From aacf8b3ae866d99d78870899c9b80184a66e0167 Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Tue, 28 May 2019 17:05:30 +0300 Subject: Version 1.4.0.3 fix priming on empty dispenser. other small bugs --- .../Embedded/Common/SWUpdate/FileSystem.c | 1 + .../Embedded_SW/Embedded/Common/SW_Info/SW_Info.c | 2 +- .../Embedded/Drivers/Motors/MotorActions.c | 2 +- .../Embedded/Modules/AlarmHandling/AlarmHandling.c | 28 ++++++++------- .../Embedded/Modules/Diagnostics/Diagnostics.c | 1 + .../Embedded/Modules/General/GeneralHardware.c | 2 ++ .../Embedded_SW/Embedded/Modules/IDS/IDS_maint.c | 41 +++++++++++++++++++++- .../Embedded_SW/Embedded/Modules/IDS/IDS_print.c | 1 + .../Embedded/Modules/Thread/Thread_Winder.c | 14 ++++---- .../Embedded/Software Release Notes.txt | 11 ++++++ .../Embedded/StateMachines/Printing/JobSTM.c | 7 ++-- 11 files changed, 85 insertions(+), 25 deletions(-) (limited to 'Software') diff --git a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c index 68500ac88..6c0262f66 100644 --- a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c +++ b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c @@ -35,6 +35,7 @@ #include "third_party/fatfs/src/diskio.h" #include "drivers/Flash_Memory/Flash_Memory.h" #include "drivers/Flash_Memory/fatfs/ff.h" +#include "drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h" #include "third_party/fatfs/src/ffconf.h" diff --git a/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c b/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c index b2590abab..bee894585 100644 --- a/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c +++ b/Software/Embedded_SW/Embedded/Common/SW_Info/SW_Info.c @@ -20,7 +20,7 @@ typedef struct } TangoVersion_t; -TangoVersion_t _gTangoVersion = {1,4,0,2}; +TangoVersion_t _gTangoVersion = {1,4,0,3}; #define BUILD_DATE __DATE__ char Dat[50] = BUILD_DATE; char _gTangoName [MAX_STRING_LEN] = "Tango01 ";//d diff --git a/Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c b/Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c index bf96335e1..3177dc787 100644 --- a/Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c +++ b/Software/Embedded_SW/Embedded/Drivers/Motors/MotorActions.c @@ -469,7 +469,7 @@ uint32_t MotorMovetoLimitSwitch (TimerMotors_t MotorId,bool direction, uint32_t MotorTimeLag[MotorId] = eTenMillisecond; MotorTimeLimit[MotorId] = timeout; - if ((MotorId == HARDWARE_MOTOR_TYPE__MOTO_DH_CLEANHEAD)||(HARDWARE_MOTOR_TYPE__MOTO_DH_CLEANMECH)) + if ((MotorId == HARDWARE_MOTOR_TYPE__MOTO_DH_CLEANHEAD)||(HARDWARE_MOTOR_TYPE__MOTO_DH_CLEANMECH)||(HARDWARE_MOTOR_TYPE__MOTO_SCREW)) MotorTimeLag[MotorId] = 2; MotorSetDirection( MotorId, direction); diff --git a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c index 931b6674f..73532a7d2 100644 --- a/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c +++ b/Software/Embedded_SW/Embedded/Modules/AlarmHandling/AlarmHandling.c @@ -669,6 +669,8 @@ uint32_t AlarmHandling_ControlTrigger(uint32_t IfIndex, uint32_t ReadValue) return OK; } +void AlarmHandlingInternalSetAlarm(uint32_t AlarmId, bool value); + void AlarmHandlingSetAlarm(uint32_t AlarmId, bool value) { AlarmHandlingInternalSetAlarm( AlarmId, value); @@ -1024,12 +1026,12 @@ void AlarmHandlingTask(UArg arg0, UArg arg1) } } //StartEventsNotificationResponse StartEventsNotification = START_EVENTS_NOTIFICATION_RESPONSE__INIT; -StartEventsNotificationResponse response = START_EVENTS_NOTIFICATION_RESPONSE__INIT; +StartEventsNotificationResponse EventsResponse = START_EVENTS_NOTIFICATION_RESPONSE__INIT; int LargeMessagesAH = 0; void SendEventNotifications(void) { MessageContainer responseContainer; - //StartEventsNotificationResponse response = START_EVENTS_NOTIFICATION_RESPONSE__INIT; + //StartEventsNotificationResponse EventsResponse = START_EVENTS_NOTIFICATION_RESPONSE__INIT; int i,e=0; if (AlarmHandlingActive == false) @@ -1042,20 +1044,20 @@ void SendEventNotifications(void) return; } - response.n_events = 0; + EventsResponse.n_events = 0; UInt Key = Task_disable(); for (i = 0;itoken, true, &response, &upload_hardware_configuration_response__pack, &upload_hardware_configuration_response__get_packed_size); if (status!= OK) { diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c index d312dcb78..0907c4a67 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c @@ -205,6 +205,10 @@ uint32_t IDS_StopHomeDispenser (uint32_t DispenserId) Disable_MidTank_Pressure_Reading(DispenserId); Valve_Set(IDS_Id_to_AirValve[DispenserId], Atm_MidTank_OFF); Control3WayValvesWithCallback ((Valves_t)DispenserId, MidTank_Dispenser, NULL); //direction: MidTank_Dispenser or Dispenser_Mixer + if (DispenserId == LUBRICANT_DISPENSER) + { + Lubricant_2Way_Valve (START); + } MotorSetMicroStep(MotorId, MotorsCfg[MotorId].microstep); CurrentDispenserSpeed[DispenserId] = 0; @@ -227,6 +231,36 @@ uint32_t IDS_CheckDispenserLimitSwitch (LimitSwitchAlarms LS_Id) else return FPGA_Read_limit_Switches(Dispenser_Id_to_Alarm_LS_Id[LS_Id]); } +uint32_t IDS_EmptyDispenserCallback(uint32_t motorId, uint32_t ReadValue) +{ + uint8_t DispenserId = motorId-HARDWARE_MOTOR_TYPE__MOTO_DISPENSER_1; + + Read_MidTank_Pressure_Sensor(DispenserId); + //close dry air valve in the dispenser + Valve_Set(IDS_Id_to_AirValve[DispenserId], Atm_MidTank_OFF); + Disable_MidTank_Pressure_Reading(DispenserId); + + MotorStop(motorId,Hard_Hiz); + CurrentDispenserSpeed[DispenserId] = 0; + MotorSetMicroStep(motorId, MotorsCfg[motorId].microstep); + HomingActive[DispenserId]= false; + if (DispenserId == LUBRICANT_DISPENSER) + { + Lubricant_2Way_Valve (STOP); + } + + Report("End Priming",__FILE__,millisecondCounter,(int)DispenserId,RpWarning,(int)DispenserHomingTime[DispenserId],0); + //MotorSetMicroStep(motorId, MotorsCfg[motorId].microstep); + if (HomingRequestCallback[DispenserId]) + { + HomingRequestCallback[DispenserId](DispenserId,0); + HomingRequestCallback[DispenserId] = NULL; + } + + +return OK; + +} uint32_t IDS_EmptyDispenser (uint32_t DispenserId, uint32_t speed , callback_fptr callback) { @@ -254,8 +288,13 @@ uint32_t IDS_EmptyDispenser (uint32_t DispenserId, uint32_t speed , callback_fpt IDS_Dispenser_RefillStarted(DispenserId); IDS_Dispenser_MovingDirection(DispenserId,UP); + if (DispenserId == LUBRICANT_DISPENSER) + { + Lubricant_2Way_Valve (START); + } + - MotorMovetoLimitSwitch (MotorId,MotorsCfg[MotorId].directionthreadwize, speed, Dispenser_Id_to_LS_Empty_Id[DispenserId], IDS_HomeDispenserCallback,0); + MotorMovetoLimitSwitch (MotorId,MotorsCfg[MotorId].directionthreadwize, speed, Dispenser_Id_to_LS_Empty_Id[DispenserId], IDS_EmptyDispenserCallback,0); CurrentDispenserSpeed[DispenserId] = speed; return OK; } diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c index 1d395ec8c..aea16bb60 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c @@ -7,6 +7,7 @@ #include "ids.h" #include "ids_ex.h" #include "../control/control.h" +#include "../control/MillisecTask.h" #include "../general/process.h" #include "../control/pidalgo.h" #include "../thread/thread.h" diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c index 9ebc32f57..a68995168 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.c @@ -223,7 +223,7 @@ double WinderReferenceSpeed=0; double TotalWinderSpeed=0; bool Add100 = false; double Rotations = 6.0; -bool flipflop = false; +int flipflop = 0; uint32_t motspeed; float speedf; int WinderCalculation = 0; @@ -250,20 +250,20 @@ uint32_t Screw100msecDirectionChange(uint32_t deviceID, uint32_t BusyFlag) WinderMotorSpeedRollOver=true; } // } - if (flipflop) + if (flipflop == 0) { - speedf = MotorGetSpeedFromFPGA_Res(HARDWARE_MOTOR_TYPE__MOTO_SCREW); + MotorGetSpeedFromFPGA1(HARDWARE_MOTOR_TYPE__MOTO_SCREW); } - else + else if (flipflop == 1) { - MotorGetSpeedFromFPGA1(HARDWARE_MOTOR_TYPE__MOTO_SCREW); + speedf = MotorGetSpeedFromFPGA_Res(HARDWARE_MOTOR_TYPE__MOTO_SCREW); } - flipflop = 1-flipflop; + flipflop ++; if (ScrewDirectionChangeCounter == CalculationDirectionChangeCounter) return OK; //deley TODO - + flipflop = 0; ScrewCurrentDirection = 1-ScrewCurrentDirection; CalculationDirectionChangeCounter++; diff --git a/Software/Embedded_SW/Embedded/Software Release Notes.txt b/Software/Embedded_SW/Embedded/Software Release Notes.txt index a6a82ae6d..32d5e73b2 100644 --- a/Software/Embedded_SW/Embedded/Software Release Notes.txt +++ b/Software/Embedded_SW/Embedded/Software Release Notes.txt @@ -1,3 +1,14 @@ +Embedded SW Release note - Version 1.3.10.6 - Itma Candidate 5 +============================================================= +change winding - fixed speed + +Embedded SW Release note - Version 1.3.10.5 - Itma Candidate 4 +============================================================= +bug fixes and work around: segment free, usb log, job length, length measurements, heating +better support for new and older dispensers +waste indication - empty and full + + Embedded SW Release note - Version 1.3.10.2 - Itma Candidate 3 ============================================================= Machine: diff --git a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c index 7ad887925..f5ae89368 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c @@ -743,6 +743,7 @@ void SendJobProgress(double ProcessedLength, int SegmentId, bool done, char *Mes Report(infomsg,__FILE__,__LINE__,55,RpWarning,33, 44); }*/ UInt Key = Task_disable(); + double totlength = 0; if (JobToken[0] != 0) { @@ -753,12 +754,14 @@ void SendJobProgress(double ProcessedLength, int SegmentId, bool done, char *Mes } //previousJobLength = ProcessedLength; jobStatus.has_progress = true; + totlength = TotalProcessedLength; if (TotalProcessedLength > job_length) { Report("job length bigger than assigned",__FILE__,__LINE__,TotalProcessedLength,RpWarning,job_length, done); - TotalProcessedLength = job_length; + //TotalProcessedLength = job_length; + totlength = job_length; } - jobStatus.progress = TotalProcessedLength; + jobStatus.progress = totlength; jobStatus.has_currentsegmentindex = true; jobStatus.currentsegmentindex = SegmentId; -- cgit v1.3.1 From f5566ee2e5b8891cfff0a8207d10d0d62c354f0d Mon Sep 17 00:00:00 2001 From: Victoria Plitt Date: Tue, 28 May 2019 18:15:19 +0300 Subject: App/TCC added new result request to server by date , email and device model --- .../TCC/Tango.TCC.BL/Tango.TCC.BL.csproj | 1 + .../TCC/Tango.TCC.BL/Web/ResultsByDateRequest.cs | 17 + .../details-card/details-card.component.html | 23 +- .../details-card/details-card.component.ts | 32 +- .../app/components/results/results.component.html | 50 +- .../app/components/results/results.component.ts | 41 +- .../App/TCC/src/app/models/resultDTO.ts | 3 + .../App/TCC/src/app/services/results.service.ts | 70 +- .../TCC/Tango.TCC.Service/Bundles/index.html | 2 +- .../Bundles/main.2e9f4f34cba0d8b1989d.js | 145003 ----------------- .../Bundles/main.2e9f4f34cba0d8b1989d.js.map | 1 - .../Bundles/main.ff33a041858b0cc46d07.js | 145288 ++++++++++++++++++ .../Bundles/main.ff33a041858b0cc46d07.js.map | 1 + .../Controllers/ResultsController.cs | 61 +- .../TCC/Tango.TCC.Service/DTO/ResultDTO.cs | 10 +- .../ExtensionMethods/DateTimeExtensions.cs | 13 + 16 files changed, 145485 insertions(+), 145131 deletions(-) create mode 100644 Software/Visual_Studio/TCC/Tango.TCC.BL/Web/ResultsByDateRequest.cs delete mode 100644 Software/Visual_Studio/TCC/Tango.TCC.Service/Bundles/main.2e9f4f34cba0d8b1989d.js delete mode 100644 Software/Visual_Studio/TCC/Tango.TCC.Service/Bundles/main.2e9f4f34cba0d8b1989d.js.map create mode 100644 Software/Visual_Studio/TCC/Tango.TCC.Service/Bundles/main.ff33a041858b0cc46d07.js create mode 100644 Software/Visual_Studio/TCC/Tango.TCC.Service/Bundles/main.ff33a041858b0cc46d07.js.map (limited to 'Software') diff --git a/Software/Visual_Studio/TCC/Tango.TCC.BL/Tango.TCC.BL.csproj b/Software/Visual_Studio/TCC/Tango.TCC.BL/Tango.TCC.BL.csproj index 04b008be6..30a01d23d 100644 --- a/Software/Visual_Studio/TCC/Tango.TCC.BL/Tango.TCC.BL.csproj +++ b/Software/Visual_Studio/TCC/Tango.TCC.BL/Tango.TCC.BL.csproj @@ -80,6 +80,7 @@ + diff --git a/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/ResultsByDateRequest.cs b/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/ResultsByDateRequest.cs new file mode 100644 index 000000000..db370879f --- /dev/null +++ b/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/ResultsByDateRequest.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Transport.Web; + +namespace Tango.TCC.BL.Web +{ + public class ResultsByDateRequest : WebRequestMessage + { + public String From { get; set; } + public String To { get; set; } + public String Email { get; set; } + public String DeviceModel { get; set; } + } +} diff --git a/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/components/details-card/details-card.component.html b/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/components/details-card/details-card.component.html index 24649e46e..2f6dcc4c5 100644 --- a/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/components/details-card/details-card.component.html +++ b/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/components/details-card/details-card.component.html @@ -58,11 +58,11 @@ Raw Color -
+
-
+
R:{{selectedResult.RawColorRGB.r}} G:{{selectedResult.RawColorRGB.g}} B:{{selectedResult.RawColorRGB.b}}
@@ -196,6 +196,16 @@ {{element.value}} + + + +
+ +
+ +
@@ -210,11 +220,11 @@ Raw Color -
+
-
+

R:{{selectedResult.RawColorRGB.r}} G:{{selectedResult.RawColorRGB.g}} B:{{selectedResult.RawColorRGB.b}}

@@ -228,12 +238,13 @@
Processed Color
-
+
-

R:{{selectedResult.ProcessedColorRGB.r}} +

+

R:{{selectedResult.ProcessedColorRGB.r}} G:{{selectedResult.ProcessedColorRGB.g}} B:{{selectedResult.ProcessedColorRGB.b}}

diff --git a/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/components/details-card/details-card.component.ts b/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/components/details-card/details-card.component.ts index 96502286c..36e7980cd 100644 --- a/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/components/details-card/details-card.component.ts +++ b/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/components/details-card/details-card.component.ts @@ -19,7 +19,7 @@ export class DetailsCardComponent implements OnInit { @Input() public view: string; public cardTable = new MatTableDataSource(); displayedCardColumns: string[] = ['cardname', 'value', 'linktoCard']; - displayedDeviceColumns: string[] = ['deviceName', 'deviceValue']; + displayedDeviceColumns: string[] = ['deviceName', 'deviceValue', 'linktoDevice']; public deviceTable = new MatTableDataSource(); constructor() { } @@ -36,26 +36,26 @@ export class DetailsCardComponent implements OnInit { this.deviceProperties = []; this.selectedResult = selResult; if (this.selectedResult) { - if (this.selectedResult.Card) { + //if (this.selectedResult.Card) { //const array = Object.entries(this.selectedResult.Card); // array.forEach(([key, rvalue]) => { // if (key !== 'Template' && key !== 'PDFPath' && key !== 'SCVPath') { - this.cards.push({ name: 'Card Guid', value: this.selectedResult.Card.CardGuid }); + this.cards.push({ name: 'Card ID', value: this.selectedResult.CardCode }); //} //}); - } - if (this.selectedResult.Device) { - const array = Object.entries(this.selectedResult.Device); - array.forEach(([key, rvalue]) => { - { - let displayValue = rvalue; - if(key === 'LastLogin'){ - displayValue = this.selectedResult.Device.getDateFormatString(); - } - this.deviceProperties.push({ name: key, value: displayValue }); - } - }); - } + //} + // if (this.selectedResult.Device) { + // const array = Object.entries(this.selectedResult.Device); + // array.forEach(([key, rvalue]) => { + // { + // let displayValue = rvalue; + // if(key === 'LastLogin'){ + // displayValue = this.selectedResult.Device.getDateFormatString(); + // } + this.deviceProperties.push({ name: 'Device ID', value: this.selectedResult.DeviceGuid }); + // } + // }); + //} } this.cardTable.data = this.cards; this.deviceTable.data = this.deviceProperties; diff --git a/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/components/results/results.component.html b/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/components/results/results.component.html index 5d3b463a1..a47337a35 100644 --- a/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/components/results/results.component.html +++ b/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/components/results/results.component.html @@ -1,28 +1,34 @@
- +
- - - - - - + + + + + + + + + + + + + + + + Please enter a valid email address + + - - - - - - - - - - + + - +
-
+
R:{{element.ProcessedColorRGB.r}} G:{{element.ProcessedColorRGB.g}} B:{{element.ProcessedColorRGB.b}} @@ -68,7 +74,7 @@
- + @@ -80,7 +86,7 @@ -
+
\ No newline at end of file diff --git a/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/components/results/results.component.ts b/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/components/results/results.component.ts index 18466fdce..d536b723b 100644 --- a/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/components/results/results.component.ts +++ b/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/components/results/results.component.ts @@ -1,7 +1,7 @@ import { Component, OnInit, ViewChild, AfterViewInit } from '@angular/core'; import { ResultDTO, RGB, RGBColor } from './../../models'; import { ResultService } from './../../services'; -import { MatSort, MatTableDataSource, MatPaginator } from '@angular/material'; +import { MatSort, MatTableDataSource, MatPaginator, DateAdapter } from '@angular/material'; import { environment } from './../../../environments/environment'; import { DetailsCardComponent } from '../details-card/details-card.component'; import { FormControl, FormBuilder, Validators, FormGroup } from '@angular/forms'; @@ -23,9 +23,10 @@ export class ResultsComponent implements OnInit, AfterViewInit { private detailsCardComponent: DetailsCardComponent; - searchForm: FormGroup; - fromDate = new FormControl(new Date()); - toDate = new FormControl((new Date()).toISOString()); + fromDate = new FormControl(new Date(), Validators.required); + toDate = new FormControl(new Date(), Validators.required); + email = new FormControl('', Validators.email); + devicemodel = new FormControl(''); @ViewChild(MatSort) sort: MatSort; @ViewChild(MatPaginator) paginator: MatPaginator; @@ -33,25 +34,20 @@ export class ResultsComponent implements OnInit, AfterViewInit { @ViewChild('detailsCard') set content(content: DetailsCardComponent) { this.detailsCardComponent = content; } - constructor(private resultService: ResultService, private fb: FormBuilder) { + constructor(private resultService: ResultService, private fb: FormBuilder, private dateAdapter: DateAdapter) { this.selectedResult = null; - this.searchForm = fb.group({ - fromDate: ['', Validators.required], - toDate: ['', Validators.required], - email: ['',], - devicemodel: [''] - }); + dateAdapter.setLocale('en-in'); // DD/MM/YYYY } ngOnInit() { - this.getResults(); + //this.getResults(); this.dataSource.filterPredicate = (data: ResultDTO, filter: string) => { return JSON.stringify(data.Device).trim().toLowerCase().indexOf(filter) !== -1; }; } // tslint:disable-next-line: use-life-cycle-interface ngAfterViewInit() { - this.getResults(); + //this.getResults(); this.dataSource.sort = this.sort; this.dataSource.sortingDataAccessor = (item, property) => { switch (property) { @@ -71,13 +67,20 @@ export class ResultsComponent implements OnInit, AfterViewInit { this.detailsCardComponent.updateCards(this.selectedResult); } } + toUTCDate(date: Date) { + const utc = new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), + date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds()); + return utc; + } getResults() { this.dataSource.data = []; - this.resultService.getResults(10).subscribe((data: {}) => { - console.log(data); - this.dataSource.data = data as ResultDTO[] || []; - }); + const fromdate: Date = this.fromDate.value as Date; + const todate: Date = this.toDate.value as Date; + const fromUTS = this.toUTCDate(fromdate).toISOString(); + const toUTS = this.toUTCDate(todate).toISOString(); + this.resultService.getResults(fromUTS, toUTS, + this.devicemodel.value, this.email.value).subscribe((data: {}) => { + this.dataSource.data = data as ResultDTO[] || []; + }); } - - } diff --git a/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/models/resultDTO.ts b/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/models/resultDTO.ts index 8e2e05c10..5d0079796 100644 --- a/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/models/resultDTO.ts +++ b/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/models/resultDTO.ts @@ -14,6 +14,9 @@ export class ResultDTO { ProcessTime: number; SampleImageBlobName: string; SourceImageBlobName: string; + DeviceModel: string; + CardCode: string; + Email: string; Card: CardDTO; Device: DeviceDTO; diff --git a/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/services/results.service.ts b/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/services/results.service.ts index 477276090..ebe912e93 100644 --- a/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/services/results.service.ts +++ b/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/services/results.service.ts @@ -16,8 +16,11 @@ export interface ResponseResult { ProcessTime: number; SampleImageBlobName: string; SourceImageBlobName: string; - Device: ResponseDevice; - Card: ResponseCard; + DeviceModel: string; + CardCode: string; + Email: string; + //Device: ResponseDevice; + //Card: ResponseCard; } export interface ResponseDevice { DeviceID: string; @@ -90,36 +93,39 @@ export class ResultService { res.SourceImageBlobName = rowRes.SampleImageBlobName; res.ProcessTime = rowRes.ProcessTime; res.InitRGB(); + res.CardCode = rowRes.CardCode; + res.DeviceModel = rowRes.DeviceModel; + res.Email = rowRes.Email; - const card: CardDTO = new CardDTO(); - const responseCard = rowRes.Card; - if (responseCard) { - card.CardGuid = responseCard.CardGuid; - card.Columns = responseCard.Columns; - card.Date = new Date(responseCard.Date); - card.Rows = responseCard.Rows; - card.TargetIndex = responseCard.TargetIndex; - card.SampleWidth = responseCard.SampleWidth; - card.SampleHeighth = responseCard.SampleHeight; - card.EnableDoubleChecking = responseCard.EnableDoubleChecking; - card.EnforceBarcodeDetection = responseCard.EnforceBarcodeDetection; - //card.PDFPath = responseCard.PDFPath; - card.Version = responseCard.Version; - card.Batch = responseCard.Batch; - card.IsHomePrinted = responseCard.IsHomePrinted; - } + const card: CardDTO = new CardDTO(); + // const responseCard = rowRes.Card; + // if (responseCard) { + // card.CardGuid = responseCard.CardGuid; + // card.Columns = responseCard.Columns; + // card.Date = new Date(responseCard.Date); + // card.Rows = responseCard.Rows; + // card.TargetIndex = responseCard.TargetIndex; + // card.SampleWidth = responseCard.SampleWidth; + // card.SampleHeighth = responseCard.SampleHeight; + // card.EnableDoubleChecking = responseCard.EnableDoubleChecking; + // card.EnforceBarcodeDetection = responseCard.EnforceBarcodeDetection; + // //card.PDFPath = responseCard.PDFPath; + // card.Version = responseCard.Version; + // card.Batch = responseCard.Batch; + // card.IsHomePrinted = responseCard.IsHomePrinted; + // } res.Card = card; const device = new DeviceDTO(); - const responseDevice = rowRes.Device; - if (responseDevice) { - device.DeviceID = responseDevice.DeviceID; - device.DeviceModel = responseDevice.DeviceModel; - device.Email = responseDevice.Email; - device.LastLogin = new Date(responseDevice.LastLogin); - device.MachineRegistered = responseDevice.MachineRegistered; - device.OSVersion = responseDevice.OSVersion; - device.OrganizationGuid = responseDevice.OrganizationGuid; - } + // const responseDevice = rowRes.Device; + // if (responseDevice) { + // device.DeviceID = responseDevice.DeviceID; + // device.DeviceModel = responseDevice.DeviceModel; + // device.Email = responseDevice.Email; + // device.LastLogin = new Date(responseDevice.LastLogin); + // device.MachineRegistered = responseDevice.MachineRegistered; + // device.OSVersion = responseDevice.OSVersion; + // device.OrganizationGuid = responseDevice.OrganizationGuid; + // } res.Device = device; this.detectionResults.push(res); } @@ -145,9 +151,9 @@ export class ResultService { return card; } - getResults(rcount: number): Observable { - const parameters = new HttpParams().set('count', rcount.toString()); - //http://localhost:52322/api/Results/GetResults?count=10 + getResults(from: string, to: string, model: string, email: string): Observable { + const parameters = new HttpParams().set('From', from).set('To', to).set('Email', email).set('DeviceModel', model); + //http://localhost:52322/api/Results/GetResults?from=..&to=...&Email=..&DeviceModel=... return this.http.get(environment.apiUrl + '/api/Results/GetResults', { params: parameters }).pipe( map(this.extractData), catchError(this.handleError('getResults'))); diff --git a/Software/Visual_Studio/TCC/Tango.TCC.Service/Bundles/index.html b/Software/Visual_Studio/TCC/Tango.TCC.Service/Bundles/index.html index 7a81e28f1..0a9ff5263 100644 --- a/Software/Visual_Studio/TCC/Tango.TCC.Service/Bundles/index.html +++ b/Software/Visual_Studio/TCC/Tango.TCC.Service/Bundles/index.html @@ -11,5 +11,5 @@ - + diff --git a/Software/Visual_Studio/TCC/Tango.TCC.Service/Bundles/main.2e9f4f34cba0d8b1989d.js b/Software/Visual_Studio/TCC/Tango.TCC.Service/Bundles/main.2e9f4f34cba0d8b1989d.js deleted file mode 100644 index 98d181b3e..000000000 --- a/Software/Visual_Studio/TCC/Tango.TCC.Service/Bundles/main.2e9f4f34cba0d8b1989d.js +++ /dev/null @@ -1,145003 +0,0 @@ -(window["webpackJsonp"] = window["webpackJsonp"] || []).push([["main"],{ - -/***/ "./node_modules/@angular/animations/fesm5/animations.js": -/*!**************************************************************!*\ - !*** ./node_modules/@angular/animations/fesm5/animations.js ***! - \**************************************************************/ -/*! exports provided: AnimationBuilder, AnimationFactory, AUTO_STYLE, animate, animateChild, animation, group, keyframes, query, sequence, stagger, state, style, transition, trigger, useAnimation, NoopAnimationPlayer, ɵPRE_STYLE, ɵAnimationGroupPlayer */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AnimationBuilder", function() { return AnimationBuilder; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AnimationFactory", function() { return AnimationFactory; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AUTO_STYLE", function() { return AUTO_STYLE; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "animate", function() { return animate; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "animateChild", function() { return animateChild; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "animation", function() { return animation; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "group", function() { return group; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "keyframes", function() { return keyframes; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "query", function() { return query; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sequence", function() { return sequence; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "stagger", function() { return stagger; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "state", function() { return state; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "style", function() { return style; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "transition", function() { return transition; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "trigger", function() { return trigger; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useAnimation", function() { return useAnimation; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NoopAnimationPlayer", function() { return NoopAnimationPlayer; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵPRE_STYLE", function() { return ɵPRE_STYLE; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵAnimationGroupPlayer", function() { return AnimationGroupPlayer; }); -/** - * @license Angular v7.2.13 - * (c) 2010-2019 Google LLC. https://angular.io/ - * License: MIT - */ - -/** - * An injectable service that produces an animation sequence programmatically within an - * Angular component or directive. - * Provided by the `BrowserAnimationsModule` or `NoopAnimationsModule`. - * - * @usageNotes - * - * To use this service, add it to your component or directive as a dependency. - * The service is instantiated along with your component. - * - * Apps do not typically need to create their own animation players, but if you - * do need to, follow these steps: - * - * 1. Use the `build()` method to create a programmatic animation using the - * `animate()` function. The method returns an `AnimationFactory` instance. - * - * 2. Use the factory object to create an `AnimationPlayer` and attach it to a DOM element. - * - * 3. Use the player object to control the animation programmatically. - * - * For example: - * - * ```ts - * // import the service from BrowserAnimationsModule - * import {AnimationBuilder} from '@angular/animations'; - * // require the service as a dependency - * class MyCmp { - * constructor(private _builder: AnimationBuilder) {} - * - * makeAnimation(element: any) { - * // first define a reusable animation - * const myAnimation = this._builder.build([ - * style({ width: 0 }), - * animate(1000, style({ width: '100px' })) - * ]); - * - * // use the returned factory object to create a player - * const player = myAnimation.create(element); - * - * player.play(); - * } - * } - * ``` - * - * @publicApi - */ -var AnimationBuilder = /** @class */ (function () { - function AnimationBuilder() { - } - return AnimationBuilder; -}()); -/** - * A factory object returned from the `AnimationBuilder`.`build()` method. - * - * @publicApi - */ -var AnimationFactory = /** @class */ (function () { - function AnimationFactory() { - } - return AnimationFactory; -}()); - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -/** - * Specifies automatic styling. - * - * @publicApi - */ -var AUTO_STYLE = '*'; -/** - * Creates a named animation trigger, containing a list of `state()` - * and `transition()` entries to be evaluated when the expression - * bound to the trigger changes. - * - * @param name An identifying string. - * @param definitions An animation definition object, containing an array of `state()` - * and `transition()` declarations. - * - * @return An object that encapsulates the trigger data. - * - * @usageNotes - * Define an animation trigger in the `animations` section of `@Component` metadata. - * In the template, reference the trigger by name and bind it to a trigger expression that - * evaluates to a defined animation state, using the following format: - * - * `[@triggerName]="expression"` - * - * Animation trigger bindings convert all values to strings, and then match the - * previous and current values against any linked transitions. - * Booleans can be specified as `1` or `true` and `0` or `false`. - * - * ### Usage Example - * - * The following example creates an animation trigger reference based on the provided - * name value. - * The provided animation value is expected to be an array consisting of state and - * transition declarations. - * - * ```typescript - * @Component({ - * selector: "my-component", - * templateUrl: "my-component-tpl.html", - * animations: [ - * trigger("myAnimationTrigger", [ - * state(...), - * state(...), - * transition(...), - * transition(...) - * ]) - * ] - * }) - * class MyComponent { - * myStatusExp = "something"; - * } - * ``` - * - * The template associated with this component makes use of the defined trigger - * by binding to an element within its template code. - * - * ```html - * - *
...
- * ``` - * - * ### Using an inline function - * The `transition` animation method also supports reading an inline function which can decide - * if its associated animation should be run. - * - * ```typescript - * // this method is run each time the `myAnimationTrigger` trigger value changes. - * function myInlineMatcherFn(fromState: string, toState: string, element: any, params: {[key: - string]: any}): boolean { - * // notice that `element` and `params` are also available here - * return toState == 'yes-please-animate'; - * } - * - * @Component({ - * selector: 'my-component', - * templateUrl: 'my-component-tpl.html', - * animations: [ - * trigger('myAnimationTrigger', [ - * transition(myInlineMatcherFn, [ - * // the animation sequence code - * ]), - * ]) - * ] - * }) - * class MyComponent { - * myStatusExp = "yes-please-animate"; - * } - * ``` - * - * ### Disabling Animations - * When true, the special animation control binding `@.disabled` binding prevents - * all animations from rendering. - * Place the `@.disabled` binding on an element to disable - * animations on the element itself, as well as any inner animation triggers - * within the element. - * - * The following example shows how to use this feature: - * - * ```typescript - * @Component({ - * selector: 'my-component', - * template: ` - *
- *
- *
- * `, - * animations: [ - * trigger("childAnimation", [ - * // ... - * ]) - * ] - * }) - * class MyComponent { - * isDisabled = true; - * exp = '...'; - * } - * ``` - * - * When `@.disabled` is true, it prevents the `@childAnimation` trigger from animating, - * along with any inner animations. - * - * ### Disable animations application-wide - * When an area of the template is set to have animations disabled, - * **all** inner components have their animations disabled as well. - * This means that you can disable all animations for an app - * by placing a host binding set on `@.disabled` on the topmost Angular component. - * - * ```typescript - * import {Component, HostBinding} from '@angular/core'; - * - * @Component({ - * selector: 'app-component', - * templateUrl: 'app.component.html', - * }) - * class AppComponent { - * @HostBinding('@.disabled') - * public animationsDisabled = true; - * } - * ``` - * - * ### Overriding disablement of inner animations - * Despite inner animations being disabled, a parent animation can `query()` - * for inner elements located in disabled areas of the template and still animate - * them if needed. This is also the case for when a sub animation is - * queried by a parent and then later animated using `animateChild()`. - * - * ### Detecting when an animation is disabled - * If a region of the DOM (or the entire application) has its animations disabled, the animation - * trigger callbacks still fire, but for zero seconds. When the callback fires, it provides - * an instance of an `AnimationEvent`. If animations are disabled, - * the `.disabled` flag on the event is true. - * - * @publicApi - */ -function trigger(name, definitions) { - return { type: 7 /* Trigger */, name: name, definitions: definitions, options: {} }; -} -/** - * Defines an animation step that combines styling information with timing information. - * - * @param timings Sets `AnimateTimings` for the parent animation. - * A string in the format "duration [delay] [easing]". - * - Duration and delay are expressed as a number and optional time unit, - * such as "1s" or "10ms" for one second and 10 milliseconds, respectively. - * The default unit is milliseconds. - * - The easing value controls how the animation accelerates and decelerates - * during its runtime. Value is one of `ease`, `ease-in`, `ease-out`, - * `ease-in-out`, or a `cubic-bezier()` function call. - * If not supplied, no easing is applied. - * - * For example, the string "1s 100ms ease-out" specifies a duration of - * 1000 milliseconds, and delay of 100 ms, and the "ease-out" easing style, - * which decelerates near the end of the duration. - * @param styles Sets AnimationStyles for the parent animation. - * A function call to either `style()` or `keyframes()` - * that returns a collection of CSS style entries to be applied to the parent animation. - * When null, uses the styles from the destination state. - * This is useful when describing an animation step that will complete an animation; - * see "Animating to the final state" in `transitions()`. - * @returns An object that encapsulates the animation step. - * - * @usageNotes - * Call within an animation `sequence()`, `{@link animations/group group()}`, or - * `transition()` call to specify an animation step - * that applies given style data to the parent animation for a given amount of time. - * - * ### Syntax Examples - * **Timing examples** - * - * The following examples show various `timings` specifications. - * - `animate(500)` : Duration is 500 milliseconds. - * - `animate("1s")` : Duration is 1000 milliseconds. - * - `animate("100ms 0.5s")` : Duration is 100 milliseconds, delay is 500 milliseconds. - * - `animate("5s ease-in")` : Duration is 5000 milliseconds, easing in. - * - `animate("5s 10ms cubic-bezier(.17,.67,.88,.1)")` : Duration is 5000 milliseconds, delay is 10 - * milliseconds, easing according to a bezier curve. - * - * **Style examples** - * - * The following example calls `style()` to set a single CSS style. - * ```typescript - * animate(500, style({ background: "red" })) - * ``` - * The following example calls `keyframes()` to set a CSS style - * to different values for successive keyframes. - * ```typescript - * animate(500, keyframes( - * [ - * style({ background: "blue" })), - * style({ background: "red" })) - * ]) - * ``` - * - * @publicApi - */ -function animate(timings, styles) { - if (styles === void 0) { styles = null; } - return { type: 4 /* Animate */, styles: styles, timings: timings }; -} -/** - * @description Defines a list of animation steps to be run in parallel. - * - * @param steps An array of animation step objects. - * - When steps are defined by `style()` or `animate()` - * function calls, each call within the group is executed instantly. - * - To specify offset styles to be applied at a later time, define steps with - * `keyframes()`, or use `animate()` calls with a delay value. - * For example: - * - * ```typescript - * group([ - * animate("1s", style({ background: "black" })), - * animate("2s", style({ color: "white" })) - * ]) - * ``` - * - * @param options An options object containing a delay and - * developer-defined parameters that provide styling defaults and - * can be overridden on invocation. - * - * @return An object that encapsulates the group data. - * - * @usageNotes - * Grouped animations are useful when a series of styles must be - * animated at different starting times and closed off at different ending times. - * - * When called within a `sequence()` or a - * `transition()` call, does not continue to the next - * instruction until all of the inner animation steps have completed. - * - * @publicApi - */ -function group(steps, options) { - if (options === void 0) { options = null; } - return { type: 3 /* Group */, steps: steps, options: options }; -} -/** - * Defines a list of animation steps to be run sequentially, one by one. - * - * @param steps An array of animation step objects. - * - Steps defined by `style()` calls apply the styling data immediately. - * - Steps defined by `animate()` calls apply the styling data over time - * as specified by the timing data. - * - * ```typescript - * sequence([ - * style({ opacity: 0 })), - * animate("1s", style({ opacity: 1 })) - * ]) - * ``` - * - * @param options An options object containing a delay and - * developer-defined parameters that provide styling defaults and - * can be overridden on invocation. - * - * @return An object that encapsulates the sequence data. - * - * @usageNotes - * When you pass an array of steps to a - * `transition()` call, the steps run sequentially by default. - * Compare this to the `{@link animations/group group()}` call, which runs animation steps in parallel. - * - * When a sequence is used within a `{@link animations/group group()}` or a `transition()` call, - * execution continues to the next instruction only after each of the inner animation - * steps have completed. - * - * @publicApi - **/ -function sequence(steps, options) { - if (options === void 0) { options = null; } - return { type: 2 /* Sequence */, steps: steps, options: options }; -} -/** - * Declares a key/value object containing CSS properties/styles that - * can then be used for an animation `state`, within an animation `sequence`, - * or as styling data for calls to `animate()` and `keyframes()`. - * - * @param tokens A set of CSS styles or HTML styles associated with an animation state. - * The value can be any of the following: - * - A key-value style pair associating a CSS property with a value. - * - An array of key-value style pairs. - * - An asterisk (*), to use auto-styling, where styles are derived from the element - * being animated and applied to the animation when it starts. - * - * Auto-styling can be used to define a state that depends on layout or other - * environmental factors. - * - * @return An object that encapsulates the style data. - * - * @usageNotes - * The following examples create animation styles that collect a set of - * CSS property values: - * - * ```typescript - * // string values for CSS properties - * style({ background: "red", color: "blue" }) - * - * // numerical pixel values - * style({ width: 100, height: 0 }) - * ``` - * - * The following example uses auto-styling to allow a component to animate from - * a height of 0 up to the height of the parent element: - * - * ``` - * style({ height: 0 }), - * animate("1s", style({ height: "*" })) - * ``` - * - * @publicApi - **/ -function style(tokens) { - return { type: 6 /* Style */, styles: tokens, offset: null }; -} -/** - * Declares an animation state within a trigger attached to an element. - * - * @param name One or more names for the defined state in a comma-separated string. - * The following reserved state names can be supplied to define a style for specific use - * cases: - * - * - `void` You can associate styles with this name to be used when - * the element is detached from the application. For example, when an `ngIf` evaluates - * to false, the state of the associated element is void. - * - `*` (asterisk) Indicates the default state. You can associate styles with this name - * to be used as the fallback when the state that is being animated is not declared - * within the trigger. - * - * @param styles A set of CSS styles associated with this state, created using the - * `style()` function. - * This set of styles persists on the element once the state has been reached. - * @param options Parameters that can be passed to the state when it is invoked. - * 0 or more key-value pairs. - * @return An object that encapsulates the new state data. - * - * @usageNotes - * Use the `trigger()` function to register states to an animation trigger. - * Use the `transition()` function to animate between states. - * When a state is active within a component, its associated styles persist on the element, - * even when the animation ends. - * - * @publicApi - **/ -function state(name, styles, options) { - return { type: 0 /* State */, name: name, styles: styles, options: options }; -} -/** - * Defines a set of animation styles, associating each style with an optional `offset` value. - * - * @param steps A set of animation styles with optional offset data. - * The optional `offset` value for a style specifies a percentage of the total animation - * time at which that style is applied. - * @returns An object that encapsulates the keyframes data. - * - * @usageNotes - * Use with the `animate()` call. Instead of applying animations - * from the current state - * to the destination state, keyframes describe how each style entry is applied and at what point - * within the animation arc. - * Compare [CSS Keyframe Animations](https://www.w3schools.com/css/css3_animations.asp). - * - * ### Usage - * - * In the following example, the offset values describe - * when each `backgroundColor` value is applied. The color is red at the start, and changes to - * blue when 20% of the total time has elapsed. - * - * ```typescript - * // the provided offset values - * animate("5s", keyframes([ - * style({ backgroundColor: "red", offset: 0 }), - * style({ backgroundColor: "blue", offset: 0.2 }), - * style({ backgroundColor: "orange", offset: 0.3 }), - * style({ backgroundColor: "black", offset: 1 }) - * ])) - * ``` - * - * If there are no `offset` values specified in the style entries, the offsets - * are calculated automatically. - * - * ```typescript - * animate("5s", keyframes([ - * style({ backgroundColor: "red" }) // offset = 0 - * style({ backgroundColor: "blue" }) // offset = 0.33 - * style({ backgroundColor: "orange" }) // offset = 0.66 - * style({ backgroundColor: "black" }) // offset = 1 - * ])) - *``` - - * @publicApi - */ -function keyframes(steps) { - return { type: 5 /* Keyframes */, steps: steps }; -} -/** - * Declares an animation transition as a sequence of animation steps to run when a given - * condition is satisfied. The condition is a Boolean expression or function that compares - * the previous and current animation states, and returns true if this transition should occur. - * When the state criteria of a defined transition are met, the associated animation is - * triggered. - * - * @param stateChangeExpr A Boolean expression or function that compares the previous and current - * animation states, and returns true if this transition should occur. Note that "true" and "false" - * match 1 and 0, respectively. An expression is evaluated each time a state change occurs in the - * animation trigger element. - * The animation steps run when the expression evaluates to true. - * - * - A state-change string takes the form "state1 => state2", where each side is a defined animation - * state, or an asterix (*) to refer to a dynamic start or end state. - * - The expression string can contain multiple comma-separated statements; - * for example "state1 => state2, state3 => state4". - * - Special values `:enter` and `:leave` initiate a transition on the entry and exit states, - * equivalent to "void => *" and "* => void". - * - Special values `:increment` and `:decrement` initiate a transition when a numeric value has - * increased or decreased in value. - * - A function is executed each time a state change occurs in the animation trigger element. - * The animation steps run when the function returns true. - * - * @param steps One or more animation objects, as returned by the `animate()` or - * `sequence()` function, that form a transformation from one state to another. - * A sequence is used by default when you pass an array. - * @param options An options object that can contain a delay value for the start of the animation, - * and additional developer-defined parameters. Provided values for additional parameters are used - * as defaults, and override values can be passed to the caller on invocation. - * @returns An object that encapsulates the transition data. - * - * @usageNotes - * The template associated with a component binds an animation trigger to an element. - * - * ```HTML - * - *
...
- * ``` - * - * All transitions are defined within an animation trigger, - * along with named states that the transitions change to and from. - * - * ```typescript - * trigger("myAnimationTrigger", [ - * // define states - * state("on", style({ background: "green" })), - * state("off", style({ background: "grey" })), - * ...] - * ``` - * - * Note that when you call the `sequence()` function within a `{@link animations/group group()}` - * or a `transition()` call, execution does not continue to the next instruction - * until each of the inner animation steps have completed. - * - * ### Syntax examples - * - * The following examples define transitions between the two defined states (and default states), - * using various options: - * - * ```typescript - * // Transition occurs when the state value - * // bound to "myAnimationTrigger" changes from "on" to "off" - * transition("on => off", animate(500)) - * // Run the same animation for both directions - * transition("on <=> off", animate(500)) - * // Define multiple state-change pairs separated by commas - * transition("on => off, off => void", animate(500)) - * ``` - * - * ### Special values for state-change expressions - * - * - Catch-all state change for when an element is inserted into the page and the - * destination state is unknown: - * - * ```typescript - * transition("void => *", [ - * style({ opacity: 0 }), - * animate(500) - * ]) - * ``` - * - * - Capture a state change between any states: - * - * `transition("* => *", animate("1s 0s"))` - * - * - Entry and exit transitions: - * - * ```typescript - * transition(":enter", [ - * style({ opacity: 0 }), - * animate(500, style({ opacity: 1 })) - * ]), - * transition(":leave", [ - * animate(500, style({ opacity: 0 })) - * ]) - * ``` - * - * - Use `:increment` and `:decrement` to initiate transitions: - * - * ```typescript - * transition(":increment", group([ - * query(':enter', [ - * style({ left: '100%' }), - * animate('0.5s ease-out', style('*')) - * ]), - * query(':leave', [ - * animate('0.5s ease-out', style({ left: '-100%' })) - * ]) - * ])) - * - * transition(":decrement", group([ - * query(':enter', [ - * style({ left: '100%' }), - * animate('0.5s ease-out', style('*')) - * ]), - * query(':leave', [ - * animate('0.5s ease-out', style({ left: '-100%' })) - * ]) - * ])) - * ``` - * - * ### State-change functions - * - * Here is an example of a `fromState` specified as a state-change function that invokes an - * animation when true: - * - * ```typescript - * transition((fromState, toState) => - * { - * return fromState == "off" && toState == "on"; - * }, - * animate("1s 0s")) - * ``` - * - * ### Animating to the final state - * - * If the final step in a transition is a call to `animate()` that uses a timing value - * with no style data, that step is automatically considered the final animation arc, - * for the element to reach the final state. Angular automatically adds or removes - * CSS styles to ensure that the element is in the correct final state. - * - * The following example defines a transition that starts by hiding the element, - * then makes sure that it animates properly to whatever state is currently active for trigger: - * - * ```typescript - * transition("void => *", [ - * style({ opacity: 0 }), - * animate(500) - * ]) - * ``` - * ### Boolean value matching - * If a trigger binding value is a Boolean, it can be matched using a transition expression - * that compares true and false or 1 and 0. For example: - * - * ``` - * // in the template - *
...
- * // in the component metadata - * trigger('openClose', [ - * state('true', style({ height: '*' })), - * state('false', style({ height: '0px' })), - * transition('false <=> true', animate(500)) - * ]) - * ``` - * - * @publicApi - **/ -function transition(stateChangeExpr, steps, options) { - if (options === void 0) { options = null; } - return { type: 1 /* Transition */, expr: stateChangeExpr, animation: steps, options: options }; -} -/** - * Produces a reusable animation that can be invoked in another animation or sequence, - * by calling the `useAnimation()` function. - * - * @param steps One or more animation objects, as returned by the `animate()` - * or `sequence()` function, that form a transformation from one state to another. - * A sequence is used by default when you pass an array. - * @param options An options object that can contain a delay value for the start of the - * animation, and additional developer-defined parameters. - * Provided values for additional parameters are used as defaults, - * and override values can be passed to the caller on invocation. - * @returns An object that encapsulates the animation data. - * - * @usageNotes - * The following example defines a reusable animation, providing some default parameter - * values. - * - * ```typescript - * var fadeAnimation = animation([ - * style({ opacity: '{{ start }}' }), - * animate('{{ time }}', - * style({ opacity: '{{ end }}'})) - * ], - * { params: { time: '1000ms', start: 0, end: 1 }}); - * ``` - * - * The following invokes the defined animation with a call to `useAnimation()`, - * passing in override parameter values. - * - * ```js - * useAnimation(fadeAnimation, { - * params: { - * time: '2s', - * start: 1, - * end: 0 - * } - * }) - * ``` - * - * If any of the passed-in parameter values are missing from this call, - * the default values are used. If one or more parameter values are missing before a step is - * animated, `useAnimation()` throws an error. - * - * @publicApi - */ -function animation(steps, options) { - if (options === void 0) { options = null; } - return { type: 8 /* Reference */, animation: steps, options: options }; -} -/** - * Executes a queried inner animation element within an animation sequence. - * - * @param options An options object that can contain a delay value for the start of the - * animation, and additional override values for developer-defined parameters. - * @return An object that encapsulates the child animation data. - * - * @usageNotes - * Each time an animation is triggered in Angular, the parent animation - * has priority and any child animations are blocked. In order - * for a child animation to run, the parent animation must query each of the elements - * containing child animations, and run them using this function. - * - * Note that this feature is designed to be used with `query()` and it will only work - * with animations that are assigned using the Angular animation library. CSS keyframes - * and transitions are not handled by this API. - * - * @publicApi - */ -function animateChild(options) { - if (options === void 0) { options = null; } - return { type: 9 /* AnimateChild */, options: options }; -} -/** - * Starts a reusable animation that is created using the `animation()` function. - * - * @param animation The reusable animation to start. - * @param options An options object that can contain a delay value for the start of - * the animation, and additional override values for developer-defined parameters. - * @return An object that contains the animation parameters. - * - * @publicApi - */ -function useAnimation(animation, options) { - if (options === void 0) { options = null; } - return { type: 10 /* AnimateRef */, animation: animation, options: options }; -} -/** - * Finds one or more inner elements within the current element that is - * being animated within a sequence. Use with `animate()`. - * - * @param selector The element to query, or a set of elements that contain Angular-specific - * characteristics, specified with one or more of the following tokens. - * - `query(":enter")` or `query(":leave")` : Query for newly inserted/removed elements. - * - `query(":animating")` : Query all currently animating elements. - * - `query("@triggerName")` : Query elements that contain an animation trigger. - * - `query("@*")` : Query all elements that contain an animation triggers. - * - `query(":self")` : Include the current element into the animation sequence. - * - * @param animation One or more animation steps to apply to the queried element or elements. - * An array is treated as an animation sequence. - * @param options An options object. Use the 'limit' field to limit the total number of - * items to collect. - * @return An object that encapsulates the query data. - * - * @usageNotes - * Tokens can be merged into a combined query selector string. For example: - * - * ```typescript - * query(':self, .record:enter, .record:leave, @subTrigger', [...]) - * ``` - * - * The `query()` function collects multiple elements and works internally by using - * `element.querySelectorAll`. Use the `limit` field of an options object to limit - * the total number of items to be collected. For example: - * - * ```js - * query('div', [ - * animate(...), - * animate(...) - * ], { limit: 1 }) - * ``` - * - * By default, throws an error when zero items are found. Set the - * `optional` flag to ignore this error. For example: - * - * ```js - * query('.some-element-that-may-not-be-there', [ - * animate(...), - * animate(...) - * ], { optional: true }) - * ``` - * - * ### Usage Example - * - * The following example queries for inner elements and animates them - * individually using `animate()`. - * - * ```typescript - * @Component({ - * selector: 'inner', - * template: ` - *
- *

Title

- *
- * Blah blah blah - *
- *
- * `, - * animations: [ - * trigger('queryAnimation', [ - * transition('* => goAnimate', [ - * // hide the inner elements - * query('h1', style({ opacity: 0 })), - * query('.content', style({ opacity: 0 })), - * - * // animate the inner elements in, one by one - * query('h1', animate(1000, style({ opacity: 1 })), - * query('.content', animate(1000, style({ opacity: 1 })), - * ]) - * ]) - * ] - * }) - * class Cmp { - * exp = ''; - * - * goAnimate() { - * this.exp = 'goAnimate'; - * } - * } - * ``` - * - * @publicApi - */ -function query(selector, animation, options) { - if (options === void 0) { options = null; } - return { type: 11 /* Query */, selector: selector, animation: animation, options: options }; -} -/** - * Use within an animation `query()` call to issue a timing gap after - * each queried item is animated. - * - * @param timings A delay value. - * @param animation One ore more animation steps. - * @returns An object that encapsulates the stagger data. - * - * @usageNotes - * In the following example, a container element wraps a list of items stamped out - * by an `ngFor`. The container element contains an animation trigger that will later be set - * to query for each of the inner items. - * - * Each time items are added, the opacity fade-in animation runs, - * and each removed item is faded out. - * When either of these animations occur, the stagger effect is - * applied after each item's animation is started. - * - * ```html - * - * - *
- *
- *
- * {{ item }} - *
- *
- * ``` - * - * Here is the component code: - * - * ```typescript - * import {trigger, transition, style, animate, query, stagger} from '@angular/animations'; - * @Component({ - * templateUrl: 'list.component.html', - * animations: [ - * trigger('listAnimation', [ - * ... - * ]) - * ] - * }) - * class ListComponent { - * items = []; - * - * showItems() { - * this.items = [0,1,2,3,4]; - * } - * - * hideItems() { - * this.items = []; - * } - * - * toggle() { - * this.items.length ? this.hideItems() : this.showItems(); - * } - * } - * ``` - * - * Here is the animation trigger code: - * - * ```typescript - * trigger('listAnimation', [ - * transition('* => *', [ // each time the binding value changes - * query(':leave', [ - * stagger(100, [ - * animate('0.5s', style({ opacity: 0 })) - * ]) - * ]), - * query(':enter', [ - * style({ opacity: 0 }), - * stagger(100, [ - * animate('0.5s', style({ opacity: 1 })) - * ]) - * ]) - * ]) - * ]) - * ``` - * - * @publicApi - */ -function stagger(timings, animation) { - return { type: 12 /* Stagger */, timings: timings, animation: animation }; -} - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -function scheduleMicroTask(cb) { - Promise.resolve(null).then(cb); -} - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -/** - * An empty programmatic controller for reusable animations. - * Used internally when animations are disabled, to avoid - * checking for the null case when an animation player is expected. - * - * @see `animate()` - * @see `AnimationPlayer` - * @see `GroupPlayer` - * - * @publicApi - */ -var NoopAnimationPlayer = /** @class */ (function () { - function NoopAnimationPlayer(duration, delay) { - if (duration === void 0) { duration = 0; } - if (delay === void 0) { delay = 0; } - this._onDoneFns = []; - this._onStartFns = []; - this._onDestroyFns = []; - this._started = false; - this._destroyed = false; - this._finished = false; - this.parentPlayer = null; - this.totalTime = duration + delay; - } - NoopAnimationPlayer.prototype._onFinish = function () { - if (!this._finished) { - this._finished = true; - this._onDoneFns.forEach(function (fn) { return fn(); }); - this._onDoneFns = []; - } - }; - NoopAnimationPlayer.prototype.onStart = function (fn) { this._onStartFns.push(fn); }; - NoopAnimationPlayer.prototype.onDone = function (fn) { this._onDoneFns.push(fn); }; - NoopAnimationPlayer.prototype.onDestroy = function (fn) { this._onDestroyFns.push(fn); }; - NoopAnimationPlayer.prototype.hasStarted = function () { return this._started; }; - NoopAnimationPlayer.prototype.init = function () { }; - NoopAnimationPlayer.prototype.play = function () { - if (!this.hasStarted()) { - this._onStart(); - this.triggerMicrotask(); - } - this._started = true; - }; - /** @internal */ - NoopAnimationPlayer.prototype.triggerMicrotask = function () { - var _this = this; - scheduleMicroTask(function () { return _this._onFinish(); }); - }; - NoopAnimationPlayer.prototype._onStart = function () { - this._onStartFns.forEach(function (fn) { return fn(); }); - this._onStartFns = []; - }; - NoopAnimationPlayer.prototype.pause = function () { }; - NoopAnimationPlayer.prototype.restart = function () { }; - NoopAnimationPlayer.prototype.finish = function () { this._onFinish(); }; - NoopAnimationPlayer.prototype.destroy = function () { - if (!this._destroyed) { - this._destroyed = true; - if (!this.hasStarted()) { - this._onStart(); - } - this.finish(); - this._onDestroyFns.forEach(function (fn) { return fn(); }); - this._onDestroyFns = []; - } - }; - NoopAnimationPlayer.prototype.reset = function () { }; - NoopAnimationPlayer.prototype.setPosition = function (position) { }; - NoopAnimationPlayer.prototype.getPosition = function () { return 0; }; - /** @internal */ - NoopAnimationPlayer.prototype.triggerCallback = function (phaseName) { - var methods = phaseName == 'start' ? this._onStartFns : this._onDoneFns; - methods.forEach(function (fn) { return fn(); }); - methods.length = 0; - }; - return NoopAnimationPlayer; -}()); - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -/** - * A programmatic controller for a group of reusable animations. - * Used internally to control animations. - * - * @see `AnimationPlayer` - * @see `{@link animations/group group()}` - * - */ -var AnimationGroupPlayer = /** @class */ (function () { - function AnimationGroupPlayer(_players) { - var _this = this; - this._onDoneFns = []; - this._onStartFns = []; - this._finished = false; - this._started = false; - this._destroyed = false; - this._onDestroyFns = []; - this.parentPlayer = null; - this.totalTime = 0; - this.players = _players; - var doneCount = 0; - var destroyCount = 0; - var startCount = 0; - var total = this.players.length; - if (total == 0) { - scheduleMicroTask(function () { return _this._onFinish(); }); - } - else { - this.players.forEach(function (player) { - player.onDone(function () { - if (++doneCount == total) { - _this._onFinish(); - } - }); - player.onDestroy(function () { - if (++destroyCount == total) { - _this._onDestroy(); - } - }); - player.onStart(function () { - if (++startCount == total) { - _this._onStart(); - } - }); - }); - } - this.totalTime = this.players.reduce(function (time, player) { return Math.max(time, player.totalTime); }, 0); - } - AnimationGroupPlayer.prototype._onFinish = function () { - if (!this._finished) { - this._finished = true; - this._onDoneFns.forEach(function (fn) { return fn(); }); - this._onDoneFns = []; - } - }; - AnimationGroupPlayer.prototype.init = function () { this.players.forEach(function (player) { return player.init(); }); }; - AnimationGroupPlayer.prototype.onStart = function (fn) { this._onStartFns.push(fn); }; - AnimationGroupPlayer.prototype._onStart = function () { - if (!this.hasStarted()) { - this._started = true; - this._onStartFns.forEach(function (fn) { return fn(); }); - this._onStartFns = []; - } - }; - AnimationGroupPlayer.prototype.onDone = function (fn) { this._onDoneFns.push(fn); }; - AnimationGroupPlayer.prototype.onDestroy = function (fn) { this._onDestroyFns.push(fn); }; - AnimationGroupPlayer.prototype.hasStarted = function () { return this._started; }; - AnimationGroupPlayer.prototype.play = function () { - if (!this.parentPlayer) { - this.init(); - } - this._onStart(); - this.players.forEach(function (player) { return player.play(); }); - }; - AnimationGroupPlayer.prototype.pause = function () { this.players.forEach(function (player) { return player.pause(); }); }; - AnimationGroupPlayer.prototype.restart = function () { this.players.forEach(function (player) { return player.restart(); }); }; - AnimationGroupPlayer.prototype.finish = function () { - this._onFinish(); - this.players.forEach(function (player) { return player.finish(); }); - }; - AnimationGroupPlayer.prototype.destroy = function () { this._onDestroy(); }; - AnimationGroupPlayer.prototype._onDestroy = function () { - if (!this._destroyed) { - this._destroyed = true; - this._onFinish(); - this.players.forEach(function (player) { return player.destroy(); }); - this._onDestroyFns.forEach(function (fn) { return fn(); }); - this._onDestroyFns = []; - } - }; - AnimationGroupPlayer.prototype.reset = function () { - this.players.forEach(function (player) { return player.reset(); }); - this._destroyed = false; - this._finished = false; - this._started = false; - }; - AnimationGroupPlayer.prototype.setPosition = function (p) { - var timeAtPosition = p * this.totalTime; - this.players.forEach(function (player) { - var position = player.totalTime ? Math.min(1, timeAtPosition / player.totalTime) : 1; - player.setPosition(position); - }); - }; - AnimationGroupPlayer.prototype.getPosition = function () { - var min = 0; - this.players.forEach(function (player) { - var p = player.getPosition(); - min = Math.min(p, min); - }); - return min; - }; - AnimationGroupPlayer.prototype.beforeDestroy = function () { - this.players.forEach(function (player) { - if (player.beforeDestroy) { - player.beforeDestroy(); - } - }); - }; - /** @internal */ - AnimationGroupPlayer.prototype.triggerCallback = function (phaseName) { - var methods = phaseName == 'start' ? this._onStartFns : this._onDoneFns; - methods.forEach(function (fn) { return fn(); }); - methods.length = 0; - }; - return AnimationGroupPlayer; -}()); - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -var ɵPRE_STYLE = '!'; - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -/** - * Generated bundle index. Do not edit. - */ - - -//# sourceMappingURL=animations.js.map - - -/***/ }), - -/***/ "./node_modules/@angular/animations/fesm5/browser.js": -/*!***********************************************************!*\ - !*** ./node_modules/@angular/animations/fesm5/browser.js ***! - \***********************************************************/ -/*! exports provided: ɵangular_packages_animations_browser_browser_a, AnimationDriver, ɵAnimationDriver, ɵAnimation, ɵAnimationStyleNormalizer, ɵNoopAnimationStyleNormalizer, ɵWebAnimationsStyleNormalizer, ɵNoopAnimationDriver, ɵAnimationEngine, ɵCssKeyframesDriver, ɵCssKeyframesPlayer, ɵcontainsElement, ɵinvokeQuery, ɵmatchesElement, ɵvalidateStyleProperty, ɵWebAnimationsDriver, ɵsupportsWebAnimations, ɵWebAnimationsPlayer, ɵallowPreviousPlayerStylesMerge */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_animations_browser_browser_a", function() { return SpecialCasedStyles; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AnimationDriver", function() { return AnimationDriver; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵAnimationDriver", function() { return AnimationDriver; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵAnimation", function() { return Animation; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵAnimationStyleNormalizer", function() { return AnimationStyleNormalizer; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵNoopAnimationStyleNormalizer", function() { return NoopAnimationStyleNormalizer; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵWebAnimationsStyleNormalizer", function() { return WebAnimationsStyleNormalizer; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵNoopAnimationDriver", function() { return NoopAnimationDriver; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵAnimationEngine", function() { return AnimationEngine; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵCssKeyframesDriver", function() { return CssKeyframesDriver; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵCssKeyframesPlayer", function() { return CssKeyframesPlayer; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵcontainsElement", function() { return containsElement; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵinvokeQuery", function() { return invokeQuery; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵmatchesElement", function() { return matchesElement; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵvalidateStyleProperty", function() { return validateStyleProperty; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵWebAnimationsDriver", function() { return WebAnimationsDriver; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵsupportsWebAnimations", function() { return supportsWebAnimations; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵWebAnimationsPlayer", function() { return WebAnimationsPlayer; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵallowPreviousPlayerStylesMerge", function() { return allowPreviousPlayerStylesMerge; }); -/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); -/* harmony import */ var _angular_animations__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/animations */ "./node_modules/@angular/animations/fesm5/animations.js"); -/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); -/** - * @license Angular v7.2.13 - * (c) 2010-2019 Google LLC. https://angular.io/ - * License: MIT - */ - - - - - -function isBrowser() { - return (typeof window !== 'undefined' && typeof window.document !== 'undefined'); -} -function isNode() { - return (typeof process !== 'undefined'); -} -function optimizeGroupPlayer(players) { - switch (players.length) { - case 0: - return new _angular_animations__WEBPACK_IMPORTED_MODULE_1__["NoopAnimationPlayer"](); - case 1: - return players[0]; - default: - return new _angular_animations__WEBPACK_IMPORTED_MODULE_1__["ɵAnimationGroupPlayer"](players); - } -} -function normalizeKeyframes(driver, normalizer, element, keyframes, preStyles, postStyles) { - if (preStyles === void 0) { preStyles = {}; } - if (postStyles === void 0) { postStyles = {}; } - var errors = []; - var normalizedKeyframes = []; - var previousOffset = -1; - var previousKeyframe = null; - keyframes.forEach(function (kf) { - var offset = kf['offset']; - var isSameOffset = offset == previousOffset; - var normalizedKeyframe = (isSameOffset && previousKeyframe) || {}; - Object.keys(kf).forEach(function (prop) { - var normalizedProp = prop; - var normalizedValue = kf[prop]; - if (prop !== 'offset') { - normalizedProp = normalizer.normalizePropertyName(normalizedProp, errors); - switch (normalizedValue) { - case _angular_animations__WEBPACK_IMPORTED_MODULE_1__["ɵPRE_STYLE"]: - normalizedValue = preStyles[prop]; - break; - case _angular_animations__WEBPACK_IMPORTED_MODULE_1__["AUTO_STYLE"]: - normalizedValue = postStyles[prop]; - break; - default: - normalizedValue = - normalizer.normalizeStyleValue(prop, normalizedProp, normalizedValue, errors); - break; - } - } - normalizedKeyframe[normalizedProp] = normalizedValue; - }); - if (!isSameOffset) { - normalizedKeyframes.push(normalizedKeyframe); - } - previousKeyframe = normalizedKeyframe; - previousOffset = offset; - }); - if (errors.length) { - var LINE_START = '\n - '; - throw new Error("Unable to animate due to the following errors:" + LINE_START + errors.join(LINE_START)); - } - return normalizedKeyframes; -} -function listenOnPlayer(player, eventName, event, callback) { - switch (eventName) { - case 'start': - player.onStart(function () { return callback(event && copyAnimationEvent(event, 'start', player)); }); - break; - case 'done': - player.onDone(function () { return callback(event && copyAnimationEvent(event, 'done', player)); }); - break; - case 'destroy': - player.onDestroy(function () { return callback(event && copyAnimationEvent(event, 'destroy', player)); }); - break; - } -} -function copyAnimationEvent(e, phaseName, player) { - var totalTime = player.totalTime; - var disabled = player.disabled ? true : false; - var event = makeAnimationEvent(e.element, e.triggerName, e.fromState, e.toState, phaseName || e.phaseName, totalTime == undefined ? e.totalTime : totalTime, disabled); - var data = e['_data']; - if (data != null) { - event['_data'] = data; - } - return event; -} -function makeAnimationEvent(element, triggerName, fromState, toState, phaseName, totalTime, disabled) { - if (phaseName === void 0) { phaseName = ''; } - if (totalTime === void 0) { totalTime = 0; } - return { element: element, triggerName: triggerName, fromState: fromState, toState: toState, phaseName: phaseName, totalTime: totalTime, disabled: !!disabled }; -} -function getOrSetAsInMap(map, key, defaultValue) { - var value; - if (map instanceof Map) { - value = map.get(key); - if (!value) { - map.set(key, value = defaultValue); - } - } - else { - value = map[key]; - if (!value) { - value = map[key] = defaultValue; - } - } - return value; -} -function parseTimelineCommand(command) { - var separatorPos = command.indexOf(':'); - var id = command.substring(1, separatorPos); - var action = command.substr(separatorPos + 1); - return [id, action]; -} -var _contains = function (elm1, elm2) { return false; }; -var _matches = function (element, selector) { - return false; -}; -var _query = function (element, selector, multi) { - return []; -}; -// Define utility methods for browsers and platform-server(domino) where Element -// and utility methods exist. -var _isNode = isNode(); -if (_isNode || typeof Element !== 'undefined') { - // this is well supported in all browsers - _contains = function (elm1, elm2) { return elm1.contains(elm2); }; - if (_isNode || Element.prototype.matches) { - _matches = function (element, selector) { return element.matches(selector); }; - } - else { - var proto = Element.prototype; - var fn_1 = proto.matchesSelector || proto.mozMatchesSelector || proto.msMatchesSelector || - proto.oMatchesSelector || proto.webkitMatchesSelector; - if (fn_1) { - _matches = function (element, selector) { return fn_1.apply(element, [selector]); }; - } - } - _query = function (element, selector, multi) { - var results = []; - if (multi) { - results.push.apply(results, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(element.querySelectorAll(selector))); - } - else { - var elm = element.querySelector(selector); - if (elm) { - results.push(elm); - } - } - return results; - }; -} -function containsVendorPrefix(prop) { - // Webkit is the only real popular vendor prefix nowadays - // cc: http://shouldiprefix.com/ - return prop.substring(1, 6) == 'ebkit'; // webkit or Webkit -} -var _CACHED_BODY = null; -var _IS_WEBKIT = false; -function validateStyleProperty(prop) { - if (!_CACHED_BODY) { - _CACHED_BODY = getBodyNode() || {}; - _IS_WEBKIT = _CACHED_BODY.style ? ('WebkitAppearance' in _CACHED_BODY.style) : false; - } - var result = true; - if (_CACHED_BODY.style && !containsVendorPrefix(prop)) { - result = prop in _CACHED_BODY.style; - if (!result && _IS_WEBKIT) { - var camelProp = 'Webkit' + prop.charAt(0).toUpperCase() + prop.substr(1); - result = camelProp in _CACHED_BODY.style; - } - } - return result; -} -function getBodyNode() { - if (typeof document != 'undefined') { - return document.body; - } - return null; -} -var matchesElement = _matches; -var containsElement = _contains; -var invokeQuery = _query; -function hypenatePropsObject(object) { - var newObj = {}; - Object.keys(object).forEach(function (prop) { - var newProp = prop.replace(/([a-z])([A-Z])/g, '$1-$2'); - newObj[newProp] = object[prop]; - }); - return newObj; -} - -/** - * @publicApi - */ -var NoopAnimationDriver = /** @class */ (function () { - function NoopAnimationDriver() { - } - NoopAnimationDriver.prototype.validateStyleProperty = function (prop) { return validateStyleProperty(prop); }; - NoopAnimationDriver.prototype.matchesElement = function (element, selector) { - return matchesElement(element, selector); - }; - NoopAnimationDriver.prototype.containsElement = function (elm1, elm2) { return containsElement(elm1, elm2); }; - NoopAnimationDriver.prototype.query = function (element, selector, multi) { - return invokeQuery(element, selector, multi); - }; - NoopAnimationDriver.prototype.computeStyle = function (element, prop, defaultValue) { - return defaultValue || ''; - }; - NoopAnimationDriver.prototype.animate = function (element, keyframes, duration, delay, easing, previousPlayers, scrubberAccessRequested) { - if (previousPlayers === void 0) { previousPlayers = []; } - return new _angular_animations__WEBPACK_IMPORTED_MODULE_1__["NoopAnimationPlayer"](duration, delay); - }; - NoopAnimationDriver = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_2__["Injectable"])() - ], NoopAnimationDriver); - return NoopAnimationDriver; -}()); -/** - * @publicApi - */ -var AnimationDriver = /** @class */ (function () { - function AnimationDriver() { - } - AnimationDriver.NOOP = new NoopAnimationDriver(); - return AnimationDriver; -}()); - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -var ONE_SECOND = 1000; -var SUBSTITUTION_EXPR_START = '{{'; -var SUBSTITUTION_EXPR_END = '}}'; -var ENTER_CLASSNAME = 'ng-enter'; -var LEAVE_CLASSNAME = 'ng-leave'; -var NG_TRIGGER_CLASSNAME = 'ng-trigger'; -var NG_TRIGGER_SELECTOR = '.ng-trigger'; -var NG_ANIMATING_CLASSNAME = 'ng-animating'; -var NG_ANIMATING_SELECTOR = '.ng-animating'; -function resolveTimingValue(value) { - if (typeof value == 'number') - return value; - var matches = value.match(/^(-?[\.\d]+)(m?s)/); - if (!matches || matches.length < 2) - return 0; - return _convertTimeValueToMS(parseFloat(matches[1]), matches[2]); -} -function _convertTimeValueToMS(value, unit) { - switch (unit) { - case 's': - return value * ONE_SECOND; - default: // ms or something else - return value; - } -} -function resolveTiming(timings, errors, allowNegativeValues) { - return timings.hasOwnProperty('duration') ? - timings : - parseTimeExpression(timings, errors, allowNegativeValues); -} -function parseTimeExpression(exp, errors, allowNegativeValues) { - var regex = /^(-?[\.\d]+)(m?s)(?:\s+(-?[\.\d]+)(m?s))?(?:\s+([-a-z]+(?:\(.+?\))?))?$/i; - var duration; - var delay = 0; - var easing = ''; - if (typeof exp === 'string') { - var matches = exp.match(regex); - if (matches === null) { - errors.push("The provided timing value \"" + exp + "\" is invalid."); - return { duration: 0, delay: 0, easing: '' }; - } - duration = _convertTimeValueToMS(parseFloat(matches[1]), matches[2]); - var delayMatch = matches[3]; - if (delayMatch != null) { - delay = _convertTimeValueToMS(parseFloat(delayMatch), matches[4]); - } - var easingVal = matches[5]; - if (easingVal) { - easing = easingVal; - } - } - else { - duration = exp; - } - if (!allowNegativeValues) { - var containsErrors = false; - var startIndex = errors.length; - if (duration < 0) { - errors.push("Duration values below 0 are not allowed for this animation step."); - containsErrors = true; - } - if (delay < 0) { - errors.push("Delay values below 0 are not allowed for this animation step."); - containsErrors = true; - } - if (containsErrors) { - errors.splice(startIndex, 0, "The provided timing value \"" + exp + "\" is invalid."); - } - } - return { duration: duration, delay: delay, easing: easing }; -} -function copyObj(obj, destination) { - if (destination === void 0) { destination = {}; } - Object.keys(obj).forEach(function (prop) { destination[prop] = obj[prop]; }); - return destination; -} -function normalizeStyles(styles) { - var normalizedStyles = {}; - if (Array.isArray(styles)) { - styles.forEach(function (data) { return copyStyles(data, false, normalizedStyles); }); - } - else { - copyStyles(styles, false, normalizedStyles); - } - return normalizedStyles; -} -function copyStyles(styles, readPrototype, destination) { - if (destination === void 0) { destination = {}; } - if (readPrototype) { - // we make use of a for-in loop so that the - // prototypically inherited properties are - // revealed from the backFill map - for (var prop in styles) { - destination[prop] = styles[prop]; - } - } - else { - copyObj(styles, destination); - } - return destination; -} -function getStyleAttributeString(element, key, value) { - // Return the key-value pair string to be added to the style attribute for the - // given CSS style key. - if (value) { - return key + ':' + value + ';'; - } - else { - return ''; - } -} -function writeStyleAttribute(element) { - // Read the style property of the element and manually reflect it to the - // style attribute. This is needed because Domino on platform-server doesn't - // understand the full set of allowed CSS properties and doesn't reflect some - // of them automatically. - var styleAttrValue = ''; - for (var i = 0; i < element.style.length; i++) { - var key = element.style.item(i); - styleAttrValue += getStyleAttributeString(element, key, element.style.getPropertyValue(key)); - } - for (var key in element.style) { - // Skip internal Domino properties that don't need to be reflected. - if (!element.style.hasOwnProperty(key) || key.startsWith('_')) { - continue; - } - var dashKey = camelCaseToDashCase(key); - styleAttrValue += getStyleAttributeString(element, dashKey, element.style[key]); - } - element.setAttribute('style', styleAttrValue); -} -function setStyles(element, styles, formerStyles) { - if (element['style']) { - Object.keys(styles).forEach(function (prop) { - var camelProp = dashCaseToCamelCase(prop); - if (formerStyles && !formerStyles.hasOwnProperty(prop)) { - formerStyles[prop] = element.style[camelProp]; - } - element.style[camelProp] = styles[prop]; - }); - // On the server set the 'style' attribute since it's not automatically reflected. - if (isNode()) { - writeStyleAttribute(element); - } - } -} -function eraseStyles(element, styles) { - if (element['style']) { - Object.keys(styles).forEach(function (prop) { - var camelProp = dashCaseToCamelCase(prop); - element.style[camelProp] = ''; - }); - // On the server set the 'style' attribute since it's not automatically reflected. - if (isNode()) { - writeStyleAttribute(element); - } - } -} -function normalizeAnimationEntry(steps) { - if (Array.isArray(steps)) { - if (steps.length == 1) - return steps[0]; - return Object(_angular_animations__WEBPACK_IMPORTED_MODULE_1__["sequence"])(steps); - } - return steps; -} -function validateStyleParams(value, options, errors) { - var params = options.params || {}; - var matches = extractStyleParams(value); - if (matches.length) { - matches.forEach(function (varName) { - if (!params.hasOwnProperty(varName)) { - errors.push("Unable to resolve the local animation param " + varName + " in the given list of values"); - } - }); - } -} -var PARAM_REGEX = new RegExp(SUBSTITUTION_EXPR_START + "\\s*(.+?)\\s*" + SUBSTITUTION_EXPR_END, 'g'); -function extractStyleParams(value) { - var params = []; - if (typeof value === 'string') { - var val = value.toString(); - var match = void 0; - while (match = PARAM_REGEX.exec(val)) { - params.push(match[1]); - } - PARAM_REGEX.lastIndex = 0; - } - return params; -} -function interpolateParams(value, params, errors) { - var original = value.toString(); - var str = original.replace(PARAM_REGEX, function (_, varName) { - var localVal = params[varName]; - // this means that the value was never overridden by the data passed in by the user - if (!params.hasOwnProperty(varName)) { - errors.push("Please provide a value for the animation param " + varName); - localVal = ''; - } - return localVal.toString(); - }); - // we do this to assert that numeric values stay as they are - return str == original ? value : str; -} -function iteratorToArray(iterator) { - var arr = []; - var item = iterator.next(); - while (!item.done) { - arr.push(item.value); - item = iterator.next(); - } - return arr; -} -var DASH_CASE_REGEXP = /-+([a-z0-9])/g; -function dashCaseToCamelCase(input) { - return input.replace(DASH_CASE_REGEXP, function () { - var m = []; - for (var _i = 0; _i < arguments.length; _i++) { - m[_i] = arguments[_i]; - } - return m[1].toUpperCase(); - }); -} -function camelCaseToDashCase(input) { - return input.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(); -} -function allowPreviousPlayerStylesMerge(duration, delay) { - return duration === 0 || delay === 0; -} -function balancePreviousStylesIntoKeyframes(element, keyframes, previousStyles) { - var previousStyleProps = Object.keys(previousStyles); - if (previousStyleProps.length && keyframes.length) { - var startingKeyframe_1 = keyframes[0]; - var missingStyleProps_1 = []; - previousStyleProps.forEach(function (prop) { - if (!startingKeyframe_1.hasOwnProperty(prop)) { - missingStyleProps_1.push(prop); - } - startingKeyframe_1[prop] = previousStyles[prop]; - }); - if (missingStyleProps_1.length) { - var _loop_1 = function () { - var kf = keyframes[i]; - missingStyleProps_1.forEach(function (prop) { kf[prop] = computeStyle(element, prop); }); - }; - // tslint:disable-next-line - for (var i = 1; i < keyframes.length; i++) { - _loop_1(); - } - } - } - return keyframes; -} -function visitDslNode(visitor, node, context) { - switch (node.type) { - case 7 /* Trigger */: - return visitor.visitTrigger(node, context); - case 0 /* State */: - return visitor.visitState(node, context); - case 1 /* Transition */: - return visitor.visitTransition(node, context); - case 2 /* Sequence */: - return visitor.visitSequence(node, context); - case 3 /* Group */: - return visitor.visitGroup(node, context); - case 4 /* Animate */: - return visitor.visitAnimate(node, context); - case 5 /* Keyframes */: - return visitor.visitKeyframes(node, context); - case 6 /* Style */: - return visitor.visitStyle(node, context); - case 8 /* Reference */: - return visitor.visitReference(node, context); - case 9 /* AnimateChild */: - return visitor.visitAnimateChild(node, context); - case 10 /* AnimateRef */: - return visitor.visitAnimateRef(node, context); - case 11 /* Query */: - return visitor.visitQuery(node, context); - case 12 /* Stagger */: - return visitor.visitStagger(node, context); - default: - throw new Error("Unable to resolve animation metadata node #" + node.type); - } -} -function computeStyle(element, prop) { - return window.getComputedStyle(element)[prop]; -} - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -var ANY_STATE = '*'; -function parseTransitionExpr(transitionValue, errors) { - var expressions = []; - if (typeof transitionValue == 'string') { - transitionValue - .split(/\s*,\s*/) - .forEach(function (str) { return parseInnerTransitionStr(str, expressions, errors); }); - } - else { - expressions.push(transitionValue); - } - return expressions; -} -function parseInnerTransitionStr(eventStr, expressions, errors) { - if (eventStr[0] == ':') { - var result = parseAnimationAlias(eventStr, errors); - if (typeof result == 'function') { - expressions.push(result); - return; - } - eventStr = result; - } - var match = eventStr.match(/^(\*|[-\w]+)\s*()\s*(\*|[-\w]+)$/); - if (match == null || match.length < 4) { - errors.push("The provided transition expression \"" + eventStr + "\" is not supported"); - return expressions; - } - var fromState = match[1]; - var separator = match[2]; - var toState = match[3]; - expressions.push(makeLambdaFromStates(fromState, toState)); - var isFullAnyStateExpr = fromState == ANY_STATE && toState == ANY_STATE; - if (separator[0] == '<' && !isFullAnyStateExpr) { - expressions.push(makeLambdaFromStates(toState, fromState)); - } -} -function parseAnimationAlias(alias, errors) { - switch (alias) { - case ':enter': - return 'void => *'; - case ':leave': - return '* => void'; - case ':increment': - return function (fromState, toState) { return parseFloat(toState) > parseFloat(fromState); }; - case ':decrement': - return function (fromState, toState) { return parseFloat(toState) < parseFloat(fromState); }; - default: - errors.push("The transition alias value \"" + alias + "\" is not supported"); - return '* => *'; - } -} -// DO NOT REFACTOR ... keep the follow set instantiations -// with the values intact (closure compiler for some reason -// removes follow-up lines that add the values outside of -// the constructor... -var TRUE_BOOLEAN_VALUES = new Set(['true', '1']); -var FALSE_BOOLEAN_VALUES = new Set(['false', '0']); -function makeLambdaFromStates(lhs, rhs) { - var LHS_MATCH_BOOLEAN = TRUE_BOOLEAN_VALUES.has(lhs) || FALSE_BOOLEAN_VALUES.has(lhs); - var RHS_MATCH_BOOLEAN = TRUE_BOOLEAN_VALUES.has(rhs) || FALSE_BOOLEAN_VALUES.has(rhs); - return function (fromState, toState) { - var lhsMatch = lhs == ANY_STATE || lhs == fromState; - var rhsMatch = rhs == ANY_STATE || rhs == toState; - if (!lhsMatch && LHS_MATCH_BOOLEAN && typeof fromState === 'boolean') { - lhsMatch = fromState ? TRUE_BOOLEAN_VALUES.has(lhs) : FALSE_BOOLEAN_VALUES.has(lhs); - } - if (!rhsMatch && RHS_MATCH_BOOLEAN && typeof toState === 'boolean') { - rhsMatch = toState ? TRUE_BOOLEAN_VALUES.has(rhs) : FALSE_BOOLEAN_VALUES.has(rhs); - } - return lhsMatch && rhsMatch; - }; -} - -var SELF_TOKEN = ':self'; -var SELF_TOKEN_REGEX = new RegExp("s*" + SELF_TOKEN + "s*,?", 'g'); -/* - * [Validation] - * The visitor code below will traverse the animation AST generated by the animation verb functions - * (the output is a tree of objects) and attempt to perform a series of validations on the data. The - * following corner-cases will be validated: - * - * 1. Overlap of animations - * Given that a CSS property cannot be animated in more than one place at the same time, it's - * important that this behavior is detected and validated. The way in which this occurs is that - * each time a style property is examined, a string-map containing the property will be updated with - * the start and end times for when the property is used within an animation step. - * - * If there are two or more parallel animations that are currently running (these are invoked by the - * group()) on the same element then the validator will throw an error. Since the start/end timing - * values are collected for each property then if the current animation step is animating the same - * property and its timing values fall anywhere into the window of time that the property is - * currently being animated within then this is what causes an error. - * - * 2. Timing values - * The validator will validate to see if a timing value of `duration delay easing` or - * `durationNumber` is valid or not. - * - * (note that upon validation the code below will replace the timing data with an object containing - * {duration,delay,easing}. - * - * 3. Offset Validation - * Each of the style() calls are allowed to have an offset value when placed inside of keyframes(). - * Offsets within keyframes() are considered valid when: - * - * - No offsets are used at all - * - Each style() entry contains an offset value - * - Each offset is between 0 and 1 - * - Each offset is greater to or equal than the previous one - * - * Otherwise an error will be thrown. - */ -function buildAnimationAst(driver, metadata, errors) { - return new AnimationAstBuilderVisitor(driver).build(metadata, errors); -} -var ROOT_SELECTOR = ''; -var AnimationAstBuilderVisitor = /** @class */ (function () { - function AnimationAstBuilderVisitor(_driver) { - this._driver = _driver; - } - AnimationAstBuilderVisitor.prototype.build = function (metadata, errors) { - var context = new AnimationAstBuilderContext(errors); - this._resetContextStyleTimingState(context); - return visitDslNode(this, normalizeAnimationEntry(metadata), context); - }; - AnimationAstBuilderVisitor.prototype._resetContextStyleTimingState = function (context) { - context.currentQuerySelector = ROOT_SELECTOR; - context.collectedStyles = {}; - context.collectedStyles[ROOT_SELECTOR] = {}; - context.currentTime = 0; - }; - AnimationAstBuilderVisitor.prototype.visitTrigger = function (metadata, context) { - var _this = this; - var queryCount = context.queryCount = 0; - var depCount = context.depCount = 0; - var states = []; - var transitions = []; - if (metadata.name.charAt(0) == '@') { - context.errors.push('animation triggers cannot be prefixed with an `@` sign (e.g. trigger(\'@foo\', [...]))'); - } - metadata.definitions.forEach(function (def) { - _this._resetContextStyleTimingState(context); - if (def.type == 0 /* State */) { - var stateDef_1 = def; - var name_1 = stateDef_1.name; - name_1.toString().split(/\s*,\s*/).forEach(function (n) { - stateDef_1.name = n; - states.push(_this.visitState(stateDef_1, context)); - }); - stateDef_1.name = name_1; - } - else if (def.type == 1 /* Transition */) { - var transition = _this.visitTransition(def, context); - queryCount += transition.queryCount; - depCount += transition.depCount; - transitions.push(transition); - } - else { - context.errors.push('only state() and transition() definitions can sit inside of a trigger()'); - } - }); - return { - type: 7 /* Trigger */, - name: metadata.name, states: states, transitions: transitions, queryCount: queryCount, depCount: depCount, - options: null - }; - }; - AnimationAstBuilderVisitor.prototype.visitState = function (metadata, context) { - var styleAst = this.visitStyle(metadata.styles, context); - var astParams = (metadata.options && metadata.options.params) || null; - if (styleAst.containsDynamicStyles) { - var missingSubs_1 = new Set(); - var params_1 = astParams || {}; - styleAst.styles.forEach(function (value) { - if (isObject(value)) { - var stylesObj_1 = value; - Object.keys(stylesObj_1).forEach(function (prop) { - extractStyleParams(stylesObj_1[prop]).forEach(function (sub) { - if (!params_1.hasOwnProperty(sub)) { - missingSubs_1.add(sub); - } - }); - }); - } - }); - if (missingSubs_1.size) { - var missingSubsArr = iteratorToArray(missingSubs_1.values()); - context.errors.push("state(\"" + metadata.name + "\", ...) must define default values for all the following style substitutions: " + missingSubsArr.join(', ')); - } - } - return { - type: 0 /* State */, - name: metadata.name, - style: styleAst, - options: astParams ? { params: astParams } : null - }; - }; - AnimationAstBuilderVisitor.prototype.visitTransition = function (metadata, context) { - context.queryCount = 0; - context.depCount = 0; - var animation = visitDslNode(this, normalizeAnimationEntry(metadata.animation), context); - var matchers = parseTransitionExpr(metadata.expr, context.errors); - return { - type: 1 /* Transition */, - matchers: matchers, - animation: animation, - queryCount: context.queryCount, - depCount: context.depCount, - options: normalizeAnimationOptions(metadata.options) - }; - }; - AnimationAstBuilderVisitor.prototype.visitSequence = function (metadata, context) { - var _this = this; - return { - type: 2 /* Sequence */, - steps: metadata.steps.map(function (s) { return visitDslNode(_this, s, context); }), - options: normalizeAnimationOptions(metadata.options) - }; - }; - AnimationAstBuilderVisitor.prototype.visitGroup = function (metadata, context) { - var _this = this; - var currentTime = context.currentTime; - var furthestTime = 0; - var steps = metadata.steps.map(function (step) { - context.currentTime = currentTime; - var innerAst = visitDslNode(_this, step, context); - furthestTime = Math.max(furthestTime, context.currentTime); - return innerAst; - }); - context.currentTime = furthestTime; - return { - type: 3 /* Group */, - steps: steps, - options: normalizeAnimationOptions(metadata.options) - }; - }; - AnimationAstBuilderVisitor.prototype.visitAnimate = function (metadata, context) { - var timingAst = constructTimingAst(metadata.timings, context.errors); - context.currentAnimateTimings = timingAst; - var styleAst; - var styleMetadata = metadata.styles ? metadata.styles : Object(_angular_animations__WEBPACK_IMPORTED_MODULE_1__["style"])({}); - if (styleMetadata.type == 5 /* Keyframes */) { - styleAst = this.visitKeyframes(styleMetadata, context); - } - else { - var styleMetadata_1 = metadata.styles; - var isEmpty = false; - if (!styleMetadata_1) { - isEmpty = true; - var newStyleData = {}; - if (timingAst.easing) { - newStyleData['easing'] = timingAst.easing; - } - styleMetadata_1 = Object(_angular_animations__WEBPACK_IMPORTED_MODULE_1__["style"])(newStyleData); - } - context.currentTime += timingAst.duration + timingAst.delay; - var _styleAst = this.visitStyle(styleMetadata_1, context); - _styleAst.isEmptyStep = isEmpty; - styleAst = _styleAst; - } - context.currentAnimateTimings = null; - return { - type: 4 /* Animate */, - timings: timingAst, - style: styleAst, - options: null - }; - }; - AnimationAstBuilderVisitor.prototype.visitStyle = function (metadata, context) { - var ast = this._makeStyleAst(metadata, context); - this._validateStyleAst(ast, context); - return ast; - }; - AnimationAstBuilderVisitor.prototype._makeStyleAst = function (metadata, context) { - var styles = []; - if (Array.isArray(metadata.styles)) { - metadata.styles.forEach(function (styleTuple) { - if (typeof styleTuple == 'string') { - if (styleTuple == _angular_animations__WEBPACK_IMPORTED_MODULE_1__["AUTO_STYLE"]) { - styles.push(styleTuple); - } - else { - context.errors.push("The provided style string value " + styleTuple + " is not allowed."); - } - } - else { - styles.push(styleTuple); - } - }); - } - else { - styles.push(metadata.styles); - } - var containsDynamicStyles = false; - var collectedEasing = null; - styles.forEach(function (styleData) { - if (isObject(styleData)) { - var styleMap = styleData; - var easing = styleMap['easing']; - if (easing) { - collectedEasing = easing; - delete styleMap['easing']; - } - if (!containsDynamicStyles) { - for (var prop in styleMap) { - var value = styleMap[prop]; - if (value.toString().indexOf(SUBSTITUTION_EXPR_START) >= 0) { - containsDynamicStyles = true; - break; - } - } - } - } - }); - return { - type: 6 /* Style */, - styles: styles, - easing: collectedEasing, - offset: metadata.offset, containsDynamicStyles: containsDynamicStyles, - options: null - }; - }; - AnimationAstBuilderVisitor.prototype._validateStyleAst = function (ast, context) { - var _this = this; - var timings = context.currentAnimateTimings; - var endTime = context.currentTime; - var startTime = context.currentTime; - if (timings && startTime > 0) { - startTime -= timings.duration + timings.delay; - } - ast.styles.forEach(function (tuple) { - if (typeof tuple == 'string') - return; - Object.keys(tuple).forEach(function (prop) { - if (!_this._driver.validateStyleProperty(prop)) { - context.errors.push("The provided animation property \"" + prop + "\" is not a supported CSS property for animations"); - return; - } - var collectedStyles = context.collectedStyles[context.currentQuerySelector]; - var collectedEntry = collectedStyles[prop]; - var updateCollectedStyle = true; - if (collectedEntry) { - if (startTime != endTime && startTime >= collectedEntry.startTime && - endTime <= collectedEntry.endTime) { - context.errors.push("The CSS property \"" + prop + "\" that exists between the times of \"" + collectedEntry.startTime + "ms\" and \"" + collectedEntry.endTime + "ms\" is also being animated in a parallel animation between the times of \"" + startTime + "ms\" and \"" + endTime + "ms\""); - updateCollectedStyle = false; - } - // we always choose the smaller start time value since we - // want to have a record of the entire animation window where - // the style property is being animated in between - startTime = collectedEntry.startTime; - } - if (updateCollectedStyle) { - collectedStyles[prop] = { startTime: startTime, endTime: endTime }; - } - if (context.options) { - validateStyleParams(tuple[prop], context.options, context.errors); - } - }); - }); - }; - AnimationAstBuilderVisitor.prototype.visitKeyframes = function (metadata, context) { - var _this = this; - var ast = { type: 5 /* Keyframes */, styles: [], options: null }; - if (!context.currentAnimateTimings) { - context.errors.push("keyframes() must be placed inside of a call to animate()"); - return ast; - } - var MAX_KEYFRAME_OFFSET = 1; - var totalKeyframesWithOffsets = 0; - var offsets = []; - var offsetsOutOfOrder = false; - var keyframesOutOfRange = false; - var previousOffset = 0; - var keyframes = metadata.steps.map(function (styles) { - var style$$1 = _this._makeStyleAst(styles, context); - var offsetVal = style$$1.offset != null ? style$$1.offset : consumeOffset(style$$1.styles); - var offset = 0; - if (offsetVal != null) { - totalKeyframesWithOffsets++; - offset = style$$1.offset = offsetVal; - } - keyframesOutOfRange = keyframesOutOfRange || offset < 0 || offset > 1; - offsetsOutOfOrder = offsetsOutOfOrder || offset < previousOffset; - previousOffset = offset; - offsets.push(offset); - return style$$1; - }); - if (keyframesOutOfRange) { - context.errors.push("Please ensure that all keyframe offsets are between 0 and 1"); - } - if (offsetsOutOfOrder) { - context.errors.push("Please ensure that all keyframe offsets are in order"); - } - var length = metadata.steps.length; - var generatedOffset = 0; - if (totalKeyframesWithOffsets > 0 && totalKeyframesWithOffsets < length) { - context.errors.push("Not all style() steps within the declared keyframes() contain offsets"); - } - else if (totalKeyframesWithOffsets == 0) { - generatedOffset = MAX_KEYFRAME_OFFSET / (length - 1); - } - var limit = length - 1; - var currentTime = context.currentTime; - var currentAnimateTimings = context.currentAnimateTimings; - var animateDuration = currentAnimateTimings.duration; - keyframes.forEach(function (kf, i) { - var offset = generatedOffset > 0 ? (i == limit ? 1 : (generatedOffset * i)) : offsets[i]; - var durationUpToThisFrame = offset * animateDuration; - context.currentTime = currentTime + currentAnimateTimings.delay + durationUpToThisFrame; - currentAnimateTimings.duration = durationUpToThisFrame; - _this._validateStyleAst(kf, context); - kf.offset = offset; - ast.styles.push(kf); - }); - return ast; - }; - AnimationAstBuilderVisitor.prototype.visitReference = function (metadata, context) { - return { - type: 8 /* Reference */, - animation: visitDslNode(this, normalizeAnimationEntry(metadata.animation), context), - options: normalizeAnimationOptions(metadata.options) - }; - }; - AnimationAstBuilderVisitor.prototype.visitAnimateChild = function (metadata, context) { - context.depCount++; - return { - type: 9 /* AnimateChild */, - options: normalizeAnimationOptions(metadata.options) - }; - }; - AnimationAstBuilderVisitor.prototype.visitAnimateRef = function (metadata, context) { - return { - type: 10 /* AnimateRef */, - animation: this.visitReference(metadata.animation, context), - options: normalizeAnimationOptions(metadata.options) - }; - }; - AnimationAstBuilderVisitor.prototype.visitQuery = function (metadata, context) { - var parentSelector = context.currentQuerySelector; - var options = (metadata.options || {}); - context.queryCount++; - context.currentQuery = metadata; - var _a = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__read"])(normalizeSelector(metadata.selector), 2), selector = _a[0], includeSelf = _a[1]; - context.currentQuerySelector = - parentSelector.length ? (parentSelector + ' ' + selector) : selector; - getOrSetAsInMap(context.collectedStyles, context.currentQuerySelector, {}); - var animation = visitDslNode(this, normalizeAnimationEntry(metadata.animation), context); - context.currentQuery = null; - context.currentQuerySelector = parentSelector; - return { - type: 11 /* Query */, - selector: selector, - limit: options.limit || 0, - optional: !!options.optional, includeSelf: includeSelf, animation: animation, - originalSelector: metadata.selector, - options: normalizeAnimationOptions(metadata.options) - }; - }; - AnimationAstBuilderVisitor.prototype.visitStagger = function (metadata, context) { - if (!context.currentQuery) { - context.errors.push("stagger() can only be used inside of query()"); - } - var timings = metadata.timings === 'full' ? - { duration: 0, delay: 0, easing: 'full' } : - resolveTiming(metadata.timings, context.errors, true); - return { - type: 12 /* Stagger */, - animation: visitDslNode(this, normalizeAnimationEntry(metadata.animation), context), timings: timings, - options: null - }; - }; - return AnimationAstBuilderVisitor; -}()); -function normalizeSelector(selector) { - var hasAmpersand = selector.split(/\s*,\s*/).find(function (token) { return token == SELF_TOKEN; }) ? true : false; - if (hasAmpersand) { - selector = selector.replace(SELF_TOKEN_REGEX, ''); - } - // the :enter and :leave selectors are filled in at runtime during timeline building - selector = selector.replace(/@\*/g, NG_TRIGGER_SELECTOR) - .replace(/@\w+/g, function (match) { return NG_TRIGGER_SELECTOR + '-' + match.substr(1); }) - .replace(/:animating/g, NG_ANIMATING_SELECTOR); - return [selector, hasAmpersand]; -} -function normalizeParams(obj) { - return obj ? copyObj(obj) : null; -} -var AnimationAstBuilderContext = /** @class */ (function () { - function AnimationAstBuilderContext(errors) { - this.errors = errors; - this.queryCount = 0; - this.depCount = 0; - this.currentTransition = null; - this.currentQuery = null; - this.currentQuerySelector = null; - this.currentAnimateTimings = null; - this.currentTime = 0; - this.collectedStyles = {}; - this.options = null; - } - return AnimationAstBuilderContext; -}()); -function consumeOffset(styles) { - if (typeof styles == 'string') - return null; - var offset = null; - if (Array.isArray(styles)) { - styles.forEach(function (styleTuple) { - if (isObject(styleTuple) && styleTuple.hasOwnProperty('offset')) { - var obj = styleTuple; - offset = parseFloat(obj['offset']); - delete obj['offset']; - } - }); - } - else if (isObject(styles) && styles.hasOwnProperty('offset')) { - var obj = styles; - offset = parseFloat(obj['offset']); - delete obj['offset']; - } - return offset; -} -function isObject(value) { - return !Array.isArray(value) && typeof value == 'object'; -} -function constructTimingAst(value, errors) { - var timings = null; - if (value.hasOwnProperty('duration')) { - timings = value; - } - else if (typeof value == 'number') { - var duration = resolveTiming(value, errors).duration; - return makeTimingAst(duration, 0, ''); - } - var strValue = value; - var isDynamic = strValue.split(/\s+/).some(function (v) { return v.charAt(0) == '{' && v.charAt(1) == '{'; }); - if (isDynamic) { - var ast = makeTimingAst(0, 0, ''); - ast.dynamic = true; - ast.strValue = strValue; - return ast; - } - timings = timings || resolveTiming(strValue, errors); - return makeTimingAst(timings.duration, timings.delay, timings.easing); -} -function normalizeAnimationOptions(options) { - if (options) { - options = copyObj(options); - if (options['params']) { - options['params'] = normalizeParams(options['params']); - } - } - else { - options = {}; - } - return options; -} -function makeTimingAst(duration, delay, easing) { - return { duration: duration, delay: delay, easing: easing }; -} - -function createTimelineInstruction(element, keyframes, preStyleProps, postStyleProps, duration, delay, easing, subTimeline) { - if (easing === void 0) { easing = null; } - if (subTimeline === void 0) { subTimeline = false; } - return { - type: 1 /* TimelineAnimation */, - element: element, - keyframes: keyframes, - preStyleProps: preStyleProps, - postStyleProps: postStyleProps, - duration: duration, - delay: delay, - totalTime: duration + delay, easing: easing, subTimeline: subTimeline - }; -} - -var ElementInstructionMap = /** @class */ (function () { - function ElementInstructionMap() { - this._map = new Map(); - } - ElementInstructionMap.prototype.consume = function (element) { - var instructions = this._map.get(element); - if (instructions) { - this._map.delete(element); - } - else { - instructions = []; - } - return instructions; - }; - ElementInstructionMap.prototype.append = function (element, instructions) { - var existingInstructions = this._map.get(element); - if (!existingInstructions) { - this._map.set(element, existingInstructions = []); - } - existingInstructions.push.apply(existingInstructions, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(instructions)); - }; - ElementInstructionMap.prototype.has = function (element) { return this._map.has(element); }; - ElementInstructionMap.prototype.clear = function () { this._map.clear(); }; - return ElementInstructionMap; -}()); - -var ONE_FRAME_IN_MILLISECONDS = 1; -var ENTER_TOKEN = ':enter'; -var ENTER_TOKEN_REGEX = new RegExp(ENTER_TOKEN, 'g'); -var LEAVE_TOKEN = ':leave'; -var LEAVE_TOKEN_REGEX = new RegExp(LEAVE_TOKEN, 'g'); -/* - * The code within this file aims to generate web-animations-compatible keyframes from Angular's - * animation DSL code. - * - * The code below will be converted from: - * - * ``` - * sequence([ - * style({ opacity: 0 }), - * animate(1000, style({ opacity: 0 })) - * ]) - * ``` - * - * To: - * ``` - * keyframes = [{ opacity: 0, offset: 0 }, { opacity: 1, offset: 1 }] - * duration = 1000 - * delay = 0 - * easing = '' - * ``` - * - * For this operation to cover the combination of animation verbs (style, animate, group, etc...) a - * combination of prototypical inheritance, AST traversal and merge-sort-like algorithms are used. - * - * [AST Traversal] - * Each of the animation verbs, when executed, will return an string-map object representing what - * type of action it is (style, animate, group, etc...) and the data associated with it. This means - * that when functional composition mix of these functions is evaluated (like in the example above) - * then it will end up producing a tree of objects representing the animation itself. - * - * When this animation object tree is processed by the visitor code below it will visit each of the - * verb statements within the visitor. And during each visit it will build the context of the - * animation keyframes by interacting with the `TimelineBuilder`. - * - * [TimelineBuilder] - * This class is responsible for tracking the styles and building a series of keyframe objects for a - * timeline between a start and end time. The builder starts off with an initial timeline and each - * time the AST comes across a `group()`, `keyframes()` or a combination of the two wihtin a - * `sequence()` then it will generate a sub timeline for each step as well as a new one after - * they are complete. - * - * As the AST is traversed, the timing state on each of the timelines will be incremented. If a sub - * timeline was created (based on one of the cases above) then the parent timeline will attempt to - * merge the styles used within the sub timelines into itself (only with group() this will happen). - * This happens with a merge operation (much like how the merge works in mergesort) and it will only - * copy the most recently used styles from the sub timelines into the parent timeline. This ensures - * that if the styles are used later on in another phase of the animation then they will be the most - * up-to-date values. - * - * [How Missing Styles Are Updated] - * Each timeline has a `backFill` property which is responsible for filling in new styles into - * already processed keyframes if a new style shows up later within the animation sequence. - * - * ``` - * sequence([ - * style({ width: 0 }), - * animate(1000, style({ width: 100 })), - * animate(1000, style({ width: 200 })), - * animate(1000, style({ width: 300 })) - * animate(1000, style({ width: 400, height: 400 })) // notice how `height` doesn't exist anywhere - * else - * ]) - * ``` - * - * What is happening here is that the `height` value is added later in the sequence, but is missing - * from all previous animation steps. Therefore when a keyframe is created it would also be missing - * from all previous keyframes up until where it is first used. For the timeline keyframe generation - * to properly fill in the style it will place the previous value (the value from the parent - * timeline) or a default value of `*` into the backFill object. Given that each of the keyframe - * styles are objects that prototypically inhert from the backFill object, this means that if a - * value is added into the backFill then it will automatically propagate any missing values to all - * keyframes. Therefore the missing `height` value will be properly filled into the already - * processed keyframes. - * - * When a sub-timeline is created it will have its own backFill property. This is done so that - * styles present within the sub-timeline do not accidentally seep into the previous/future timeline - * keyframes - * - * (For prototypically-inherited contents to be detected a `for(i in obj)` loop must be used.) - * - * [Validation] - * The code in this file is not responsible for validation. That functionality happens with within - * the `AnimationValidatorVisitor` code. - */ -function buildAnimationTimelines(driver, rootElement, ast, enterClassName, leaveClassName, startingStyles, finalStyles, options, subInstructions, errors) { - if (startingStyles === void 0) { startingStyles = {}; } - if (finalStyles === void 0) { finalStyles = {}; } - if (errors === void 0) { errors = []; } - return new AnimationTimelineBuilderVisitor().buildKeyframes(driver, rootElement, ast, enterClassName, leaveClassName, startingStyles, finalStyles, options, subInstructions, errors); -} -var AnimationTimelineBuilderVisitor = /** @class */ (function () { - function AnimationTimelineBuilderVisitor() { - } - AnimationTimelineBuilderVisitor.prototype.buildKeyframes = function (driver, rootElement, ast, enterClassName, leaveClassName, startingStyles, finalStyles, options, subInstructions, errors) { - if (errors === void 0) { errors = []; } - subInstructions = subInstructions || new ElementInstructionMap(); - var context = new AnimationTimelineContext(driver, rootElement, subInstructions, enterClassName, leaveClassName, errors, []); - context.options = options; - context.currentTimeline.setStyles([startingStyles], null, context.errors, options); - visitDslNode(this, ast, context); - // this checks to see if an actual animation happened - var timelines = context.timelines.filter(function (timeline) { return timeline.containsAnimation(); }); - if (timelines.length && Object.keys(finalStyles).length) { - var tl = timelines[timelines.length - 1]; - if (!tl.allowOnlyTimelineStyles()) { - tl.setStyles([finalStyles], null, context.errors, options); - } - } - return timelines.length ? timelines.map(function (timeline) { return timeline.buildKeyframes(); }) : - [createTimelineInstruction(rootElement, [], [], [], 0, 0, '', false)]; - }; - AnimationTimelineBuilderVisitor.prototype.visitTrigger = function (ast, context) { - // these values are not visited in this AST - }; - AnimationTimelineBuilderVisitor.prototype.visitState = function (ast, context) { - // these values are not visited in this AST - }; - AnimationTimelineBuilderVisitor.prototype.visitTransition = function (ast, context) { - // these values are not visited in this AST - }; - AnimationTimelineBuilderVisitor.prototype.visitAnimateChild = function (ast, context) { - var elementInstructions = context.subInstructions.consume(context.element); - if (elementInstructions) { - var innerContext = context.createSubContext(ast.options); - var startTime = context.currentTimeline.currentTime; - var endTime = this._visitSubInstructions(elementInstructions, innerContext, innerContext.options); - if (startTime != endTime) { - // we do this on the upper context because we created a sub context for - // the sub child animations - context.transformIntoNewTimeline(endTime); - } - } - context.previousNode = ast; - }; - AnimationTimelineBuilderVisitor.prototype.visitAnimateRef = function (ast, context) { - var innerContext = context.createSubContext(ast.options); - innerContext.transformIntoNewTimeline(); - this.visitReference(ast.animation, innerContext); - context.transformIntoNewTimeline(innerContext.currentTimeline.currentTime); - context.previousNode = ast; - }; - AnimationTimelineBuilderVisitor.prototype._visitSubInstructions = function (instructions, context, options) { - var startTime = context.currentTimeline.currentTime; - var furthestTime = startTime; - // this is a special-case for when a user wants to skip a sub - // animation from being fired entirely. - var duration = options.duration != null ? resolveTimingValue(options.duration) : null; - var delay = options.delay != null ? resolveTimingValue(options.delay) : null; - if (duration !== 0) { - instructions.forEach(function (instruction) { - var instructionTimings = context.appendInstructionToTimeline(instruction, duration, delay); - furthestTime = - Math.max(furthestTime, instructionTimings.duration + instructionTimings.delay); - }); - } - return furthestTime; - }; - AnimationTimelineBuilderVisitor.prototype.visitReference = function (ast, context) { - context.updateOptions(ast.options, true); - visitDslNode(this, ast.animation, context); - context.previousNode = ast; - }; - AnimationTimelineBuilderVisitor.prototype.visitSequence = function (ast, context) { - var _this = this; - var subContextCount = context.subContextCount; - var ctx = context; - var options = ast.options; - if (options && (options.params || options.delay)) { - ctx = context.createSubContext(options); - ctx.transformIntoNewTimeline(); - if (options.delay != null) { - if (ctx.previousNode.type == 6 /* Style */) { - ctx.currentTimeline.snapshotCurrentStyles(); - ctx.previousNode = DEFAULT_NOOP_PREVIOUS_NODE; - } - var delay = resolveTimingValue(options.delay); - ctx.delayNextStep(delay); - } - } - if (ast.steps.length) { - ast.steps.forEach(function (s) { return visitDslNode(_this, s, ctx); }); - // this is here just incase the inner steps only contain or end with a style() call - ctx.currentTimeline.applyStylesToKeyframe(); - // this means that some animation function within the sequence - // ended up creating a sub timeline (which means the current - // timeline cannot overlap with the contents of the sequence) - if (ctx.subContextCount > subContextCount) { - ctx.transformIntoNewTimeline(); - } - } - context.previousNode = ast; - }; - AnimationTimelineBuilderVisitor.prototype.visitGroup = function (ast, context) { - var _this = this; - var innerTimelines = []; - var furthestTime = context.currentTimeline.currentTime; - var delay = ast.options && ast.options.delay ? resolveTimingValue(ast.options.delay) : 0; - ast.steps.forEach(function (s) { - var innerContext = context.createSubContext(ast.options); - if (delay) { - innerContext.delayNextStep(delay); - } - visitDslNode(_this, s, innerContext); - furthestTime = Math.max(furthestTime, innerContext.currentTimeline.currentTime); - innerTimelines.push(innerContext.currentTimeline); - }); - // this operation is run after the AST loop because otherwise - // if the parent timeline's collected styles were updated then - // it would pass in invalid data into the new-to-be forked items - innerTimelines.forEach(function (timeline) { return context.currentTimeline.mergeTimelineCollectedStyles(timeline); }); - context.transformIntoNewTimeline(furthestTime); - context.previousNode = ast; - }; - AnimationTimelineBuilderVisitor.prototype._visitTiming = function (ast, context) { - if (ast.dynamic) { - var strValue = ast.strValue; - var timingValue = context.params ? interpolateParams(strValue, context.params, context.errors) : strValue; - return resolveTiming(timingValue, context.errors); - } - else { - return { duration: ast.duration, delay: ast.delay, easing: ast.easing }; - } - }; - AnimationTimelineBuilderVisitor.prototype.visitAnimate = function (ast, context) { - var timings = context.currentAnimateTimings = this._visitTiming(ast.timings, context); - var timeline = context.currentTimeline; - if (timings.delay) { - context.incrementTime(timings.delay); - timeline.snapshotCurrentStyles(); - } - var style$$1 = ast.style; - if (style$$1.type == 5 /* Keyframes */) { - this.visitKeyframes(style$$1, context); - } - else { - context.incrementTime(timings.duration); - this.visitStyle(style$$1, context); - timeline.applyStylesToKeyframe(); - } - context.currentAnimateTimings = null; - context.previousNode = ast; - }; - AnimationTimelineBuilderVisitor.prototype.visitStyle = function (ast, context) { - var timeline = context.currentTimeline; - var timings = context.currentAnimateTimings; - // this is a special case for when a style() call - // directly follows an animate() call (but not inside of an animate() call) - if (!timings && timeline.getCurrentStyleProperties().length) { - timeline.forwardFrame(); - } - var easing = (timings && timings.easing) || ast.easing; - if (ast.isEmptyStep) { - timeline.applyEmptyStep(easing); - } - else { - timeline.setStyles(ast.styles, easing, context.errors, context.options); - } - context.previousNode = ast; - }; - AnimationTimelineBuilderVisitor.prototype.visitKeyframes = function (ast, context) { - var currentAnimateTimings = context.currentAnimateTimings; - var startTime = (context.currentTimeline).duration; - var duration = currentAnimateTimings.duration; - var innerContext = context.createSubContext(); - var innerTimeline = innerContext.currentTimeline; - innerTimeline.easing = currentAnimateTimings.easing; - ast.styles.forEach(function (step) { - var offset = step.offset || 0; - innerTimeline.forwardTime(offset * duration); - innerTimeline.setStyles(step.styles, step.easing, context.errors, context.options); - innerTimeline.applyStylesToKeyframe(); - }); - // this will ensure that the parent timeline gets all the styles from - // the child even if the new timeline below is not used - context.currentTimeline.mergeTimelineCollectedStyles(innerTimeline); - // we do this because the window between this timeline and the sub timeline - // should ensure that the styles within are exactly the same as they were before - context.transformIntoNewTimeline(startTime + duration); - context.previousNode = ast; - }; - AnimationTimelineBuilderVisitor.prototype.visitQuery = function (ast, context) { - var _this = this; - // in the event that the first step before this is a style step we need - // to ensure the styles are applied before the children are animated - var startTime = context.currentTimeline.currentTime; - var options = (ast.options || {}); - var delay = options.delay ? resolveTimingValue(options.delay) : 0; - if (delay && (context.previousNode.type === 6 /* Style */ || - (startTime == 0 && context.currentTimeline.getCurrentStyleProperties().length))) { - context.currentTimeline.snapshotCurrentStyles(); - context.previousNode = DEFAULT_NOOP_PREVIOUS_NODE; - } - var furthestTime = startTime; - var elms = context.invokeQuery(ast.selector, ast.originalSelector, ast.limit, ast.includeSelf, options.optional ? true : false, context.errors); - context.currentQueryTotal = elms.length; - var sameElementTimeline = null; - elms.forEach(function (element, i) { - context.currentQueryIndex = i; - var innerContext = context.createSubContext(ast.options, element); - if (delay) { - innerContext.delayNextStep(delay); - } - if (element === context.element) { - sameElementTimeline = innerContext.currentTimeline; - } - visitDslNode(_this, ast.animation, innerContext); - // this is here just incase the inner steps only contain or end - // with a style() call (which is here to signal that this is a preparatory - // call to style an element before it is animated again) - innerContext.currentTimeline.applyStylesToKeyframe(); - var endTime = innerContext.currentTimeline.currentTime; - furthestTime = Math.max(furthestTime, endTime); - }); - context.currentQueryIndex = 0; - context.currentQueryTotal = 0; - context.transformIntoNewTimeline(furthestTime); - if (sameElementTimeline) { - context.currentTimeline.mergeTimelineCollectedStyles(sameElementTimeline); - context.currentTimeline.snapshotCurrentStyles(); - } - context.previousNode = ast; - }; - AnimationTimelineBuilderVisitor.prototype.visitStagger = function (ast, context) { - var parentContext = context.parentContext; - var tl = context.currentTimeline; - var timings = ast.timings; - var duration = Math.abs(timings.duration); - var maxTime = duration * (context.currentQueryTotal - 1); - var delay = duration * context.currentQueryIndex; - var staggerTransformer = timings.duration < 0 ? 'reverse' : timings.easing; - switch (staggerTransformer) { - case 'reverse': - delay = maxTime - delay; - break; - case 'full': - delay = parentContext.currentStaggerTime; - break; - } - var timeline = context.currentTimeline; - if (delay) { - timeline.delayNextStep(delay); - } - var startingTime = timeline.currentTime; - visitDslNode(this, ast.animation, context); - context.previousNode = ast; - // time = duration + delay - // the reason why this computation is so complex is because - // the inner timeline may either have a delay value or a stretched - // keyframe depending on if a subtimeline is not used or is used. - parentContext.currentStaggerTime = - (tl.currentTime - startingTime) + (tl.startTime - parentContext.currentTimeline.startTime); - }; - return AnimationTimelineBuilderVisitor; -}()); -var DEFAULT_NOOP_PREVIOUS_NODE = {}; -var AnimationTimelineContext = /** @class */ (function () { - function AnimationTimelineContext(_driver, element, subInstructions, _enterClassName, _leaveClassName, errors, timelines, initialTimeline) { - this._driver = _driver; - this.element = element; - this.subInstructions = subInstructions; - this._enterClassName = _enterClassName; - this._leaveClassName = _leaveClassName; - this.errors = errors; - this.timelines = timelines; - this.parentContext = null; - this.currentAnimateTimings = null; - this.previousNode = DEFAULT_NOOP_PREVIOUS_NODE; - this.subContextCount = 0; - this.options = {}; - this.currentQueryIndex = 0; - this.currentQueryTotal = 0; - this.currentStaggerTime = 0; - this.currentTimeline = initialTimeline || new TimelineBuilder(this._driver, element, 0); - timelines.push(this.currentTimeline); - } - Object.defineProperty(AnimationTimelineContext.prototype, "params", { - get: function () { return this.options.params; }, - enumerable: true, - configurable: true - }); - AnimationTimelineContext.prototype.updateOptions = function (options, skipIfExists) { - var _this = this; - if (!options) - return; - var newOptions = options; - var optionsToUpdate = this.options; - // NOTE: this will get patched up when other animation methods support duration overrides - if (newOptions.duration != null) { - optionsToUpdate.duration = resolveTimingValue(newOptions.duration); - } - if (newOptions.delay != null) { - optionsToUpdate.delay = resolveTimingValue(newOptions.delay); - } - var newParams = newOptions.params; - if (newParams) { - var paramsToUpdate_1 = optionsToUpdate.params; - if (!paramsToUpdate_1) { - paramsToUpdate_1 = this.options.params = {}; - } - Object.keys(newParams).forEach(function (name) { - if (!skipIfExists || !paramsToUpdate_1.hasOwnProperty(name)) { - paramsToUpdate_1[name] = interpolateParams(newParams[name], paramsToUpdate_1, _this.errors); - } - }); - } - }; - AnimationTimelineContext.prototype._copyOptions = function () { - var options = {}; - if (this.options) { - var oldParams_1 = this.options.params; - if (oldParams_1) { - var params_1 = options['params'] = {}; - Object.keys(oldParams_1).forEach(function (name) { params_1[name] = oldParams_1[name]; }); - } - } - return options; - }; - AnimationTimelineContext.prototype.createSubContext = function (options, element, newTime) { - if (options === void 0) { options = null; } - var target = element || this.element; - var context = new AnimationTimelineContext(this._driver, target, this.subInstructions, this._enterClassName, this._leaveClassName, this.errors, this.timelines, this.currentTimeline.fork(target, newTime || 0)); - context.previousNode = this.previousNode; - context.currentAnimateTimings = this.currentAnimateTimings; - context.options = this._copyOptions(); - context.updateOptions(options); - context.currentQueryIndex = this.currentQueryIndex; - context.currentQueryTotal = this.currentQueryTotal; - context.parentContext = this; - this.subContextCount++; - return context; - }; - AnimationTimelineContext.prototype.transformIntoNewTimeline = function (newTime) { - this.previousNode = DEFAULT_NOOP_PREVIOUS_NODE; - this.currentTimeline = this.currentTimeline.fork(this.element, newTime); - this.timelines.push(this.currentTimeline); - return this.currentTimeline; - }; - AnimationTimelineContext.prototype.appendInstructionToTimeline = function (instruction, duration, delay) { - var updatedTimings = { - duration: duration != null ? duration : instruction.duration, - delay: this.currentTimeline.currentTime + (delay != null ? delay : 0) + instruction.delay, - easing: '' - }; - var builder = new SubTimelineBuilder(this._driver, instruction.element, instruction.keyframes, instruction.preStyleProps, instruction.postStyleProps, updatedTimings, instruction.stretchStartingKeyframe); - this.timelines.push(builder); - return updatedTimings; - }; - AnimationTimelineContext.prototype.incrementTime = function (time) { - this.currentTimeline.forwardTime(this.currentTimeline.duration + time); - }; - AnimationTimelineContext.prototype.delayNextStep = function (delay) { - // negative delays are not yet supported - if (delay > 0) { - this.currentTimeline.delayNextStep(delay); - } - }; - AnimationTimelineContext.prototype.invokeQuery = function (selector, originalSelector, limit, includeSelf, optional, errors) { - var results = []; - if (includeSelf) { - results.push(this.element); - } - if (selector.length > 0) { // if :self is only used then the selector is empty - selector = selector.replace(ENTER_TOKEN_REGEX, '.' + this._enterClassName); - selector = selector.replace(LEAVE_TOKEN_REGEX, '.' + this._leaveClassName); - var multi = limit != 1; - var elements = this._driver.query(this.element, selector, multi); - if (limit !== 0) { - elements = limit < 0 ? elements.slice(elements.length + limit, elements.length) : - elements.slice(0, limit); - } - results.push.apply(results, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(elements)); - } - if (!optional && results.length == 0) { - errors.push("`query(\"" + originalSelector + "\")` returned zero elements. (Use `query(\"" + originalSelector + "\", { optional: true })` if you wish to allow this.)"); - } - return results; - }; - return AnimationTimelineContext; -}()); -var TimelineBuilder = /** @class */ (function () { - function TimelineBuilder(_driver, element, startTime, _elementTimelineStylesLookup) { - this._driver = _driver; - this.element = element; - this.startTime = startTime; - this._elementTimelineStylesLookup = _elementTimelineStylesLookup; - this.duration = 0; - this._previousKeyframe = {}; - this._currentKeyframe = {}; - this._keyframes = new Map(); - this._styleSummary = {}; - this._pendingStyles = {}; - this._backFill = {}; - this._currentEmptyStepKeyframe = null; - if (!this._elementTimelineStylesLookup) { - this._elementTimelineStylesLookup = new Map(); - } - this._localTimelineStyles = Object.create(this._backFill, {}); - this._globalTimelineStyles = this._elementTimelineStylesLookup.get(element); - if (!this._globalTimelineStyles) { - this._globalTimelineStyles = this._localTimelineStyles; - this._elementTimelineStylesLookup.set(element, this._localTimelineStyles); - } - this._loadKeyframe(); - } - TimelineBuilder.prototype.containsAnimation = function () { - switch (this._keyframes.size) { - case 0: - return false; - case 1: - return this.getCurrentStyleProperties().length > 0; - default: - return true; - } - }; - TimelineBuilder.prototype.getCurrentStyleProperties = function () { return Object.keys(this._currentKeyframe); }; - Object.defineProperty(TimelineBuilder.prototype, "currentTime", { - get: function () { return this.startTime + this.duration; }, - enumerable: true, - configurable: true - }); - TimelineBuilder.prototype.delayNextStep = function (delay) { - // in the event that a style() step is placed right before a stagger() - // and that style() step is the very first style() value in the animation - // then we need to make a copy of the keyframe [0, copy, 1] so that the delay - // properly applies the style() values to work with the stagger... - var hasPreStyleStep = this._keyframes.size == 1 && Object.keys(this._pendingStyles).length; - if (this.duration || hasPreStyleStep) { - this.forwardTime(this.currentTime + delay); - if (hasPreStyleStep) { - this.snapshotCurrentStyles(); - } - } - else { - this.startTime += delay; - } - }; - TimelineBuilder.prototype.fork = function (element, currentTime) { - this.applyStylesToKeyframe(); - return new TimelineBuilder(this._driver, element, currentTime || this.currentTime, this._elementTimelineStylesLookup); - }; - TimelineBuilder.prototype._loadKeyframe = function () { - if (this._currentKeyframe) { - this._previousKeyframe = this._currentKeyframe; - } - this._currentKeyframe = this._keyframes.get(this.duration); - if (!this._currentKeyframe) { - this._currentKeyframe = Object.create(this._backFill, {}); - this._keyframes.set(this.duration, this._currentKeyframe); - } - }; - TimelineBuilder.prototype.forwardFrame = function () { - this.duration += ONE_FRAME_IN_MILLISECONDS; - this._loadKeyframe(); - }; - TimelineBuilder.prototype.forwardTime = function (time) { - this.applyStylesToKeyframe(); - this.duration = time; - this._loadKeyframe(); - }; - TimelineBuilder.prototype._updateStyle = function (prop, value) { - this._localTimelineStyles[prop] = value; - this._globalTimelineStyles[prop] = value; - this._styleSummary[prop] = { time: this.currentTime, value: value }; - }; - TimelineBuilder.prototype.allowOnlyTimelineStyles = function () { return this._currentEmptyStepKeyframe !== this._currentKeyframe; }; - TimelineBuilder.prototype.applyEmptyStep = function (easing) { - var _this = this; - if (easing) { - this._previousKeyframe['easing'] = easing; - } - // special case for animate(duration): - // all missing styles are filled with a `*` value then - // if any destination styles are filled in later on the same - // keyframe then they will override the overridden styles - // We use `_globalTimelineStyles` here because there may be - // styles in previous keyframes that are not present in this timeline - Object.keys(this._globalTimelineStyles).forEach(function (prop) { - _this._backFill[prop] = _this._globalTimelineStyles[prop] || _angular_animations__WEBPACK_IMPORTED_MODULE_1__["AUTO_STYLE"]; - _this._currentKeyframe[prop] = _angular_animations__WEBPACK_IMPORTED_MODULE_1__["AUTO_STYLE"]; - }); - this._currentEmptyStepKeyframe = this._currentKeyframe; - }; - TimelineBuilder.prototype.setStyles = function (input, easing, errors, options) { - var _this = this; - if (easing) { - this._previousKeyframe['easing'] = easing; - } - var params = (options && options.params) || {}; - var styles = flattenStyles(input, this._globalTimelineStyles); - Object.keys(styles).forEach(function (prop) { - var val = interpolateParams(styles[prop], params, errors); - _this._pendingStyles[prop] = val; - if (!_this._localTimelineStyles.hasOwnProperty(prop)) { - _this._backFill[prop] = _this._globalTimelineStyles.hasOwnProperty(prop) ? - _this._globalTimelineStyles[prop] : - _angular_animations__WEBPACK_IMPORTED_MODULE_1__["AUTO_STYLE"]; - } - _this._updateStyle(prop, val); - }); - }; - TimelineBuilder.prototype.applyStylesToKeyframe = function () { - var _this = this; - var styles = this._pendingStyles; - var props = Object.keys(styles); - if (props.length == 0) - return; - this._pendingStyles = {}; - props.forEach(function (prop) { - var val = styles[prop]; - _this._currentKeyframe[prop] = val; - }); - Object.keys(this._localTimelineStyles).forEach(function (prop) { - if (!_this._currentKeyframe.hasOwnProperty(prop)) { - _this._currentKeyframe[prop] = _this._localTimelineStyles[prop]; - } - }); - }; - TimelineBuilder.prototype.snapshotCurrentStyles = function () { - var _this = this; - Object.keys(this._localTimelineStyles).forEach(function (prop) { - var val = _this._localTimelineStyles[prop]; - _this._pendingStyles[prop] = val; - _this._updateStyle(prop, val); - }); - }; - TimelineBuilder.prototype.getFinalKeyframe = function () { return this._keyframes.get(this.duration); }; - Object.defineProperty(TimelineBuilder.prototype, "properties", { - get: function () { - var properties = []; - for (var prop in this._currentKeyframe) { - properties.push(prop); - } - return properties; - }, - enumerable: true, - configurable: true - }); - TimelineBuilder.prototype.mergeTimelineCollectedStyles = function (timeline) { - var _this = this; - Object.keys(timeline._styleSummary).forEach(function (prop) { - var details0 = _this._styleSummary[prop]; - var details1 = timeline._styleSummary[prop]; - if (!details0 || details1.time > details0.time) { - _this._updateStyle(prop, details1.value); - } - }); - }; - TimelineBuilder.prototype.buildKeyframes = function () { - var _this = this; - this.applyStylesToKeyframe(); - var preStyleProps = new Set(); - var postStyleProps = new Set(); - var isEmpty = this._keyframes.size === 1 && this.duration === 0; - var finalKeyframes = []; - this._keyframes.forEach(function (keyframe, time) { - var finalKeyframe = copyStyles(keyframe, true); - Object.keys(finalKeyframe).forEach(function (prop) { - var value = finalKeyframe[prop]; - if (value == _angular_animations__WEBPACK_IMPORTED_MODULE_1__["ɵPRE_STYLE"]) { - preStyleProps.add(prop); - } - else if (value == _angular_animations__WEBPACK_IMPORTED_MODULE_1__["AUTO_STYLE"]) { - postStyleProps.add(prop); - } - }); - if (!isEmpty) { - finalKeyframe['offset'] = time / _this.duration; - } - finalKeyframes.push(finalKeyframe); - }); - var preProps = preStyleProps.size ? iteratorToArray(preStyleProps.values()) : []; - var postProps = postStyleProps.size ? iteratorToArray(postStyleProps.values()) : []; - // special case for a 0-second animation (which is designed just to place styles onscreen) - if (isEmpty) { - var kf0 = finalKeyframes[0]; - var kf1 = copyObj(kf0); - kf0['offset'] = 0; - kf1['offset'] = 1; - finalKeyframes = [kf0, kf1]; - } - return createTimelineInstruction(this.element, finalKeyframes, preProps, postProps, this.duration, this.startTime, this.easing, false); - }; - return TimelineBuilder; -}()); -var SubTimelineBuilder = /** @class */ (function (_super) { - Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(SubTimelineBuilder, _super); - function SubTimelineBuilder(driver, element, keyframes, preStyleProps, postStyleProps, timings, _stretchStartingKeyframe) { - if (_stretchStartingKeyframe === void 0) { _stretchStartingKeyframe = false; } - var _this = _super.call(this, driver, element, timings.delay) || this; - _this.element = element; - _this.keyframes = keyframes; - _this.preStyleProps = preStyleProps; - _this.postStyleProps = postStyleProps; - _this._stretchStartingKeyframe = _stretchStartingKeyframe; - _this.timings = { duration: timings.duration, delay: timings.delay, easing: timings.easing }; - return _this; - } - SubTimelineBuilder.prototype.containsAnimation = function () { return this.keyframes.length > 1; }; - SubTimelineBuilder.prototype.buildKeyframes = function () { - var keyframes = this.keyframes; - var _a = this.timings, delay = _a.delay, duration = _a.duration, easing = _a.easing; - if (this._stretchStartingKeyframe && delay) { - var newKeyframes = []; - var totalTime = duration + delay; - var startingGap = delay / totalTime; - // the original starting keyframe now starts once the delay is done - var newFirstKeyframe = copyStyles(keyframes[0], false); - newFirstKeyframe['offset'] = 0; - newKeyframes.push(newFirstKeyframe); - var oldFirstKeyframe = copyStyles(keyframes[0], false); - oldFirstKeyframe['offset'] = roundOffset(startingGap); - newKeyframes.push(oldFirstKeyframe); - /* - When the keyframe is stretched then it means that the delay before the animation - starts is gone. Instead the first keyframe is placed at the start of the animation - and it is then copied to where it starts when the original delay is over. This basically - means nothing animates during that delay, but the styles are still renderered. For this - to work the original offset values that exist in the original keyframes must be "warped" - so that they can take the new keyframe + delay into account. - - delay=1000, duration=1000, keyframes = 0 .5 1 - - turns into - - delay=0, duration=2000, keyframes = 0 .33 .66 1 - */ - // offsets between 1 ... n -1 are all warped by the keyframe stretch - var limit = keyframes.length - 1; - for (var i = 1; i <= limit; i++) { - var kf = copyStyles(keyframes[i], false); - var oldOffset = kf['offset']; - var timeAtKeyframe = delay + oldOffset * duration; - kf['offset'] = roundOffset(timeAtKeyframe / totalTime); - newKeyframes.push(kf); - } - // the new starting keyframe should be added at the start - duration = totalTime; - delay = 0; - easing = ''; - keyframes = newKeyframes; - } - return createTimelineInstruction(this.element, keyframes, this.preStyleProps, this.postStyleProps, duration, delay, easing, true); - }; - return SubTimelineBuilder; -}(TimelineBuilder)); -function roundOffset(offset, decimalPoints) { - if (decimalPoints === void 0) { decimalPoints = 3; } - var mult = Math.pow(10, decimalPoints - 1); - return Math.round(offset * mult) / mult; -} -function flattenStyles(input, allStyles) { - var styles = {}; - var allProperties; - input.forEach(function (token) { - if (token === '*') { - allProperties = allProperties || Object.keys(allStyles); - allProperties.forEach(function (prop) { styles[prop] = _angular_animations__WEBPACK_IMPORTED_MODULE_1__["AUTO_STYLE"]; }); - } - else { - copyStyles(token, false, styles); - } - }); - return styles; -} - -var Animation = /** @class */ (function () { - function Animation(_driver, input) { - this._driver = _driver; - var errors = []; - var ast = buildAnimationAst(_driver, input, errors); - if (errors.length) { - var errorMessage = "animation validation failed:\n" + errors.join("\n"); - throw new Error(errorMessage); - } - this._animationAst = ast; - } - Animation.prototype.buildTimelines = function (element, startingStyles, destinationStyles, options, subInstructions) { - var start = Array.isArray(startingStyles) ? normalizeStyles(startingStyles) : - startingStyles; - var dest = Array.isArray(destinationStyles) ? normalizeStyles(destinationStyles) : - destinationStyles; - var errors = []; - subInstructions = subInstructions || new ElementInstructionMap(); - var result = buildAnimationTimelines(this._driver, element, this._animationAst, ENTER_CLASSNAME, LEAVE_CLASSNAME, start, dest, options, subInstructions, errors); - if (errors.length) { - var errorMessage = "animation building failed:\n" + errors.join("\n"); - throw new Error(errorMessage); - } - return result; - }; - return Animation; -}()); - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -/** - * @publicApi - */ -var AnimationStyleNormalizer = /** @class */ (function () { - function AnimationStyleNormalizer() { - } - return AnimationStyleNormalizer; -}()); -/** - * @publicApi - */ -var NoopAnimationStyleNormalizer = /** @class */ (function () { - function NoopAnimationStyleNormalizer() { - } - NoopAnimationStyleNormalizer.prototype.normalizePropertyName = function (propertyName, errors) { return propertyName; }; - NoopAnimationStyleNormalizer.prototype.normalizeStyleValue = function (userProvidedProperty, normalizedProperty, value, errors) { - return value; - }; - return NoopAnimationStyleNormalizer; -}()); - -var WebAnimationsStyleNormalizer = /** @class */ (function (_super) { - Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(WebAnimationsStyleNormalizer, _super); - function WebAnimationsStyleNormalizer() { - return _super !== null && _super.apply(this, arguments) || this; - } - WebAnimationsStyleNormalizer.prototype.normalizePropertyName = function (propertyName, errors) { - return dashCaseToCamelCase(propertyName); - }; - WebAnimationsStyleNormalizer.prototype.normalizeStyleValue = function (userProvidedProperty, normalizedProperty, value, errors) { - var unit = ''; - var strVal = value.toString().trim(); - if (DIMENSIONAL_PROP_MAP[normalizedProperty] && value !== 0 && value !== '0') { - if (typeof value === 'number') { - unit = 'px'; - } - else { - var valAndSuffixMatch = value.match(/^[+-]?[\d\.]+([a-z]*)$/); - if (valAndSuffixMatch && valAndSuffixMatch[1].length == 0) { - errors.push("Please provide a CSS unit value for " + userProvidedProperty + ":" + value); - } - } - } - return strVal + unit; - }; - return WebAnimationsStyleNormalizer; -}(AnimationStyleNormalizer)); -var DIMENSIONAL_PROP_MAP = makeBooleanMap('width,height,minWidth,minHeight,maxWidth,maxHeight,left,top,bottom,right,fontSize,outlineWidth,outlineOffset,paddingTop,paddingLeft,paddingBottom,paddingRight,marginTop,marginLeft,marginBottom,marginRight,borderRadius,borderWidth,borderTopWidth,borderLeftWidth,borderRightWidth,borderBottomWidth,textIndent,perspective' - .split(',')); -function makeBooleanMap(keys) { - var map = {}; - keys.forEach(function (key) { return map[key] = true; }); - return map; -} - -function createTransitionInstruction(element, triggerName, fromState, toState, isRemovalTransition, fromStyles, toStyles, timelines, queriedElements, preStyleProps, postStyleProps, totalTime, errors) { - return { - type: 0 /* TransitionAnimation */, - element: element, - triggerName: triggerName, - isRemovalTransition: isRemovalTransition, - fromState: fromState, - fromStyles: fromStyles, - toState: toState, - toStyles: toStyles, - timelines: timelines, - queriedElements: queriedElements, - preStyleProps: preStyleProps, - postStyleProps: postStyleProps, - totalTime: totalTime, - errors: errors - }; -} - -var EMPTY_OBJECT = {}; -var AnimationTransitionFactory = /** @class */ (function () { - function AnimationTransitionFactory(_triggerName, ast, _stateStyles) { - this._triggerName = _triggerName; - this.ast = ast; - this._stateStyles = _stateStyles; - } - AnimationTransitionFactory.prototype.match = function (currentState, nextState, element, params) { - return oneOrMoreTransitionsMatch(this.ast.matchers, currentState, nextState, element, params); - }; - AnimationTransitionFactory.prototype.buildStyles = function (stateName, params, errors) { - var backupStateStyler = this._stateStyles['*']; - var stateStyler = this._stateStyles[stateName]; - var backupStyles = backupStateStyler ? backupStateStyler.buildStyles(params, errors) : {}; - return stateStyler ? stateStyler.buildStyles(params, errors) : backupStyles; - }; - AnimationTransitionFactory.prototype.build = function (driver, element, currentState, nextState, enterClassName, leaveClassName, currentOptions, nextOptions, subInstructions, skipAstBuild) { - var errors = []; - var transitionAnimationParams = this.ast.options && this.ast.options.params || EMPTY_OBJECT; - var currentAnimationParams = currentOptions && currentOptions.params || EMPTY_OBJECT; - var currentStateStyles = this.buildStyles(currentState, currentAnimationParams, errors); - var nextAnimationParams = nextOptions && nextOptions.params || EMPTY_OBJECT; - var nextStateStyles = this.buildStyles(nextState, nextAnimationParams, errors); - var queriedElements = new Set(); - var preStyleMap = new Map(); - var postStyleMap = new Map(); - var isRemoval = nextState === 'void'; - var animationOptions = { params: Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, transitionAnimationParams, nextAnimationParams) }; - var timelines = skipAstBuild ? [] : buildAnimationTimelines(driver, element, this.ast.animation, enterClassName, leaveClassName, currentStateStyles, nextStateStyles, animationOptions, subInstructions, errors); - var totalTime = 0; - timelines.forEach(function (tl) { totalTime = Math.max(tl.duration + tl.delay, totalTime); }); - if (errors.length) { - return createTransitionInstruction(element, this._triggerName, currentState, nextState, isRemoval, currentStateStyles, nextStateStyles, [], [], preStyleMap, postStyleMap, totalTime, errors); - } - timelines.forEach(function (tl) { - var elm = tl.element; - var preProps = getOrSetAsInMap(preStyleMap, elm, {}); - tl.preStyleProps.forEach(function (prop) { return preProps[prop] = true; }); - var postProps = getOrSetAsInMap(postStyleMap, elm, {}); - tl.postStyleProps.forEach(function (prop) { return postProps[prop] = true; }); - if (elm !== element) { - queriedElements.add(elm); - } - }); - var queriedElementsList = iteratorToArray(queriedElements.values()); - return createTransitionInstruction(element, this._triggerName, currentState, nextState, isRemoval, currentStateStyles, nextStateStyles, timelines, queriedElementsList, preStyleMap, postStyleMap, totalTime); - }; - return AnimationTransitionFactory; -}()); -function oneOrMoreTransitionsMatch(matchFns, currentState, nextState, element, params) { - return matchFns.some(function (fn) { return fn(currentState, nextState, element, params); }); -} -var AnimationStateStyles = /** @class */ (function () { - function AnimationStateStyles(styles, defaultParams) { - this.styles = styles; - this.defaultParams = defaultParams; - } - AnimationStateStyles.prototype.buildStyles = function (params, errors) { - var finalStyles = {}; - var combinedParams = copyObj(this.defaultParams); - Object.keys(params).forEach(function (key) { - var value = params[key]; - if (value != null) { - combinedParams[key] = value; - } - }); - this.styles.styles.forEach(function (value) { - if (typeof value !== 'string') { - var styleObj_1 = value; - Object.keys(styleObj_1).forEach(function (prop) { - var val = styleObj_1[prop]; - if (val.length > 1) { - val = interpolateParams(val, combinedParams, errors); - } - finalStyles[prop] = val; - }); - } - }); - return finalStyles; - }; - return AnimationStateStyles; -}()); - -/** - * @publicApi - */ -function buildTrigger(name, ast) { - return new AnimationTrigger(name, ast); -} -/** -* @publicApi -*/ -var AnimationTrigger = /** @class */ (function () { - function AnimationTrigger(name, ast) { - var _this = this; - this.name = name; - this.ast = ast; - this.transitionFactories = []; - this.states = {}; - ast.states.forEach(function (ast) { - var defaultParams = (ast.options && ast.options.params) || {}; - _this.states[ast.name] = new AnimationStateStyles(ast.style, defaultParams); - }); - balanceProperties(this.states, 'true', '1'); - balanceProperties(this.states, 'false', '0'); - ast.transitions.forEach(function (ast) { - _this.transitionFactories.push(new AnimationTransitionFactory(name, ast, _this.states)); - }); - this.fallbackTransition = createFallbackTransition(name, this.states); - } - Object.defineProperty(AnimationTrigger.prototype, "containsQueries", { - get: function () { return this.ast.queryCount > 0; }, - enumerable: true, - configurable: true - }); - AnimationTrigger.prototype.matchTransition = function (currentState, nextState, element, params) { - var entry = this.transitionFactories.find(function (f) { return f.match(currentState, nextState, element, params); }); - return entry || null; - }; - AnimationTrigger.prototype.matchStyles = function (currentState, params, errors) { - return this.fallbackTransition.buildStyles(currentState, params, errors); - }; - return AnimationTrigger; -}()); -function createFallbackTransition(triggerName, states) { - var matchers = [function (fromState, toState) { return true; }]; - var animation = { type: 2 /* Sequence */, steps: [], options: null }; - var transition = { - type: 1 /* Transition */, - animation: animation, - matchers: matchers, - options: null, - queryCount: 0, - depCount: 0 - }; - return new AnimationTransitionFactory(triggerName, transition, states); -} -function balanceProperties(obj, key1, key2) { - if (obj.hasOwnProperty(key1)) { - if (!obj.hasOwnProperty(key2)) { - obj[key2] = obj[key1]; - } - } - else if (obj.hasOwnProperty(key2)) { - obj[key1] = obj[key2]; - } -} - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -var EMPTY_INSTRUCTION_MAP = new ElementInstructionMap(); -var TimelineAnimationEngine = /** @class */ (function () { - function TimelineAnimationEngine(bodyNode, _driver, _normalizer) { - this.bodyNode = bodyNode; - this._driver = _driver; - this._normalizer = _normalizer; - this._animations = {}; - this._playersById = {}; - this.players = []; - } - TimelineAnimationEngine.prototype.register = function (id, metadata) { - var errors = []; - var ast = buildAnimationAst(this._driver, metadata, errors); - if (errors.length) { - throw new Error("Unable to build the animation due to the following errors: " + errors.join("\n")); - } - else { - this._animations[id] = ast; - } - }; - TimelineAnimationEngine.prototype._buildPlayer = function (i, preStyles, postStyles) { - var element = i.element; - var keyframes = normalizeKeyframes(this._driver, this._normalizer, element, i.keyframes, preStyles, postStyles); - return this._driver.animate(element, keyframes, i.duration, i.delay, i.easing, [], true); - }; - TimelineAnimationEngine.prototype.create = function (id, element, options) { - var _this = this; - if (options === void 0) { options = {}; } - var errors = []; - var ast = this._animations[id]; - var instructions; - var autoStylesMap = new Map(); - if (ast) { - instructions = buildAnimationTimelines(this._driver, element, ast, ENTER_CLASSNAME, LEAVE_CLASSNAME, {}, {}, options, EMPTY_INSTRUCTION_MAP, errors); - instructions.forEach(function (inst) { - var styles = getOrSetAsInMap(autoStylesMap, inst.element, {}); - inst.postStyleProps.forEach(function (prop) { return styles[prop] = null; }); - }); - } - else { - errors.push('The requested animation doesn\'t exist or has already been destroyed'); - instructions = []; - } - if (errors.length) { - throw new Error("Unable to create the animation due to the following errors: " + errors.join("\n")); - } - autoStylesMap.forEach(function (styles, element) { - Object.keys(styles).forEach(function (prop) { styles[prop] = _this._driver.computeStyle(element, prop, _angular_animations__WEBPACK_IMPORTED_MODULE_1__["AUTO_STYLE"]); }); - }); - var players = instructions.map(function (i) { - var styles = autoStylesMap.get(i.element); - return _this._buildPlayer(i, {}, styles); - }); - var player = optimizeGroupPlayer(players); - this._playersById[id] = player; - player.onDestroy(function () { return _this.destroy(id); }); - this.players.push(player); - return player; - }; - TimelineAnimationEngine.prototype.destroy = function (id) { - var player = this._getPlayer(id); - player.destroy(); - delete this._playersById[id]; - var index = this.players.indexOf(player); - if (index >= 0) { - this.players.splice(index, 1); - } - }; - TimelineAnimationEngine.prototype._getPlayer = function (id) { - var player = this._playersById[id]; - if (!player) { - throw new Error("Unable to find the timeline player referenced by " + id); - } - return player; - }; - TimelineAnimationEngine.prototype.listen = function (id, element, eventName, callback) { - // triggerName, fromState, toState are all ignored for timeline animations - var baseEvent = makeAnimationEvent(element, '', '', ''); - listenOnPlayer(this._getPlayer(id), eventName, baseEvent, callback); - return function () { }; - }; - TimelineAnimationEngine.prototype.command = function (id, element, command, args) { - if (command == 'register') { - this.register(id, args[0]); - return; - } - if (command == 'create') { - var options = (args[0] || {}); - this.create(id, element, options); - return; - } - var player = this._getPlayer(id); - switch (command) { - case 'play': - player.play(); - break; - case 'pause': - player.pause(); - break; - case 'reset': - player.reset(); - break; - case 'restart': - player.restart(); - break; - case 'finish': - player.finish(); - break; - case 'init': - player.init(); - break; - case 'setPosition': - player.setPosition(parseFloat(args[0])); - break; - case 'destroy': - this.destroy(id); - break; - } - }; - return TimelineAnimationEngine; -}()); - -var QUEUED_CLASSNAME = 'ng-animate-queued'; -var QUEUED_SELECTOR = '.ng-animate-queued'; -var DISABLED_CLASSNAME = 'ng-animate-disabled'; -var DISABLED_SELECTOR = '.ng-animate-disabled'; -var STAR_CLASSNAME = 'ng-star-inserted'; -var STAR_SELECTOR = '.ng-star-inserted'; -var EMPTY_PLAYER_ARRAY = []; -var NULL_REMOVAL_STATE = { - namespaceId: '', - setForRemoval: false, - setForMove: false, - hasAnimation: false, - removedBeforeQueried: false -}; -var NULL_REMOVED_QUERIED_STATE = { - namespaceId: '', - setForMove: false, - setForRemoval: false, - hasAnimation: false, - removedBeforeQueried: true -}; -var REMOVAL_FLAG = '__ng_removed'; -var StateValue = /** @class */ (function () { - function StateValue(input, namespaceId) { - if (namespaceId === void 0) { namespaceId = ''; } - this.namespaceId = namespaceId; - var isObj = input && input.hasOwnProperty('value'); - var value = isObj ? input['value'] : input; - this.value = normalizeTriggerValue(value); - if (isObj) { - var options = copyObj(input); - delete options['value']; - this.options = options; - } - else { - this.options = {}; - } - if (!this.options.params) { - this.options.params = {}; - } - } - Object.defineProperty(StateValue.prototype, "params", { - get: function () { return this.options.params; }, - enumerable: true, - configurable: true - }); - StateValue.prototype.absorbOptions = function (options) { - var newParams = options.params; - if (newParams) { - var oldParams_1 = this.options.params; - Object.keys(newParams).forEach(function (prop) { - if (oldParams_1[prop] == null) { - oldParams_1[prop] = newParams[prop]; - } - }); - } - }; - return StateValue; -}()); -var VOID_VALUE = 'void'; -var DEFAULT_STATE_VALUE = new StateValue(VOID_VALUE); -var AnimationTransitionNamespace = /** @class */ (function () { - function AnimationTransitionNamespace(id, hostElement, _engine) { - this.id = id; - this.hostElement = hostElement; - this._engine = _engine; - this.players = []; - this._triggers = {}; - this._queue = []; - this._elementListeners = new Map(); - this._hostClassName = 'ng-tns-' + id; - addClass(hostElement, this._hostClassName); - } - AnimationTransitionNamespace.prototype.listen = function (element, name, phase, callback) { - var _this = this; - if (!this._triggers.hasOwnProperty(name)) { - throw new Error("Unable to listen on the animation trigger event \"" + phase + "\" because the animation trigger \"" + name + "\" doesn't exist!"); - } - if (phase == null || phase.length == 0) { - throw new Error("Unable to listen on the animation trigger \"" + name + "\" because the provided event is undefined!"); - } - if (!isTriggerEventValid(phase)) { - throw new Error("The provided animation trigger event \"" + phase + "\" for the animation trigger \"" + name + "\" is not supported!"); - } - var listeners = getOrSetAsInMap(this._elementListeners, element, []); - var data = { name: name, phase: phase, callback: callback }; - listeners.push(data); - var triggersWithStates = getOrSetAsInMap(this._engine.statesByElement, element, {}); - if (!triggersWithStates.hasOwnProperty(name)) { - addClass(element, NG_TRIGGER_CLASSNAME); - addClass(element, NG_TRIGGER_CLASSNAME + '-' + name); - triggersWithStates[name] = DEFAULT_STATE_VALUE; - } - return function () { - // the event listener is removed AFTER the flush has occurred such - // that leave animations callbacks can fire (otherwise if the node - // is removed in between then the listeners would be deregistered) - _this._engine.afterFlush(function () { - var index = listeners.indexOf(data); - if (index >= 0) { - listeners.splice(index, 1); - } - if (!_this._triggers[name]) { - delete triggersWithStates[name]; - } - }); - }; - }; - AnimationTransitionNamespace.prototype.register = function (name, ast) { - if (this._triggers[name]) { - // throw - return false; - } - else { - this._triggers[name] = ast; - return true; - } - }; - AnimationTransitionNamespace.prototype._getTrigger = function (name) { - var trigger = this._triggers[name]; - if (!trigger) { - throw new Error("The provided animation trigger \"" + name + "\" has not been registered!"); - } - return trigger; - }; - AnimationTransitionNamespace.prototype.trigger = function (element, triggerName, value, defaultToFallback) { - var _this = this; - if (defaultToFallback === void 0) { defaultToFallback = true; } - var trigger = this._getTrigger(triggerName); - var player = new TransitionAnimationPlayer(this.id, triggerName, element); - var triggersWithStates = this._engine.statesByElement.get(element); - if (!triggersWithStates) { - addClass(element, NG_TRIGGER_CLASSNAME); - addClass(element, NG_TRIGGER_CLASSNAME + '-' + triggerName); - this._engine.statesByElement.set(element, triggersWithStates = {}); - } - var fromState = triggersWithStates[triggerName]; - var toState = new StateValue(value, this.id); - var isObj = value && value.hasOwnProperty('value'); - if (!isObj && fromState) { - toState.absorbOptions(fromState.options); - } - triggersWithStates[triggerName] = toState; - if (!fromState) { - fromState = DEFAULT_STATE_VALUE; - } - var isRemoval = toState.value === VOID_VALUE; - // normally this isn't reached by here, however, if an object expression - // is passed in then it may be a new object each time. Comparing the value - // is important since that will stay the same despite there being a new object. - // The removal arc here is special cased because the same element is triggered - // twice in the event that it contains animations on the outer/inner portions - // of the host container - if (!isRemoval && fromState.value === toState.value) { - // this means that despite the value not changing, some inner params - // have changed which means that the animation final styles need to be applied - if (!objEquals(fromState.params, toState.params)) { - var errors = []; - var fromStyles_1 = trigger.matchStyles(fromState.value, fromState.params, errors); - var toStyles_1 = trigger.matchStyles(toState.value, toState.params, errors); - if (errors.length) { - this._engine.reportError(errors); - } - else { - this._engine.afterFlush(function () { - eraseStyles(element, fromStyles_1); - setStyles(element, toStyles_1); - }); - } - } - return; - } - var playersOnElement = getOrSetAsInMap(this._engine.playersByElement, element, []); - playersOnElement.forEach(function (player) { - // only remove the player if it is queued on the EXACT same trigger/namespace - // we only also deal with queued players here because if the animation has - // started then we want to keep the player alive until the flush happens - // (which is where the previousPlayers are passed into the new palyer) - if (player.namespaceId == _this.id && player.triggerName == triggerName && player.queued) { - player.destroy(); - } - }); - var transition = trigger.matchTransition(fromState.value, toState.value, element, toState.params); - var isFallbackTransition = false; - if (!transition) { - if (!defaultToFallback) - return; - transition = trigger.fallbackTransition; - isFallbackTransition = true; - } - this._engine.totalQueuedPlayers++; - this._queue.push({ element: element, triggerName: triggerName, transition: transition, fromState: fromState, toState: toState, player: player, isFallbackTransition: isFallbackTransition }); - if (!isFallbackTransition) { - addClass(element, QUEUED_CLASSNAME); - player.onStart(function () { removeClass(element, QUEUED_CLASSNAME); }); - } - player.onDone(function () { - var index = _this.players.indexOf(player); - if (index >= 0) { - _this.players.splice(index, 1); - } - var players = _this._engine.playersByElement.get(element); - if (players) { - var index_1 = players.indexOf(player); - if (index_1 >= 0) { - players.splice(index_1, 1); - } - } - }); - this.players.push(player); - playersOnElement.push(player); - return player; - }; - AnimationTransitionNamespace.prototype.deregister = function (name) { - var _this = this; - delete this._triggers[name]; - this._engine.statesByElement.forEach(function (stateMap, element) { delete stateMap[name]; }); - this._elementListeners.forEach(function (listeners, element) { - _this._elementListeners.set(element, listeners.filter(function (entry) { return entry.name != name; })); - }); - }; - AnimationTransitionNamespace.prototype.clearElementCache = function (element) { - this._engine.statesByElement.delete(element); - this._elementListeners.delete(element); - var elementPlayers = this._engine.playersByElement.get(element); - if (elementPlayers) { - elementPlayers.forEach(function (player) { return player.destroy(); }); - this._engine.playersByElement.delete(element); - } - }; - AnimationTransitionNamespace.prototype._signalRemovalForInnerTriggers = function (rootElement, context, animate) { - var _this = this; - if (animate === void 0) { animate = false; } - // emulate a leave animation for all inner nodes within this node. - // If there are no animations found for any of the nodes then clear the cache - // for the element. - this._engine.driver.query(rootElement, NG_TRIGGER_SELECTOR, true).forEach(function (elm) { - // this means that an inner remove() operation has already kicked off - // the animation on this element... - if (elm[REMOVAL_FLAG]) - return; - var namespaces = _this._engine.fetchNamespacesByElement(elm); - if (namespaces.size) { - namespaces.forEach(function (ns) { return ns.triggerLeaveAnimation(elm, context, false, true); }); - } - else { - _this.clearElementCache(elm); - } - }); - }; - AnimationTransitionNamespace.prototype.triggerLeaveAnimation = function (element, context, destroyAfterComplete, defaultToFallback) { - var _this = this; - var triggerStates = this._engine.statesByElement.get(element); - if (triggerStates) { - var players_1 = []; - Object.keys(triggerStates).forEach(function (triggerName) { - // this check is here in the event that an element is removed - // twice (both on the host level and the component level) - if (_this._triggers[triggerName]) { - var player = _this.trigger(element, triggerName, VOID_VALUE, defaultToFallback); - if (player) { - players_1.push(player); - } - } - }); - if (players_1.length) { - this._engine.markElementAsRemoved(this.id, element, true, context); - if (destroyAfterComplete) { - optimizeGroupPlayer(players_1).onDone(function () { return _this._engine.processLeaveNode(element); }); - } - return true; - } - } - return false; - }; - AnimationTransitionNamespace.prototype.prepareLeaveAnimationListeners = function (element) { - var _this = this; - var listeners = this._elementListeners.get(element); - if (listeners) { - var visitedTriggers_1 = new Set(); - listeners.forEach(function (listener) { - var triggerName = listener.name; - if (visitedTriggers_1.has(triggerName)) - return; - visitedTriggers_1.add(triggerName); - var trigger = _this._triggers[triggerName]; - var transition = trigger.fallbackTransition; - var elementStates = _this._engine.statesByElement.get(element); - var fromState = elementStates[triggerName] || DEFAULT_STATE_VALUE; - var toState = new StateValue(VOID_VALUE); - var player = new TransitionAnimationPlayer(_this.id, triggerName, element); - _this._engine.totalQueuedPlayers++; - _this._queue.push({ - element: element, - triggerName: triggerName, - transition: transition, - fromState: fromState, - toState: toState, - player: player, - isFallbackTransition: true - }); - }); - } - }; - AnimationTransitionNamespace.prototype.removeNode = function (element, context) { - var _this = this; - var engine = this._engine; - if (element.childElementCount) { - this._signalRemovalForInnerTriggers(element, context, true); - } - // this means that a * => VOID animation was detected and kicked off - if (this.triggerLeaveAnimation(element, context, true)) - return; - // find the player that is animating and make sure that the - // removal is delayed until that player has completed - var containsPotentialParentTransition = false; - if (engine.totalAnimations) { - var currentPlayers = engine.players.length ? engine.playersByQueriedElement.get(element) : []; - // when this `if statement` does not continue forward it means that - // a previous animation query has selected the current element and - // is animating it. In this situation want to continue forwards and - // allow the element to be queued up for animation later. - if (currentPlayers && currentPlayers.length) { - containsPotentialParentTransition = true; - } - else { - var parent_1 = element; - while (parent_1 = parent_1.parentNode) { - var triggers = engine.statesByElement.get(parent_1); - if (triggers) { - containsPotentialParentTransition = true; - break; - } - } - } - } - // at this stage we know that the element will either get removed - // during flush or will be picked up by a parent query. Either way - // we need to fire the listeners for this element when it DOES get - // removed (once the query parent animation is done or after flush) - this.prepareLeaveAnimationListeners(element); - // whether or not a parent has an animation we need to delay the deferral of the leave - // operation until we have more information (which we do after flush() has been called) - if (containsPotentialParentTransition) { - engine.markElementAsRemoved(this.id, element, false, context); - } - else { - // we do this after the flush has occurred such - // that the callbacks can be fired - engine.afterFlush(function () { return _this.clearElementCache(element); }); - engine.destroyInnerAnimations(element); - engine._onRemovalComplete(element, context); - } - }; - AnimationTransitionNamespace.prototype.insertNode = function (element, parent) { addClass(element, this._hostClassName); }; - AnimationTransitionNamespace.prototype.drainQueuedTransitions = function (microtaskId) { - var _this = this; - var instructions = []; - this._queue.forEach(function (entry) { - var player = entry.player; - if (player.destroyed) - return; - var element = entry.element; - var listeners = _this._elementListeners.get(element); - if (listeners) { - listeners.forEach(function (listener) { - if (listener.name == entry.triggerName) { - var baseEvent = makeAnimationEvent(element, entry.triggerName, entry.fromState.value, entry.toState.value); - baseEvent['_data'] = microtaskId; - listenOnPlayer(entry.player, listener.phase, baseEvent, listener.callback); - } - }); - } - if (player.markedForDestroy) { - _this._engine.afterFlush(function () { - // now we can destroy the element properly since the event listeners have - // been bound to the player - player.destroy(); - }); - } - else { - instructions.push(entry); - } - }); - this._queue = []; - return instructions.sort(function (a, b) { - // if depCount == 0 them move to front - // otherwise if a contains b then move back - var d0 = a.transition.ast.depCount; - var d1 = b.transition.ast.depCount; - if (d0 == 0 || d1 == 0) { - return d0 - d1; - } - return _this._engine.driver.containsElement(a.element, b.element) ? 1 : -1; - }); - }; - AnimationTransitionNamespace.prototype.destroy = function (context) { - this.players.forEach(function (p) { return p.destroy(); }); - this._signalRemovalForInnerTriggers(this.hostElement, context); - }; - AnimationTransitionNamespace.prototype.elementContainsData = function (element) { - var containsData = false; - if (this._elementListeners.has(element)) - containsData = true; - containsData = - (this._queue.find(function (entry) { return entry.element === element; }) ? true : false) || containsData; - return containsData; - }; - return AnimationTransitionNamespace; -}()); -var TransitionAnimationEngine = /** @class */ (function () { - function TransitionAnimationEngine(bodyNode, driver, _normalizer) { - this.bodyNode = bodyNode; - this.driver = driver; - this._normalizer = _normalizer; - this.players = []; - this.newHostElements = new Map(); - this.playersByElement = new Map(); - this.playersByQueriedElement = new Map(); - this.statesByElement = new Map(); - this.disabledNodes = new Set(); - this.totalAnimations = 0; - this.totalQueuedPlayers = 0; - this._namespaceLookup = {}; - this._namespaceList = []; - this._flushFns = []; - this._whenQuietFns = []; - this.namespacesByHostElement = new Map(); - this.collectedEnterElements = []; - this.collectedLeaveElements = []; - // this method is designed to be overridden by the code that uses this engine - this.onRemovalComplete = function (element, context) { }; - } - /** @internal */ - TransitionAnimationEngine.prototype._onRemovalComplete = function (element, context) { this.onRemovalComplete(element, context); }; - Object.defineProperty(TransitionAnimationEngine.prototype, "queuedPlayers", { - get: function () { - var players = []; - this._namespaceList.forEach(function (ns) { - ns.players.forEach(function (player) { - if (player.queued) { - players.push(player); - } - }); - }); - return players; - }, - enumerable: true, - configurable: true - }); - TransitionAnimationEngine.prototype.createNamespace = function (namespaceId, hostElement) { - var ns = new AnimationTransitionNamespace(namespaceId, hostElement, this); - if (hostElement.parentNode) { - this._balanceNamespaceList(ns, hostElement); - } - else { - // defer this later until flush during when the host element has - // been inserted so that we know exactly where to place it in - // the namespace list - this.newHostElements.set(hostElement, ns); - // given that this host element is apart of the animation code, it - // may or may not be inserted by a parent node that is an of an - // animation renderer type. If this happens then we can still have - // access to this item when we query for :enter nodes. If the parent - // is a renderer then the set data-structure will normalize the entry - this.collectEnterElement(hostElement); - } - return this._namespaceLookup[namespaceId] = ns; - }; - TransitionAnimationEngine.prototype._balanceNamespaceList = function (ns, hostElement) { - var limit = this._namespaceList.length - 1; - if (limit >= 0) { - var found = false; - for (var i = limit; i >= 0; i--) { - var nextNamespace = this._namespaceList[i]; - if (this.driver.containsElement(nextNamespace.hostElement, hostElement)) { - this._namespaceList.splice(i + 1, 0, ns); - found = true; - break; - } - } - if (!found) { - this._namespaceList.splice(0, 0, ns); - } - } - else { - this._namespaceList.push(ns); - } - this.namespacesByHostElement.set(hostElement, ns); - return ns; - }; - TransitionAnimationEngine.prototype.register = function (namespaceId, hostElement) { - var ns = this._namespaceLookup[namespaceId]; - if (!ns) { - ns = this.createNamespace(namespaceId, hostElement); - } - return ns; - }; - TransitionAnimationEngine.prototype.registerTrigger = function (namespaceId, name, trigger) { - var ns = this._namespaceLookup[namespaceId]; - if (ns && ns.register(name, trigger)) { - this.totalAnimations++; - } - }; - TransitionAnimationEngine.prototype.destroy = function (namespaceId, context) { - var _this = this; - if (!namespaceId) - return; - var ns = this._fetchNamespace(namespaceId); - this.afterFlush(function () { - _this.namespacesByHostElement.delete(ns.hostElement); - delete _this._namespaceLookup[namespaceId]; - var index = _this._namespaceList.indexOf(ns); - if (index >= 0) { - _this._namespaceList.splice(index, 1); - } - }); - this.afterFlushAnimationsDone(function () { return ns.destroy(context); }); - }; - TransitionAnimationEngine.prototype._fetchNamespace = function (id) { return this._namespaceLookup[id]; }; - TransitionAnimationEngine.prototype.fetchNamespacesByElement = function (element) { - // normally there should only be one namespace per element, however - // if @triggers are placed on both the component element and then - // its host element (within the component code) then there will be - // two namespaces returned. We use a set here to simply the dedupe - // of namespaces incase there are multiple triggers both the elm and host - var namespaces = new Set(); - var elementStates = this.statesByElement.get(element); - if (elementStates) { - var keys = Object.keys(elementStates); - for (var i = 0; i < keys.length; i++) { - var nsId = elementStates[keys[i]].namespaceId; - if (nsId) { - var ns = this._fetchNamespace(nsId); - if (ns) { - namespaces.add(ns); - } - } - } - } - return namespaces; - }; - TransitionAnimationEngine.prototype.trigger = function (namespaceId, element, name, value) { - if (isElementNode(element)) { - var ns = this._fetchNamespace(namespaceId); - if (ns) { - ns.trigger(element, name, value); - return true; - } - } - return false; - }; - TransitionAnimationEngine.prototype.insertNode = function (namespaceId, element, parent, insertBefore) { - if (!isElementNode(element)) - return; - // special case for when an element is removed and reinserted (move operation) - // when this occurs we do not want to use the element for deletion later - var details = element[REMOVAL_FLAG]; - if (details && details.setForRemoval) { - details.setForRemoval = false; - details.setForMove = true; - var index = this.collectedLeaveElements.indexOf(element); - if (index >= 0) { - this.collectedLeaveElements.splice(index, 1); - } - } - // in the event that the namespaceId is blank then the caller - // code does not contain any animation code in it, but it is - // just being called so that the node is marked as being inserted - if (namespaceId) { - var ns = this._fetchNamespace(namespaceId); - // This if-statement is a workaround for router issue #21947. - // The router sometimes hits a race condition where while a route - // is being instantiated a new navigation arrives, triggering leave - // animation of DOM that has not been fully initialized, until this - // is resolved, we need to handle the scenario when DOM is not in a - // consistent state during the animation. - if (ns) { - ns.insertNode(element, parent); - } - } - // only *directives and host elements are inserted before - if (insertBefore) { - this.collectEnterElement(element); - } - }; - TransitionAnimationEngine.prototype.collectEnterElement = function (element) { this.collectedEnterElements.push(element); }; - TransitionAnimationEngine.prototype.markElementAsDisabled = function (element, value) { - if (value) { - if (!this.disabledNodes.has(element)) { - this.disabledNodes.add(element); - addClass(element, DISABLED_CLASSNAME); - } - } - else if (this.disabledNodes.has(element)) { - this.disabledNodes.delete(element); - removeClass(element, DISABLED_CLASSNAME); - } - }; - TransitionAnimationEngine.prototype.removeNode = function (namespaceId, element, context) { - if (!isElementNode(element)) { - this._onRemovalComplete(element, context); - return; - } - var ns = namespaceId ? this._fetchNamespace(namespaceId) : null; - if (ns) { - ns.removeNode(element, context); - } - else { - this.markElementAsRemoved(namespaceId, element, false, context); - } - }; - TransitionAnimationEngine.prototype.markElementAsRemoved = function (namespaceId, element, hasAnimation, context) { - this.collectedLeaveElements.push(element); - element[REMOVAL_FLAG] = { - namespaceId: namespaceId, - setForRemoval: context, hasAnimation: hasAnimation, - removedBeforeQueried: false - }; - }; - TransitionAnimationEngine.prototype.listen = function (namespaceId, element, name, phase, callback) { - if (isElementNode(element)) { - return this._fetchNamespace(namespaceId).listen(element, name, phase, callback); - } - return function () { }; - }; - TransitionAnimationEngine.prototype._buildInstruction = function (entry, subTimelines, enterClassName, leaveClassName, skipBuildAst) { - return entry.transition.build(this.driver, entry.element, entry.fromState.value, entry.toState.value, enterClassName, leaveClassName, entry.fromState.options, entry.toState.options, subTimelines, skipBuildAst); - }; - TransitionAnimationEngine.prototype.destroyInnerAnimations = function (containerElement) { - var _this = this; - var elements = this.driver.query(containerElement, NG_TRIGGER_SELECTOR, true); - elements.forEach(function (element) { return _this.destroyActiveAnimationsForElement(element); }); - if (this.playersByQueriedElement.size == 0) - return; - elements = this.driver.query(containerElement, NG_ANIMATING_SELECTOR, true); - elements.forEach(function (element) { return _this.finishActiveQueriedAnimationOnElement(element); }); - }; - TransitionAnimationEngine.prototype.destroyActiveAnimationsForElement = function (element) { - var players = this.playersByElement.get(element); - if (players) { - players.forEach(function (player) { - // special case for when an element is set for destruction, but hasn't started. - // in this situation we want to delay the destruction until the flush occurs - // so that any event listeners attached to the player are triggered. - if (player.queued) { - player.markedForDestroy = true; - } - else { - player.destroy(); - } - }); - } - }; - TransitionAnimationEngine.prototype.finishActiveQueriedAnimationOnElement = function (element) { - var players = this.playersByQueriedElement.get(element); - if (players) { - players.forEach(function (player) { return player.finish(); }); - } - }; - TransitionAnimationEngine.prototype.whenRenderingDone = function () { - var _this = this; - return new Promise(function (resolve) { - if (_this.players.length) { - return optimizeGroupPlayer(_this.players).onDone(function () { return resolve(); }); - } - else { - resolve(); - } - }); - }; - TransitionAnimationEngine.prototype.processLeaveNode = function (element) { - var _this = this; - var details = element[REMOVAL_FLAG]; - if (details && details.setForRemoval) { - // this will prevent it from removing it twice - element[REMOVAL_FLAG] = NULL_REMOVAL_STATE; - if (details.namespaceId) { - this.destroyInnerAnimations(element); - var ns = this._fetchNamespace(details.namespaceId); - if (ns) { - ns.clearElementCache(element); - } - } - this._onRemovalComplete(element, details.setForRemoval); - } - if (this.driver.matchesElement(element, DISABLED_SELECTOR)) { - this.markElementAsDisabled(element, false); - } - this.driver.query(element, DISABLED_SELECTOR, true).forEach(function (node) { - _this.markElementAsDisabled(node, false); - }); - }; - TransitionAnimationEngine.prototype.flush = function (microtaskId) { - var _this = this; - if (microtaskId === void 0) { microtaskId = -1; } - var players = []; - if (this.newHostElements.size) { - this.newHostElements.forEach(function (ns, element) { return _this._balanceNamespaceList(ns, element); }); - this.newHostElements.clear(); - } - if (this.totalAnimations && this.collectedEnterElements.length) { - for (var i = 0; i < this.collectedEnterElements.length; i++) { - var elm = this.collectedEnterElements[i]; - addClass(elm, STAR_CLASSNAME); - } - } - if (this._namespaceList.length && - (this.totalQueuedPlayers || this.collectedLeaveElements.length)) { - var cleanupFns = []; - try { - players = this._flushAnimations(cleanupFns, microtaskId); - } - finally { - for (var i = 0; i < cleanupFns.length; i++) { - cleanupFns[i](); - } - } - } - else { - for (var i = 0; i < this.collectedLeaveElements.length; i++) { - var element = this.collectedLeaveElements[i]; - this.processLeaveNode(element); - } - } - this.totalQueuedPlayers = 0; - this.collectedEnterElements.length = 0; - this.collectedLeaveElements.length = 0; - this._flushFns.forEach(function (fn) { return fn(); }); - this._flushFns = []; - if (this._whenQuietFns.length) { - // we move these over to a variable so that - // if any new callbacks are registered in another - // flush they do not populate the existing set - var quietFns_1 = this._whenQuietFns; - this._whenQuietFns = []; - if (players.length) { - optimizeGroupPlayer(players).onDone(function () { quietFns_1.forEach(function (fn) { return fn(); }); }); - } - else { - quietFns_1.forEach(function (fn) { return fn(); }); - } - } - }; - TransitionAnimationEngine.prototype.reportError = function (errors) { - throw new Error("Unable to process animations due to the following failed trigger transitions\n " + errors.join('\n')); - }; - TransitionAnimationEngine.prototype._flushAnimations = function (cleanupFns, microtaskId) { - var _this = this; - var subTimelines = new ElementInstructionMap(); - var skippedPlayers = []; - var skippedPlayersMap = new Map(); - var queuedInstructions = []; - var queriedElements = new Map(); - var allPreStyleElements = new Map(); - var allPostStyleElements = new Map(); - var disabledElementsSet = new Set(); - this.disabledNodes.forEach(function (node) { - disabledElementsSet.add(node); - var nodesThatAreDisabled = _this.driver.query(node, QUEUED_SELECTOR, true); - for (var i_1 = 0; i_1 < nodesThatAreDisabled.length; i_1++) { - disabledElementsSet.add(nodesThatAreDisabled[i_1]); - } - }); - var bodyNode = this.bodyNode; - var allTriggerElements = Array.from(this.statesByElement.keys()); - var enterNodeMap = buildRootMap(allTriggerElements, this.collectedEnterElements); - // this must occur before the instructions are built below such that - // the :enter queries match the elements (since the timeline queries - // are fired during instruction building). - var enterNodeMapIds = new Map(); - var i = 0; - enterNodeMap.forEach(function (nodes, root) { - var className = ENTER_CLASSNAME + i++; - enterNodeMapIds.set(root, className); - nodes.forEach(function (node) { return addClass(node, className); }); - }); - var allLeaveNodes = []; - var mergedLeaveNodes = new Set(); - var leaveNodesWithoutAnimations = new Set(); - for (var i_2 = 0; i_2 < this.collectedLeaveElements.length; i_2++) { - var element = this.collectedLeaveElements[i_2]; - var details = element[REMOVAL_FLAG]; - if (details && details.setForRemoval) { - allLeaveNodes.push(element); - mergedLeaveNodes.add(element); - if (details.hasAnimation) { - this.driver.query(element, STAR_SELECTOR, true).forEach(function (elm) { return mergedLeaveNodes.add(elm); }); - } - else { - leaveNodesWithoutAnimations.add(element); - } - } - } - var leaveNodeMapIds = new Map(); - var leaveNodeMap = buildRootMap(allTriggerElements, Array.from(mergedLeaveNodes)); - leaveNodeMap.forEach(function (nodes, root) { - var className = LEAVE_CLASSNAME + i++; - leaveNodeMapIds.set(root, className); - nodes.forEach(function (node) { return addClass(node, className); }); - }); - cleanupFns.push(function () { - enterNodeMap.forEach(function (nodes, root) { - var className = enterNodeMapIds.get(root); - nodes.forEach(function (node) { return removeClass(node, className); }); - }); - leaveNodeMap.forEach(function (nodes, root) { - var className = leaveNodeMapIds.get(root); - nodes.forEach(function (node) { return removeClass(node, className); }); - }); - allLeaveNodes.forEach(function (element) { _this.processLeaveNode(element); }); - }); - var allPlayers = []; - var erroneousTransitions = []; - for (var i_3 = this._namespaceList.length - 1; i_3 >= 0; i_3--) { - var ns = this._namespaceList[i_3]; - ns.drainQueuedTransitions(microtaskId).forEach(function (entry) { - var player = entry.player; - var element = entry.element; - allPlayers.push(player); - if (_this.collectedEnterElements.length) { - var details = element[REMOVAL_FLAG]; - // move animations are currently not supported... - if (details && details.setForMove) { - player.destroy(); - return; - } - } - var nodeIsOrphaned = !bodyNode || !_this.driver.containsElement(bodyNode, element); - var leaveClassName = leaveNodeMapIds.get(element); - var enterClassName = enterNodeMapIds.get(element); - var instruction = _this._buildInstruction(entry, subTimelines, enterClassName, leaveClassName, nodeIsOrphaned); - if (instruction.errors && instruction.errors.length) { - erroneousTransitions.push(instruction); - return; - } - // even though the element may not be apart of the DOM, it may - // still be added at a later point (due to the mechanics of content - // projection and/or dynamic component insertion) therefore it's - // important we still style the element. - if (nodeIsOrphaned) { - player.onStart(function () { return eraseStyles(element, instruction.fromStyles); }); - player.onDestroy(function () { return setStyles(element, instruction.toStyles); }); - skippedPlayers.push(player); - return; - } - // if a unmatched transition is queued to go then it SHOULD NOT render - // an animation and cancel the previously running animations. - if (entry.isFallbackTransition) { - player.onStart(function () { return eraseStyles(element, instruction.fromStyles); }); - player.onDestroy(function () { return setStyles(element, instruction.toStyles); }); - skippedPlayers.push(player); - return; - } - // this means that if a parent animation uses this animation as a sub trigger - // then it will instruct the timeline builder to not add a player delay, but - // instead stretch the first keyframe gap up until the animation starts. The - // reason this is important is to prevent extra initialization styles from being - // required by the user in the animation. - instruction.timelines.forEach(function (tl) { return tl.stretchStartingKeyframe = true; }); - subTimelines.append(element, instruction.timelines); - var tuple = { instruction: instruction, player: player, element: element }; - queuedInstructions.push(tuple); - instruction.queriedElements.forEach(function (element) { return getOrSetAsInMap(queriedElements, element, []).push(player); }); - instruction.preStyleProps.forEach(function (stringMap, element) { - var props = Object.keys(stringMap); - if (props.length) { - var setVal_1 = allPreStyleElements.get(element); - if (!setVal_1) { - allPreStyleElements.set(element, setVal_1 = new Set()); - } - props.forEach(function (prop) { return setVal_1.add(prop); }); - } - }); - instruction.postStyleProps.forEach(function (stringMap, element) { - var props = Object.keys(stringMap); - var setVal = allPostStyleElements.get(element); - if (!setVal) { - allPostStyleElements.set(element, setVal = new Set()); - } - props.forEach(function (prop) { return setVal.add(prop); }); - }); - }); - } - if (erroneousTransitions.length) { - var errors_1 = []; - erroneousTransitions.forEach(function (instruction) { - errors_1.push("@" + instruction.triggerName + " has failed due to:\n"); - instruction.errors.forEach(function (error) { return errors_1.push("- " + error + "\n"); }); - }); - allPlayers.forEach(function (player) { return player.destroy(); }); - this.reportError(errors_1); - } - var allPreviousPlayersMap = new Map(); - // this map works to tell which element in the DOM tree is contained by - // which animation. Further down below this map will get populated once - // the players are built and in doing so it can efficiently figure out - // if a sub player is skipped due to a parent player having priority. - var animationElementMap = new Map(); - queuedInstructions.forEach(function (entry) { - var element = entry.element; - if (subTimelines.has(element)) { - animationElementMap.set(element, element); - _this._beforeAnimationBuild(entry.player.namespaceId, entry.instruction, allPreviousPlayersMap); - } - }); - skippedPlayers.forEach(function (player) { - var element = player.element; - var previousPlayers = _this._getPreviousPlayers(element, false, player.namespaceId, player.triggerName, null); - previousPlayers.forEach(function (prevPlayer) { - getOrSetAsInMap(allPreviousPlayersMap, element, []).push(prevPlayer); - prevPlayer.destroy(); - }); - }); - // this is a special case for nodes that will be removed (either by) - // having their own leave animations or by being queried in a container - // that will be removed once a parent animation is complete. The idea - // here is that * styles must be identical to ! styles because of - // backwards compatibility (* is also filled in by default in many places). - // Otherwise * styles will return an empty value or auto since the element - // that is being getComputedStyle'd will not be visible (since * = destination) - var replaceNodes = allLeaveNodes.filter(function (node) { - return replacePostStylesAsPre(node, allPreStyleElements, allPostStyleElements); - }); - // POST STAGE: fill the * styles - var postStylesMap = new Map(); - var allLeaveQueriedNodes = cloakAndComputeStyles(postStylesMap, this.driver, leaveNodesWithoutAnimations, allPostStyleElements, _angular_animations__WEBPACK_IMPORTED_MODULE_1__["AUTO_STYLE"]); - allLeaveQueriedNodes.forEach(function (node) { - if (replacePostStylesAsPre(node, allPreStyleElements, allPostStyleElements)) { - replaceNodes.push(node); - } - }); - // PRE STAGE: fill the ! styles - var preStylesMap = new Map(); - enterNodeMap.forEach(function (nodes, root) { - cloakAndComputeStyles(preStylesMap, _this.driver, new Set(nodes), allPreStyleElements, _angular_animations__WEBPACK_IMPORTED_MODULE_1__["ɵPRE_STYLE"]); - }); - replaceNodes.forEach(function (node) { - var post = postStylesMap.get(node); - var pre = preStylesMap.get(node); - postStylesMap.set(node, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, post, pre)); - }); - var rootPlayers = []; - var subPlayers = []; - var NO_PARENT_ANIMATION_ELEMENT_DETECTED = {}; - queuedInstructions.forEach(function (entry) { - var element = entry.element, player = entry.player, instruction = entry.instruction; - // this means that it was never consumed by a parent animation which - // means that it is independent and therefore should be set for animation - if (subTimelines.has(element)) { - if (disabledElementsSet.has(element)) { - player.onDestroy(function () { return setStyles(element, instruction.toStyles); }); - player.disabled = true; - player.overrideTotalTime(instruction.totalTime); - skippedPlayers.push(player); - return; - } - // this will flow up the DOM and query the map to figure out - // if a parent animation has priority over it. In the situation - // that a parent is detected then it will cancel the loop. If - // nothing is detected, or it takes a few hops to find a parent, - // then it will fill in the missing nodes and signal them as having - // a detected parent (or a NO_PARENT value via a special constant). - var parentWithAnimation_1 = NO_PARENT_ANIMATION_ELEMENT_DETECTED; - if (animationElementMap.size > 1) { - var elm = element; - var parentsToAdd = []; - while (elm = elm.parentNode) { - var detectedParent = animationElementMap.get(elm); - if (detectedParent) { - parentWithAnimation_1 = detectedParent; - break; - } - parentsToAdd.push(elm); - } - parentsToAdd.forEach(function (parent) { return animationElementMap.set(parent, parentWithAnimation_1); }); - } - var innerPlayer = _this._buildAnimation(player.namespaceId, instruction, allPreviousPlayersMap, skippedPlayersMap, preStylesMap, postStylesMap); - player.setRealPlayer(innerPlayer); - if (parentWithAnimation_1 === NO_PARENT_ANIMATION_ELEMENT_DETECTED) { - rootPlayers.push(player); - } - else { - var parentPlayers = _this.playersByElement.get(parentWithAnimation_1); - if (parentPlayers && parentPlayers.length) { - player.parentPlayer = optimizeGroupPlayer(parentPlayers); - } - skippedPlayers.push(player); - } - } - else { - eraseStyles(element, instruction.fromStyles); - player.onDestroy(function () { return setStyles(element, instruction.toStyles); }); - // there still might be a ancestor player animating this - // element therefore we will still add it as a sub player - // even if its animation may be disabled - subPlayers.push(player); - if (disabledElementsSet.has(element)) { - skippedPlayers.push(player); - } - } - }); - // find all of the sub players' corresponding inner animation player - subPlayers.forEach(function (player) { - // even if any players are not found for a sub animation then it - // will still complete itself after the next tick since it's Noop - var playersForElement = skippedPlayersMap.get(player.element); - if (playersForElement && playersForElement.length) { - var innerPlayer = optimizeGroupPlayer(playersForElement); - player.setRealPlayer(innerPlayer); - } - }); - // the reason why we don't actually play the animation is - // because all that a skipped player is designed to do is to - // fire the start/done transition callback events - skippedPlayers.forEach(function (player) { - if (player.parentPlayer) { - player.syncPlayerEvents(player.parentPlayer); - } - else { - player.destroy(); - } - }); - // run through all of the queued removals and see if they - // were picked up by a query. If not then perform the removal - // operation right away unless a parent animation is ongoing. - for (var i_4 = 0; i_4 < allLeaveNodes.length; i_4++) { - var element = allLeaveNodes[i_4]; - var details = element[REMOVAL_FLAG]; - removeClass(element, LEAVE_CLASSNAME); - // this means the element has a removal animation that is being - // taken care of and therefore the inner elements will hang around - // until that animation is over (or the parent queried animation) - if (details && details.hasAnimation) - continue; - var players = []; - // if this element is queried or if it contains queried children - // then we want for the element not to be removed from the page - // until the queried animations have finished - if (queriedElements.size) { - var queriedPlayerResults = queriedElements.get(element); - if (queriedPlayerResults && queriedPlayerResults.length) { - players.push.apply(players, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(queriedPlayerResults)); - } - var queriedInnerElements = this.driver.query(element, NG_ANIMATING_SELECTOR, true); - for (var j = 0; j < queriedInnerElements.length; j++) { - var queriedPlayers = queriedElements.get(queriedInnerElements[j]); - if (queriedPlayers && queriedPlayers.length) { - players.push.apply(players, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(queriedPlayers)); - } - } - } - var activePlayers = players.filter(function (p) { return !p.destroyed; }); - if (activePlayers.length) { - removeNodesAfterAnimationDone(this, element, activePlayers); - } - else { - this.processLeaveNode(element); - } - } - // this is required so the cleanup method doesn't remove them - allLeaveNodes.length = 0; - rootPlayers.forEach(function (player) { - _this.players.push(player); - player.onDone(function () { - player.destroy(); - var index = _this.players.indexOf(player); - _this.players.splice(index, 1); - }); - player.play(); - }); - return rootPlayers; - }; - TransitionAnimationEngine.prototype.elementContainsData = function (namespaceId, element) { - var containsData = false; - var details = element[REMOVAL_FLAG]; - if (details && details.setForRemoval) - containsData = true; - if (this.playersByElement.has(element)) - containsData = true; - if (this.playersByQueriedElement.has(element)) - containsData = true; - if (this.statesByElement.has(element)) - containsData = true; - return this._fetchNamespace(namespaceId).elementContainsData(element) || containsData; - }; - TransitionAnimationEngine.prototype.afterFlush = function (callback) { this._flushFns.push(callback); }; - TransitionAnimationEngine.prototype.afterFlushAnimationsDone = function (callback) { this._whenQuietFns.push(callback); }; - TransitionAnimationEngine.prototype._getPreviousPlayers = function (element, isQueriedElement, namespaceId, triggerName, toStateValue) { - var players = []; - if (isQueriedElement) { - var queriedElementPlayers = this.playersByQueriedElement.get(element); - if (queriedElementPlayers) { - players = queriedElementPlayers; - } - } - else { - var elementPlayers = this.playersByElement.get(element); - if (elementPlayers) { - var isRemovalAnimation_1 = !toStateValue || toStateValue == VOID_VALUE; - elementPlayers.forEach(function (player) { - if (player.queued) - return; - if (!isRemovalAnimation_1 && player.triggerName != triggerName) - return; - players.push(player); - }); - } - } - if (namespaceId || triggerName) { - players = players.filter(function (player) { - if (namespaceId && namespaceId != player.namespaceId) - return false; - if (triggerName && triggerName != player.triggerName) - return false; - return true; - }); - } - return players; - }; - TransitionAnimationEngine.prototype._beforeAnimationBuild = function (namespaceId, instruction, allPreviousPlayersMap) { - var e_1, _a; - var triggerName = instruction.triggerName; - var rootElement = instruction.element; - // when a removal animation occurs, ALL previous players are collected - // and destroyed (even if they are outside of the current namespace) - var targetNameSpaceId = instruction.isRemovalTransition ? undefined : namespaceId; - var targetTriggerName = instruction.isRemovalTransition ? undefined : triggerName; - var _loop_1 = function (timelineInstruction) { - var element = timelineInstruction.element; - var isQueriedElement = element !== rootElement; - var players = getOrSetAsInMap(allPreviousPlayersMap, element, []); - var previousPlayers = this_1._getPreviousPlayers(element, isQueriedElement, targetNameSpaceId, targetTriggerName, instruction.toState); - previousPlayers.forEach(function (player) { - var realPlayer = player.getRealPlayer(); - if (realPlayer.beforeDestroy) { - realPlayer.beforeDestroy(); - } - player.destroy(); - players.push(player); - }); - }; - var this_1 = this; - try { - for (var _b = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__values"])(instruction.timelines), _c = _b.next(); !_c.done; _c = _b.next()) { - var timelineInstruction = _c.value; - _loop_1(timelineInstruction); - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_1) throw e_1.error; } - } - // this needs to be done so that the PRE/POST styles can be - // computed properly without interfering with the previous animation - eraseStyles(rootElement, instruction.fromStyles); - }; - TransitionAnimationEngine.prototype._buildAnimation = function (namespaceId, instruction, allPreviousPlayersMap, skippedPlayersMap, preStylesMap, postStylesMap) { - var _this = this; - var triggerName = instruction.triggerName; - var rootElement = instruction.element; - // we first run this so that the previous animation player - // data can be passed into the successive animation players - var allQueriedPlayers = []; - var allConsumedElements = new Set(); - var allSubElements = new Set(); - var allNewPlayers = instruction.timelines.map(function (timelineInstruction) { - var element = timelineInstruction.element; - allConsumedElements.add(element); - // FIXME (matsko): make sure to-be-removed animations are removed properly - var details = element[REMOVAL_FLAG]; - if (details && details.removedBeforeQueried) - return new _angular_animations__WEBPACK_IMPORTED_MODULE_1__["NoopAnimationPlayer"](timelineInstruction.duration, timelineInstruction.delay); - var isQueriedElement = element !== rootElement; - var previousPlayers = flattenGroupPlayers((allPreviousPlayersMap.get(element) || EMPTY_PLAYER_ARRAY) - .map(function (p) { return p.getRealPlayer(); })) - .filter(function (p) { - // the `element` is not apart of the AnimationPlayer definition, but - // Mock/WebAnimations - // use the element within their implementation. This will be added in Angular5 to - // AnimationPlayer - var pp = p; - return pp.element ? pp.element === element : false; - }); - var preStyles = preStylesMap.get(element); - var postStyles = postStylesMap.get(element); - var keyframes = normalizeKeyframes(_this.driver, _this._normalizer, element, timelineInstruction.keyframes, preStyles, postStyles); - var player = _this._buildPlayer(timelineInstruction, keyframes, previousPlayers); - // this means that this particular player belongs to a sub trigger. It is - // important that we match this player up with the corresponding (@trigger.listener) - if (timelineInstruction.subTimeline && skippedPlayersMap) { - allSubElements.add(element); - } - if (isQueriedElement) { - var wrappedPlayer = new TransitionAnimationPlayer(namespaceId, triggerName, element); - wrappedPlayer.setRealPlayer(player); - allQueriedPlayers.push(wrappedPlayer); - } - return player; - }); - allQueriedPlayers.forEach(function (player) { - getOrSetAsInMap(_this.playersByQueriedElement, player.element, []).push(player); - player.onDone(function () { return deleteOrUnsetInMap(_this.playersByQueriedElement, player.element, player); }); - }); - allConsumedElements.forEach(function (element) { return addClass(element, NG_ANIMATING_CLASSNAME); }); - var player = optimizeGroupPlayer(allNewPlayers); - player.onDestroy(function () { - allConsumedElements.forEach(function (element) { return removeClass(element, NG_ANIMATING_CLASSNAME); }); - setStyles(rootElement, instruction.toStyles); - }); - // this basically makes all of the callbacks for sub element animations - // be dependent on the upper players for when they finish - allSubElements.forEach(function (element) { getOrSetAsInMap(skippedPlayersMap, element, []).push(player); }); - return player; - }; - TransitionAnimationEngine.prototype._buildPlayer = function (instruction, keyframes, previousPlayers) { - if (keyframes.length > 0) { - return this.driver.animate(instruction.element, keyframes, instruction.duration, instruction.delay, instruction.easing, previousPlayers); - } - // special case for when an empty transition|definition is provided - // ... there is no point in rendering an empty animation - return new _angular_animations__WEBPACK_IMPORTED_MODULE_1__["NoopAnimationPlayer"](instruction.duration, instruction.delay); - }; - return TransitionAnimationEngine; -}()); -var TransitionAnimationPlayer = /** @class */ (function () { - function TransitionAnimationPlayer(namespaceId, triggerName, element) { - this.namespaceId = namespaceId; - this.triggerName = triggerName; - this.element = element; - this._player = new _angular_animations__WEBPACK_IMPORTED_MODULE_1__["NoopAnimationPlayer"](); - this._containsRealPlayer = false; - this._queuedCallbacks = {}; - this.destroyed = false; - this.markedForDestroy = false; - this.disabled = false; - this.queued = true; - this.totalTime = 0; - } - TransitionAnimationPlayer.prototype.setRealPlayer = function (player) { - var _this = this; - if (this._containsRealPlayer) - return; - this._player = player; - Object.keys(this._queuedCallbacks).forEach(function (phase) { - _this._queuedCallbacks[phase].forEach(function (callback) { return listenOnPlayer(player, phase, undefined, callback); }); - }); - this._queuedCallbacks = {}; - this._containsRealPlayer = true; - this.overrideTotalTime(player.totalTime); - this.queued = false; - }; - TransitionAnimationPlayer.prototype.getRealPlayer = function () { return this._player; }; - TransitionAnimationPlayer.prototype.overrideTotalTime = function (totalTime) { this.totalTime = totalTime; }; - TransitionAnimationPlayer.prototype.syncPlayerEvents = function (player) { - var _this = this; - var p = this._player; - if (p.triggerCallback) { - player.onStart(function () { return p.triggerCallback('start'); }); - } - player.onDone(function () { return _this.finish(); }); - player.onDestroy(function () { return _this.destroy(); }); - }; - TransitionAnimationPlayer.prototype._queueEvent = function (name, callback) { - getOrSetAsInMap(this._queuedCallbacks, name, []).push(callback); - }; - TransitionAnimationPlayer.prototype.onDone = function (fn) { - if (this.queued) { - this._queueEvent('done', fn); - } - this._player.onDone(fn); - }; - TransitionAnimationPlayer.prototype.onStart = function (fn) { - if (this.queued) { - this._queueEvent('start', fn); - } - this._player.onStart(fn); - }; - TransitionAnimationPlayer.prototype.onDestroy = function (fn) { - if (this.queued) { - this._queueEvent('destroy', fn); - } - this._player.onDestroy(fn); - }; - TransitionAnimationPlayer.prototype.init = function () { this._player.init(); }; - TransitionAnimationPlayer.prototype.hasStarted = function () { return this.queued ? false : this._player.hasStarted(); }; - TransitionAnimationPlayer.prototype.play = function () { !this.queued && this._player.play(); }; - TransitionAnimationPlayer.prototype.pause = function () { !this.queued && this._player.pause(); }; - TransitionAnimationPlayer.prototype.restart = function () { !this.queued && this._player.restart(); }; - TransitionAnimationPlayer.prototype.finish = function () { this._player.finish(); }; - TransitionAnimationPlayer.prototype.destroy = function () { - this.destroyed = true; - this._player.destroy(); - }; - TransitionAnimationPlayer.prototype.reset = function () { !this.queued && this._player.reset(); }; - TransitionAnimationPlayer.prototype.setPosition = function (p) { - if (!this.queued) { - this._player.setPosition(p); - } - }; - TransitionAnimationPlayer.prototype.getPosition = function () { return this.queued ? 0 : this._player.getPosition(); }; - /** @internal */ - TransitionAnimationPlayer.prototype.triggerCallback = function (phaseName) { - var p = this._player; - if (p.triggerCallback) { - p.triggerCallback(phaseName); - } - }; - return TransitionAnimationPlayer; -}()); -function deleteOrUnsetInMap(map, key, value) { - var currentValues; - if (map instanceof Map) { - currentValues = map.get(key); - if (currentValues) { - if (currentValues.length) { - var index = currentValues.indexOf(value); - currentValues.splice(index, 1); - } - if (currentValues.length == 0) { - map.delete(key); - } - } - } - else { - currentValues = map[key]; - if (currentValues) { - if (currentValues.length) { - var index = currentValues.indexOf(value); - currentValues.splice(index, 1); - } - if (currentValues.length == 0) { - delete map[key]; - } - } - } - return currentValues; -} -function normalizeTriggerValue(value) { - // we use `!= null` here because it's the most simple - // way to test against a "falsy" value without mixing - // in empty strings or a zero value. DO NOT OPTIMIZE. - return value != null ? value : null; -} -function isElementNode(node) { - return node && node['nodeType'] === 1; -} -function isTriggerEventValid(eventName) { - return eventName == 'start' || eventName == 'done'; -} -function cloakElement(element, value) { - var oldValue = element.style.display; - element.style.display = value != null ? value : 'none'; - return oldValue; -} -function cloakAndComputeStyles(valuesMap, driver, elements, elementPropsMap, defaultStyle) { - var cloakVals = []; - elements.forEach(function (element) { return cloakVals.push(cloakElement(element)); }); - var failedElements = []; - elementPropsMap.forEach(function (props, element) { - var styles = {}; - props.forEach(function (prop) { - var value = styles[prop] = driver.computeStyle(element, prop, defaultStyle); - // there is no easy way to detect this because a sub element could be removed - // by a parent animation element being detached. - if (!value || value.length == 0) { - element[REMOVAL_FLAG] = NULL_REMOVED_QUERIED_STATE; - failedElements.push(element); - } - }); - valuesMap.set(element, styles); - }); - // we use a index variable here since Set.forEach(a, i) does not return - // an index value for the closure (but instead just the value) - var i = 0; - elements.forEach(function (element) { return cloakElement(element, cloakVals[i++]); }); - return failedElements; -} -/* -Since the Angular renderer code will return a collection of inserted -nodes in all areas of a DOM tree, it's up to this algorithm to figure -out which nodes are roots for each animation @trigger. - -By placing each inserted node into a Set and traversing upwards, it -is possible to find the @trigger elements and well any direct *star -insertion nodes, if a @trigger root is found then the enter element -is placed into the Map[@trigger] spot. - */ -function buildRootMap(roots, nodes) { - var rootMap = new Map(); - roots.forEach(function (root) { return rootMap.set(root, []); }); - if (nodes.length == 0) - return rootMap; - var NULL_NODE = 1; - var nodeSet = new Set(nodes); - var localRootMap = new Map(); - function getRoot(node) { - if (!node) - return NULL_NODE; - var root = localRootMap.get(node); - if (root) - return root; - var parent = node.parentNode; - if (rootMap.has(parent)) { // ngIf inside @trigger - root = parent; - } - else if (nodeSet.has(parent)) { // ngIf inside ngIf - root = NULL_NODE; - } - else { // recurse upwards - root = getRoot(parent); - } - localRootMap.set(node, root); - return root; - } - nodes.forEach(function (node) { - var root = getRoot(node); - if (root !== NULL_NODE) { - rootMap.get(root).push(node); - } - }); - return rootMap; -} -var CLASSES_CACHE_KEY = '$$classes'; -function addClass(element, className) { - if (element.classList) { - element.classList.add(className); - } - else { - var classes = element[CLASSES_CACHE_KEY]; - if (!classes) { - classes = element[CLASSES_CACHE_KEY] = {}; - } - classes[className] = true; - } -} -function removeClass(element, className) { - if (element.classList) { - element.classList.remove(className); - } - else { - var classes = element[CLASSES_CACHE_KEY]; - if (classes) { - delete classes[className]; - } - } -} -function removeNodesAfterAnimationDone(engine, element, players) { - optimizeGroupPlayer(players).onDone(function () { return engine.processLeaveNode(element); }); -} -function flattenGroupPlayers(players) { - var finalPlayers = []; - _flattenGroupPlayersRecur(players, finalPlayers); - return finalPlayers; -} -function _flattenGroupPlayersRecur(players, finalPlayers) { - for (var i = 0; i < players.length; i++) { - var player = players[i]; - if (player instanceof _angular_animations__WEBPACK_IMPORTED_MODULE_1__["ɵAnimationGroupPlayer"]) { - _flattenGroupPlayersRecur(player.players, finalPlayers); - } - else { - finalPlayers.push(player); - } - } -} -function objEquals(a, b) { - var k1 = Object.keys(a); - var k2 = Object.keys(b); - if (k1.length != k2.length) - return false; - for (var i = 0; i < k1.length; i++) { - var prop = k1[i]; - if (!b.hasOwnProperty(prop) || a[prop] !== b[prop]) - return false; - } - return true; -} -function replacePostStylesAsPre(element, allPreStyleElements, allPostStyleElements) { - var postEntry = allPostStyleElements.get(element); - if (!postEntry) - return false; - var preEntry = allPreStyleElements.get(element); - if (preEntry) { - postEntry.forEach(function (data) { return preEntry.add(data); }); - } - else { - allPreStyleElements.set(element, postEntry); - } - allPostStyleElements.delete(element); - return true; -} - -var AnimationEngine = /** @class */ (function () { - function AnimationEngine(bodyNode, _driver, normalizer) { - var _this = this; - this.bodyNode = bodyNode; - this._driver = _driver; - this._triggerCache = {}; - // this method is designed to be overridden by the code that uses this engine - this.onRemovalComplete = function (element, context) { }; - this._transitionEngine = new TransitionAnimationEngine(bodyNode, _driver, normalizer); - this._timelineEngine = new TimelineAnimationEngine(bodyNode, _driver, normalizer); - this._transitionEngine.onRemovalComplete = function (element, context) { - return _this.onRemovalComplete(element, context); - }; - } - AnimationEngine.prototype.registerTrigger = function (componentId, namespaceId, hostElement, name, metadata) { - var cacheKey = componentId + '-' + name; - var trigger = this._triggerCache[cacheKey]; - if (!trigger) { - var errors = []; - var ast = buildAnimationAst(this._driver, metadata, errors); - if (errors.length) { - throw new Error("The animation trigger \"" + name + "\" has failed to build due to the following errors:\n - " + errors.join("\n - ")); - } - trigger = buildTrigger(name, ast); - this._triggerCache[cacheKey] = trigger; - } - this._transitionEngine.registerTrigger(namespaceId, name, trigger); - }; - AnimationEngine.prototype.register = function (namespaceId, hostElement) { - this._transitionEngine.register(namespaceId, hostElement); - }; - AnimationEngine.prototype.destroy = function (namespaceId, context) { - this._transitionEngine.destroy(namespaceId, context); - }; - AnimationEngine.prototype.onInsert = function (namespaceId, element, parent, insertBefore) { - this._transitionEngine.insertNode(namespaceId, element, parent, insertBefore); - }; - AnimationEngine.prototype.onRemove = function (namespaceId, element, context) { - this._transitionEngine.removeNode(namespaceId, element, context); - }; - AnimationEngine.prototype.disableAnimations = function (element, disable) { - this._transitionEngine.markElementAsDisabled(element, disable); - }; - AnimationEngine.prototype.process = function (namespaceId, element, property, value) { - if (property.charAt(0) == '@') { - var _a = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__read"])(parseTimelineCommand(property), 2), id = _a[0], action = _a[1]; - var args = value; - this._timelineEngine.command(id, element, action, args); - } - else { - this._transitionEngine.trigger(namespaceId, element, property, value); - } - }; - AnimationEngine.prototype.listen = function (namespaceId, element, eventName, eventPhase, callback) { - // @@listen - if (eventName.charAt(0) == '@') { - var _a = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__read"])(parseTimelineCommand(eventName), 2), id = _a[0], action = _a[1]; - return this._timelineEngine.listen(id, element, action, callback); - } - return this._transitionEngine.listen(namespaceId, element, eventName, eventPhase, callback); - }; - AnimationEngine.prototype.flush = function (microtaskId) { - if (microtaskId === void 0) { microtaskId = -1; } - this._transitionEngine.flush(microtaskId); - }; - Object.defineProperty(AnimationEngine.prototype, "players", { - get: function () { - return this._transitionEngine.players - .concat(this._timelineEngine.players); - }, - enumerable: true, - configurable: true - }); - AnimationEngine.prototype.whenRenderingDone = function () { return this._transitionEngine.whenRenderingDone(); }; - return AnimationEngine; -}()); - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -/** - * Returns an instance of `SpecialCasedStyles` if and when any special (non animateable) styles are - * detected. - * - * In CSS there exist properties that cannot be animated within a keyframe animation - * (whether it be via CSS keyframes or web-animations) and the animation implementation - * will ignore them. This function is designed to detect those special cased styles and - * return a container that will be executed at the start and end of the animation. - * - * @returns an instance of `SpecialCasedStyles` if any special styles are detected otherwise `null` - */ -function packageNonAnimatableStyles(element, styles) { - var startStyles = null; - var endStyles = null; - if (Array.isArray(styles) && styles.length) { - startStyles = filterNonAnimatableStyles(styles[0]); - if (styles.length > 1) { - endStyles = filterNonAnimatableStyles(styles[styles.length - 1]); - } - } - else if (styles) { - startStyles = filterNonAnimatableStyles(styles); - } - return (startStyles || endStyles) ? new SpecialCasedStyles(element, startStyles, endStyles) : - null; -} -/** - * Designed to be executed during a keyframe-based animation to apply any special-cased styles. - * - * When started (when the `start()` method is run) then the provided `startStyles` - * will be applied. When finished (when the `finish()` method is called) the - * `endStyles` will be applied as well any any starting styles. Finally when - * `destroy()` is called then all styles will be removed. - */ -var SpecialCasedStyles = /** @class */ (function () { - function SpecialCasedStyles(_element, _startStyles, _endStyles) { - this._element = _element; - this._startStyles = _startStyles; - this._endStyles = _endStyles; - this._state = 0 /* Pending */; - var initialStyles = SpecialCasedStyles.initialStylesByElement.get(_element); - if (!initialStyles) { - SpecialCasedStyles.initialStylesByElement.set(_element, initialStyles = {}); - } - this._initialStyles = initialStyles; - } - SpecialCasedStyles.prototype.start = function () { - if (this._state < 1 /* Started */) { - if (this._startStyles) { - setStyles(this._element, this._startStyles, this._initialStyles); - } - this._state = 1 /* Started */; - } - }; - SpecialCasedStyles.prototype.finish = function () { - this.start(); - if (this._state < 2 /* Finished */) { - setStyles(this._element, this._initialStyles); - if (this._endStyles) { - setStyles(this._element, this._endStyles); - this._endStyles = null; - } - this._state = 1 /* Started */; - } - }; - SpecialCasedStyles.prototype.destroy = function () { - this.finish(); - if (this._state < 3 /* Destroyed */) { - SpecialCasedStyles.initialStylesByElement.delete(this._element); - if (this._startStyles) { - eraseStyles(this._element, this._startStyles); - this._endStyles = null; - } - if (this._endStyles) { - eraseStyles(this._element, this._endStyles); - this._endStyles = null; - } - setStyles(this._element, this._initialStyles); - this._state = 3 /* Destroyed */; - } - }; - SpecialCasedStyles.initialStylesByElement = new WeakMap(); - return SpecialCasedStyles; -}()); -function filterNonAnimatableStyles(styles) { - var result = null; - var props = Object.keys(styles); - for (var i = 0; i < props.length; i++) { - var prop = props[i]; - if (isNonAnimatableStyle(prop)) { - result = result || {}; - result[prop] = styles[prop]; - } - } - return result; -} -function isNonAnimatableStyle(prop) { - return prop === 'display' || prop === 'position'; -} - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -var ELAPSED_TIME_MAX_DECIMAL_PLACES = 3; -var ANIMATION_PROP = 'animation'; -var ANIMATIONEND_EVENT = 'animationend'; -var ONE_SECOND$1 = 1000; -var ElementAnimationStyleHandler = /** @class */ (function () { - function ElementAnimationStyleHandler(_element, _name, _duration, _delay, _easing, _fillMode, _onDoneFn) { - var _this = this; - this._element = _element; - this._name = _name; - this._duration = _duration; - this._delay = _delay; - this._easing = _easing; - this._fillMode = _fillMode; - this._onDoneFn = _onDoneFn; - this._finished = false; - this._destroyed = false; - this._startTime = 0; - this._position = 0; - this._eventFn = function (e) { return _this._handleCallback(e); }; - } - ElementAnimationStyleHandler.prototype.apply = function () { - applyKeyframeAnimation(this._element, this._duration + "ms " + this._easing + " " + this._delay + "ms 1 normal " + this._fillMode + " " + this._name); - addRemoveAnimationEvent(this._element, this._eventFn, false); - this._startTime = Date.now(); - }; - ElementAnimationStyleHandler.prototype.pause = function () { playPauseAnimation(this._element, this._name, 'paused'); }; - ElementAnimationStyleHandler.prototype.resume = function () { playPauseAnimation(this._element, this._name, 'running'); }; - ElementAnimationStyleHandler.prototype.setPosition = function (position) { - var index = findIndexForAnimation(this._element, this._name); - this._position = position * this._duration; - setAnimationStyle(this._element, 'Delay', "-" + this._position + "ms", index); - }; - ElementAnimationStyleHandler.prototype.getPosition = function () { return this._position; }; - ElementAnimationStyleHandler.prototype._handleCallback = function (event) { - var timestamp = event._ngTestManualTimestamp || Date.now(); - var elapsedTime = parseFloat(event.elapsedTime.toFixed(ELAPSED_TIME_MAX_DECIMAL_PLACES)) * ONE_SECOND$1; - if (event.animationName == this._name && - Math.max(timestamp - this._startTime, 0) >= this._delay && elapsedTime >= this._duration) { - this.finish(); - } - }; - ElementAnimationStyleHandler.prototype.finish = function () { - if (this._finished) - return; - this._finished = true; - this._onDoneFn(); - addRemoveAnimationEvent(this._element, this._eventFn, true); - }; - ElementAnimationStyleHandler.prototype.destroy = function () { - if (this._destroyed) - return; - this._destroyed = true; - this.finish(); - removeKeyframeAnimation(this._element, this._name); - }; - return ElementAnimationStyleHandler; -}()); -function playPauseAnimation(element, name, status) { - var index = findIndexForAnimation(element, name); - setAnimationStyle(element, 'PlayState', status, index); -} -function applyKeyframeAnimation(element, value) { - var anim = getAnimationStyle(element, '').trim(); - var index = 0; - if (anim.length) { - index = countChars(anim, ',') + 1; - value = anim + ", " + value; - } - setAnimationStyle(element, '', value); - return index; -} -function removeKeyframeAnimation(element, name) { - var anim = getAnimationStyle(element, ''); - var tokens = anim.split(','); - var index = findMatchingTokenIndex(tokens, name); - if (index >= 0) { - tokens.splice(index, 1); - var newValue = tokens.join(','); - setAnimationStyle(element, '', newValue); - } -} -function findIndexForAnimation(element, value) { - var anim = getAnimationStyle(element, ''); - if (anim.indexOf(',') > 0) { - var tokens = anim.split(','); - return findMatchingTokenIndex(tokens, value); - } - return findMatchingTokenIndex([anim], value); -} -function findMatchingTokenIndex(tokens, searchToken) { - for (var i = 0; i < tokens.length; i++) { - if (tokens[i].indexOf(searchToken) >= 0) { - return i; - } - } - return -1; -} -function addRemoveAnimationEvent(element, fn, doRemove) { - doRemove ? element.removeEventListener(ANIMATIONEND_EVENT, fn) : - element.addEventListener(ANIMATIONEND_EVENT, fn); -} -function setAnimationStyle(element, name, value, index) { - var prop = ANIMATION_PROP + name; - if (index != null) { - var oldValue = element.style[prop]; - if (oldValue.length) { - var tokens = oldValue.split(','); - tokens[index] = value; - value = tokens.join(','); - } - } - element.style[prop] = value; -} -function getAnimationStyle(element, name) { - return element.style[ANIMATION_PROP + name]; -} -function countChars(value, char) { - var count = 0; - for (var i = 0; i < value.length; i++) { - var c = value.charAt(i); - if (c === char) - count++; - } - return count; -} - -var DEFAULT_FILL_MODE = 'forwards'; -var DEFAULT_EASING = 'linear'; -var CssKeyframesPlayer = /** @class */ (function () { - function CssKeyframesPlayer(element, keyframes, animationName, _duration, _delay, easing, _finalStyles, _specialStyles) { - this.element = element; - this.keyframes = keyframes; - this.animationName = animationName; - this._duration = _duration; - this._delay = _delay; - this._finalStyles = _finalStyles; - this._specialStyles = _specialStyles; - this._onDoneFns = []; - this._onStartFns = []; - this._onDestroyFns = []; - this._started = false; - this.currentSnapshot = {}; - this._state = 0; - this.easing = easing || DEFAULT_EASING; - this.totalTime = _duration + _delay; - this._buildStyler(); - } - CssKeyframesPlayer.prototype.onStart = function (fn) { this._onStartFns.push(fn); }; - CssKeyframesPlayer.prototype.onDone = function (fn) { this._onDoneFns.push(fn); }; - CssKeyframesPlayer.prototype.onDestroy = function (fn) { this._onDestroyFns.push(fn); }; - CssKeyframesPlayer.prototype.destroy = function () { - this.init(); - if (this._state >= 4 /* DESTROYED */) - return; - this._state = 4 /* DESTROYED */; - this._styler.destroy(); - this._flushStartFns(); - this._flushDoneFns(); - if (this._specialStyles) { - this._specialStyles.destroy(); - } - this._onDestroyFns.forEach(function (fn) { return fn(); }); - this._onDestroyFns = []; - }; - CssKeyframesPlayer.prototype._flushDoneFns = function () { - this._onDoneFns.forEach(function (fn) { return fn(); }); - this._onDoneFns = []; - }; - CssKeyframesPlayer.prototype._flushStartFns = function () { - this._onStartFns.forEach(function (fn) { return fn(); }); - this._onStartFns = []; - }; - CssKeyframesPlayer.prototype.finish = function () { - this.init(); - if (this._state >= 3 /* FINISHED */) - return; - this._state = 3 /* FINISHED */; - this._styler.finish(); - this._flushStartFns(); - if (this._specialStyles) { - this._specialStyles.finish(); - } - this._flushDoneFns(); - }; - CssKeyframesPlayer.prototype.setPosition = function (value) { this._styler.setPosition(value); }; - CssKeyframesPlayer.prototype.getPosition = function () { return this._styler.getPosition(); }; - CssKeyframesPlayer.prototype.hasStarted = function () { return this._state >= 2 /* STARTED */; }; - CssKeyframesPlayer.prototype.init = function () { - if (this._state >= 1 /* INITIALIZED */) - return; - this._state = 1 /* INITIALIZED */; - var elm = this.element; - this._styler.apply(); - if (this._delay) { - this._styler.pause(); - } - }; - CssKeyframesPlayer.prototype.play = function () { - this.init(); - if (!this.hasStarted()) { - this._flushStartFns(); - this._state = 2 /* STARTED */; - if (this._specialStyles) { - this._specialStyles.start(); - } - } - this._styler.resume(); - }; - CssKeyframesPlayer.prototype.pause = function () { - this.init(); - this._styler.pause(); - }; - CssKeyframesPlayer.prototype.restart = function () { - this.reset(); - this.play(); - }; - CssKeyframesPlayer.prototype.reset = function () { - this._styler.destroy(); - this._buildStyler(); - this._styler.apply(); - }; - CssKeyframesPlayer.prototype._buildStyler = function () { - var _this = this; - this._styler = new ElementAnimationStyleHandler(this.element, this.animationName, this._duration, this._delay, this.easing, DEFAULT_FILL_MODE, function () { return _this.finish(); }); - }; - /** @internal */ - CssKeyframesPlayer.prototype.triggerCallback = function (phaseName) { - var methods = phaseName == 'start' ? this._onStartFns : this._onDoneFns; - methods.forEach(function (fn) { return fn(); }); - methods.length = 0; - }; - CssKeyframesPlayer.prototype.beforeDestroy = function () { - var _this = this; - this.init(); - var styles = {}; - if (this.hasStarted()) { - var finished_1 = this._state >= 3 /* FINISHED */; - Object.keys(this._finalStyles).forEach(function (prop) { - if (prop != 'offset') { - styles[prop] = finished_1 ? _this._finalStyles[prop] : computeStyle(_this.element, prop); - } - }); - } - this.currentSnapshot = styles; - }; - return CssKeyframesPlayer; -}()); - -var DirectStylePlayer = /** @class */ (function (_super) { - Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(DirectStylePlayer, _super); - function DirectStylePlayer(element, styles) { - var _this = _super.call(this) || this; - _this.element = element; - _this._startingStyles = {}; - _this.__initialized = false; - _this._styles = hypenatePropsObject(styles); - return _this; - } - DirectStylePlayer.prototype.init = function () { - var _this = this; - if (this.__initialized || !this._startingStyles) - return; - this.__initialized = true; - Object.keys(this._styles).forEach(function (prop) { - _this._startingStyles[prop] = _this.element.style[prop]; - }); - _super.prototype.init.call(this); - }; - DirectStylePlayer.prototype.play = function () { - var _this = this; - if (!this._startingStyles) - return; - this.init(); - Object.keys(this._styles) - .forEach(function (prop) { return _this.element.style.setProperty(prop, _this._styles[prop]); }); - _super.prototype.play.call(this); - }; - DirectStylePlayer.prototype.destroy = function () { - var _this = this; - if (!this._startingStyles) - return; - Object.keys(this._startingStyles).forEach(function (prop) { - var value = _this._startingStyles[prop]; - if (value) { - _this.element.style.setProperty(prop, value); - } - else { - _this.element.style.removeProperty(prop); - } - }); - this._startingStyles = null; - _super.prototype.destroy.call(this); - }; - return DirectStylePlayer; -}(_angular_animations__WEBPACK_IMPORTED_MODULE_1__["NoopAnimationPlayer"])); - -var KEYFRAMES_NAME_PREFIX = 'gen_css_kf_'; -var TAB_SPACE = ' '; -var CssKeyframesDriver = /** @class */ (function () { - function CssKeyframesDriver() { - this._count = 0; - this._head = document.querySelector('head'); - this._warningIssued = false; - } - CssKeyframesDriver.prototype.validateStyleProperty = function (prop) { return validateStyleProperty(prop); }; - CssKeyframesDriver.prototype.matchesElement = function (element, selector) { - return matchesElement(element, selector); - }; - CssKeyframesDriver.prototype.containsElement = function (elm1, elm2) { return containsElement(elm1, elm2); }; - CssKeyframesDriver.prototype.query = function (element, selector, multi) { - return invokeQuery(element, selector, multi); - }; - CssKeyframesDriver.prototype.computeStyle = function (element, prop, defaultValue) { - return window.getComputedStyle(element)[prop]; - }; - CssKeyframesDriver.prototype.buildKeyframeElement = function (element, name, keyframes) { - keyframes = keyframes.map(function (kf) { return hypenatePropsObject(kf); }); - var keyframeStr = "@keyframes " + name + " {\n"; - var tab = ''; - keyframes.forEach(function (kf) { - tab = TAB_SPACE; - var offset = parseFloat(kf['offset']); - keyframeStr += "" + tab + offset * 100 + "% {\n"; - tab += TAB_SPACE; - Object.keys(kf).forEach(function (prop) { - var value = kf[prop]; - switch (prop) { - case 'offset': - return; - case 'easing': - if (value) { - keyframeStr += tab + "animation-timing-function: " + value + ";\n"; - } - return; - default: - keyframeStr += "" + tab + prop + ": " + value + ";\n"; - return; - } - }); - keyframeStr += tab + "}\n"; - }); - keyframeStr += "}\n"; - var kfElm = document.createElement('style'); - kfElm.innerHTML = keyframeStr; - return kfElm; - }; - CssKeyframesDriver.prototype.animate = function (element, keyframes, duration, delay, easing, previousPlayers, scrubberAccessRequested) { - if (previousPlayers === void 0) { previousPlayers = []; } - if (scrubberAccessRequested) { - this._notifyFaultyScrubber(); - } - var previousCssKeyframePlayers = previousPlayers.filter(function (player) { return player instanceof CssKeyframesPlayer; }); - var previousStyles = {}; - if (allowPreviousPlayerStylesMerge(duration, delay)) { - previousCssKeyframePlayers.forEach(function (player) { - var styles = player.currentSnapshot; - Object.keys(styles).forEach(function (prop) { return previousStyles[prop] = styles[prop]; }); - }); - } - keyframes = balancePreviousStylesIntoKeyframes(element, keyframes, previousStyles); - var finalStyles = flattenKeyframesIntoStyles(keyframes); - // if there is no animation then there is no point in applying - // styles and waiting for an event to get fired. This causes lag. - // It's better to just directly apply the styles to the element - // via the direct styling animation player. - if (duration == 0) { - return new DirectStylePlayer(element, finalStyles); - } - var animationName = "" + KEYFRAMES_NAME_PREFIX + this._count++; - var kfElm = this.buildKeyframeElement(element, animationName, keyframes); - document.querySelector('head').appendChild(kfElm); - var specialStyles = packageNonAnimatableStyles(element, keyframes); - var player = new CssKeyframesPlayer(element, keyframes, animationName, duration, delay, easing, finalStyles, specialStyles); - player.onDestroy(function () { return removeElement(kfElm); }); - return player; - }; - CssKeyframesDriver.prototype._notifyFaultyScrubber = function () { - if (!this._warningIssued) { - console.warn('@angular/animations: please load the web-animations.js polyfill to allow programmatic access...\n', ' visit http://bit.ly/IWukam to learn more about using the web-animation-js polyfill.'); - this._warningIssued = true; - } - }; - return CssKeyframesDriver; -}()); -function flattenKeyframesIntoStyles(keyframes) { - var flatKeyframes = {}; - if (keyframes) { - var kfs = Array.isArray(keyframes) ? keyframes : [keyframes]; - kfs.forEach(function (kf) { - Object.keys(kf).forEach(function (prop) { - if (prop == 'offset' || prop == 'easing') - return; - flatKeyframes[prop] = kf[prop]; - }); - }); - } - return flatKeyframes; -} -function removeElement(node) { - node.parentNode.removeChild(node); -} - -var WebAnimationsPlayer = /** @class */ (function () { - function WebAnimationsPlayer(element, keyframes, options, _specialStyles) { - this.element = element; - this.keyframes = keyframes; - this.options = options; - this._specialStyles = _specialStyles; - this._onDoneFns = []; - this._onStartFns = []; - this._onDestroyFns = []; - this._initialized = false; - this._finished = false; - this._started = false; - this._destroyed = false; - this.time = 0; - this.parentPlayer = null; - this.currentSnapshot = {}; - this._duration = options['duration']; - this._delay = options['delay'] || 0; - this.time = this._duration + this._delay; - } - WebAnimationsPlayer.prototype._onFinish = function () { - if (!this._finished) { - this._finished = true; - this._onDoneFns.forEach(function (fn) { return fn(); }); - this._onDoneFns = []; - } - }; - WebAnimationsPlayer.prototype.init = function () { - this._buildPlayer(); - this._preparePlayerBeforeStart(); - }; - WebAnimationsPlayer.prototype._buildPlayer = function () { - var _this = this; - if (this._initialized) - return; - this._initialized = true; - var keyframes = this.keyframes; - this.domPlayer = - this._triggerWebAnimation(this.element, keyframes, this.options); - this._finalKeyframe = keyframes.length ? keyframes[keyframes.length - 1] : {}; - this.domPlayer.addEventListener('finish', function () { return _this._onFinish(); }); - }; - WebAnimationsPlayer.prototype._preparePlayerBeforeStart = function () { - // this is required so that the player doesn't start to animate right away - if (this._delay) { - this._resetDomPlayerState(); - } - else { - this.domPlayer.pause(); - } - }; - /** @internal */ - WebAnimationsPlayer.prototype._triggerWebAnimation = function (element, keyframes, options) { - // jscompiler doesn't seem to know animate is a native property because it's not fully - // supported yet across common browsers (we polyfill it for Edge/Safari) [CL #143630929] - return element['animate'](keyframes, options); - }; - WebAnimationsPlayer.prototype.onStart = function (fn) { this._onStartFns.push(fn); }; - WebAnimationsPlayer.prototype.onDone = function (fn) { this._onDoneFns.push(fn); }; - WebAnimationsPlayer.prototype.onDestroy = function (fn) { this._onDestroyFns.push(fn); }; - WebAnimationsPlayer.prototype.play = function () { - this._buildPlayer(); - if (!this.hasStarted()) { - this._onStartFns.forEach(function (fn) { return fn(); }); - this._onStartFns = []; - this._started = true; - if (this._specialStyles) { - this._specialStyles.start(); - } - } - this.domPlayer.play(); - }; - WebAnimationsPlayer.prototype.pause = function () { - this.init(); - this.domPlayer.pause(); - }; - WebAnimationsPlayer.prototype.finish = function () { - this.init(); - if (this._specialStyles) { - this._specialStyles.finish(); - } - this._onFinish(); - this.domPlayer.finish(); - }; - WebAnimationsPlayer.prototype.reset = function () { - this._resetDomPlayerState(); - this._destroyed = false; - this._finished = false; - this._started = false; - }; - WebAnimationsPlayer.prototype._resetDomPlayerState = function () { - if (this.domPlayer) { - this.domPlayer.cancel(); - } - }; - WebAnimationsPlayer.prototype.restart = function () { - this.reset(); - this.play(); - }; - WebAnimationsPlayer.prototype.hasStarted = function () { return this._started; }; - WebAnimationsPlayer.prototype.destroy = function () { - if (!this._destroyed) { - this._destroyed = true; - this._resetDomPlayerState(); - this._onFinish(); - if (this._specialStyles) { - this._specialStyles.destroy(); - } - this._onDestroyFns.forEach(function (fn) { return fn(); }); - this._onDestroyFns = []; - } - }; - WebAnimationsPlayer.prototype.setPosition = function (p) { this.domPlayer.currentTime = p * this.time; }; - WebAnimationsPlayer.prototype.getPosition = function () { return this.domPlayer.currentTime / this.time; }; - Object.defineProperty(WebAnimationsPlayer.prototype, "totalTime", { - get: function () { return this._delay + this._duration; }, - enumerable: true, - configurable: true - }); - WebAnimationsPlayer.prototype.beforeDestroy = function () { - var _this = this; - var styles = {}; - if (this.hasStarted()) { - Object.keys(this._finalKeyframe).forEach(function (prop) { - if (prop != 'offset') { - styles[prop] = - _this._finished ? _this._finalKeyframe[prop] : computeStyle(_this.element, prop); - } - }); - } - this.currentSnapshot = styles; - }; - /** @internal */ - WebAnimationsPlayer.prototype.triggerCallback = function (phaseName) { - var methods = phaseName == 'start' ? this._onStartFns : this._onDoneFns; - methods.forEach(function (fn) { return fn(); }); - methods.length = 0; - }; - return WebAnimationsPlayer; -}()); - -var WebAnimationsDriver = /** @class */ (function () { - function WebAnimationsDriver() { - this._isNativeImpl = /\{\s*\[native\s+code\]\s*\}/.test(getElementAnimateFn().toString()); - this._cssKeyframesDriver = new CssKeyframesDriver(); - } - WebAnimationsDriver.prototype.validateStyleProperty = function (prop) { return validateStyleProperty(prop); }; - WebAnimationsDriver.prototype.matchesElement = function (element, selector) { - return matchesElement(element, selector); - }; - WebAnimationsDriver.prototype.containsElement = function (elm1, elm2) { return containsElement(elm1, elm2); }; - WebAnimationsDriver.prototype.query = function (element, selector, multi) { - return invokeQuery(element, selector, multi); - }; - WebAnimationsDriver.prototype.computeStyle = function (element, prop, defaultValue) { - return window.getComputedStyle(element)[prop]; - }; - WebAnimationsDriver.prototype.overrideWebAnimationsSupport = function (supported) { this._isNativeImpl = supported; }; - WebAnimationsDriver.prototype.animate = function (element, keyframes, duration, delay, easing, previousPlayers, scrubberAccessRequested) { - if (previousPlayers === void 0) { previousPlayers = []; } - var useKeyframes = !scrubberAccessRequested && !this._isNativeImpl; - if (useKeyframes) { - return this._cssKeyframesDriver.animate(element, keyframes, duration, delay, easing, previousPlayers); - } - var fill = delay == 0 ? 'both' : 'forwards'; - var playerOptions = { duration: duration, delay: delay, fill: fill }; - // we check for this to avoid having a null|undefined value be present - // for the easing (which results in an error for certain browsers #9752) - if (easing) { - playerOptions['easing'] = easing; - } - var previousStyles = {}; - var previousWebAnimationPlayers = previousPlayers.filter(function (player) { return player instanceof WebAnimationsPlayer; }); - if (allowPreviousPlayerStylesMerge(duration, delay)) { - previousWebAnimationPlayers.forEach(function (player) { - var styles = player.currentSnapshot; - Object.keys(styles).forEach(function (prop) { return previousStyles[prop] = styles[prop]; }); - }); - } - keyframes = keyframes.map(function (styles) { return copyStyles(styles, false); }); - keyframes = balancePreviousStylesIntoKeyframes(element, keyframes, previousStyles); - var specialStyles = packageNonAnimatableStyles(element, keyframes); - return new WebAnimationsPlayer(element, keyframes, playerOptions, specialStyles); - }; - return WebAnimationsDriver; -}()); -function supportsWebAnimations() { - return typeof getElementAnimateFn() === 'function'; -} -function getElementAnimateFn() { - return (isBrowser() && Element.prototype['animate']) || {}; -} - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -/** - * Generated bundle index. Do not edit. - */ - - -//# sourceMappingURL=browser.js.map - - -/***/ }), - -/***/ "./node_modules/@angular/cdk/esm5/a11y.es5.js": -/*!****************************************************!*\ - !*** ./node_modules/@angular/cdk/esm5/a11y.es5.js ***! - \****************************************************/ -/*! exports provided: ARIA_DESCRIBER_PROVIDER_FACTORY, MESSAGES_CONTAINER_ID, CDK_DESCRIBEDBY_ID_PREFIX, CDK_DESCRIBEDBY_HOST_ATTRIBUTE, AriaDescriber, ARIA_DESCRIBER_PROVIDER, ActiveDescendantKeyManager, FocusKeyManager, ListKeyManager, FocusTrap, FocusTrapFactory, CdkTrapFocus, InteractivityChecker, LIVE_ANNOUNCER_PROVIDER_FACTORY, LiveAnnouncer, CdkAriaLive, LIVE_ANNOUNCER_PROVIDER, LIVE_ANNOUNCER_ELEMENT_TOKEN_FACTORY, LIVE_ANNOUNCER_ELEMENT_TOKEN, FOCUS_MONITOR_PROVIDER_FACTORY, TOUCH_BUFFER_MS, FocusMonitor, CdkMonitorFocus, FOCUS_MONITOR_PROVIDER, isFakeMousedownFromScreenReader, A11yModule */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ARIA_DESCRIBER_PROVIDER_FACTORY", function() { return ARIA_DESCRIBER_PROVIDER_FACTORY; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MESSAGES_CONTAINER_ID", function() { return MESSAGES_CONTAINER_ID; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CDK_DESCRIBEDBY_ID_PREFIX", function() { return CDK_DESCRIBEDBY_ID_PREFIX; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CDK_DESCRIBEDBY_HOST_ATTRIBUTE", function() { return CDK_DESCRIBEDBY_HOST_ATTRIBUTE; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AriaDescriber", function() { return AriaDescriber; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ARIA_DESCRIBER_PROVIDER", function() { return ARIA_DESCRIBER_PROVIDER; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ActiveDescendantKeyManager", function() { return ActiveDescendantKeyManager; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FocusKeyManager", function() { return FocusKeyManager; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ListKeyManager", function() { return ListKeyManager; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FocusTrap", function() { return FocusTrap; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FocusTrapFactory", function() { return FocusTrapFactory; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CdkTrapFocus", function() { return CdkTrapFocus; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InteractivityChecker", function() { return InteractivityChecker; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LIVE_ANNOUNCER_PROVIDER_FACTORY", function() { return LIVE_ANNOUNCER_PROVIDER_FACTORY; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LiveAnnouncer", function() { return LiveAnnouncer; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CdkAriaLive", function() { return CdkAriaLive; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LIVE_ANNOUNCER_PROVIDER", function() { return LIVE_ANNOUNCER_PROVIDER; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LIVE_ANNOUNCER_ELEMENT_TOKEN_FACTORY", function() { return LIVE_ANNOUNCER_ELEMENT_TOKEN_FACTORY; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LIVE_ANNOUNCER_ELEMENT_TOKEN", function() { return LIVE_ANNOUNCER_ELEMENT_TOKEN; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FOCUS_MONITOR_PROVIDER_FACTORY", function() { return FOCUS_MONITOR_PROVIDER_FACTORY; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TOUCH_BUFFER_MS", function() { return TOUCH_BUFFER_MS; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FocusMonitor", function() { return FocusMonitor; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CdkMonitorFocus", function() { return CdkMonitorFocus; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FOCUS_MONITOR_PROVIDER", function() { return FOCUS_MONITOR_PROVIDER; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isFakeMousedownFromScreenReader", function() { return isFakeMousedownFromScreenReader; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "A11yModule", function() { return A11yModule; }); -/* harmony import */ var _angular_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/common */ "./node_modules/@angular/common/fesm5/common.js"); -/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); -/* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! rxjs */ "./node_modules/rxjs/_esm5/index.js"); -/* harmony import */ var _angular_cdk_keycodes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @angular/cdk/keycodes */ "./node_modules/@angular/cdk/esm5/keycodes.es5.js"); -/* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! rxjs/operators */ "./node_modules/rxjs/_esm5/operators/index.js"); -/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); -/* harmony import */ var _angular_cdk_platform__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @angular/cdk/platform */ "./node_modules/@angular/cdk/esm5/platform.es5.js"); -/* harmony import */ var _angular_cdk_coercion__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @angular/cdk/coercion */ "./node_modules/@angular/cdk/esm5/coercion.es5.js"); -/* harmony import */ var _angular_cdk_observers__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @angular/cdk/observers */ "./node_modules/@angular/cdk/esm5/observers.es5.js"); -/** - * @license - * Copyright Google LLC All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - - - - - - - - - - -/** - * @fileoverview added by tsickle - * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc - */ - -/** - * IDs are deliminated by an empty space, as per the spec. - * @type {?} - */ -var ID_DELIMINATOR = ' '; -/** - * Adds the given ID to the specified ARIA attribute on an element. - * Used for attributes such as aria-labelledby, aria-owns, etc. - * @param {?} el - * @param {?} attr - * @param {?} id - * @return {?} - */ -function addAriaReferencedId(el, attr, id) { - /** @type {?} */ - var ids = getAriaReferenceIds(el, attr); - if (ids.some(function (existingId) { return existingId.trim() == id.trim(); })) { - return; - } - ids.push(id.trim()); - el.setAttribute(attr, ids.join(ID_DELIMINATOR)); -} -/** - * Removes the given ID from the specified ARIA attribute on an element. - * Used for attributes such as aria-labelledby, aria-owns, etc. - * @param {?} el - * @param {?} attr - * @param {?} id - * @return {?} - */ -function removeAriaReferencedId(el, attr, id) { - /** @type {?} */ - var ids = getAriaReferenceIds(el, attr); - /** @type {?} */ - var filteredIds = ids.filter(function (val) { return val != id.trim(); }); - el.setAttribute(attr, filteredIds.join(ID_DELIMINATOR)); -} -/** - * Gets the list of IDs referenced by the given ARIA attribute on an element. - * Used for attributes such as aria-labelledby, aria-owns, etc. - * @param {?} el - * @param {?} attr - * @return {?} - */ -function getAriaReferenceIds(el, attr) { - // Get string array of all individual ids (whitespace deliminated) in the attribute value - return (el.getAttribute(attr) || '').match(/\S+/g) || []; -} - -/** - * @fileoverview added by tsickle - * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc - */ -/** - * ID used for the body container where all messages are appended. - * @type {?} - */ -var MESSAGES_CONTAINER_ID = 'cdk-describedby-message-container'; -/** - * ID prefix used for each created message element. - * @type {?} - */ -var CDK_DESCRIBEDBY_ID_PREFIX = 'cdk-describedby-message'; -/** - * Attribute given to each host element that is described by a message element. - * @type {?} - */ -var CDK_DESCRIBEDBY_HOST_ATTRIBUTE = 'cdk-describedby-host'; -/** - * Global incremental identifier for each registered message element. - * @type {?} - */ -var nextId = 0; -/** - * Global map of all registered message elements that have been placed into the document. - * @type {?} - */ -var messageRegistry = new Map(); -/** - * Container for all registered messages. - * @type {?} - */ -var messagesContainer = null; -/** - * Utility that creates visually hidden elements with a message content. Useful for elements that - * want to use aria-describedby to further describe themselves without adding additional visual - * content. - * \@docs-private - */ -var AriaDescriber = /** @class */ (function () { - function AriaDescriber(_document) { - this._document = _document; - } - /** - * Adds to the host element an aria-describedby reference to a hidden element that contains - * the message. If the same message has already been registered, then it will reuse the created - * message element. - */ - /** - * Adds to the host element an aria-describedby reference to a hidden element that contains - * the message. If the same message has already been registered, then it will reuse the created - * message element. - * @param {?} hostElement - * @param {?} message - * @return {?} - */ - AriaDescriber.prototype.describe = /** - * Adds to the host element an aria-describedby reference to a hidden element that contains - * the message. If the same message has already been registered, then it will reuse the created - * message element. - * @param {?} hostElement - * @param {?} message - * @return {?} - */ - function (hostElement, message) { - if (!this._canBeDescribed(hostElement, message)) { - return; - } - if (!messageRegistry.has(message)) { - this._createMessageElement(message); - } - if (!this._isElementDescribedByMessage(hostElement, message)) { - this._addMessageReference(hostElement, message); - } - }; - /** Removes the host element's aria-describedby reference to the message element. */ - /** - * Removes the host element's aria-describedby reference to the message element. - * @param {?} hostElement - * @param {?} message - * @return {?} - */ - AriaDescriber.prototype.removeDescription = /** - * Removes the host element's aria-describedby reference to the message element. - * @param {?} hostElement - * @param {?} message - * @return {?} - */ - function (hostElement, message) { - if (!this._canBeDescribed(hostElement, message)) { - return; - } - if (this._isElementDescribedByMessage(hostElement, message)) { - this._removeMessageReference(hostElement, message); - } - /** @type {?} */ - var registeredMessage = messageRegistry.get(message); - if (registeredMessage && registeredMessage.referenceCount === 0) { - this._deleteMessageElement(message); - } - if (messagesContainer && messagesContainer.childNodes.length === 0) { - this._deleteMessagesContainer(); - } - }; - /** Unregisters all created message elements and removes the message container. */ - /** - * Unregisters all created message elements and removes the message container. - * @return {?} - */ - AriaDescriber.prototype.ngOnDestroy = /** - * Unregisters all created message elements and removes the message container. - * @return {?} - */ - function () { - /** @type {?} */ - var describedElements = this._document.querySelectorAll("[" + CDK_DESCRIBEDBY_HOST_ATTRIBUTE + "]"); - for (var i = 0; i < describedElements.length; i++) { - this._removeCdkDescribedByReferenceIds(describedElements[i]); - describedElements[i].removeAttribute(CDK_DESCRIBEDBY_HOST_ATTRIBUTE); - } - if (messagesContainer) { - this._deleteMessagesContainer(); - } - messageRegistry.clear(); - }; - /** - * Creates a new element in the visually hidden message container element with the message - * as its content and adds it to the message registry. - */ - /** - * Creates a new element in the visually hidden message container element with the message - * as its content and adds it to the message registry. - * @private - * @param {?} message - * @return {?} - */ - AriaDescriber.prototype._createMessageElement = /** - * Creates a new element in the visually hidden message container element with the message - * as its content and adds it to the message registry. - * @private - * @param {?} message - * @return {?} - */ - function (message) { - /** @type {?} */ - var messageElement = this._document.createElement('div'); - messageElement.setAttribute('id', CDK_DESCRIBEDBY_ID_PREFIX + "-" + nextId++); - messageElement.appendChild((/** @type {?} */ (this._document.createTextNode(message)))); - this._createMessagesContainer(); - (/** @type {?} */ (messagesContainer)).appendChild(messageElement); - messageRegistry.set(message, { messageElement: messageElement, referenceCount: 0 }); - }; - /** Deletes the message element from the global messages container. */ - /** - * Deletes the message element from the global messages container. - * @private - * @param {?} message - * @return {?} - */ - AriaDescriber.prototype._deleteMessageElement = /** - * Deletes the message element from the global messages container. - * @private - * @param {?} message - * @return {?} - */ - function (message) { - /** @type {?} */ - var registeredMessage = messageRegistry.get(message); - /** @type {?} */ - var messageElement = registeredMessage && registeredMessage.messageElement; - if (messagesContainer && messageElement) { - messagesContainer.removeChild(messageElement); - } - messageRegistry.delete(message); - }; - /** Creates the global container for all aria-describedby messages. */ - /** - * Creates the global container for all aria-describedby messages. - * @private - * @return {?} - */ - AriaDescriber.prototype._createMessagesContainer = /** - * Creates the global container for all aria-describedby messages. - * @private - * @return {?} - */ - function () { - if (!messagesContainer) { - /** @type {?} */ - var preExistingContainer = this._document.getElementById(MESSAGES_CONTAINER_ID); - // When going from the server to the client, we may end up in a situation where there's - // already a container on the page, but we don't have a reference to it. Clear the - // old container so we don't get duplicates. Doing this, instead of emptying the previous - // container, should be slightly faster. - if (preExistingContainer) { - (/** @type {?} */ (preExistingContainer.parentNode)).removeChild(preExistingContainer); - } - messagesContainer = this._document.createElement('div'); - messagesContainer.id = MESSAGES_CONTAINER_ID; - messagesContainer.setAttribute('aria-hidden', 'true'); - messagesContainer.style.display = 'none'; - this._document.body.appendChild(messagesContainer); - } - }; - /** Deletes the global messages container. */ - /** - * Deletes the global messages container. - * @private - * @return {?} - */ - AriaDescriber.prototype._deleteMessagesContainer = /** - * Deletes the global messages container. - * @private - * @return {?} - */ - function () { - if (messagesContainer && messagesContainer.parentNode) { - messagesContainer.parentNode.removeChild(messagesContainer); - messagesContainer = null; - } - }; - /** Removes all cdk-describedby messages that are hosted through the element. */ - /** - * Removes all cdk-describedby messages that are hosted through the element. - * @private - * @param {?} element - * @return {?} - */ - AriaDescriber.prototype._removeCdkDescribedByReferenceIds = /** - * Removes all cdk-describedby messages that are hosted through the element. - * @private - * @param {?} element - * @return {?} - */ - function (element) { - // Remove all aria-describedby reference IDs that are prefixed by CDK_DESCRIBEDBY_ID_PREFIX - /** @type {?} */ - var originalReferenceIds = getAriaReferenceIds(element, 'aria-describedby') - .filter(function (id) { return id.indexOf(CDK_DESCRIBEDBY_ID_PREFIX) != 0; }); - element.setAttribute('aria-describedby', originalReferenceIds.join(' ')); - }; - /** - * Adds a message reference to the element using aria-describedby and increments the registered - * message's reference count. - */ - /** - * Adds a message reference to the element using aria-describedby and increments the registered - * message's reference count. - * @private - * @param {?} element - * @param {?} message - * @return {?} - */ - AriaDescriber.prototype._addMessageReference = /** - * Adds a message reference to the element using aria-describedby and increments the registered - * message's reference count. - * @private - * @param {?} element - * @param {?} message - * @return {?} - */ - function (element, message) { - /** @type {?} */ - var registeredMessage = (/** @type {?} */ (messageRegistry.get(message))); - // Add the aria-describedby reference and set the - // describedby_host attribute to mark the element. - addAriaReferencedId(element, 'aria-describedby', registeredMessage.messageElement.id); - element.setAttribute(CDK_DESCRIBEDBY_HOST_ATTRIBUTE, ''); - registeredMessage.referenceCount++; - }; - /** - * Removes a message reference from the element using aria-describedby - * and decrements the registered message's reference count. - */ - /** - * Removes a message reference from the element using aria-describedby - * and decrements the registered message's reference count. - * @private - * @param {?} element - * @param {?} message - * @return {?} - */ - AriaDescriber.prototype._removeMessageReference = /** - * Removes a message reference from the element using aria-describedby - * and decrements the registered message's reference count. - * @private - * @param {?} element - * @param {?} message - * @return {?} - */ - function (element, message) { - /** @type {?} */ - var registeredMessage = (/** @type {?} */ (messageRegistry.get(message))); - registeredMessage.referenceCount--; - removeAriaReferencedId(element, 'aria-describedby', registeredMessage.messageElement.id); - element.removeAttribute(CDK_DESCRIBEDBY_HOST_ATTRIBUTE); - }; - /** Returns true if the element has been described by the provided message ID. */ - /** - * Returns true if the element has been described by the provided message ID. - * @private - * @param {?} element - * @param {?} message - * @return {?} - */ - AriaDescriber.prototype._isElementDescribedByMessage = /** - * Returns true if the element has been described by the provided message ID. - * @private - * @param {?} element - * @param {?} message - * @return {?} - */ - function (element, message) { - /** @type {?} */ - var referenceIds = getAriaReferenceIds(element, 'aria-describedby'); - /** @type {?} */ - var registeredMessage = messageRegistry.get(message); - /** @type {?} */ - var messageId = registeredMessage && registeredMessage.messageElement.id; - return !!messageId && referenceIds.indexOf(messageId) != -1; - }; - /** Determines whether a message can be described on a particular element. */ - /** - * Determines whether a message can be described on a particular element. - * @private - * @param {?} element - * @param {?} message - * @return {?} - */ - AriaDescriber.prototype._canBeDescribed = /** - * Determines whether a message can be described on a particular element. - * @private - * @param {?} element - * @param {?} message - * @return {?} - */ - function (element, message) { - return element.nodeType === this._document.ELEMENT_NODE && message != null && - !!("" + message).trim(); - }; - AriaDescriber.decorators = [ - { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Injectable"], args: [{ providedIn: 'root' },] }, - ]; - /** @nocollapse */ - AriaDescriber.ctorParameters = function () { return [ - { type: undefined, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Inject"], args: [_angular_common__WEBPACK_IMPORTED_MODULE_0__["DOCUMENT"],] }] } - ]; }; - /** @nocollapse */ AriaDescriber.ngInjectableDef = Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["defineInjectable"])({ factory: function AriaDescriber_Factory() { return new AriaDescriber(Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["inject"])(_angular_common__WEBPACK_IMPORTED_MODULE_0__["DOCUMENT"])); }, token: AriaDescriber, providedIn: "root" }); - return AriaDescriber; -}()); -/** - * \@docs-private \@deprecated \@breaking-change 8.0.0 - * @param {?} parentDispatcher - * @param {?} _document - * @return {?} - */ -function ARIA_DESCRIBER_PROVIDER_FACTORY(parentDispatcher, _document) { - return parentDispatcher || new AriaDescriber(_document); -} -/** - * \@docs-private \@deprecated \@breaking-change 8.0.0 - * @type {?} - */ -var ARIA_DESCRIBER_PROVIDER = { - // If there is already an AriaDescriber available, use that. Otherwise, provide a new one. - provide: AriaDescriber, - deps: [ - [new _angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"](), new _angular_core__WEBPACK_IMPORTED_MODULE_1__["SkipSelf"](), AriaDescriber], - (/** @type {?} */ (_angular_common__WEBPACK_IMPORTED_MODULE_0__["DOCUMENT"])) - ], - useFactory: ARIA_DESCRIBER_PROVIDER_FACTORY -}; - -/** - * @fileoverview added by tsickle - * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc - */ -/** - * This class manages keyboard events for selectable lists. If you pass it a query list - * of items, it will set the active item correctly when arrow events occur. - * @template T - */ -var /** - * This class manages keyboard events for selectable lists. If you pass it a query list - * of items, it will set the active item correctly when arrow events occur. - * @template T - */ -ListKeyManager = /** @class */ (function () { - function ListKeyManager(_items) { - var _this = this; - this._items = _items; - this._activeItemIndex = -1; - this._activeItem = null; - this._wrap = false; - this._letterKeyStream = new rxjs__WEBPACK_IMPORTED_MODULE_2__["Subject"](); - this._typeaheadSubscription = rxjs__WEBPACK_IMPORTED_MODULE_2__["Subscription"].EMPTY; - this._vertical = true; - this._allowedModifierKeys = []; - /** - * Predicate function that can be used to check whether an item should be skipped - * by the key manager. By default, disabled items are skipped. - */ - this._skipPredicateFn = function (item) { return item.disabled; }; - // Buffer for the letters that the user has pressed when the typeahead option is turned on. - this._pressedLetters = []; - /** - * Stream that emits any time the TAB key is pressed, so components can react - * when focus is shifted off of the list. - */ - this.tabOut = new rxjs__WEBPACK_IMPORTED_MODULE_2__["Subject"](); - /** - * Stream that emits whenever the active item of the list manager changes. - */ - this.change = new rxjs__WEBPACK_IMPORTED_MODULE_2__["Subject"](); - // We allow for the items to be an array because, in some cases, the consumer may - // not have access to a QueryList of the items they want to manage (e.g. when the - // items aren't being collected via `ViewChildren` or `ContentChildren`). - if (_items instanceof _angular_core__WEBPACK_IMPORTED_MODULE_1__["QueryList"]) { - _items.changes.subscribe(function (newItems) { - if (_this._activeItem) { - /** @type {?} */ - var itemArray = newItems.toArray(); - /** @type {?} */ - var newIndex = itemArray.indexOf(_this._activeItem); - if (newIndex > -1 && newIndex !== _this._activeItemIndex) { - _this._activeItemIndex = newIndex; - } - } - }); - } - } - /** - * Sets the predicate function that determines which items should be skipped by the - * list key manager. - * @param predicate Function that determines whether the given item should be skipped. - */ - /** - * Sets the predicate function that determines which items should be skipped by the - * list key manager. - * @template THIS - * @this {THIS} - * @param {?} predicate Function that determines whether the given item should be skipped. - * @return {THIS} - */ - ListKeyManager.prototype.skipPredicate = /** - * Sets the predicate function that determines which items should be skipped by the - * list key manager. - * @template THIS - * @this {THIS} - * @param {?} predicate Function that determines whether the given item should be skipped. - * @return {THIS} - */ - function (predicate) { - (/** @type {?} */ (this))._skipPredicateFn = predicate; - return (/** @type {?} */ (this)); - }; - /** - * Configures wrapping mode, which determines whether the active item will wrap to - * the other end of list when there are no more items in the given direction. - * @param shouldWrap Whether the list should wrap when reaching the end. - */ - /** - * Configures wrapping mode, which determines whether the active item will wrap to - * the other end of list when there are no more items in the given direction. - * @template THIS - * @this {THIS} - * @param {?=} shouldWrap Whether the list should wrap when reaching the end. - * @return {THIS} - */ - ListKeyManager.prototype.withWrap = /** - * Configures wrapping mode, which determines whether the active item will wrap to - * the other end of list when there are no more items in the given direction. - * @template THIS - * @this {THIS} - * @param {?=} shouldWrap Whether the list should wrap when reaching the end. - * @return {THIS} - */ - function (shouldWrap) { - if (shouldWrap === void 0) { shouldWrap = true; } - (/** @type {?} */ (this))._wrap = shouldWrap; - return (/** @type {?} */ (this)); - }; - /** - * Configures whether the key manager should be able to move the selection vertically. - * @param enabled Whether vertical selection should be enabled. - */ - /** - * Configures whether the key manager should be able to move the selection vertically. - * @template THIS - * @this {THIS} - * @param {?=} enabled Whether vertical selection should be enabled. - * @return {THIS} - */ - ListKeyManager.prototype.withVerticalOrientation = /** - * Configures whether the key manager should be able to move the selection vertically. - * @template THIS - * @this {THIS} - * @param {?=} enabled Whether vertical selection should be enabled. - * @return {THIS} - */ - function (enabled) { - if (enabled === void 0) { enabled = true; } - (/** @type {?} */ (this))._vertical = enabled; - return (/** @type {?} */ (this)); - }; - /** - * Configures the key manager to move the selection horizontally. - * Passing in `null` will disable horizontal movement. - * @param direction Direction in which the selection can be moved. - */ - /** - * Configures the key manager to move the selection horizontally. - * Passing in `null` will disable horizontal movement. - * @template THIS - * @this {THIS} - * @param {?} direction Direction in which the selection can be moved. - * @return {THIS} - */ - ListKeyManager.prototype.withHorizontalOrientation = /** - * Configures the key manager to move the selection horizontally. - * Passing in `null` will disable horizontal movement. - * @template THIS - * @this {THIS} - * @param {?} direction Direction in which the selection can be moved. - * @return {THIS} - */ - function (direction) { - (/** @type {?} */ (this))._horizontal = direction; - return (/** @type {?} */ (this)); - }; - /** - * Modifier keys which are allowed to be held down and whose default actions will be prevented - * as the user is pressing the arrow keys. Defaults to not allowing any modifier keys. - */ - /** - * Modifier keys which are allowed to be held down and whose default actions will be prevented - * as the user is pressing the arrow keys. Defaults to not allowing any modifier keys. - * @template THIS - * @this {THIS} - * @param {?} keys - * @return {THIS} - */ - ListKeyManager.prototype.withAllowedModifierKeys = /** - * Modifier keys which are allowed to be held down and whose default actions will be prevented - * as the user is pressing the arrow keys. Defaults to not allowing any modifier keys. - * @template THIS - * @this {THIS} - * @param {?} keys - * @return {THIS} - */ - function (keys) { - (/** @type {?} */ (this))._allowedModifierKeys = keys; - return (/** @type {?} */ (this)); - }; - /** - * Turns on typeahead mode which allows users to set the active item by typing. - * @param debounceInterval Time to wait after the last keystroke before setting the active item. - */ - /** - * Turns on typeahead mode which allows users to set the active item by typing. - * @template THIS - * @this {THIS} - * @param {?=} debounceInterval Time to wait after the last keystroke before setting the active item. - * @return {THIS} - */ - ListKeyManager.prototype.withTypeAhead = /** - * Turns on typeahead mode which allows users to set the active item by typing. - * @template THIS - * @this {THIS} - * @param {?=} debounceInterval Time to wait after the last keystroke before setting the active item. - * @return {THIS} - */ - function (debounceInterval) { - var _this = this; - if (debounceInterval === void 0) { debounceInterval = 200; } - if ((/** @type {?} */ (this))._items.length && (/** @type {?} */ (this))._items.some(function (item) { return typeof item.getLabel !== 'function'; })) { - throw Error('ListKeyManager items in typeahead mode must implement the `getLabel` method.'); - } - (/** @type {?} */ (this))._typeaheadSubscription.unsubscribe(); - // Debounce the presses of non-navigational keys, collect the ones that correspond to letters - // and convert those letters back into a string. Afterwards find the first item that starts - // with that string and select it. - (/** @type {?} */ (this))._typeaheadSubscription = (/** @type {?} */ (this))._letterKeyStream.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_4__["tap"])(function (keyCode) { return (/** @type {?} */ (_this))._pressedLetters.push(keyCode); }), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_4__["debounceTime"])(debounceInterval), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_4__["filter"])(function () { return (/** @type {?} */ (_this))._pressedLetters.length > 0; }), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_4__["map"])(function () { return (/** @type {?} */ (_this))._pressedLetters.join(''); })).subscribe(function (inputString) { - /** @type {?} */ - var items = (/** @type {?} */ (_this))._getItemsArray(); - // Start at 1 because we want to start searching at the item immediately - // following the current active item. - for (var i = 1; i < items.length + 1; i++) { - /** @type {?} */ - var index = ((/** @type {?} */ (_this))._activeItemIndex + i) % items.length; - /** @type {?} */ - var item = items[index]; - if (!(/** @type {?} */ (_this))._skipPredicateFn(item) && - (/** @type {?} */ (item.getLabel))().toUpperCase().trim().indexOf(inputString) === 0) { - (/** @type {?} */ (_this)).setActiveItem(index); - break; - } - } - (/** @type {?} */ (_this))._pressedLetters = []; - }); - return (/** @type {?} */ (this)); - }; - /** - * @param {?} item - * @return {?} - */ - ListKeyManager.prototype.setActiveItem = /** - * @param {?} item - * @return {?} - */ - function (item) { - /** @type {?} */ - var previousIndex = this._activeItemIndex; - this.updateActiveItem(item); - if (this._activeItemIndex !== previousIndex) { - this.change.next(this._activeItemIndex); - } - }; - /** - * Sets the active item depending on the key event passed in. - * @param event Keyboard event to be used for determining which element should be active. - */ - /** - * Sets the active item depending on the key event passed in. - * @param {?} event Keyboard event to be used for determining which element should be active. - * @return {?} - */ - ListKeyManager.prototype.onKeydown = /** - * Sets the active item depending on the key event passed in. - * @param {?} event Keyboard event to be used for determining which element should be active. - * @return {?} - */ - function (event) { - var _this = this; - /** @type {?} */ - var keyCode = event.keyCode; - /** @type {?} */ - var modifiers = ['altKey', 'ctrlKey', 'metaKey', 'shiftKey']; - /** @type {?} */ - var isModifierAllowed = modifiers.every(function (modifier) { - return !event[modifier] || _this._allowedModifierKeys.indexOf(modifier) > -1; - }); - switch (keyCode) { - case _angular_cdk_keycodes__WEBPACK_IMPORTED_MODULE_3__["TAB"]: - this.tabOut.next(); - return; - case _angular_cdk_keycodes__WEBPACK_IMPORTED_MODULE_3__["DOWN_ARROW"]: - if (this._vertical && isModifierAllowed) { - this.setNextItemActive(); - break; - } - else { - return; - } - case _angular_cdk_keycodes__WEBPACK_IMPORTED_MODULE_3__["UP_ARROW"]: - if (this._vertical && isModifierAllowed) { - this.setPreviousItemActive(); - break; - } - else { - return; - } - case _angular_cdk_keycodes__WEBPACK_IMPORTED_MODULE_3__["RIGHT_ARROW"]: - if (this._horizontal && isModifierAllowed) { - this._horizontal === 'rtl' ? this.setPreviousItemActive() : this.setNextItemActive(); - break; - } - else { - return; - } - case _angular_cdk_keycodes__WEBPACK_IMPORTED_MODULE_3__["LEFT_ARROW"]: - if (this._horizontal && isModifierAllowed) { - this._horizontal === 'rtl' ? this.setNextItemActive() : this.setPreviousItemActive(); - break; - } - else { - return; - } - default: - if (isModifierAllowed || Object(_angular_cdk_keycodes__WEBPACK_IMPORTED_MODULE_3__["hasModifierKey"])(event, 'shiftKey')) { - // Attempt to use the `event.key` which also maps it to the user's keyboard language, - // otherwise fall back to resolving alphanumeric characters via the keyCode. - if (event.key && event.key.length === 1) { - this._letterKeyStream.next(event.key.toLocaleUpperCase()); - } - else if ((keyCode >= _angular_cdk_keycodes__WEBPACK_IMPORTED_MODULE_3__["A"] && keyCode <= _angular_cdk_keycodes__WEBPACK_IMPORTED_MODULE_3__["Z"]) || (keyCode >= _angular_cdk_keycodes__WEBPACK_IMPORTED_MODULE_3__["ZERO"] && keyCode <= _angular_cdk_keycodes__WEBPACK_IMPORTED_MODULE_3__["NINE"])) { - this._letterKeyStream.next(String.fromCharCode(keyCode)); - } - } - // Note that we return here, in order to avoid preventing - // the default action of non-navigational keys. - return; - } - this._pressedLetters = []; - event.preventDefault(); - }; - Object.defineProperty(ListKeyManager.prototype, "activeItemIndex", { - /** Index of the currently active item. */ - get: /** - * Index of the currently active item. - * @return {?} - */ - function () { - return this._activeItemIndex; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ListKeyManager.prototype, "activeItem", { - /** The active item. */ - get: /** - * The active item. - * @return {?} - */ - function () { - return this._activeItem; - }, - enumerable: true, - configurable: true - }); - /** Sets the active item to the first enabled item in the list. */ - /** - * Sets the active item to the first enabled item in the list. - * @return {?} - */ - ListKeyManager.prototype.setFirstItemActive = /** - * Sets the active item to the first enabled item in the list. - * @return {?} - */ - function () { - this._setActiveItemByIndex(0, 1); - }; - /** Sets the active item to the last enabled item in the list. */ - /** - * Sets the active item to the last enabled item in the list. - * @return {?} - */ - ListKeyManager.prototype.setLastItemActive = /** - * Sets the active item to the last enabled item in the list. - * @return {?} - */ - function () { - this._setActiveItemByIndex(this._items.length - 1, -1); - }; - /** Sets the active item to the next enabled item in the list. */ - /** - * Sets the active item to the next enabled item in the list. - * @return {?} - */ - ListKeyManager.prototype.setNextItemActive = /** - * Sets the active item to the next enabled item in the list. - * @return {?} - */ - function () { - this._activeItemIndex < 0 ? this.setFirstItemActive() : this._setActiveItemByDelta(1); - }; - /** Sets the active item to a previous enabled item in the list. */ - /** - * Sets the active item to a previous enabled item in the list. - * @return {?} - */ - ListKeyManager.prototype.setPreviousItemActive = /** - * Sets the active item to a previous enabled item in the list. - * @return {?} - */ - function () { - this._activeItemIndex < 0 && this._wrap ? this.setLastItemActive() - : this._setActiveItemByDelta(-1); - }; - /** - * @param {?} item - * @return {?} - */ - ListKeyManager.prototype.updateActiveItem = /** - * @param {?} item - * @return {?} - */ - function (item) { - /** @type {?} */ - var itemArray = this._getItemsArray(); - /** @type {?} */ - var index = typeof item === 'number' ? item : itemArray.indexOf(item); - /** @type {?} */ - var activeItem = itemArray[index]; - // Explicitly check for `null` and `undefined` because other falsy values are valid. - this._activeItem = activeItem == null ? null : activeItem; - this._activeItemIndex = index; - }; - /** - * Allows setting of the activeItemIndex without any other effects. - * @param index The new activeItemIndex. - * @deprecated Use `updateActiveItem` instead. - * @breaking-change 8.0.0 - */ - /** - * Allows setting of the activeItemIndex without any other effects. - * @deprecated Use `updateActiveItem` instead. - * \@breaking-change 8.0.0 - * @param {?} index The new activeItemIndex. - * @return {?} - */ - ListKeyManager.prototype.updateActiveItemIndex = /** - * Allows setting of the activeItemIndex without any other effects. - * @deprecated Use `updateActiveItem` instead. - * \@breaking-change 8.0.0 - * @param {?} index The new activeItemIndex. - * @return {?} - */ - function (index) { - this.updateActiveItem(index); - }; - /** - * This method sets the active item, given a list of items and the delta between the - * currently active item and the new active item. It will calculate differently - * depending on whether wrap mode is turned on. - */ - /** - * This method sets the active item, given a list of items and the delta between the - * currently active item and the new active item. It will calculate differently - * depending on whether wrap mode is turned on. - * @private - * @param {?} delta - * @return {?} - */ - ListKeyManager.prototype._setActiveItemByDelta = /** - * This method sets the active item, given a list of items and the delta between the - * currently active item and the new active item. It will calculate differently - * depending on whether wrap mode is turned on. - * @private - * @param {?} delta - * @return {?} - */ - function (delta) { - this._wrap ? this._setActiveInWrapMode(delta) : this._setActiveInDefaultMode(delta); - }; - /** - * Sets the active item properly given "wrap" mode. In other words, it will continue to move - * down the list until it finds an item that is not disabled, and it will wrap if it - * encounters either end of the list. - */ - /** - * Sets the active item properly given "wrap" mode. In other words, it will continue to move - * down the list until it finds an item that is not disabled, and it will wrap if it - * encounters either end of the list. - * @private - * @param {?} delta - * @return {?} - */ - ListKeyManager.prototype._setActiveInWrapMode = /** - * Sets the active item properly given "wrap" mode. In other words, it will continue to move - * down the list until it finds an item that is not disabled, and it will wrap if it - * encounters either end of the list. - * @private - * @param {?} delta - * @return {?} - */ - function (delta) { - /** @type {?} */ - var items = this._getItemsArray(); - for (var i = 1; i <= items.length; i++) { - /** @type {?} */ - var index = (this._activeItemIndex + (delta * i) + items.length) % items.length; - /** @type {?} */ - var item = items[index]; - if (!this._skipPredicateFn(item)) { - this.setActiveItem(index); - return; - } - } - }; - /** - * Sets the active item properly given the default mode. In other words, it will - * continue to move down the list until it finds an item that is not disabled. If - * it encounters either end of the list, it will stop and not wrap. - */ - /** - * Sets the active item properly given the default mode. In other words, it will - * continue to move down the list until it finds an item that is not disabled. If - * it encounters either end of the list, it will stop and not wrap. - * @private - * @param {?} delta - * @return {?} - */ - ListKeyManager.prototype._setActiveInDefaultMode = /** - * Sets the active item properly given the default mode. In other words, it will - * continue to move down the list until it finds an item that is not disabled. If - * it encounters either end of the list, it will stop and not wrap. - * @private - * @param {?} delta - * @return {?} - */ - function (delta) { - this._setActiveItemByIndex(this._activeItemIndex + delta, delta); - }; - /** - * Sets the active item to the first enabled item starting at the index specified. If the - * item is disabled, it will move in the fallbackDelta direction until it either - * finds an enabled item or encounters the end of the list. - */ - /** - * Sets the active item to the first enabled item starting at the index specified. If the - * item is disabled, it will move in the fallbackDelta direction until it either - * finds an enabled item or encounters the end of the list. - * @private - * @param {?} index - * @param {?} fallbackDelta - * @return {?} - */ - ListKeyManager.prototype._setActiveItemByIndex = /** - * Sets the active item to the first enabled item starting at the index specified. If the - * item is disabled, it will move in the fallbackDelta direction until it either - * finds an enabled item or encounters the end of the list. - * @private - * @param {?} index - * @param {?} fallbackDelta - * @return {?} - */ - function (index, fallbackDelta) { - /** @type {?} */ - var items = this._getItemsArray(); - if (!items[index]) { - return; - } - while (this._skipPredicateFn(items[index])) { - index += fallbackDelta; - if (!items[index]) { - return; - } - } - this.setActiveItem(index); - }; - /** Returns the items as an array. */ - /** - * Returns the items as an array. - * @private - * @return {?} - */ - ListKeyManager.prototype._getItemsArray = /** - * Returns the items as an array. - * @private - * @return {?} - */ - function () { - return this._items instanceof _angular_core__WEBPACK_IMPORTED_MODULE_1__["QueryList"] ? this._items.toArray() : this._items; - }; - return ListKeyManager; -}()); - -/** - * @fileoverview added by tsickle - * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc - */ -/** - * @template T - */ -var /** - * @template T - */ -ActiveDescendantKeyManager = /** @class */ (function (_super) { - Object(tslib__WEBPACK_IMPORTED_MODULE_5__["__extends"])(ActiveDescendantKeyManager, _super); - function ActiveDescendantKeyManager() { - return _super !== null && _super.apply(this, arguments) || this; - } - /** - * @param {?} index - * @return {?} - */ - ActiveDescendantKeyManager.prototype.setActiveItem = /** - * @param {?} index - * @return {?} - */ - function (index) { - if (this.activeItem) { - this.activeItem.setInactiveStyles(); - } - _super.prototype.setActiveItem.call(this, index); - if (this.activeItem) { - this.activeItem.setActiveStyles(); - } - }; - return ActiveDescendantKeyManager; -}(ListKeyManager)); - -/** - * @fileoverview added by tsickle - * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc - */ -/** - * @template T - */ -var /** - * @template T - */ -FocusKeyManager = /** @class */ (function (_super) { - Object(tslib__WEBPACK_IMPORTED_MODULE_5__["__extends"])(FocusKeyManager, _super); - function FocusKeyManager() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this._origin = 'program'; - return _this; - } - /** - * Sets the focus origin that will be passed in to the items for any subsequent `focus` calls. - * @param origin Focus origin to be used when focusing items. - */ - /** - * Sets the focus origin that will be passed in to the items for any subsequent `focus` calls. - * @template THIS - * @this {THIS} - * @param {?} origin Focus origin to be used when focusing items. - * @return {THIS} - */ - FocusKeyManager.prototype.setFocusOrigin = /** - * Sets the focus origin that will be passed in to the items for any subsequent `focus` calls. - * @template THIS - * @this {THIS} - * @param {?} origin Focus origin to be used when focusing items. - * @return {THIS} - */ - function (origin) { - (/** @type {?} */ (this))._origin = origin; - return (/** @type {?} */ (this)); - }; - /** - * @param {?} item - * @return {?} - */ - FocusKeyManager.prototype.setActiveItem = /** - * @param {?} item - * @return {?} - */ - function (item) { - _super.prototype.setActiveItem.call(this, item); - if (this.activeItem) { - this.activeItem.focus(this._origin); - } - }; - return FocusKeyManager; -}(ListKeyManager)); - -/** - * @fileoverview added by tsickle - * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc - */ -// The InteractivityChecker leans heavily on the ally.js accessibility utilities. -// Methods like `isTabbable` are only covering specific edge-cases for the browsers which are -// supported. -/** - * Utility for checking the interactivity of an element, such as whether is is focusable or - * tabbable. - */ -var InteractivityChecker = /** @class */ (function () { - function InteractivityChecker(_platform) { - this._platform = _platform; - } - /** - * Gets whether an element is disabled. - * - * @param element Element to be checked. - * @returns Whether the element is disabled. - */ - /** - * Gets whether an element is disabled. - * - * @param {?} element Element to be checked. - * @return {?} Whether the element is disabled. - */ - InteractivityChecker.prototype.isDisabled = /** - * Gets whether an element is disabled. - * - * @param {?} element Element to be checked. - * @return {?} Whether the element is disabled. - */ - function (element) { - // This does not capture some cases, such as a non-form control with a disabled attribute or - // a form control inside of a disabled form, but should capture the most common cases. - return element.hasAttribute('disabled'); - }; - /** - * Gets whether an element is visible for the purposes of interactivity. - * - * This will capture states like `display: none` and `visibility: hidden`, but not things like - * being clipped by an `overflow: hidden` parent or being outside the viewport. - * - * @returns Whether the element is visible. - */ - /** - * Gets whether an element is visible for the purposes of interactivity. - * - * This will capture states like `display: none` and `visibility: hidden`, but not things like - * being clipped by an `overflow: hidden` parent or being outside the viewport. - * - * @param {?} element - * @return {?} Whether the element is visible. - */ - InteractivityChecker.prototype.isVisible = /** - * Gets whether an element is visible for the purposes of interactivity. - * - * This will capture states like `display: none` and `visibility: hidden`, but not things like - * being clipped by an `overflow: hidden` parent or being outside the viewport. - * - * @param {?} element - * @return {?} Whether the element is visible. - */ - function (element) { - return hasGeometry(element) && getComputedStyle(element).visibility === 'visible'; - }; - /** - * Gets whether an element can be reached via Tab key. - * Assumes that the element has already been checked with isFocusable. - * - * @param element Element to be checked. - * @returns Whether the element is tabbable. - */ - /** - * Gets whether an element can be reached via Tab key. - * Assumes that the element has already been checked with isFocusable. - * - * @param {?} element Element to be checked. - * @return {?} Whether the element is tabbable. - */ - InteractivityChecker.prototype.isTabbable = /** - * Gets whether an element can be reached via Tab key. - * Assumes that the element has already been checked with isFocusable. - * - * @param {?} element Element to be checked. - * @return {?} Whether the element is tabbable. - */ - function (element) { - // Nothing is tabbable on the server 😎 - if (!this._platform.isBrowser) { - return false; - } - /** @type {?} */ - var frameElement = getFrameElement(getWindow(element)); - if (frameElement) { - /** @type {?} */ - var frameType = frameElement && frameElement.nodeName.toLowerCase(); - // Frame elements inherit their tabindex onto all child elements. - if (getTabIndexValue(frameElement) === -1) { - return false; - } - // Webkit and Blink consider anything inside of an element as non-tabbable. - if ((this._platform.BLINK || this._platform.WEBKIT) && frameType === 'object') { - return false; - } - // Webkit and Blink disable tabbing to an element inside of an invisible frame. - if ((this._platform.BLINK || this._platform.WEBKIT) && !this.isVisible(frameElement)) { - return false; - } - } - /** @type {?} */ - var nodeName = element.nodeName.toLowerCase(); - /** @type {?} */ - var tabIndexValue = getTabIndexValue(element); - if (element.hasAttribute('contenteditable')) { - return tabIndexValue !== -1; - } - if (nodeName === 'iframe') { - // The frames may be tabbable depending on content, but it's not possibly to reliably - // investigate the content of the frames. - return false; - } - if (nodeName === 'audio') { - if (!element.hasAttribute('controls')) { - // By default an
Device {{element.Device}} {{element.DeviceModel}}
` element. - * @param stickCellCss The CSS class that will be applied to every row/cell that has - * sticky positioning applied. - * @param direction The directionality context of the table (ltr/rtl); affects column positioning - * by reversing left/right positions. - * @param _isBrowser Whether the table is currently being rendered on the server or the client. - */ - function StickyStyler(isNativeHtmlTable, stickCellCss, direction, _isBrowser) { - if (_isBrowser === void 0) { _isBrowser = true; } - this.isNativeHtmlTable = isNativeHtmlTable; - this.stickCellCss = stickCellCss; - this.direction = direction; - this._isBrowser = _isBrowser; - } - /** - * Clears the sticky positioning styles from the row and its cells by resetting the `position` - * style, setting the zIndex to 0, and unsetting each provided sticky direction. - * @param rows The list of rows that should be cleared from sticking in the provided directions - * @param stickyDirections The directions that should no longer be set as sticky on the rows. - */ - /** - * Clears the sticky positioning styles from the row and its cells by resetting the `position` - * style, setting the zIndex to 0, and unsetting each provided sticky direction. - * @param {?} rows The list of rows that should be cleared from sticking in the provided directions - * @param {?} stickyDirections The directions that should no longer be set as sticky on the rows. - * @return {?} - */ - StickyStyler.prototype.clearStickyPositioning = /** - * Clears the sticky positioning styles from the row and its cells by resetting the `position` - * style, setting the zIndex to 0, and unsetting each provided sticky direction. - * @param {?} rows The list of rows that should be cleared from sticking in the provided directions - * @param {?} stickyDirections The directions that should no longer be set as sticky on the rows. - * @return {?} - */ - function (rows, stickyDirections) { - for (var _i = 0, rows_1 = rows; _i < rows_1.length; _i++) { - var row = rows_1[_i]; - // If the row isn't an element (e.g. if it's an `ng-container`), - // it won't have inline styles or `children` so we skip it. - if (row.nodeType !== row.ELEMENT_NODE) { - continue; - } - this._removeStickyStyle(row, stickyDirections); - for (var i = 0; i < row.children.length; i++) { - /** @type {?} */ - var cell = (/** @type {?} */ (row.children[i])); - this._removeStickyStyle(cell, stickyDirections); - } - } - }; - /** - * Applies sticky left and right positions to the cells of each row according to the sticky - * states of the rendered column definitions. - * @param rows The rows that should have its set of cells stuck according to the sticky states. - * @param stickyStartStates A list of boolean states where each state represents whether the cell - * in this index position should be stuck to the start of the row. - * @param stickyEndStates A list of boolean states where each state represents whether the cell - * in this index position should be stuck to the end of the row. - */ - /** - * Applies sticky left and right positions to the cells of each row according to the sticky - * states of the rendered column definitions. - * @param {?} rows The rows that should have its set of cells stuck according to the sticky states. - * @param {?} stickyStartStates A list of boolean states where each state represents whether the cell - * in this index position should be stuck to the start of the row. - * @param {?} stickyEndStates A list of boolean states where each state represents whether the cell - * in this index position should be stuck to the end of the row. - * @return {?} - */ - StickyStyler.prototype.updateStickyColumns = /** - * Applies sticky left and right positions to the cells of each row according to the sticky - * states of the rendered column definitions. - * @param {?} rows The rows that should have its set of cells stuck according to the sticky states. - * @param {?} stickyStartStates A list of boolean states where each state represents whether the cell - * in this index position should be stuck to the start of the row. - * @param {?} stickyEndStates A list of boolean states where each state represents whether the cell - * in this index position should be stuck to the end of the row. - * @return {?} - */ - function (rows, stickyStartStates, stickyEndStates) { - /** @type {?} */ - var hasStickyColumns = stickyStartStates.some(function (state) { return state; }) || stickyEndStates.some(function (state) { return state; }); - if (!rows.length || !hasStickyColumns || !this._isBrowser) { - return; - } - /** @type {?} */ - var firstRow = rows[0]; - /** @type {?} */ - var numCells = firstRow.children.length; - /** @type {?} */ - var cellWidths = this._getCellWidths(firstRow); - /** @type {?} */ - var startPositions = this._getStickyStartColumnPositions(cellWidths, stickyStartStates); - /** @type {?} */ - var endPositions = this._getStickyEndColumnPositions(cellWidths, stickyEndStates); - /** @type {?} */ - var isRtl = this.direction === 'rtl'; - for (var _i = 0, rows_2 = rows; _i < rows_2.length; _i++) { - var row = rows_2[_i]; - for (var i = 0; i < numCells; i++) { - /** @type {?} */ - var cell = (/** @type {?} */ (row.children[i])); - if (stickyStartStates[i]) { - this._addStickyStyle(cell, isRtl ? 'right' : 'left', startPositions[i]); - } - if (stickyEndStates[i]) { - this._addStickyStyle(cell, isRtl ? 'left' : 'right', endPositions[i]); - } - } - } - }; - /** - * Applies sticky positioning to the row's cells if using the native table layout, and to the - * row itself otherwise. - * @param rowsToStick The list of rows that should be stuck according to their corresponding - * sticky state and to the provided top or bottom position. - * @param stickyStates A list of boolean states where each state represents whether the row - * should be stuck in the particular top or bottom position. - * @param position The position direction in which the row should be stuck if that row should be - * sticky. - * - */ - /** - * Applies sticky positioning to the row's cells if using the native table layout, and to the - * row itself otherwise. - * @param {?} rowsToStick The list of rows that should be stuck according to their corresponding - * sticky state and to the provided top or bottom position. - * @param {?} stickyStates A list of boolean states where each state represents whether the row - * should be stuck in the particular top or bottom position. - * @param {?} position The position direction in which the row should be stuck if that row should be - * sticky. - * - * @return {?} - */ - StickyStyler.prototype.stickRows = /** - * Applies sticky positioning to the row's cells if using the native table layout, and to the - * row itself otherwise. - * @param {?} rowsToStick The list of rows that should be stuck according to their corresponding - * sticky state and to the provided top or bottom position. - * @param {?} stickyStates A list of boolean states where each state represents whether the row - * should be stuck in the particular top or bottom position. - * @param {?} position The position direction in which the row should be stuck if that row should be - * sticky. - * - * @return {?} - */ - function (rowsToStick, stickyStates, position) { - // Since we can't measure the rows on the server, we can't stick the rows properly. - if (!this._isBrowser) { - return; - } - // If positioning the rows to the bottom, reverse their order when evaluating the sticky - // position such that the last row stuck will be "bottom: 0px" and so on. - /** @type {?} */ - var rows = position === 'bottom' ? rowsToStick.reverse() : rowsToStick; - /** @type {?} */ - var stickyHeight = 0; - for (var rowIndex = 0; rowIndex < rows.length; rowIndex++) { - if (!stickyStates[rowIndex]) { - continue; - } - /** @type {?} */ - var row = rows[rowIndex]; - if (this.isNativeHtmlTable) { - for (var j = 0; j < row.children.length; j++) { - /** @type {?} */ - var cell = (/** @type {?} */ (row.children[j])); - this._addStickyStyle(cell, position, stickyHeight); - } - } - else { - // Flex does not respect the stick positioning on the cells, needs to be applied to the row. - // If this is applied on a native table, Safari causes the header to fly in wrong direction. - this._addStickyStyle(row, position, stickyHeight); - } - if (rowIndex === rows.length - 1) { - // prevent unnecessary reflow from getBoundingClientRect() - return; - } - stickyHeight += row.getBoundingClientRect().height; - } - }; - /** - * When using the native table in Safari, sticky footer cells do not stick. The only way to stick - * footer rows is to apply sticky styling to the tfoot container. This should only be done if - * all footer rows are sticky. If not all footer rows are sticky, remove sticky positioning from - * the tfoot element. - */ - /** - * When using the native table in Safari, sticky footer cells do not stick. The only way to stick - * footer rows is to apply sticky styling to the tfoot container. This should only be done if - * all footer rows are sticky. If not all footer rows are sticky, remove sticky positioning from - * the tfoot element. - * @param {?} tableElement - * @param {?} stickyStates - * @return {?} - */ - StickyStyler.prototype.updateStickyFooterContainer = /** - * When using the native table in Safari, sticky footer cells do not stick. The only way to stick - * footer rows is to apply sticky styling to the tfoot container. This should only be done if - * all footer rows are sticky. If not all footer rows are sticky, remove sticky positioning from - * the tfoot element. - * @param {?} tableElement - * @param {?} stickyStates - * @return {?} - */ - function (tableElement, stickyStates) { - if (!this.isNativeHtmlTable) { - return; - } - /** @type {?} */ - var tfoot = (/** @type {?} */ (tableElement.querySelector('tfoot'))); - if (stickyStates.some(function (state) { return !state; })) { - this._removeStickyStyle(tfoot, ['bottom']); - } - else { - this._addStickyStyle(tfoot, 'bottom', 0); - } - }; - /** - * Removes the sticky style on the element by removing the sticky cell CSS class, re-evaluating - * the zIndex, removing each of the provided sticky directions, and removing the - * sticky position if there are no more directions. - */ - /** - * Removes the sticky style on the element by removing the sticky cell CSS class, re-evaluating - * the zIndex, removing each of the provided sticky directions, and removing the - * sticky position if there are no more directions. - * @param {?} element - * @param {?} stickyDirections - * @return {?} - */ - StickyStyler.prototype._removeStickyStyle = /** - * Removes the sticky style on the element by removing the sticky cell CSS class, re-evaluating - * the zIndex, removing each of the provided sticky directions, and removing the - * sticky position if there are no more directions. - * @param {?} element - * @param {?} stickyDirections - * @return {?} - */ - function (element, stickyDirections) { - for (var _i = 0, stickyDirections_1 = stickyDirections; _i < stickyDirections_1.length; _i++) { - var dir = stickyDirections_1[_i]; - element.style[dir] = ''; - } - element.style.zIndex = this._getCalculatedZIndex(element); - // If the element no longer has any more sticky directions, remove sticky positioning and - // the sticky CSS class. - /** @type {?} */ - var hasDirection = STICKY_DIRECTIONS.some(function (dir) { return !!element.style[dir]; }); - if (!hasDirection) { - element.style.position = ''; - element.classList.remove(this.stickCellCss); - } - }; - /** - * Adds the sticky styling to the element by adding the sticky style class, changing position - * to be sticky (and -webkit-sticky), setting the appropriate zIndex, and adding a sticky - * direction and value. - */ - /** - * Adds the sticky styling to the element by adding the sticky style class, changing position - * to be sticky (and -webkit-sticky), setting the appropriate zIndex, and adding a sticky - * direction and value. - * @param {?} element - * @param {?} dir - * @param {?} dirValue - * @return {?} - */ - StickyStyler.prototype._addStickyStyle = /** - * Adds the sticky styling to the element by adding the sticky style class, changing position - * to be sticky (and -webkit-sticky), setting the appropriate zIndex, and adding a sticky - * direction and value. - * @param {?} element - * @param {?} dir - * @param {?} dirValue - * @return {?} - */ - function (element, dir, dirValue) { - element.classList.add(this.stickCellCss); - element.style[dir] = dirValue + "px"; - element.style.cssText += 'position: -webkit-sticky; position: sticky; '; - element.style.zIndex = this._getCalculatedZIndex(element); - }; - /** - * Calculate what the z-index should be for the element, depending on what directions (top, - * bottom, left, right) have been set. It should be true that elements with a top direction - * should have the highest index since these are elements like a table header. If any of those - * elements are also sticky in another direction, then they should appear above other elements - * that are only sticky top (e.g. a sticky column on a sticky header). Bottom-sticky elements - * (e.g. footer rows) should then be next in the ordering such that they are below the header - * but above any non-sticky elements. Finally, left/right sticky elements (e.g. sticky columns) - * should minimally increment so that they are above non-sticky elements but below top and bottom - * elements. - */ - /** - * Calculate what the z-index should be for the element, depending on what directions (top, - * bottom, left, right) have been set. It should be true that elements with a top direction - * should have the highest index since these are elements like a table header. If any of those - * elements are also sticky in another direction, then they should appear above other elements - * that are only sticky top (e.g. a sticky column on a sticky header). Bottom-sticky elements - * (e.g. footer rows) should then be next in the ordering such that they are below the header - * but above any non-sticky elements. Finally, left/right sticky elements (e.g. sticky columns) - * should minimally increment so that they are above non-sticky elements but below top and bottom - * elements. - * @param {?} element - * @return {?} - */ - StickyStyler.prototype._getCalculatedZIndex = /** - * Calculate what the z-index should be for the element, depending on what directions (top, - * bottom, left, right) have been set. It should be true that elements with a top direction - * should have the highest index since these are elements like a table header. If any of those - * elements are also sticky in another direction, then they should appear above other elements - * that are only sticky top (e.g. a sticky column on a sticky header). Bottom-sticky elements - * (e.g. footer rows) should then be next in the ordering such that they are below the header - * but above any non-sticky elements. Finally, left/right sticky elements (e.g. sticky columns) - * should minimally increment so that they are above non-sticky elements but below top and bottom - * elements. - * @param {?} element - * @return {?} - */ - function (element) { - /** @type {?} */ - var zIndexIncrements = { - top: 100, - bottom: 10, - left: 1, - right: 1, - }; - /** @type {?} */ - var zIndex = 0; - for (var _i = 0, STICKY_DIRECTIONS_1 = STICKY_DIRECTIONS; _i < STICKY_DIRECTIONS_1.length; _i++) { - var dir = STICKY_DIRECTIONS_1[_i]; - if (element.style[dir]) { - zIndex += zIndexIncrements[dir]; - } - } - return zIndex ? "" + zIndex : ''; - }; - /** Gets the widths for each cell in the provided row. */ - /** - * Gets the widths for each cell in the provided row. - * @param {?} row - * @return {?} - */ - StickyStyler.prototype._getCellWidths = /** - * Gets the widths for each cell in the provided row. - * @param {?} row - * @return {?} - */ - function (row) { - /** @type {?} */ - var cellWidths = []; - /** @type {?} */ - var firstRowCells = row.children; - for (var i = 0; i < firstRowCells.length; i++) { - /** @type {?} */ - var cell = (/** @type {?} */ (firstRowCells[i])); - cellWidths.push(cell.getBoundingClientRect().width); - } - return cellWidths; - }; - /** - * Determines the left and right positions of each sticky column cell, which will be the - * accumulation of all sticky column cell widths to the left and right, respectively. - * Non-sticky cells do not need to have a value set since their positions will not be applied. - */ - /** - * Determines the left and right positions of each sticky column cell, which will be the - * accumulation of all sticky column cell widths to the left and right, respectively. - * Non-sticky cells do not need to have a value set since their positions will not be applied. - * @param {?} widths - * @param {?} stickyStates - * @return {?} - */ - StickyStyler.prototype._getStickyStartColumnPositions = /** - * Determines the left and right positions of each sticky column cell, which will be the - * accumulation of all sticky column cell widths to the left and right, respectively. - * Non-sticky cells do not need to have a value set since their positions will not be applied. - * @param {?} widths - * @param {?} stickyStates - * @return {?} - */ - function (widths, stickyStates) { - /** @type {?} */ - var positions = []; - /** @type {?} */ - var nextPosition = 0; - for (var i = 0; i < widths.length; i++) { - if (stickyStates[i]) { - positions[i] = nextPosition; - nextPosition += widths[i]; - } - } - return positions; - }; - /** - * Determines the left and right positions of each sticky column cell, which will be the - * accumulation of all sticky column cell widths to the left and right, respectively. - * Non-sticky cells do not need to have a value set since their positions will not be applied. - */ - /** - * Determines the left and right positions of each sticky column cell, which will be the - * accumulation of all sticky column cell widths to the left and right, respectively. - * Non-sticky cells do not need to have a value set since their positions will not be applied. - * @param {?} widths - * @param {?} stickyStates - * @return {?} - */ - StickyStyler.prototype._getStickyEndColumnPositions = /** - * Determines the left and right positions of each sticky column cell, which will be the - * accumulation of all sticky column cell widths to the left and right, respectively. - * Non-sticky cells do not need to have a value set since their positions will not be applied. - * @param {?} widths - * @param {?} stickyStates - * @return {?} - */ - function (widths, stickyStates) { - /** @type {?} */ - var positions = []; - /** @type {?} */ - var nextPosition = 0; - for (var i = widths.length; i > 0; i--) { - if (stickyStates[i]) { - positions[i] = nextPosition; - nextPosition += widths[i]; - } - } - return positions; - }; - return StickyStyler; -}()); - -/** - * @fileoverview added by tsickle - * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc - */ -/** - * Provides a handle for the table to grab the view container's ng-container to insert data rows. - * \@docs-private - */ -var DataRowOutlet = /** @class */ (function () { - function DataRowOutlet(viewContainer, elementRef) { - this.viewContainer = viewContainer; - this.elementRef = elementRef; - } - DataRowOutlet.decorators = [ - { type: _angular_core__WEBPACK_IMPORTED_MODULE_2__["Directive"], args: [{ selector: '[rowOutlet]' },] }, - ]; - /** @nocollapse */ - DataRowOutlet.ctorParameters = function () { return [ - { type: _angular_core__WEBPACK_IMPORTED_MODULE_2__["ViewContainerRef"] }, - { type: _angular_core__WEBPACK_IMPORTED_MODULE_2__["ElementRef"] } - ]; }; - return DataRowOutlet; -}()); -/** - * Provides a handle for the table to grab the view container's ng-container to insert the header. - * \@docs-private - */ -var HeaderRowOutlet = /** @class */ (function () { - function HeaderRowOutlet(viewContainer, elementRef) { - this.viewContainer = viewContainer; - this.elementRef = elementRef; - } - HeaderRowOutlet.decorators = [ - { type: _angular_core__WEBPACK_IMPORTED_MODULE_2__["Directive"], args: [{ selector: '[headerRowOutlet]' },] }, - ]; - /** @nocollapse */ - HeaderRowOutlet.ctorParameters = function () { return [ - { type: _angular_core__WEBPACK_IMPORTED_MODULE_2__["ViewContainerRef"] }, - { type: _angular_core__WEBPACK_IMPORTED_MODULE_2__["ElementRef"] } - ]; }; - return HeaderRowOutlet; -}()); -/** - * Provides a handle for the table to grab the view container's ng-container to insert the footer. - * \@docs-private - */ -var FooterRowOutlet = /** @class */ (function () { - function FooterRowOutlet(viewContainer, elementRef) { - this.viewContainer = viewContainer; - this.elementRef = elementRef; - } - FooterRowOutlet.decorators = [ - { type: _angular_core__WEBPACK_IMPORTED_MODULE_2__["Directive"], args: [{ selector: '[footerRowOutlet]' },] }, - ]; - /** @nocollapse */ - FooterRowOutlet.ctorParameters = function () { return [ - { type: _angular_core__WEBPACK_IMPORTED_MODULE_2__["ViewContainerRef"] }, - { type: _angular_core__WEBPACK_IMPORTED_MODULE_2__["ElementRef"] } - ]; }; - return FooterRowOutlet; -}()); -/** - * The table template that can be used by the mat-table. Should not be used outside of the - * material library. - * \@docs-private - * @type {?} - */ -var CDK_TABLE_TEMPLATE = -// Note that according to MDN, the `caption` element has to be projected as the **first** element -// in the table. See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/caption -"\n \n \n \n \n"; -/** - * Class used to conveniently type the embedded view ref for rows with a context. - * \@docs-private - * @abstract - * @template T - */ -var /** - * Class used to conveniently type the embedded view ref for rows with a context. - * \@docs-private - * @abstract - * @template T - */ -RowViewRef = /** @class */ (function (_super) { - Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(RowViewRef, _super); - function RowViewRef() { - return _super !== null && _super.apply(this, arguments) || this; - } - return RowViewRef; -}(_angular_core__WEBPACK_IMPORTED_MODULE_2__["EmbeddedViewRef"])); -/** - * A data table that can render a header row, data rows, and a footer row. - * Uses the dataSource input to determine the data to be rendered. The data can be provided either - * as a data array, an Observable stream that emits the data array to render, or a DataSource with a - * connect function that will return an Observable stream that emits the data array to render. - * @template T - */ -var CdkTable = /** @class */ (function () { - function CdkTable(_differs, _changeDetectorRef, _elementRef, role, _dir, - /** - * @deprecated - * @breaking-change 8.0.0 `_document` and `_platform` to - * be made into a required parameters. - */ - _document, _platform) { - this._differs = _differs; - this._changeDetectorRef = _changeDetectorRef; - this._elementRef = _elementRef; - this._dir = _dir; - this._platform = _platform; - /** - * Subject that emits when the component has been destroyed. - */ - this._onDestroy = new rxjs__WEBPACK_IMPORTED_MODULE_5__["Subject"](); - /** - * Map of all the user's defined columns (header, data, and footer cell template) identified by - * name. Collection populated by the column definitions gathered by `ContentChildren` as well as - * any custom column definitions added to `_customColumnDefs`. - */ - this._columnDefsByName = new Map(); - /** - * Column definitions that were defined outside of the direct content children of the table. - * These will be defined when, e.g., creating a wrapper around the cdkTable that has - * column definitions as *it's* content child. - */ - this._customColumnDefs = new Set(); - /** - * Data row definitions that were defined outside of the direct content children of the table. - * These will be defined when, e.g., creating a wrapper around the cdkTable that has - * built-in data rows as *it's* content child. - */ - this._customRowDefs = new Set(); - /** - * Header row definitions that were defined outside of the direct content children of the table. - * These will be defined when, e.g., creating a wrapper around the cdkTable that has - * built-in header rows as *it's* content child. - */ - this._customHeaderRowDefs = new Set(); - /** - * Footer row definitions that were defined outside of the direct content children of the table. - * These will be defined when, e.g., creating a wrapper around the cdkTable that has a - * built-in footer row as *it's* content child. - */ - this._customFooterRowDefs = new Set(); - /** - * Whether the header row definition has been changed. Triggers an update to the header row after - * content is checked. Initialized as true so that the table renders the initial set of rows. - */ - this._headerRowDefChanged = true; - /** - * Whether the footer row definition has been changed. Triggers an update to the footer row after - * content is checked. Initialized as true so that the table renders the initial set of rows. - */ - this._footerRowDefChanged = true; - /** - * Cache of the latest rendered `RenderRow` objects as a map for easy retrieval when constructing - * a new list of `RenderRow` objects for rendering rows. Since the new list is constructed with - * the cached `RenderRow` objects when possible, the row identity is preserved when the data - * and row template matches, which allows the `IterableDiffer` to check rows by reference - * and understand which rows are added/moved/removed. - * - * Implemented as a map of maps where the first key is the `data: T` object and the second is the - * `CdkRowDef` object. With the two keys, the cache points to a `RenderRow` object that - * contains an array of created pairs. The array is necessary to handle cases where the data - * array contains multiple duplicate data objects and each instantiated `RenderRow` must be - * stored. - */ - this._cachedRenderRowsMap = new Map(); - /** - * CSS class added to any row or cell that has sticky positioning applied. May be overriden by - * table subclasses. - */ - this.stickyCssClass = 'cdk-table-sticky'; - this._multiTemplateDataRows = false; - // TODO(andrewseguin): Remove max value as the end index - // and instead calculate the view on init and scroll. - /** - * Stream containing the latest information on what rows are being displayed on screen. - * Can be used by the data source to as a heuristic of what data should be provided. - * - * \@docs-private - */ - this.viewChange = new rxjs__WEBPACK_IMPORTED_MODULE_5__["BehaviorSubject"]({ start: 0, end: Number.MAX_VALUE }); - if (!role) { - this._elementRef.nativeElement.setAttribute('role', 'grid'); - } - this._document = _document; - this._isNativeHtmlTable = this._elementRef.nativeElement.nodeName === 'TABLE'; - } - Object.defineProperty(CdkTable.prototype, "trackBy", { - /** - * Tracking function that will be used to check the differences in data changes. Used similarly - * to `ngFor` `trackBy` function. Optimize row operations by identifying a row based on its data - * relative to the function to know if a row should be added/removed/moved. - * Accepts a function that takes two parameters, `index` and `item`. - */ - get: /** - * Tracking function that will be used to check the differences in data changes. Used similarly - * to `ngFor` `trackBy` function. Optimize row operations by identifying a row based on its data - * relative to the function to know if a row should be added/removed/moved. - * Accepts a function that takes two parameters, `index` and `item`. - * @return {?} - */ - function () { return this._trackByFn; }, - set: /** - * @param {?} fn - * @return {?} - */ - function (fn) { - if (Object(_angular_core__WEBPACK_IMPORTED_MODULE_2__["isDevMode"])() && - fn != null && typeof fn !== 'function' && - (/** @type {?} */ (console)) && (/** @type {?} */ (console.warn))) { - console.warn("trackBy must be a function, but received " + JSON.stringify(fn) + "."); - } - this._trackByFn = fn; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(CdkTable.prototype, "dataSource", { - /** - * The table's source of data, which can be provided in three ways (in order of complexity): - * - Simple data array (each object represents one table row) - * - Stream that emits a data array each time the array changes - * - `DataSource` object that implements the connect/disconnect interface. - * - * If a data array is provided, the table must be notified when the array's objects are - * added, removed, or moved. This can be done by calling the `renderRows()` function which will - * render the diff since the last table render. If the data array reference is changed, the table - * will automatically trigger an update to the rows. - * - * When providing an Observable stream, the table will trigger an update automatically when the - * stream emits a new array of data. - * - * Finally, when providing a `DataSource` object, the table will use the Observable stream - * provided by the connect function and trigger updates when that stream emits new data array - * values. During the table's ngOnDestroy or when the data source is removed from the table, the - * table will call the DataSource's `disconnect` function (may be useful for cleaning up any - * subscriptions registered during the connect process). - */ - get: /** - * The table's source of data, which can be provided in three ways (in order of complexity): - * - Simple data array (each object represents one table row) - * - Stream that emits a data array each time the array changes - * - `DataSource` object that implements the connect/disconnect interface. - * - * If a data array is provided, the table must be notified when the array's objects are - * added, removed, or moved. This can be done by calling the `renderRows()` function which will - * render the diff since the last table render. If the data array reference is changed, the table - * will automatically trigger an update to the rows. - * - * When providing an Observable stream, the table will trigger an update automatically when the - * stream emits a new array of data. - * - * Finally, when providing a `DataSource` object, the table will use the Observable stream - * provided by the connect function and trigger updates when that stream emits new data array - * values. During the table's ngOnDestroy or when the data source is removed from the table, the - * table will call the DataSource's `disconnect` function (may be useful for cleaning up any - * subscriptions registered during the connect process). - * @return {?} - */ - function () { return this._dataSource; }, - set: /** - * @param {?} dataSource - * @return {?} - */ - function (dataSource) { - if (this._dataSource !== dataSource) { - this._switchDataSource(dataSource); - } - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(CdkTable.prototype, "multiTemplateDataRows", { - /** - * Whether to allow multiple rows per data object by evaluating which rows evaluate their 'when' - * predicate to true. If `multiTemplateDataRows` is false, which is the default value, then each - * dataobject will render the first row that evaluates its when predicate to true, in the order - * defined in the table, or otherwise the default row which does not have a when predicate. - */ - get: /** - * Whether to allow multiple rows per data object by evaluating which rows evaluate their 'when' - * predicate to true. If `multiTemplateDataRows` is false, which is the default value, then each - * dataobject will render the first row that evaluates its when predicate to true, in the order - * defined in the table, or otherwise the default row which does not have a when predicate. - * @return {?} - */ - function () { return this._multiTemplateDataRows; }, - set: /** - * @param {?} v - * @return {?} - */ - function (v) { - this._multiTemplateDataRows = Object(_angular_cdk_coercion__WEBPACK_IMPORTED_MODULE_1__["coerceBooleanProperty"])(v); - if (this._rowOutlet.viewContainer.length) { - this._forceRenderDataRows(); - } - }, - enumerable: true, - configurable: true - }); - /** - * @return {?} - */ - CdkTable.prototype.ngOnInit = /** - * @return {?} - */ - function () { - var _this = this; - this._setupStickyStyler(); - if (this._isNativeHtmlTable) { - this._applyNativeTableSections(); - } - // Set up the trackBy function so that it uses the `RenderRow` as its identity by default. If - // the user has provided a custom trackBy, return the result of that function as evaluated - // with the values of the `RenderRow`'s data and index. - this._dataDiffer = this._differs.find([]).create(function (_i, dataRow) { - return _this.trackBy ? _this.trackBy(dataRow.dataIndex, dataRow.data) : dataRow; - }); - }; - /** - * @return {?} - */ - CdkTable.prototype.ngAfterContentChecked = /** - * @return {?} - */ - function () { - // Cache the row and column definitions gathered by ContentChildren and programmatic injection. - this._cacheRowDefs(); - this._cacheColumnDefs(); - // Make sure that the user has at least added header, footer, or data row def. - if (!this._headerRowDefs.length && !this._footerRowDefs.length && !this._rowDefs.length) { - throw getTableMissingRowDefsError(); - } - // Render updates if the list of columns have been changed for the header, row, or footer defs. - this._renderUpdatedColumns(); - // If the header row definition has been changed, trigger a render to the header row. - if (this._headerRowDefChanged) { - this._forceRenderHeaderRows(); - this._headerRowDefChanged = false; - } - // If the footer row definition has been changed, trigger a render to the footer row. - if (this._footerRowDefChanged) { - this._forceRenderFooterRows(); - this._footerRowDefChanged = false; - } - // If there is a data source and row definitions, connect to the data source unless a - // connection has already been made. - if (this.dataSource && this._rowDefs.length > 0 && !this._renderChangeSubscription) { - this._observeRenderChanges(); - } - this._checkStickyStates(); - }; - /** - * @return {?} - */ - CdkTable.prototype.ngOnDestroy = /** - * @return {?} - */ - function () { - this._rowOutlet.viewContainer.clear(); - this._headerRowOutlet.viewContainer.clear(); - this._footerRowOutlet.viewContainer.clear(); - this._cachedRenderRowsMap.clear(); - this._onDestroy.next(); - this._onDestroy.complete(); - if (Object(_angular_cdk_collections__WEBPACK_IMPORTED_MODULE_3__["isDataSource"])(this.dataSource)) { - this.dataSource.disconnect(this); - } - }; - /** - * Renders rows based on the table's latest set of data, which was either provided directly as an - * input or retrieved through an Observable stream (directly or from a DataSource). - * Checks for differences in the data since the last diff to perform only the necessary - * changes (add/remove/move rows). - * - * If the table's data source is a DataSource or Observable, this will be invoked automatically - * each time the provided Observable stream emits a new data array. Otherwise if your data is - * an array, this function will need to be called to render any changes. - */ - /** - * Renders rows based on the table's latest set of data, which was either provided directly as an - * input or retrieved through an Observable stream (directly or from a DataSource). - * Checks for differences in the data since the last diff to perform only the necessary - * changes (add/remove/move rows). - * - * If the table's data source is a DataSource or Observable, this will be invoked automatically - * each time the provided Observable stream emits a new data array. Otherwise if your data is - * an array, this function will need to be called to render any changes. - * @return {?} - */ - CdkTable.prototype.renderRows = /** - * Renders rows based on the table's latest set of data, which was either provided directly as an - * input or retrieved through an Observable stream (directly or from a DataSource). - * Checks for differences in the data since the last diff to perform only the necessary - * changes (add/remove/move rows). - * - * If the table's data source is a DataSource or Observable, this will be invoked automatically - * each time the provided Observable stream emits a new data array. Otherwise if your data is - * an array, this function will need to be called to render any changes. - * @return {?} - */ - function () { - var _this = this; - this._renderRows = this._getAllRenderRows(); - /** @type {?} */ - var changes = this._dataDiffer.diff(this._renderRows); - if (!changes) { - return; - } - /** @type {?} */ - var viewContainer = this._rowOutlet.viewContainer; - changes.forEachOperation(function (record, prevIndex, currentIndex) { - if (record.previousIndex == null) { - _this._insertRow(record.item, (/** @type {?} */ (currentIndex))); - } - else if (currentIndex == null) { - viewContainer.remove((/** @type {?} */ (prevIndex))); - } - else { - /** @type {?} */ - var view = (/** @type {?} */ (viewContainer.get((/** @type {?} */ (prevIndex))))); - viewContainer.move((/** @type {?} */ (view)), currentIndex); - } - }); - // Update the meta context of a row's context data (index, count, first, last, ...) - this._updateRowIndexContext(); - // Update rows that did not get added/removed/moved but may have had their identity changed, - // e.g. if trackBy matched data on some property but the actual data reference changed. - changes.forEachIdentityChange(function (record) { - /** @type {?} */ - var rowView = (/** @type {?} */ (viewContainer.get((/** @type {?} */ (record.currentIndex))))); - rowView.context.$implicit = record.item.data; - }); - this.updateStickyColumnStyles(); - }; - /** - * Sets the header row definition to be used. Overrides the header row definition gathered by - * using `ContentChild`, if one exists. Sets a flag that will re-render the header row after the - * table's content is checked. - * @docs-private - * @deprecated Use `addHeaderRowDef` and `removeHeaderRowDef` instead - * @breaking-change 8.0.0 - */ - /** - * Sets the header row definition to be used. Overrides the header row definition gathered by - * using `ContentChild`, if one exists. Sets a flag that will re-render the header row after the - * table's content is checked. - * \@docs-private - * @deprecated Use `addHeaderRowDef` and `removeHeaderRowDef` instead - * \@breaking-change 8.0.0 - * @param {?} headerRowDef - * @return {?} - */ - CdkTable.prototype.setHeaderRowDef = /** - * Sets the header row definition to be used. Overrides the header row definition gathered by - * using `ContentChild`, if one exists. Sets a flag that will re-render the header row after the - * table's content is checked. - * \@docs-private - * @deprecated Use `addHeaderRowDef` and `removeHeaderRowDef` instead - * \@breaking-change 8.0.0 - * @param {?} headerRowDef - * @return {?} - */ - function (headerRowDef) { - this._customHeaderRowDefs = new Set([headerRowDef]); - this._headerRowDefChanged = true; - }; - /** - * Sets the footer row definition to be used. Overrides the footer row definition gathered by - * using `ContentChild`, if one exists. Sets a flag that will re-render the footer row after the - * table's content is checked. - * @docs-private - * @deprecated Use `addFooterRowDef` and `removeFooterRowDef` instead - * @breaking-change 8.0.0 - */ - /** - * Sets the footer row definition to be used. Overrides the footer row definition gathered by - * using `ContentChild`, if one exists. Sets a flag that will re-render the footer row after the - * table's content is checked. - * \@docs-private - * @deprecated Use `addFooterRowDef` and `removeFooterRowDef` instead - * \@breaking-change 8.0.0 - * @param {?} footerRowDef - * @return {?} - */ - CdkTable.prototype.setFooterRowDef = /** - * Sets the footer row definition to be used. Overrides the footer row definition gathered by - * using `ContentChild`, if one exists. Sets a flag that will re-render the footer row after the - * table's content is checked. - * \@docs-private - * @deprecated Use `addFooterRowDef` and `removeFooterRowDef` instead - * \@breaking-change 8.0.0 - * @param {?} footerRowDef - * @return {?} - */ - function (footerRowDef) { - this._customFooterRowDefs = new Set([footerRowDef]); - this._footerRowDefChanged = true; - }; - /** Adds a column definition that was not included as part of the content children. */ - /** - * Adds a column definition that was not included as part of the content children. - * @param {?} columnDef - * @return {?} - */ - CdkTable.prototype.addColumnDef = /** - * Adds a column definition that was not included as part of the content children. - * @param {?} columnDef - * @return {?} - */ - function (columnDef) { - this._customColumnDefs.add(columnDef); - }; - /** Removes a column definition that was not included as part of the content children. */ - /** - * Removes a column definition that was not included as part of the content children. - * @param {?} columnDef - * @return {?} - */ - CdkTable.prototype.removeColumnDef = /** - * Removes a column definition that was not included as part of the content children. - * @param {?} columnDef - * @return {?} - */ - function (columnDef) { - this._customColumnDefs.delete(columnDef); - }; - /** Adds a row definition that was not included as part of the content children. */ - /** - * Adds a row definition that was not included as part of the content children. - * @param {?} rowDef - * @return {?} - */ - CdkTable.prototype.addRowDef = /** - * Adds a row definition that was not included as part of the content children. - * @param {?} rowDef - * @return {?} - */ - function (rowDef) { - this._customRowDefs.add(rowDef); - }; - /** Removes a row definition that was not included as part of the content children. */ - /** - * Removes a row definition that was not included as part of the content children. - * @param {?} rowDef - * @return {?} - */ - CdkTable.prototype.removeRowDef = /** - * Removes a row definition that was not included as part of the content children. - * @param {?} rowDef - * @return {?} - */ - function (rowDef) { - this._customRowDefs.delete(rowDef); - }; - /** Adds a header row definition that was not included as part of the content children. */ - /** - * Adds a header row definition that was not included as part of the content children. - * @param {?} headerRowDef - * @return {?} - */ - CdkTable.prototype.addHeaderRowDef = /** - * Adds a header row definition that was not included as part of the content children. - * @param {?} headerRowDef - * @return {?} - */ - function (headerRowDef) { - this._customHeaderRowDefs.add(headerRowDef); - this._headerRowDefChanged = true; - }; - /** Removes a header row definition that was not included as part of the content children. */ - /** - * Removes a header row definition that was not included as part of the content children. - * @param {?} headerRowDef - * @return {?} - */ - CdkTable.prototype.removeHeaderRowDef = /** - * Removes a header row definition that was not included as part of the content children. - * @param {?} headerRowDef - * @return {?} - */ - function (headerRowDef) { - this._customHeaderRowDefs.delete(headerRowDef); - this._headerRowDefChanged = true; - }; - /** Adds a footer row definition that was not included as part of the content children. */ - /** - * Adds a footer row definition that was not included as part of the content children. - * @param {?} footerRowDef - * @return {?} - */ - CdkTable.prototype.addFooterRowDef = /** - * Adds a footer row definition that was not included as part of the content children. - * @param {?} footerRowDef - * @return {?} - */ - function (footerRowDef) { - this._customFooterRowDefs.add(footerRowDef); - this._footerRowDefChanged = true; - }; - /** Removes a footer row definition that was not included as part of the content children. */ - /** - * Removes a footer row definition that was not included as part of the content children. - * @param {?} footerRowDef - * @return {?} - */ - CdkTable.prototype.removeFooterRowDef = /** - * Removes a footer row definition that was not included as part of the content children. - * @param {?} footerRowDef - * @return {?} - */ - function (footerRowDef) { - this._customFooterRowDefs.delete(footerRowDef); - this._footerRowDefChanged = true; - }; - /** - * Updates the header sticky styles. First resets all applied styles with respect to the cells - * sticking to the top. Then, evaluating which cells need to be stuck to the top. This is - * automatically called when the header row changes its displayed set of columns, or if its - * sticky input changes. May be called manually for cases where the cell content changes outside - * of these events. - */ - /** - * Updates the header sticky styles. First resets all applied styles with respect to the cells - * sticking to the top. Then, evaluating which cells need to be stuck to the top. This is - * automatically called when the header row changes its displayed set of columns, or if its - * sticky input changes. May be called manually for cases where the cell content changes outside - * of these events. - * @return {?} - */ - CdkTable.prototype.updateStickyHeaderRowStyles = /** - * Updates the header sticky styles. First resets all applied styles with respect to the cells - * sticking to the top. Then, evaluating which cells need to be stuck to the top. This is - * automatically called when the header row changes its displayed set of columns, or if its - * sticky input changes. May be called manually for cases where the cell content changes outside - * of these events. - * @return {?} - */ - function () { - /** @type {?} */ - var headerRows = this._getRenderedRows(this._headerRowOutlet); - /** @type {?} */ - var tableElement = (/** @type {?} */ (this._elementRef.nativeElement)); - // Hide the thead element if there are no header rows. This is necessary to satisfy - // overzealous a11y checkers that fail because the `rowgroup` element does not contain - // required child `row`. - /** @type {?} */ - var thead = tableElement.querySelector('thead'); - if (thead) { - thead.style.display = headerRows.length ? '' : 'none'; - } - /** @type {?} */ - var stickyStates = this._headerRowDefs.map(function (def) { return def.sticky; }); - this._stickyStyler.clearStickyPositioning(headerRows, ['top']); - this._stickyStyler.stickRows(headerRows, stickyStates, 'top'); - // Reset the dirty state of the sticky input change since it has been used. - this._headerRowDefs.forEach(function (def) { return def.resetStickyChanged(); }); - }; - /** - * Updates the footer sticky styles. First resets all applied styles with respect to the cells - * sticking to the bottom. Then, evaluating which cells need to be stuck to the bottom. This is - * automatically called when the footer row changes its displayed set of columns, or if its - * sticky input changes. May be called manually for cases where the cell content changes outside - * of these events. - */ - /** - * Updates the footer sticky styles. First resets all applied styles with respect to the cells - * sticking to the bottom. Then, evaluating which cells need to be stuck to the bottom. This is - * automatically called when the footer row changes its displayed set of columns, or if its - * sticky input changes. May be called manually for cases where the cell content changes outside - * of these events. - * @return {?} - */ - CdkTable.prototype.updateStickyFooterRowStyles = /** - * Updates the footer sticky styles. First resets all applied styles with respect to the cells - * sticking to the bottom. Then, evaluating which cells need to be stuck to the bottom. This is - * automatically called when the footer row changes its displayed set of columns, or if its - * sticky input changes. May be called manually for cases where the cell content changes outside - * of these events. - * @return {?} - */ - function () { - /** @type {?} */ - var footerRows = this._getRenderedRows(this._footerRowOutlet); - /** @type {?} */ - var tableElement = (/** @type {?} */ (this._elementRef.nativeElement)); - // Hide the tfoot element if there are no footer rows. This is necessary to satisfy - // overzealous a11y checkers that fail because the `rowgroup` element does not contain - // required child `row`. - /** @type {?} */ - var tfoot = tableElement.querySelector('tfoot'); - if (tfoot) { - tfoot.style.display = footerRows.length ? '' : 'none'; - } - /** @type {?} */ - var stickyStates = this._footerRowDefs.map(function (def) { return def.sticky; }); - this._stickyStyler.clearStickyPositioning(footerRows, ['bottom']); - this._stickyStyler.stickRows(footerRows, stickyStates, 'bottom'); - this._stickyStyler.updateStickyFooterContainer(this._elementRef.nativeElement, stickyStates); - // Reset the dirty state of the sticky input change since it has been used. - this._footerRowDefs.forEach(function (def) { return def.resetStickyChanged(); }); - }; - /** - * Updates the column sticky styles. First resets all applied styles with respect to the cells - * sticking to the left and right. Then sticky styles are added for the left and right according - * to the column definitions for each cell in each row. This is automatically called when - * the data source provides a new set of data or when a column definition changes its sticky - * input. May be called manually for cases where the cell content changes outside of these events. - */ - /** - * Updates the column sticky styles. First resets all applied styles with respect to the cells - * sticking to the left and right. Then sticky styles are added for the left and right according - * to the column definitions for each cell in each row. This is automatically called when - * the data source provides a new set of data or when a column definition changes its sticky - * input. May be called manually for cases where the cell content changes outside of these events. - * @return {?} - */ - CdkTable.prototype.updateStickyColumnStyles = /** - * Updates the column sticky styles. First resets all applied styles with respect to the cells - * sticking to the left and right. Then sticky styles are added for the left and right according - * to the column definitions for each cell in each row. This is automatically called when - * the data source provides a new set of data or when a column definition changes its sticky - * input. May be called manually for cases where the cell content changes outside of these events. - * @return {?} - */ - function () { - var _this = this; - /** @type {?} */ - var headerRows = this._getRenderedRows(this._headerRowOutlet); - /** @type {?} */ - var dataRows = this._getRenderedRows(this._rowOutlet); - /** @type {?} */ - var footerRows = this._getRenderedRows(this._footerRowOutlet); - // Clear the left and right positioning from all columns in the table across all rows since - // sticky columns span across all table sections (header, data, footer) - this._stickyStyler.clearStickyPositioning(headerRows.concat(dataRows, footerRows), ['left', 'right']); - // Update the sticky styles for each header row depending on the def's sticky state - headerRows.forEach(function (headerRow, i) { - _this._addStickyColumnStyles([headerRow], _this._headerRowDefs[i]); - }); - // Update the sticky styles for each data row depending on its def's sticky state - this._rowDefs.forEach(function (rowDef) { - // Collect all the rows rendered with this row definition. - /** @type {?} */ - var rows = []; - for (var i = 0; i < dataRows.length; i++) { - if (_this._renderRows[i].rowDef === rowDef) { - rows.push(dataRows[i]); - } - } - _this._addStickyColumnStyles(rows, rowDef); - }); - // Update the sticky styles for each footer row depending on the def's sticky state - footerRows.forEach(function (footerRow, i) { - _this._addStickyColumnStyles([footerRow], _this._footerRowDefs[i]); - }); - // Reset the dirty state of the sticky input change since it has been used. - Array.from(this._columnDefsByName.values()).forEach(function (def) { return def.resetStickyChanged(); }); - }; - /** - * Get the list of RenderRow objects to render according to the current list of data and defined - * row definitions. If the previous list already contained a particular pair, it should be reused - * so that the differ equates their references. - */ - /** - * Get the list of RenderRow objects to render according to the current list of data and defined - * row definitions. If the previous list already contained a particular pair, it should be reused - * so that the differ equates their references. - * @private - * @return {?} - */ - CdkTable.prototype._getAllRenderRows = /** - * Get the list of RenderRow objects to render according to the current list of data and defined - * row definitions. If the previous list already contained a particular pair, it should be reused - * so that the differ equates their references. - * @private - * @return {?} - */ - function () { - /** @type {?} */ - var renderRows = []; - // Store the cache and create a new one. Any re-used RenderRow objects will be moved into the - // new cache while unused ones can be picked up by garbage collection. - /** @type {?} */ - var prevCachedRenderRows = this._cachedRenderRowsMap; - this._cachedRenderRowsMap = new Map(); - // For each data object, get the list of rows that should be rendered, represented by the - // respective `RenderRow` object which is the pair of `data` and `CdkRowDef`. - for (var i = 0; i < this._data.length; i++) { - /** @type {?} */ - var data = this._data[i]; - /** @type {?} */ - var renderRowsForData = this._getRenderRowsForData(data, i, prevCachedRenderRows.get(data)); - if (!this._cachedRenderRowsMap.has(data)) { - this._cachedRenderRowsMap.set(data, new WeakMap()); - } - for (var j = 0; j < renderRowsForData.length; j++) { - /** @type {?} */ - var renderRow = renderRowsForData[j]; - /** @type {?} */ - var cache = (/** @type {?} */ (this._cachedRenderRowsMap.get(renderRow.data))); - if (cache.has(renderRow.rowDef)) { - (/** @type {?} */ (cache.get(renderRow.rowDef))).push(renderRow); - } - else { - cache.set(renderRow.rowDef, [renderRow]); - } - renderRows.push(renderRow); - } - } - return renderRows; - }; - /** - * Gets a list of `RenderRow` for the provided data object and any `CdkRowDef` objects that - * should be rendered for this data. Reuses the cached RenderRow objects if they match the same - * `(T, CdkRowDef)` pair. - */ - /** - * Gets a list of `RenderRow` for the provided data object and any `CdkRowDef` objects that - * should be rendered for this data. Reuses the cached RenderRow objects if they match the same - * `(T, CdkRowDef)` pair. - * @private - * @param {?} data - * @param {?} dataIndex - * @param {?=} cache - * @return {?} - */ - CdkTable.prototype._getRenderRowsForData = /** - * Gets a list of `RenderRow` for the provided data object and any `CdkRowDef` objects that - * should be rendered for this data. Reuses the cached RenderRow objects if they match the same - * `(T, CdkRowDef)` pair. - * @private - * @param {?} data - * @param {?} dataIndex - * @param {?=} cache - * @return {?} - */ - function (data, dataIndex, cache) { - /** @type {?} */ - var rowDefs = this._getRowDefs(data, dataIndex); - return rowDefs.map(function (rowDef) { - /** @type {?} */ - var cachedRenderRows = (cache && cache.has(rowDef)) ? (/** @type {?} */ (cache.get(rowDef))) : []; - if (cachedRenderRows.length) { - /** @type {?} */ - var dataRow = (/** @type {?} */ (cachedRenderRows.shift())); - dataRow.dataIndex = dataIndex; - return dataRow; - } - else { - return { data: data, rowDef: rowDef, dataIndex: dataIndex }; - } - }); - }; - /** Update the map containing the content's column definitions. */ - /** - * Update the map containing the content's column definitions. - * @private - * @return {?} - */ - CdkTable.prototype._cacheColumnDefs = /** - * Update the map containing the content's column definitions. - * @private - * @return {?} - */ - function () { - var _this = this; - this._columnDefsByName.clear(); - /** @type {?} */ - var columnDefs = mergeQueryListAndSet(this._contentColumnDefs, this._customColumnDefs); - columnDefs.forEach(function (columnDef) { - if (_this._columnDefsByName.has(columnDef.name)) { - throw getTableDuplicateColumnNameError(columnDef.name); - } - _this._columnDefsByName.set(columnDef.name, columnDef); - }); - }; - /** Update the list of all available row definitions that can be used. */ - /** - * Update the list of all available row definitions that can be used. - * @private - * @return {?} - */ - CdkTable.prototype._cacheRowDefs = /** - * Update the list of all available row definitions that can be used. - * @private - * @return {?} - */ - function () { - this._headerRowDefs = - mergeQueryListAndSet(this._contentHeaderRowDefs, this._customHeaderRowDefs); - this._footerRowDefs = - mergeQueryListAndSet(this._contentFooterRowDefs, this._customFooterRowDefs); - this._rowDefs = - mergeQueryListAndSet(this._contentRowDefs, this._customRowDefs); - // After all row definitions are determined, find the row definition to be considered default. - /** @type {?} */ - var defaultRowDefs = this._rowDefs.filter(function (def) { return !def.when; }); - if (!this.multiTemplateDataRows && defaultRowDefs.length > 1) { - throw getTableMultipleDefaultRowDefsError(); - } - this._defaultRowDef = defaultRowDefs[0]; - }; - /** - * Check if the header, data, or footer rows have changed what columns they want to display or - * whether the sticky states have changed for the header or footer. If there is a diff, then - * re-render that section. - */ - /** - * Check if the header, data, or footer rows have changed what columns they want to display or - * whether the sticky states have changed for the header or footer. If there is a diff, then - * re-render that section. - * @private - * @return {?} - */ - CdkTable.prototype._renderUpdatedColumns = /** - * Check if the header, data, or footer rows have changed what columns they want to display or - * whether the sticky states have changed for the header or footer. If there is a diff, then - * re-render that section. - * @private - * @return {?} - */ - function () { - /** @type {?} */ - var columnsDiffReducer = function (acc, def) { return acc || !!def.getColumnsDiff(); }; - // Force re-render data rows if the list of column definitions have changed. - if (this._rowDefs.reduce(columnsDiffReducer, false)) { - this._forceRenderDataRows(); - } - // Force re-render header/footer rows if the list of column definitions have changed.. - if (this._headerRowDefs.reduce(columnsDiffReducer, false)) { - this._forceRenderHeaderRows(); - } - if (this._footerRowDefs.reduce(columnsDiffReducer, false)) { - this._forceRenderFooterRows(); - } - }; - /** - * Switch to the provided data source by resetting the data and unsubscribing from the current - * render change subscription if one exists. If the data source is null, interpret this by - * clearing the row outlet. Otherwise start listening for new data. - */ - /** - * Switch to the provided data source by resetting the data and unsubscribing from the current - * render change subscription if one exists. If the data source is null, interpret this by - * clearing the row outlet. Otherwise start listening for new data. - * @private - * @param {?} dataSource - * @return {?} - */ - CdkTable.prototype._switchDataSource = /** - * Switch to the provided data source by resetting the data and unsubscribing from the current - * render change subscription if one exists. If the data source is null, interpret this by - * clearing the row outlet. Otherwise start listening for new data. - * @private - * @param {?} dataSource - * @return {?} - */ - function (dataSource) { - this._data = []; - if (Object(_angular_cdk_collections__WEBPACK_IMPORTED_MODULE_3__["isDataSource"])(this.dataSource)) { - this.dataSource.disconnect(this); - } - // Stop listening for data from the previous data source. - if (this._renderChangeSubscription) { - this._renderChangeSubscription.unsubscribe(); - this._renderChangeSubscription = null; - } - if (!dataSource) { - if (this._dataDiffer) { - this._dataDiffer.diff([]); - } - this._rowOutlet.viewContainer.clear(); - } - this._dataSource = dataSource; - }; - /** Set up a subscription for the data provided by the data source. */ - /** - * Set up a subscription for the data provided by the data source. - * @private - * @return {?} - */ - CdkTable.prototype._observeRenderChanges = /** - * Set up a subscription for the data provided by the data source. - * @private - * @return {?} - */ - function () { - var _this = this; - // If no data source has been set, there is nothing to observe for changes. - if (!this.dataSource) { - return; - } - /** @type {?} */ - var dataStream; - if (Object(_angular_cdk_collections__WEBPACK_IMPORTED_MODULE_3__["isDataSource"])(this.dataSource)) { - dataStream = this.dataSource.connect(this); - } - else if (this.dataSource instanceof rxjs__WEBPACK_IMPORTED_MODULE_5__["Observable"]) { - dataStream = this.dataSource; - } - else if (Array.isArray(this.dataSource)) { - dataStream = Object(rxjs__WEBPACK_IMPORTED_MODULE_5__["of"])(this.dataSource); - } - if (dataStream === undefined) { - throw getTableUnknownDataSourceError(); - } - this._renderChangeSubscription = dataStream - .pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_6__["takeUntil"])(this._onDestroy)) - .subscribe(function (data) { - _this._data = data || []; - _this.renderRows(); - }); - }; - /** - * Clears any existing content in the header row outlet and creates a new embedded view - * in the outlet using the header row definition. - */ - /** - * Clears any existing content in the header row outlet and creates a new embedded view - * in the outlet using the header row definition. - * @private - * @return {?} - */ - CdkTable.prototype._forceRenderHeaderRows = /** - * Clears any existing content in the header row outlet and creates a new embedded view - * in the outlet using the header row definition. - * @private - * @return {?} - */ - function () { - var _this = this; - // Clear the header row outlet if any content exists. - if (this._headerRowOutlet.viewContainer.length > 0) { - this._headerRowOutlet.viewContainer.clear(); - } - this._headerRowDefs.forEach(function (def, i) { return _this._renderRow(_this._headerRowOutlet, def, i); }); - this.updateStickyHeaderRowStyles(); - this.updateStickyColumnStyles(); - }; - /** - * Clears any existing content in the footer row outlet and creates a new embedded view - * in the outlet using the footer row definition. - */ - /** - * Clears any existing content in the footer row outlet and creates a new embedded view - * in the outlet using the footer row definition. - * @private - * @return {?} - */ - CdkTable.prototype._forceRenderFooterRows = /** - * Clears any existing content in the footer row outlet and creates a new embedded view - * in the outlet using the footer row definition. - * @private - * @return {?} - */ - function () { - var _this = this; - // Clear the footer row outlet if any content exists. - if (this._footerRowOutlet.viewContainer.length > 0) { - this._footerRowOutlet.viewContainer.clear(); - } - this._footerRowDefs.forEach(function (def, i) { return _this._renderRow(_this._footerRowOutlet, def, i); }); - this.updateStickyFooterRowStyles(); - this.updateStickyColumnStyles(); - }; - /** Adds the sticky column styles for the rows according to the columns' stick states. */ - /** - * Adds the sticky column styles for the rows according to the columns' stick states. - * @private - * @param {?} rows - * @param {?} rowDef - * @return {?} - */ - CdkTable.prototype._addStickyColumnStyles = /** - * Adds the sticky column styles for the rows according to the columns' stick states. - * @private - * @param {?} rows - * @param {?} rowDef - * @return {?} - */ - function (rows, rowDef) { - var _this = this; - /** @type {?} */ - var columnDefs = Array.from(rowDef.columns || []).map(function (columnName) { - /** @type {?} */ - var columnDef = _this._columnDefsByName.get(columnName); - if (!columnDef) { - throw getTableUnknownColumnError(columnName); - } - return (/** @type {?} */ (columnDef)); - }); - /** @type {?} */ - var stickyStartStates = columnDefs.map(function (columnDef) { return columnDef.sticky; }); - /** @type {?} */ - var stickyEndStates = columnDefs.map(function (columnDef) { return columnDef.stickyEnd; }); - this._stickyStyler.updateStickyColumns(rows, stickyStartStates, stickyEndStates); - }; - /** Gets the list of rows that have been rendered in the row outlet. */ - /** - * Gets the list of rows that have been rendered in the row outlet. - * @param {?} rowOutlet - * @return {?} - */ - CdkTable.prototype._getRenderedRows = /** - * Gets the list of rows that have been rendered in the row outlet. - * @param {?} rowOutlet - * @return {?} - */ - function (rowOutlet) { - /** @type {?} */ - var renderedRows = []; - for (var i = 0; i < rowOutlet.viewContainer.length; i++) { - /** @type {?} */ - var viewRef = ((/** @type {?} */ ((/** @type {?} */ (rowOutlet.viewContainer.get(i)))))); - renderedRows.push(viewRef.rootNodes[0]); - } - return renderedRows; - }; - /** - * Get the matching row definitions that should be used for this row data. If there is only - * one row definition, it is returned. Otherwise, find the row definitions that has a when - * predicate that returns true with the data. If none return true, return the default row - * definition. - */ - /** - * Get the matching row definitions that should be used for this row data. If there is only - * one row definition, it is returned. Otherwise, find the row definitions that has a when - * predicate that returns true with the data. If none return true, return the default row - * definition. - * @param {?} data - * @param {?} dataIndex - * @return {?} - */ - CdkTable.prototype._getRowDefs = /** - * Get the matching row definitions that should be used for this row data. If there is only - * one row definition, it is returned. Otherwise, find the row definitions that has a when - * predicate that returns true with the data. If none return true, return the default row - * definition. - * @param {?} data - * @param {?} dataIndex - * @return {?} - */ - function (data, dataIndex) { - if (this._rowDefs.length == 1) { - return [this._rowDefs[0]]; - } - /** @type {?} */ - var rowDefs = []; - if (this.multiTemplateDataRows) { - rowDefs = this._rowDefs.filter(function (def) { return !def.when || def.when(dataIndex, data); }); - } - else { - /** @type {?} */ - var rowDef = this._rowDefs.find(function (def) { return def.when && def.when(dataIndex, data); }) || this._defaultRowDef; - if (rowDef) { - rowDefs.push(rowDef); - } - } - if (!rowDefs.length) { - throw getTableMissingMatchingRowDefError(data); - } - return rowDefs; - }; - /** - * Create the embedded view for the data row template and place it in the correct index location - * within the data row view container. - */ - /** - * Create the embedded view for the data row template and place it in the correct index location - * within the data row view container. - * @private - * @param {?} renderRow - * @param {?} renderIndex - * @return {?} - */ - CdkTable.prototype._insertRow = /** - * Create the embedded view for the data row template and place it in the correct index location - * within the data row view container. - * @private - * @param {?} renderRow - * @param {?} renderIndex - * @return {?} - */ - function (renderRow, renderIndex) { - /** @type {?} */ - var rowDef = renderRow.rowDef; - /** @type {?} */ - var context = { $implicit: renderRow.data }; - this._renderRow(this._rowOutlet, rowDef, renderIndex, context); - }; - /** - * Creates a new row template in the outlet and fills it with the set of cell templates. - * Optionally takes a context to provide to the row and cells, as well as an optional index - * of where to place the new row template in the outlet. - */ - /** - * Creates a new row template in the outlet and fills it with the set of cell templates. - * Optionally takes a context to provide to the row and cells, as well as an optional index - * of where to place the new row template in the outlet. - * @private - * @param {?} outlet - * @param {?} rowDef - * @param {?} index - * @param {?=} context - * @return {?} - */ - CdkTable.prototype._renderRow = /** - * Creates a new row template in the outlet and fills it with the set of cell templates. - * Optionally takes a context to provide to the row and cells, as well as an optional index - * of where to place the new row template in the outlet. - * @private - * @param {?} outlet - * @param {?} rowDef - * @param {?} index - * @param {?=} context - * @return {?} - */ - function (outlet, rowDef, index, context) { - if (context === void 0) { context = {}; } - // TODO(andrewseguin): enforce that one outlet was instantiated from createEmbeddedView - outlet.viewContainer.createEmbeddedView(rowDef.template, context, index); - for (var _a = 0, _b = this._getCellTemplates(rowDef); _a < _b.length; _a++) { - var cellTemplate = _b[_a]; - if (CdkCellOutlet.mostRecentCellOutlet) { - CdkCellOutlet.mostRecentCellOutlet._viewContainer.createEmbeddedView(cellTemplate, context); - } - } - this._changeDetectorRef.markForCheck(); - }; - /** - * Updates the index-related context for each row to reflect any changes in the index of the rows, - * e.g. first/last/even/odd. - */ - /** - * Updates the index-related context for each row to reflect any changes in the index of the rows, - * e.g. first/last/even/odd. - * @private - * @return {?} - */ - CdkTable.prototype._updateRowIndexContext = /** - * Updates the index-related context for each row to reflect any changes in the index of the rows, - * e.g. first/last/even/odd. - * @private - * @return {?} - */ - function () { - /** @type {?} */ - var viewContainer = this._rowOutlet.viewContainer; - for (var renderIndex = 0, count = viewContainer.length; renderIndex < count; renderIndex++) { - /** @type {?} */ - var viewRef = (/** @type {?} */ (viewContainer.get(renderIndex))); - /** @type {?} */ - var context = (/** @type {?} */ (viewRef.context)); - context.count = count; - context.first = renderIndex === 0; - context.last = renderIndex === count - 1; - context.even = renderIndex % 2 === 0; - context.odd = !context.even; - if (this.multiTemplateDataRows) { - context.dataIndex = this._renderRows[renderIndex].dataIndex; - context.renderIndex = renderIndex; - } - else { - context.index = this._renderRows[renderIndex].dataIndex; - } - } - }; - /** Gets the column definitions for the provided row def. */ - /** - * Gets the column definitions for the provided row def. - * @private - * @param {?} rowDef - * @return {?} - */ - CdkTable.prototype._getCellTemplates = /** - * Gets the column definitions for the provided row def. - * @private - * @param {?} rowDef - * @return {?} - */ - function (rowDef) { - var _this = this; - if (!rowDef || !rowDef.columns) { - return []; - } - return Array.from(rowDef.columns, function (columnId) { - /** @type {?} */ - var column = _this._columnDefsByName.get(columnId); - if (!column) { - throw getTableUnknownColumnError(columnId); - } - return rowDef.extractCellTemplate(column); - }); - }; - /** Adds native table sections (e.g. tbody) and moves the row outlets into them. */ - /** - * Adds native table sections (e.g. tbody) and moves the row outlets into them. - * @private - * @return {?} - */ - CdkTable.prototype._applyNativeTableSections = /** - * Adds native table sections (e.g. tbody) and moves the row outlets into them. - * @private - * @return {?} - */ - function () { - // @breaking-change 8.0.0 remove the `|| document` once the `_document` is a required param. - /** @type {?} */ - var documentRef = this._document || document; - /** @type {?} */ - var documentFragment = documentRef.createDocumentFragment(); - /** @type {?} */ - var sections = [ - { tag: 'thead', outlet: this._headerRowOutlet }, - { tag: 'tbody', outlet: this._rowOutlet }, - { tag: 'tfoot', outlet: this._footerRowOutlet }, - ]; - for (var _a = 0, sections_1 = sections; _a < sections_1.length; _a++) { - var section = sections_1[_a]; - /** @type {?} */ - var element = documentRef.createElement(section.tag); - element.setAttribute('role', 'rowgroup'); - element.appendChild(section.outlet.elementRef.nativeElement); - documentFragment.appendChild(element); - } - // Use a DocumentFragment so we don't hit the DOM on each iteration. - this._elementRef.nativeElement.appendChild(documentFragment); - }; - /** - * Forces a re-render of the data rows. Should be called in cases where there has been an input - * change that affects the evaluation of which rows should be rendered, e.g. toggling - * `multiTemplateDataRows` or adding/removing row definitions. - */ - /** - * Forces a re-render of the data rows. Should be called in cases where there has been an input - * change that affects the evaluation of which rows should be rendered, e.g. toggling - * `multiTemplateDataRows` or adding/removing row definitions. - * @private - * @return {?} - */ - CdkTable.prototype._forceRenderDataRows = /** - * Forces a re-render of the data rows. Should be called in cases where there has been an input - * change that affects the evaluation of which rows should be rendered, e.g. toggling - * `multiTemplateDataRows` or adding/removing row definitions. - * @private - * @return {?} - */ - function () { - this._dataDiffer.diff([]); - this._rowOutlet.viewContainer.clear(); - this.renderRows(); - this.updateStickyColumnStyles(); - }; - /** - * Checks if there has been a change in sticky states since last check and applies the correct - * sticky styles. Since checking resets the "dirty" state, this should only be performed once - * during a change detection and after the inputs are settled (after content check). - */ - /** - * Checks if there has been a change in sticky states since last check and applies the correct - * sticky styles. Since checking resets the "dirty" state, this should only be performed once - * during a change detection and after the inputs are settled (after content check). - * @private - * @return {?} - */ - CdkTable.prototype._checkStickyStates = /** - * Checks if there has been a change in sticky states since last check and applies the correct - * sticky styles. Since checking resets the "dirty" state, this should only be performed once - * during a change detection and after the inputs are settled (after content check). - * @private - * @return {?} - */ - function () { - /** @type {?} */ - var stickyCheckReducer = function (acc, d) { - return acc || d.hasStickyChanged(); - }; - // Note that the check needs to occur for every definition since it notifies the definition - // that it can reset its dirty state. Using another operator like `some` may short-circuit - // remaining definitions and leave them in an unchecked state. - if (this._headerRowDefs.reduce(stickyCheckReducer, false)) { - this.updateStickyHeaderRowStyles(); - } - if (this._footerRowDefs.reduce(stickyCheckReducer, false)) { - this.updateStickyFooterRowStyles(); - } - if (Array.from(this._columnDefsByName.values()).reduce(stickyCheckReducer, false)) { - this.updateStickyColumnStyles(); - } - }; - /** - * Creates the sticky styler that will be used for sticky rows and columns. Listens - * for directionality changes and provides the latest direction to the styler. Re-applies column - * stickiness when directionality changes. - */ - /** - * Creates the sticky styler that will be used for sticky rows and columns. Listens - * for directionality changes and provides the latest direction to the styler. Re-applies column - * stickiness when directionality changes. - * @private - * @return {?} - */ - CdkTable.prototype._setupStickyStyler = /** - * Creates the sticky styler that will be used for sticky rows and columns. Listens - * for directionality changes and provides the latest direction to the styler. Re-applies column - * stickiness when directionality changes. - * @private - * @return {?} - */ - function () { - var _this = this; - /** @type {?} */ - var direction = this._dir ? this._dir.value : 'ltr'; - this._stickyStyler = new StickyStyler(this._isNativeHtmlTable, - // @breaking-change 8.0.0 remove the null check for `this._platform`. - this.stickyCssClass, direction, this._platform ? this._platform.isBrowser : true); - (this._dir ? this._dir.change : Object(rxjs__WEBPACK_IMPORTED_MODULE_5__["of"])()) - .pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_6__["takeUntil"])(this._onDestroy)) - .subscribe(function (value) { - _this._stickyStyler.direction = value; - _this.updateStickyColumnStyles(); - }); - }; - CdkTable.decorators = [ - { type: _angular_core__WEBPACK_IMPORTED_MODULE_2__["Component"], args: [{selector: 'cdk-table, table[cdk-table]', - exportAs: 'cdkTable', - template: CDK_TABLE_TEMPLATE, - host: { - 'class': 'cdk-table', - }, - encapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_2__["ViewEncapsulation"].None, - changeDetection: _angular_core__WEBPACK_IMPORTED_MODULE_2__["ChangeDetectionStrategy"].OnPush, - },] }, - ]; - /** @nocollapse */ - CdkTable.ctorParameters = function () { return [ - { type: _angular_core__WEBPACK_IMPORTED_MODULE_2__["IterableDiffers"] }, - { type: _angular_core__WEBPACK_IMPORTED_MODULE_2__["ChangeDetectorRef"] }, - { type: _angular_core__WEBPACK_IMPORTED_MODULE_2__["ElementRef"] }, - { type: String, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_2__["Attribute"], args: ['role',] }] }, - { type: _angular_cdk_bidi__WEBPACK_IMPORTED_MODULE_7__["Directionality"], decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_2__["Optional"] }] }, - { type: undefined, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_2__["Inject"], args: [_angular_common__WEBPACK_IMPORTED_MODULE_4__["DOCUMENT"],] }] }, - { type: _angular_cdk_platform__WEBPACK_IMPORTED_MODULE_8__["Platform"] } - ]; }; - CdkTable.propDecorators = { - trackBy: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_2__["Input"] }], - dataSource: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_2__["Input"] }], - multiTemplateDataRows: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_2__["Input"] }], - _rowOutlet: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_2__["ViewChild"], args: [DataRowOutlet,] }], - _headerRowOutlet: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_2__["ViewChild"], args: [HeaderRowOutlet,] }], - _footerRowOutlet: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_2__["ViewChild"], args: [FooterRowOutlet,] }], - _contentColumnDefs: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_2__["ContentChildren"], args: [CdkColumnDef,] }], - _contentRowDefs: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_2__["ContentChildren"], args: [CdkRowDef,] }], - _contentHeaderRowDefs: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_2__["ContentChildren"], args: [CdkHeaderRowDef,] }], - _contentFooterRowDefs: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_2__["ContentChildren"], args: [CdkFooterRowDef,] }] - }; - return CdkTable; -}()); -/** - * Utility function that gets a merged list of the entries in a QueryList and values of a Set. - * @template T - * @param {?} queryList - * @param {?} set - * @return {?} - */ -function mergeQueryListAndSet(queryList, set) { - return queryList.toArray().concat(Array.from(set)); -} - -/** - * @fileoverview added by tsickle - * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc - */ -/** @type {?} */ -var EXPORTED_DECLARATIONS = [ - CdkTable, - CdkRowDef, - CdkCellDef, - CdkCellOutlet, - CdkHeaderCellDef, - CdkFooterCellDef, - CdkColumnDef, - CdkCell, - CdkRow, - CdkHeaderCell, - CdkFooterCell, - CdkHeaderRow, - CdkHeaderRowDef, - CdkFooterRow, - CdkFooterRowDef, - DataRowOutlet, - HeaderRowOutlet, - FooterRowOutlet, -]; -var CdkTableModule = /** @class */ (function () { - function CdkTableModule() { - } - CdkTableModule.decorators = [ - { type: _angular_core__WEBPACK_IMPORTED_MODULE_2__["NgModule"], args: [{ - imports: [_angular_common__WEBPACK_IMPORTED_MODULE_4__["CommonModule"]], - exports: EXPORTED_DECLARATIONS, - declarations: EXPORTED_DECLARATIONS - },] }, - ]; - return CdkTableModule; -}()); - -/** - * @fileoverview added by tsickle - * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc - */ - -/** - * @fileoverview added by tsickle - * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc - */ - - -//# sourceMappingURL=table.es5.js.map - - -/***/ }), - -/***/ "./node_modules/@angular/cdk/esm5/text-field.es5.js": -/*!**********************************************************!*\ - !*** ./node_modules/@angular/cdk/esm5/text-field.es5.js ***! - \**********************************************************/ -/*! exports provided: AutofillMonitor, CdkAutofill, CdkTextareaAutosize, TextFieldModule */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AutofillMonitor", function() { return AutofillMonitor; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CdkAutofill", function() { return CdkAutofill; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CdkTextareaAutosize", function() { return CdkTextareaAutosize; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextFieldModule", function() { return TextFieldModule; }); -/* harmony import */ var _angular_cdk_platform__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/cdk/platform */ "./node_modules/@angular/cdk/esm5/platform.es5.js"); -/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); -/* harmony import */ var _angular_cdk_coercion__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @angular/cdk/coercion */ "./node_modules/@angular/cdk/esm5/coercion.es5.js"); -/* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! rxjs */ "./node_modules/rxjs/_esm5/index.js"); -/* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! rxjs/operators */ "./node_modules/rxjs/_esm5/operators/index.js"); -/** - * @license - * Copyright Google LLC All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - - - - - - -/** - * @fileoverview added by tsickle - * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc - */ -/** - * Options to pass to the animationstart listener. - * @type {?} - */ -var listenerOptions = Object(_angular_cdk_platform__WEBPACK_IMPORTED_MODULE_0__["normalizePassiveListenerOptions"])({ passive: true }); -/** - * An injectable service that can be used to monitor the autofill state of an input. - * Based on the following blog post: - * https://medium.com/\@brunn/detecting-autofilled-fields-in-javascript-aed598d25da7 - */ -var AutofillMonitor = /** @class */ (function () { - function AutofillMonitor(_platform, _ngZone) { - this._platform = _platform; - this._ngZone = _ngZone; - this._monitoredElements = new Map(); - } - /** - * @param {?} elementOrRef - * @return {?} - */ - AutofillMonitor.prototype.monitor = /** - * @param {?} elementOrRef - * @return {?} - */ - function (elementOrRef) { - var _this = this; - if (!this._platform.isBrowser) { - return rxjs__WEBPACK_IMPORTED_MODULE_3__["EMPTY"]; - } - /** @type {?} */ - var element = Object(_angular_cdk_coercion__WEBPACK_IMPORTED_MODULE_2__["coerceElement"])(elementOrRef); - /** @type {?} */ - var info = this._monitoredElements.get(element); - if (info) { - return info.subject.asObservable(); - } - /** @type {?} */ - var result = new rxjs__WEBPACK_IMPORTED_MODULE_3__["Subject"](); - /** @type {?} */ - var cssClass = 'cdk-text-field-autofilled'; - /** @type {?} */ - var listener = (/** @type {?} */ ((function (event) { - // Animation events fire on initial element render, we check for the presence of the autofill - // CSS class to make sure this is a real change in state, not just the initial render before - // we fire off events. - if (event.animationName === 'cdk-text-field-autofill-start' && - !element.classList.contains(cssClass)) { - element.classList.add(cssClass); - _this._ngZone.run(function () { return result.next({ target: (/** @type {?} */ (event.target)), isAutofilled: true }); }); - } - else if (event.animationName === 'cdk-text-field-autofill-end' && - element.classList.contains(cssClass)) { - element.classList.remove(cssClass); - _this._ngZone.run(function () { return result.next({ target: (/** @type {?} */ (event.target)), isAutofilled: false }); }); - } - }))); - this._ngZone.runOutsideAngular(function () { - element.addEventListener('animationstart', listener, listenerOptions); - element.classList.add('cdk-text-field-autofill-monitored'); - }); - this._monitoredElements.set(element, { - subject: result, - unlisten: function () { - element.removeEventListener('animationstart', listener, listenerOptions); - } - }); - return result.asObservable(); - }; - /** - * @param {?} elementOrRef - * @return {?} - */ - AutofillMonitor.prototype.stopMonitoring = /** - * @param {?} elementOrRef - * @return {?} - */ - function (elementOrRef) { - /** @type {?} */ - var element = Object(_angular_cdk_coercion__WEBPACK_IMPORTED_MODULE_2__["coerceElement"])(elementOrRef); - /** @type {?} */ - var info = this._monitoredElements.get(element); - if (info) { - info.unlisten(); - info.subject.complete(); - element.classList.remove('cdk-text-field-autofill-monitored'); - element.classList.remove('cdk-text-field-autofilled'); - this._monitoredElements.delete(element); - } - }; - /** - * @return {?} - */ - AutofillMonitor.prototype.ngOnDestroy = /** - * @return {?} - */ - function () { - var _this = this; - this._monitoredElements.forEach(function (_info, element) { return _this.stopMonitoring(element); }); - }; - AutofillMonitor.decorators = [ - { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Injectable"], args: [{ providedIn: 'root' },] }, - ]; - /** @nocollapse */ - AutofillMonitor.ctorParameters = function () { return [ - { type: _angular_cdk_platform__WEBPACK_IMPORTED_MODULE_0__["Platform"] }, - { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["NgZone"] } - ]; }; - /** @nocollapse */ AutofillMonitor.ngInjectableDef = Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["defineInjectable"])({ factory: function AutofillMonitor_Factory() { return new AutofillMonitor(Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["inject"])(_angular_cdk_platform__WEBPACK_IMPORTED_MODULE_0__["Platform"]), Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["inject"])(_angular_core__WEBPACK_IMPORTED_MODULE_1__["NgZone"])); }, token: AutofillMonitor, providedIn: "root" }); - return AutofillMonitor; -}()); -/** - * A directive that can be used to monitor the autofill state of an input. - */ -var CdkAutofill = /** @class */ (function () { - function CdkAutofill(_elementRef, _autofillMonitor) { - this._elementRef = _elementRef; - this._autofillMonitor = _autofillMonitor; - /** - * Emits when the autofill state of the element changes. - */ - this.cdkAutofill = new _angular_core__WEBPACK_IMPORTED_MODULE_1__["EventEmitter"](); - } - /** - * @return {?} - */ - CdkAutofill.prototype.ngOnInit = /** - * @return {?} - */ - function () { - var _this = this; - this._autofillMonitor - .monitor(this._elementRef) - .subscribe(function (event) { return _this.cdkAutofill.emit(event); }); - }; - /** - * @return {?} - */ - CdkAutofill.prototype.ngOnDestroy = /** - * @return {?} - */ - function () { - this._autofillMonitor.stopMonitoring(this._elementRef); - }; - CdkAutofill.decorators = [ - { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Directive"], args: [{ - selector: '[cdkAutofill]', - },] }, - ]; - /** @nocollapse */ - CdkAutofill.ctorParameters = function () { return [ - { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ElementRef"] }, - { type: AutofillMonitor } - ]; }; - CdkAutofill.propDecorators = { - cdkAutofill: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Output"] }] - }; - return CdkAutofill; -}()); - -/** - * @fileoverview added by tsickle - * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc - */ -/** - * Directive to automatically resize a textarea to fit its content. - */ -var CdkTextareaAutosize = /** @class */ (function () { - function CdkTextareaAutosize(_elementRef, _platform, _ngZone) { - this._elementRef = _elementRef; - this._platform = _platform; - this._ngZone = _ngZone; - this._destroyed = new rxjs__WEBPACK_IMPORTED_MODULE_3__["Subject"](); - this._enabled = true; - /** - * Value of minRows as of last resize. If the minRows has decreased, the - * height of the textarea needs to be recomputed to reflect the new minimum. The maxHeight - * does not have the same problem because it does not affect the textarea's scrollHeight. - */ - this._previousMinRows = -1; - this._textareaElement = (/** @type {?} */ (this._elementRef.nativeElement)); - } - Object.defineProperty(CdkTextareaAutosize.prototype, "minRows", { - /** Minimum amount of rows in the textarea. */ - get: /** - * Minimum amount of rows in the textarea. - * @return {?} - */ - function () { return this._minRows; }, - set: /** - * @param {?} value - * @return {?} - */ - function (value) { - this._minRows = value; - this._setMinHeight(); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(CdkTextareaAutosize.prototype, "maxRows", { - /** Maximum amount of rows in the textarea. */ - get: /** - * Maximum amount of rows in the textarea. - * @return {?} - */ - function () { return this._maxRows; }, - set: /** - * @param {?} value - * @return {?} - */ - function (value) { - this._maxRows = value; - this._setMaxHeight(); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(CdkTextareaAutosize.prototype, "enabled", { - /** Whether autosizing is enabled or not */ - get: /** - * Whether autosizing is enabled or not - * @return {?} - */ - function () { return this._enabled; }, - set: /** - * @param {?} value - * @return {?} - */ - function (value) { - value = Object(_angular_cdk_coercion__WEBPACK_IMPORTED_MODULE_2__["coerceBooleanProperty"])(value); - // Only act if the actual value changed. This specifically helps to not run - // resizeToFitContent too early (i.e. before ngAfterViewInit) - if (this._enabled !== value) { - (this._enabled = value) ? this.resizeToFitContent(true) : this.reset(); - } - }, - enumerable: true, - configurable: true - }); - /** Sets the minimum height of the textarea as determined by minRows. */ - /** - * Sets the minimum height of the textarea as determined by minRows. - * @return {?} - */ - CdkTextareaAutosize.prototype._setMinHeight = /** - * Sets the minimum height of the textarea as determined by minRows. - * @return {?} - */ - function () { - /** @type {?} */ - var minHeight = this.minRows && this._cachedLineHeight ? - this.minRows * this._cachedLineHeight + "px" : null; - if (minHeight) { - this._textareaElement.style.minHeight = minHeight; - } - }; - /** Sets the maximum height of the textarea as determined by maxRows. */ - /** - * Sets the maximum height of the textarea as determined by maxRows. - * @return {?} - */ - CdkTextareaAutosize.prototype._setMaxHeight = /** - * Sets the maximum height of the textarea as determined by maxRows. - * @return {?} - */ - function () { - /** @type {?} */ - var maxHeight = this.maxRows && this._cachedLineHeight ? - this.maxRows * this._cachedLineHeight + "px" : null; - if (maxHeight) { - this._textareaElement.style.maxHeight = maxHeight; - } - }; - /** - * @return {?} - */ - CdkTextareaAutosize.prototype.ngAfterViewInit = /** - * @return {?} - */ - function () { - var _this = this; - if (this._platform.isBrowser) { - // Remember the height which we started with in case autosizing is disabled - this._initialHeight = this._textareaElement.style.height; - this.resizeToFitContent(); - this._ngZone.runOutsideAngular(function () { - Object(rxjs__WEBPACK_IMPORTED_MODULE_3__["fromEvent"])(window, 'resize') - .pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_4__["auditTime"])(16), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_4__["takeUntil"])(_this._destroyed)) - .subscribe(function () { return _this.resizeToFitContent(true); }); - }); - } - }; - /** - * @return {?} - */ - CdkTextareaAutosize.prototype.ngOnDestroy = /** - * @return {?} - */ - function () { - this._destroyed.next(); - this._destroyed.complete(); - }; - /** - * Cache the height of a single-row textarea if it has not already been cached. - * - * We need to know how large a single "row" of a textarea is in order to apply minRows and - * maxRows. For the initial version, we will assume that the height of a single line in the - * textarea does not ever change. - */ - /** - * Cache the height of a single-row textarea if it has not already been cached. - * - * We need to know how large a single "row" of a textarea is in order to apply minRows and - * maxRows. For the initial version, we will assume that the height of a single line in the - * textarea does not ever change. - * @private - * @return {?} - */ - CdkTextareaAutosize.prototype._cacheTextareaLineHeight = /** - * Cache the height of a single-row textarea if it has not already been cached. - * - * We need to know how large a single "row" of a textarea is in order to apply minRows and - * maxRows. For the initial version, we will assume that the height of a single line in the - * textarea does not ever change. - * @private - * @return {?} - */ - function () { - if (this._cachedLineHeight) { - return; - } - // Use a clone element because we have to override some styles. - /** @type {?} */ - var textareaClone = (/** @type {?} */ (this._textareaElement.cloneNode(false))); - textareaClone.rows = 1; - // Use `position: absolute` so that this doesn't cause a browser layout and use - // `visibility: hidden` so that nothing is rendered. Clear any other styles that - // would affect the height. - textareaClone.style.position = 'absolute'; - textareaClone.style.visibility = 'hidden'; - textareaClone.style.border = 'none'; - textareaClone.style.padding = '0'; - textareaClone.style.height = ''; - textareaClone.style.minHeight = ''; - textareaClone.style.maxHeight = ''; - // In Firefox it happens that textarea elements are always bigger than the specified amount - // of rows. This is because Firefox tries to add extra space for the horizontal scrollbar. - // As a workaround that removes the extra space for the scrollbar, we can just set overflow - // to hidden. This ensures that there is no invalid calculation of the line height. - // See Firefox bug report: https://bugzilla.mozilla.org/show_bug.cgi?id=33654 - textareaClone.style.overflow = 'hidden'; - (/** @type {?} */ (this._textareaElement.parentNode)).appendChild(textareaClone); - this._cachedLineHeight = textareaClone.clientHeight; - (/** @type {?} */ (this._textareaElement.parentNode)).removeChild(textareaClone); - // Min and max heights have to be re-calculated if the cached line height changes - this._setMinHeight(); - this._setMaxHeight(); - }; - /** - * @return {?} - */ - CdkTextareaAutosize.prototype.ngDoCheck = /** - * @return {?} - */ - function () { - if (this._platform.isBrowser) { - this.resizeToFitContent(); - } - }; - /** - * Resize the textarea to fit its content. - * @param force Whether to force a height recalculation. By default the height will be - * recalculated only if the value changed since the last call. - */ - /** - * Resize the textarea to fit its content. - * @param {?=} force Whether to force a height recalculation. By default the height will be - * recalculated only if the value changed since the last call. - * @return {?} - */ - CdkTextareaAutosize.prototype.resizeToFitContent = /** - * Resize the textarea to fit its content. - * @param {?=} force Whether to force a height recalculation. By default the height will be - * recalculated only if the value changed since the last call. - * @return {?} - */ - function (force) { - var _this = this; - if (force === void 0) { force = false; } - // If autosizing is disabled, just skip everything else - if (!this._enabled) { - return; - } - this._cacheTextareaLineHeight(); - // If we haven't determined the line-height yet, we know we're still hidden and there's no point - // in checking the height of the textarea. - if (!this._cachedLineHeight) { - return; - } - /** @type {?} */ - var textarea = (/** @type {?} */ (this._elementRef.nativeElement)); - /** @type {?} */ - var value = textarea.value; - // Only resize if the value or minRows have changed since these calculations can be expensive. - if (!force && this._minRows === this._previousMinRows && value === this._previousValue) { - return; - } - /** @type {?} */ - var placeholderText = textarea.placeholder; - // Reset the textarea height to auto in order to shrink back to its default size. - // Also temporarily force overflow:hidden, so scroll bars do not interfere with calculations. - // Long placeholders that are wider than the textarea width may lead to a bigger scrollHeight - // value. To ensure that the scrollHeight is not bigger than the content, the placeholders - // need to be removed temporarily. - textarea.classList.add('cdk-textarea-autosize-measuring'); - textarea.placeholder = ''; - // The cdk-textarea-autosize-measuring class includes a 2px padding to workaround an issue with - // Chrome, so we account for that extra space here by subtracting 4 (2px top + 2px bottom). - /** @type {?} */ - var height = textarea.scrollHeight - 4; - // Use the scrollHeight to know how large the textarea *would* be if fit its entire value. - textarea.style.height = height + "px"; - textarea.classList.remove('cdk-textarea-autosize-measuring'); - textarea.placeholder = placeholderText; - this._ngZone.runOutsideAngular(function () { - if (typeof requestAnimationFrame !== 'undefined') { - requestAnimationFrame(function () { return _this._scrollToCaretPosition(textarea); }); - } - else { - setTimeout(function () { return _this._scrollToCaretPosition(textarea); }); - } - }); - this._previousValue = value; - this._previousMinRows = this._minRows; - }; - /** - * Resets the textarea to it's original size - */ - /** - * Resets the textarea to it's original size - * @return {?} - */ - CdkTextareaAutosize.prototype.reset = /** - * Resets the textarea to it's original size - * @return {?} - */ - function () { - // Do not try to change the textarea, if the initialHeight has not been determined yet - // This might potentially remove styles when reset() is called before ngAfterViewInit - if (this._initialHeight === undefined) { - return; - } - this._textareaElement.style.height = this._initialHeight; - }; - /** - * @return {?} - */ - CdkTextareaAutosize.prototype._noopInputHandler = /** - * @return {?} - */ - function () { - // no-op handler that ensures we're running change detection on input events. - }; - /** - * Scrolls a textarea to the caret position. On Firefox resizing the textarea will - * prevent it from scrolling to the caret position. We need to re-set the selection - * in order for it to scroll to the proper position. - */ - /** - * Scrolls a textarea to the caret position. On Firefox resizing the textarea will - * prevent it from scrolling to the caret position. We need to re-set the selection - * in order for it to scroll to the proper position. - * @private - * @param {?} textarea - * @return {?} - */ - CdkTextareaAutosize.prototype._scrollToCaretPosition = /** - * Scrolls a textarea to the caret position. On Firefox resizing the textarea will - * prevent it from scrolling to the caret position. We need to re-set the selection - * in order for it to scroll to the proper position. - * @private - * @param {?} textarea - * @return {?} - */ - function (textarea) { - var selectionStart = textarea.selectionStart, selectionEnd = textarea.selectionEnd; - // IE will throw an "Unspecified error" if we try to set the selection range after the - // element has been removed from the DOM. Assert that the directive hasn't been destroyed - // between the time we requested the animation frame and when it was executed. - // Also note that we have to assert that the textarea is focused before we set the - // selection range. Setting the selection range on a non-focused textarea will cause - // it to receive focus on IE and Edge. - if (!this._destroyed.isStopped && document.activeElement === textarea) { - textarea.setSelectionRange(selectionStart, selectionEnd); - } - }; - CdkTextareaAutosize.decorators = [ - { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Directive"], args: [{ - selector: 'textarea[cdkTextareaAutosize]', - exportAs: 'cdkTextareaAutosize', - host: { - 'class': 'cdk-textarea-autosize', - // Textarea elements that have the directive applied should have a single row by default. - // Browsers normally show two rows by default and therefore this limits the minRows binding. - 'rows': '1', - '(input)': '_noopInputHandler()', - }, - },] }, - ]; - /** @nocollapse */ - CdkTextareaAutosize.ctorParameters = function () { return [ - { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ElementRef"] }, - { type: _angular_cdk_platform__WEBPACK_IMPORTED_MODULE_0__["Platform"] }, - { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["NgZone"] } - ]; }; - CdkTextareaAutosize.propDecorators = { - minRows: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"], args: ['cdkAutosizeMinRows',] }], - maxRows: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"], args: ['cdkAutosizeMaxRows',] }], - enabled: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"], args: ['cdkTextareaAutosize',] }] - }; - return CdkTextareaAutosize; -}()); - -/** - * @fileoverview added by tsickle - * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc - */ -var TextFieldModule = /** @class */ (function () { - function TextFieldModule() { - } - TextFieldModule.decorators = [ - { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["NgModule"], args: [{ - declarations: [CdkAutofill, CdkTextareaAutosize], - imports: [_angular_cdk_platform__WEBPACK_IMPORTED_MODULE_0__["PlatformModule"]], - exports: [CdkAutofill, CdkTextareaAutosize], - },] }, - ]; - return TextFieldModule; -}()); - -/** - * @fileoverview added by tsickle - * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc - */ - -/** - * @fileoverview added by tsickle - * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc - */ - - -//# sourceMappingURL=text-field.es5.js.map - - -/***/ }), - -/***/ "./node_modules/@angular/cdk/esm5/tree.es5.js": -/*!****************************************************!*\ - !*** ./node_modules/@angular/cdk/esm5/tree.es5.js ***! - \****************************************************/ -/*! exports provided: BaseTreeControl, FlatTreeControl, NestedTreeControl, CdkNestedTreeNode, CdkTreeNodeOutletContext, CdkTreeNodeDef, CdkTreeNodePadding, CDK_TREE_NODE_OUTLET_NODE, CdkTreeNodeOutlet, CdkTree, CdkTreeNode, getTreeNoValidDataSourceError, getTreeMultipleDefaultNodeDefsError, getTreeMissingMatchingNodeDefError, getTreeControlMissingError, getTreeControlFunctionsMissingError, CdkTreeModule, CdkTreeNodeToggle */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BaseTreeControl", function() { return BaseTreeControl; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FlatTreeControl", function() { return FlatTreeControl; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NestedTreeControl", function() { return NestedTreeControl; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CdkNestedTreeNode", function() { return CdkNestedTreeNode; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CdkTreeNodeOutletContext", function() { return CdkTreeNodeOutletContext; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CdkTreeNodeDef", function() { return CdkTreeNodeDef; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CdkTreeNodePadding", function() { return CdkTreeNodePadding; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CDK_TREE_NODE_OUTLET_NODE", function() { return CDK_TREE_NODE_OUTLET_NODE; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CdkTreeNodeOutlet", function() { return CdkTreeNodeOutlet; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CdkTree", function() { return CdkTree; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CdkTreeNode", function() { return CdkTreeNode; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTreeNoValidDataSourceError", function() { return getTreeNoValidDataSourceError; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTreeMultipleDefaultNodeDefsError", function() { return getTreeMultipleDefaultNodeDefsError; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTreeMissingMatchingNodeDefError", function() { return getTreeMissingMatchingNodeDefError; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTreeControlMissingError", function() { return getTreeControlMissingError; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTreeControlFunctionsMissingError", function() { return getTreeControlFunctionsMissingError; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CdkTreeModule", function() { return CdkTreeModule; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CdkTreeNodeToggle", function() { return CdkTreeNodeToggle; }); -/* harmony import */ var _angular_cdk_collections__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/cdk/collections */ "./node_modules/@angular/cdk/esm5/collections.es5.js"); -/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); -/* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! rxjs */ "./node_modules/rxjs/_esm5/index.js"); -/* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! rxjs/operators */ "./node_modules/rxjs/_esm5/operators/index.js"); -/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); -/* harmony import */ var _angular_cdk_bidi__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @angular/cdk/bidi */ "./node_modules/@angular/cdk/esm5/bidi.es5.js"); -/* harmony import */ var _angular_cdk_coercion__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @angular/cdk/coercion */ "./node_modules/@angular/cdk/esm5/coercion.es5.js"); -/* harmony import */ var _angular_cdk_a11y__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @angular/cdk/a11y */ "./node_modules/@angular/cdk/esm5/a11y.es5.js"); -/* harmony import */ var _angular_common__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @angular/common */ "./node_modules/@angular/common/fesm5/common.js"); -/** - * @license - * Copyright Google LLC All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - - - - - - - - - - -/** - * @fileoverview added by tsickle - * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc - */ -/** - * Base tree control. It has basic toggle/expand/collapse operations on a single data node. - * @abstract - * @template T - */ -var /** - * Base tree control. It has basic toggle/expand/collapse operations on a single data node. - * @abstract - * @template T - */ -BaseTreeControl = /** @class */ (function () { - function BaseTreeControl() { - /** - * A selection model with multi-selection to track expansion status. - */ - this.expansionModel = new _angular_cdk_collections__WEBPACK_IMPORTED_MODULE_0__["SelectionModel"](true); - } - /** Toggles one single data node's expanded/collapsed state. */ - /** - * Toggles one single data node's expanded/collapsed state. - * @param {?} dataNode - * @return {?} - */ - BaseTreeControl.prototype.toggle = /** - * Toggles one single data node's expanded/collapsed state. - * @param {?} dataNode - * @return {?} - */ - function (dataNode) { - this.expansionModel.toggle(dataNode); - }; - /** Expands one single data node. */ - /** - * Expands one single data node. - * @param {?} dataNode - * @return {?} - */ - BaseTreeControl.prototype.expand = /** - * Expands one single data node. - * @param {?} dataNode - * @return {?} - */ - function (dataNode) { - this.expansionModel.select(dataNode); - }; - /** Collapses one single data node. */ - /** - * Collapses one single data node. - * @param {?} dataNode - * @return {?} - */ - BaseTreeControl.prototype.collapse = /** - * Collapses one single data node. - * @param {?} dataNode - * @return {?} - */ - function (dataNode) { - this.expansionModel.deselect(dataNode); - }; - /** Whether a given data node is expanded or not. Returns true if the data node is expanded. */ - /** - * Whether a given data node is expanded or not. Returns true if the data node is expanded. - * @param {?} dataNode - * @return {?} - */ - BaseTreeControl.prototype.isExpanded = /** - * Whether a given data node is expanded or not. Returns true if the data node is expanded. - * @param {?} dataNode - * @return {?} - */ - function (dataNode) { - return this.expansionModel.isSelected(dataNode); - }; - /** Toggles a subtree rooted at `node` recursively. */ - /** - * Toggles a subtree rooted at `node` recursively. - * @param {?} dataNode - * @return {?} - */ - BaseTreeControl.prototype.toggleDescendants = /** - * Toggles a subtree rooted at `node` recursively. - * @param {?} dataNode - * @return {?} - */ - function (dataNode) { - this.expansionModel.isSelected(dataNode) - ? this.collapseDescendants(dataNode) - : this.expandDescendants(dataNode); - }; - /** Collapse all dataNodes in the tree. */ - /** - * Collapse all dataNodes in the tree. - * @return {?} - */ - BaseTreeControl.prototype.collapseAll = /** - * Collapse all dataNodes in the tree. - * @return {?} - */ - function () { - this.expansionModel.clear(); - }; - /** Expands a subtree rooted at given data node recursively. */ - /** - * Expands a subtree rooted at given data node recursively. - * @param {?} dataNode - * @return {?} - */ - BaseTreeControl.prototype.expandDescendants = /** - * Expands a subtree rooted at given data node recursively. - * @param {?} dataNode - * @return {?} - */ - function (dataNode) { - var _a; - /** @type {?} */ - var toBeProcessed = [dataNode]; - toBeProcessed.push.apply(toBeProcessed, this.getDescendants(dataNode)); - (_a = this.expansionModel).select.apply(_a, toBeProcessed); - }; - /** Collapses a subtree rooted at given data node recursively. */ - /** - * Collapses a subtree rooted at given data node recursively. - * @param {?} dataNode - * @return {?} - */ - BaseTreeControl.prototype.collapseDescendants = /** - * Collapses a subtree rooted at given data node recursively. - * @param {?} dataNode - * @return {?} - */ - function (dataNode) { - var _a; - /** @type {?} */ - var toBeProcessed = [dataNode]; - toBeProcessed.push.apply(toBeProcessed, this.getDescendants(dataNode)); - (_a = this.expansionModel).deselect.apply(_a, toBeProcessed); - }; - return BaseTreeControl; -}()); - -/** - * @fileoverview added by tsickle - * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc - */ -/** - * Flat tree control. Able to expand/collapse a subtree recursively for flattened tree. - * @template T - */ -var /** - * Flat tree control. Able to expand/collapse a subtree recursively for flattened tree. - * @template T - */ -FlatTreeControl = /** @class */ (function (_super) { - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__extends"])(FlatTreeControl, _super); - /** Construct with flat tree data node functions getLevel and isExpandable. */ - function FlatTreeControl(getLevel, isExpandable) { - var _this = _super.call(this) || this; - _this.getLevel = getLevel; - _this.isExpandable = isExpandable; - return _this; - } - /** - * Gets a list of the data node's subtree of descendent data nodes. - * - * To make this working, the `dataNodes` of the TreeControl must be flattened tree nodes - * with correct levels. - */ - /** - * Gets a list of the data node's subtree of descendent data nodes. - * - * To make this working, the `dataNodes` of the TreeControl must be flattened tree nodes - * with correct levels. - * @param {?} dataNode - * @return {?} - */ - FlatTreeControl.prototype.getDescendants = /** - * Gets a list of the data node's subtree of descendent data nodes. - * - * To make this working, the `dataNodes` of the TreeControl must be flattened tree nodes - * with correct levels. - * @param {?} dataNode - * @return {?} - */ - function (dataNode) { - /** @type {?} */ - var startIndex = this.dataNodes.indexOf(dataNode); - /** @type {?} */ - var results = []; - // Goes through flattened tree nodes in the `dataNodes` array, and get all descendants. - // The level of descendants of a tree node must be greater than the level of the given - // tree node. - // If we reach a node whose level is equal to the level of the tree node, we hit a sibling. - // If we reach a node whose level is greater than the level of the tree node, we hit a - // sibling of an ancestor. - for (var i = startIndex + 1; i < this.dataNodes.length && this.getLevel(dataNode) < this.getLevel(this.dataNodes[i]); i++) { - results.push(this.dataNodes[i]); - } - return results; - }; - /** - * Expands all data nodes in the tree. - * - * To make this working, the `dataNodes` variable of the TreeControl must be set to all flattened - * data nodes of the tree. - */ - /** - * Expands all data nodes in the tree. - * - * To make this working, the `dataNodes` variable of the TreeControl must be set to all flattened - * data nodes of the tree. - * @return {?} - */ - FlatTreeControl.prototype.expandAll = /** - * Expands all data nodes in the tree. - * - * To make this working, the `dataNodes` variable of the TreeControl must be set to all flattened - * data nodes of the tree. - * @return {?} - */ - function () { - var _a; - (_a = this.expansionModel).select.apply(_a, this.dataNodes); - }; - return FlatTreeControl; -}(BaseTreeControl)); - -/** - * @fileoverview added by tsickle - * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc - */ -/** - * Nested tree control. Able to expand/collapse a subtree recursively for NestedNode type. - * @template T - */ -var /** - * Nested tree control. Able to expand/collapse a subtree recursively for NestedNode type. - * @template T - */ -NestedTreeControl = /** @class */ (function (_super) { - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__extends"])(NestedTreeControl, _super); - /** Construct with nested tree function getChildren. */ - function NestedTreeControl(getChildren) { - var _this = _super.call(this) || this; - _this.getChildren = getChildren; - return _this; - } - /** - * Expands all dataNodes in the tree. - * - * To make this working, the `dataNodes` variable of the TreeControl must be set to all root level - * data nodes of the tree. - */ - /** - * Expands all dataNodes in the tree. - * - * To make this working, the `dataNodes` variable of the TreeControl must be set to all root level - * data nodes of the tree. - * @return {?} - */ - NestedTreeControl.prototype.expandAll = /** - * Expands all dataNodes in the tree. - * - * To make this working, the `dataNodes` variable of the TreeControl must be set to all root level - * data nodes of the tree. - * @return {?} - */ - function () { - var _this = this; - var _a; - this.expansionModel.clear(); - /** @type {?} */ - var allNodes = this.dataNodes.reduce(function (accumulator, dataNode) { - return accumulator.concat(_this.getDescendants(dataNode), [dataNode]); - }, []); - (_a = this.expansionModel).select.apply(_a, allNodes); - }; - /** Gets a list of descendant dataNodes of a subtree rooted at given data node recursively. */ - /** - * Gets a list of descendant dataNodes of a subtree rooted at given data node recursively. - * @param {?} dataNode - * @return {?} - */ - NestedTreeControl.prototype.getDescendants = /** - * Gets a list of descendant dataNodes of a subtree rooted at given data node recursively. - * @param {?} dataNode - * @return {?} - */ - function (dataNode) { - /** @type {?} */ - var descendants = []; - this._getDescendants(descendants, dataNode); - // Remove the node itself - return descendants.splice(1); - }; - /** A helper function to get descendants recursively. */ - /** - * A helper function to get descendants recursively. - * @protected - * @param {?} descendants - * @param {?} dataNode - * @return {?} - */ - NestedTreeControl.prototype._getDescendants = /** - * A helper function to get descendants recursively. - * @protected - * @param {?} descendants - * @param {?} dataNode - * @return {?} - */ - function (descendants, dataNode) { - var _this = this; - descendants.push(dataNode); - /** @type {?} */ - var childrenNodes = this.getChildren(dataNode); - if (Array.isArray(childrenNodes)) { - childrenNodes.forEach(function (child) { return _this._getDescendants(descendants, child); }); - } - else if (childrenNodes instanceof rxjs__WEBPACK_IMPORTED_MODULE_2__["Observable"]) { - childrenNodes.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["take"])(1), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["filter"])(Boolean)).subscribe(function (children) { - children.forEach(function (child) { return _this._getDescendants(descendants, child); }); - }); - } - }; - return NestedTreeControl; -}(BaseTreeControl)); - -/** - * @fileoverview added by tsickle - * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc - */ - -/** - * @fileoverview added by tsickle - * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc - */ -/** - * Injection token used to provide a `CdkTreeNode` to its outlet. - * Used primarily to avoid circular imports. - * \@docs-private - * @type {?} - */ -var CDK_TREE_NODE_OUTLET_NODE = new _angular_core__WEBPACK_IMPORTED_MODULE_4__["InjectionToken"]('CDK_TREE_NODE_OUTLET_NODE'); -/** - * Outlet for nested CdkNode. Put `[cdkTreeNodeOutlet]` on a tag to place children dataNodes - * inside the outlet. - */ -var CdkTreeNodeOutlet = /** @class */ (function () { - function CdkTreeNodeOutlet(viewContainer, _node) { - this.viewContainer = viewContainer; - this._node = _node; - } - CdkTreeNodeOutlet.decorators = [ - { type: _angular_core__WEBPACK_IMPORTED_MODULE_4__["Directive"], args: [{ - selector: '[cdkTreeNodeOutlet]' - },] }, - ]; - /** @nocollapse */ - CdkTreeNodeOutlet.ctorParameters = function () { return [ - { type: _angular_core__WEBPACK_IMPORTED_MODULE_4__["ViewContainerRef"] }, - { type: undefined, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_4__["Inject"], args: [CDK_TREE_NODE_OUTLET_NODE,] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_4__["Optional"] }] } - ]; }; - return CdkTreeNodeOutlet; -}()); - -/** - * @fileoverview added by tsickle - * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc - */ -/** - * Context provided to the tree node component. - * @template T - */ -var /** - * Context provided to the tree node component. - * @template T - */ -CdkTreeNodeOutletContext = /** @class */ (function () { - function CdkTreeNodeOutletContext(data) { - this.$implicit = data; - } - return CdkTreeNodeOutletContext; -}()); -/** - * Data node definition for the CdkTree. - * Captures the node's template and a when predicate that describes when this node should be used. - * @template T - */ -var CdkTreeNodeDef = /** @class */ (function () { - /** @docs-private */ - function CdkTreeNodeDef(template) { - this.template = template; - } - CdkTreeNodeDef.decorators = [ - { type: _angular_core__WEBPACK_IMPORTED_MODULE_4__["Directive"], args: [{ - selector: '[cdkTreeNodeDef]', - inputs: [ - 'when: cdkTreeNodeDefWhen' - ], - },] }, - ]; - /** @nocollapse */ - CdkTreeNodeDef.ctorParameters = function () { return [ - { type: _angular_core__WEBPACK_IMPORTED_MODULE_4__["TemplateRef"] } - ]; }; - return CdkTreeNodeDef; -}()); - -/** - * @fileoverview added by tsickle - * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc - */ - -/** - * Returns an error to be thrown when there is no usable data. - * \@docs-private - * @return {?} - */ -function getTreeNoValidDataSourceError() { - return Error("A valid data source must be provided."); -} -/** - * Returns an error to be thrown when there are multiple nodes that are missing a when function. - * \@docs-private - * @return {?} - */ -function getTreeMultipleDefaultNodeDefsError() { - return Error("There can only be one default row without a when predicate function."); -} -/** - * Returns an error to be thrown when there are no matching node defs for a particular set of data. - * \@docs-private - * @return {?} - */ -function getTreeMissingMatchingNodeDefError() { - return Error("Could not find a matching node definition for the provided node data."); -} -/** - * Returns an error to be thrown when there are tree control. - * \@docs-private - * @return {?} - */ -function getTreeControlMissingError() { - return Error("Could not find a tree control for the tree."); -} -/** - * Returns an error to be thrown when tree control did not implement functions for flat/nested node. - * \@docs-private - * @return {?} - */ -function getTreeControlFunctionsMissingError() { - return Error("Could not find functions for nested/flat tree in tree control."); -} - -/** - * @fileoverview added by tsickle - * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc - */ -/** - * CDK tree component that connects with a data source to retrieve data of type `T` and renders - * dataNodes with hierarchy. Updates the dataNodes when new data is provided by the data source. - * @template T - */ -var CdkTree = /** @class */ (function () { - function CdkTree(_differs, _changeDetectorRef) { - this._differs = _differs; - this._changeDetectorRef = _changeDetectorRef; - /** - * Subject that emits when the component has been destroyed. - */ - this._onDestroy = new rxjs__WEBPACK_IMPORTED_MODULE_2__["Subject"](); - /** - * Level of nodes - */ - this._levels = new Map(); - // TODO(tinayuangao): Setup a listener for scrolling, emit the calculated view to viewChange. - // Remove the MAX_VALUE in viewChange - /** - * Stream containing the latest information on what rows are being displayed on screen. - * Can be used by the data source to as a heuristic of what data should be provided. - */ - this.viewChange = new rxjs__WEBPACK_IMPORTED_MODULE_2__["BehaviorSubject"]({ start: 0, end: Number.MAX_VALUE }); - } - Object.defineProperty(CdkTree.prototype, "dataSource", { - /** - * Provides a stream containing the latest data array to render. Influenced by the tree's - * stream of view window (what dataNodes are currently on screen). - * Data source can be an observable of data array, or a data array to render. - */ - get: /** - * Provides a stream containing the latest data array to render. Influenced by the tree's - * stream of view window (what dataNodes are currently on screen). - * Data source can be an observable of data array, or a data array to render. - * @return {?} - */ - function () { return this._dataSource; }, - set: /** - * @param {?} dataSource - * @return {?} - */ - function (dataSource) { - if (this._dataSource !== dataSource) { - this._switchDataSource(dataSource); - } - }, - enumerable: true, - configurable: true - }); - /** - * @return {?} - */ - CdkTree.prototype.ngOnInit = /** - * @return {?} - */ - function () { - this._dataDiffer = this._differs.find([]).create(this.trackBy); - if (!this.treeControl) { - throw getTreeControlMissingError(); - } - }; - /** - * @return {?} - */ - CdkTree.prototype.ngOnDestroy = /** - * @return {?} - */ - function () { - this._nodeOutlet.viewContainer.clear(); - this._onDestroy.next(); - this._onDestroy.complete(); - if (this._dataSource && typeof ((/** @type {?} */ (this._dataSource))).disconnect === 'function') { - ((/** @type {?} */ (this.dataSource))).disconnect(this); - } - if (this._dataSubscription) { - this._dataSubscription.unsubscribe(); - this._dataSubscription = null; - } - }; - /** - * @return {?} - */ - CdkTree.prototype.ngAfterContentChecked = /** - * @return {?} - */ - function () { - /** @type {?} */ - var defaultNodeDefs = this._nodeDefs.filter(function (def) { return !def.when; }); - if (defaultNodeDefs.length > 1) { - throw getTreeMultipleDefaultNodeDefsError(); - } - this._defaultNodeDef = defaultNodeDefs[0]; - if (this.dataSource && this._nodeDefs && !this._dataSubscription) { - this._observeRenderChanges(); - } - }; - // TODO(tinayuangao): Work on keyboard traversal and actions, make sure it's working for RTL - // and nested trees. - /** - * Switch to the provided data source by resetting the data and unsubscribing from the current - * render change subscription if one exists. If the data source is null, interpret this by - * clearing the node outlet. Otherwise start listening for new data. - */ - // TODO(tinayuangao): Work on keyboard traversal and actions, make sure it's working for RTL - // and nested trees. - /** - * Switch to the provided data source by resetting the data and unsubscribing from the current - * render change subscription if one exists. If the data source is null, interpret this by - * clearing the node outlet. Otherwise start listening for new data. - * @private - * @param {?} dataSource - * @return {?} - */ - CdkTree.prototype._switchDataSource = - // TODO(tinayuangao): Work on keyboard traversal and actions, make sure it's working for RTL - // and nested trees. - /** - * Switch to the provided data source by resetting the data and unsubscribing from the current - * render change subscription if one exists. If the data source is null, interpret this by - * clearing the node outlet. Otherwise start listening for new data. - * @private - * @param {?} dataSource - * @return {?} - */ - function (dataSource) { - if (this._dataSource && typeof ((/** @type {?} */ (this._dataSource))).disconnect === 'function') { - ((/** @type {?} */ (this.dataSource))).disconnect(this); - } - if (this._dataSubscription) { - this._dataSubscription.unsubscribe(); - this._dataSubscription = null; - } - // Remove the all dataNodes if there is now no data source - if (!dataSource) { - this._nodeOutlet.viewContainer.clear(); - } - this._dataSource = dataSource; - if (this._nodeDefs) { - this._observeRenderChanges(); - } - }; - /** Set up a subscription for the data provided by the data source. */ - /** - * Set up a subscription for the data provided by the data source. - * @private - * @return {?} - */ - CdkTree.prototype._observeRenderChanges = /** - * Set up a subscription for the data provided by the data source. - * @private - * @return {?} - */ - function () { - var _this = this; - /** @type {?} */ - var dataStream; - if (Object(_angular_cdk_collections__WEBPACK_IMPORTED_MODULE_0__["isDataSource"])(this._dataSource)) { - dataStream = this._dataSource.connect(this); - } - else if (this._dataSource instanceof rxjs__WEBPACK_IMPORTED_MODULE_2__["Observable"]) { - dataStream = this._dataSource; - } - else if (Array.isArray(this._dataSource)) { - dataStream = Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(this._dataSource); - } - if (dataStream) { - this._dataSubscription = dataStream.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["takeUntil"])(this._onDestroy)) - .subscribe(function (data) { return _this.renderNodeChanges(data); }); - } - else { - throw getTreeNoValidDataSourceError(); - } - }; - /** Check for changes made in the data and render each change (node added/removed/moved). */ - /** - * Check for changes made in the data and render each change (node added/removed/moved). - * @param {?} data - * @param {?=} dataDiffer - * @param {?=} viewContainer - * @param {?=} parentData - * @return {?} - */ - CdkTree.prototype.renderNodeChanges = /** - * Check for changes made in the data and render each change (node added/removed/moved). - * @param {?} data - * @param {?=} dataDiffer - * @param {?=} viewContainer - * @param {?=} parentData - * @return {?} - */ - function (data, dataDiffer, viewContainer, parentData) { - var _this = this; - if (dataDiffer === void 0) { dataDiffer = this._dataDiffer; } - if (viewContainer === void 0) { viewContainer = this._nodeOutlet.viewContainer; } - /** @type {?} */ - var changes = dataDiffer.diff(data); - if (!changes) { - return; - } - changes.forEachOperation(function (item, adjustedPreviousIndex, currentIndex) { - if (item.previousIndex == null) { - _this.insertNode(data[(/** @type {?} */ (currentIndex))], (/** @type {?} */ (currentIndex)), viewContainer, parentData); - } - else if (currentIndex == null) { - viewContainer.remove((/** @type {?} */ (adjustedPreviousIndex))); - _this._levels.delete(item.item); - } - else { - /** @type {?} */ - var view = viewContainer.get((/** @type {?} */ (adjustedPreviousIndex))); - viewContainer.move((/** @type {?} */ (view)), currentIndex); - } - }); - this._changeDetectorRef.detectChanges(); - }; - /** - * Finds the matching node definition that should be used for this node data. If there is only - * one node definition, it is returned. Otherwise, find the node definition that has a when - * predicate that returns true with the data. If none return true, return the default node - * definition. - */ - /** - * Finds the matching node definition that should be used for this node data. If there is only - * one node definition, it is returned. Otherwise, find the node definition that has a when - * predicate that returns true with the data. If none return true, return the default node - * definition. - * @param {?} data - * @param {?} i - * @return {?} - */ - CdkTree.prototype._getNodeDef = /** - * Finds the matching node definition that should be used for this node data. If there is only - * one node definition, it is returned. Otherwise, find the node definition that has a when - * predicate that returns true with the data. If none return true, return the default node - * definition. - * @param {?} data - * @param {?} i - * @return {?} - */ - function (data, i) { - if (this._nodeDefs.length === 1) { - return this._nodeDefs.first; - } - /** @type {?} */ - var nodeDef = this._nodeDefs.find(function (def) { return def.when && def.when(i, data); }) || this._defaultNodeDef; - if (!nodeDef) { - throw getTreeMissingMatchingNodeDefError(); - } - return nodeDef; - }; - /** - * Create the embedded view for the data node template and place it in the correct index location - * within the data node view container. - */ - /** - * Create the embedded view for the data node template and place it in the correct index location - * within the data node view container. - * @param {?} nodeData - * @param {?} index - * @param {?=} viewContainer - * @param {?=} parentData - * @return {?} - */ - CdkTree.prototype.insertNode = /** - * Create the embedded view for the data node template and place it in the correct index location - * within the data node view container. - * @param {?} nodeData - * @param {?} index - * @param {?=} viewContainer - * @param {?=} parentData - * @return {?} - */ - function (nodeData, index, viewContainer, parentData) { - /** @type {?} */ - var node = this._getNodeDef(nodeData, index); - // Node context that will be provided to created embedded view - /** @type {?} */ - var context = new CdkTreeNodeOutletContext(nodeData); - // If the tree is flat tree, then use the `getLevel` function in flat tree control - // Otherwise, use the level of parent node. - if (this.treeControl.getLevel) { - context.level = this.treeControl.getLevel(nodeData); - } - else if (typeof parentData !== 'undefined' && this._levels.has(parentData)) { - context.level = (/** @type {?} */ (this._levels.get(parentData))) + 1; - } - else { - context.level = 0; - } - this._levels.set(nodeData, context.level); - // Use default tree nodeOutlet, or nested node's nodeOutlet - /** @type {?} */ - var container = viewContainer ? viewContainer : this._nodeOutlet.viewContainer; - container.createEmbeddedView(node.template, context, index); - // Set the data to just created `CdkTreeNode`. - // The `CdkTreeNode` created from `createEmbeddedView` will be saved in static variable - // `mostRecentTreeNode`. We get it from static variable and pass the node data to it. - if (CdkTreeNode.mostRecentTreeNode) { - CdkTreeNode.mostRecentTreeNode.data = nodeData; - } - }; - CdkTree.decorators = [ - { type: _angular_core__WEBPACK_IMPORTED_MODULE_4__["Component"], args: [{selector: 'cdk-tree', - exportAs: 'cdkTree', - template: "", - host: { - 'class': 'cdk-tree', - 'role': 'tree', - }, - encapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_4__["ViewEncapsulation"].None, - // The "OnPush" status for the `CdkTree` component is effectively a noop, so we are removing it. - // The view for `CdkTree` consists entirely of templates declared in other views. As they are - // declared elsewhere, they are checked when their declaration points are checked. - // tslint:disable-next-line:validate-decorators - changeDetection: _angular_core__WEBPACK_IMPORTED_MODULE_4__["ChangeDetectionStrategy"].Default - },] }, - ]; - /** @nocollapse */ - CdkTree.ctorParameters = function () { return [ - { type: _angular_core__WEBPACK_IMPORTED_MODULE_4__["IterableDiffers"] }, - { type: _angular_core__WEBPACK_IMPORTED_MODULE_4__["ChangeDetectorRef"] } - ]; }; - CdkTree.propDecorators = { - dataSource: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_4__["Input"] }], - treeControl: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_4__["Input"] }], - trackBy: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_4__["Input"] }], - _nodeOutlet: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_4__["ViewChild"], args: [CdkTreeNodeOutlet,] }], - _nodeDefs: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_4__["ContentChildren"], args: [CdkTreeNodeDef,] }] - }; - return CdkTree; -}()); -/** - * Tree node for CdkTree. It contains the data in the tree node. - * @template T - */ -var CdkTreeNode = /** @class */ (function () { - function CdkTreeNode(_elementRef, _tree) { - this._elementRef = _elementRef; - this._tree = _tree; - /** - * Subject that emits when the component has been destroyed. - */ - this._destroyed = new rxjs__WEBPACK_IMPORTED_MODULE_2__["Subject"](); - /** - * Emits when the node's data has changed. - */ - this._dataChanges = new rxjs__WEBPACK_IMPORTED_MODULE_2__["Subject"](); - /** - * The role of the node should be 'group' if it's an internal node, - * and 'treeitem' if it's a leaf node. - */ - this.role = 'treeitem'; - CdkTreeNode.mostRecentTreeNode = (/** @type {?} */ (this)); - } - Object.defineProperty(CdkTreeNode.prototype, "data", { - /** The tree node's data. */ - get: /** - * The tree node's data. - * @return {?} - */ - function () { return this._data; }, - set: /** - * @param {?} value - * @return {?} - */ - function (value) { - if (value !== this._data) { - this._data = value; - this._setRoleFromData(); - this._dataChanges.next(); - } - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(CdkTreeNode.prototype, "isExpanded", { - get: /** - * @return {?} - */ - function () { - return this._tree.treeControl.isExpanded(this._data); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(CdkTreeNode.prototype, "level", { - get: /** - * @return {?} - */ - function () { - return this._tree.treeControl.getLevel ? this._tree.treeControl.getLevel(this._data) : 0; - }, - enumerable: true, - configurable: true - }); - /** - * @return {?} - */ - CdkTreeNode.prototype.ngOnDestroy = /** - * @return {?} - */ - function () { - // If this is the last tree node being destroyed, - // clear out the reference to avoid leaking memory. - if (CdkTreeNode.mostRecentTreeNode === this) { - CdkTreeNode.mostRecentTreeNode = null; - } - this._dataChanges.complete(); - this._destroyed.next(); - this._destroyed.complete(); - }; - /** Focuses the menu item. Implements for FocusableOption. */ - /** - * Focuses the menu item. Implements for FocusableOption. - * @return {?} - */ - CdkTreeNode.prototype.focus = /** - * Focuses the menu item. Implements for FocusableOption. - * @return {?} - */ - function () { - this._elementRef.nativeElement.focus(); - }; - /** - * @protected - * @return {?} - */ - CdkTreeNode.prototype._setRoleFromData = /** - * @protected - * @return {?} - */ - function () { - var _this = this; - if (this._tree.treeControl.isExpandable) { - this.role = this._tree.treeControl.isExpandable(this._data) ? 'group' : 'treeitem'; - } - else { - if (!this._tree.treeControl.getChildren) { - throw getTreeControlFunctionsMissingError(); - } - /** @type {?} */ - var childrenNodes = this._tree.treeControl.getChildren(this._data); - if (Array.isArray(childrenNodes)) { - this._setRoleFromChildren((/** @type {?} */ (childrenNodes))); - } - else if (childrenNodes instanceof rxjs__WEBPACK_IMPORTED_MODULE_2__["Observable"]) { - childrenNodes.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["takeUntil"])(this._destroyed)) - .subscribe(function (children) { return _this._setRoleFromChildren(children); }); - } - } - }; - /** - * @protected - * @param {?} children - * @return {?} - */ - CdkTreeNode.prototype._setRoleFromChildren = /** - * @protected - * @param {?} children - * @return {?} - */ - function (children) { - this.role = children && children.length ? 'group' : 'treeitem'; - }; - /** - * The most recently created `CdkTreeNode`. We save it in static variable so we can retrieve it - * in `CdkTree` and set the data to it. - */ - CdkTreeNode.mostRecentTreeNode = null; - CdkTreeNode.decorators = [ - { type: _angular_core__WEBPACK_IMPORTED_MODULE_4__["Directive"], args: [{ - selector: 'cdk-tree-node', - exportAs: 'cdkTreeNode', - host: { - '[attr.aria-expanded]': 'isExpanded', - '[attr.aria-level]': 'role === "treeitem" ? level : null', - '[attr.role]': 'role', - 'class': 'cdk-tree-node', - }, - },] }, - ]; - /** @nocollapse */ - CdkTreeNode.ctorParameters = function () { return [ - { type: _angular_core__WEBPACK_IMPORTED_MODULE_4__["ElementRef"] }, - { type: CdkTree } - ]; }; - CdkTreeNode.propDecorators = { - role: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_4__["Input"] }] - }; - return CdkTreeNode; -}()); - -/** - * @fileoverview added by tsickle - * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc - */ -/** - * Nested node is a child of ``. It works with nested tree. - * By using `cdk-nested-tree-node` component in tree node template, children of the parent node will - * be added in the `cdkTreeNodeOutlet` in tree node template. - * For example: - * ```html - * - * {{node.name}} - * - * - * ``` - * The children of node will be automatically added to `cdkTreeNodeOutlet`, the result dom will be - * like this: - * ```html - * - * {{node.name}} - * {{child1.name}} - * {{child2.name}} - * - * ``` - * @template T - */ -var CdkNestedTreeNode = /** @class */ (function (_super) { - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__extends"])(CdkNestedTreeNode, _super); - function CdkNestedTreeNode(_elementRef, _tree, _differs) { - var _this = _super.call(this, _elementRef, _tree) || this; - _this._elementRef = _elementRef; - _this._tree = _tree; - _this._differs = _differs; - return _this; - } - /** - * @return {?} - */ - CdkNestedTreeNode.prototype.ngAfterContentInit = /** - * @return {?} - */ - function () { - var _this = this; - this._dataDiffer = this._differs.find([]).create(this._tree.trackBy); - if (!this._tree.treeControl.getChildren) { - throw getTreeControlFunctionsMissingError(); - } - /** @type {?} */ - var childrenNodes = this._tree.treeControl.getChildren(this.data); - if (Array.isArray(childrenNodes)) { - this.updateChildrenNodes((/** @type {?} */ (childrenNodes))); - } - else if (childrenNodes instanceof rxjs__WEBPACK_IMPORTED_MODULE_2__["Observable"]) { - childrenNodes.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["takeUntil"])(this._destroyed)) - .subscribe(function (result) { return _this.updateChildrenNodes(result); }); - } - this.nodeOutlet.changes.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["takeUntil"])(this._destroyed)) - .subscribe(function () { return _this.updateChildrenNodes(); }); - }; - /** - * @return {?} - */ - CdkNestedTreeNode.prototype.ngOnDestroy = /** - * @return {?} - */ - function () { - this._clear(); - _super.prototype.ngOnDestroy.call(this); - }; - /** Add children dataNodes to the NodeOutlet */ - /** - * Add children dataNodes to the NodeOutlet - * @protected - * @param {?=} children - * @return {?} - */ - CdkNestedTreeNode.prototype.updateChildrenNodes = /** - * Add children dataNodes to the NodeOutlet - * @protected - * @param {?=} children - * @return {?} - */ - function (children) { - /** @type {?} */ - var outlet = this._getNodeOutlet(); - if (children) { - this._children = children; - } - if (outlet && this._children) { - /** @type {?} */ - var viewContainer = outlet.viewContainer; - this._tree.renderNodeChanges(this._children, this._dataDiffer, viewContainer, this._data); - } - else { - // Reset the data differ if there's no children nodes displayed - this._dataDiffer.diff([]); - } - }; - /** Clear the children dataNodes. */ - /** - * Clear the children dataNodes. - * @protected - * @return {?} - */ - CdkNestedTreeNode.prototype._clear = /** - * Clear the children dataNodes. - * @protected - * @return {?} - */ - function () { - /** @type {?} */ - var outlet = this._getNodeOutlet(); - if (outlet) { - outlet.viewContainer.clear(); - this._dataDiffer.diff([]); - } - }; - /** Gets the outlet for the current node. */ - /** - * Gets the outlet for the current node. - * @private - * @return {?} - */ - CdkNestedTreeNode.prototype._getNodeOutlet = /** - * Gets the outlet for the current node. - * @private - * @return {?} - */ - function () { - var _this = this; - /** @type {?} */ - var outlets = this.nodeOutlet; - if (outlets) { - // Note that since we use `descendants: true` on the query, we have to ensure - // that we don't pick up the outlet of a child node by accident. - return outlets.find(function (outlet) { return !outlet._node || outlet._node === _this; }); - } - }; - CdkNestedTreeNode.decorators = [ - { type: _angular_core__WEBPACK_IMPORTED_MODULE_4__["Directive"], args: [{ - selector: 'cdk-nested-tree-node', - exportAs: 'cdkNestedTreeNode', - host: { - '[attr.aria-expanded]': 'isExpanded', - '[attr.role]': 'role', - 'class': 'cdk-tree-node cdk-nested-tree-node', - }, - providers: [ - { provide: CdkTreeNode, useExisting: CdkNestedTreeNode }, - { provide: CDK_TREE_NODE_OUTLET_NODE, useExisting: CdkNestedTreeNode } - ] - },] }, - ]; - /** @nocollapse */ - CdkNestedTreeNode.ctorParameters = function () { return [ - { type: _angular_core__WEBPACK_IMPORTED_MODULE_4__["ElementRef"] }, - { type: CdkTree }, - { type: _angular_core__WEBPACK_IMPORTED_MODULE_4__["IterableDiffers"] } - ]; }; - CdkNestedTreeNode.propDecorators = { - nodeOutlet: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_4__["ContentChildren"], args: [CdkTreeNodeOutlet, { - // We need to use `descendants: true`, because Ivy will no longer match - // indirect descendants if it's left as false. - descendants: true - },] }] - }; - return CdkNestedTreeNode; -}(CdkTreeNode)); - -/** - * @fileoverview added by tsickle - * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc - */ -/** - * Regex used to split a string on its CSS units. - * @type {?} - */ -var cssUnitPattern = /([A-Za-z%]+)$/; -/** - * Indent for the children tree dataNodes. - * This directive will add left-padding to the node to show hierarchy. - * @template T - */ -var CdkTreeNodePadding = /** @class */ (function () { - function CdkTreeNodePadding(_treeNode, _tree, _renderer, _element, _dir) { - var _this = this; - this._treeNode = _treeNode; - this._tree = _tree; - this._renderer = _renderer; - this._element = _element; - this._dir = _dir; - /** - * Subject that emits when the component has been destroyed. - */ - this._destroyed = new rxjs__WEBPACK_IMPORTED_MODULE_2__["Subject"](); - /** - * CSS units used for the indentation value. - */ - this.indentUnits = 'px'; - this._indent = 40; - this._setPadding(); - if (_dir) { - _dir.change.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["takeUntil"])(this._destroyed)).subscribe(function () { return _this._setPadding(true); }); - } - // In Ivy the indentation binding might be set before the tree node's data has been added, - // which means that we'll miss the first render. We have to subscribe to changes in the - // data to ensure that everything is up to date. - _treeNode._dataChanges.subscribe(function () { return _this._setPadding(); }); - } - Object.defineProperty(CdkTreeNodePadding.prototype, "level", { - /** The level of depth of the tree node. The padding will be `level * indent` pixels. */ - get: /** - * The level of depth of the tree node. The padding will be `level * indent` pixels. - * @return {?} - */ - function () { return this._level; }, - set: /** - * @param {?} value - * @return {?} - */ - function (value) { - this._level = Object(_angular_cdk_coercion__WEBPACK_IMPORTED_MODULE_6__["coerceNumberProperty"])(value); - this._setPadding(); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(CdkTreeNodePadding.prototype, "indent", { - /** - * The indent for each level. Can be a number or a CSS string. - * Default number 40px from material design menu sub-menu spec. - */ - get: /** - * The indent for each level. Can be a number or a CSS string. - * Default number 40px from material design menu sub-menu spec. - * @return {?} - */ - function () { return this._indent; }, - set: /** - * @param {?} indent - * @return {?} - */ - function (indent) { - /** @type {?} */ - var value = indent; - /** @type {?} */ - var units = 'px'; - if (typeof indent === 'string') { - /** @type {?} */ - var parts = indent.split(cssUnitPattern); - value = parts[0]; - units = parts[1] || units; - } - this.indentUnits = units; - this._indent = Object(_angular_cdk_coercion__WEBPACK_IMPORTED_MODULE_6__["coerceNumberProperty"])(value); - this._setPadding(); - }, - enumerable: true, - configurable: true - }); - /** - * @return {?} - */ - CdkTreeNodePadding.prototype.ngOnDestroy = /** - * @return {?} - */ - function () { - this._destroyed.next(); - this._destroyed.complete(); - }; - /** The padding indent value for the tree node. Returns a string with px numbers if not null. */ - /** - * The padding indent value for the tree node. Returns a string with px numbers if not null. - * @return {?} - */ - CdkTreeNodePadding.prototype._paddingIndent = /** - * The padding indent value for the tree node. Returns a string with px numbers if not null. - * @return {?} - */ - function () { - /** @type {?} */ - var nodeLevel = (this._treeNode.data && this._tree.treeControl.getLevel) - ? this._tree.treeControl.getLevel(this._treeNode.data) - : null; - /** @type {?} */ - var level = this._level || nodeLevel; - return level ? "" + level * this._indent + this.indentUnits : null; - }; - /** - * @param {?=} forceChange - * @return {?} - */ - CdkTreeNodePadding.prototype._setPadding = /** - * @param {?=} forceChange - * @return {?} - */ - function (forceChange) { - if (forceChange === void 0) { forceChange = false; } - /** @type {?} */ - var padding = this._paddingIndent(); - if (padding !== this._currentPadding || forceChange) { - /** @type {?} */ - var element = this._element.nativeElement; - /** @type {?} */ - var paddingProp = this._dir && this._dir.value === 'rtl' ? 'paddingRight' : 'paddingLeft'; - /** @type {?} */ - var resetProp = paddingProp === 'paddingLeft' ? 'paddingRight' : 'paddingLeft'; - this._renderer.setStyle(element, paddingProp, padding); - this._renderer.setStyle(element, resetProp, null); - this._currentPadding = padding; - } - }; - CdkTreeNodePadding.decorators = [ - { type: _angular_core__WEBPACK_IMPORTED_MODULE_4__["Directive"], args: [{ - selector: '[cdkTreeNodePadding]', - },] }, - ]; - /** @nocollapse */ - CdkTreeNodePadding.ctorParameters = function () { return [ - { type: CdkTreeNode }, - { type: CdkTree }, - { type: _angular_core__WEBPACK_IMPORTED_MODULE_4__["Renderer2"] }, - { type: _angular_core__WEBPACK_IMPORTED_MODULE_4__["ElementRef"] }, - { type: _angular_cdk_bidi__WEBPACK_IMPORTED_MODULE_5__["Directionality"], decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_4__["Optional"] }] } - ]; }; - CdkTreeNodePadding.propDecorators = { - level: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_4__["Input"], args: ['cdkTreeNodePadding',] }], - indent: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_4__["Input"], args: ['cdkTreeNodePaddingIndent',] }] - }; - return CdkTreeNodePadding; -}()); - -/** - * @fileoverview added by tsickle - * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc - */ -/** - * Node toggle to expand/collapse the node. - * @template T - */ -var CdkTreeNodeToggle = /** @class */ (function () { - function CdkTreeNodeToggle(_tree, _treeNode) { - this._tree = _tree; - this._treeNode = _treeNode; - this._recursive = false; - } - Object.defineProperty(CdkTreeNodeToggle.prototype, "recursive", { - /** Whether expand/collapse the node recursively. */ - get: /** - * Whether expand/collapse the node recursively. - * @return {?} - */ - function () { return this._recursive; }, - set: /** - * @param {?} value - * @return {?} - */ - function (value) { this._recursive = Object(_angular_cdk_coercion__WEBPACK_IMPORTED_MODULE_6__["coerceBooleanProperty"])(value); }, - enumerable: true, - configurable: true - }); - // We have to use a `HostListener` here in order to support both Ivy and ViewEngine. - // In Ivy the `host` bindings will be merged when this class is extended, whereas in - // ViewEngine they're overwritten. - // TODO(crisbeto): we move this back into `host` once Ivy is turned on by default. - // tslint:disable-next-line:no-host-decorator-in-concrete - // We have to use a `HostListener` here in order to support both Ivy and ViewEngine. - // In Ivy the `host` bindings will be merged when this class is extended, whereas in - // ViewEngine they're overwritten. - // TODO(crisbeto): we move this back into `host` once Ivy is turned on by default. - // tslint:disable-next-line:no-host-decorator-in-concrete - /** - * @param {?} event - * @return {?} - */ - CdkTreeNodeToggle.prototype._toggle = - // We have to use a `HostListener` here in order to support both Ivy and ViewEngine. - // In Ivy the `host` bindings will be merged when this class is extended, whereas in - // ViewEngine they're overwritten. - // TODO(crisbeto): we move this back into `host` once Ivy is turned on by default. - // tslint:disable-next-line:no-host-decorator-in-concrete - /** - * @param {?} event - * @return {?} - */ - function (event) { - this.recursive - ? this._tree.treeControl.toggleDescendants(this._treeNode.data) - : this._tree.treeControl.toggle(this._treeNode.data); - event.stopPropagation(); - }; - CdkTreeNodeToggle.decorators = [ - { type: _angular_core__WEBPACK_IMPORTED_MODULE_4__["Directive"], args: [{ selector: '[cdkTreeNodeToggle]' },] }, - ]; - /** @nocollapse */ - CdkTreeNodeToggle.ctorParameters = function () { return [ - { type: CdkTree }, - { type: CdkTreeNode } - ]; }; - CdkTreeNodeToggle.propDecorators = { - recursive: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_4__["Input"], args: ['cdkTreeNodeToggleRecursive',] }], - _toggle: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_4__["HostListener"], args: ['click', ['$event'],] }] - }; - return CdkTreeNodeToggle; -}()); - -/** - * @fileoverview added by tsickle - * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc - */ -/** @type {?} */ -var EXPORTED_DECLARATIONS = [ - CdkNestedTreeNode, - CdkTreeNodeDef, - CdkTreeNodePadding, - CdkTreeNodeToggle, - CdkTree, - CdkTreeNode, - CdkTreeNodeOutlet, -]; -var CdkTreeModule = /** @class */ (function () { - function CdkTreeModule() { - } - CdkTreeModule.decorators = [ - { type: _angular_core__WEBPACK_IMPORTED_MODULE_4__["NgModule"], args: [{ - imports: [_angular_common__WEBPACK_IMPORTED_MODULE_8__["CommonModule"]], - exports: EXPORTED_DECLARATIONS, - declarations: EXPORTED_DECLARATIONS, - providers: [_angular_cdk_a11y__WEBPACK_IMPORTED_MODULE_7__["FocusMonitor"], CdkTreeNodeDef] - },] }, - ]; - return CdkTreeModule; -}()); - -/** - * @fileoverview added by tsickle - * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc - */ - -/** - * @fileoverview added by tsickle - * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc - */ - - -//# sourceMappingURL=tree.es5.js.map - - -/***/ }), - -/***/ "./node_modules/@angular/common/fesm5/common.js": -/*!******************************************************!*\ - !*** ./node_modules/@angular/common/fesm5/common.js ***! - \******************************************************/ -/*! exports provided: ɵangular_packages_common_common_e, ɵangular_packages_common_common_d, ɵangular_packages_common_common_a, ɵangular_packages_common_common_b, ɵangular_packages_common_common_g, ɵangular_packages_common_common_f, ɵregisterLocaleData, registerLocaleData, formatDate, formatCurrency, formatNumber, formatPercent, NgLocaleLocalization, NgLocalization, Plural, NumberFormatStyle, FormStyle, TranslationWidth, FormatWidth, NumberSymbol, WeekDay, getNumberOfCurrencyDigits, getCurrencySymbol, getLocaleDayPeriods, getLocaleDayNames, getLocaleMonthNames, getLocaleId, getLocaleEraNames, getLocaleWeekEndRange, getLocaleFirstDayOfWeek, getLocaleDateFormat, getLocaleDateTimeFormat, getLocaleExtraDayPeriodRules, getLocaleExtraDayPeriods, getLocalePluralCase, getLocaleTimeFormat, getLocaleNumberSymbol, getLocaleNumberFormat, getLocaleCurrencyName, getLocaleCurrencySymbol, ɵparseCookieValue, CommonModule, DeprecatedI18NPipesModule, NgClass, NgForOf, NgForOfContext, NgIf, NgIfContext, NgPlural, NgPluralCase, NgStyle, NgSwitch, NgSwitchCase, NgSwitchDefault, NgTemplateOutlet, NgComponentOutlet, DOCUMENT, AsyncPipe, DatePipe, I18nPluralPipe, I18nSelectPipe, JsonPipe, LowerCasePipe, CurrencyPipe, DecimalPipe, PercentPipe, SlicePipe, UpperCasePipe, TitleCasePipe, KeyValuePipe, DeprecatedDatePipe, DeprecatedCurrencyPipe, DeprecatedDecimalPipe, DeprecatedPercentPipe, ɵPLATFORM_BROWSER_ID, ɵPLATFORM_SERVER_ID, ɵPLATFORM_WORKER_APP_ID, ɵPLATFORM_WORKER_UI_ID, isPlatformBrowser, isPlatformServer, isPlatformWorkerApp, isPlatformWorkerUi, VERSION, ViewportScroller, ɵNullViewportScroller, PlatformLocation, LOCATION_INITIALIZED, LocationStrategy, APP_BASE_HREF, HashLocationStrategy, PathLocationStrategy, Location */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_common_e", function() { return COMMON_DIRECTIVES; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_common_d", function() { return findLocaleData; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_common_a", function() { return DEPRECATED_PLURAL_FN; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_common_b", function() { return getPluralCase; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_common_g", function() { return COMMON_DEPRECATED_I18N_PIPES; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_common_f", function() { return COMMON_PIPES; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵregisterLocaleData", function() { return registerLocaleData; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "registerLocaleData", function() { return registerLocaleData; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "formatDate", function() { return formatDate; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "formatCurrency", function() { return formatCurrency; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "formatNumber", function() { return formatNumber; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "formatPercent", function() { return formatPercent; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgLocaleLocalization", function() { return NgLocaleLocalization; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgLocalization", function() { return NgLocalization; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Plural", function() { return Plural; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NumberFormatStyle", function() { return NumberFormatStyle; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormStyle", function() { return FormStyle; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TranslationWidth", function() { return TranslationWidth; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormatWidth", function() { return FormatWidth; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NumberSymbol", function() { return NumberSymbol; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WeekDay", function() { return WeekDay; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getNumberOfCurrencyDigits", function() { return getNumberOfCurrencyDigits; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getCurrencySymbol", function() { return getCurrencySymbol; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleDayPeriods", function() { return getLocaleDayPeriods; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleDayNames", function() { return getLocaleDayNames; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleMonthNames", function() { return getLocaleMonthNames; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleId", function() { return getLocaleId; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleEraNames", function() { return getLocaleEraNames; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleWeekEndRange", function() { return getLocaleWeekEndRange; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleFirstDayOfWeek", function() { return getLocaleFirstDayOfWeek; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleDateFormat", function() { return getLocaleDateFormat; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleDateTimeFormat", function() { return getLocaleDateTimeFormat; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleExtraDayPeriodRules", function() { return getLocaleExtraDayPeriodRules; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleExtraDayPeriods", function() { return getLocaleExtraDayPeriods; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocalePluralCase", function() { return getLocalePluralCase; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleTimeFormat", function() { return getLocaleTimeFormat; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleNumberSymbol", function() { return getLocaleNumberSymbol; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleNumberFormat", function() { return getLocaleNumberFormat; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleCurrencyName", function() { return getLocaleCurrencyName; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleCurrencySymbol", function() { return getLocaleCurrencySymbol; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵparseCookieValue", function() { return parseCookieValue; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CommonModule", function() { return CommonModule; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DeprecatedI18NPipesModule", function() { return DeprecatedI18NPipesModule; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgClass", function() { return NgClass; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgForOf", function() { return NgForOf; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgForOfContext", function() { return NgForOfContext; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgIf", function() { return NgIf; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgIfContext", function() { return NgIfContext; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgPlural", function() { return NgPlural; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgPluralCase", function() { return NgPluralCase; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgStyle", function() { return NgStyle; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgSwitch", function() { return NgSwitch; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgSwitchCase", function() { return NgSwitchCase; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgSwitchDefault", function() { return NgSwitchDefault; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgTemplateOutlet", function() { return NgTemplateOutlet; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgComponentOutlet", function() { return NgComponentOutlet; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DOCUMENT", function() { return DOCUMENT; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AsyncPipe", function() { return AsyncPipe; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DatePipe", function() { return DatePipe; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "I18nPluralPipe", function() { return I18nPluralPipe; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "I18nSelectPipe", function() { return I18nSelectPipe; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "JsonPipe", function() { return JsonPipe; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LowerCasePipe", function() { return LowerCasePipe; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CurrencyPipe", function() { return CurrencyPipe; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DecimalPipe", function() { return DecimalPipe; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PercentPipe", function() { return PercentPipe; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SlicePipe", function() { return SlicePipe; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UpperCasePipe", function() { return UpperCasePipe; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TitleCasePipe", function() { return TitleCasePipe; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "KeyValuePipe", function() { return KeyValuePipe; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DeprecatedDatePipe", function() { return DeprecatedDatePipe; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DeprecatedCurrencyPipe", function() { return DeprecatedCurrencyPipe; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DeprecatedDecimalPipe", function() { return DeprecatedDecimalPipe; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DeprecatedPercentPipe", function() { return DeprecatedPercentPipe; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵPLATFORM_BROWSER_ID", function() { return PLATFORM_BROWSER_ID; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵPLATFORM_SERVER_ID", function() { return PLATFORM_SERVER_ID; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵPLATFORM_WORKER_APP_ID", function() { return PLATFORM_WORKER_APP_ID; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵPLATFORM_WORKER_UI_ID", function() { return PLATFORM_WORKER_UI_ID; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isPlatformBrowser", function() { return isPlatformBrowser; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isPlatformServer", function() { return isPlatformServer; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isPlatformWorkerApp", function() { return isPlatformWorkerApp; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isPlatformWorkerUi", function() { return isPlatformWorkerUi; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VERSION", function() { return VERSION; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ViewportScroller", function() { return ViewportScroller; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵNullViewportScroller", function() { return NullViewportScroller; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PlatformLocation", function() { return PlatformLocation; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LOCATION_INITIALIZED", function() { return LOCATION_INITIALIZED; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LocationStrategy", function() { return LocationStrategy; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "APP_BASE_HREF", function() { return APP_BASE_HREF; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HashLocationStrategy", function() { return HashLocationStrategy; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PathLocationStrategy", function() { return PathLocationStrategy; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Location", function() { return Location; }); -/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); -/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); -/** - * @license Angular v7.2.13 - * (c) 2010-2019 Google LLC. https://angular.io/ - * License: MIT - */ - - - - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -/** - * This class should not be used directly by an application developer. Instead, use - * {@link Location}. - * - * `PlatformLocation` encapsulates all calls to DOM apis, which allows the Router to be platform - * agnostic. - * This means that we can have different implementation of `PlatformLocation` for the different - * platforms that angular supports. For example, `@angular/platform-browser` provides an - * implementation specific to the browser environment, while `@angular/platform-webworker` provides - * one suitable for use with web workers. - * - * The `PlatformLocation` class is used directly by all implementations of {@link LocationStrategy} - * when they need to interact with the DOM apis like pushState, popState, etc... - * - * {@link LocationStrategy} in turn is used by the {@link Location} service which is used directly - * by the {@link Router} in order to navigate between routes. Since all interactions between {@link - * Router} / - * {@link Location} / {@link LocationStrategy} and DOM apis flow through the `PlatformLocation` - * class they are all platform independent. - * - * @publicApi - */ -var PlatformLocation = /** @class */ (function () { - function PlatformLocation() { - } - return PlatformLocation; -}()); -/** - * @description - * Indicates when a location is initialized. - * - * @publicApi - */ -var LOCATION_INITIALIZED = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["InjectionToken"]('Location Initialized'); - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -/** - * `LocationStrategy` is responsible for representing and reading route state - * from the browser's URL. Angular provides two strategies: - * {@link HashLocationStrategy} and {@link PathLocationStrategy}. - * - * This is used under the hood of the {@link Location} service. - * - * Applications should use the {@link Router} or {@link Location} services to - * interact with application route state. - * - * For instance, {@link HashLocationStrategy} produces URLs like - * `http://example.com#/foo`, and {@link PathLocationStrategy} produces - * `http://example.com/foo` as an equivalent URL. - * - * See these two classes for more. - * - * @publicApi - */ -var LocationStrategy = /** @class */ (function () { - function LocationStrategy() { - } - return LocationStrategy; -}()); -/** - * A predefined [DI token](guide/glossary#di-token) for the base href - * to be used with the `PathLocationStrategy`. - * The base href is the URL prefix that should be preserved when generating - * and recognizing URLs. - * - * @usageNotes - * - * The following example shows how to use this token to configure the root app injector - * with a base href value, so that the DI framework can supply the dependency anywhere in the app. - * - * ```typescript - * import {Component, NgModule} from '@angular/core'; - * import {APP_BASE_HREF} from '@angular/common'; - * - * @NgModule({ - * providers: [{provide: APP_BASE_HREF, useValue: '/my/app'}] - * }) - * class AppModule {} - * ``` - * - * @publicApi - */ -var APP_BASE_HREF = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["InjectionToken"]('appBaseHref'); - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -/** - * @description - * - * A service that applications can use to interact with a browser's URL. - * - * Depending on the {@link LocationStrategy} used, `Location` will either persist - * to the URL's path or the URL's hash segment. - * - * @usageNotes - * - * It's better to use the {@link Router#navigate} service to trigger route changes. Use - * `Location` only if you need to interact with or create normalized URLs outside of - * routing. - * - * `Location` is responsible for normalizing the URL against the application's base href. - * A normalized URL is absolute from the URL host, includes the application's base href, and has no - * trailing slash: - * - `/my/app/user/123` is normalized - * - `my/app/user/123` **is not** normalized - * - `/my/app/user/123/` **is not** normalized - * - * ### Example - * - * {@example common/location/ts/path_location_component.ts region='LocationComponent'} - * - * @publicApi - */ -var Location = /** @class */ (function () { - function Location(platformStrategy) { - var _this = this; - /** @internal */ - this._subject = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"](); - this._platformStrategy = platformStrategy; - var browserBaseHref = this._platformStrategy.getBaseHref(); - this._baseHref = Location_1.stripTrailingSlash(_stripIndexHtml(browserBaseHref)); - this._platformStrategy.onPopState(function (ev) { - _this._subject.emit({ - 'url': _this.path(true), - 'pop': true, - 'state': ev.state, - 'type': ev.type, - }); - }); - } - Location_1 = Location; - /** - * Returns the normalized URL path. - * - * @param includeHash Whether path has an anchor fragment. - * - * @returns The normalized URL path. - */ - // TODO: vsavkin. Remove the boolean flag and always include hash once the deprecated router is - // removed. - Location.prototype.path = function (includeHash) { - if (includeHash === void 0) { includeHash = false; } - return this.normalize(this._platformStrategy.path(includeHash)); - }; - /** - * Normalizes the given path and compares to the current normalized path. - * - * @param path The given URL path - * @param query Query parameters - * - * @returns `true` if the given URL path is equal to the current normalized path, `false` - * otherwise. - */ - Location.prototype.isCurrentPathEqualTo = function (path, query) { - if (query === void 0) { query = ''; } - return this.path() == this.normalize(path + Location_1.normalizeQueryParams(query)); - }; - /** - * Given a string representing a URL, returns the URL path after stripping the - * trailing slashes. - * - * @param url String representing a URL. - * - * @returns Normalized URL string. - */ - Location.prototype.normalize = function (url) { - return Location_1.stripTrailingSlash(_stripBaseHref(this._baseHref, _stripIndexHtml(url))); - }; - /** - * Given a string representing a URL, returns the platform-specific external URL path. - * If the given URL doesn't begin with a leading slash (`'/'`), this method adds one - * before normalizing. This method also adds a hash if `HashLocationStrategy` is - * used, or the `APP_BASE_HREF` if the `PathLocationStrategy` is in use. - * - * - * @param url String representing a URL. - * - * @returns A normalized platform-specific URL. - */ - Location.prototype.prepareExternalUrl = function (url) { - if (url && url[0] !== '/') { - url = '/' + url; - } - return this._platformStrategy.prepareExternalUrl(url); - }; - // TODO: rename this method to pushState - /** - * Changes the browsers URL to a normalized version of the given URL, and pushes a - * new item onto the platform's history. - * - * @param path URL path to normalizze - * @param query Query parameters - * @param state Location history state - * - */ - Location.prototype.go = function (path, query, state) { - if (query === void 0) { query = ''; } - if (state === void 0) { state = null; } - this._platformStrategy.pushState(state, '', path, query); - }; - /** - * Changes the browser's URL to a normalized version of the given URL, and replaces - * the top item on the platform's history stack. - * - * @param path URL path to normalizze - * @param query Query parameters - * @param state Location history state - */ - Location.prototype.replaceState = function (path, query, state) { - if (query === void 0) { query = ''; } - if (state === void 0) { state = null; } - this._platformStrategy.replaceState(state, '', path, query); - }; - /** - * Navigates forward in the platform's history. - */ - Location.prototype.forward = function () { this._platformStrategy.forward(); }; - /** - * Navigates back in the platform's history. - */ - Location.prototype.back = function () { this._platformStrategy.back(); }; - /** - * Subscribe to the platform's `popState` events. - * - * @param value Event that is triggered when the state history changes. - * @param exception The exception to throw. - * - * @returns Subscribed events. - */ - Location.prototype.subscribe = function (onNext, onThrow, onReturn) { - return this._subject.subscribe({ next: onNext, error: onThrow, complete: onReturn }); - }; - /** - * Given a string of url parameters, prepend with `?` if needed, otherwise return the - * parameters as is. - * - * @param params String of URL parameters - * - * @returns URL parameters prepended with `?` or the parameters as is. - */ - Location.normalizeQueryParams = function (params) { - return params && params[0] !== '?' ? '?' + params : params; - }; - /** - * Given 2 parts of a URL, join them with a slash if needed. - * - * @param start URL string - * @param end URL string - * - * - * @returns Given URL strings joined with a slash, if needed. - */ - Location.joinWithSlash = function (start, end) { - if (start.length == 0) { - return end; - } - if (end.length == 0) { - return start; - } - var slashes = 0; - if (start.endsWith('/')) { - slashes++; - } - if (end.startsWith('/')) { - slashes++; - } - if (slashes == 2) { - return start + end.substring(1); - } - if (slashes == 1) { - return start + end; - } - return start + '/' + end; - }; - /** - * If URL has a trailing slash, remove it, otherwise return the URL as is. The - * method looks for the first occurrence of either `#`, `?`, or the end of the - * line as `/` characters and removes the trailing slash if one exists. - * - * @param url URL string - * - * @returns Returns a URL string after removing the trailing slash if one exists, otherwise - * returns the string as is. - */ - Location.stripTrailingSlash = function (url) { - var match = url.match(/#|\?|$/); - var pathEndIdx = match && match.index || url.length; - var droppedSlashIdx = pathEndIdx - (url[pathEndIdx - 1] === '/' ? 1 : 0); - return url.slice(0, droppedSlashIdx) + url.slice(pathEndIdx); - }; - var Location_1; - Location = Location_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"])(), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [LocationStrategy]) - ], Location); - return Location; -}()); -function _stripBaseHref(baseHref, url) { - return baseHref && url.startsWith(baseHref) ? url.substring(baseHref.length) : url; -} -function _stripIndexHtml(url) { - return url.replace(/\/index.html$/, ''); -} - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -/** - * @description - * A {@link LocationStrategy} used to configure the {@link Location} service to - * represent its state in the - * [hash fragment](https://en.wikipedia.org/wiki/Uniform_Resource_Locator#Syntax) - * of the browser's URL. - * - * For instance, if you call `location.go('/foo')`, the browser's URL will become - * `example.com#/foo`. - * - * @usageNotes - * - * ### Example - * - * {@example common/location/ts/hash_location_component.ts region='LocationComponent'} - * - * @publicApi - */ -var HashLocationStrategy = /** @class */ (function (_super) { - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__extends"])(HashLocationStrategy, _super); - function HashLocationStrategy(_platformLocation, _baseHref) { - var _this = _super.call(this) || this; - _this._platformLocation = _platformLocation; - _this._baseHref = ''; - if (_baseHref != null) { - _this._baseHref = _baseHref; - } - return _this; - } - HashLocationStrategy.prototype.onPopState = function (fn) { - this._platformLocation.onPopState(fn); - this._platformLocation.onHashChange(fn); - }; - HashLocationStrategy.prototype.getBaseHref = function () { return this._baseHref; }; - HashLocationStrategy.prototype.path = function (includeHash) { - if (includeHash === void 0) { includeHash = false; } - // the hash value is always prefixed with a `#` - // and if it is empty then it will stay empty - var path = this._platformLocation.hash; - if (path == null) - path = '#'; - return path.length > 0 ? path.substring(1) : path; - }; - HashLocationStrategy.prototype.prepareExternalUrl = function (internal) { - var url = Location.joinWithSlash(this._baseHref, internal); - return url.length > 0 ? ('#' + url) : url; - }; - HashLocationStrategy.prototype.pushState = function (state, title, path, queryParams) { - var url = this.prepareExternalUrl(path + Location.normalizeQueryParams(queryParams)); - if (url.length == 0) { - url = this._platformLocation.pathname; - } - this._platformLocation.pushState(state, title, url); - }; - HashLocationStrategy.prototype.replaceState = function (state, title, path, queryParams) { - var url = this.prepareExternalUrl(path + Location.normalizeQueryParams(queryParams)); - if (url.length == 0) { - url = this._platformLocation.pathname; - } - this._platformLocation.replaceState(state, title, url); - }; - HashLocationStrategy.prototype.forward = function () { this._platformLocation.forward(); }; - HashLocationStrategy.prototype.back = function () { this._platformLocation.back(); }; - HashLocationStrategy = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"])(), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__param"])(1, Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__param"])(1, Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"])(APP_BASE_HREF)), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [PlatformLocation, String]) - ], HashLocationStrategy); - return HashLocationStrategy; -}(LocationStrategy)); - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -/** - * @description - * A {@link LocationStrategy} used to configure the {@link Location} service to - * represent its state in the - * [path](https://en.wikipedia.org/wiki/Uniform_Resource_Locator#Syntax) of the - * browser's URL. - * - * If you're using `PathLocationStrategy`, you must provide a {@link APP_BASE_HREF} - * or add a base element to the document. This URL prefix that will be preserved - * when generating and recognizing URLs. - * - * For instance, if you provide an `APP_BASE_HREF` of `'/my/app'` and call - * `location.go('/foo')`, the browser's URL will become - * `example.com/my/app/foo`. - * - * Similarly, if you add `` to the document and call - * `location.go('/foo')`, the browser's URL will become - * `example.com/my/app/foo`. - * - * @usageNotes - * - * ### Example - * - * {@example common/location/ts/path_location_component.ts region='LocationComponent'} - * - * @publicApi - */ -var PathLocationStrategy = /** @class */ (function (_super) { - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__extends"])(PathLocationStrategy, _super); - function PathLocationStrategy(_platformLocation, href) { - var _this = _super.call(this) || this; - _this._platformLocation = _platformLocation; - if (href == null) { - href = _this._platformLocation.getBaseHrefFromDOM(); - } - if (href == null) { - throw new Error("No base href set. Please provide a value for the APP_BASE_HREF token or add a base element to the document."); - } - _this._baseHref = href; - return _this; - } - PathLocationStrategy.prototype.onPopState = function (fn) { - this._platformLocation.onPopState(fn); - this._platformLocation.onHashChange(fn); - }; - PathLocationStrategy.prototype.getBaseHref = function () { return this._baseHref; }; - PathLocationStrategy.prototype.prepareExternalUrl = function (internal) { - return Location.joinWithSlash(this._baseHref, internal); - }; - PathLocationStrategy.prototype.path = function (includeHash) { - if (includeHash === void 0) { includeHash = false; } - var pathname = this._platformLocation.pathname + - Location.normalizeQueryParams(this._platformLocation.search); - var hash = this._platformLocation.hash; - return hash && includeHash ? "" + pathname + hash : pathname; - }; - PathLocationStrategy.prototype.pushState = function (state, title, url, queryParams) { - var externalUrl = this.prepareExternalUrl(url + Location.normalizeQueryParams(queryParams)); - this._platformLocation.pushState(state, title, externalUrl); - }; - PathLocationStrategy.prototype.replaceState = function (state, title, url, queryParams) { - var externalUrl = this.prepareExternalUrl(url + Location.normalizeQueryParams(queryParams)); - this._platformLocation.replaceState(state, title, externalUrl); - }; - PathLocationStrategy.prototype.forward = function () { this._platformLocation.forward(); }; - PathLocationStrategy.prototype.back = function () { this._platformLocation.back(); }; - PathLocationStrategy = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"])(), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__param"])(1, Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__param"])(1, Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"])(APP_BASE_HREF)), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [PlatformLocation, String]) - ], PathLocationStrategy); - return PathLocationStrategy; -}(LocationStrategy)); - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -// THIS CODE IS GENERATED - DO NOT MODIFY -// See angular/tools/gulp-tasks/cldr/extract.js -var u = undefined; -function plural(n) { - var i = Math.floor(Math.abs(n)), v = n.toString().replace(/^[^.]*\.?/, '').length; - if (i === 1 && v === 0) - return 1; - return 5; -} -var localeEn = [ - 'en', [['a', 'p'], ['AM', 'PM'], u], [['AM', 'PM'], u, u], - [ - ['S', 'M', 'T', 'W', 'T', 'F', 'S'], ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], - ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], - ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'] - ], - u, - [ - ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'], - ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], - [ - 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', - 'October', 'November', 'December' - ] - ], - u, [['B', 'A'], ['BC', 'AD'], ['Before Christ', 'Anno Domini']], 0, [6, 0], - ['M/d/yy', 'MMM d, y', 'MMMM d, y', 'EEEE, MMMM d, y'], - ['h:mm a', 'h:mm:ss a', 'h:mm:ss a z', 'h:mm:ss a zzzz'], ['{1}, {0}', u, '{1} \'at\' {0}', u], - ['.', ',', ';', '%', '+', '-', 'E', '×', '‰', '∞', 'NaN', ':'], - ['#,##0.###', '#,##0%', '¤#,##0.00', '#E0'], '$', 'US Dollar', {}, plural -]; - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -/** - * @publicApi - */ -var LOCALE_DATA = {}; -/** - * Register global data to be used internally by Angular. See the - * ["I18n guide"](guide/i18n#i18n-pipes) to know how to import additional locale data. - * - * @publicApi - */ -// The signature registerLocaleData(data: any, extraData?: any) is deprecated since v5.1 -function registerLocaleData(data, localeId, extraData) { - if (typeof localeId !== 'string') { - extraData = localeId; - localeId = data[0 /* LocaleId */]; - } - localeId = localeId.toLowerCase().replace(/_/g, '-'); - LOCALE_DATA[localeId] = data; - if (extraData) { - LOCALE_DATA[localeId][19 /* ExtraData */] = extraData; - } -} - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -/** @internal */ -var CURRENCIES_EN = { - 'ADP': [undefined, undefined, 0], - 'AFN': [undefined, undefined, 0], - 'ALL': [undefined, undefined, 0], - 'AMD': [undefined, undefined, 0], - 'AOA': [undefined, 'Kz'], - 'ARS': [undefined, '$'], - 'AUD': ['A$', '$'], - 'BAM': [undefined, 'KM'], - 'BBD': [undefined, '$'], - 'BDT': [undefined, '৳'], - 'BHD': [undefined, undefined, 3], - 'BIF': [undefined, undefined, 0], - 'BMD': [undefined, '$'], - 'BND': [undefined, '$'], - 'BOB': [undefined, 'Bs'], - 'BRL': ['R$'], - 'BSD': [undefined, '$'], - 'BWP': [undefined, 'P'], - 'BYN': [undefined, 'р.', 2], - 'BYR': [undefined, undefined, 0], - 'BZD': [undefined, '$'], - 'CAD': ['CA$', '$', 2], - 'CHF': [undefined, undefined, 2], - 'CLF': [undefined, undefined, 4], - 'CLP': [undefined, '$', 0], - 'CNY': ['CN¥', '¥'], - 'COP': [undefined, '$', 0], - 'CRC': [undefined, '₡', 2], - 'CUC': [undefined, '$'], - 'CUP': [undefined, '$'], - 'CZK': [undefined, 'Kč', 2], - 'DJF': [undefined, undefined, 0], - 'DKK': [undefined, 'kr', 2], - 'DOP': [undefined, '$'], - 'EGP': [undefined, 'E£'], - 'ESP': [undefined, '₧', 0], - 'EUR': ['€'], - 'FJD': [undefined, '$'], - 'FKP': [undefined, '£'], - 'GBP': ['£'], - 'GEL': [undefined, '₾'], - 'GIP': [undefined, '£'], - 'GNF': [undefined, 'FG', 0], - 'GTQ': [undefined, 'Q'], - 'GYD': [undefined, '$', 0], - 'HKD': ['HK$', '$'], - 'HNL': [undefined, 'L'], - 'HRK': [undefined, 'kn'], - 'HUF': [undefined, 'Ft', 2], - 'IDR': [undefined, 'Rp', 0], - 'ILS': ['₪'], - 'INR': ['₹'], - 'IQD': [undefined, undefined, 0], - 'IRR': [undefined, undefined, 0], - 'ISK': [undefined, 'kr', 0], - 'ITL': [undefined, undefined, 0], - 'JMD': [undefined, '$'], - 'JOD': [undefined, undefined, 3], - 'JPY': ['¥', undefined, 0], - 'KHR': [undefined, '៛'], - 'KMF': [undefined, 'CF', 0], - 'KPW': [undefined, '₩', 0], - 'KRW': ['₩', undefined, 0], - 'KWD': [undefined, undefined, 3], - 'KYD': [undefined, '$'], - 'KZT': [undefined, '₸'], - 'LAK': [undefined, '₭', 0], - 'LBP': [undefined, 'L£', 0], - 'LKR': [undefined, 'Rs'], - 'LRD': [undefined, '$'], - 'LTL': [undefined, 'Lt'], - 'LUF': [undefined, undefined, 0], - 'LVL': [undefined, 'Ls'], - 'LYD': [undefined, undefined, 3], - 'MGA': [undefined, 'Ar', 0], - 'MGF': [undefined, undefined, 0], - 'MMK': [undefined, 'K', 0], - 'MNT': [undefined, '₮', 0], - 'MRO': [undefined, undefined, 0], - 'MUR': [undefined, 'Rs', 0], - 'MXN': ['MX$', '$'], - 'MYR': [undefined, 'RM'], - 'NAD': [undefined, '$'], - 'NGN': [undefined, '₦'], - 'NIO': [undefined, 'C$'], - 'NOK': [undefined, 'kr', 2], - 'NPR': [undefined, 'Rs'], - 'NZD': ['NZ$', '$'], - 'OMR': [undefined, undefined, 3], - 'PHP': [undefined, '₱'], - 'PKR': [undefined, 'Rs', 0], - 'PLN': [undefined, 'zł'], - 'PYG': [undefined, '₲', 0], - 'RON': [undefined, 'lei'], - 'RSD': [undefined, undefined, 0], - 'RUB': [undefined, '₽'], - 'RUR': [undefined, 'р.'], - 'RWF': [undefined, 'RF', 0], - 'SBD': [undefined, '$'], - 'SEK': [undefined, 'kr', 2], - 'SGD': [undefined, '$'], - 'SHP': [undefined, '£'], - 'SLL': [undefined, undefined, 0], - 'SOS': [undefined, undefined, 0], - 'SRD': [undefined, '$'], - 'SSP': [undefined, '£'], - 'STD': [undefined, undefined, 0], - 'STN': [undefined, 'Db'], - 'SYP': [undefined, '£', 0], - 'THB': [undefined, '฿'], - 'TMM': [undefined, undefined, 0], - 'TND': [undefined, undefined, 3], - 'TOP': [undefined, 'T$'], - 'TRL': [undefined, undefined, 0], - 'TRY': [undefined, '₺'], - 'TTD': [undefined, '$'], - 'TWD': ['NT$', '$', 2], - 'TZS': [undefined, undefined, 0], - 'UAH': [undefined, '₴'], - 'UGX': [undefined, undefined, 0], - 'USD': ['$'], - 'UYI': [undefined, undefined, 0], - 'UYU': [undefined, '$'], - 'UZS': [undefined, undefined, 0], - 'VEF': [undefined, 'Bs'], - 'VND': ['₫', undefined, 0], - 'VUV': [undefined, undefined, 0], - 'XAF': ['FCFA', undefined, 0], - 'XCD': ['EC$', '$'], - 'XOF': ['CFA', undefined, 0], - 'XPF': ['CFPF', undefined, 0], - 'YER': [undefined, undefined, 0], - 'ZAR': [undefined, 'R'], - 'ZMK': [undefined, undefined, 0], - 'ZMW': [undefined, 'ZK'], - 'ZWD': [undefined, undefined, 0] -}; - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -/** - * Format styles that can be used to represent numbers. - * @see `getLocaleNumberFormat()`. - * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n) - * - * @publicApi - */ -var NumberFormatStyle; -(function (NumberFormatStyle) { - NumberFormatStyle[NumberFormatStyle["Decimal"] = 0] = "Decimal"; - NumberFormatStyle[NumberFormatStyle["Percent"] = 1] = "Percent"; - NumberFormatStyle[NumberFormatStyle["Currency"] = 2] = "Currency"; - NumberFormatStyle[NumberFormatStyle["Scientific"] = 3] = "Scientific"; -})(NumberFormatStyle || (NumberFormatStyle = {})); -/** - * Plurality cases used for translating plurals to different languages. - * - * @see `NgPlural` - * @see `NgPluralCase` - * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n) - * - * @publicApi */ -var Plural; -(function (Plural) { - Plural[Plural["Zero"] = 0] = "Zero"; - Plural[Plural["One"] = 1] = "One"; - Plural[Plural["Two"] = 2] = "Two"; - Plural[Plural["Few"] = 3] = "Few"; - Plural[Plural["Many"] = 4] = "Many"; - Plural[Plural["Other"] = 5] = "Other"; -})(Plural || (Plural = {})); -/** - * Context-dependant translation forms for strings. - * Typically the standalone version is for the nominative form of the word, - * and the format version is used for the genitive case. - * @see [CLDR website](http://cldr.unicode.org/translation/date-time#TOC-Stand-Alone-vs.-Format-Styles) - * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n) - * - * @publicApi - */ -var FormStyle; -(function (FormStyle) { - FormStyle[FormStyle["Format"] = 0] = "Format"; - FormStyle[FormStyle["Standalone"] = 1] = "Standalone"; -})(FormStyle || (FormStyle = {})); -/** - * String widths available for translations. - * The specific character widths are locale-specific. - * Examples are given for the word "Sunday" in English. - * - * @publicApi - */ -var TranslationWidth; -(function (TranslationWidth) { - /** 1 character for `en-US`. For example: 'S' */ - TranslationWidth[TranslationWidth["Narrow"] = 0] = "Narrow"; - /** 3 characters for `en-US`. For example: 'Sun' */ - TranslationWidth[TranslationWidth["Abbreviated"] = 1] = "Abbreviated"; - /** Full length for `en-US`. For example: "Sunday" */ - TranslationWidth[TranslationWidth["Wide"] = 2] = "Wide"; - /** 2 characters for `en-US`, For example: "Su" */ - TranslationWidth[TranslationWidth["Short"] = 3] = "Short"; -})(TranslationWidth || (TranslationWidth = {})); -/** - * String widths available for date-time formats. - * The specific character widths are locale-specific. - * Examples are given for `en-US`. - * - * @see `getLocaleDateFormat()` - * @see `getLocaleTimeFormat()`` - * @see `getLocaleDateTimeFormat()` - * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n) - * @publicApi - */ -var FormatWidth; -(function (FormatWidth) { - /** - * For `en-US`, 'M/d/yy, h:mm a'` - * (Example: `6/15/15, 9:03 AM`) - */ - FormatWidth[FormatWidth["Short"] = 0] = "Short"; - /** - * For `en-US`, `'MMM d, y, h:mm:ss a'` - * (Example: `Jun 15, 2015, 9:03:01 AM`) - */ - FormatWidth[FormatWidth["Medium"] = 1] = "Medium"; - /** - * For `en-US`, `'MMMM d, y, h:mm:ss a z'` - * (Example: `June 15, 2015 at 9:03:01 AM GMT+1`) - */ - FormatWidth[FormatWidth["Long"] = 2] = "Long"; - /** - * For `en-US`, `'EEEE, MMMM d, y, h:mm:ss a zzzz'` - * (Example: `Monday, June 15, 2015 at 9:03:01 AM GMT+01:00`) - */ - FormatWidth[FormatWidth["Full"] = 3] = "Full"; -})(FormatWidth || (FormatWidth = {})); -/** - * Symbols that can be used to replace placeholders in number patterns. - * Examples are based on `en-US` values. - * - * @see `getLocaleNumberSymbol()` - * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n) - * - * @publicApi - */ -var NumberSymbol; -(function (NumberSymbol) { - /** - * Decimal separator. - * For `en-US`, the dot character. - * Example : 2,345`.`67 - */ - NumberSymbol[NumberSymbol["Decimal"] = 0] = "Decimal"; - /** - * Grouping separator, typically for thousands. - * For `en-US`, the comma character. - * Example: 2`,`345.67 - */ - NumberSymbol[NumberSymbol["Group"] = 1] = "Group"; - /** - * List-item separator. - * Example: "one, two, and three" - */ - NumberSymbol[NumberSymbol["List"] = 2] = "List"; - /** - * Sign for percentage (out of 100). - * Example: 23.4% - */ - NumberSymbol[NumberSymbol["PercentSign"] = 3] = "PercentSign"; - /** - * Sign for positive numbers. - * Example: +23 - */ - NumberSymbol[NumberSymbol["PlusSign"] = 4] = "PlusSign"; - /** - * Sign for negative numbers. - * Example: -23 - */ - NumberSymbol[NumberSymbol["MinusSign"] = 5] = "MinusSign"; - /** - * Computer notation for exponential value (n times a power of 10). - * Example: 1.2E3 - */ - NumberSymbol[NumberSymbol["Exponential"] = 6] = "Exponential"; - /** - * Human-readable format of exponential. - * Example: 1.2x103 - */ - NumberSymbol[NumberSymbol["SuperscriptingExponent"] = 7] = "SuperscriptingExponent"; - /** - * Sign for permille (out of 1000). - * Example: 23.4‰ - */ - NumberSymbol[NumberSymbol["PerMille"] = 8] = "PerMille"; - /** - * Infinity, can be used with plus and minus. - * Example: ∞, +∞, -∞ - */ - NumberSymbol[NumberSymbol["Infinity"] = 9] = "Infinity"; - /** - * Not a number. - * Example: NaN - */ - NumberSymbol[NumberSymbol["NaN"] = 10] = "NaN"; - /** - * Symbol used between time units. - * Example: 10:52 - */ - NumberSymbol[NumberSymbol["TimeSeparator"] = 11] = "TimeSeparator"; - /** - * Decimal separator for currency values (fallback to `Decimal`). - * Example: $2,345.67 - */ - NumberSymbol[NumberSymbol["CurrencyDecimal"] = 12] = "CurrencyDecimal"; - /** - * Group separator for currency values (fallback to `Group`). - * Example: $2,345.67 - */ - NumberSymbol[NumberSymbol["CurrencyGroup"] = 13] = "CurrencyGroup"; -})(NumberSymbol || (NumberSymbol = {})); -/** - * The value for each day of the week, based on the `en-US` locale - * - * @publicApi - */ -var WeekDay; -(function (WeekDay) { - WeekDay[WeekDay["Sunday"] = 0] = "Sunday"; - WeekDay[WeekDay["Monday"] = 1] = "Monday"; - WeekDay[WeekDay["Tuesday"] = 2] = "Tuesday"; - WeekDay[WeekDay["Wednesday"] = 3] = "Wednesday"; - WeekDay[WeekDay["Thursday"] = 4] = "Thursday"; - WeekDay[WeekDay["Friday"] = 5] = "Friday"; - WeekDay[WeekDay["Saturday"] = 6] = "Saturday"; -})(WeekDay || (WeekDay = {})); -/** - * Retrieves the locale ID from the currently loaded locale. - * The loaded locale could be, for example, a global one rather than a regional one. - * @param locale A locale code, such as `fr-FR`. - * @returns The locale code. For example, `fr`. - * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n) - * - * @publicApi - */ -function getLocaleId(locale) { - return findLocaleData(locale)[0 /* LocaleId */]; -} -/** - * Retrieves day period strings for the given locale. - * - * @param locale A locale code for the locale format rules to use. - * @param formStyle The required grammatical form. - * @param width The required character width. - * @returns An array of localized period strings. For example, `[AM, PM]` for `en-US`. - * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n) - * - * @publicApi - */ -function getLocaleDayPeriods(locale, formStyle, width) { - var data = findLocaleData(locale); - var amPmData = [data[1 /* DayPeriodsFormat */], data[2 /* DayPeriodsStandalone */]]; - var amPm = getLastDefinedValue(amPmData, formStyle); - return getLastDefinedValue(amPm, width); -} -/** - * Retrieves days of the week for the given locale, using the Gregorian calendar. - * - * @param locale A locale code for the locale format rules to use. - * @param formStyle The required grammatical form. - * @param width The required character width. - * @returns An array of localized name strings. - * For example,`[Sunday, Monday, ... Saturday]` for `en-US`. - * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n) - * - * @publicApi - */ -function getLocaleDayNames(locale, formStyle, width) { - var data = findLocaleData(locale); - var daysData = [data[3 /* DaysFormat */], data[4 /* DaysStandalone */]]; - var days = getLastDefinedValue(daysData, formStyle); - return getLastDefinedValue(days, width); -} -/** - * Retrieves months of the year for the given locale, using the Gregorian calendar. - * - * @param locale A locale code for the locale format rules to use. - * @param formStyle The required grammatical form. - * @param width The required character width. - * @returns An array of localized name strings. - * For example, `[January, February, ...]` for `en-US`. - * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n) - * - * @publicApi - */ -function getLocaleMonthNames(locale, formStyle, width) { - var data = findLocaleData(locale); - var monthsData = [data[5 /* MonthsFormat */], data[6 /* MonthsStandalone */]]; - var months = getLastDefinedValue(monthsData, formStyle); - return getLastDefinedValue(months, width); -} -/** - * Retrieves Gregorian-calendar eras for the given locale. - * @param locale A locale code for the locale format rules to use. - * @param formStyle The required grammatical form. - * @param width The required character width. - - * @returns An array of localized era strings. - * For example, `[AD, BC]` for `en-US`. - * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n) - * - * @publicApi - */ -function getLocaleEraNames(locale, width) { - var data = findLocaleData(locale); - var erasData = data[7 /* Eras */]; - return getLastDefinedValue(erasData, width); -} -/** - * Retrieves the first day of the week for the given locale. - * - * @param locale A locale code for the locale format rules to use. - * @returns A day index number, using the 0-based week-day index for `en-US` - * (Sunday = 0, Monday = 1, ...). - * For example, for `fr-FR`, returns 1 to indicate that the first day is Monday. - * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n) - * - * @publicApi - */ -function getLocaleFirstDayOfWeek(locale) { - var data = findLocaleData(locale); - return data[8 /* FirstDayOfWeek */]; -} -/** - * Range of week days that are considered the week-end for the given locale. - * - * @param locale A locale code for the locale format rules to use. - * @returns The range of day values, `[startDay, endDay]`. - * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n) - * - * @publicApi - */ -function getLocaleWeekEndRange(locale) { - var data = findLocaleData(locale); - return data[9 /* WeekendRange */]; -} -/** - * Retrieves a localized date-value formating string. - * - * @param locale A locale code for the locale format rules to use. - * @param width The format type. - * @returns The localized formating string. - * @see `FormatWidth` - * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n) - * - * @publicApi - */ -function getLocaleDateFormat(locale, width) { - var data = findLocaleData(locale); - return getLastDefinedValue(data[10 /* DateFormat */], width); -} -/** - * Retrieves a localized time-value formatting string. - * - * @param locale A locale code for the locale format rules to use. - * @param width The format type. - * @returns The localized formatting string. - * @see `FormatWidth` - * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n) - - * @publicApi - */ -function getLocaleTimeFormat(locale, width) { - var data = findLocaleData(locale); - return getLastDefinedValue(data[11 /* TimeFormat */], width); -} -/** - * Retrieves a localized date-time formatting string. - * - * @param locale A locale code for the locale format rules to use. - * @param width The format type. - * @returns The localized formatting string. - * @see `FormatWidth` - * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n) - * - * @publicApi - */ -function getLocaleDateTimeFormat(locale, width) { - var data = findLocaleData(locale); - var dateTimeFormatData = data[12 /* DateTimeFormat */]; - return getLastDefinedValue(dateTimeFormatData, width); -} -/** - * Retrieves a localized number symbol that can be used to replace placeholders in number formats. - * @param locale The locale code. - * @param symbol The symbol to localize. - * @returns The character for the localized symbol. - * @see `NumberSymbol` - * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n) - * - * @publicApi - */ -function getLocaleNumberSymbol(locale, symbol) { - var data = findLocaleData(locale); - var res = data[13 /* NumberSymbols */][symbol]; - if (typeof res === 'undefined') { - if (symbol === NumberSymbol.CurrencyDecimal) { - return data[13 /* NumberSymbols */][NumberSymbol.Decimal]; - } - else if (symbol === NumberSymbol.CurrencyGroup) { - return data[13 /* NumberSymbols */][NumberSymbol.Group]; - } - } - return res; -} -/** - * Retrieves a number format for a given locale. - * - * Numbers are formatted using patterns, like `#,###.00`. For example, the pattern `#,###.00` - * when used to format the number 12345.678 could result in "12'345,678". That would happen if the - * grouping separator for your language is an apostrophe, and the decimal separator is a comma. - * - * Important: The characters `.` `,` `0` `#` (and others below) are special placeholders - * that stand for the decimal separator, and so on, and are NOT real characters. - * You must NOT "translate" the placeholders. For example, don't change `.` to `,` even though in - * your language the decimal point is written with a comma. The symbols should be replaced by the - * local equivalents, using the appropriate `NumberSymbol` for your language. - * - * Here are the special characters used in number patterns: - * - * | Symbol | Meaning | - * |--------|---------| - * | . | Replaced automatically by the character used for the decimal point. | - * | , | Replaced by the "grouping" (thousands) separator. | - * | 0 | Replaced by a digit (or zero if there aren't enough digits). | - * | # | Replaced by a digit (or nothing if there aren't enough). | - * | ¤ | Replaced by a currency symbol, such as $ or USD. | - * | % | Marks a percent format. The % symbol may change position, but must be retained. | - * | E | Marks a scientific format. The E symbol may change position, but must be retained. | - * | ' | Special characters used as literal characters are quoted with ASCII single quotes. | - * - * @param locale A locale code for the locale format rules to use. - * @param type The type of numeric value to be formatted (such as `Decimal` or `Currency`.) - * @returns The localized format string. - * @see `NumberFormatStyle` - * @see [CLDR website](http://cldr.unicode.org/translation/number-patterns) - * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n) - * - * @publicApi - */ -function getLocaleNumberFormat(locale, type) { - var data = findLocaleData(locale); - return data[14 /* NumberFormats */][type]; -} -/** - * Retrieves the symbol used to represent the currency for the main country - * corresponding to a given locale. For example, '$' for `en-US`. - * - * @param locale A locale code for the locale format rules to use. - * @returns The localized symbol character, - * or `null` if the main country cannot be determined. - * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n) - * - * @publicApi - */ -function getLocaleCurrencySymbol(locale) { - var data = findLocaleData(locale); - return data[15 /* CurrencySymbol */] || null; -} -/** - * Retrieves the name of the currency for the main country corresponding - * to a given locale. For example, 'US Dollar' for `en-US`. - * @param locale A locale code for the locale format rules to use. - * @returns The currency name, - * or `null` if the main country cannot be determined. - * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n) - * - * @publicApi - */ -function getLocaleCurrencyName(locale) { - var data = findLocaleData(locale); - return data[16 /* CurrencyName */] || null; -} -/** - * Retrieves the currency values for a given locale. - * @param locale A locale code for the locale format rules to use. - * @returns The currency values. - * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n) - */ -function getLocaleCurrencies(locale) { - var data = findLocaleData(locale); - return data[17 /* Currencies */]; -} -/** - * Retrieves the plural function used by ICU expressions to determine the plural case to use - * for a given locale. - * @param locale A locale code for the locale format rules to use. - * @returns The plural function for the locale. - * @see `NgPlural` - * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n) - * - * @publicApi - */ -function getLocalePluralCase(locale) { - var data = findLocaleData(locale); - return data[18 /* PluralCase */]; -} -function checkFullData(data) { - if (!data[19 /* ExtraData */]) { - throw new Error("Missing extra locale data for the locale \"" + data[0 /* LocaleId */] + "\". Use \"registerLocaleData\" to load new data. See the \"I18n guide\" on angular.io to know more."); - } -} -/** - * Retrieves locale-specific rules used to determine which day period to use - * when more than one period is defined for a locale. - * - * There is a rule for each defined day period. The - * first rule is applied to the first day period and so on. - * Fall back to AM/PM when no rules are available. - * - * A rule can specify a period as time range, or as a single time value. - * - * This functionality is only available when you have loaded the full locale data. - * See the ["I18n guide"](guide/i18n#i18n-pipes). - * - * @param locale A locale code for the locale format rules to use. - * @returns The rules for the locale, a single time value or array of *from-time, to-time*, - * or null if no periods are available. - * - * @see `getLocaleExtraDayPeriods()` - * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n) - * - * @publicApi - */ -function getLocaleExtraDayPeriodRules(locale) { - var data = findLocaleData(locale); - checkFullData(data); - var rules = data[19 /* ExtraData */][2 /* ExtraDayPeriodsRules */] || []; - return rules.map(function (rule) { - if (typeof rule === 'string') { - return extractTime(rule); - } - return [extractTime(rule[0]), extractTime(rule[1])]; - }); -} -/** - * Retrieves locale-specific day periods, which indicate roughly how a day is broken up - * in different languages. - * For example, for `en-US`, periods are morning, noon, afternoon, evening, and midnight. - * - * This functionality is only available when you have loaded the full locale data. - * See the ["I18n guide"](guide/i18n#i18n-pipes). - * - * @param locale A locale code for the locale format rules to use. - * @param formStyle The required grammatical form. - * @param width The required character width. - * @returns The translated day-period strings. - * @see `getLocaleExtraDayPeriodRules()` - * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n) - * - * @publicApi - */ -function getLocaleExtraDayPeriods(locale, formStyle, width) { - var data = findLocaleData(locale); - checkFullData(data); - var dayPeriodsData = [ - data[19 /* ExtraData */][0 /* ExtraDayPeriodFormats */], - data[19 /* ExtraData */][1 /* ExtraDayPeriodStandalone */] - ]; - var dayPeriods = getLastDefinedValue(dayPeriodsData, formStyle) || []; - return getLastDefinedValue(dayPeriods, width) || []; -} -/** - * Retrieves the first value that is defined in an array, going backwards from an index position. - * - * To avoid repeating the same data (as when the "format" and "standalone" forms are the same) - * add the first value to the locale data arrays, and add other values only if they are different. - * - * @param data The data array to retrieve from. - * @param index A 0-based index into the array to start from. - * @returns The value immediately before the given index position. - * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n) - * - * @publicApi - */ -function getLastDefinedValue(data, index) { - for (var i = index; i > -1; i--) { - if (typeof data[i] !== 'undefined') { - return data[i]; - } - } - throw new Error('Locale data API: locale data undefined'); -} -/** - * Extracts the hours and minutes from a string like "15:45" - */ -function extractTime(time) { - var _a = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__read"])(time.split(':'), 2), h = _a[0], m = _a[1]; - return { hours: +h, minutes: +m }; -} -/** - * Finds the locale data for a given locale. - * - * @param locale The locale code. - * @returns The locale data. - * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n) - * - * @publicApi - */ -function findLocaleData(locale) { - var normalizedLocale = locale.toLowerCase().replace(/_/g, '-'); - var match = LOCALE_DATA[normalizedLocale]; - if (match) { - return match; - } - // let's try to find a parent locale - var parentLocale = normalizedLocale.split('-')[0]; - match = LOCALE_DATA[parentLocale]; - if (match) { - return match; - } - if (parentLocale === 'en') { - return localeEn; - } - throw new Error("Missing locale data for the locale \"" + locale + "\"."); -} -/** - * Retrieves the currency symbol for a given currency code. - * - * For example, for the default `en-US` locale, the code `USD` can - * be represented by the narrow symbol `$` or the wide symbol `US$`. - * - * @param code The currency code. - * @param format The format, `wide` or `narrow`. - * @param locale A locale code for the locale format rules to use. - * - * @returns The symbol, or the currency code if no symbol is available.0 - * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n) - * - * @publicApi - */ -function getCurrencySymbol(code, format, locale) { - if (locale === void 0) { locale = 'en'; } - var currency = getLocaleCurrencies(locale)[code] || CURRENCIES_EN[code] || []; - var symbolNarrow = currency[1 /* SymbolNarrow */]; - if (format === 'narrow' && typeof symbolNarrow === 'string') { - return symbolNarrow; - } - return currency[0 /* Symbol */] || code; -} -// Most currencies have cents, that's why the default is 2 -var DEFAULT_NB_OF_CURRENCY_DIGITS = 2; -/** - * Reports the number of decimal digits for a given currency. - * The value depends upon the presence of cents in that particular currency. - * - * @param code The currency code. - * @returns The number of decimal digits, typically 0 or 2. - * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n) - * - * @publicApi - */ -function getNumberOfCurrencyDigits(code) { - var digits; - var currency = CURRENCIES_EN[code]; - if (currency) { - digits = currency[2 /* NbOfDigits */]; - } - return typeof digits === 'number' ? digits : DEFAULT_NB_OF_CURRENCY_DIGITS; -} - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -var ISO8601_DATE_REGEX = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/; -// 1 2 3 4 5 6 7 8 9 10 11 -var NAMED_FORMATS = {}; -var DATE_FORMATS_SPLIT = /((?:[^GyMLwWdEabBhHmsSzZO']+)|(?:'(?:[^']|'')*')|(?:G{1,5}|y{1,4}|M{1,5}|L{1,5}|w{1,2}|W{1}|d{1,2}|E{1,6}|a{1,5}|b{1,5}|B{1,5}|h{1,2}|H{1,2}|m{1,2}|s{1,2}|S{1,3}|z{1,4}|Z{1,5}|O{1,4}))([\s\S]*)/; -var ZoneWidth; -(function (ZoneWidth) { - ZoneWidth[ZoneWidth["Short"] = 0] = "Short"; - ZoneWidth[ZoneWidth["ShortGMT"] = 1] = "ShortGMT"; - ZoneWidth[ZoneWidth["Long"] = 2] = "Long"; - ZoneWidth[ZoneWidth["Extended"] = 3] = "Extended"; -})(ZoneWidth || (ZoneWidth = {})); -var DateType; -(function (DateType) { - DateType[DateType["FullYear"] = 0] = "FullYear"; - DateType[DateType["Month"] = 1] = "Month"; - DateType[DateType["Date"] = 2] = "Date"; - DateType[DateType["Hours"] = 3] = "Hours"; - DateType[DateType["Minutes"] = 4] = "Minutes"; - DateType[DateType["Seconds"] = 5] = "Seconds"; - DateType[DateType["FractionalSeconds"] = 6] = "FractionalSeconds"; - DateType[DateType["Day"] = 7] = "Day"; -})(DateType || (DateType = {})); -var TranslationType; -(function (TranslationType) { - TranslationType[TranslationType["DayPeriods"] = 0] = "DayPeriods"; - TranslationType[TranslationType["Days"] = 1] = "Days"; - TranslationType[TranslationType["Months"] = 2] = "Months"; - TranslationType[TranslationType["Eras"] = 3] = "Eras"; -})(TranslationType || (TranslationType = {})); -/** - * @ngModule CommonModule - * @description - * - * Formats a date according to locale rules. - * - * @param value The date to format, as a Date, or a number (milliseconds since UTC epoch) - * or an [ISO date-time string](https://www.w3.org/TR/NOTE-datetime). - * @param format The date-time components to include. See `DatePipe` for details. - * @param locale A locale code for the locale format rules to use. - * @param timezone The time zone. A time zone offset from GMT (such as `'+0430'`), - * or a standard UTC/GMT or continental US time zone abbreviation. - * If not specified, uses host system settings. - * - * @returns The formatted date string. - * - * @see `DatePipe` - * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n) - * - * @publicApi - */ -function formatDate(value, format, locale, timezone) { - var date = toDate(value); - var namedFormat = getNamedFormat(locale, format); - format = namedFormat || format; - var parts = []; - var match; - while (format) { - match = DATE_FORMATS_SPLIT.exec(format); - if (match) { - parts = parts.concat(match.slice(1)); - var part = parts.pop(); - if (!part) { - break; - } - format = part; - } - else { - parts.push(format); - break; - } - } - var dateTimezoneOffset = date.getTimezoneOffset(); - if (timezone) { - dateTimezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset); - date = convertTimezoneToLocal(date, timezone, true); - } - var text = ''; - parts.forEach(function (value) { - var dateFormatter = getDateFormatter(value); - text += dateFormatter ? - dateFormatter(date, locale, dateTimezoneOffset) : - value === '\'\'' ? '\'' : value.replace(/(^'|'$)/g, '').replace(/''/g, '\''); - }); - return text; -} -function getNamedFormat(locale, format) { - var localeId = getLocaleId(locale); - NAMED_FORMATS[localeId] = NAMED_FORMATS[localeId] || {}; - if (NAMED_FORMATS[localeId][format]) { - return NAMED_FORMATS[localeId][format]; - } - var formatValue = ''; - switch (format) { - case 'shortDate': - formatValue = getLocaleDateFormat(locale, FormatWidth.Short); - break; - case 'mediumDate': - formatValue = getLocaleDateFormat(locale, FormatWidth.Medium); - break; - case 'longDate': - formatValue = getLocaleDateFormat(locale, FormatWidth.Long); - break; - case 'fullDate': - formatValue = getLocaleDateFormat(locale, FormatWidth.Full); - break; - case 'shortTime': - formatValue = getLocaleTimeFormat(locale, FormatWidth.Short); - break; - case 'mediumTime': - formatValue = getLocaleTimeFormat(locale, FormatWidth.Medium); - break; - case 'longTime': - formatValue = getLocaleTimeFormat(locale, FormatWidth.Long); - break; - case 'fullTime': - formatValue = getLocaleTimeFormat(locale, FormatWidth.Full); - break; - case 'short': - var shortTime = getNamedFormat(locale, 'shortTime'); - var shortDate = getNamedFormat(locale, 'shortDate'); - formatValue = formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Short), [shortTime, shortDate]); - break; - case 'medium': - var mediumTime = getNamedFormat(locale, 'mediumTime'); - var mediumDate = getNamedFormat(locale, 'mediumDate'); - formatValue = formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Medium), [mediumTime, mediumDate]); - break; - case 'long': - var longTime = getNamedFormat(locale, 'longTime'); - var longDate = getNamedFormat(locale, 'longDate'); - formatValue = - formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Long), [longTime, longDate]); - break; - case 'full': - var fullTime = getNamedFormat(locale, 'fullTime'); - var fullDate = getNamedFormat(locale, 'fullDate'); - formatValue = - formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Full), [fullTime, fullDate]); - break; - } - if (formatValue) { - NAMED_FORMATS[localeId][format] = formatValue; - } - return formatValue; -} -function formatDateTime(str, opt_values) { - if (opt_values) { - str = str.replace(/\{([^}]+)}/g, function (match, key) { - return (opt_values != null && key in opt_values) ? opt_values[key] : match; - }); - } - return str; -} -function padNumber(num, digits, minusSign, trim, negWrap) { - if (minusSign === void 0) { minusSign = '-'; } - var neg = ''; - if (num < 0 || (negWrap && num <= 0)) { - if (negWrap) { - num = -num + 1; - } - else { - num = -num; - neg = minusSign; - } - } - var strNum = String(num); - while (strNum.length < digits) { - strNum = '0' + strNum; - } - if (trim) { - strNum = strNum.substr(strNum.length - digits); - } - return neg + strNum; -} -function formatFractionalSeconds(milliseconds, digits) { - var strMs = padNumber(milliseconds, 3); - return strMs.substr(0, digits); -} -/** - * Returns a date formatter that transforms a date into its locale digit representation - */ -function dateGetter(name, size, offset, trim, negWrap) { - if (offset === void 0) { offset = 0; } - if (trim === void 0) { trim = false; } - if (negWrap === void 0) { negWrap = false; } - return function (date, locale) { - var part = getDatePart(name, date); - if (offset > 0 || part > -offset) { - part += offset; - } - if (name === DateType.Hours) { - if (part === 0 && offset === -12) { - part = 12; - } - } - else if (name === DateType.FractionalSeconds) { - return formatFractionalSeconds(part, size); - } - var localeMinus = getLocaleNumberSymbol(locale, NumberSymbol.MinusSign); - return padNumber(part, size, localeMinus, trim, negWrap); - }; -} -function getDatePart(part, date) { - switch (part) { - case DateType.FullYear: - return date.getFullYear(); - case DateType.Month: - return date.getMonth(); - case DateType.Date: - return date.getDate(); - case DateType.Hours: - return date.getHours(); - case DateType.Minutes: - return date.getMinutes(); - case DateType.Seconds: - return date.getSeconds(); - case DateType.FractionalSeconds: - return date.getMilliseconds(); - case DateType.Day: - return date.getDay(); - default: - throw new Error("Unknown DateType value \"" + part + "\"."); - } -} -/** - * Returns a date formatter that transforms a date into its locale string representation - */ -function dateStrGetter(name, width, form, extended) { - if (form === void 0) { form = FormStyle.Format; } - if (extended === void 0) { extended = false; } - return function (date, locale) { - return getDateTranslation(date, locale, name, width, form, extended); - }; -} -/** - * Returns the locale translation of a date for a given form, type and width - */ -function getDateTranslation(date, locale, name, width, form, extended) { - switch (name) { - case TranslationType.Months: - return getLocaleMonthNames(locale, form, width)[date.getMonth()]; - case TranslationType.Days: - return getLocaleDayNames(locale, form, width)[date.getDay()]; - case TranslationType.DayPeriods: - var currentHours_1 = date.getHours(); - var currentMinutes_1 = date.getMinutes(); - if (extended) { - var rules = getLocaleExtraDayPeriodRules(locale); - var dayPeriods_1 = getLocaleExtraDayPeriods(locale, form, width); - var result_1; - rules.forEach(function (rule, index) { - if (Array.isArray(rule)) { - // morning, afternoon, evening, night - var _a = rule[0], hoursFrom = _a.hours, minutesFrom = _a.minutes; - var _b = rule[1], hoursTo = _b.hours, minutesTo = _b.minutes; - if (currentHours_1 >= hoursFrom && currentMinutes_1 >= minutesFrom && - (currentHours_1 < hoursTo || - (currentHours_1 === hoursTo && currentMinutes_1 < minutesTo))) { - result_1 = dayPeriods_1[index]; - } - } - else { // noon or midnight - var hours = rule.hours, minutes = rule.minutes; - if (hours === currentHours_1 && minutes === currentMinutes_1) { - result_1 = dayPeriods_1[index]; - } - } - }); - if (result_1) { - return result_1; - } - } - // if no rules for the day periods, we use am/pm by default - return getLocaleDayPeriods(locale, form, width)[currentHours_1 < 12 ? 0 : 1]; - case TranslationType.Eras: - return getLocaleEraNames(locale, width)[date.getFullYear() <= 0 ? 0 : 1]; - default: - // This default case is not needed by TypeScript compiler, as the switch is exhaustive. - // However Closure Compiler does not understand that and reports an error in typed mode. - // The `throw new Error` below works around the problem, and the unexpected: never variable - // makes sure tsc still checks this code is unreachable. - var unexpected = name; - throw new Error("unexpected translation type " + unexpected); - } -} -/** - * Returns a date formatter that transforms a date and an offset into a timezone with ISO8601 or - * GMT format depending on the width (eg: short = +0430, short:GMT = GMT+4, long = GMT+04:30, - * extended = +04:30) - */ -function timeZoneGetter(width) { - return function (date, locale, offset) { - var zone = -1 * offset; - var minusSign = getLocaleNumberSymbol(locale, NumberSymbol.MinusSign); - var hours = zone > 0 ? Math.floor(zone / 60) : Math.ceil(zone / 60); - switch (width) { - case ZoneWidth.Short: - return ((zone >= 0) ? '+' : '') + padNumber(hours, 2, minusSign) + - padNumber(Math.abs(zone % 60), 2, minusSign); - case ZoneWidth.ShortGMT: - return 'GMT' + ((zone >= 0) ? '+' : '') + padNumber(hours, 1, minusSign); - case ZoneWidth.Long: - return 'GMT' + ((zone >= 0) ? '+' : '') + padNumber(hours, 2, minusSign) + ':' + - padNumber(Math.abs(zone % 60), 2, minusSign); - case ZoneWidth.Extended: - if (offset === 0) { - return 'Z'; - } - else { - return ((zone >= 0) ? '+' : '') + padNumber(hours, 2, minusSign) + ':' + - padNumber(Math.abs(zone % 60), 2, minusSign); - } - default: - throw new Error("Unknown zone width \"" + width + "\""); - } - }; -} -var JANUARY = 0; -var THURSDAY = 4; -function getFirstThursdayOfYear(year) { - var firstDayOfYear = (new Date(year, JANUARY, 1)).getDay(); - return new Date(year, 0, 1 + ((firstDayOfYear <= THURSDAY) ? THURSDAY : THURSDAY + 7) - firstDayOfYear); -} -function getThursdayThisWeek(datetime) { - return new Date(datetime.getFullYear(), datetime.getMonth(), datetime.getDate() + (THURSDAY - datetime.getDay())); -} -function weekGetter(size, monthBased) { - if (monthBased === void 0) { monthBased = false; } - return function (date, locale) { - var result; - if (monthBased) { - var nbDaysBefore1stDayOfMonth = new Date(date.getFullYear(), date.getMonth(), 1).getDay() - 1; - var today = date.getDate(); - result = 1 + Math.floor((today + nbDaysBefore1stDayOfMonth) / 7); - } - else { - var firstThurs = getFirstThursdayOfYear(date.getFullYear()); - var thisThurs = getThursdayThisWeek(date); - var diff = thisThurs.getTime() - firstThurs.getTime(); - result = 1 + Math.round(diff / 6.048e8); // 6.048e8 ms per week - } - return padNumber(result, size, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign)); - }; -} -var DATE_FORMATS = {}; -// Based on CLDR formats: -// See complete list: http://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table -// See also explanations: http://cldr.unicode.org/translation/date-time -// TODO(ocombe): support all missing cldr formats: Y, U, Q, D, F, e, c, j, J, C, A, v, V, X, x -function getDateFormatter(format) { - if (DATE_FORMATS[format]) { - return DATE_FORMATS[format]; - } - var formatter; - switch (format) { - // Era name (AD/BC) - case 'G': - case 'GG': - case 'GGG': - formatter = dateStrGetter(TranslationType.Eras, TranslationWidth.Abbreviated); - break; - case 'GGGG': - formatter = dateStrGetter(TranslationType.Eras, TranslationWidth.Wide); - break; - case 'GGGGG': - formatter = dateStrGetter(TranslationType.Eras, TranslationWidth.Narrow); - break; - // 1 digit representation of the year, e.g. (AD 1 => 1, AD 199 => 199) - case 'y': - formatter = dateGetter(DateType.FullYear, 1, 0, false, true); - break; - // 2 digit representation of the year, padded (00-99). (e.g. AD 2001 => 01, AD 2010 => 10) - case 'yy': - formatter = dateGetter(DateType.FullYear, 2, 0, true, true); - break; - // 3 digit representation of the year, padded (000-999). (e.g. AD 2001 => 01, AD 2010 => 10) - case 'yyy': - formatter = dateGetter(DateType.FullYear, 3, 0, false, true); - break; - // 4 digit representation of the year (e.g. AD 1 => 0001, AD 2010 => 2010) - case 'yyyy': - formatter = dateGetter(DateType.FullYear, 4, 0, false, true); - break; - // Month of the year (1-12), numeric - case 'M': - case 'L': - formatter = dateGetter(DateType.Month, 1, 1); - break; - case 'MM': - case 'LL': - formatter = dateGetter(DateType.Month, 2, 1); - break; - // Month of the year (January, ...), string, format - case 'MMM': - formatter = dateStrGetter(TranslationType.Months, TranslationWidth.Abbreviated); - break; - case 'MMMM': - formatter = dateStrGetter(TranslationType.Months, TranslationWidth.Wide); - break; - case 'MMMMM': - formatter = dateStrGetter(TranslationType.Months, TranslationWidth.Narrow); - break; - // Month of the year (January, ...), string, standalone - case 'LLL': - formatter = - dateStrGetter(TranslationType.Months, TranslationWidth.Abbreviated, FormStyle.Standalone); - break; - case 'LLLL': - formatter = - dateStrGetter(TranslationType.Months, TranslationWidth.Wide, FormStyle.Standalone); - break; - case 'LLLLL': - formatter = - dateStrGetter(TranslationType.Months, TranslationWidth.Narrow, FormStyle.Standalone); - break; - // Week of the year (1, ... 52) - case 'w': - formatter = weekGetter(1); - break; - case 'ww': - formatter = weekGetter(2); - break; - // Week of the month (1, ...) - case 'W': - formatter = weekGetter(1, true); - break; - // Day of the month (1-31) - case 'd': - formatter = dateGetter(DateType.Date, 1); - break; - case 'dd': - formatter = dateGetter(DateType.Date, 2); - break; - // Day of the Week - case 'E': - case 'EE': - case 'EEE': - formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Abbreviated); - break; - case 'EEEE': - formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Wide); - break; - case 'EEEEE': - formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Narrow); - break; - case 'EEEEEE': - formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Short); - break; - // Generic period of the day (am-pm) - case 'a': - case 'aa': - case 'aaa': - formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Abbreviated); - break; - case 'aaaa': - formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Wide); - break; - case 'aaaaa': - formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Narrow); - break; - // Extended period of the day (midnight, at night, ...), standalone - case 'b': - case 'bb': - case 'bbb': - formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Abbreviated, FormStyle.Standalone, true); - break; - case 'bbbb': - formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Wide, FormStyle.Standalone, true); - break; - case 'bbbbb': - formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Narrow, FormStyle.Standalone, true); - break; - // Extended period of the day (midnight, night, ...), standalone - case 'B': - case 'BB': - case 'BBB': - formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Abbreviated, FormStyle.Format, true); - break; - case 'BBBB': - formatter = - dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Wide, FormStyle.Format, true); - break; - case 'BBBBB': - formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Narrow, FormStyle.Format, true); - break; - // Hour in AM/PM, (1-12) - case 'h': - formatter = dateGetter(DateType.Hours, 1, -12); - break; - case 'hh': - formatter = dateGetter(DateType.Hours, 2, -12); - break; - // Hour of the day (0-23) - case 'H': - formatter = dateGetter(DateType.Hours, 1); - break; - // Hour in day, padded (00-23) - case 'HH': - formatter = dateGetter(DateType.Hours, 2); - break; - // Minute of the hour (0-59) - case 'm': - formatter = dateGetter(DateType.Minutes, 1); - break; - case 'mm': - formatter = dateGetter(DateType.Minutes, 2); - break; - // Second of the minute (0-59) - case 's': - formatter = dateGetter(DateType.Seconds, 1); - break; - case 'ss': - formatter = dateGetter(DateType.Seconds, 2); - break; - // Fractional second - case 'S': - formatter = dateGetter(DateType.FractionalSeconds, 1); - break; - case 'SS': - formatter = dateGetter(DateType.FractionalSeconds, 2); - break; - case 'SSS': - formatter = dateGetter(DateType.FractionalSeconds, 3); - break; - // Timezone ISO8601 short format (-0430) - case 'Z': - case 'ZZ': - case 'ZZZ': - formatter = timeZoneGetter(ZoneWidth.Short); - break; - // Timezone ISO8601 extended format (-04:30) - case 'ZZZZZ': - formatter = timeZoneGetter(ZoneWidth.Extended); - break; - // Timezone GMT short format (GMT+4) - case 'O': - case 'OO': - case 'OOO': - // Should be location, but fallback to format O instead because we don't have the data yet - case 'z': - case 'zz': - case 'zzz': - formatter = timeZoneGetter(ZoneWidth.ShortGMT); - break; - // Timezone GMT long format (GMT+0430) - case 'OOOO': - case 'ZZZZ': - // Should be location, but fallback to format O instead because we don't have the data yet - case 'zzzz': - formatter = timeZoneGetter(ZoneWidth.Long); - break; - default: - return null; - } - DATE_FORMATS[format] = formatter; - return formatter; -} -function timezoneToOffset(timezone, fallback) { - // Support: IE 9-11 only, Edge 13-15+ - // IE/Edge do not "understand" colon (`:`) in timezone - timezone = timezone.replace(/:/g, ''); - var requestedTimezoneOffset = Date.parse('Jan 01, 1970 00:00:00 ' + timezone) / 60000; - return isNaN(requestedTimezoneOffset) ? fallback : requestedTimezoneOffset; -} -function addDateMinutes(date, minutes) { - date = new Date(date.getTime()); - date.setMinutes(date.getMinutes() + minutes); - return date; -} -function convertTimezoneToLocal(date, timezone, reverse) { - var reverseValue = reverse ? -1 : 1; - var dateTimezoneOffset = date.getTimezoneOffset(); - var timezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset); - return addDateMinutes(date, reverseValue * (timezoneOffset - dateTimezoneOffset)); -} -/** - * Converts a value to date. - * - * Supported input formats: - * - `Date` - * - number: timestamp - * - string: numeric (e.g. "1234"), ISO and date strings in a format supported by - * [Date.parse()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse). - * Note: ISO strings without time return a date without timeoffset. - * - * Throws if unable to convert to a date. - */ -function toDate(value) { - if (isDate(value)) { - return value; - } - if (typeof value === 'number' && !isNaN(value)) { - return new Date(value); - } - if (typeof value === 'string') { - value = value.trim(); - var parsedNb = parseFloat(value); - // any string that only contains numbers, like "1234" but not like "1234hello" - if (!isNaN(value - parsedNb)) { - return new Date(parsedNb); - } - if (/^(\d{4}-\d{1,2}-\d{1,2})$/.test(value)) { - /* For ISO Strings without time the day, month and year must be extracted from the ISO String - before Date creation to avoid time offset and errors in the new Date. - If we only replace '-' with ',' in the ISO String ("2015,01,01"), and try to create a new - date, some browsers (e.g. IE 9) will throw an invalid Date error. - If we leave the '-' ("2015-01-01") and try to create a new Date("2015-01-01") the timeoffset - is applied. - Note: ISO months are 0 for January, 1 for February, ... */ - var _a = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__read"])(value.split('-').map(function (val) { return +val; }), 3), y = _a[0], m = _a[1], d = _a[2]; - return new Date(y, m - 1, d); - } - var match = void 0; - if (match = value.match(ISO8601_DATE_REGEX)) { - return isoStringToDate(match); - } - } - var date = new Date(value); - if (!isDate(date)) { - throw new Error("Unable to convert \"" + value + "\" into a date"); - } - return date; -} -/** - * Converts a date in ISO8601 to a Date. - * Used instead of `Date.parse` because of browser discrepancies. - */ -function isoStringToDate(match) { - var date = new Date(0); - var tzHour = 0; - var tzMin = 0; - // match[8] means that the string contains "Z" (UTC) or a timezone like "+01:00" or "+0100" - var dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear; - var timeSetter = match[8] ? date.setUTCHours : date.setHours; - // if there is a timezone defined like "+01:00" or "+0100" - if (match[9]) { - tzHour = Number(match[9] + match[10]); - tzMin = Number(match[9] + match[11]); - } - dateSetter.call(date, Number(match[1]), Number(match[2]) - 1, Number(match[3])); - var h = Number(match[4] || 0) - tzHour; - var m = Number(match[5] || 0) - tzMin; - var s = Number(match[6] || 0); - var ms = Math.round(parseFloat('0.' + (match[7] || 0)) * 1000); - timeSetter.call(date, h, m, s, ms); - return date; -} -function isDate(value) { - return value instanceof Date && !isNaN(value.valueOf()); -} - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -var NUMBER_FORMAT_REGEXP = /^(\d+)?\.((\d+)(-(\d+))?)?$/; -var MAX_DIGITS = 22; -var DECIMAL_SEP = '.'; -var ZERO_CHAR = '0'; -var PATTERN_SEP = ';'; -var GROUP_SEP = ','; -var DIGIT_CHAR = '#'; -var CURRENCY_CHAR = '¤'; -var PERCENT_CHAR = '%'; -/** - * Transforms a number to a locale string based on a style and a format. - */ -function formatNumberToLocaleString(value, pattern, locale, groupSymbol, decimalSymbol, digitsInfo, isPercent) { - if (isPercent === void 0) { isPercent = false; } - var formattedText = ''; - var isZero = false; - if (!isFinite(value)) { - formattedText = getLocaleNumberSymbol(locale, NumberSymbol.Infinity); - } - else { - var parsedNumber = parseNumber(value); - if (isPercent) { - parsedNumber = toPercent(parsedNumber); - } - var minInt = pattern.minInt; - var minFraction = pattern.minFrac; - var maxFraction = pattern.maxFrac; - if (digitsInfo) { - var parts = digitsInfo.match(NUMBER_FORMAT_REGEXP); - if (parts === null) { - throw new Error(digitsInfo + " is not a valid digit info"); - } - var minIntPart = parts[1]; - var minFractionPart = parts[3]; - var maxFractionPart = parts[5]; - if (minIntPart != null) { - minInt = parseIntAutoRadix(minIntPart); - } - if (minFractionPart != null) { - minFraction = parseIntAutoRadix(minFractionPart); - } - if (maxFractionPart != null) { - maxFraction = parseIntAutoRadix(maxFractionPart); - } - else if (minFractionPart != null && minFraction > maxFraction) { - maxFraction = minFraction; - } - } - roundNumber(parsedNumber, minFraction, maxFraction); - var digits = parsedNumber.digits; - var integerLen = parsedNumber.integerLen; - var exponent = parsedNumber.exponent; - var decimals = []; - isZero = digits.every(function (d) { return !d; }); - // pad zeros for small numbers - for (; integerLen < minInt; integerLen++) { - digits.unshift(0); - } - // pad zeros for small numbers - for (; integerLen < 0; integerLen++) { - digits.unshift(0); - } - // extract decimals digits - if (integerLen > 0) { - decimals = digits.splice(integerLen, digits.length); - } - else { - decimals = digits; - digits = [0]; - } - // format the integer digits with grouping separators - var groups = []; - if (digits.length >= pattern.lgSize) { - groups.unshift(digits.splice(-pattern.lgSize, digits.length).join('')); - } - while (digits.length > pattern.gSize) { - groups.unshift(digits.splice(-pattern.gSize, digits.length).join('')); - } - if (digits.length) { - groups.unshift(digits.join('')); - } - formattedText = groups.join(getLocaleNumberSymbol(locale, groupSymbol)); - // append the decimal digits - if (decimals.length) { - formattedText += getLocaleNumberSymbol(locale, decimalSymbol) + decimals.join(''); - } - if (exponent) { - formattedText += getLocaleNumberSymbol(locale, NumberSymbol.Exponential) + '+' + exponent; - } - } - if (value < 0 && !isZero) { - formattedText = pattern.negPre + formattedText + pattern.negSuf; - } - else { - formattedText = pattern.posPre + formattedText + pattern.posSuf; - } - return formattedText; -} -/** - * @ngModule CommonModule - * @description - * - * Formats a number as currency using locale rules. - * - * @param value The number to format. - * @param locale A locale code for the locale format rules to use. - * @param currency A string containing the currency symbol or its name, - * such as "$" or "Canadian Dollar". Used in output string, but does not affect the operation - * of the function. - * @param currencyCode The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) - * currency code to use in the result string, such as `USD` for the US dollar and `EUR` for the euro. - * @param digitInfo Decimal representation options, specified by a string in the following format: - * `{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}`. See `DecimalPipe` for more details. - * - * @returns The formatted currency value. - * - * @see `formatNumber()` - * @see `DecimalPipe` - * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n) - * - * @publicApi - */ -function formatCurrency(value, locale, currency, currencyCode, digitsInfo) { - var format = getLocaleNumberFormat(locale, NumberFormatStyle.Currency); - var pattern = parseNumberFormat(format, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign)); - pattern.minFrac = getNumberOfCurrencyDigits(currencyCode); - pattern.maxFrac = pattern.minFrac; - var res = formatNumberToLocaleString(value, pattern, locale, NumberSymbol.CurrencyGroup, NumberSymbol.CurrencyDecimal, digitsInfo); - return res - .replace(CURRENCY_CHAR, currency) - // if we have 2 time the currency character, the second one is ignored - .replace(CURRENCY_CHAR, ''); -} -/** - * @ngModule CommonModule - * @description - * - * Formats a number as a percentage according to locale rules. - * - * @param value The number to format. - * @param locale A locale code for the locale format rules to use. - * @param digitInfo Decimal representation options, specified by a string in the following format: - * `{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}`. See `DecimalPipe` for more details. - * - * @returns The formatted percentage value. - * - * @see `formatNumber()` - * @see `DecimalPipe` - * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n) - * @publicApi - * - */ -function formatPercent(value, locale, digitsInfo) { - var format = getLocaleNumberFormat(locale, NumberFormatStyle.Percent); - var pattern = parseNumberFormat(format, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign)); - var res = formatNumberToLocaleString(value, pattern, locale, NumberSymbol.Group, NumberSymbol.Decimal, digitsInfo, true); - return res.replace(new RegExp(PERCENT_CHAR, 'g'), getLocaleNumberSymbol(locale, NumberSymbol.PercentSign)); -} -/** - * @ngModule CommonModule - * @description - * - * Formats a number as text, with group sizing, separator, and other - * parameters based on the locale. - * - * @param value The number to format. - * @param locale A locale code for the locale format rules to use. - * @param digitInfo Decimal representation options, specified by a string in the following format: - * `{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}`. See `DecimalPipe` for more details. - * - * @returns The formatted text string. - * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n) - * - * @publicApi - */ -function formatNumber(value, locale, digitsInfo) { - var format = getLocaleNumberFormat(locale, NumberFormatStyle.Decimal); - var pattern = parseNumberFormat(format, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign)); - return formatNumberToLocaleString(value, pattern, locale, NumberSymbol.Group, NumberSymbol.Decimal, digitsInfo); -} -function parseNumberFormat(format, minusSign) { - if (minusSign === void 0) { minusSign = '-'; } - var p = { - minInt: 1, - minFrac: 0, - maxFrac: 0, - posPre: '', - posSuf: '', - negPre: '', - negSuf: '', - gSize: 0, - lgSize: 0 - }; - var patternParts = format.split(PATTERN_SEP); - var positive = patternParts[0]; - var negative = patternParts[1]; - var positiveParts = positive.indexOf(DECIMAL_SEP) !== -1 ? - positive.split(DECIMAL_SEP) : - [ - positive.substring(0, positive.lastIndexOf(ZERO_CHAR) + 1), - positive.substring(positive.lastIndexOf(ZERO_CHAR) + 1) - ], integer = positiveParts[0], fraction = positiveParts[1] || ''; - p.posPre = integer.substr(0, integer.indexOf(DIGIT_CHAR)); - for (var i = 0; i < fraction.length; i++) { - var ch = fraction.charAt(i); - if (ch === ZERO_CHAR) { - p.minFrac = p.maxFrac = i + 1; - } - else if (ch === DIGIT_CHAR) { - p.maxFrac = i + 1; - } - else { - p.posSuf += ch; - } - } - var groups = integer.split(GROUP_SEP); - p.gSize = groups[1] ? groups[1].length : 0; - p.lgSize = (groups[2] || groups[1]) ? (groups[2] || groups[1]).length : 0; - if (negative) { - var trunkLen = positive.length - p.posPre.length - p.posSuf.length, pos = negative.indexOf(DIGIT_CHAR); - p.negPre = negative.substr(0, pos).replace(/'/g, ''); - p.negSuf = negative.substr(pos + trunkLen).replace(/'/g, ''); - } - else { - p.negPre = minusSign + p.posPre; - p.negSuf = p.posSuf; - } - return p; -} -// Transforms a parsed number into a percentage by multiplying it by 100 -function toPercent(parsedNumber) { - // if the number is 0, don't do anything - if (parsedNumber.digits[0] === 0) { - return parsedNumber; - } - // Getting the current number of decimals - var fractionLen = parsedNumber.digits.length - parsedNumber.integerLen; - if (parsedNumber.exponent) { - parsedNumber.exponent += 2; - } - else { - if (fractionLen === 0) { - parsedNumber.digits.push(0, 0); - } - else if (fractionLen === 1) { - parsedNumber.digits.push(0); - } - parsedNumber.integerLen += 2; - } - return parsedNumber; -} -/** - * Parses a number. - * Significant bits of this parse algorithm came from https://github.com/MikeMcl/big.js/ - */ -function parseNumber(num) { - var numStr = Math.abs(num) + ''; - var exponent = 0, digits, integerLen; - var i, j, zeros; - // Decimal point? - if ((integerLen = numStr.indexOf(DECIMAL_SEP)) > -1) { - numStr = numStr.replace(DECIMAL_SEP, ''); - } - // Exponential form? - if ((i = numStr.search(/e/i)) > 0) { - // Work out the exponent. - if (integerLen < 0) - integerLen = i; - integerLen += +numStr.slice(i + 1); - numStr = numStr.substring(0, i); - } - else if (integerLen < 0) { - // There was no decimal point or exponent so it is an integer. - integerLen = numStr.length; - } - // Count the number of leading zeros. - for (i = 0; numStr.charAt(i) === ZERO_CHAR; i++) { /* empty */ - } - if (i === (zeros = numStr.length)) { - // The digits are all zero. - digits = [0]; - integerLen = 1; - } - else { - // Count the number of trailing zeros - zeros--; - while (numStr.charAt(zeros) === ZERO_CHAR) - zeros--; - // Trailing zeros are insignificant so ignore them - integerLen -= i; - digits = []; - // Convert string to array of digits without leading/trailing zeros. - for (j = 0; i <= zeros; i++, j++) { - digits[j] = Number(numStr.charAt(i)); - } - } - // If the number overflows the maximum allowed digits then use an exponent. - if (integerLen > MAX_DIGITS) { - digits = digits.splice(0, MAX_DIGITS - 1); - exponent = integerLen - 1; - integerLen = 1; - } - return { digits: digits, exponent: exponent, integerLen: integerLen }; -} -/** - * Round the parsed number to the specified number of decimal places - * This function changes the parsedNumber in-place - */ -function roundNumber(parsedNumber, minFrac, maxFrac) { - if (minFrac > maxFrac) { - throw new Error("The minimum number of digits after fraction (" + minFrac + ") is higher than the maximum (" + maxFrac + ")."); - } - var digits = parsedNumber.digits; - var fractionLen = digits.length - parsedNumber.integerLen; - var fractionSize = Math.min(Math.max(minFrac, fractionLen), maxFrac); - // The index of the digit to where rounding is to occur - var roundAt = fractionSize + parsedNumber.integerLen; - var digit = digits[roundAt]; - if (roundAt > 0) { - // Drop fractional digits beyond `roundAt` - digits.splice(Math.max(parsedNumber.integerLen, roundAt)); - // Set non-fractional digits beyond `roundAt` to 0 - for (var j = roundAt; j < digits.length; j++) { - digits[j] = 0; - } - } - else { - // We rounded to zero so reset the parsedNumber - fractionLen = Math.max(0, fractionLen); - parsedNumber.integerLen = 1; - digits.length = Math.max(1, roundAt = fractionSize + 1); - digits[0] = 0; - for (var i = 1; i < roundAt; i++) - digits[i] = 0; - } - if (digit >= 5) { - if (roundAt - 1 < 0) { - for (var k = 0; k > roundAt; k--) { - digits.unshift(0); - parsedNumber.integerLen++; - } - digits.unshift(1); - parsedNumber.integerLen++; - } - else { - digits[roundAt - 1]++; - } - } - // Pad out with zeros to get the required fraction length - for (; fractionLen < Math.max(0, fractionSize); fractionLen++) - digits.push(0); - var dropTrailingZeros = fractionSize !== 0; - // Minimal length = nb of decimals required + current nb of integers - // Any number besides that is optional and can be removed if it's a trailing 0 - var minLen = minFrac + parsedNumber.integerLen; - // Do any carrying, e.g. a digit was rounded up to 10 - var carry = digits.reduceRight(function (carry, d, i, digits) { - d = d + carry; - digits[i] = d < 10 ? d : d - 10; // d % 10 - if (dropTrailingZeros) { - // Do not keep meaningless fractional trailing zeros (e.g. 15.52000 --> 15.52) - if (digits[i] === 0 && i >= minLen) { - digits.pop(); - } - else { - dropTrailingZeros = false; - } - } - return d >= 10 ? 1 : 0; // Math.floor(d / 10); - }, 0); - if (carry) { - digits.unshift(carry); - parsedNumber.integerLen++; - } -} -function parseIntAutoRadix(text) { - var result = parseInt(text); - if (isNaN(result)) { - throw new Error('Invalid integer literal when parsing ' + text); - } - return result; -} - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -/** - * @deprecated from v5 - */ -var DEPRECATED_PLURAL_FN = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["InjectionToken"]('UseV4Plurals'); -/** - * @publicApi - */ -var NgLocalization = /** @class */ (function () { - function NgLocalization() { - } - return NgLocalization; -}()); -/** - * Returns the plural category for a given value. - * - "=value" when the case exists, - * - the plural category otherwise - */ -function getPluralCategory(value, cases, ngLocalization, locale) { - var key = "=" + value; - if (cases.indexOf(key) > -1) { - return key; - } - key = ngLocalization.getPluralCategory(value, locale); - if (cases.indexOf(key) > -1) { - return key; - } - if (cases.indexOf('other') > -1) { - return 'other'; - } - throw new Error("No plural message found for value \"" + value + "\""); -} -/** - * Returns the plural case based on the locale - * - * @publicApi - */ -var NgLocaleLocalization = /** @class */ (function (_super) { - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__extends"])(NgLocaleLocalization, _super); - function NgLocaleLocalization(locale, - /** @deprecated from v5 */ - deprecatedPluralFn) { - var _this = _super.call(this) || this; - _this.locale = locale; - _this.deprecatedPluralFn = deprecatedPluralFn; - return _this; - } - NgLocaleLocalization.prototype.getPluralCategory = function (value, locale) { - var plural = this.deprecatedPluralFn ? this.deprecatedPluralFn(locale || this.locale, value) : - getLocalePluralCase(locale || this.locale)(value); - switch (plural) { - case Plural.Zero: - return 'zero'; - case Plural.One: - return 'one'; - case Plural.Two: - return 'two'; - case Plural.Few: - return 'few'; - case Plural.Many: - return 'many'; - default: - return 'other'; - } - }; - NgLocaleLocalization = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"])(), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"])(_angular_core__WEBPACK_IMPORTED_MODULE_0__["LOCALE_ID"])), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__param"])(1, Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__param"])(1, Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"])(DEPRECATED_PLURAL_FN)), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [String, Object]) - ], NgLocaleLocalization); - return NgLocaleLocalization; -}(NgLocalization)); -/** - * Returns the plural case based on the locale - * - * @deprecated from v5 the plural case function is in locale data files common/locales/*.ts - * @publicApi - */ -function getPluralCase(locale, nLike) { - // TODO(vicb): lazy compute - if (typeof nLike === 'string') { - nLike = parseInt(nLike, 10); - } - var n = nLike; - var nDecimal = n.toString().replace(/^[^.]*\.?/, ''); - var i = Math.floor(Math.abs(n)); - var v = nDecimal.length; - var f = parseInt(nDecimal, 10); - var t = parseInt(n.toString().replace(/^[^.]*\.?|0+$/g, ''), 10) || 0; - var lang = locale.split('-')[0].toLowerCase(); - switch (lang) { - case 'af': - case 'asa': - case 'az': - case 'bem': - case 'bez': - case 'bg': - case 'brx': - case 'ce': - case 'cgg': - case 'chr': - case 'ckb': - case 'ee': - case 'el': - case 'eo': - case 'es': - case 'eu': - case 'fo': - case 'fur': - case 'gsw': - case 'ha': - case 'haw': - case 'hu': - case 'jgo': - case 'jmc': - case 'ka': - case 'kk': - case 'kkj': - case 'kl': - case 'ks': - case 'ksb': - case 'ky': - case 'lb': - case 'lg': - case 'mas': - case 'mgo': - case 'ml': - case 'mn': - case 'nb': - case 'nd': - case 'ne': - case 'nn': - case 'nnh': - case 'nyn': - case 'om': - case 'or': - case 'os': - case 'ps': - case 'rm': - case 'rof': - case 'rwk': - case 'saq': - case 'seh': - case 'sn': - case 'so': - case 'sq': - case 'ta': - case 'te': - case 'teo': - case 'tk': - case 'tr': - case 'ug': - case 'uz': - case 'vo': - case 'vun': - case 'wae': - case 'xog': - if (n === 1) - return Plural.One; - return Plural.Other; - case 'ak': - case 'ln': - case 'mg': - case 'pa': - case 'ti': - if (n === Math.floor(n) && n >= 0 && n <= 1) - return Plural.One; - return Plural.Other; - case 'am': - case 'as': - case 'bn': - case 'fa': - case 'gu': - case 'hi': - case 'kn': - case 'mr': - case 'zu': - if (i === 0 || n === 1) - return Plural.One; - return Plural.Other; - case 'ar': - if (n === 0) - return Plural.Zero; - if (n === 1) - return Plural.One; - if (n === 2) - return Plural.Two; - if (n % 100 === Math.floor(n % 100) && n % 100 >= 3 && n % 100 <= 10) - return Plural.Few; - if (n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 99) - return Plural.Many; - return Plural.Other; - case 'ast': - case 'ca': - case 'de': - case 'en': - case 'et': - case 'fi': - case 'fy': - case 'gl': - case 'it': - case 'nl': - case 'sv': - case 'sw': - case 'ur': - case 'yi': - if (i === 1 && v === 0) - return Plural.One; - return Plural.Other; - case 'be': - if (n % 10 === 1 && !(n % 100 === 11)) - return Plural.One; - if (n % 10 === Math.floor(n % 10) && n % 10 >= 2 && n % 10 <= 4 && - !(n % 100 >= 12 && n % 100 <= 14)) - return Plural.Few; - if (n % 10 === 0 || n % 10 === Math.floor(n % 10) && n % 10 >= 5 && n % 10 <= 9 || - n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 14) - return Plural.Many; - return Plural.Other; - case 'br': - if (n % 10 === 1 && !(n % 100 === 11 || n % 100 === 71 || n % 100 === 91)) - return Plural.One; - if (n % 10 === 2 && !(n % 100 === 12 || n % 100 === 72 || n % 100 === 92)) - return Plural.Two; - if (n % 10 === Math.floor(n % 10) && (n % 10 >= 3 && n % 10 <= 4 || n % 10 === 9) && - !(n % 100 >= 10 && n % 100 <= 19 || n % 100 >= 70 && n % 100 <= 79 || - n % 100 >= 90 && n % 100 <= 99)) - return Plural.Few; - if (!(n === 0) && n % 1e6 === 0) - return Plural.Many; - return Plural.Other; - case 'bs': - case 'hr': - case 'sr': - if (v === 0 && i % 10 === 1 && !(i % 100 === 11) || f % 10 === 1 && !(f % 100 === 11)) - return Plural.One; - if (v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 2 && i % 10 <= 4 && - !(i % 100 >= 12 && i % 100 <= 14) || - f % 10 === Math.floor(f % 10) && f % 10 >= 2 && f % 10 <= 4 && - !(f % 100 >= 12 && f % 100 <= 14)) - return Plural.Few; - return Plural.Other; - case 'cs': - case 'sk': - if (i === 1 && v === 0) - return Plural.One; - if (i === Math.floor(i) && i >= 2 && i <= 4 && v === 0) - return Plural.Few; - if (!(v === 0)) - return Plural.Many; - return Plural.Other; - case 'cy': - if (n === 0) - return Plural.Zero; - if (n === 1) - return Plural.One; - if (n === 2) - return Plural.Two; - if (n === 3) - return Plural.Few; - if (n === 6) - return Plural.Many; - return Plural.Other; - case 'da': - if (n === 1 || !(t === 0) && (i === 0 || i === 1)) - return Plural.One; - return Plural.Other; - case 'dsb': - case 'hsb': - if (v === 0 && i % 100 === 1 || f % 100 === 1) - return Plural.One; - if (v === 0 && i % 100 === 2 || f % 100 === 2) - return Plural.Two; - if (v === 0 && i % 100 === Math.floor(i % 100) && i % 100 >= 3 && i % 100 <= 4 || - f % 100 === Math.floor(f % 100) && f % 100 >= 3 && f % 100 <= 4) - return Plural.Few; - return Plural.Other; - case 'ff': - case 'fr': - case 'hy': - case 'kab': - if (i === 0 || i === 1) - return Plural.One; - return Plural.Other; - case 'fil': - if (v === 0 && (i === 1 || i === 2 || i === 3) || - v === 0 && !(i % 10 === 4 || i % 10 === 6 || i % 10 === 9) || - !(v === 0) && !(f % 10 === 4 || f % 10 === 6 || f % 10 === 9)) - return Plural.One; - return Plural.Other; - case 'ga': - if (n === 1) - return Plural.One; - if (n === 2) - return Plural.Two; - if (n === Math.floor(n) && n >= 3 && n <= 6) - return Plural.Few; - if (n === Math.floor(n) && n >= 7 && n <= 10) - return Plural.Many; - return Plural.Other; - case 'gd': - if (n === 1 || n === 11) - return Plural.One; - if (n === 2 || n === 12) - return Plural.Two; - if (n === Math.floor(n) && (n >= 3 && n <= 10 || n >= 13 && n <= 19)) - return Plural.Few; - return Plural.Other; - case 'gv': - if (v === 0 && i % 10 === 1) - return Plural.One; - if (v === 0 && i % 10 === 2) - return Plural.Two; - if (v === 0 && - (i % 100 === 0 || i % 100 === 20 || i % 100 === 40 || i % 100 === 60 || i % 100 === 80)) - return Plural.Few; - if (!(v === 0)) - return Plural.Many; - return Plural.Other; - case 'he': - if (i === 1 && v === 0) - return Plural.One; - if (i === 2 && v === 0) - return Plural.Two; - if (v === 0 && !(n >= 0 && n <= 10) && n % 10 === 0) - return Plural.Many; - return Plural.Other; - case 'is': - if (t === 0 && i % 10 === 1 && !(i % 100 === 11) || !(t === 0)) - return Plural.One; - return Plural.Other; - case 'ksh': - if (n === 0) - return Plural.Zero; - if (n === 1) - return Plural.One; - return Plural.Other; - case 'kw': - case 'naq': - case 'se': - case 'smn': - if (n === 1) - return Plural.One; - if (n === 2) - return Plural.Two; - return Plural.Other; - case 'lag': - if (n === 0) - return Plural.Zero; - if ((i === 0 || i === 1) && !(n === 0)) - return Plural.One; - return Plural.Other; - case 'lt': - if (n % 10 === 1 && !(n % 100 >= 11 && n % 100 <= 19)) - return Plural.One; - if (n % 10 === Math.floor(n % 10) && n % 10 >= 2 && n % 10 <= 9 && - !(n % 100 >= 11 && n % 100 <= 19)) - return Plural.Few; - if (!(f === 0)) - return Plural.Many; - return Plural.Other; - case 'lv': - case 'prg': - if (n % 10 === 0 || n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 19 || - v === 2 && f % 100 === Math.floor(f % 100) && f % 100 >= 11 && f % 100 <= 19) - return Plural.Zero; - if (n % 10 === 1 && !(n % 100 === 11) || v === 2 && f % 10 === 1 && !(f % 100 === 11) || - !(v === 2) && f % 10 === 1) - return Plural.One; - return Plural.Other; - case 'mk': - if (v === 0 && i % 10 === 1 || f % 10 === 1) - return Plural.One; - return Plural.Other; - case 'mt': - if (n === 1) - return Plural.One; - if (n === 0 || n % 100 === Math.floor(n % 100) && n % 100 >= 2 && n % 100 <= 10) - return Plural.Few; - if (n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 19) - return Plural.Many; - return Plural.Other; - case 'pl': - if (i === 1 && v === 0) - return Plural.One; - if (v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 2 && i % 10 <= 4 && - !(i % 100 >= 12 && i % 100 <= 14)) - return Plural.Few; - if (v === 0 && !(i === 1) && i % 10 === Math.floor(i % 10) && i % 10 >= 0 && i % 10 <= 1 || - v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 5 && i % 10 <= 9 || - v === 0 && i % 100 === Math.floor(i % 100) && i % 100 >= 12 && i % 100 <= 14) - return Plural.Many; - return Plural.Other; - case 'pt': - if (n === Math.floor(n) && n >= 0 && n <= 2 && !(n === 2)) - return Plural.One; - return Plural.Other; - case 'ro': - if (i === 1 && v === 0) - return Plural.One; - if (!(v === 0) || n === 0 || - !(n === 1) && n % 100 === Math.floor(n % 100) && n % 100 >= 1 && n % 100 <= 19) - return Plural.Few; - return Plural.Other; - case 'ru': - case 'uk': - if (v === 0 && i % 10 === 1 && !(i % 100 === 11)) - return Plural.One; - if (v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 2 && i % 10 <= 4 && - !(i % 100 >= 12 && i % 100 <= 14)) - return Plural.Few; - if (v === 0 && i % 10 === 0 || - v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 5 && i % 10 <= 9 || - v === 0 && i % 100 === Math.floor(i % 100) && i % 100 >= 11 && i % 100 <= 14) - return Plural.Many; - return Plural.Other; - case 'shi': - if (i === 0 || n === 1) - return Plural.One; - if (n === Math.floor(n) && n >= 2 && n <= 10) - return Plural.Few; - return Plural.Other; - case 'si': - if (n === 0 || n === 1 || i === 0 && f === 1) - return Plural.One; - return Plural.Other; - case 'sl': - if (v === 0 && i % 100 === 1) - return Plural.One; - if (v === 0 && i % 100 === 2) - return Plural.Two; - if (v === 0 && i % 100 === Math.floor(i % 100) && i % 100 >= 3 && i % 100 <= 4 || !(v === 0)) - return Plural.Few; - return Plural.Other; - case 'tzm': - if (n === Math.floor(n) && n >= 0 && n <= 1 || n === Math.floor(n) && n >= 11 && n <= 99) - return Plural.One; - return Plural.Other; - // When there is no specification, the default is always "other" - // Spec: http://cldr.unicode.org/index/cldr-spec/plural-rules - // > other (required—general plural form — also used if the language only has a single form) - default: - return Plural.Other; - } -} - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -function parseCookieValue(cookieStr, name) { - var e_1, _a; - name = encodeURIComponent(name); - try { - for (var _b = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__values"])(cookieStr.split(';')), _c = _b.next(); !_c.done; _c = _b.next()) { - var cookie = _c.value; - var eqIndex = cookie.indexOf('='); - var _d = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__read"])(eqIndex == -1 ? [cookie, ''] : [cookie.slice(0, eqIndex), cookie.slice(eqIndex + 1)], 2), cookieName = _d[0], cookieValue = _d[1]; - if (cookieName.trim() === name) { - return decodeURIComponent(cookieValue); - } - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_1) throw e_1.error; } - } - return null; -} - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -/** - * @ngModule CommonModule - * - * @usageNotes - * ``` - * ... - * - * ... - * - * ... - * - * ... - * - * ... - * ``` - * - * @description - * - * Adds and removes CSS classes on an HTML element. - * - * The CSS classes are updated as follows, depending on the type of the expression evaluation: - * - `string` - the CSS classes listed in the string (space delimited) are added, - * - `Array` - the CSS classes declared as Array elements are added, - * - `Object` - keys are CSS classes that get added when the expression given in the value - * evaluates to a truthy value, otherwise they are removed. - * - * @publicApi - */ -var NgClass = /** @class */ (function () { - function NgClass(_iterableDiffers, _keyValueDiffers, _ngEl, _renderer) { - this._iterableDiffers = _iterableDiffers; - this._keyValueDiffers = _keyValueDiffers; - this._ngEl = _ngEl; - this._renderer = _renderer; - this._initialClasses = []; - } - Object.defineProperty(NgClass.prototype, "klass", { - set: function (value) { - this._removeClasses(this._initialClasses); - this._initialClasses = typeof value === 'string' ? value.split(/\s+/) : []; - this._applyClasses(this._initialClasses); - this._applyClasses(this._rawClass); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(NgClass.prototype, "ngClass", { - set: function (value) { - this._removeClasses(this._rawClass); - this._applyClasses(this._initialClasses); - this._iterableDiffer = null; - this._keyValueDiffer = null; - this._rawClass = typeof value === 'string' ? value.split(/\s+/) : value; - if (this._rawClass) { - if (Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵisListLikeIterable"])(this._rawClass)) { - this._iterableDiffer = this._iterableDiffers.find(this._rawClass).create(); - } - else { - this._keyValueDiffer = this._keyValueDiffers.find(this._rawClass).create(); - } - } - }, - enumerable: true, - configurable: true - }); - NgClass.prototype.ngDoCheck = function () { - if (this._iterableDiffer) { - var iterableChanges = this._iterableDiffer.diff(this._rawClass); - if (iterableChanges) { - this._applyIterableChanges(iterableChanges); - } - } - else if (this._keyValueDiffer) { - var keyValueChanges = this._keyValueDiffer.diff(this._rawClass); - if (keyValueChanges) { - this._applyKeyValueChanges(keyValueChanges); - } - } - }; - NgClass.prototype._applyKeyValueChanges = function (changes) { - var _this = this; - changes.forEachAddedItem(function (record) { return _this._toggleClass(record.key, record.currentValue); }); - changes.forEachChangedItem(function (record) { return _this._toggleClass(record.key, record.currentValue); }); - changes.forEachRemovedItem(function (record) { - if (record.previousValue) { - _this._toggleClass(record.key, false); - } - }); - }; - NgClass.prototype._applyIterableChanges = function (changes) { - var _this = this; - changes.forEachAddedItem(function (record) { - if (typeof record.item === 'string') { - _this._toggleClass(record.item, true); - } - else { - throw new Error("NgClass can only toggle CSS classes expressed as strings, got " + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵstringify"])(record.item)); - } - }); - changes.forEachRemovedItem(function (record) { return _this._toggleClass(record.item, false); }); - }; - /** - * Applies a collection of CSS classes to the DOM element. - * - * For argument of type Set and Array CSS class names contained in those collections are always - * added. - * For argument of type Map CSS class name in the map's key is toggled based on the value (added - * for truthy and removed for falsy). - */ - NgClass.prototype._applyClasses = function (rawClassVal) { - var _this = this; - if (rawClassVal) { - if (Array.isArray(rawClassVal) || rawClassVal instanceof Set) { - rawClassVal.forEach(function (klass) { return _this._toggleClass(klass, true); }); - } - else { - Object.keys(rawClassVal).forEach(function (klass) { return _this._toggleClass(klass, !!rawClassVal[klass]); }); - } - } - }; - /** - * Removes a collection of CSS classes from the DOM element. This is mostly useful for cleanup - * purposes. - */ - NgClass.prototype._removeClasses = function (rawClassVal) { - var _this = this; - if (rawClassVal) { - if (Array.isArray(rawClassVal) || rawClassVal instanceof Set) { - rawClassVal.forEach(function (klass) { return _this._toggleClass(klass, false); }); - } - else { - Object.keys(rawClassVal).forEach(function (klass) { return _this._toggleClass(klass, false); }); - } - } - }; - NgClass.prototype._toggleClass = function (klass, enabled) { - var _this = this; - klass = klass.trim(); - if (klass) { - klass.split(/\s+/g).forEach(function (klass) { - if (enabled) { - _this._renderer.addClass(_this._ngEl.nativeElement, klass); - } - else { - _this._renderer.removeClass(_this._ngEl.nativeElement, klass); - } - }); - } - }; - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])('class'), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:type", String), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [String]) - ], NgClass.prototype, "klass", null); - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:type", Object), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [Object]) - ], NgClass.prototype, "ngClass", null); - NgClass = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"])({ selector: '[ngClass]' }), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [_angular_core__WEBPACK_IMPORTED_MODULE_0__["IterableDiffers"], _angular_core__WEBPACK_IMPORTED_MODULE_0__["KeyValueDiffers"], - _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"], _angular_core__WEBPACK_IMPORTED_MODULE_0__["Renderer2"]]) - ], NgClass); - return NgClass; -}()); - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -/** - * Instantiates a single {@link Component} type and inserts its Host View into current View. - * `NgComponentOutlet` provides a declarative approach for dynamic component creation. - * - * `NgComponentOutlet` requires a component type, if a falsy value is set the view will clear and - * any existing component will get destroyed. - * - * @usageNotes - * - * ### Fine tune control - * - * You can control the component creation process by using the following optional attributes: - * - * * `ngComponentOutletInjector`: Optional custom {@link Injector} that will be used as parent for - * the Component. Defaults to the injector of the current view container. - * - * * `ngComponentOutletContent`: Optional list of projectable nodes to insert into the content - * section of the component, if exists. - * - * * `ngComponentOutletNgModuleFactory`: Optional module factory to allow dynamically loading other - * module, then load a component from that module. - * - * ### Syntax - * - * Simple - * ``` - * - * ``` - * - * Customized injector/content - * ``` - * - * - * ``` - * - * Customized ngModuleFactory - * ``` - * - * - * ``` - * - * ### A simple example - * - * {@example common/ngComponentOutlet/ts/module.ts region='SimpleExample'} - * - * A more complete example with additional options: - * - * {@example common/ngComponentOutlet/ts/module.ts region='CompleteExample'} - - * A more complete example with ngModuleFactory: - * - * {@example common/ngComponentOutlet/ts/module.ts region='NgModuleFactoryExample'} - * - * @publicApi - * @ngModule CommonModule - */ -var NgComponentOutlet = /** @class */ (function () { - function NgComponentOutlet(_viewContainerRef) { - this._viewContainerRef = _viewContainerRef; - this._componentRef = null; - this._moduleRef = null; - } - NgComponentOutlet.prototype.ngOnChanges = function (changes) { - this._viewContainerRef.clear(); - this._componentRef = null; - if (this.ngComponentOutlet) { - var elInjector = this.ngComponentOutletInjector || this._viewContainerRef.parentInjector; - if (changes['ngComponentOutletNgModuleFactory']) { - if (this._moduleRef) - this._moduleRef.destroy(); - if (this.ngComponentOutletNgModuleFactory) { - var parentModule = elInjector.get(_angular_core__WEBPACK_IMPORTED_MODULE_0__["NgModuleRef"]); - this._moduleRef = this.ngComponentOutletNgModuleFactory.create(parentModule.injector); - } - else { - this._moduleRef = null; - } - } - var componentFactoryResolver = this._moduleRef ? this._moduleRef.componentFactoryResolver : - elInjector.get(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ComponentFactoryResolver"]); - var componentFactory = componentFactoryResolver.resolveComponentFactory(this.ngComponentOutlet); - this._componentRef = this._viewContainerRef.createComponent(componentFactory, this._viewContainerRef.length, elInjector, this.ngComponentOutletContent); - } - }; - NgComponentOutlet.prototype.ngOnDestroy = function () { - if (this._moduleRef) - this._moduleRef.destroy(); - }; - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:type", _angular_core__WEBPACK_IMPORTED_MODULE_0__["Type"]) - ], NgComponentOutlet.prototype, "ngComponentOutlet", void 0); - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:type", _angular_core__WEBPACK_IMPORTED_MODULE_0__["Injector"]) - ], NgComponentOutlet.prototype, "ngComponentOutletInjector", void 0); - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:type", Array) - ], NgComponentOutlet.prototype, "ngComponentOutletContent", void 0); - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:type", _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgModuleFactory"]) - ], NgComponentOutlet.prototype, "ngComponentOutletNgModuleFactory", void 0); - NgComponentOutlet = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"])({ selector: '[ngComponentOutlet]' }), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [_angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewContainerRef"]]) - ], NgComponentOutlet); - return NgComponentOutlet; -}()); - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -/** - * @publicApi - */ -var NgForOfContext = /** @class */ (function () { - function NgForOfContext($implicit, ngForOf, index, count) { - this.$implicit = $implicit; - this.ngForOf = ngForOf; - this.index = index; - this.count = count; - } - Object.defineProperty(NgForOfContext.prototype, "first", { - get: function () { return this.index === 0; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(NgForOfContext.prototype, "last", { - get: function () { return this.index === this.count - 1; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(NgForOfContext.prototype, "even", { - get: function () { return this.index % 2 === 0; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(NgForOfContext.prototype, "odd", { - get: function () { return !this.even; }, - enumerable: true, - configurable: true - }); - return NgForOfContext; -}()); -/** - * A [structural directive](guide/structural-directives) that renders - * a template for each item in a collection. - * The directive is placed on an element, which becomes the parent - * of the cloned templates. - * - * The `ngForOf` is generally used in the - * [shorthand form](guide/structural-directives#the-asterisk--prefix) `*ngFor`. - * In this form, the template to be rendered for each iteration is the content - * of an anchor element containing the directive. - * - * The following example shows the shorthand syntax with some options, - * contained in an `
  • ` element. - * - * ``` - *
  • ...
  • - * ``` - * - * The shorthand form expands into a long form that uses the `ngForOf` selector - * on an `` element. - * The content of the `` element is the `
  • ` element that held the - * short-form directive. - * - * Here is the expanded version of the short-form example. - * - * ``` - * - *
  • ...
  • - *
    - * ``` - * - * Angular automatically expands the shorthand syntax as it compiles the template. - * The context for each embedded view is logically merged to the current component - * context according to its lexical position. - * - * When using the shorthand syntax, Angular allows only [one structural directive - * on an element](guide/structural-directives#one-structural-directive-per-host-element). - * If you want to iterate conditionally, for example, - * put the `*ngIf` on a container element that wraps the `*ngFor` element. - * For futher discussion, see - * [Structural Directives](guide/structural-directives#one-per-element). - * - * @usageNotes - * - * ### Local variables - * - * `NgForOf` provides exported values that can be aliased to local variables. - * For example: - * - * ``` - *
  • - * {{i}}/{{users.length}}. {{user}} default - *
  • - * ``` - * - * The following exported values can be aliased to local variables: - * - * - `$implicit: T`: The value of the individual items in the iterable (`ngForOf`). - * - `ngForOf: NgIterable`: The value of the iterable expression. Useful when the expression is - * more complex then a property access, for example when using the async pipe (`userStreams | - * async`). - * - `index: number`: The index of the current item in the iterable. - * - `first: boolean`: True when the item is the first item in the iterable. - * - `last: boolean`: True when the item is the last item in the iterable. - * - `even: boolean`: True when the item has an even index in the iterable. - * - `odd: boolean`: True when the item has an odd index in the iterable. - * - * ### Change propagation - * - * When the contents of the iterator changes, `NgForOf` makes the corresponding changes to the DOM: - * - * * When an item is added, a new instance of the template is added to the DOM. - * * When an item is removed, its template instance is removed from the DOM. - * * When items are reordered, their respective templates are reordered in the DOM. - * - * Angular uses object identity to track insertions and deletions within the iterator and reproduce - * those changes in the DOM. This has important implications for animations and any stateful - * controls that are present, such as `` elements that accept user input. Inserted rows can - * be animated in, deleted rows can be animated out, and unchanged rows retain any unsaved state - * such as user input. - * For more on animations, see [Transitions and Triggers](guide/transition-and-triggers). - * - * The identities of elements in the iterator can change while the data does not. - * This can happen, for example, if the iterator is produced from an RPC to the server, and that - * RPC is re-run. Even if the data hasn't changed, the second response produces objects with - * different identities, and Angular must tear down the entire DOM and rebuild it (as if all old - * elements were deleted and all new elements inserted). - * - * To avoid this expensive operation, you can customize the default tracking algorithm. - * by supplying the `trackBy` option to `NgForOf`. - * `trackBy` takes a function that has two arguments: `index` and `item`. - * If `trackBy` is given, Angular tracks changes by the return value of the function. - * - * @see [Structural Directives](guide/structural-directives) - * @ngModule CommonModule - * @publicApi - */ -var NgForOf = /** @class */ (function () { - function NgForOf(_viewContainer, _template, _differs) { - this._viewContainer = _viewContainer; - this._template = _template; - this._differs = _differs; - this._ngForOfDirty = true; - this._differ = null; - } - Object.defineProperty(NgForOf.prototype, "ngForOf", { - set: function (ngForOf) { - this._ngForOf = ngForOf; - this._ngForOfDirty = true; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(NgForOf.prototype, "ngForTrackBy", { - get: function () { return this._trackByFn; }, - set: function (fn) { - if (Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["isDevMode"])() && fn != null && typeof fn !== 'function') { - // TODO(vicb): use a log service once there is a public one available - if (console && console.warn) { - console.warn("trackBy must be a function, but received " + JSON.stringify(fn) + ". " + - "See https://angular.io/docs/ts/latest/api/common/index/NgFor-directive.html#!#change-propagation for more information."); - } - } - this._trackByFn = fn; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(NgForOf.prototype, "ngForTemplate", { - set: function (value) { - // TODO(TS2.1): make TemplateRef>> once we move to TS v2.1 - // The current type is too restrictive; a template that just uses index, for example, - // should be acceptable. - if (value) { - this._template = value; - } - }, - enumerable: true, - configurable: true - }); - NgForOf.prototype.ngDoCheck = function () { - if (this._ngForOfDirty) { - this._ngForOfDirty = false; - // React on ngForOf changes only once all inputs have been initialized - var value = this._ngForOf; - if (!this._differ && value) { - try { - this._differ = this._differs.find(value).create(this.ngForTrackBy); - } - catch (_a) { - throw new Error("Cannot find a differ supporting object '" + value + "' of type '" + getTypeNameForDebugging(value) + "'. NgFor only supports binding to Iterables such as Arrays."); - } - } - } - if (this._differ) { - var changes = this._differ.diff(this._ngForOf); - if (changes) - this._applyChanges(changes); - } - }; - NgForOf.prototype._applyChanges = function (changes) { - var _this = this; - var insertTuples = []; - changes.forEachOperation(function (item, adjustedPreviousIndex, currentIndex) { - if (item.previousIndex == null) { - var view = _this._viewContainer.createEmbeddedView(_this._template, new NgForOfContext(null, _this._ngForOf, -1, -1), currentIndex); - var tuple = new RecordViewTuple(item, view); - insertTuples.push(tuple); - } - else if (currentIndex == null) { - _this._viewContainer.remove(adjustedPreviousIndex); - } - else { - var view = _this._viewContainer.get(adjustedPreviousIndex); - _this._viewContainer.move(view, currentIndex); - var tuple = new RecordViewTuple(item, view); - insertTuples.push(tuple); - } - }); - for (var i = 0; i < insertTuples.length; i++) { - this._perViewChange(insertTuples[i].view, insertTuples[i].record); - } - for (var i = 0, ilen = this._viewContainer.length; i < ilen; i++) { - var viewRef = this._viewContainer.get(i); - viewRef.context.index = i; - viewRef.context.count = ilen; - viewRef.context.ngForOf = this._ngForOf; - } - changes.forEachIdentityChange(function (record) { - var viewRef = _this._viewContainer.get(record.currentIndex); - viewRef.context.$implicit = record.item; - }); - }; - NgForOf.prototype._perViewChange = function (view, record) { - view.context.$implicit = record.item; - }; - /** - * Asserts the correct type of the context for the template that `NgForOf` will render. - * - * The presence of this method is a signal to the Ivy template type-check compiler that the - * `NgForOf` structural directive renders its template with a specific context type. - */ - NgForOf.ngTemplateContextGuard = function (dir, ctx) { - return true; - }; - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:type", Object), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [Object]) - ], NgForOf.prototype, "ngForOf", null); - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:type", Function), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [Function]) - ], NgForOf.prototype, "ngForTrackBy", null); - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:type", _angular_core__WEBPACK_IMPORTED_MODULE_0__["TemplateRef"]), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [_angular_core__WEBPACK_IMPORTED_MODULE_0__["TemplateRef"]]) - ], NgForOf.prototype, "ngForTemplate", null); - NgForOf = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"])({ selector: '[ngFor][ngForOf]' }), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [_angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewContainerRef"], _angular_core__WEBPACK_IMPORTED_MODULE_0__["TemplateRef"], - _angular_core__WEBPACK_IMPORTED_MODULE_0__["IterableDiffers"]]) - ], NgForOf); - return NgForOf; -}()); -var RecordViewTuple = /** @class */ (function () { - function RecordViewTuple(record, view) { - this.record = record; - this.view = view; - } - return RecordViewTuple; -}()); -function getTypeNameForDebugging(type) { - return type['name'] || typeof type; -} - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -/** - * A structural directive that conditionally includes a template based on the value of - * an expression coerced to Boolean. - * When the expression evaluates to true, Angular renders the template - * provided in a `then` clause, and when false or null, - * Angular renders the template provided in an optional `else` clause. The default - * template for the `else` clause is blank. - * - * A [shorthand form](guide/structural-directives#the-asterisk--prefix) of the directive, - * `*ngIf="condition"`, is generally used, provided - * as an attribute of the anchor element for the inserted template. - * Angular expands this into a more explicit version, in which the anchor element - * is contained in an `` element. - * - * Simple form with shorthand syntax: - * - * ``` - *
    Content to render when condition is true.
    - * ``` - * - * Simple form with expanded syntax: - * - * ``` - *
    Content to render when condition is - * true.
    - * ``` - * - * Form with an "else" block: - * - * ``` - *
    Content to render when condition is true.
    - * Content to render when condition is false. - * ``` - * - * Shorthand form with "then" and "else" blocks: - * - * ``` - *
    - * Content to render when condition is true. - * Content to render when condition is false. - * ``` - * - * Form with storing the value locally: - * - * ``` - *
    {{value}}
    - * Content to render when value is null. - * ``` - * - * @usageNotes - * - * The `*ngIf` directive is most commonly used to conditionally show an inline template, - * as seen in the following example. - * The default `else` template is blank. - * - * {@example common/ngIf/ts/module.ts region='NgIfSimple'} - * - * ### Showing an alternative template using `else` - * - * To display a template when `expression` evaluates to false, use an `else` template - * binding as shown in the following example. - * The `else` binding points to an `` element labeled `#elseBlock`. - * The template can be defined anywhere in the component view, but is typically placed right after - * `ngIf` for readability. - * - * {@example common/ngIf/ts/module.ts region='NgIfElse'} - * - * ### Using an external `then` template - * - * In the previous example, the then-clause template is specified inline, as the content of the - * tag that contains the `ngIf` directive. You can also specify a template that is defined - * externally, by referencing a labeled `` element. When you do this, you can - * change which template to use at runtime, as shown in the following example. - * - * {@example common/ngIf/ts/module.ts region='NgIfThenElse'} - * - * ### Storing a conditional result in a variable - * - * You might want to show a set of properties from the same object. If you are waiting - * for asynchronous data, the object can be undefined. - * In this case, you can use `ngIf` and store the result of the condition in a local - * variable as shown in the the following example. - * - * {@example common/ngIf/ts/module.ts region='NgIfAs'} - * - * This code uses only one `AsyncPipe`, so only one subscription is created. - * The conditional statement stores the result of `userStream|async` in the local variable `user`. - * You can then bind the local `user` repeatedly. - * - * The conditional displays the data only if `userStream` returns a value, - * so you don't need to use the - * [safe-navigation-operator](guide/template-syntax#safe-navigation-operator) (`?.`) - * to guard against null values when accessing properties. - * You can display an alternative template while waiting for the data. - * - * ### Shorthand syntax - * - * The shorthand syntax `*ngIf` expands into two separate template specifications - * for the "then" and "else" clauses. For example, consider the following shorthand statement, - * that is meant to show a loading page while waiting for data to be loaded. - * - * ``` - *
    - * ... - *
    - * - * - *
    Loading...
    - *
    - * ``` - * - * You can see that the "else" clause references the `` - * with the `#loading` label, and the template for the "then" clause - * is provided as the content of the anchor element. - * - * However, when Angular expands the shorthand syntax, it creates - * another `` tag, with `ngIf` and `ngIfElse` directives. - * The anchor element containing the template for the "then" clause becomes - * the content of this unlabeled `` tag. - * - * ``` - * - *
    - * ... - *
    - *
    - * - * - *
    Loading...
    - *
    - * ``` - * - * The presence of the implicit template object has implications for the nesting of - * structural directives. For more on this subject, see - * [Structural Directives](https://angular.io/guide/structural-directives#one-per-element). - * - * @ngModule CommonModule - * @publicApi - */ -var NgIf = /** @class */ (function () { - function NgIf(_viewContainer, templateRef) { - this._viewContainer = _viewContainer; - this._context = new NgIfContext(); - this._thenTemplateRef = null; - this._elseTemplateRef = null; - this._thenViewRef = null; - this._elseViewRef = null; - this._thenTemplateRef = templateRef; - } - Object.defineProperty(NgIf.prototype, "ngIf", { - set: function (condition) { - this._context.$implicit = this._context.ngIf = condition; - this._updateView(); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(NgIf.prototype, "ngIfThen", { - set: function (templateRef) { - assertTemplate('ngIfThen', templateRef); - this._thenTemplateRef = templateRef; - this._thenViewRef = null; // clear previous view if any. - this._updateView(); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(NgIf.prototype, "ngIfElse", { - set: function (templateRef) { - assertTemplate('ngIfElse', templateRef); - this._elseTemplateRef = templateRef; - this._elseViewRef = null; // clear previous view if any. - this._updateView(); - }, - enumerable: true, - configurable: true - }); - NgIf.prototype._updateView = function () { - if (this._context.$implicit) { - if (!this._thenViewRef) { - this._viewContainer.clear(); - this._elseViewRef = null; - if (this._thenTemplateRef) { - this._thenViewRef = - this._viewContainer.createEmbeddedView(this._thenTemplateRef, this._context); - } - } - } - else { - if (!this._elseViewRef) { - this._viewContainer.clear(); - this._thenViewRef = null; - if (this._elseTemplateRef) { - this._elseViewRef = - this._viewContainer.createEmbeddedView(this._elseTemplateRef, this._context); - } - } - } - }; - /** - * Assert the correct type of the expression bound to the `ngIf` input within the template. - * - * The presence of this method is a signal to the Ivy template type check compiler that when the - * `NgIf` structural directive renders its template, the type of the expression bound to `ngIf` - * should be narrowed in some way. For `NgIf`, it is narrowed to be non-null, which allows the - * strictNullChecks feature of TypeScript to work with `NgIf`. - */ - NgIf.ngTemplateGuard_ngIf = function (dir, expr) { return true; }; - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:type", Object), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [Object]) - ], NgIf.prototype, "ngIf", null); - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:type", Object), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [Object]) - ], NgIf.prototype, "ngIfThen", null); - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:type", Object), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [Object]) - ], NgIf.prototype, "ngIfElse", null); - NgIf = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"])({ selector: '[ngIf]' }), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [_angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewContainerRef"], _angular_core__WEBPACK_IMPORTED_MODULE_0__["TemplateRef"]]) - ], NgIf); - return NgIf; -}()); -/** - * @publicApi - */ -var NgIfContext = /** @class */ (function () { - function NgIfContext() { - this.$implicit = null; - this.ngIf = null; - } - return NgIfContext; -}()); -function assertTemplate(property, templateRef) { - var isTemplateRefOrNull = !!(!templateRef || templateRef.createEmbeddedView); - if (!isTemplateRefOrNull) { - throw new Error(property + " must be a TemplateRef, but received '" + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵstringify"])(templateRef) + "'."); - } -} - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -var SwitchView = /** @class */ (function () { - function SwitchView(_viewContainerRef, _templateRef) { - this._viewContainerRef = _viewContainerRef; - this._templateRef = _templateRef; - this._created = false; - } - SwitchView.prototype.create = function () { - this._created = true; - this._viewContainerRef.createEmbeddedView(this._templateRef); - }; - SwitchView.prototype.destroy = function () { - this._created = false; - this._viewContainerRef.clear(); - }; - SwitchView.prototype.enforceState = function (created) { - if (created && !this._created) { - this.create(); - } - else if (!created && this._created) { - this.destroy(); - } - }; - return SwitchView; -}()); -/** - * @ngModule CommonModule - * - * @description A structural directive that adds or removes templates (displaying or hiding views) - * when the next match expression matches the switch expression. - * - * The `[ngSwitch]` directive on a container specifies an expression to match against. - * The expressions to match are provided by `ngSwitchCase` directives on views within the container. - * - Every view that matches is rendered. - * - If there are no matches, a view with the `ngSwitchDefault` directive is rendered. - * - Elements within the `[NgSwitch]` statement but outside of any `NgSwitchCase` - * or `ngSwitchDefault` directive are preserved at the location. - * - * @usageNotes - * Define a container element for the directive, and specify the switch expression - * to match against as an attribute: - * - * ``` - * - * ``` - * - * Within the container, `*ngSwitchCase` statements specify the match expressions - * as attributes. Include `*ngSwitchDefault` as the final case. - * - * ``` - * - * ... - * ... - * ... - * - * ``` - * - * ### Usage Examples - * - * The following example shows how to use more than one case to display the same view: - * - * ``` - * - * - * ... - * ... - * ... - * - * ... - * - * ``` - * - * The following example shows how cases can be nested: - * ``` - * - * ... - * ... - * ... - * - * - * - * - * - * ... - * - * ``` - * - * @publicApi - * @see `NgSwitchCase` - * @see `NgSwitchDefault` - * @see [Stuctural Directives](guide/structural-directives) - * - */ -var NgSwitch = /** @class */ (function () { - function NgSwitch() { - this._defaultUsed = false; - this._caseCount = 0; - this._lastCaseCheckIndex = 0; - this._lastCasesMatched = false; - } - Object.defineProperty(NgSwitch.prototype, "ngSwitch", { - set: function (newValue) { - this._ngSwitch = newValue; - if (this._caseCount === 0) { - this._updateDefaultCases(true); - } - }, - enumerable: true, - configurable: true - }); - /** @internal */ - NgSwitch.prototype._addCase = function () { return this._caseCount++; }; - /** @internal */ - NgSwitch.prototype._addDefault = function (view) { - if (!this._defaultViews) { - this._defaultViews = []; - } - this._defaultViews.push(view); - }; - /** @internal */ - NgSwitch.prototype._matchCase = function (value) { - var matched = value == this._ngSwitch; - this._lastCasesMatched = this._lastCasesMatched || matched; - this._lastCaseCheckIndex++; - if (this._lastCaseCheckIndex === this._caseCount) { - this._updateDefaultCases(!this._lastCasesMatched); - this._lastCaseCheckIndex = 0; - this._lastCasesMatched = false; - } - return matched; - }; - NgSwitch.prototype._updateDefaultCases = function (useDefault) { - if (this._defaultViews && useDefault !== this._defaultUsed) { - this._defaultUsed = useDefault; - for (var i = 0; i < this._defaultViews.length; i++) { - var defaultView = this._defaultViews[i]; - defaultView.enforceState(useDefault); - } - } - }; - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:type", Object), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [Object]) - ], NgSwitch.prototype, "ngSwitch", null); - NgSwitch = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"])({ selector: '[ngSwitch]' }) - ], NgSwitch); - return NgSwitch; -}()); -/** - * @ngModule CommonModule - * - * @description - * Provides a switch case expression to match against an enclosing `ngSwitch` expression. - * When the expressions match, the given `NgSwitchCase` template is rendered. - * If multiple match expressions match the switch expression value, all of them are displayed. - * - * @usageNotes - * - * Within a switch container, `*ngSwitchCase` statements specify the match expressions - * as attributes. Include `*ngSwitchDefault` as the final case. - * - * ``` - * - * ... - * ... - * ... - * - * ``` - * - * Each switch-case statement contains an in-line HTML template or template reference - * that defines the subtree to be selected if the value of the match expression - * matches the value of the switch expression. - * - * Unlike JavaScript, which uses strict equality, Angular uses loose equality. - * This means that the empty string, `""` matches 0. - * - * @publicApi - * @see `NgSwitch` - * @see `NgSwitchDefault` - * - */ -var NgSwitchCase = /** @class */ (function () { - function NgSwitchCase(viewContainer, templateRef, ngSwitch) { - this.ngSwitch = ngSwitch; - ngSwitch._addCase(); - this._view = new SwitchView(viewContainer, templateRef); - } - /** - * Performs case matching. For internal use only. - */ - NgSwitchCase.prototype.ngDoCheck = function () { this._view.enforceState(this.ngSwitch._matchCase(this.ngSwitchCase)); }; - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:type", Object) - ], NgSwitchCase.prototype, "ngSwitchCase", void 0); - NgSwitchCase = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"])({ selector: '[ngSwitchCase]' }), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__param"])(2, Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Host"])()), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [_angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewContainerRef"], _angular_core__WEBPACK_IMPORTED_MODULE_0__["TemplateRef"], - NgSwitch]) - ], NgSwitchCase); - return NgSwitchCase; -}()); -/** - * @ngModule CommonModule - * - * @description - * - * Creates a view that is rendered when no `NgSwitchCase` expressions - * match the `NgSwitch` expression. - * This statement should be the final case in an `NgSwitch`. - * - * @publicApi - * @see `NgSwitch` - * @see `NgSwitchCase` - * - */ -var NgSwitchDefault = /** @class */ (function () { - function NgSwitchDefault(viewContainer, templateRef, ngSwitch) { - ngSwitch._addDefault(new SwitchView(viewContainer, templateRef)); - } - NgSwitchDefault = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"])({ selector: '[ngSwitchDefault]' }), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__param"])(2, Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Host"])()), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [_angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewContainerRef"], _angular_core__WEBPACK_IMPORTED_MODULE_0__["TemplateRef"], - NgSwitch]) - ], NgSwitchDefault); - return NgSwitchDefault; -}()); - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -/** - * @ngModule CommonModule - * - * @usageNotes - * ``` - * - * there is nothing - * there is one - * there are a few - * - * ``` - * - * @description - * - * Adds / removes DOM sub-trees based on a numeric value. Tailored for pluralization. - * - * Displays DOM sub-trees that match the switch expression value, or failing that, DOM sub-trees - * that match the switch expression's pluralization category. - * - * To use this directive you must provide a container element that sets the `[ngPlural]` attribute - * to a switch expression. Inner elements with a `[ngPluralCase]` will display based on their - * expression: - * - if `[ngPluralCase]` is set to a value starting with `=`, it will only display if the value - * matches the switch expression exactly, - * - otherwise, the view will be treated as a "category match", and will only display if exact - * value matches aren't found and the value maps to its category for the defined locale. - * - * See http://cldr.unicode.org/index/cldr-spec/plural-rules - * - * @publicApi - */ -var NgPlural = /** @class */ (function () { - function NgPlural(_localization) { - this._localization = _localization; - this._caseViews = {}; - } - Object.defineProperty(NgPlural.prototype, "ngPlural", { - set: function (value) { - this._switchValue = value; - this._updateView(); - }, - enumerable: true, - configurable: true - }); - NgPlural.prototype.addCase = function (value, switchView) { this._caseViews[value] = switchView; }; - NgPlural.prototype._updateView = function () { - this._clearViews(); - var cases = Object.keys(this._caseViews); - var key = getPluralCategory(this._switchValue, cases, this._localization); - this._activateView(this._caseViews[key]); - }; - NgPlural.prototype._clearViews = function () { - if (this._activeView) - this._activeView.destroy(); - }; - NgPlural.prototype._activateView = function (view) { - if (view) { - this._activeView = view; - this._activeView.create(); - } - }; - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:type", Number), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [Number]) - ], NgPlural.prototype, "ngPlural", null); - NgPlural = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"])({ selector: '[ngPlural]' }), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [NgLocalization]) - ], NgPlural); - return NgPlural; -}()); -/** - * @ngModule CommonModule - * - * @description - * - * Creates a view that will be added/removed from the parent {@link NgPlural} when the - * given expression matches the plural expression according to CLDR rules. - * - * @usageNotes - * ``` - * - * ... - * ... - * - *``` - * - * See {@link NgPlural} for more details and example. - * - * @publicApi - */ -var NgPluralCase = /** @class */ (function () { - function NgPluralCase(value, template, viewContainer, ngPlural) { - this.value = value; - var isANumber = !isNaN(Number(value)); - ngPlural.addCase(isANumber ? "=" + value : value, new SwitchView(viewContainer, template)); - } - NgPluralCase = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"])({ selector: '[ngPluralCase]' }), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Attribute"])('ngPluralCase')), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__param"])(3, Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Host"])()), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [String, _angular_core__WEBPACK_IMPORTED_MODULE_0__["TemplateRef"], - _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewContainerRef"], NgPlural]) - ], NgPluralCase); - return NgPluralCase; -}()); - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -/** - * @ngModule CommonModule - * - * @usageNotes - * - * Set the font of the containing element to the result of an expression. - * - * ``` - * ... - * ``` - * - * Set the width of the containing element to a pixel value returned by an expression. - * - * ``` - * ... - * ``` - * - * Set a collection of style values using an expression that returns key-value pairs. - * - * ``` - * ... - * ``` - * - * @description - * - * An attribute directive that updates styles for the containing HTML element. - * Sets one or more style properties, specified as colon-separated key-value pairs. - * The key is a style name, with an optional `.` suffix - * (such as 'top.px', 'font-style.em'). - * The value is an expression to be evaluated. - * The resulting non-null value, expressed in the given unit, - * is assigned to the given style property. - * If the result of evaluation is null, the corresponding style is removed. - * - * @publicApi - */ -var NgStyle = /** @class */ (function () { - function NgStyle(_differs, _ngEl, _renderer) { - this._differs = _differs; - this._ngEl = _ngEl; - this._renderer = _renderer; - } - Object.defineProperty(NgStyle.prototype, "ngStyle", { - set: function ( - /** - * A map of style properties, specified as colon-separated - * key-value pairs. - * * The key is a style name, with an optional `.` suffix - * (such as 'top.px', 'font-style.em'). - * * The value is an expression to be evaluated. - */ - values) { - this._ngStyle = values; - if (!this._differ && values) { - this._differ = this._differs.find(values).create(); - } - }, - enumerable: true, - configurable: true - }); - /** - * Applies the new styles if needed. - */ - NgStyle.prototype.ngDoCheck = function () { - if (this._differ) { - var changes = this._differ.diff(this._ngStyle); - if (changes) { - this._applyChanges(changes); - } - } - }; - NgStyle.prototype._applyChanges = function (changes) { - var _this = this; - changes.forEachRemovedItem(function (record) { return _this._setStyle(record.key, null); }); - changes.forEachAddedItem(function (record) { return _this._setStyle(record.key, record.currentValue); }); - changes.forEachChangedItem(function (record) { return _this._setStyle(record.key, record.currentValue); }); - }; - NgStyle.prototype._setStyle = function (nameAndUnit, value) { - var _a = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__read"])(nameAndUnit.split('.'), 2), name = _a[0], unit = _a[1]; - value = value != null && unit ? "" + value + unit : value; - if (value != null) { - this._renderer.setStyle(this._ngEl.nativeElement, name, value); - } - else { - this._renderer.removeStyle(this._ngEl.nativeElement, name); - } - }; - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:type", Object), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [Object]) - ], NgStyle.prototype, "ngStyle", null); - NgStyle = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"])({ selector: '[ngStyle]' }), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [_angular_core__WEBPACK_IMPORTED_MODULE_0__["KeyValueDiffers"], _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"], _angular_core__WEBPACK_IMPORTED_MODULE_0__["Renderer2"]]) - ], NgStyle); - return NgStyle; -}()); - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -/** - * @ngModule CommonModule - * - * @description - * - * Inserts an embedded view from a prepared `TemplateRef`. - * - * You can attach a context object to the `EmbeddedViewRef` by setting `[ngTemplateOutletContext]`. - * `[ngTemplateOutletContext]` should be an object, the object's keys will be available for binding - * by the local template `let` declarations. - * - * @usageNotes - * ``` - * - * ``` - * - * Using the key `$implicit` in the context object will set its value as default. - * - * ### Example - * - * {@example common/ngTemplateOutlet/ts/module.ts region='NgTemplateOutlet'} - * - * @publicApi - */ -var NgTemplateOutlet = /** @class */ (function () { - function NgTemplateOutlet(_viewContainerRef) { - this._viewContainerRef = _viewContainerRef; - } - NgTemplateOutlet.prototype.ngOnChanges = function (changes) { - var recreateView = this._shouldRecreateView(changes); - if (recreateView) { - if (this._viewRef) { - this._viewContainerRef.remove(this._viewContainerRef.indexOf(this._viewRef)); - } - if (this.ngTemplateOutlet) { - this._viewRef = this._viewContainerRef.createEmbeddedView(this.ngTemplateOutlet, this.ngTemplateOutletContext); - } - } - else { - if (this._viewRef && this.ngTemplateOutletContext) { - this._updateExistingContext(this.ngTemplateOutletContext); - } - } - }; - /** - * We need to re-create existing embedded view if: - * - templateRef has changed - * - context has changes - * - * We mark context object as changed when the corresponding object - * shape changes (new properties are added or existing properties are removed). - * In other words we consider context with the same properties as "the same" even - * if object reference changes (see https://github.com/angular/angular/issues/13407). - */ - NgTemplateOutlet.prototype._shouldRecreateView = function (changes) { - var ctxChange = changes['ngTemplateOutletContext']; - return !!changes['ngTemplateOutlet'] || (ctxChange && this._hasContextShapeChanged(ctxChange)); - }; - NgTemplateOutlet.prototype._hasContextShapeChanged = function (ctxChange) { - var e_1, _a; - var prevCtxKeys = Object.keys(ctxChange.previousValue || {}); - var currCtxKeys = Object.keys(ctxChange.currentValue || {}); - if (prevCtxKeys.length === currCtxKeys.length) { - try { - for (var currCtxKeys_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__values"])(currCtxKeys), currCtxKeys_1_1 = currCtxKeys_1.next(); !currCtxKeys_1_1.done; currCtxKeys_1_1 = currCtxKeys_1.next()) { - var propName = currCtxKeys_1_1.value; - if (prevCtxKeys.indexOf(propName) === -1) { - return true; - } - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (currCtxKeys_1_1 && !currCtxKeys_1_1.done && (_a = currCtxKeys_1.return)) _a.call(currCtxKeys_1); - } - finally { if (e_1) throw e_1.error; } - } - return false; - } - else { - return true; - } - }; - NgTemplateOutlet.prototype._updateExistingContext = function (ctx) { - var e_2, _a; - try { - for (var _b = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__values"])(Object.keys(ctx)), _c = _b.next(); !_c.done; _c = _b.next()) { - var propName = _c.value; - this._viewRef.context[propName] = this.ngTemplateOutletContext[propName]; - } - } - catch (e_2_1) { e_2 = { error: e_2_1 }; } - finally { - try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); - } - finally { if (e_2) throw e_2.error; } - } - }; - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:type", Object) - ], NgTemplateOutlet.prototype, "ngTemplateOutletContext", void 0); - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:type", _angular_core__WEBPACK_IMPORTED_MODULE_0__["TemplateRef"]) - ], NgTemplateOutlet.prototype, "ngTemplateOutlet", void 0); - NgTemplateOutlet = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"])({ selector: '[ngTemplateOutlet]' }), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [_angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewContainerRef"]]) - ], NgTemplateOutlet); - return NgTemplateOutlet; -}()); - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -/** - * A collection of Angular directives that are likely to be used in each and every Angular - * application. - */ -var COMMON_DIRECTIVES = [ - NgClass, - NgComponentOutlet, - NgForOf, - NgIf, - NgTemplateOutlet, - NgStyle, - NgSwitch, - NgSwitchCase, - NgSwitchDefault, - NgPlural, - NgPluralCase, -]; - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -function invalidPipeArgumentError(type, value) { - return Error("InvalidPipeArgument: '" + value + "' for pipe '" + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵstringify"])(type) + "'"); -} - -var NumberFormatter = /** @class */ (function () { - function NumberFormatter() { - } - NumberFormatter.format = function (num, locale, style, opts) { - if (opts === void 0) { opts = {}; } - var minimumIntegerDigits = opts.minimumIntegerDigits, minimumFractionDigits = opts.minimumFractionDigits, maximumFractionDigits = opts.maximumFractionDigits, currency = opts.currency, _a = opts.currencyAsSymbol, currencyAsSymbol = _a === void 0 ? false : _a; - var options = { - minimumIntegerDigits: minimumIntegerDigits, - minimumFractionDigits: minimumFractionDigits, - maximumFractionDigits: maximumFractionDigits, - style: NumberFormatStyle[style].toLowerCase() - }; - if (style == NumberFormatStyle.Currency) { - options.currency = typeof currency == 'string' ? currency : undefined; - options.currencyDisplay = currencyAsSymbol ? 'symbol' : 'code'; - } - return new Intl.NumberFormat(locale, options).format(num); - }; - return NumberFormatter; -}()); -var DATE_FORMATS_SPLIT$1 = /((?:[^yMLdHhmsazZEwGjJ']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|L+|d+|H+|h+|J+|j+|m+|s+|a|z|Z|G+|w+))(.*)/; -var PATTERN_ALIASES = { - // Keys are quoted so they do not get renamed during closure compilation. - 'yMMMdjms': datePartGetterFactory(combine([ - digitCondition('year', 1), - nameCondition('month', 3), - digitCondition('day', 1), - digitCondition('hour', 1), - digitCondition('minute', 1), - digitCondition('second', 1), - ])), - 'yMdjm': datePartGetterFactory(combine([ - digitCondition('year', 1), digitCondition('month', 1), digitCondition('day', 1), - digitCondition('hour', 1), digitCondition('minute', 1) - ])), - 'yMMMMEEEEd': datePartGetterFactory(combine([ - digitCondition('year', 1), nameCondition('month', 4), nameCondition('weekday', 4), - digitCondition('day', 1) - ])), - 'yMMMMd': datePartGetterFactory(combine([digitCondition('year', 1), nameCondition('month', 4), digitCondition('day', 1)])), - 'yMMMd': datePartGetterFactory(combine([digitCondition('year', 1), nameCondition('month', 3), digitCondition('day', 1)])), - 'yMd': datePartGetterFactory(combine([digitCondition('year', 1), digitCondition('month', 1), digitCondition('day', 1)])), - 'jms': datePartGetterFactory(combine([digitCondition('hour', 1), digitCondition('second', 1), digitCondition('minute', 1)])), - 'jm': datePartGetterFactory(combine([digitCondition('hour', 1), digitCondition('minute', 1)])) -}; -var DATE_FORMATS$1 = { - // Keys are quoted so they do not get renamed. - 'yyyy': datePartGetterFactory(digitCondition('year', 4)), - 'yy': datePartGetterFactory(digitCondition('year', 2)), - 'y': datePartGetterFactory(digitCondition('year', 1)), - 'MMMM': datePartGetterFactory(nameCondition('month', 4)), - 'MMM': datePartGetterFactory(nameCondition('month', 3)), - 'MM': datePartGetterFactory(digitCondition('month', 2)), - 'M': datePartGetterFactory(digitCondition('month', 1)), - 'LLLL': datePartGetterFactory(nameCondition('month', 4)), - 'L': datePartGetterFactory(nameCondition('month', 1)), - 'dd': datePartGetterFactory(digitCondition('day', 2)), - 'd': datePartGetterFactory(digitCondition('day', 1)), - 'HH': digitModifier(hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 2), false)))), - 'H': hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 1), false))), - 'hh': digitModifier(hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 2), true)))), - 'h': hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 1), true))), - 'jj': datePartGetterFactory(digitCondition('hour', 2)), - 'j': datePartGetterFactory(digitCondition('hour', 1)), - 'mm': digitModifier(datePartGetterFactory(digitCondition('minute', 2))), - 'm': datePartGetterFactory(digitCondition('minute', 1)), - 'ss': digitModifier(datePartGetterFactory(digitCondition('second', 2))), - 's': datePartGetterFactory(digitCondition('second', 1)), - // while ISO 8601 requires fractions to be prefixed with `.` or `,` - // we can be just safely rely on using `sss` since we currently don't support single or two digit - // fractions - 'sss': datePartGetterFactory(digitCondition('second', 3)), - 'EEEE': datePartGetterFactory(nameCondition('weekday', 4)), - 'EEE': datePartGetterFactory(nameCondition('weekday', 3)), - 'EE': datePartGetterFactory(nameCondition('weekday', 2)), - 'E': datePartGetterFactory(nameCondition('weekday', 1)), - 'a': hourClockExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 1), true))), - 'Z': timeZoneGetter$1('short'), - 'z': timeZoneGetter$1('long'), - 'ww': datePartGetterFactory({}), - // first Thursday of the year. not support ? - 'w': datePartGetterFactory({}), - // of the year not support ? - 'G': datePartGetterFactory(nameCondition('era', 1)), - 'GG': datePartGetterFactory(nameCondition('era', 2)), - 'GGG': datePartGetterFactory(nameCondition('era', 3)), - 'GGGG': datePartGetterFactory(nameCondition('era', 4)) -}; -function digitModifier(inner) { - return function (date, locale) { - var result = inner(date, locale); - return result.length == 1 ? '0' + result : result; - }; -} -function hourClockExtractor(inner) { - return function (date, locale) { return inner(date, locale).split(' ')[1]; }; -} -function hourExtractor(inner) { - return function (date, locale) { return inner(date, locale).split(' ')[0]; }; -} -function intlDateFormat(date, locale, options) { - return new Intl.DateTimeFormat(locale, options).format(date).replace(/[\u200e\u200f]/g, ''); -} -function timeZoneGetter$1(timezone) { - // To workaround `Intl` API restriction for single timezone let format with 24 hours - var options = { hour: '2-digit', hour12: false, timeZoneName: timezone }; - return function (date, locale) { - var result = intlDateFormat(date, locale, options); - // Then extract first 3 letters that related to hours - return result ? result.substring(3) : ''; - }; -} -function hour12Modify(options, value) { - options.hour12 = value; - return options; -} -function digitCondition(prop, len) { - var result = {}; - result[prop] = len === 2 ? '2-digit' : 'numeric'; - return result; -} -function nameCondition(prop, len) { - var result = {}; - if (len < 4) { - result[prop] = len > 1 ? 'short' : 'narrow'; - } - else { - result[prop] = 'long'; - } - return result; -} -function combine(options) { - return options.reduce(function (merged, opt) { return (Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__assign"])({}, merged, opt)); }, {}); -} -function datePartGetterFactory(ret) { - return function (date, locale) { return intlDateFormat(date, locale, ret); }; -} -var DATE_FORMATTER_CACHE = new Map(); -function dateFormatter(format, date, locale) { - var fn = PATTERN_ALIASES[format]; - if (fn) - return fn(date, locale); - var cacheKey = format; - var parts = DATE_FORMATTER_CACHE.get(cacheKey); - if (!parts) { - parts = []; - var match = void 0; - DATE_FORMATS_SPLIT$1.exec(format); - var _format = format; - while (_format) { - match = DATE_FORMATS_SPLIT$1.exec(_format); - if (match) { - parts = parts.concat(match.slice(1)); - _format = parts.pop(); - } - else { - parts.push(_format); - _format = null; - } - } - DATE_FORMATTER_CACHE.set(cacheKey, parts); - } - return parts.reduce(function (text, part) { - var fn = DATE_FORMATS$1[part]; - return text + (fn ? fn(date, locale) : partToTime(part)); - }, ''); -} -function partToTime(part) { - return part === '\'\'' ? '\'' : part.replace(/(^'|'$)/g, '').replace(/''/g, '\''); -} -var DateFormatter = /** @class */ (function () { - function DateFormatter() { - } - DateFormatter.format = function (date, locale, pattern) { - return dateFormatter(pattern, date, locale); - }; - return DateFormatter; -}()); - -/** -* @license -* Copyright Google Inc. All Rights Reserved. -* -* Use of this source code is governed by an MIT-style license that can be -* found in the LICENSE file at https://angular.io/license - */ -/** - * @ngModule CommonModule - * @description - * - * Formats a date according to locale rules. - * - * Where: - * - `expression` is a date object or a number (milliseconds since UTC epoch) or an ISO string - * (https://www.w3.org/TR/NOTE-datetime). - * - `format` indicates which date/time components to include. The format can be predefined as - * shown below or custom as shown in the table. - * - `'medium'`: equivalent to `'yMMMdjms'` (e.g. `Sep 3, 2010, 12:05:08 PM` for `en-US`) - * - `'short'`: equivalent to `'yMdjm'` (e.g. `9/3/2010, 12:05 PM` for `en-US`) - * - `'fullDate'`: equivalent to `'yMMMMEEEEd'` (e.g. `Friday, September 3, 2010` for `en-US`) - * - `'longDate'`: equivalent to `'yMMMMd'` (e.g. `September 3, 2010` for `en-US`) - * - `'mediumDate'`: equivalent to `'yMMMd'` (e.g. `Sep 3, 2010` for `en-US`) - * - `'shortDate'`: equivalent to `'yMd'` (e.g. `9/3/2010` for `en-US`) - * - `'mediumTime'`: equivalent to `'jms'` (e.g. `12:05:08 PM` for `en-US`) - * - `'shortTime'`: equivalent to `'jm'` (e.g. `12:05 PM` for `en-US`) - * - * - * | Component | Symbol | Narrow | Short Form | Long Form | Numeric | 2-digit | - * |-----------|:------:|--------|--------------|-------------------|-----------|-----------| - * | era | G | G (A) | GGG (AD) | GGGG (Anno Domini)| - | - | - * | year | y | - | - | - | y (2015) | yy (15) | - * | month | M | L (S) | MMM (Sep) | MMMM (September) | M (9) | MM (09) | - * | day | d | - | - | - | d (3) | dd (03) | - * | weekday | E | E (S) | EEE (Sun) | EEEE (Sunday) | - | - | - * | hour | j | - | - | - | j (13) | jj (13) | - * | hour12 | h | - | - | - | h (1 PM) | hh (01 PM)| - * | hour24 | H | - | - | - | H (13) | HH (13) | - * | minute | m | - | - | - | m (5) | mm (05) | - * | second | s | - | - | - | s (9) | ss (09) | - * | timezone | z | - | - | z (Pacific Standard Time)| - | - | - * | timezone | Z | - | Z (GMT-8:00) | - | - | - | - * | timezone | a | - | a (PM) | - | - | - | - * - * In javascript, only the components specified will be respected (not the ordering, - * punctuations, ...) and details of the formatting will be dependent on the locale. - * - * Timezone of the formatted text will be the local system timezone of the end-user's machine. - * - * When the expression is a ISO string without time (e.g. 2016-09-19) the time zone offset is not - * applied and the formatted text will have the same day, month and year of the expression. - * - * WARNINGS: - * - this pipe is marked as pure hence it will not be re-evaluated when the input is mutated. - * Instead users should treat the date as an immutable object and change the reference when the - * pipe needs to re-run (this is to avoid reformatting the date on every change detection run - * which would be an expensive operation). - * - this pipe uses the Internationalization API. Therefore it is only reliable in Chrome and Opera - * browsers. - * - * @usageNotes - * - * ### Examples - * - * Assuming `dateObj` is (year: 2010, month: 9, day: 3, hour: 12 PM, minute: 05, second: 08) - * in the _local_ time and locale is 'en-US': - * - * {@example common/pipes/ts/date_pipe.ts region='DeprecatedDatePipe'} - * - * @publicApi - */ -var DeprecatedDatePipe = /** @class */ (function () { - function DeprecatedDatePipe(_locale) { - this._locale = _locale; - } - DeprecatedDatePipe_1 = DeprecatedDatePipe; - DeprecatedDatePipe.prototype.transform = function (value, pattern) { - if (pattern === void 0) { pattern = 'mediumDate'; } - if (value == null || value === '' || value !== value) - return null; - var date; - if (typeof value === 'string') { - value = value.trim(); - } - if (isDate$1(value)) { - date = value; - } - else if (!isNaN(value - parseFloat(value))) { - date = new Date(parseFloat(value)); - } - else if (typeof value === 'string' && /^(\d{4}-\d{1,2}-\d{1,2})$/.test(value)) { - /** - * For ISO Strings without time the day, month and year must be extracted from the ISO String - * before Date creation to avoid time offset and errors in the new Date. - * If we only replace '-' with ',' in the ISO String ("2015,01,01"), and try to create a new - * date, some browsers (e.g. IE 9) will throw an invalid Date error - * If we leave the '-' ("2015-01-01") and try to create a new Date("2015-01-01") the - * timeoffset - * is applied - * Note: ISO months are 0 for January, 1 for February, ... - */ - var _a = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__read"])(value.split('-').map(function (val) { return parseInt(val, 10); }), 3), y = _a[0], m = _a[1], d = _a[2]; - date = new Date(y, m - 1, d); - } - else { - date = new Date(value); - } - if (!isDate$1(date)) { - var match = void 0; - if ((typeof value === 'string') && (match = value.match(ISO8601_DATE_REGEX))) { - date = isoStringToDate(match); - } - else { - throw invalidPipeArgumentError(DeprecatedDatePipe_1, value); - } - } - return DateFormatter.format(date, this._locale, DeprecatedDatePipe_1._ALIASES[pattern] || pattern); - }; - var DeprecatedDatePipe_1; - /** @internal */ - DeprecatedDatePipe._ALIASES = { - 'medium': 'yMMMdjms', - 'short': 'yMdjm', - 'fullDate': 'yMMMMEEEEd', - 'longDate': 'yMMMMd', - 'mediumDate': 'yMMMd', - 'shortDate': 'yMd', - 'mediumTime': 'jms', - 'shortTime': 'jm' - }; - DeprecatedDatePipe = DeprecatedDatePipe_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Pipe"])({ name: 'date', pure: true }), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"])(_angular_core__WEBPACK_IMPORTED_MODULE_0__["LOCALE_ID"])), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [String]) - ], DeprecatedDatePipe); - return DeprecatedDatePipe; -}()); -function isDate$1(value) { - return value instanceof Date && !isNaN(value.valueOf()); -} - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -function formatNumber$1(pipe, locale, value, style, digits, currency, currencyAsSymbol) { - if (currency === void 0) { currency = null; } - if (currencyAsSymbol === void 0) { currencyAsSymbol = false; } - if (value == null) - return null; - // Convert strings to numbers - value = typeof value === 'string' && !isNaN(+value - parseFloat(value)) ? +value : value; - if (typeof value !== 'number') { - throw invalidPipeArgumentError(pipe, value); - } - var minInt; - var minFraction; - var maxFraction; - if (style !== NumberFormatStyle.Currency) { - // rely on Intl default for currency - minInt = 1; - minFraction = 0; - maxFraction = 3; - } - if (digits) { - var parts = digits.match(NUMBER_FORMAT_REGEXP); - if (parts === null) { - throw new Error(digits + " is not a valid digit info for number pipes"); - } - if (parts[1] != null) { // min integer digits - minInt = parseIntAutoRadix(parts[1]); - } - if (parts[3] != null) { // min fraction digits - minFraction = parseIntAutoRadix(parts[3]); - } - if (parts[5] != null) { // max fraction digits - maxFraction = parseIntAutoRadix(parts[5]); - } - } - return NumberFormatter.format(value, locale, style, { - minimumIntegerDigits: minInt, - minimumFractionDigits: minFraction, - maximumFractionDigits: maxFraction, - currency: currency, - currencyAsSymbol: currencyAsSymbol, - }); -} -/** - * Formats a number as text. Group sizing and separator and other locale-specific - * configurations are based on the active locale. - * - * where `expression` is a number: - * - `digitInfo` is a `string` which has a following format:
    - * {minIntegerDigits}.{minFractionDigits}-{maxFractionDigits} - * - `minIntegerDigits` is the minimum number of integer digits to use. Defaults to `1`. - * - `minFractionDigits` is the minimum number of digits after fraction. Defaults to `0`. - * - `maxFractionDigits` is the maximum number of digits after fraction. Defaults to `3`. - * - * For more information on the acceptable range for each of these numbers and other - * details see your native internationalization library. - * - * WARNING: this pipe uses the Internationalization API which is not yet available in all browsers - * and may require a polyfill. See [Browser Support](guide/browser-support) for details. - * - * @usageNotes - * - * ### Example - * - * {@example common/pipes/ts/number_pipe.ts region='DeprecatedNumberPipe'} - * - * @ngModule CommonModule - * @publicApi - */ -var DeprecatedDecimalPipe = /** @class */ (function () { - function DeprecatedDecimalPipe(_locale) { - this._locale = _locale; - } - DeprecatedDecimalPipe_1 = DeprecatedDecimalPipe; - DeprecatedDecimalPipe.prototype.transform = function (value, digits) { - return formatNumber$1(DeprecatedDecimalPipe_1, this._locale, value, NumberFormatStyle.Decimal, digits); - }; - var DeprecatedDecimalPipe_1; - DeprecatedDecimalPipe = DeprecatedDecimalPipe_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Pipe"])({ name: 'number' }), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"])(_angular_core__WEBPACK_IMPORTED_MODULE_0__["LOCALE_ID"])), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [String]) - ], DeprecatedDecimalPipe); - return DeprecatedDecimalPipe; -}()); -/** - * @ngModule CommonModule - * - * @description - * - * Formats a number as percentage according to locale rules. - * - * - `digitInfo` See {@link DecimalPipe} for detailed description. - * - * WARNING: this pipe uses the Internationalization API which is not yet available in all browsers - * and may require a polyfill. See [Browser Support](guide/browser-support) for details. - * - * @usageNotes - * - * ### Example - * - * {@example common/pipes/ts/percent_pipe.ts region='DeprecatedPercentPipe'} - * - * @publicApi - */ -var DeprecatedPercentPipe = /** @class */ (function () { - function DeprecatedPercentPipe(_locale) { - this._locale = _locale; - } - DeprecatedPercentPipe_1 = DeprecatedPercentPipe; - DeprecatedPercentPipe.prototype.transform = function (value, digits) { - return formatNumber$1(DeprecatedPercentPipe_1, this._locale, value, NumberFormatStyle.Percent, digits); - }; - var DeprecatedPercentPipe_1; - DeprecatedPercentPipe = DeprecatedPercentPipe_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Pipe"])({ name: 'percent' }), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"])(_angular_core__WEBPACK_IMPORTED_MODULE_0__["LOCALE_ID"])), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [String]) - ], DeprecatedPercentPipe); - return DeprecatedPercentPipe; -}()); -/** - * @ngModule CommonModule - * @description - * - * Formats a number as currency using locale rules. - * - * Use `currency` to format a number as currency. - * - * - `currencyCode` is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, such - * as `USD` for the US dollar and `EUR` for the euro. - * - `symbolDisplay` is a boolean indicating whether to use the currency symbol or code. - * - `true`: use symbol (e.g. `$`). - * - `false`(default): use code (e.g. `USD`). - * - `digitInfo` See {@link DecimalPipe} for detailed description. - * - * WARNING: this pipe uses the Internationalization API which is not yet available in all browsers - * and may require a polyfill. See [Browser Support](guide/browser-support) for details. - * - * @usageNotes - * - * ### Example - * - * {@example common/pipes/ts/currency_pipe.ts region='DeprecatedCurrencyPipe'} - * - * @publicApi - */ -var DeprecatedCurrencyPipe = /** @class */ (function () { - function DeprecatedCurrencyPipe(_locale) { - this._locale = _locale; - } - DeprecatedCurrencyPipe_1 = DeprecatedCurrencyPipe; - DeprecatedCurrencyPipe.prototype.transform = function (value, currencyCode, symbolDisplay, digits) { - if (currencyCode === void 0) { currencyCode = 'USD'; } - if (symbolDisplay === void 0) { symbolDisplay = false; } - return formatNumber$1(DeprecatedCurrencyPipe_1, this._locale, value, NumberFormatStyle.Currency, digits, currencyCode, symbolDisplay); - }; - var DeprecatedCurrencyPipe_1; - DeprecatedCurrencyPipe = DeprecatedCurrencyPipe_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Pipe"])({ name: 'currency' }), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"])(_angular_core__WEBPACK_IMPORTED_MODULE_0__["LOCALE_ID"])), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [String]) - ], DeprecatedCurrencyPipe); - return DeprecatedCurrencyPipe; -}()); - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -/** - * A collection of deprecated i18n pipes that require intl api - * - * @deprecated from v5 - */ -var COMMON_DEPRECATED_I18N_PIPES = [DeprecatedDecimalPipe, DeprecatedPercentPipe, DeprecatedCurrencyPipe, DeprecatedDatePipe]; - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -var ObservableStrategy = /** @class */ (function () { - function ObservableStrategy() { - } - ObservableStrategy.prototype.createSubscription = function (async, updateLatestValue) { - return async.subscribe({ next: updateLatestValue, error: function (e) { throw e; } }); - }; - ObservableStrategy.prototype.dispose = function (subscription) { subscription.unsubscribe(); }; - ObservableStrategy.prototype.onDestroy = function (subscription) { subscription.unsubscribe(); }; - return ObservableStrategy; -}()); -var PromiseStrategy = /** @class */ (function () { - function PromiseStrategy() { - } - PromiseStrategy.prototype.createSubscription = function (async, updateLatestValue) { - return async.then(updateLatestValue, function (e) { throw e; }); - }; - PromiseStrategy.prototype.dispose = function (subscription) { }; - PromiseStrategy.prototype.onDestroy = function (subscription) { }; - return PromiseStrategy; -}()); -var _promiseStrategy = new PromiseStrategy(); -var _observableStrategy = new ObservableStrategy(); -/** - * @ngModule CommonModule - * @description - * - * Unwraps a value from an asynchronous primitive. - * - * The `async` pipe subscribes to an `Observable` or `Promise` and returns the latest value it has - * emitted. When a new value is emitted, the `async` pipe marks the component to be checked for - * changes. When the component gets destroyed, the `async` pipe unsubscribes automatically to avoid - * potential memory leaks. - * - * @usageNotes - * - * ### Examples - * - * This example binds a `Promise` to the view. Clicking the `Resolve` button resolves the - * promise. - * - * {@example common/pipes/ts/async_pipe.ts region='AsyncPipePromise'} - * - * It's also possible to use `async` with Observables. The example below binds the `time` Observable - * to the view. The Observable continuously updates the view with the current time. - * - * {@example common/pipes/ts/async_pipe.ts region='AsyncPipeObservable'} - * - * @publicApi - */ -var AsyncPipe = /** @class */ (function () { - function AsyncPipe(_ref) { - this._ref = _ref; - this._latestValue = null; - this._latestReturnedValue = null; - this._subscription = null; - this._obj = null; - this._strategy = null; - } - AsyncPipe_1 = AsyncPipe; - AsyncPipe.prototype.ngOnDestroy = function () { - if (this._subscription) { - this._dispose(); - } - }; - AsyncPipe.prototype.transform = function (obj) { - if (!this._obj) { - if (obj) { - this._subscribe(obj); - } - this._latestReturnedValue = this._latestValue; - return this._latestValue; - } - if (obj !== this._obj) { - this._dispose(); - return this.transform(obj); - } - if (this._latestValue === this._latestReturnedValue) { - return this._latestReturnedValue; - } - this._latestReturnedValue = this._latestValue; - return _angular_core__WEBPACK_IMPORTED_MODULE_0__["WrappedValue"].wrap(this._latestValue); - }; - AsyncPipe.prototype._subscribe = function (obj) { - var _this = this; - this._obj = obj; - this._strategy = this._selectStrategy(obj); - this._subscription = this._strategy.createSubscription(obj, function (value) { return _this._updateLatestValue(obj, value); }); - }; - AsyncPipe.prototype._selectStrategy = function (obj) { - if (Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵisPromise"])(obj)) { - return _promiseStrategy; - } - if (Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵisObservable"])(obj)) { - return _observableStrategy; - } - throw invalidPipeArgumentError(AsyncPipe_1, obj); - }; - AsyncPipe.prototype._dispose = function () { - this._strategy.dispose(this._subscription); - this._latestValue = null; - this._latestReturnedValue = null; - this._subscription = null; - this._obj = null; - }; - AsyncPipe.prototype._updateLatestValue = function (async, value) { - if (async === this._obj) { - this._latestValue = value; - this._ref.markForCheck(); - } - }; - var AsyncPipe_1; - AsyncPipe = AsyncPipe_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Pipe"])({ name: 'async', pure: false }), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [_angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectorRef"]]) - ], AsyncPipe); - return AsyncPipe; -}()); - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -/** - * Transforms text to all lower case. - * - * @see `UpperCasePipe` - * @see `TitleCasePipe` - * @usageNotes - * - * The following example defines a view that allows the user to enter - * text, and then uses the pipe to convert the input text to all lower case. - * - * - * - * @ngModule CommonModule - * @publicApi - */ -var LowerCasePipe = /** @class */ (function () { - function LowerCasePipe() { - } - LowerCasePipe_1 = LowerCasePipe; - /** - * @param value The string to transform to lower case. - */ - LowerCasePipe.prototype.transform = function (value) { - if (!value) - return value; - if (typeof value !== 'string') { - throw invalidPipeArgumentError(LowerCasePipe_1, value); - } - return value.toLowerCase(); - }; - var LowerCasePipe_1; - LowerCasePipe = LowerCasePipe_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Pipe"])({ name: 'lowercase' }) - ], LowerCasePipe); - return LowerCasePipe; -}()); -// -// Regex below matches any Unicode word and compatible with ES5. In ES2018 the same result -// can be achieved by using /\p{L}\S*/gu and also known as Unicode Property Escapes -// (http://2ality.com/2017/07/regexp-unicode-property-escapes.html). Since there is no -// transpilation of this functionality down to ES5 without external tool, the only solution is -// to use already transpiled form. Example can be found here - -// https://mothereff.in/regexpu#input=var+regex+%3D+/%5Cp%7BL%7D/u%3B&unicodePropertyEscape=1 -// -var unicodeWordMatch = /(?:[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D])\S*/g; -/** - * Transforms text to title case. - * Capitalizes the first letter of each word, and transforms the - * rest of the word to lower case. - * Words are delimited by any whitespace character, such as a space, tab, or line-feed character. - * - * @see `LowerCasePipe` - * @see `UpperCasePipe` - * - * @usageNotes - * The following example shows the result of transforming various strings into title case. - * - * - * - * @ngModule CommonModule - * @publicApi - */ -var TitleCasePipe = /** @class */ (function () { - function TitleCasePipe() { - } - TitleCasePipe_1 = TitleCasePipe; - /** - * @param value The string to transform to title case. - */ - TitleCasePipe.prototype.transform = function (value) { - if (!value) - return value; - if (typeof value !== 'string') { - throw invalidPipeArgumentError(TitleCasePipe_1, value); - } - return value.replace(unicodeWordMatch, (function (txt) { return txt[0].toUpperCase() + txt.substr(1).toLowerCase(); })); - }; - var TitleCasePipe_1; - TitleCasePipe = TitleCasePipe_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Pipe"])({ name: 'titlecase' }) - ], TitleCasePipe); - return TitleCasePipe; -}()); -/** - * Transforms text to all upper case. - * @see `LowerCasePipe` - * @see `TitleCasePipe` - * - * @ngModule CommonModule - * @publicApi - */ -var UpperCasePipe = /** @class */ (function () { - function UpperCasePipe() { - } - UpperCasePipe_1 = UpperCasePipe; - /** - * @param value The string to transform to upper case. - */ - UpperCasePipe.prototype.transform = function (value) { - if (!value) - return value; - if (typeof value !== 'string') { - throw invalidPipeArgumentError(UpperCasePipe_1, value); - } - return value.toUpperCase(); - }; - var UpperCasePipe_1; - UpperCasePipe = UpperCasePipe_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Pipe"])({ name: 'uppercase' }) - ], UpperCasePipe); - return UpperCasePipe; -}()); - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -// clang-format off -/** - * @ngModule CommonModule - * @description - * - * Formats a date value according to locale rules. - * - * Only the `en-US` locale data comes with Angular. To localize dates - * in another language, you must import the corresponding locale data. - * See the [I18n guide](guide/i18n#i18n-pipes) for more information. - * - * @see `formatDate()` - * - * - * @usageNotes - * - * The result of this pipe is not reevaluated when the input is mutated. To avoid the need to - * reformat the date on every change-detection cycle, treat the date as an immutable object - * and change the reference when the pipe needs to run again. - * - * ### Pre-defined format options - * - * Examples are given in `en-US` locale. - * - * - `'short'`: equivalent to `'M/d/yy, h:mm a'` (`6/15/15, 9:03 AM`). - * - `'medium'`: equivalent to `'MMM d, y, h:mm:ss a'` (`Jun 15, 2015, 9:03:01 AM`). - * - `'long'`: equivalent to `'MMMM d, y, h:mm:ss a z'` (`June 15, 2015 at 9:03:01 AM - * GMT+1`). - * - `'full'`: equivalent to `'EEEE, MMMM d, y, h:mm:ss a zzzz'` (`Monday, June 15, 2015 at - * 9:03:01 AM GMT+01:00`). - * - `'shortDate'`: equivalent to `'M/d/yy'` (`6/15/15`). - * - `'mediumDate'`: equivalent to `'MMM d, y'` (`Jun 15, 2015`). - * - `'longDate'`: equivalent to `'MMMM d, y'` (`June 15, 2015`). - * - `'fullDate'`: equivalent to `'EEEE, MMMM d, y'` (`Monday, June 15, 2015`). - * - `'shortTime'`: equivalent to `'h:mm a'` (`9:03 AM`). - * - `'mediumTime'`: equivalent to `'h:mm:ss a'` (`9:03:01 AM`). - * - `'longTime'`: equivalent to `'h:mm:ss a z'` (`9:03:01 AM GMT+1`). - * - `'fullTime'`: equivalent to `'h:mm:ss a zzzz'` (`9:03:01 AM GMT+01:00`). - * - * ### Custom format options - * - * You can construct a format string using symbols to specify the components - * of a date-time value, as described in the following table. - * Format details depend on the locale. - * Fields marked with (*) are only available in the extra data set for the given locale. - * - * | Field type | Format | Description | Example Value | - * |--------------------|-------------|---------------------------------------------------------------|------------------------------------------------------------| - * | Era | G, GG & GGG | Abbreviated | AD | - * | | GGGG | Wide | Anno Domini | - * | | GGGGG | Narrow | A | - * | Year | y | Numeric: minimum digits | 2, 20, 201, 2017, 20173 | - * | | yy | Numeric: 2 digits + zero padded | 02, 20, 01, 17, 73 | - * | | yyy | Numeric: 3 digits + zero padded | 002, 020, 201, 2017, 20173 | - * | | yyyy | Numeric: 4 digits or more + zero padded | 0002, 0020, 0201, 2017, 20173 | - * | Month | M | Numeric: 1 digit | 9, 12 | - * | | MM | Numeric: 2 digits + zero padded | 09, 12 | - * | | MMM | Abbreviated | Sep | - * | | MMMM | Wide | September | - * | | MMMMM | Narrow | S | - * | Month standalone | L | Numeric: 1 digit | 9, 12 | - * | | LL | Numeric: 2 digits + zero padded | 09, 12 | - * | | LLL | Abbreviated | Sep | - * | | LLLL | Wide | September | - * | | LLLLL | Narrow | S | - * | Week of year | w | Numeric: minimum digits | 1... 53 | - * | | ww | Numeric: 2 digits + zero padded | 01... 53 | - * | Week of month | W | Numeric: 1 digit | 1... 5 | - * | Day of month | d | Numeric: minimum digits | 1 | - * | | dd | Numeric: 2 digits + zero padded | 01 | - * | Week day | E, EE & EEE | Abbreviated | Tue | - * | | EEEE | Wide | Tuesday | - * | | EEEEE | Narrow | T | - * | | EEEEEE | Short | Tu | - * | Period | a, aa & aaa | Abbreviated | am/pm or AM/PM | - * | | aaaa | Wide (fallback to `a` when missing) | ante meridiem/post meridiem | - * | | aaaaa | Narrow | a/p | - * | Period* | B, BB & BBB | Abbreviated | mid. | - * | | BBBB | Wide | am, pm, midnight, noon, morning, afternoon, evening, night | - * | | BBBBB | Narrow | md | - * | Period standalone* | b, bb & bbb | Abbreviated | mid. | - * | | bbbb | Wide | am, pm, midnight, noon, morning, afternoon, evening, night | - * | | bbbbb | Narrow | md | - * | Hour 1-12 | h | Numeric: minimum digits | 1, 12 | - * | | hh | Numeric: 2 digits + zero padded | 01, 12 | - * | Hour 0-23 | H | Numeric: minimum digits | 0, 23 | - * | | HH | Numeric: 2 digits + zero padded | 00, 23 | - * | Minute | m | Numeric: minimum digits | 8, 59 | - * | | mm | Numeric: 2 digits + zero padded | 08, 59 | - * | Second | s | Numeric: minimum digits | 0... 59 | - * | | ss | Numeric: 2 digits + zero padded | 00... 59 | - * | Fractional seconds | S | Numeric: 1 digit | 0... 9 | - * | | SS | Numeric: 2 digits + zero padded | 00... 99 | - * | | SSS | Numeric: 3 digits + zero padded (= milliseconds) | 000... 999 | - * | Zone | z, zz & zzz | Short specific non location format (fallback to O) | GMT-8 | - * | | zzzz | Long specific non location format (fallback to OOOO) | GMT-08:00 | - * | | Z, ZZ & ZZZ | ISO8601 basic format | -0800 | - * | | ZZZZ | Long localized GMT format | GMT-8:00 | - * | | ZZZZZ | ISO8601 extended format + Z indicator for offset 0 (= XXXXX) | -08:00 | - * | | O, OO & OOO | Short localized GMT format | GMT-8 | - * | | OOOO | Long localized GMT format | GMT-08:00 | - * - * Note that timezone correction is not applied to an ISO string that has no time component, such as "2016-09-19" - * - * ### Format examples - * - * These examples transform a date into various formats, - * assuming that `dateObj` is a JavaScript `Date` object for - * year: 2015, month: 6, day: 15, hour: 21, minute: 43, second: 11, - * given in the local time for the `en-US` locale. - * - * ``` - * {{ dateObj | date }} // output is 'Jun 15, 2015' - * {{ dateObj | date:'medium' }} // output is 'Jun 15, 2015, 9:43:11 PM' - * {{ dateObj | date:'shortTime' }} // output is '9:43 PM' - * {{ dateObj | date:'mmss' }} // output is '43:11' - * ``` - * - * ### Usage example - * - * The following component uses a date pipe to display the current date in different formats. - * - * ``` - * @Component({ - * selector: 'date-pipe', - * template: `
    - *

    Today is {{today | date}}

    - *

    Or if you prefer, {{today | date:'fullDate'}}

    - *

    The time is {{today | date:'h:mm a z'}}

    - *
    ` - * }) - * // Get the current date and time as a date-time value. - * export class DatePipeComponent { - * today: number = Date.now(); - * } - * ``` - * - * @publicApi - */ -// clang-format on -var DatePipe = /** @class */ (function () { - function DatePipe(locale) { - this.locale = locale; - } - DatePipe_1 = DatePipe; - /** - * @param value The date expression: a `Date` object, a number - * (milliseconds since UTC epoch), or an ISO string (https://www.w3.org/TR/NOTE-datetime). - * @param format The date/time components to include, using predefined options or a - * custom format string. - * @param timezone A timezone offset (such as `'+0430'`), or a standard - * UTC/GMT or continental US timezone abbreviation. Default is - * the local system timezone of the end-user's machine. - * @param locale A locale code for the locale format rules to use. - * When not supplied, uses the value of `LOCALE_ID`, which is `en-US` by default. - * See [Setting your app locale](guide/i18n#setting-up-the-locale-of-your-app). - * @returns A date string in the desired format. - */ - DatePipe.prototype.transform = function (value, format, timezone, locale) { - if (format === void 0) { format = 'mediumDate'; } - if (value == null || value === '' || value !== value) - return null; - try { - return formatDate(value, format, locale || this.locale, timezone); - } - catch (error) { - throw invalidPipeArgumentError(DatePipe_1, error.message); - } - }; - var DatePipe_1; - DatePipe = DatePipe_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Pipe"])({ name: 'date', pure: true }), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"])(_angular_core__WEBPACK_IMPORTED_MODULE_0__["LOCALE_ID"])), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [String]) - ], DatePipe); - return DatePipe; -}()); - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -var _INTERPOLATION_REGEXP = /#/g; -/** - * @ngModule CommonModule - * @description - * - * Maps a value to a string that pluralizes the value according to locale rules. - * - * @usageNotes - * - * ### Example - * - * {@example common/pipes/ts/i18n_pipe.ts region='I18nPluralPipeComponent'} - * - * @publicApi - */ -var I18nPluralPipe = /** @class */ (function () { - function I18nPluralPipe(_localization) { - this._localization = _localization; - } - I18nPluralPipe_1 = I18nPluralPipe; - /** - * @param value the number to be formatted - * @param pluralMap an object that mimics the ICU format, see - * http://userguide.icu-project.org/formatparse/messages. - * @param locale a `string` defining the locale to use (uses the current {@link LOCALE_ID} by - * default). - */ - I18nPluralPipe.prototype.transform = function (value, pluralMap, locale) { - if (value == null) - return ''; - if (typeof pluralMap !== 'object' || pluralMap === null) { - throw invalidPipeArgumentError(I18nPluralPipe_1, pluralMap); - } - var key = getPluralCategory(value, Object.keys(pluralMap), this._localization, locale); - return pluralMap[key].replace(_INTERPOLATION_REGEXP, value.toString()); - }; - var I18nPluralPipe_1; - I18nPluralPipe = I18nPluralPipe_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Pipe"])({ name: 'i18nPlural', pure: true }), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [NgLocalization]) - ], I18nPluralPipe); - return I18nPluralPipe; -}()); - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -/** - * @ngModule CommonModule - * @description - * - * Generic selector that displays the string that matches the current value. - * - * If none of the keys of the `mapping` match the `value`, then the content - * of the `other` key is returned when present, otherwise an empty string is returned. - * - * @usageNotes - * - * ### Example - * - * {@example common/pipes/ts/i18n_pipe.ts region='I18nSelectPipeComponent'} - * - * @publicApi - */ -var I18nSelectPipe = /** @class */ (function () { - function I18nSelectPipe() { - } - I18nSelectPipe_1 = I18nSelectPipe; - /** - * @param value a string to be internationalized. - * @param mapping an object that indicates the text that should be displayed - * for different values of the provided `value`. - */ - I18nSelectPipe.prototype.transform = function (value, mapping) { - if (value == null) - return ''; - if (typeof mapping !== 'object' || typeof value !== 'string') { - throw invalidPipeArgumentError(I18nSelectPipe_1, mapping); - } - if (mapping.hasOwnProperty(value)) { - return mapping[value]; - } - if (mapping.hasOwnProperty('other')) { - return mapping['other']; - } - return ''; - }; - var I18nSelectPipe_1; - I18nSelectPipe = I18nSelectPipe_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Pipe"])({ name: 'i18nSelect', pure: true }) - ], I18nSelectPipe); - return I18nSelectPipe; -}()); - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -/** - * @ngModule CommonModule - * @description - * - * Converts a value into its JSON-format representation. Useful for debugging. - * - * @usageNotes - * - * The following component uses a JSON pipe to convert an object - * to JSON format, and displays the string in both formats for comparison. - * - * {@example common/pipes/ts/json_pipe.ts region='JsonPipe'} - * - * @publicApi - */ -var JsonPipe = /** @class */ (function () { - function JsonPipe() { - } - /** - * @param value A value of any type to convert into a JSON-format string. - */ - JsonPipe.prototype.transform = function (value) { return JSON.stringify(value, null, 2); }; - JsonPipe = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Pipe"])({ name: 'json', pure: false }) - ], JsonPipe); - return JsonPipe; -}()); - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -function makeKeyValuePair(key, value) { - return { key: key, value: value }; -} -/** - * @ngModule CommonModule - * @description - * - * Transforms Object or Map into an array of key value pairs. - * - * The output array will be ordered by keys. - * By default the comparator will be by Unicode point value. - * You can optionally pass a compareFn if your keys are complex types. - * - * @usageNotes - * ### Examples - * - * This examples show how an Object or a Map can be iterated by ngFor with the use of this keyvalue - * pipe. - * - * {@example common/pipes/ts/keyvalue_pipe.ts region='KeyValuePipe'} - * - * @publicApi - */ -var KeyValuePipe = /** @class */ (function () { - function KeyValuePipe(differs) { - this.differs = differs; - this.keyValues = []; - } - KeyValuePipe.prototype.transform = function (input, compareFn) { - var _this = this; - if (compareFn === void 0) { compareFn = defaultComparator; } - if (!input || (!(input instanceof Map) && typeof input !== 'object')) { - return null; - } - if (!this.differ) { - // make a differ for whatever type we've been passed in - this.differ = this.differs.find(input).create(); - } - var differChanges = this.differ.diff(input); - if (differChanges) { - this.keyValues = []; - differChanges.forEachItem(function (r) { - _this.keyValues.push(makeKeyValuePair(r.key, r.currentValue)); - }); - this.keyValues.sort(compareFn); - } - return this.keyValues; - }; - KeyValuePipe = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Pipe"])({ name: 'keyvalue', pure: false }), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [_angular_core__WEBPACK_IMPORTED_MODULE_0__["KeyValueDiffers"]]) - ], KeyValuePipe); - return KeyValuePipe; -}()); -function defaultComparator(keyValueA, keyValueB) { - var a = keyValueA.key; - var b = keyValueB.key; - // if same exit with 0; - if (a === b) - return 0; - // make sure that undefined are at the end of the sort. - if (a === undefined) - return 1; - if (b === undefined) - return -1; - // make sure that nulls are at the end of the sort. - if (a === null) - return 1; - if (b === null) - return -1; - if (typeof a == 'string' && typeof b == 'string') { - return a < b ? -1 : 1; - } - if (typeof a == 'number' && typeof b == 'number') { - return a - b; - } - if (typeof a == 'boolean' && typeof b == 'boolean') { - return a < b ? -1 : 1; - } - // `a` and `b` are of different types. Compare their string values. - var aString = String(a); - var bString = String(b); - return aString == bString ? 0 : aString < bString ? -1 : 1; -} - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -/** - * @ngModule CommonModule - * @description - * - * Transforms a number into a string, - * formatted according to locale rules that determine group sizing and - * separator, decimal-point character, and other locale-specific - * configurations. - * - * If no parameters are specified, the function rounds off to the nearest value using this - * [rounding method](https://en.wikibooks.org/wiki/Arithmetic/Rounding). - * The behavior differs from that of the JavaScript ```Math.round()``` function. - * In the following case for example, the pipe rounds down where - * ```Math.round()``` rounds up: - * - * ```html - * -2.5 | number:'1.0-0' - * > -3 - * Math.round(-2.5) - * > -2 - * ``` - * - * @see `formatNumber()` - * - * @usageNotes - * The following code shows how the pipe transforms numbers - * into text strings, according to various format specifications, - * where the caller's default locale is `en-US`. - * - * ### Example - * - * - * - * @publicApi - */ -var DecimalPipe = /** @class */ (function () { - function DecimalPipe(_locale) { - this._locale = _locale; - } - DecimalPipe_1 = DecimalPipe; - /** - * @param value The number to be formatted. - * @param digitsInfo Decimal representation options, specified by a string - * in the following format:
    - * {minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}. - * - `minIntegerDigits`: The minimum number of integer digits before the decimal point. - * Default is `1`. - * - `minFractionDigits`: The minimum number of digits after the decimal point. - * Default is `0`. - * - `maxFractionDigits`: The maximum number of digits after the decimal point. - * Default is `3`. - * @param locale A locale code for the locale format rules to use. - * When not supplied, uses the value of `LOCALE_ID`, which is `en-US` by default. - * See [Setting your app locale](guide/i18n#setting-up-the-locale-of-your-app). - */ - DecimalPipe.prototype.transform = function (value, digitsInfo, locale) { - if (isEmpty(value)) - return null; - locale = locale || this._locale; - try { - var num = strToNumber(value); - return formatNumber(num, locale, digitsInfo); - } - catch (error) { - throw invalidPipeArgumentError(DecimalPipe_1, error.message); - } - }; - var DecimalPipe_1; - DecimalPipe = DecimalPipe_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Pipe"])({ name: 'number' }), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"])(_angular_core__WEBPACK_IMPORTED_MODULE_0__["LOCALE_ID"])), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [String]) - ], DecimalPipe); - return DecimalPipe; -}()); -/** - * @ngModule CommonModule - * @description - * - * Transforms a number to a percentage - * string, formatted according to locale rules that determine group sizing and - * separator, decimal-point character, and other locale-specific - * configurations. - * - * @see `formatPercent()` - * - * @usageNotes - * The following code shows how the pipe transforms numbers - * into text strings, according to various format specifications, - * where the caller's default locale is `en-US`. - * - * - * - * @publicApi - */ -var PercentPipe = /** @class */ (function () { - function PercentPipe(_locale) { - this._locale = _locale; - } - PercentPipe_1 = PercentPipe; - /** - * - * @param value The number to be formatted as a percentage. - * @param digitsInfo Decimal representation options, specified by a string - * in the following format:
    - * {minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}. - * - `minIntegerDigits`: The minimum number of integer digits before the decimal point. - * Default is `1`. - * - `minFractionDigits`: The minimum number of digits after the decimal point. - * Default is `0`. - * - `maxFractionDigits`: The maximum number of digits after the decimal point. - * Default is `0`. - * @param locale A locale code for the locale format rules to use. - * When not supplied, uses the value of `LOCALE_ID`, which is `en-US` by default. - * See [Setting your app locale](guide/i18n#setting-up-the-locale-of-your-app). - */ - PercentPipe.prototype.transform = function (value, digitsInfo, locale) { - if (isEmpty(value)) - return null; - locale = locale || this._locale; - try { - var num = strToNumber(value); - return formatPercent(num, locale, digitsInfo); - } - catch (error) { - throw invalidPipeArgumentError(PercentPipe_1, error.message); - } - }; - var PercentPipe_1; - PercentPipe = PercentPipe_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Pipe"])({ name: 'percent' }), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"])(_angular_core__WEBPACK_IMPORTED_MODULE_0__["LOCALE_ID"])), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [String]) - ], PercentPipe); - return PercentPipe; -}()); -/** - * @ngModule CommonModule - * @description - * - * Transforms a number to a currency string, formatted according to locale rules - * that determine group sizing and separator, decimal-point character, - * and other locale-specific configurations. - * - * @see `getCurrencySymbol()` - * @see `formatCurrency()` - * - * @usageNotes - * The following code shows how the pipe transforms numbers - * into text strings, according to various format specifications, - * where the caller's default locale is `en-US`. - * - * - * - * @publicApi - */ -var CurrencyPipe = /** @class */ (function () { - function CurrencyPipe(_locale) { - this._locale = _locale; - } - CurrencyPipe_1 = CurrencyPipe; - /** - * - * @param value The number to be formatted as currency. - * @param currencyCode The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, - * such as `USD` for the US dollar and `EUR` for the euro. - * @param display The format for the currency indicator. One of the following: - * - `code`: Show the code (such as `USD`). - * - `symbol`(default): Show the symbol (such as `$`). - * - `symbol-narrow`: Use the narrow symbol for locales that have two symbols for their - * currency. - * For example, the Canadian dollar CAD has the symbol `CA$` and the symbol-narrow `$`. If the - * locale has no narrow symbol, uses the standard symbol for the locale. - * - String: Use the given string value instead of a code or a symbol. - * For example, an empty string will suppress the currency & symbol. - * - Boolean (marked deprecated in v5): `true` for symbol and false for `code`. - * - * @param digitsInfo Decimal representation options, specified by a string - * in the following format:
    - * {minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}. - * - `minIntegerDigits`: The minimum number of integer digits before the decimal point. - * Default is `1`. - * - `minFractionDigits`: The minimum number of digits after the decimal point. - * Default is `2`. - * - `maxFractionDigits`: The maximum number of digits after the decimal point. - * Default is `2`. - * If not provided, the number will be formatted with the proper amount of digits, - * depending on what the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) specifies. - * For example, the Canadian dollar has 2 digits, whereas the Chilean peso has none. - * @param locale A locale code for the locale format rules to use. - * When not supplied, uses the value of `LOCALE_ID`, which is `en-US` by default. - * See [Setting your app locale](guide/i18n#setting-up-the-locale-of-your-app). - */ - CurrencyPipe.prototype.transform = function (value, currencyCode, display, digitsInfo, locale) { - if (display === void 0) { display = 'symbol'; } - if (isEmpty(value)) - return null; - locale = locale || this._locale; - if (typeof display === 'boolean') { - if (console && console.warn) { - console.warn("Warning: the currency pipe has been changed in Angular v5. The symbolDisplay option (third parameter) is now a string instead of a boolean. The accepted values are \"code\", \"symbol\" or \"symbol-narrow\"."); - } - display = display ? 'symbol' : 'code'; - } - var currency = currencyCode || 'USD'; - if (display !== 'code') { - if (display === 'symbol' || display === 'symbol-narrow') { - currency = getCurrencySymbol(currency, display === 'symbol' ? 'wide' : 'narrow', locale); - } - else { - currency = display; - } - } - try { - var num = strToNumber(value); - return formatCurrency(num, locale, currency, currencyCode, digitsInfo); - } - catch (error) { - throw invalidPipeArgumentError(CurrencyPipe_1, error.message); - } - }; - var CurrencyPipe_1; - CurrencyPipe = CurrencyPipe_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Pipe"])({ name: 'currency' }), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"])(_angular_core__WEBPACK_IMPORTED_MODULE_0__["LOCALE_ID"])), - Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [String]) - ], CurrencyPipe); - return CurrencyPipe; -}()); -function isEmpty(value) { - return value == null || value === '' || value !== value; -} -/** - * Transforms a string into a number (if needed). - */ -function strToNumber(value) { - // Convert strings to numbers - if (typeof value === 'string' && !isNaN(Number(value) - parseFloat(value))) { - return Number(value); - } - if (typeof value !== 'number') { - throw new Error(value + " is not a number"); - } - return value; -} - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -/** - * @ngModule CommonModule - * @description - * - * Creates a new `Array` or `String` containing a subset (slice) of the elements. - * - * @usageNotes - * - * All behavior is based on the expected behavior of the JavaScript API `Array.prototype.slice()` - * and `String.prototype.slice()`. - * - * When operating on an `Array`, the returned `Array` is always a copy even when all - * the elements are being returned. - * - * When operating on a blank value, the pipe returns the blank value. - * - * ### List Example - * - * This `ngFor` example: - * - * {@example common/pipes/ts/slice_pipe.ts region='SlicePipe_list'} - * - * produces the following: - * - * ```html - *
  • b
  • - *
  • c
  • - * ``` - * - * ### String Examples - * - * {@example common/pipes/ts/slice_pipe.ts region='SlicePipe_string'} - * - * @publicApi - */ -var SlicePipe = /** @class */ (function () { - function SlicePipe() { - } - SlicePipe_1 = SlicePipe; - /** - * @param value a list or a string to be sliced. - * @param start the starting index of the subset to return: - * - **a positive integer**: return the item at `start` index and all items after - * in the list or string expression. - * - **a negative integer**: return the item at `start` index from the end and all items after - * in the list or string expression. - * - **if positive and greater than the size of the expression**: return an empty list or - * string. - * - **if negative and greater than the size of the expression**: return entire list or string. - * @param end the ending index of the subset to return: - * - **omitted**: return all items until the end. - * - **if positive**: return all items before `end` index of the list or string. - * - **if negative**: return all items before `end` index from the end of the list or string. - */ - SlicePipe.prototype.transform = function (value, start, end) { - if (value == null) - return value; - if (!this.supports(value)) { - throw invalidPipeArgumentError(SlicePipe_1, value); - } - return value.slice(start, end); - }; - SlicePipe.prototype.supports = function (obj) { return typeof obj === 'string' || Array.isArray(obj); }; - var SlicePipe_1; - SlicePipe = SlicePipe_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Pipe"])({ name: 'slice', pure: false }) - ], SlicePipe); - return SlicePipe; -}()); - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -/** - * A collection of Angular pipes that are likely to be used in each and every application. - */ -var COMMON_PIPES = [ - AsyncPipe, - UpperCasePipe, - LowerCasePipe, - JsonPipe, - SlicePipe, - DecimalPipe, - PercentPipe, - TitleCasePipe, - CurrencyPipe, - DatePipe, - I18nPluralPipe, - I18nSelectPipe, - KeyValuePipe, -]; - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -// Note: This does not contain the location providers, -// as they need some platform specific implementations to work. -/** - * Exports all the basic Angular directives and pipes, - * such as `NgIf`, `NgForOf`, `DecimalPipe`, and so on. - * Re-exported by `BrowserModule`, which is included automatically in the root - * `AppModule` when you create a new app with the CLI `new` command. - * - * * The `providers` options configure the NgModule's injector to provide - * localization dependencies to members. - * * The `exports` options make the declared directives and pipes available for import - * by other NgModules. - * - * @publicApi - */ -var CommonModule = /** @class */ (function () { - function CommonModule() { - } - CommonModule = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["NgModule"])({ - declarations: [COMMON_DIRECTIVES, COMMON_PIPES], - exports: [COMMON_DIRECTIVES, COMMON_PIPES], - providers: [ - { provide: NgLocalization, useClass: NgLocaleLocalization }, - ], - }) - ], CommonModule); - return CommonModule; -}()); -var ɵ0 = getPluralCase; -/** - * A module that contains the deprecated i18n pipes. - * - * @deprecated from v5 - * @publicApi - */ -var DeprecatedI18NPipesModule = /** @class */ (function () { - function DeprecatedI18NPipesModule() { - } - DeprecatedI18NPipesModule = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["NgModule"])({ - declarations: [COMMON_DEPRECATED_I18N_PIPES], - exports: [COMMON_DEPRECATED_I18N_PIPES], - providers: [{ provide: DEPRECATED_PLURAL_FN, useValue: ɵ0 }], - }) - ], DeprecatedI18NPipesModule); - return DeprecatedI18NPipesModule; -}()); - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -/** - * A DI Token representing the main rendering context. In a browser this is the DOM Document. - * - * Note: Document might not be available in the Application Context when Application and Rendering - * Contexts are not the same (e.g. when running the application into a Web Worker). - * - * @publicApi - */ -var DOCUMENT = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["InjectionToken"]('DocumentToken'); - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -var PLATFORM_BROWSER_ID = 'browser'; -var PLATFORM_SERVER_ID = 'server'; -var PLATFORM_WORKER_APP_ID = 'browserWorkerApp'; -var PLATFORM_WORKER_UI_ID = 'browserWorkerUi'; -/** - * Returns whether a platform id represents a browser platform. - * @publicApi - */ -function isPlatformBrowser(platformId) { - return platformId === PLATFORM_BROWSER_ID; -} -/** - * Returns whether a platform id represents a server platform. - * @publicApi - */ -function isPlatformServer(platformId) { - return platformId === PLATFORM_SERVER_ID; -} -/** - * Returns whether a platform id represents a web worker app platform. - * @publicApi - */ -function isPlatformWorkerApp(platformId) { - return platformId === PLATFORM_WORKER_APP_ID; -} -/** - * Returns whether a platform id represents a web worker UI platform. - * @publicApi - */ -function isPlatformWorkerUi(platformId) { - return platformId === PLATFORM_WORKER_UI_ID; -} - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -/** - * @publicApi - */ -var VERSION = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["Version"]('7.2.13'); - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -/** - * Defines a scroll position manager. Implemented by `BrowserViewportScroller`. - * - * @publicApi - */ -var ViewportScroller = /** @class */ (function () { - function ViewportScroller() { - } - // De-sugared tree-shakable injection - // See #23917 - /** @nocollapse */ - ViewportScroller.ngInjectableDef = Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["defineInjectable"])({ - providedIn: 'root', - factory: function () { return new BrowserViewportScroller(Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["inject"])(DOCUMENT), window, Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["inject"])(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ErrorHandler"])); } - }); - return ViewportScroller; -}()); -/** - * Manages the scroll position for a browser window. - */ -var BrowserViewportScroller = /** @class */ (function () { - function BrowserViewportScroller(document, window, errorHandler) { - this.document = document; - this.window = window; - this.errorHandler = errorHandler; - this.offset = function () { return [0, 0]; }; - } - /** - * Configures the top offset used when scrolling to an anchor. - * @param offset A position in screen coordinates (a tuple with x and y values) - * or a function that returns the top offset position. - * - */ - BrowserViewportScroller.prototype.setOffset = function (offset) { - if (Array.isArray(offset)) { - this.offset = function () { return offset; }; - } - else { - this.offset = offset; - } - }; - /** - * Retrieves the current scroll position. - * @returns The position in screen coordinates. - */ - BrowserViewportScroller.prototype.getScrollPosition = function () { - if (this.supportScrollRestoration()) { - return [this.window.scrollX, this.window.scrollY]; - } - else { - return [0, 0]; - } - }; - /** - * Sets the scroll position. - * @param position The new position in screen coordinates. - */ - BrowserViewportScroller.prototype.scrollToPosition = function (position) { - if (this.supportScrollRestoration()) { - this.window.scrollTo(position[0], position[1]); - } - }; - /** - * Scrolls to an anchor element. - * @param anchor The ID of the anchor element. - */ - BrowserViewportScroller.prototype.scrollToAnchor = function (anchor) { - if (this.supportScrollRestoration()) { - // Escape anything passed to `querySelector` as it can throw errors and stop the application - // from working if invalid values are passed. - if (this.window.CSS && this.window.CSS.escape) { - anchor = this.window.CSS.escape(anchor); - } - else { - anchor = anchor.replace(/(\"|\'\ |:|\.|\[|\]|,|=)/g, '\\$1'); - } - try { - var elSelectedById = this.document.querySelector("#" + anchor); - if (elSelectedById) { - this.scrollToElement(elSelectedById); - return; - } - var elSelectedByName = this.document.querySelector("[name='" + anchor + "']"); - if (elSelectedByName) { - this.scrollToElement(elSelectedByName); - return; - } - } - catch (e) { - this.errorHandler.handleError(e); - } - } - }; - /** - * Disables automatic scroll restoration provided by the browser. - */ - BrowserViewportScroller.prototype.setHistoryScrollRestoration = function (scrollRestoration) { - if (this.supportScrollRestoration()) { - var history_1 = this.window.history; - if (history_1 && history_1.scrollRestoration) { - history_1.scrollRestoration = scrollRestoration; - } - } - }; - BrowserViewportScroller.prototype.scrollToElement = function (el) { - var rect = el.getBoundingClientRect(); - var left = rect.left + this.window.pageXOffset; - var top = rect.top + this.window.pageYOffset; - var offset = this.offset(); - this.window.scrollTo(left - offset[0], top - offset[1]); - }; - /** - * We only support scroll restoration when we can get a hold of window. - * This means that we do not support this behavior when running in a web worker. - * - * Lifting this restriction right now would require more changes in the dom adapter. - * Since webworkers aren't widely used, we will lift it once RouterScroller is - * battle-tested. - */ - BrowserViewportScroller.prototype.supportScrollRestoration = function () { - try { - return !!this.window && !!this.window.scrollTo; - } - catch (_a) { - return false; - } - }; - return BrowserViewportScroller; -}()); -/** - * Provides an empty implementation of the viewport scroller. This will - * live in @angular/common as it will be used by both platform-server and platform-webworker. - */ -var NullViewportScroller = /** @class */ (function () { - function NullViewportScroller() { - } - /** - * Empty implementation - */ - NullViewportScroller.prototype.setOffset = function (offset) { }; - /** - * Empty implementation - */ - NullViewportScroller.prototype.getScrollPosition = function () { return [0, 0]; }; - /** - * Empty implementation - */ - NullViewportScroller.prototype.scrollToPosition = function (position) { }; - /** - * Empty implementation - */ - NullViewportScroller.prototype.scrollToAnchor = function (anchor) { }; - /** - * Empty implementation - */ - NullViewportScroller.prototype.setHistoryScrollRestoration = function (scrollRestoration) { }; - return NullViewportScroller; -}()); - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -// This file only reexports content of the `src` folder. Keep it that way. - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ - -/** - * Generated bundle index. Do not edit. - */ - - -//# sourceMappingURL=common.js.map - - -/***/ }), - -/***/ "./node_modules/@angular/common/fesm5/http.js": -/*!****************************************************!*\ - !*** ./node_modules/@angular/common/fesm5/http.js ***! - \****************************************************/ -/*! exports provided: ɵangular_packages_common_http_http_a, ɵangular_packages_common_http_http_b, ɵangular_packages_common_http_http_c, ɵangular_packages_common_http_http_d, ɵangular_packages_common_http_http_g, ɵangular_packages_common_http_http_h, ɵangular_packages_common_http_http_e, ɵangular_packages_common_http_http_f, HttpBackend, HttpHandler, HttpClient, HttpHeaders, HTTP_INTERCEPTORS, JsonpClientBackend, JsonpInterceptor, HttpClientJsonpModule, HttpClientModule, HttpClientXsrfModule, ɵHttpInterceptingHandler, HttpParams, HttpUrlEncodingCodec, HttpRequest, HttpErrorResponse, HttpEventType, HttpHeaderResponse, HttpResponse, HttpResponseBase, HttpXhrBackend, XhrFactory, HttpXsrfTokenExtractor */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_http_http_a", function() { return NoopInterceptor; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_http_http_b", function() { return JsonpCallbackContext; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_http_http_c", function() { return jsonpCallbackContext; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_http_http_d", function() { return BrowserXhr; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_http_http_g", function() { return HttpXsrfCookieExtractor; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_http_http_h", function() { return HttpXsrfInterceptor; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_http_http_e", function() { return XSRF_COOKIE_NAME; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_http_http_f", function() { return XSRF_HEADER_NAME; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpBackend", function() { return HttpBackend; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpHandler", function() { return HttpHandler; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpClient", function() { return HttpClient; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpHeaders", function() { return HttpHeaders; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HTTP_INTERCEPTORS", function() { return HTTP_INTERCEPTORS; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "JsonpClientBackend", function() { return JsonpClientBackend; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "JsonpInterceptor", function() { return JsonpInterceptor; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpClientJsonpModule", function() { return HttpClientJsonpModule; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpClientModule", function() { return HttpClientModule; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpClientXsrfModule", function() { return HttpClientXsrfModule; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵHttpInterceptingHandler", function() { return HttpInterceptingHandler; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpParams", function() { return HttpParams; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpUrlEncodingCodec", function() { return HttpUrlEncodingCodec; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpRequest", function() { return HttpRequest; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpErrorResponse", function() { return HttpErrorResponse; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpEventType", function() { return HttpEventType; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpHeaderResponse", function() { return HttpHeaderResponse; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpResponse", function() { return HttpResponse; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpResponseBase", function() { return HttpResponseBase; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpXhrBackend", function() { return HttpXhrBackend; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "XhrFactory", function() { return XhrFactory; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpXsrfTokenExtractor", function() { return HttpXsrfTokenExtractor; }); -/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js"); -/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"); -/* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! rxjs */ "./node_modules/rxjs/_esm5/index.js"); -/* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! rxjs/operators */ "./node_modules/rxjs/_esm5/operators/index.js"); -/* harmony import */ var _angular_common__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @angular/common */ "./node_modules/@angular/common/fesm5/common.js"); -/** - * @license Angular v7.2.13 - * (c) 2010-2019 Google LLC. https://angular.io/ - * License: MIT - */ - - - - - - - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -/** - * Transforms an `HttpRequest` into a stream of `HttpEvent`s, one of which will likely be a - * `HttpResponse`. - * - * `HttpHandler` is injectable. When injected, the handler instance dispatches requests to the - * first interceptor in the chain, which dispatches to the second, etc, eventually reaching the - * `HttpBackend`. - * - * In an `HttpInterceptor`, the `HttpHandler` parameter is the next interceptor in the chain. - * - * @publicApi - */ -var HttpHandler = /** @class */ (function () { - function HttpHandler() { - } - return HttpHandler; -}()); -/** - * A final `HttpHandler` which will dispatch the request via browser HTTP APIs to a backend. - * - * Interceptors sit between the `HttpClient` interface and the `HttpBackend`. - * - * When injected, `HttpBackend` dispatches requests directly to the backend, without going - * through the interceptor chain. - * - * @publicApi - */ -var HttpBackend = /** @class */ (function () { - function HttpBackend() { - } - return HttpBackend; -}()); - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -/** - * `HttpHeaders` class represents the header configuration options for an HTTP request. - * Instances should be assumed immutable with lazy parsing. - * - * @publicApi - */ -var HttpHeaders = /** @class */ (function () { - /** Constructs a new HTTP header object with the given values.*/ - function HttpHeaders(headers) { - var _this = this; - /** - * Internal map of lowercased header names to the normalized - * form of the name (the form seen first). - */ - this.normalizedNames = new Map(); - /** - * Queued updates to be materialized the next initialization. - */ - this.lazyUpdate = null; - if (!headers) { - this.headers = new Map(); - } - else if (typeof headers === 'string') { - this.lazyInit = function () { - _this.headers = new Map(); - headers.split('\n').forEach(function (line) { - var index = line.indexOf(':'); - if (index > 0) { - var name_1 = line.slice(0, index); - var key = name_1.toLowerCase(); - var value = line.slice(index + 1).trim(); - _this.maybeSetNormalizedName(name_1, key); - if (_this.headers.has(key)) { - _this.headers.get(key).push(value); - } - else { - _this.headers.set(key, [value]); - } - } - }); - }; - } - else { - this.lazyInit = function () { - _this.headers = new Map(); - Object.keys(headers).forEach(function (name) { - var values = headers[name]; - var key = name.toLowerCase(); - if (typeof values === 'string') { - values = [values]; - } - if (values.length > 0) { - _this.headers.set(key, values); - _this.maybeSetNormalizedName(name, key); - } - }); - }; - } - } - /** - * Checks for existence of a header by a given name. - * - * @param name The header name to check for existence. - * - * @returns Whether the header exits. - */ - HttpHeaders.prototype.has = function (name) { - this.init(); - return this.headers.has(name.toLowerCase()); - }; - /** - * Returns the first header value that matches a given name. - * - * @param name The header name to retrieve. - * - * @returns A string if the header exists, null otherwise - */ - HttpHeaders.prototype.get = function (name) { - this.init(); - var values = this.headers.get(name.toLowerCase()); - return values && values.length > 0 ? values[0] : null; - }; - /** - * Returns the names of the headers. - * - * @returns A list of header names. - */ - HttpHeaders.prototype.keys = function () { - this.init(); - return Array.from(this.normalizedNames.values()); - }; - /** - * Returns a list of header values for a given header name. - * - * @param name The header name from which to retrieve the values. - * - * @returns A string of values if the header exists, null otherwise. - */ - HttpHeaders.prototype.getAll = function (name) { - this.init(); - return this.headers.get(name.toLowerCase()) || null; - }; - /** - * Appends a new header value to the existing set of - * header values. - * - * @param name The header name for which to append the values. - * - * @returns A clone of the HTTP header object with the value appended. - */ - HttpHeaders.prototype.append = function (name, value) { - return this.clone({ name: name, value: value, op: 'a' }); - }; - /** - * Sets a header value for a given name. If the header name already exists, - * its value is replaced with the given value. - * - * @param name The header name. - * @param value Provides the value to set or overide for a given name. - * - * @returns A clone of the HTTP header object with the newly set header value. - */ - HttpHeaders.prototype.set = function (name, value) { - return this.clone({ name: name, value: value, op: 's' }); - }; - /** - * Deletes all header values for a given name. - * - * @param name The header name. - * @param value The header values to delete for a given name. - * - * @returns A clone of the HTTP header object. - */ - HttpHeaders.prototype.delete = function (name, value) { - return this.clone({ name: name, value: value, op: 'd' }); - }; - HttpHeaders.prototype.maybeSetNormalizedName = function (name, lcName) { - if (!this.normalizedNames.has(lcName)) { - this.normalizedNames.set(lcName, name); - } - }; - HttpHeaders.prototype.init = function () { - var _this = this; - if (!!this.lazyInit) { - if (this.lazyInit instanceof HttpHeaders) { - this.copyFrom(this.lazyInit); - } - else { - this.lazyInit(); - } - this.lazyInit = null; - if (!!this.lazyUpdate) { - this.lazyUpdate.forEach(function (update) { return _this.applyUpdate(update); }); - this.lazyUpdate = null; - } - } - }; - HttpHeaders.prototype.copyFrom = function (other) { - var _this = this; - other.init(); - Array.from(other.headers.keys()).forEach(function (key) { - _this.headers.set(key, other.headers.get(key)); - _this.normalizedNames.set(key, other.normalizedNames.get(key)); - }); - }; - HttpHeaders.prototype.clone = function (update) { - var clone = new HttpHeaders(); - clone.lazyInit = - (!!this.lazyInit && this.lazyInit instanceof HttpHeaders) ? this.lazyInit : this; - clone.lazyUpdate = (this.lazyUpdate || []).concat([update]); - return clone; - }; - HttpHeaders.prototype.applyUpdate = function (update) { - var key = update.name.toLowerCase(); - switch (update.op) { - case 'a': - case 's': - var value = update.value; - if (typeof value === 'string') { - value = [value]; - } - if (value.length === 0) { - return; - } - this.maybeSetNormalizedName(update.name, key); - var base = (update.op === 'a' ? this.headers.get(key) : undefined) || []; - base.push.apply(base, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(value)); - this.headers.set(key, base); - break; - case 'd': - var toDelete_1 = update.value; - if (!toDelete_1) { - this.headers.delete(key); - this.normalizedNames.delete(key); - } - else { - var existing = this.headers.get(key); - if (!existing) { - return; - } - existing = existing.filter(function (value) { return toDelete_1.indexOf(value) === -1; }); - if (existing.length === 0) { - this.headers.delete(key); - this.normalizedNames.delete(key); - } - else { - this.headers.set(key, existing); - } - } - break; - } - }; - /** - * @internal - */ - HttpHeaders.prototype.forEach = function (fn) { - var _this = this; - this.init(); - Array.from(this.normalizedNames.keys()) - .forEach(function (key) { return fn(_this.normalizedNames.get(key), _this.headers.get(key)); }); - }; - return HttpHeaders; -}()); - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -/** - * A class that uses `encodeURIComponent` and `decodeURIComponent` to - * serialize and parse URL parameter keys and values. If you pass URL query parameters - * without encoding, the query parameters can get misinterpreted at the receiving end. - * Use the `HttpParameterCodec` class to encode and decode the query-string values. - * - * @publicApi - */ -var HttpUrlEncodingCodec = /** @class */ (function () { - function HttpUrlEncodingCodec() { - } - HttpUrlEncodingCodec.prototype.encodeKey = function (key) { return standardEncoding(key); }; - HttpUrlEncodingCodec.prototype.encodeValue = function (value) { return standardEncoding(value); }; - HttpUrlEncodingCodec.prototype.decodeKey = function (key) { return decodeURIComponent(key); }; - HttpUrlEncodingCodec.prototype.decodeValue = function (value) { return decodeURIComponent(value); }; - return HttpUrlEncodingCodec; -}()); -function paramParser(rawParams, codec) { - var map$$1 = new Map(); - if (rawParams.length > 0) { - var params = rawParams.split('&'); - params.forEach(function (param) { - var eqIdx = param.indexOf('='); - var _a = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__read"])(eqIdx == -1 ? - [codec.decodeKey(param), ''] : - [codec.decodeKey(param.slice(0, eqIdx)), codec.decodeValue(param.slice(eqIdx + 1))], 2), key = _a[0], val = _a[1]; - var list = map$$1.get(key) || []; - list.push(val); - map$$1.set(key, list); - }); - } - return map$$1; -} -function standardEncoding(v) { - return encodeURIComponent(v) - .replace(/%40/gi, '@') - .replace(/%3A/gi, ':') - .replace(/%24/gi, '$') - .replace(/%2C/gi, ',') - .replace(/%3B/gi, ';') - .replace(/%2B/gi, '+') - .replace(/%3D/gi, '=') - .replace(/%3F/gi, '?') - .replace(/%2F/gi, '/'); -} -/** - * An HTTP request/response body that represents serialized parameters, - * per the MIME type `application/x-www-form-urlencoded`. - * - * This class is immutable - all mutation operations return a new instance. - * - * @publicApi - */ -var HttpParams = /** @class */ (function () { - function HttpParams(options) { - if (options === void 0) { options = {}; } - var _this = this; - this.updates = null; - this.cloneFrom = null; - this.encoder = options.encoder || new HttpUrlEncodingCodec(); - if (!!options.fromString) { - if (!!options.fromObject) { - throw new Error("Cannot specify both fromString and fromObject."); - } - this.map = paramParser(options.fromString, this.encoder); - } - else if (!!options.fromObject) { - this.map = new Map(); - Object.keys(options.fromObject).forEach(function (key) { - var value = options.fromObject[key]; - _this.map.set(key, Array.isArray(value) ? value : [value]); - }); - } - else { - this.map = null; - } - } - /** - * Check whether the body has one or more values for the given parameter name. - */ - HttpParams.prototype.has = function (param) { - this.init(); - return this.map.has(param); - }; - /** - * Get the first value for the given parameter name, or `null` if it's not present. - */ - HttpParams.prototype.get = function (param) { - this.init(); - var res = this.map.get(param); - return !!res ? res[0] : null; - }; - /** - * Get all values for the given parameter name, or `null` if it's not present. - */ - HttpParams.prototype.getAll = function (param) { - this.init(); - return this.map.get(param) || null; - }; - /** - * Get all the parameter names for this body. - */ - HttpParams.prototype.keys = function () { - this.init(); - return Array.from(this.map.keys()); - }; - /** - * Construct a new body with an appended value for the given parameter name. - */ - HttpParams.prototype.append = function (param, value) { return this.clone({ param: param, value: value, op: 'a' }); }; - /** - * Construct a new body with a new value for the given parameter name. - */ - HttpParams.prototype.set = function (param, value) { return this.clone({ param: param, value: value, op: 's' }); }; - /** - * Construct a new body with either the given value for the given parameter - * removed, if a value is given, or all values for the given parameter removed - * if not. - */ - HttpParams.prototype.delete = function (param, value) { return this.clone({ param: param, value: value, op: 'd' }); }; - /** - * Serialize the body to an encoded string, where key-value pairs (separated by `=`) are - * separated by `&`s. - */ - HttpParams.prototype.toString = function () { - var _this = this; - this.init(); - return this.keys() - .map(function (key) { - var eKey = _this.encoder.encodeKey(key); - return _this.map.get(key).map(function (value) { return eKey + '=' + _this.encoder.encodeValue(value); }) - .join('&'); - }) - .join('&'); - }; - HttpParams.prototype.clone = function (update) { - var clone = new HttpParams({ encoder: this.encoder }); - clone.cloneFrom = this.cloneFrom || this; - clone.updates = (this.updates || []).concat([update]); - return clone; - }; - HttpParams.prototype.init = function () { - var _this = this; - if (this.map === null) { - this.map = new Map(); - } - if (this.cloneFrom !== null) { - this.cloneFrom.init(); - this.cloneFrom.keys().forEach(function (key) { return _this.map.set(key, _this.cloneFrom.map.get(key)); }); - this.updates.forEach(function (update) { - switch (update.op) { - case 'a': - case 's': - var base = (update.op === 'a' ? _this.map.get(update.param) : undefined) || []; - base.push(update.value); - _this.map.set(update.param, base); - break; - case 'd': - if (update.value !== undefined) { - var base_1 = _this.map.get(update.param) || []; - var idx = base_1.indexOf(update.value); - if (idx !== -1) { - base_1.splice(idx, 1); - } - if (base_1.length > 0) { - _this.map.set(update.param, base_1); - } - else { - _this.map.delete(update.param); - } - } - else { - _this.map.delete(update.param); - break; - } - } - }); - this.cloneFrom = null; - } - }; - return HttpParams; -}()); - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -/** - * Determine whether the given HTTP method may include a body. - */ -function mightHaveBody(method) { - switch (method) { - case 'DELETE': - case 'GET': - case 'HEAD': - case 'OPTIONS': - case 'JSONP': - return false; - default: - return true; - } -} -/** - * Safely assert whether the given value is an ArrayBuffer. - * - * In some execution environments ArrayBuffer is not defined. - */ -function isArrayBuffer(value) { - return typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer; -} -/** - * Safely assert whether the given value is a Blob. - * - * In some execution environments Blob is not defined. - */ -function isBlob(value) { - return typeof Blob !== 'undefined' && value instanceof Blob; -} -/** - * Safely assert whether the given value is a FormData instance. - * - * In some execution environments FormData is not defined. - */ -function isFormData(value) { - return typeof FormData !== 'undefined' && value instanceof FormData; -} -/** - * An outgoing HTTP request with an optional typed body. - * - * `HttpRequest` represents an outgoing request, including URL, method, - * headers, body, and other request configuration options. Instances should be - * assumed to be immutable. To modify a `HttpRequest`, the `clone` - * method should be used. - * - * @publicApi - */ -var HttpRequest = /** @class */ (function () { - function HttpRequest(method, url, third, fourth) { - this.url = url; - /** - * The request body, or `null` if one isn't set. - * - * Bodies are not enforced to be immutable, as they can include a reference to any - * user-defined data type. However, interceptors should take care to preserve - * idempotence by treating them as such. - */ - this.body = null; - /** - * Whether this request should be made in a way that exposes progress events. - * - * Progress events are expensive (change detection runs on each event) and so - * they should only be requested if the consumer intends to monitor them. - */ - this.reportProgress = false; - /** - * Whether this request should be sent with outgoing credentials (cookies). - */ - this.withCredentials = false; - /** - * The expected response type of the server. - * - * This is used to parse the response appropriately before returning it to - * the requestee. - */ - this.responseType = 'json'; - this.method = method.toUpperCase(); - // Next, need to figure out which argument holds the HttpRequestInit - // options, if any. - var options; - // Check whether a body argument is expected. The only valid way to omit - // the body argument is to use a known no-body method like GET. - if (mightHaveBody(this.method) || !!fourth) { - // Body is the third argument, options are the fourth. - this.body = (third !== undefined) ? third : null; - options = fourth; - } - else { - // No body required, options are the third argument. The body stays null. - options = third; - } - // If options have been passed, interpret them. - if (options) { - // Normalize reportProgress and withCredentials. - this.reportProgress = !!options.reportProgress; - this.withCredentials = !!options.withCredentials; - // Override default response type of 'json' if one is provided. - if (!!options.responseType) { - this.responseType = options.responseType; - } - // Override headers if they're provided. - if (!!options.headers) { - this.headers = options.headers; - } - if (!!options.params) { - this.params = options.params; - } - } - // If no headers have been passed in, construct a new HttpHeaders instance. - if (!this.headers) { - this.headers = new HttpHeaders(); - } - // If no parameters have been passed in, construct a new HttpUrlEncodedParams instance. - if (!this.params) { - this.params = new HttpParams(); - this.urlWithParams = url; - } - else { - // Encode the parameters to a string in preparation for inclusion in the URL. - var params = this.params.toString(); - if (params.length === 0) { - // No parameters, the visible URL is just the URL given at creation time. - this.urlWithParams = url; - } - else { - // Does the URL already have query parameters? Look for '?'. - var qIdx = url.indexOf('?'); - // There are 3 cases to handle: - // 1) No existing parameters -> append '?' followed by params. - // 2) '?' exists and is followed by existing query string -> - // append '&' followed by params. - // 3) '?' exists at the end of the url -> append params directly. - // This basically amounts to determining the character, if any, with - // which to join the URL and parameters. - var sep = qIdx === -1 ? '?' : (qIdx < url.length - 1 ? '&' : ''); - this.urlWithParams = url + sep + params; - } - } - } - /** - * Transform the free-form body into a serialized format suitable for - * transmission to the server. - */ - HttpRequest.prototype.serializeBody = function () { - // If no body is present, no need to serialize it. - if (this.body === null) { - return null; - } - // Check whether the body is already in a serialized form. If so, - // it can just be returned directly. - if (isArrayBuffer(this.body) || isBlob(this.body) || isFormData(this.body) || - typeof this.body === 'string') { - return this.body; - } - // Check whether the body is an instance of HttpUrlEncodedParams. - if (this.body instanceof HttpParams) { - return this.body.toString(); - } - // Check whether the body is an object or array, and serialize with JSON if so. - if (typeof this.body === 'object' || typeof this.body === 'boolean' || - Array.isArray(this.body)) { - return JSON.stringify(this.body); - } - // Fall back on toString() for everything else. - return this.body.toString(); - }; - /** - * Examine the body and attempt to infer an appropriate MIME type - * for it. - * - * If no such type can be inferred, this method will return `null`. - */ - HttpRequest.prototype.detectContentTypeHeader = function () { - // An empty body has no content type. - if (this.body === null) { - return null; - } - // FormData bodies rely on the browser's content type assignment. - if (isFormData(this.body)) { - return null; - } - // Blobs usually have their own content type. If it doesn't, then - // no type can be inferred. - if (isBlob(this.body)) { - return this.body.type || null; - } - // Array buffers have unknown contents and thus no type can be inferred. - if (isArrayBuffer(this.body)) { - return null; - } - // Technically, strings could be a form of JSON data, but it's safe enough - // to assume they're plain strings. - if (typeof this.body === 'string') { - return 'text/plain'; - } - // `HttpUrlEncodedParams` has its own content-type. - if (this.body instanceof HttpParams) { - return 'application/x-www-form-urlencoded;charset=UTF-8'; - } - // Arrays, objects, and numbers will be encoded as JSON. - if (typeof this.body === 'object' || typeof this.body === 'number' || - Array.isArray(this.body)) { - return 'application/json'; - } - // No type could be inferred. - return null; - }; - HttpRequest.prototype.clone = function (update) { - if (update === void 0) { update = {}; } - // For method, url, and responseType, take the current value unless - // it is overridden in the update hash. - var method = update.method || this.method; - var url = update.url || this.url; - var responseType = update.responseType || this.responseType; - // The body is somewhat special - a `null` value in update.body means - // whatever current body is present is being overridden with an empty - // body, whereas an `undefined` value in update.body implies no - // override. - var body = (update.body !== undefined) ? update.body : this.body; - // Carefully handle the boolean options to differentiate between - // `false` and `undefined` in the update args. - var withCredentials = (update.withCredentials !== undefined) ? update.withCredentials : this.withCredentials; - var reportProgress = (update.reportProgress !== undefined) ? update.reportProgress : this.reportProgress; - // Headers and params may be appended to if `setHeaders` or - // `setParams` are used. - var headers = update.headers || this.headers; - var params = update.params || this.params; - // Check whether the caller has asked to add headers. - if (update.setHeaders !== undefined) { - // Set every requested header. - headers = - Object.keys(update.setHeaders) - .reduce(function (headers, name) { return headers.set(name, update.setHeaders[name]); }, headers); - } - // Check whether the caller has asked to set params. - if (update.setParams) { - // Set every requested param. - params = Object.keys(update.setParams) - .reduce(function (params, param) { return params.set(param, update.setParams[param]); }, params); - } - // Finally, construct the new HttpRequest using the pieces from above. - return new HttpRequest(method, url, body, { - params: params, headers: headers, reportProgress: reportProgress, responseType: responseType, withCredentials: withCredentials, - }); - }; - return HttpRequest; -}()); - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -/** - * Type enumeration for the different kinds of `HttpEvent`. - * - * @publicApi - */ -var HttpEventType; -(function (HttpEventType) { - /** - * The request was sent out over the wire. - */ - HttpEventType[HttpEventType["Sent"] = 0] = "Sent"; - /** - * An upload progress event was received. - */ - HttpEventType[HttpEventType["UploadProgress"] = 1] = "UploadProgress"; - /** - * The response status code and headers were received. - */ - HttpEventType[HttpEventType["ResponseHeader"] = 2] = "ResponseHeader"; - /** - * A download progress event was received. - */ - HttpEventType[HttpEventType["DownloadProgress"] = 3] = "DownloadProgress"; - /** - * The full response including the body was received. - */ - HttpEventType[HttpEventType["Response"] = 4] = "Response"; - /** - * A custom event from an interceptor or a backend. - */ - HttpEventType[HttpEventType["User"] = 5] = "User"; -})(HttpEventType || (HttpEventType = {})); -/** - * Base class for both `HttpResponse` and `HttpHeaderResponse`. - * - * @publicApi - */ -var HttpResponseBase = /** @class */ (function () { - /** - * Super-constructor for all responses. - * - * The single parameter accepted is an initialization hash. Any properties - * of the response passed there will override the default values. - */ - function HttpResponseBase(init, defaultStatus, defaultStatusText) { - if (defaultStatus === void 0) { defaultStatus = 200; } - if (defaultStatusText === void 0) { defaultStatusText = 'OK'; } - // If the hash has values passed, use them to initialize the response. - // Otherwise use the default values. - this.headers = init.headers || new HttpHeaders(); - this.status = init.status !== undefined ? init.status : defaultStatus; - this.statusText = init.statusText || defaultStatusText; - this.url = init.url || null; - // Cache the ok value to avoid defining a getter. - this.ok = this.status >= 200 && this.status < 300; - } - return HttpResponseBase; -}()); -/** - * A partial HTTP response which only includes the status and header data, - * but no response body. - * - * `HttpHeaderResponse` is a `HttpEvent` available on the response - * event stream, only when progress events are requested. - * - * @publicApi - */ -var HttpHeaderResponse = /** @class */ (function (_super) { - Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(HttpHeaderResponse, _super); - /** - * Create a new `HttpHeaderResponse` with the given parameters. - */ - function HttpHeaderResponse(init) { - if (init === void 0) { init = {}; } - var _this = _super.call(this, init) || this; - _this.type = HttpEventType.ResponseHeader; - return _this; - } - /** - * Copy this `HttpHeaderResponse`, overriding its contents with the - * given parameter hash. - */ - HttpHeaderResponse.prototype.clone = function (update) { - if (update === void 0) { update = {}; } - // Perform a straightforward initialization of the new HttpHeaderResponse, - // overriding the current parameters with new ones if given. - return new HttpHeaderResponse({ - headers: update.headers || this.headers, - status: update.status !== undefined ? update.status : this.status, - statusText: update.statusText || this.statusText, - url: update.url || this.url || undefined, - }); - }; - return HttpHeaderResponse; -}(HttpResponseBase)); -/** - * A full HTTP response, including a typed response body (which may be `null` - * if one was not returned). - * - * `HttpResponse` is a `HttpEvent` available on the response event - * stream. - * - * @publicApi - */ -var HttpResponse = /** @class */ (function (_super) { - Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(HttpResponse, _super); - /** - * Construct a new `HttpResponse`. - */ - function HttpResponse(init) { - if (init === void 0) { init = {}; } - var _this = _super.call(this, init) || this; - _this.type = HttpEventType.Response; - _this.body = init.body !== undefined ? init.body : null; - return _this; - } - HttpResponse.prototype.clone = function (update) { - if (update === void 0) { update = {}; } - return new HttpResponse({ - body: (update.body !== undefined) ? update.body : this.body, - headers: update.headers || this.headers, - status: (update.status !== undefined) ? update.status : this.status, - statusText: update.statusText || this.statusText, - url: update.url || this.url || undefined, - }); - }; - return HttpResponse; -}(HttpResponseBase)); -/** - * A response that represents an error or failure, either from a - * non-successful HTTP status, an error while executing the request, - * or some other failure which occurred during the parsing of the response. - * - * Any error returned on the `Observable` response stream will be - * wrapped in an `HttpErrorResponse` to provide additional context about - * the state of the HTTP layer when the error occurred. The error property - * will contain either a wrapped Error object or the error response returned - * from the server. - * - * @publicApi - */ -var HttpErrorResponse = /** @class */ (function (_super) { - Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(HttpErrorResponse, _super); - function HttpErrorResponse(init) { - var _this = - // Initialize with a default status of 0 / Unknown Error. - _super.call(this, init, 0, 'Unknown Error') || this; - _this.name = 'HttpErrorResponse'; - /** - * Errors are never okay, even when the status code is in the 2xx success range. - */ - _this.ok = false; - // If the response was successful, then this was a parse error. Otherwise, it was - // a protocol-level failure of some sort. Either the request failed in transit - // or the server returned an unsuccessful status code. - if (_this.status >= 200 && _this.status < 300) { - _this.message = "Http failure during parsing for " + (init.url || '(unknown url)'); - } - else { - _this.message = - "Http failure response for " + (init.url || '(unknown url)') + ": " + init.status + " " + init.statusText; - } - _this.error = init.error || null; - return _this; - } - return HttpErrorResponse; -}(HttpResponseBase)); - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -/** - * Constructs an instance of `HttpRequestOptions` from a source `HttpMethodOptions` and - * the given `body`. This function clones the object and adds the body. - */ -function addBody(options, body) { - return { - body: body, - headers: options.headers, - observe: options.observe, - params: options.params, - reportProgress: options.reportProgress, - responseType: options.responseType, - withCredentials: options.withCredentials, - }; -} -/** - * Performs HTTP requests. - * - * `HttpClient` is available as an injectable class, with methods to perform HTTP requests. - * Each request method has multiple signatures, and the return type varies based on - * the signature that is called (mainly the values of `observe` and `responseType`). - * - * - * @see [HTTP Guide](guide/http) - * - * - * @usageNotes - * Sample HTTP requests for the [Tour of Heroes](/tutorial/toh-pt0) application. - * - * ### HTTP Request Example - * - * ``` - * // GET heroes whose name contains search term - * searchHeroes(term: string): observable{ - * - * const params = new HttpParams({fromString: 'name=term'}); - * return this.httpClient.request('GET', this.heroesUrl, {responseType:'json', params}); - * } - * ``` - * ### JSONP Example - * ``` - * requestJsonp(url, callback = 'callback') { - * return this.httpClient.jsonp(this.heroesURL, callback); - * } - * ``` - * - * - * ### PATCH Example - * ``` - * // PATCH one of the heroes' name - * patchHero (id: number, heroName: string): Observable<{}> { - * const url = `${this.heroesUrl}/${id}`; // PATCH api/heroes/42 - * return this.httpClient.patch(url, {name: heroName}, httpOptions) - * .pipe(catchError(this.handleError('patchHero'))); - * } -* ``` - * - * @publicApi - */ -var HttpClient = /** @class */ (function () { - function HttpClient(handler) { - this.handler = handler; - } - /** - * Constructs an observable for a generic HTTP request that, when subscribed, - * fires the request through the chain of registered interceptors and on to the - * server. - * - * You can pass an `HttpRequest` directly as the only parameter. In this case, - * the call returns an observable of the raw `HttpEvent` stream. - * - * Alternatively you can pass an HTTP method as the first parameter, - * a URL string as the second, and an options hash containing the request body as the third. - * See `addBody()`. In this case, the specified `responseType` and `observe` options determine the - * type of returned observable. - * * The `responseType` value determines how a successful response body is parsed. - * * If `responseType` is the default `json`, you can pass a type interface for the resulting - * object as a type parameter to the call. - * - * The `observe` value determines the return type, according to what you are interested in - * observing. - * * An `observe` value of events returns an observable of the raw `HttpEvent` stream, including - * progress events by default. - * * An `observe` value of response returns an observable of `HttpResponse`, - * where the `T` parameter depends on the `responseType` and any optionally provided type - * parameter. - * * An `observe` value of body returns an observable of `` with the same `T` body type. - * - */ - HttpClient.prototype.request = function (first, url, options) { - var _this = this; - if (options === void 0) { options = {}; } - var req; - // First, check whether the primary argument is an instance of `HttpRequest`. - if (first instanceof HttpRequest) { - // It is. The other arguments must be undefined (per the signatures) and can be - // ignored. - req = first; - } - else { - // It's a string, so it represents a URL. Construct a request based on it, - // and incorporate the remaining arguments (assuming `GET` unless a method is - // provided. - // Figure out the headers. - var headers = undefined; - if (options.headers instanceof HttpHeaders) { - headers = options.headers; - } - else { - headers = new HttpHeaders(options.headers); - } - // Sort out parameters. - var params = undefined; - if (!!options.params) { - if (options.params instanceof HttpParams) { - params = options.params; - } - else { - params = new HttpParams({ fromObject: options.params }); - } - } - // Construct the request. - req = new HttpRequest(first, url, (options.body !== undefined ? options.body : null), { - headers: headers, - params: params, - reportProgress: options.reportProgress, - // By default, JSON is assumed to be returned for all calls. - responseType: options.responseType || 'json', - withCredentials: options.withCredentials, - }); - } - // Start with an Observable.of() the initial request, and run the handler (which - // includes all interceptors) inside a concatMap(). This way, the handler runs - // inside an Observable chain, which causes interceptors to be re-run on every - // subscription (this also makes retries re-run the handler, including interceptors). - var events$ = Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(req).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["concatMap"])(function (req) { return _this.handler.handle(req); })); - // If coming via the API signature which accepts a previously constructed HttpRequest, - // the only option is to get the event stream. Otherwise, return the event stream if - // that is what was requested. - if (first instanceof HttpRequest || options.observe === 'events') { - return events$; - } - // The requested stream contains either the full response or the body. In either - // case, the first step is to filter the event stream to extract a stream of - // responses(s). - var res$ = events$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["filter"])(function (event) { return event instanceof HttpResponse; })); - // Decide which stream to return. - switch (options.observe || 'body') { - case 'body': - // The requested stream is the body. Map the response stream to the response - // body. This could be done more simply, but a misbehaving interceptor might - // transform the response body into a different format and ignore the requested - // responseType. Guard against this by validating that the response is of the - // requested type. - switch (req.responseType) { - case 'arraybuffer': - return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])(function (res) { - // Validate that the body is an ArrayBuffer. - if (res.body !== null && !(res.body instanceof ArrayBuffer)) { - throw new Error('Response is not an ArrayBuffer.'); - } - return res.body; - })); - case 'blob': - return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])(function (res) { - // Validate that the body is a Blob. - if (res.body !== null && !(res.body instanceof Blob)) { - throw new Error('Response is not a Blob.'); - } - return res.body; - })); - case 'text': - return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])(function (res) { - // Validate that the body is a string. - if (res.body !== null && typeof res.body !== 'string') { - throw new Error('Response is not a string.'); - } - return res.body; - })); - case 'json': - default: - // No validation needed for JSON responses, as they can be of any type. - return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])(function (res) { return res.body; })); - } - case 'response': - // The response stream was requested directly, so return it. - return res$; - default: - // Guard against new future observe types being added. - throw new Error("Unreachable: unhandled observe type " + options.observe + "}"); - } - }; - /** - * Constructs an observable that, when subscribed, causes the configured - * `DELETE` request to execute on the server. See the individual overloads for - * details on the return type. - * - * @param url The endpoint URL. - * @param options The HTTP options to send with the request. - * - */ - HttpClient.prototype.delete = function (url, options) { - if (options === void 0) { options = {}; } - return this.request('DELETE', url, options); - }; - /** - * Constructs an observable that, when subscribed, causes the configured - * `GET` request to execute on the server. See the individual overloads for - * details on the return type. - */ - HttpClient.prototype.get = function (url, options) { - if (options === void 0) { options = {}; } - return this.request('GET', url, options); - }; - /** - * Constructs an observable that, when subscribed, causes the configured - * `HEAD` request to execute on the server. The `HEAD` method returns - * meta information about the resource without transferring the - * resource itself. See the individual overloads for - * details on the return type. - */ - HttpClient.prototype.head = function (url, options) { - if (options === void 0) { options = {}; } - return this.request('HEAD', url, options); - }; - /** - * Constructs an `Observable` that, when subscribed, causes a request with the special method - * `JSONP` to be dispatched via the interceptor pipeline. - * The [JSONP pattern](https://en.wikipedia.org/wiki/JSONP) works around limitations of certain - * API endpoints that don't support newer, - * and preferable [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) protocol. - * JSONP treats the endpoint API as a JavaScript file and tricks the browser to process the - * requests even if the API endpoint is not located on the same domain (origin) as the client-side - * application making the request. - * The endpoint API must support JSONP callback for JSONP requests to work. - * The resource API returns the JSON response wrapped in a callback function. - * You can pass the callback function name as one of the query parameters. - * Note that JSONP requests can only be used with `GET` requests. - * - * @param url The resource URL. - * @param callbackParam The callback function name. - * - */ - HttpClient.prototype.jsonp = function (url, callbackParam) { - return this.request('JSONP', url, { - params: new HttpParams().append(callbackParam, 'JSONP_CALLBACK'), - observe: 'body', - responseType: 'json', - }); - }; - /** - * Constructs an `Observable` that, when subscribed, causes the configured - * `OPTIONS` request to execute on the server. This method allows the client - * to determine the supported HTTP methods and other capabilites of an endpoint, - * without implying a resource action. See the individual overloads for - * details on the return type. - */ - HttpClient.prototype.options = function (url, options) { - if (options === void 0) { options = {}; } - return this.request('OPTIONS', url, options); - }; - /** - * Constructs an observable that, when subscribed, causes the configured - * `PATCH` request to execute on the server. See the individual overloads for - * details on the return type. - */ - HttpClient.prototype.patch = function (url, body, options) { - if (options === void 0) { options = {}; } - return this.request('PATCH', url, addBody(options, body)); - }; - /** - * Constructs an observable that, when subscribed, causes the configured - * `POST` request to execute on the server. The server responds with the location of - * the replaced resource. See the individual overloads for - * details on the return type. - */ - HttpClient.prototype.post = function (url, body, options) { - if (options === void 0) { options = {}; } - return this.request('POST', url, addBody(options, body)); - }; - /** - * Constructs an observable that, when subscribed, causes the configured - * `PUT` request to execute on the server. The `PUT` method replaces an existing resource - * with a new set of values. - * See the individual overloads for details on the return type. - */ - HttpClient.prototype.put = function (url, body, options) { - if (options === void 0) { options = {}; } - return this.request('PUT', url, addBody(options, body)); - }; - HttpClient = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Injectable"])(), - Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [HttpHandler]) - ], HttpClient); - return HttpClient; -}()); - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -/** - * `HttpHandler` which applies an `HttpInterceptor` to an `HttpRequest`. - * - * - */ -var HttpInterceptorHandler = /** @class */ (function () { - function HttpInterceptorHandler(next, interceptor) { - this.next = next; - this.interceptor = interceptor; - } - HttpInterceptorHandler.prototype.handle = function (req) { - return this.interceptor.intercept(req, this.next); - }; - return HttpInterceptorHandler; -}()); -/** - * A multi-provider token which represents the array of `HttpInterceptor`s that - * are registered. - * - * @publicApi - */ -var HTTP_INTERCEPTORS = new _angular_core__WEBPACK_IMPORTED_MODULE_1__["InjectionToken"]('HTTP_INTERCEPTORS'); -var NoopInterceptor = /** @class */ (function () { - function NoopInterceptor() { - } - NoopInterceptor.prototype.intercept = function (req, next) { - return next.handle(req); - }; - NoopInterceptor = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([ - Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Injectable"])() - ], NoopInterceptor); - return NoopInterceptor; -}()); - -/** - * @license - * Copyright Google Inc. All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://angular.io/license - */ -// Every request made through JSONP needs a callback name that's unique across the -// whole page. Each request is assigned an id and the callback name is constructed -// from that. The next id to be assigned is tracked in a global variable here that -// is shared among all applications on the page. -var nextRequestId = 0; -// Error text given when a JSONP script is injected, but doesn't invoke the callback -// passed in its URL. -var JSONP_ERR_NO_CALLBACK = 'JSONP injected script did not invoke callback.'; -// Error text given when a request is passed to the JsonpClientBackend that doesn't -// have a request method JSONP. -var JSONP_ERR_WRONG_METHOD = 'JSONP requests must use JSONP request method.'; -var JSONP_ERR_WRONG_RESPONSE_TYPE = 'JSONP requests must use Json response type.'; -/** - * DI token/abstract type representing a map of JSONP callbacks. - * - * In the browser, this should always be the `window` object. - * - * - */ -var JsonpCallbackContext = /** @class */ (function () { - function JsonpCallbackContext() { - } - return JsonpCallbackContext; -}()); -/** - * `HttpBackend` that only processes `HttpRequest` with the JSONP method, - * by performing JSONP style requests. - * - * @publicApi - */ -var JsonpClientBackend = /** @class */ (function () { - function JsonpClientBackend(callbackMap, document) { - this.callbackMap = callbackMap; - this.document = document; - } - /** - * Get the name of the next callback method, by incrementing the global `nextRequestId`. - */ - JsonpClientBackend.prototype.nextCallback = function () { return "ng_jsonp_callback_" + nextRequestId++; }; - /** - * Process a JSONP request and return an event stream of the results. - */ - JsonpClientBackend.prototype.handle = function (req) { - var _this = this; - // Firstly, check both the method and response type. If either doesn't match - // then the request was improperly routed here and cannot be handled. - if (req.method !== 'JSONP') { - throw new Error(JSONP_ERR_WRONG_METHOD); - } - else if (req.responseType !== 'json') { - throw new Error(JSONP_ERR_WRONG_RESPONSE_TYPE); - } - // Everything else happens inside the Observable boundary. - return new rxjs__WEBPACK_IMPORTED_MODULE_2__["Observable"](function (observer) { - // The first step to make a request is to generate the callback name, and replace the - // callback placeholder in the URL with the name. Care has to be taken here to ensure - // a trailing &, if matched, gets inserted back into the URL in the correct place. - var callback = _this.nextCallback(); - var url = req.urlWithParams.replace(/=JSONP_CALLBACK(&|$)/, "=" + callback + "$1"); - // Construct the