{"version":3,"file":"vendors-4e64aa37.981ca8458d389c9a476a.bundle.js","mappings":";;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;AC90BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACpfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","sources":["webpack://latinera/./node_modules/aurelia-polyfills/dist/native-modules/aurelia-polyfills.js","webpack://latinera/./node_modules/aurelia-route-recognizer/dist/native-modules/aurelia-route-recognizer.js","webpack://latinera/./node_modules/aurelia-router/dist/native-modules/aurelia-router.js"],"sourcesContent":["var _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nimport { PLATFORM } from 'aurelia-pal';\n\nif (typeof FEATURE_NO_ES2015 === 'undefined') {\n\n (function (Object, GOPS) {\n 'use strict';\n\n if (GOPS in Object) return;\n\n var setDescriptor,\n G = PLATFORM.global,\n id = 0,\n random = '' + Math.random(),\n prefix = '__\\x01symbol:',\n prefixLength = prefix.length,\n internalSymbol = '__\\x01symbol@@' + random,\n DP = 'defineProperty',\n DPies = 'defineProperties',\n GOPN = 'getOwnPropertyNames',\n GOPD = 'getOwnPropertyDescriptor',\n PIE = 'propertyIsEnumerable',\n gOPN = Object[GOPN],\n gOPD = Object[GOPD],\n create = Object.create,\n keys = Object.keys,\n defineProperty = Object[DP],\n $defineProperties = Object[DPies],\n descriptor = gOPD(Object, GOPN),\n ObjectProto = Object.prototype,\n hOP = ObjectProto.hasOwnProperty,\n pIE = ObjectProto[PIE],\n toString = ObjectProto.toString,\n indexOf = Array.prototype.indexOf || function (v) {\n for (var i = this.length; i-- && this[i] !== v;) {}\n return i;\n },\n addInternalIfNeeded = function addInternalIfNeeded(o, uid, enumerable) {\n if (!hOP.call(o, internalSymbol)) {\n defineProperty(o, internalSymbol, {\n enumerable: false,\n configurable: false,\n writable: false,\n value: {}\n });\n }\n o[internalSymbol]['@@' + uid] = enumerable;\n },\n createWithSymbols = function createWithSymbols(proto, descriptors) {\n var self = create(proto);\n if (descriptors !== null && (typeof descriptors === 'undefined' ? 'undefined' : _typeof(descriptors)) === 'object') {\n gOPN(descriptors).forEach(function (key) {\n if (propertyIsEnumerable.call(descriptors, key)) {\n $defineProperty(self, key, descriptors[key]);\n }\n });\n }\n return self;\n },\n copyAsNonEnumerable = function copyAsNonEnumerable(descriptor) {\n var newDescriptor = create(descriptor);\n newDescriptor.enumerable = false;\n return newDescriptor;\n },\n get = function get() {},\n onlyNonSymbols = function onlyNonSymbols(name) {\n return name != internalSymbol && !hOP.call(source, name);\n },\n onlySymbols = function onlySymbols(name) {\n return name != internalSymbol && hOP.call(source, name);\n },\n propertyIsEnumerable = function propertyIsEnumerable(key) {\n var uid = '' + key;\n return onlySymbols(uid) ? hOP.call(this, uid) && this[internalSymbol] && this[internalSymbol]['@@' + uid] : pIE.call(this, key);\n },\n setAndGetSymbol = function setAndGetSymbol(uid) {\n var descriptor = {\n enumerable: false,\n configurable: true,\n get: get,\n set: function set(value) {\n setDescriptor(this, uid, {\n enumerable: false,\n configurable: true,\n writable: true,\n value: value\n });\n addInternalIfNeeded(this, uid, true);\n }\n };\n defineProperty(ObjectProto, uid, descriptor);\n return source[uid] = defineProperty(Object(uid), 'constructor', sourceConstructor);\n },\n _Symbol = function _Symbol2(description) {\n if (this && this !== G) {\n throw new TypeError('Symbol is not a constructor');\n }\n return setAndGetSymbol(prefix.concat(description || '', random, ++id));\n },\n source = create(null),\n sourceConstructor = { value: _Symbol },\n sourceMap = function sourceMap(uid) {\n return source[uid];\n },\n $defineProperty = function defineProp(o, key, descriptor) {\n var uid = '' + key;\n if (onlySymbols(uid)) {\n setDescriptor(o, uid, descriptor.enumerable ? copyAsNonEnumerable(descriptor) : descriptor);\n addInternalIfNeeded(o, uid, !!descriptor.enumerable);\n } else {\n defineProperty(o, key, descriptor);\n }\n return o;\n },\n $getOwnPropertySymbols = function getOwnPropertySymbols(o) {\n var cof = toString.call(o);\n o = cof === '[object String]' ? o.split('') : Object(o);\n return gOPN(o).filter(onlySymbols).map(sourceMap);\n };\n\n descriptor.value = $defineProperty;\n defineProperty(Object, DP, descriptor);\n\n descriptor.value = $getOwnPropertySymbols;\n defineProperty(Object, GOPS, descriptor);\n\n var cachedWindowNames = (typeof window === 'undefined' ? 'undefined' : _typeof(window)) === 'object' ? Object.getOwnPropertyNames(window) : [];\n var originalObjectGetOwnPropertyNames = Object.getOwnPropertyNames;\n descriptor.value = function getOwnPropertyNames(o) {\n if (toString.call(o) === '[object Window]') {\n try {\n return originalObjectGetOwnPropertyNames(o);\n } catch (e) {\n return [].concat([], cachedWindowNames);\n }\n }\n return gOPN(o).filter(onlyNonSymbols);\n };\n defineProperty(Object, GOPN, descriptor);\n\n descriptor.value = function defineProperties(o, descriptors) {\n var symbols = $getOwnPropertySymbols(descriptors);\n if (symbols.length) {\n keys(descriptors).concat(symbols).forEach(function (uid) {\n if (propertyIsEnumerable.call(descriptors, uid)) {\n $defineProperty(o, uid, descriptors[uid]);\n }\n });\n } else {\n $defineProperties(o, descriptors);\n }\n return o;\n };\n defineProperty(Object, DPies, descriptor);\n\n descriptor.value = propertyIsEnumerable;\n defineProperty(ObjectProto, PIE, descriptor);\n\n descriptor.value = _Symbol;\n defineProperty(G, 'Symbol', descriptor);\n\n descriptor.value = function (key) {\n var uid = prefix.concat(prefix, key, random);\n return uid in ObjectProto ? source[uid] : setAndGetSymbol(uid);\n };\n defineProperty(_Symbol, 'for', descriptor);\n\n descriptor.value = function (symbol) {\n return hOP.call(source, symbol) ? symbol.slice(prefixLength * 2, -random.length) : void 0;\n };\n defineProperty(_Symbol, 'keyFor', descriptor);\n\n descriptor.value = function getOwnPropertyDescriptor(o, key) {\n var descriptor = gOPD(o, key);\n if (descriptor && onlySymbols(key)) {\n descriptor.enumerable = propertyIsEnumerable.call(o, key);\n }\n return descriptor;\n };\n defineProperty(Object, GOPD, descriptor);\n\n descriptor.value = function (proto, descriptors) {\n return arguments.length === 1 ? create(proto) : createWithSymbols(proto, descriptors);\n };\n defineProperty(Object, 'create', descriptor);\n\n descriptor.value = function () {\n var str = toString.call(this);\n return str === '[object String]' && onlySymbols(this) ? '[object Symbol]' : str;\n };\n defineProperty(ObjectProto, 'toString', descriptor);\n\n try {\n setDescriptor = create(defineProperty({}, prefix, {\n get: function get() {\n return defineProperty(this, prefix, { value: false })[prefix];\n }\n }))[prefix] || defineProperty;\n } catch (o_O) {\n setDescriptor = function setDescriptor(o, key, descriptor) {\n var protoDescriptor = gOPD(ObjectProto, key);\n delete ObjectProto[key];\n defineProperty(o, key, descriptor);\n defineProperty(ObjectProto, key, protoDescriptor);\n };\n }\n })(Object, 'getOwnPropertySymbols');\n\n (function (O, S) {\n var dP = O.defineProperty,\n ObjectProto = O.prototype,\n toString = ObjectProto.toString,\n toStringTag = 'toStringTag',\n descriptor;\n ['iterator', 'match', 'replace', 'search', 'split', 'hasInstance', 'isConcatSpreadable', 'unscopables', 'species', 'toPrimitive', toStringTag].forEach(function (name) {\n if (!(name in Symbol)) {\n dP(Symbol, name, { value: Symbol(name) });\n switch (name) {\n case toStringTag:\n descriptor = O.getOwnPropertyDescriptor(ObjectProto, 'toString');\n descriptor.value = function () {\n var str = toString.call(this),\n tst = typeof this === 'undefined' || this === null ? undefined : this[Symbol.toStringTag];\n return typeof tst === 'undefined' ? str : '[object ' + tst + ']';\n };\n dP(ObjectProto, 'toString', descriptor);\n break;\n }\n }\n });\n })(Object, Symbol);\n\n (function (Si, AP, SP) {\n\n function returnThis() {\n return this;\n }\n\n if (!AP[Si]) AP[Si] = function () {\n var i = 0,\n self = this,\n iterator = {\n next: function next() {\n var done = self.length <= i;\n return done ? { done: done } : { done: done, value: self[i++] };\n }\n };\n iterator[Si] = returnThis;\n return iterator;\n };\n\n if (!SP[Si]) SP[Si] = function () {\n var fromCodePoint = String.fromCodePoint,\n self = this,\n i = 0,\n length = self.length,\n iterator = {\n next: function next() {\n var done = length <= i,\n c = done ? '' : fromCodePoint(self.codePointAt(i));\n i += c.length;\n return done ? { done: done } : { done: done, value: c };\n }\n };\n iterator[Si] = returnThis;\n return iterator;\n };\n })(Symbol.iterator, Array.prototype, String.prototype);\n}\n\nif (typeof FEATURE_NO_ES2015 === 'undefined') {\n\n Number.isNaN = Number.isNaN || function (value) {\n return value !== value;\n };\n\n Number.isFinite = Number.isFinite || function (value) {\n return typeof value === \"number\" && isFinite(value);\n };\n}\n\nif (!String.prototype.endsWith || function () {\n try {\n return !\"ab\".endsWith(\"a\", 1);\n } catch (e) {\n return true;\n }\n}()) {\n String.prototype.endsWith = function (searchString, position) {\n var subjectString = this.toString();\n if (typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > subjectString.length) {\n position = subjectString.length;\n }\n position -= searchString.length;\n var lastIndex = subjectString.indexOf(searchString, position);\n return lastIndex !== -1 && lastIndex === position;\n };\n}\n\nif (!String.prototype.startsWith || function () {\n try {\n return !\"ab\".startsWith(\"b\", 1);\n } catch (e) {\n return true;\n }\n}()) {\n String.prototype.startsWith = function (searchString, position) {\n position = position || 0;\n return this.substr(position, searchString.length) === searchString;\n };\n}\n\nif (typeof FEATURE_NO_ES2015 === 'undefined') {\n\n if (!Array.from) {\n Array.from = function () {\n var toInteger = function toInteger(it) {\n return isNaN(it = +it) ? 0 : (it > 0 ? Math.floor : Math.ceil)(it);\n };\n var toLength = function toLength(it) {\n return it > 0 ? Math.min(toInteger(it), 0x1fffffffffffff) : 0;\n };\n var iterCall = function iterCall(iter, fn, val, index) {\n try {\n return fn(val, index);\n } catch (E) {\n if (typeof iter.return == 'function') iter.return();\n throw E;\n }\n };\n\n return function from(arrayLike) {\n var O = Object(arrayLike),\n C = typeof this == 'function' ? this : Array,\n aLen = arguments.length,\n mapfn = aLen > 1 ? arguments[1] : undefined,\n mapping = mapfn !== undefined,\n index = 0,\n iterFn = O[Symbol.iterator],\n length,\n result,\n step,\n iterator;\n if (mapping) mapfn = mapfn.bind(aLen > 2 ? arguments[2] : undefined);\n if (iterFn != undefined && !Array.isArray(arrayLike)) {\n for (iterator = iterFn.call(O), result = new C(); !(step = iterator.next()).done; index++) {\n result[index] = mapping ? iterCall(iterator, mapfn, step.value, index) : step.value;\n }\n } else {\n length = toLength(O.length);\n for (result = new C(length); length > index; index++) {\n result[index] = mapping ? mapfn(O[index], index) : O[index];\n }\n }\n result.length = index;\n return result;\n };\n }();\n }\n\n if (!Array.prototype.find) {\n Object.defineProperty(Array.prototype, 'find', {\n configurable: true,\n writable: true,\n enumerable: false,\n value: function value(predicate) {\n if (this === null) {\n throw new TypeError('Array.prototype.find called on null or undefined');\n }\n if (typeof predicate !== 'function') {\n throw new TypeError('predicate must be a function');\n }\n var list = Object(this);\n var length = list.length >>> 0;\n var thisArg = arguments[1];\n var value;\n\n for (var i = 0; i < length; i++) {\n value = list[i];\n if (predicate.call(thisArg, value, i, list)) {\n return value;\n }\n }\n return undefined;\n }\n });\n }\n\n if (!Array.prototype.findIndex) {\n Object.defineProperty(Array.prototype, 'findIndex', {\n configurable: true,\n writable: true,\n enumerable: false,\n value: function value(predicate) {\n if (this === null) {\n throw new TypeError('Array.prototype.findIndex called on null or undefined');\n }\n if (typeof predicate !== 'function') {\n throw new TypeError('predicate must be a function');\n }\n var list = Object(this);\n var length = list.length >>> 0;\n var thisArg = arguments[1];\n var value;\n\n for (var i = 0; i < length; i++) {\n value = list[i];\n if (predicate.call(thisArg, value, i, list)) {\n return i;\n }\n }\n return -1;\n }\n });\n }\n}\n\nif (typeof FEATURE_NO_ES2016 === 'undefined' && !Array.prototype.includes) {\n Object.defineProperty(Array.prototype, 'includes', {\n configurable: true,\n writable: true,\n enumerable: false,\n value: function value(searchElement) {\n var O = Object(this);\n var len = parseInt(O.length) || 0;\n if (len === 0) {\n return false;\n }\n var n = parseInt(arguments[1]) || 0;\n var k;\n if (n >= 0) {\n k = n;\n } else {\n k = len + n;\n if (k < 0) {\n k = 0;\n }\n }\n var currentElement;\n while (k < len) {\n currentElement = O[k];\n if (searchElement === currentElement || searchElement !== searchElement && currentElement !== currentElement) {\n return true;\n }\n k++;\n }\n return false;\n }\n });\n}\n\nif (typeof FEATURE_NO_ES2015 === 'undefined') {\n\n (function () {\n var needsFix = false;\n\n try {\n var s = Object.keys('a');\n needsFix = s.length !== 1 || s[0] !== '0';\n } catch (e) {\n needsFix = true;\n }\n\n if (needsFix) {\n Object.keys = function () {\n var hasOwnProperty = Object.prototype.hasOwnProperty,\n hasDontEnumBug = !{ toString: null }.propertyIsEnumerable('toString'),\n dontEnums = ['toString', 'toLocaleString', 'valueOf', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'constructor'],\n dontEnumsLength = dontEnums.length;\n\n return function (obj) {\n if (obj === undefined || obj === null) {\n throw TypeError('Cannot convert undefined or null to object');\n }\n\n obj = Object(obj);\n\n var result = [],\n prop,\n i;\n\n for (prop in obj) {\n if (hasOwnProperty.call(obj, prop)) {\n result.push(prop);\n }\n }\n\n if (hasDontEnumBug) {\n for (i = 0; i < dontEnumsLength; i++) {\n if (hasOwnProperty.call(obj, dontEnums[i])) {\n result.push(dontEnums[i]);\n }\n }\n }\n\n return result;\n };\n }();\n }\n })();\n\n (function (O) {\n if ('assign' in O) {\n return;\n }\n\n O.defineProperty(O, 'assign', {\n configurable: true,\n writable: true,\n value: function () {\n var gOPS = O.getOwnPropertySymbols,\n pIE = O.propertyIsEnumerable,\n filterOS = gOPS ? function (self) {\n return gOPS(self).filter(pIE, self);\n } : function () {\n return Array.prototype;\n };\n\n return function assign(where) {\n if (gOPS && !(where instanceof O)) {\n console.warn('problematic Symbols', where);\n }\n\n function set(keyOrSymbol) {\n where[keyOrSymbol] = arg[keyOrSymbol];\n }\n\n for (var i = 1, ii = arguments.length; i < ii; ++i) {\n var arg = arguments[i];\n\n if (arg === null || arg === undefined) {\n continue;\n }\n\n O.keys(arg).concat(filterOS(arg)).forEach(set);\n }\n\n return where;\n };\n }()\n });\n })(Object);\n\n if (!Object.is) {\n Object.is = function (x, y) {\n if (x === y) {\n return x !== 0 || 1 / x === 1 / y;\n } else {\n return x !== x && y !== y;\n }\n };\n }\n}\n\nif (typeof FEATURE_NO_ES2015 === 'undefined') {\n\n (function (global) {\n var i;\n\n var defineProperty = Object.defineProperty,\n is = function is(a, b) {\n return a === b || a !== a && b !== b;\n };\n\n if (typeof WeakMap == 'undefined') {\n global.WeakMap = createCollection({\n 'delete': sharedDelete,\n\n clear: sharedClear,\n\n get: sharedGet,\n\n has: mapHas,\n\n set: sharedSet\n }, true);\n }\n\n if (typeof Map == 'undefined' || typeof new Map().values !== 'function' || !new Map().values().next) {\n var _createCollection;\n\n global.Map = createCollection((_createCollection = {\n 'delete': sharedDelete,\n\n has: mapHas,\n\n get: sharedGet,\n\n set: sharedSet,\n\n keys: sharedKeys,\n\n values: sharedValues,\n\n entries: mapEntries,\n\n forEach: sharedForEach,\n\n clear: sharedClear\n }, _createCollection[Symbol.iterator] = mapEntries, _createCollection));\n }\n\n if (typeof Set == 'undefined' || typeof new Set().values !== 'function' || !new Set().values().next) {\n var _createCollection2;\n\n global.Set = createCollection((_createCollection2 = {\n has: setHas,\n\n add: sharedAdd,\n\n 'delete': sharedDelete,\n\n clear: sharedClear,\n\n keys: sharedValues,\n values: sharedValues,\n\n entries: setEntries,\n\n forEach: sharedForEach\n }, _createCollection2[Symbol.iterator] = sharedValues, _createCollection2));\n }\n\n if (typeof WeakSet == 'undefined') {\n global.WeakSet = createCollection({\n 'delete': sharedDelete,\n\n add: sharedAdd,\n\n clear: sharedClear,\n\n has: setHas\n }, true);\n }\n\n function createCollection(proto, objectOnly) {\n function Collection(a) {\n if (!this || this.constructor !== Collection) return new Collection(a);\n this._keys = [];\n this._values = [];\n this._itp = [];\n this.objectOnly = objectOnly;\n\n if (a) init.call(this, a);\n }\n\n if (!objectOnly) {\n defineProperty(proto, 'size', {\n get: sharedSize\n });\n }\n\n proto.constructor = Collection;\n Collection.prototype = proto;\n\n return Collection;\n }\n\n function init(a) {\n var i;\n\n if (this.add) a.forEach(this.add, this);else a.forEach(function (a) {\n this.set(a[0], a[1]);\n }, this);\n }\n\n function sharedDelete(key) {\n if (this.has(key)) {\n this._keys.splice(i, 1);\n this._values.splice(i, 1);\n\n this._itp.forEach(function (p) {\n if (i < p[0]) p[0]--;\n });\n }\n\n return -1 < i;\n };\n\n function sharedGet(key) {\n return this.has(key) ? this._values[i] : undefined;\n }\n\n function has(list, key) {\n if (this.objectOnly && key !== Object(key)) throw new TypeError(\"Invalid value used as weak collection key\");\n\n if (key != key || key === 0) for (i = list.length; i-- && !is(list[i], key);) {} else i = list.indexOf(key);\n return -1 < i;\n }\n\n function setHas(value) {\n return has.call(this, this._values, value);\n }\n\n function mapHas(value) {\n return has.call(this, this._keys, value);\n }\n\n function sharedSet(key, value) {\n this.has(key) ? this._values[i] = value : this._values[this._keys.push(key) - 1] = value;\n return this;\n }\n\n function sharedAdd(value) {\n if (!this.has(value)) this._values.push(value);\n return this;\n }\n\n function sharedClear() {\n (this._keys || 0).length = this._values.length = 0;\n }\n\n function sharedKeys() {\n return sharedIterator(this._itp, this._keys);\n }\n\n function sharedValues() {\n return sharedIterator(this._itp, this._values);\n }\n\n function mapEntries() {\n return sharedIterator(this._itp, this._keys, this._values);\n }\n\n function setEntries() {\n return sharedIterator(this._itp, this._values, this._values);\n }\n\n function sharedIterator(itp, array, array2) {\n var _ref;\n\n var p = [0],\n done = false;\n itp.push(p);\n return _ref = {}, _ref[Symbol.iterator] = function () {\n return this;\n }, _ref.next = function next() {\n var v,\n k = p[0];\n if (!done && k < array.length) {\n v = array2 ? [array[k], array2[k]] : array[k];\n p[0]++;\n } else {\n done = true;\n itp.splice(itp.indexOf(p), 1);\n }\n return { done: done, value: v };\n }, _ref;\n }\n\n function sharedSize() {\n return this._values.length;\n }\n\n function sharedForEach(callback, context) {\n var it = this.entries();\n for (;;) {\n var r = it.next();\n if (r.done) break;\n callback.call(context, r.value[1], r.value[0], this);\n }\n }\n })(PLATFORM.global);\n}\n\nif (typeof FEATURE_NO_ES2015 === 'undefined') {\n\n var bind = Function.prototype.bind;\n\n if (typeof PLATFORM.global.Reflect === 'undefined') {\n PLATFORM.global.Reflect = {};\n }\n\n if (typeof Reflect.defineProperty !== 'function') {\n Reflect.defineProperty = function (target, propertyKey, descriptor) {\n if ((typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' ? target === null : typeof target !== 'function') {\n throw new TypeError('Reflect.defineProperty called on non-object');\n }\n try {\n Object.defineProperty(target, propertyKey, descriptor);\n return true;\n } catch (e) {\n return false;\n }\n };\n }\n\n if (typeof Reflect.construct !== 'function') {\n Reflect.construct = function (Target, args) {\n if (args) {\n switch (args.length) {\n case 0:\n return new Target();\n case 1:\n return new Target(args[0]);\n case 2:\n return new Target(args[0], args[1]);\n case 3:\n return new Target(args[0], args[1], args[2]);\n case 4:\n return new Target(args[0], args[1], args[2], args[3]);\n }\n }\n\n var a = [null];\n a.push.apply(a, args);\n return new (bind.apply(Target, a))();\n };\n }\n\n if (typeof Reflect.ownKeys !== 'function') {\n Reflect.ownKeys = function (o) {\n return Object.getOwnPropertyNames(o).concat(Object.getOwnPropertySymbols(o));\n };\n }\n}\n\nif (typeof FEATURE_NO_ESNEXT === 'undefined') {\n\n var emptyMetadata = Object.freeze({});\n var metadataContainerKey = '__metadata__';\n\n if (typeof Reflect.getOwnMetadata !== 'function') {\n Reflect.getOwnMetadata = function (metadataKey, target, targetKey) {\n if (target.hasOwnProperty(metadataContainerKey)) {\n return (target[metadataContainerKey][targetKey] || emptyMetadata)[metadataKey];\n }\n };\n }\n\n if (typeof Reflect.defineMetadata !== 'function') {\n Reflect.defineMetadata = function (metadataKey, metadataValue, target, targetKey) {\n var metadataContainer = target.hasOwnProperty(metadataContainerKey) ? target[metadataContainerKey] : target[metadataContainerKey] = {};\n var targetContainer = metadataContainer[targetKey] || (metadataContainer[targetKey] = {});\n targetContainer[metadataKey] = metadataValue;\n };\n }\n\n if (typeof Reflect.metadata !== 'function') {\n Reflect.metadata = function (metadataKey, metadataValue) {\n return function (target, targetKey) {\n Reflect.defineMetadata(metadataKey, metadataValue, target, targetKey);\n };\n };\n }\n}","\n\nimport { buildQueryString, parseQueryString } from 'aurelia-path';\n\nexport var State = function () {\n function State(charSpec) {\n \n\n this.charSpec = charSpec;\n this.nextStates = [];\n }\n\n State.prototype.get = function get(charSpec) {\n for (var _iterator = this.nextStates, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {\n var _ref;\n\n if (_isArray) {\n if (_i >= _iterator.length) break;\n _ref = _iterator[_i++];\n } else {\n _i = _iterator.next();\n if (_i.done) break;\n _ref = _i.value;\n }\n\n var child = _ref;\n\n var isEqual = child.charSpec.validChars === charSpec.validChars && child.charSpec.invalidChars === charSpec.invalidChars;\n\n if (isEqual) {\n return child;\n }\n }\n\n return undefined;\n };\n\n State.prototype.put = function put(charSpec) {\n var state = this.get(charSpec);\n\n if (state) {\n return state;\n }\n\n state = new State(charSpec);\n\n this.nextStates.push(state);\n\n if (charSpec.repeat) {\n state.nextStates.push(state);\n }\n\n return state;\n };\n\n State.prototype.match = function match(ch) {\n var nextStates = this.nextStates;\n var results = [];\n\n for (var i = 0, l = nextStates.length; i < l; i++) {\n var child = nextStates[i];\n var charSpec = child.charSpec;\n\n if (charSpec.validChars !== undefined) {\n if (charSpec.validChars.indexOf(ch) !== -1) {\n results.push(child);\n }\n } else if (charSpec.invalidChars !== undefined) {\n if (charSpec.invalidChars.indexOf(ch) === -1) {\n results.push(child);\n }\n }\n }\n\n return results;\n };\n\n return State;\n}();\n\nvar specials = ['/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\\\'];\n\nvar escapeRegex = new RegExp('(\\\\' + specials.join('|\\\\') + ')', 'g');\n\nexport var StaticSegment = function () {\n function StaticSegment(string, caseSensitive) {\n \n\n this.string = string;\n this.caseSensitive = caseSensitive;\n }\n\n StaticSegment.prototype.eachChar = function eachChar(callback) {\n var s = this.string;\n for (var i = 0, ii = s.length; i < ii; ++i) {\n var ch = s[i];\n callback({ validChars: this.caseSensitive ? ch : ch.toUpperCase() + ch.toLowerCase() });\n }\n };\n\n StaticSegment.prototype.regex = function regex() {\n return this.string.replace(escapeRegex, '\\\\$1');\n };\n\n StaticSegment.prototype.generate = function generate() {\n return this.string;\n };\n\n return StaticSegment;\n}();\n\nexport var DynamicSegment = function () {\n function DynamicSegment(name, optional) {\n \n\n this.name = name;\n this.optional = optional;\n }\n\n DynamicSegment.prototype.eachChar = function eachChar(callback) {\n callback({ invalidChars: '/', repeat: true });\n };\n\n DynamicSegment.prototype.regex = function regex() {\n return '([^/]+)';\n };\n\n DynamicSegment.prototype.generate = function generate(params, consumed) {\n consumed[this.name] = true;\n return params[this.name];\n };\n\n return DynamicSegment;\n}();\n\nexport var StarSegment = function () {\n function StarSegment(name) {\n \n\n this.name = name;\n }\n\n StarSegment.prototype.eachChar = function eachChar(callback) {\n callback({ invalidChars: '', repeat: true });\n };\n\n StarSegment.prototype.regex = function regex() {\n return '(.+)';\n };\n\n StarSegment.prototype.generate = function generate(params, consumed) {\n consumed[this.name] = true;\n return params[this.name];\n };\n\n return StarSegment;\n}();\n\nexport var EpsilonSegment = function () {\n function EpsilonSegment() {\n \n }\n\n EpsilonSegment.prototype.eachChar = function eachChar() {};\n\n EpsilonSegment.prototype.regex = function regex() {\n return '';\n };\n\n EpsilonSegment.prototype.generate = function generate() {\n return '';\n };\n\n return EpsilonSegment;\n}();\n\nexport var RouteRecognizer = function () {\n function RouteRecognizer() {\n \n\n this.rootState = new State();\n this.names = {};\n this.routes = new Map();\n }\n\n RouteRecognizer.prototype.add = function add(route) {\n var _this = this;\n\n if (Array.isArray(route)) {\n route.forEach(function (r) {\n return _this.add(r);\n });\n return undefined;\n }\n\n var currentState = this.rootState;\n var skippableStates = [];\n var regex = '^';\n var types = { statics: 0, dynamics: 0, stars: 0 };\n var names = [];\n var routeName = route.handler.name;\n var isEmpty = true;\n var segments = parse(route.path, names, types, route.caseSensitive);\n\n for (var i = 0, ii = segments.length; i < ii; i++) {\n var segment = segments[i];\n if (segment instanceof EpsilonSegment) {\n continue;\n }\n\n var _addSegment = addSegment(currentState, segment),\n firstState = _addSegment[0],\n nextState = _addSegment[1];\n\n for (var j = 0, jj = skippableStates.length; j < jj; j++) {\n skippableStates[j].nextStates.push(firstState);\n }\n\n if (segment.optional) {\n skippableStates.push(nextState);\n regex += '(?:/' + segment.regex() + ')?';\n } else {\n currentState = nextState;\n regex += '/' + segment.regex();\n skippableStates.length = 0;\n isEmpty = false;\n }\n }\n\n if (isEmpty) {\n currentState = currentState.put({ validChars: '/' });\n regex += '/?';\n }\n\n var handlers = [{ handler: route.handler, names: names }];\n\n this.routes.set(route.handler, { segments: segments, handlers: handlers });\n if (routeName) {\n var routeNames = Array.isArray(routeName) ? routeName : [routeName];\n for (var _i2 = 0; _i2 < routeNames.length; _i2++) {\n if (!(routeNames[_i2] in this.names)) {\n this.names[routeNames[_i2]] = { segments: segments, handlers: handlers };\n }\n }\n }\n\n for (var _i3 = 0; _i3 < skippableStates.length; _i3++) {\n var state = skippableStates[_i3];\n state.handlers = handlers;\n state.regex = new RegExp(regex + '$', route.caseSensitive ? '' : 'i');\n state.types = types;\n }\n\n currentState.handlers = handlers;\n currentState.regex = new RegExp(regex + '$', route.caseSensitive ? '' : 'i');\n currentState.types = types;\n\n return currentState;\n };\n\n RouteRecognizer.prototype.getRoute = function getRoute(nameOrRoute) {\n return typeof nameOrRoute === 'string' ? this.names[nameOrRoute] : this.routes.get(nameOrRoute);\n };\n\n RouteRecognizer.prototype.handlersFor = function handlersFor(nameOrRoute) {\n var route = this.getRoute(nameOrRoute);\n if (!route) {\n throw new Error('There is no route named ' + nameOrRoute);\n }\n\n return [].concat(route.handlers);\n };\n\n RouteRecognizer.prototype.hasRoute = function hasRoute(nameOrRoute) {\n return !!this.getRoute(nameOrRoute);\n };\n\n RouteRecognizer.prototype.generate = function generate(nameOrRoute, params) {\n var route = this.getRoute(nameOrRoute);\n if (!route) {\n throw new Error('There is no route named ' + nameOrRoute);\n }\n\n var handler = route.handlers[0].handler;\n if (handler.generationUsesHref) {\n return handler.href;\n }\n\n var routeParams = Object.assign({}, params);\n var segments = route.segments;\n var consumed = {};\n var output = '';\n\n for (var i = 0, l = segments.length; i < l; i++) {\n var segment = segments[i];\n\n if (segment instanceof EpsilonSegment) {\n continue;\n }\n\n var segmentValue = segment.generate(routeParams, consumed);\n if (segmentValue === null || segmentValue === undefined) {\n if (!segment.optional) {\n throw new Error('A value is required for route parameter \\'' + segment.name + '\\' in route \\'' + nameOrRoute + '\\'.');\n }\n } else {\n output += '/';\n output += segmentValue;\n }\n }\n\n if (output.charAt(0) !== '/') {\n output = '/' + output;\n }\n\n for (var param in consumed) {\n delete routeParams[param];\n }\n\n var queryString = buildQueryString(routeParams);\n output += queryString ? '?' + queryString : '';\n\n return output;\n };\n\n RouteRecognizer.prototype.recognize = function recognize(path) {\n var states = [this.rootState];\n var queryParams = {};\n var isSlashDropped = false;\n var normalizedPath = path;\n\n var queryStart = normalizedPath.indexOf('?');\n if (queryStart !== -1) {\n var queryString = normalizedPath.substr(queryStart + 1, normalizedPath.length);\n normalizedPath = normalizedPath.substr(0, queryStart);\n queryParams = parseQueryString(queryString);\n }\n\n normalizedPath = decodeURI(normalizedPath);\n\n if (normalizedPath.charAt(0) !== '/') {\n normalizedPath = '/' + normalizedPath;\n }\n\n var pathLen = normalizedPath.length;\n if (pathLen > 1 && normalizedPath.charAt(pathLen - 1) === '/') {\n normalizedPath = normalizedPath.substr(0, pathLen - 1);\n isSlashDropped = true;\n }\n\n for (var i = 0, l = normalizedPath.length; i < l; i++) {\n states = recognizeChar(states, normalizedPath.charAt(i));\n if (!states.length) {\n break;\n }\n }\n\n var solutions = [];\n for (var _i4 = 0, _l = states.length; _i4 < _l; _i4++) {\n if (states[_i4].handlers) {\n solutions.push(states[_i4]);\n }\n }\n\n states = sortSolutions(solutions);\n\n var state = solutions[0];\n if (state && state.handlers) {\n if (isSlashDropped && state.regex.source.slice(-5) === '(.+)$') {\n normalizedPath = normalizedPath + '/';\n }\n\n return findHandler(state, normalizedPath, queryParams);\n }\n };\n\n return RouteRecognizer;\n}();\n\nvar RecognizeResults = function RecognizeResults(queryParams) {\n \n\n this.splice = Array.prototype.splice;\n this.slice = Array.prototype.slice;\n this.push = Array.prototype.push;\n this.length = 0;\n this.queryParams = queryParams || {};\n};\n\nfunction parse(route, names, types, caseSensitive) {\n var normalizedRoute = route;\n if (route.charAt(0) === '/') {\n normalizedRoute = route.substr(1);\n }\n\n var results = [];\n\n var splitRoute = normalizedRoute.split('/');\n for (var i = 0, ii = splitRoute.length; i < ii; ++i) {\n var segment = splitRoute[i];\n\n var match = segment.match(/^:([^?]+)(\\?)?$/);\n if (match) {\n var _match = match,\n _name = _match[1],\n optional = _match[2];\n\n if (_name.indexOf('=') !== -1) {\n throw new Error('Parameter ' + _name + ' in route ' + route + ' has a default value, which is not supported.');\n }\n results.push(new DynamicSegment(_name, !!optional));\n names.push(_name);\n types.dynamics++;\n continue;\n }\n\n match = segment.match(/^\\*(.+)$/);\n if (match) {\n results.push(new StarSegment(match[1]));\n names.push(match[1]);\n types.stars++;\n } else if (segment === '') {\n results.push(new EpsilonSegment());\n } else {\n results.push(new StaticSegment(segment, caseSensitive));\n types.statics++;\n }\n }\n\n return results;\n}\n\nfunction sortSolutions(states) {\n return states.sort(function (a, b) {\n if (a.types.stars !== b.types.stars) {\n return a.types.stars - b.types.stars;\n }\n\n if (a.types.stars) {\n if (a.types.statics !== b.types.statics) {\n return b.types.statics - a.types.statics;\n }\n if (a.types.dynamics !== b.types.dynamics) {\n return b.types.dynamics - a.types.dynamics;\n }\n }\n\n if (a.types.dynamics !== b.types.dynamics) {\n return a.types.dynamics - b.types.dynamics;\n }\n\n if (a.types.statics !== b.types.statics) {\n return b.types.statics - a.types.statics;\n }\n\n return 0;\n });\n}\n\nfunction recognizeChar(states, ch) {\n var nextStates = [];\n\n for (var i = 0, l = states.length; i < l; i++) {\n var state = states[i];\n nextStates.push.apply(nextStates, state.match(ch));\n }\n\n return nextStates;\n}\n\nfunction findHandler(state, path, queryParams) {\n var handlers = state.handlers;\n var regex = state.regex;\n var captures = path.match(regex);\n var currentCapture = 1;\n var result = new RecognizeResults(queryParams);\n\n for (var i = 0, l = handlers.length; i < l; i++) {\n var _handler = handlers[i];\n var _names = _handler.names;\n var _params = {};\n\n for (var j = 0, m = _names.length; j < m; j++) {\n _params[_names[j]] = captures[currentCapture++];\n }\n\n result.push({ handler: _handler.handler, params: _params, isDynamic: !!_names.length });\n }\n\n return result;\n}\n\nfunction addSegment(currentState, segment) {\n var firstState = currentState.put({ validChars: '/' });\n var nextState = firstState;\n segment.eachChar(function (ch) {\n nextState = nextState.put(ch);\n });\n\n return [firstState, nextState];\n}","import { getLogger } from 'aurelia-logging';\nimport { Container } from 'aurelia-dependency-injection';\nimport { History } from 'aurelia-history';\nimport { RouteRecognizer } from 'aurelia-route-recognizer';\nimport { EventAggregator } from 'aurelia-event-aggregator';\n\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nfunction __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\n\n/**\r\n * Class used to represent an instruction during a navigation.\r\n */\r\nvar NavigationInstruction = /** @class */ (function () {\r\n function NavigationInstruction(init) {\r\n /**\r\n * Current built viewport plan of this nav instruction\r\n */\r\n this.plan = null;\r\n this.options = {};\r\n Object.assign(this, init);\r\n this.params = this.params || {};\r\n this.viewPortInstructions = {};\r\n var ancestorParams = [];\r\n var current = this;\r\n do {\r\n var currentParams = Object.assign({}, current.params);\r\n if (current.config && current.config.hasChildRouter) {\r\n // remove the param for the injected child route segment\r\n delete currentParams[current.getWildCardName()];\r\n }\r\n ancestorParams.unshift(currentParams);\r\n current = current.parentInstruction;\r\n } while (current);\r\n var allParams = Object.assign.apply(Object, [{}, this.queryParams].concat(ancestorParams));\r\n this.lifecycleArgs = [allParams, this.config, this];\r\n }\r\n /**\r\n * Gets an array containing this instruction and all child instructions for the current navigation.\r\n */\r\n NavigationInstruction.prototype.getAllInstructions = function () {\r\n var instructions = [this];\r\n var viewPortInstructions = this.viewPortInstructions;\r\n for (var key in viewPortInstructions) {\r\n var childInstruction = viewPortInstructions[key].childNavigationInstruction;\r\n if (childInstruction) {\r\n instructions.push.apply(instructions, childInstruction.getAllInstructions());\r\n }\r\n }\r\n return instructions;\r\n };\r\n /**\r\n * Gets an array containing the instruction and all child instructions for the previous navigation.\r\n * Previous instructions are no longer available after navigation completes.\r\n */\r\n NavigationInstruction.prototype.getAllPreviousInstructions = function () {\r\n return this.getAllInstructions().map(function (c) { return c.previousInstruction; }).filter(function (c) { return c; });\r\n };\r\n NavigationInstruction.prototype.addViewPortInstruction = function (nameOrInitOptions, strategy, moduleId, component) {\r\n var viewPortInstruction;\r\n var viewPortName = typeof nameOrInitOptions === 'string' ? nameOrInitOptions : nameOrInitOptions.name;\r\n var lifecycleArgs = this.lifecycleArgs;\r\n var config = Object.assign({}, lifecycleArgs[1], { currentViewPort: viewPortName });\r\n if (typeof nameOrInitOptions === 'string') {\r\n viewPortInstruction = {\r\n name: nameOrInitOptions,\r\n strategy: strategy,\r\n moduleId: moduleId,\r\n component: component,\r\n childRouter: component.childRouter,\r\n lifecycleArgs: [lifecycleArgs[0], config, lifecycleArgs[2]]\r\n };\r\n }\r\n else {\r\n viewPortInstruction = {\r\n name: viewPortName,\r\n strategy: nameOrInitOptions.strategy,\r\n component: nameOrInitOptions.component,\r\n moduleId: nameOrInitOptions.moduleId,\r\n childRouter: nameOrInitOptions.component.childRouter,\r\n lifecycleArgs: [lifecycleArgs[0], config, lifecycleArgs[2]]\r\n };\r\n }\r\n return this.viewPortInstructions[viewPortName] = viewPortInstruction;\r\n };\r\n /**\r\n * Gets the name of the route pattern's wildcard parameter, if applicable.\r\n */\r\n NavigationInstruction.prototype.getWildCardName = function () {\r\n // todo: potential issue, or at least unsafe typings\r\n var configRoute = this.config.route;\r\n var wildcardIndex = configRoute.lastIndexOf('*');\r\n return configRoute.substr(wildcardIndex + 1);\r\n };\r\n /**\r\n * Gets the path and query string created by filling the route\r\n * pattern's wildcard parameter with the matching param.\r\n */\r\n NavigationInstruction.prototype.getWildcardPath = function () {\r\n var wildcardName = this.getWildCardName();\r\n var path = this.params[wildcardName] || '';\r\n var queryString = this.queryString;\r\n if (queryString) {\r\n path += '?' + queryString;\r\n }\r\n return path;\r\n };\r\n /**\r\n * Gets the instruction's base URL, accounting for wildcard route parameters.\r\n */\r\n NavigationInstruction.prototype.getBaseUrl = function () {\r\n var _this = this;\r\n var $encodeURI = encodeURI;\r\n var fragment = decodeURI(this.fragment);\r\n if (fragment === '') {\r\n var nonEmptyRoute = this.router.routes.find(function (route) {\r\n return route.name === _this.config.name &&\r\n route.route !== '';\r\n });\r\n if (nonEmptyRoute) {\r\n fragment = nonEmptyRoute.route;\r\n }\r\n }\r\n if (!this.params) {\r\n return $encodeURI(fragment);\r\n }\r\n var wildcardName = this.getWildCardName();\r\n var path = this.params[wildcardName] || '';\r\n if (!path) {\r\n return $encodeURI(fragment);\r\n }\r\n return $encodeURI(fragment.substr(0, fragment.lastIndexOf(path)));\r\n };\r\n /**\r\n * Finalize a viewport instruction\r\n * @internal\r\n */\r\n NavigationInstruction.prototype._commitChanges = function (waitToSwap) {\r\n var _this = this;\r\n var router = this.router;\r\n router.currentInstruction = this;\r\n var previousInstruction = this.previousInstruction;\r\n if (previousInstruction) {\r\n previousInstruction.config.navModel.isActive = false;\r\n }\r\n this.config.navModel.isActive = true;\r\n router.refreshNavigation();\r\n var loads = [];\r\n var delaySwaps = [];\r\n var viewPortInstructions = this.viewPortInstructions;\r\n var _loop_1 = function (viewPortName) {\r\n var viewPortInstruction = viewPortInstructions[viewPortName];\r\n var viewPort = router.viewPorts[viewPortName];\r\n if (!viewPort) {\r\n throw new Error(\"There was no router-view found in the view for \" + viewPortInstruction.moduleId + \".\");\r\n }\r\n var childNavInstruction = viewPortInstruction.childNavigationInstruction;\r\n if (viewPortInstruction.strategy === \"replace\" /* Replace */) {\r\n if (childNavInstruction && childNavInstruction.parentCatchHandler) {\r\n loads.push(childNavInstruction._commitChanges(waitToSwap));\r\n }\r\n else {\r\n if (waitToSwap) {\r\n delaySwaps.push({ viewPort: viewPort, viewPortInstruction: viewPortInstruction });\r\n }\r\n loads.push(viewPort\r\n .process(viewPortInstruction, waitToSwap)\r\n .then(function () { return childNavInstruction\r\n ? childNavInstruction._commitChanges(waitToSwap)\r\n : Promise.resolve(); }));\r\n }\r\n }\r\n else {\r\n if (childNavInstruction) {\r\n loads.push(childNavInstruction._commitChanges(waitToSwap));\r\n }\r\n }\r\n };\r\n for (var viewPortName in viewPortInstructions) {\r\n _loop_1(viewPortName);\r\n }\r\n return Promise\r\n .all(loads)\r\n .then(function () {\r\n delaySwaps.forEach(function (x) { return x.viewPort.swap(x.viewPortInstruction); });\r\n return null;\r\n })\r\n .then(function () { return prune(_this); });\r\n };\r\n /**@internal */\r\n NavigationInstruction.prototype._updateTitle = function () {\r\n var router = this.router;\r\n var title = this._buildTitle(router.titleSeparator);\r\n if (title) {\r\n router.history.setTitle(title);\r\n }\r\n };\r\n /**@internal */\r\n NavigationInstruction.prototype._buildTitle = function (separator) {\r\n if (separator === void 0) { separator = ' | '; }\r\n var title = '';\r\n var childTitles = [];\r\n var navModelTitle = this.config.navModel.title;\r\n var instructionRouter = this.router;\r\n var viewPortInstructions = this.viewPortInstructions;\r\n if (navModelTitle) {\r\n title = instructionRouter.transformTitle(navModelTitle);\r\n }\r\n for (var viewPortName in viewPortInstructions) {\r\n var viewPortInstruction = viewPortInstructions[viewPortName];\r\n var child_nav_instruction = viewPortInstruction.childNavigationInstruction;\r\n if (child_nav_instruction) {\r\n var childTitle = child_nav_instruction._buildTitle(separator);\r\n if (childTitle) {\r\n childTitles.push(childTitle);\r\n }\r\n }\r\n }\r\n if (childTitles.length) {\r\n title = childTitles.join(separator) + (title ? separator : '') + title;\r\n }\r\n if (instructionRouter.title) {\r\n title += (title ? separator : '') + instructionRouter.transformTitle(instructionRouter.title);\r\n }\r\n return title;\r\n };\r\n return NavigationInstruction;\r\n}());\r\nvar prune = function (instruction) {\r\n instruction.previousInstruction = null;\r\n instruction.plan = null;\r\n};\n\n/**\r\n* Class for storing and interacting with a route's navigation settings.\r\n*/\r\nvar NavModel = /** @class */ (function () {\r\n function NavModel(router, relativeHref) {\r\n /**\r\n * True if this nav item is currently active.\r\n */\r\n this.isActive = false;\r\n /**\r\n * The title.\r\n */\r\n this.title = null;\r\n /**\r\n * This nav item's absolute href.\r\n */\r\n this.href = null;\r\n /**\r\n * This nav item's relative href.\r\n */\r\n this.relativeHref = null;\r\n /**\r\n * Data attached to the route at configuration time.\r\n */\r\n this.settings = {};\r\n /**\r\n * The route config.\r\n */\r\n this.config = null;\r\n this.router = router;\r\n this.relativeHref = relativeHref;\r\n }\r\n /**\r\n * Sets the route's title and updates document.title.\r\n * If the a navigation is in progress, the change will be applied\r\n * to document.title when the navigation completes.\r\n *\r\n * @param title The new title.\r\n */\r\n NavModel.prototype.setTitle = function (title) {\r\n this.title = title;\r\n if (this.isActive) {\r\n this.router.updateTitle();\r\n }\r\n };\r\n return NavModel;\r\n}());\n\nfunction _normalizeAbsolutePath(path, hasPushState, absolute) {\r\n if (absolute === void 0) { absolute = false; }\r\n if (!hasPushState && path[0] !== '#') {\r\n path = '#' + path;\r\n }\r\n if (hasPushState && absolute) {\r\n path = path.substring(1, path.length);\r\n }\r\n return path;\r\n}\r\nfunction _createRootedPath(fragment, baseUrl, hasPushState, absolute) {\r\n if (isAbsoluteUrl.test(fragment)) {\r\n return fragment;\r\n }\r\n var path = '';\r\n if (baseUrl.length && baseUrl[0] !== '/') {\r\n path += '/';\r\n }\r\n path += baseUrl;\r\n if ((!path.length || path[path.length - 1] !== '/') && fragment[0] !== '/') {\r\n path += '/';\r\n }\r\n if (path.length && path[path.length - 1] === '/' && fragment[0] === '/') {\r\n path = path.substring(0, path.length - 1);\r\n }\r\n return _normalizeAbsolutePath(path + fragment, hasPushState, absolute);\r\n}\r\nfunction _resolveUrl(fragment, baseUrl, hasPushState) {\r\n if (isRootedPath.test(fragment)) {\r\n return _normalizeAbsolutePath(fragment, hasPushState);\r\n }\r\n return _createRootedPath(fragment, baseUrl, hasPushState);\r\n}\r\nfunction _ensureArrayWithSingleRoutePerConfig(config) {\r\n var routeConfigs = [];\r\n if (Array.isArray(config.route)) {\r\n for (var i = 0, ii = config.route.length; i < ii; ++i) {\r\n var current = Object.assign({}, config);\r\n current.route = config.route[i];\r\n routeConfigs.push(current);\r\n }\r\n }\r\n else {\r\n routeConfigs.push(Object.assign({}, config));\r\n }\r\n return routeConfigs;\r\n}\r\nvar isRootedPath = /^#?\\//;\r\nvar isAbsoluteUrl = /^([a-z][a-z0-9+\\-.]*:)?\\/\\//i;\n\n/**\r\n * Class used to configure a [[Router]] instance.\r\n *\r\n * @constructor\r\n */\r\nvar RouterConfiguration = /** @class */ (function () {\r\n function RouterConfiguration() {\r\n this.instructions = [];\r\n this.options = {};\r\n this.pipelineSteps = [];\r\n }\r\n /**\r\n * Adds a step to be run during the [[Router]]'s navigation pipeline.\r\n *\r\n * @param name The name of the pipeline slot to insert the step into.\r\n * @param step The pipeline step.\r\n * @chainable\r\n */\r\n RouterConfiguration.prototype.addPipelineStep = function (name, step) {\r\n if (step === null || step === undefined) {\r\n throw new Error('Pipeline step cannot be null or undefined.');\r\n }\r\n this.pipelineSteps.push({ name: name, step: step });\r\n return this;\r\n };\r\n /**\r\n * Adds a step to be run during the [[Router]]'s authorize pipeline slot.\r\n *\r\n * @param step The pipeline step.\r\n * @chainable\r\n */\r\n RouterConfiguration.prototype.addAuthorizeStep = function (step) {\r\n return this.addPipelineStep(\"authorize\" /* Authorize */, step);\r\n };\r\n /**\r\n * Adds a step to be run during the [[Router]]'s preActivate pipeline slot.\r\n *\r\n * @param step The pipeline step.\r\n * @chainable\r\n */\r\n RouterConfiguration.prototype.addPreActivateStep = function (step) {\r\n return this.addPipelineStep(\"preActivate\" /* PreActivate */, step);\r\n };\r\n /**\r\n * Adds a step to be run during the [[Router]]'s preRender pipeline slot.\r\n *\r\n * @param step The pipeline step.\r\n * @chainable\r\n */\r\n RouterConfiguration.prototype.addPreRenderStep = function (step) {\r\n return this.addPipelineStep(\"preRender\" /* PreRender */, step);\r\n };\r\n /**\r\n * Adds a step to be run during the [[Router]]'s postRender pipeline slot.\r\n *\r\n * @param step The pipeline step.\r\n * @chainable\r\n */\r\n RouterConfiguration.prototype.addPostRenderStep = function (step) {\r\n return this.addPipelineStep(\"postRender\" /* PostRender */, step);\r\n };\r\n /**\r\n * Configures a route that will be used if there is no previous location available on navigation cancellation.\r\n *\r\n * @param fragment The URL fragment to use as the navigation destination.\r\n * @chainable\r\n */\r\n RouterConfiguration.prototype.fallbackRoute = function (fragment) {\r\n this._fallbackRoute = fragment;\r\n return this;\r\n };\r\n /**\r\n * Maps one or more routes to be registered with the router.\r\n *\r\n * @param route The [[RouteConfig]] to map, or an array of [[RouteConfig]] to map.\r\n * @chainable\r\n */\r\n RouterConfiguration.prototype.map = function (route) {\r\n var _this = this;\r\n if (Array.isArray(route)) {\r\n route.forEach(function (r) { return _this.map(r); });\r\n return this;\r\n }\r\n return this.mapRoute(route);\r\n };\r\n /**\r\n * Configures defaults to use for any view ports.\r\n *\r\n * @param viewPortConfig a view port configuration object to use as a\r\n * default, of the form { viewPortName: { moduleId } }.\r\n * @chainable\r\n */\r\n RouterConfiguration.prototype.useViewPortDefaults = function (viewPortConfig) {\r\n this.viewPortDefaults = viewPortConfig;\r\n return this;\r\n };\r\n /**\r\n * Maps a single route to be registered with the router.\r\n *\r\n * @param route The [[RouteConfig]] to map.\r\n * @chainable\r\n */\r\n RouterConfiguration.prototype.mapRoute = function (config) {\r\n this.instructions.push(function (router) {\r\n var routeConfigs = _ensureArrayWithSingleRoutePerConfig(config);\r\n var navModel;\r\n for (var i = 0, ii = routeConfigs.length; i < ii; ++i) {\r\n var routeConfig = routeConfigs[i];\r\n routeConfig.settings = routeConfig.settings || {};\r\n if (!navModel) {\r\n navModel = router.createNavModel(routeConfig);\r\n }\r\n router.addRoute(routeConfig, navModel);\r\n }\r\n });\r\n return this;\r\n };\r\n /**\r\n * Registers an unknown route handler to be run when the URL fragment doesn't match any registered routes.\r\n *\r\n * @param config A string containing a moduleId to load, or a [[RouteConfig]], or a function that takes the\r\n * [[NavigationInstruction]] and selects a moduleId to load.\r\n * @chainable\r\n */\r\n RouterConfiguration.prototype.mapUnknownRoutes = function (config) {\r\n this.unknownRouteConfig = config;\r\n return this;\r\n };\r\n /**\r\n * Applies the current configuration to the specified [[Router]].\r\n *\r\n * @param router The [[Router]] to apply the configuration to.\r\n */\r\n RouterConfiguration.prototype.exportToRouter = function (router) {\r\n var instructions = this.instructions;\r\n for (var i = 0, ii = instructions.length; i < ii; ++i) {\r\n instructions[i](router);\r\n }\r\n var _a = this, title = _a.title, titleSeparator = _a.titleSeparator, unknownRouteConfig = _a.unknownRouteConfig, _fallbackRoute = _a._fallbackRoute, viewPortDefaults = _a.viewPortDefaults;\r\n if (title) {\r\n router.title = title;\r\n }\r\n if (titleSeparator) {\r\n router.titleSeparator = titleSeparator;\r\n }\r\n if (unknownRouteConfig) {\r\n router.handleUnknownRoutes(unknownRouteConfig);\r\n }\r\n if (_fallbackRoute) {\r\n router.fallbackRoute = _fallbackRoute;\r\n }\r\n if (viewPortDefaults) {\r\n router.useViewPortDefaults(viewPortDefaults);\r\n }\r\n Object.assign(router.options, this.options);\r\n var pipelineSteps = this.pipelineSteps;\r\n var pipelineStepCount = pipelineSteps.length;\r\n if (pipelineStepCount) {\r\n if (!router.isRoot) {\r\n throw new Error('Pipeline steps can only be added to the root router');\r\n }\r\n var pipelineProvider = router.pipelineProvider;\r\n for (var i = 0, ii = pipelineStepCount; i < ii; ++i) {\r\n var _b = pipelineSteps[i], name_1 = _b.name, step = _b.step;\r\n pipelineProvider.addStep(name_1, step);\r\n }\r\n }\r\n };\r\n return RouterConfiguration;\r\n}());\n\n/**\r\n * The primary class responsible for handling routing and navigation.\r\n */\r\nvar Router = /** @class */ (function () {\r\n /**\r\n * @param container The [[Container]] to use when child routers.\r\n * @param history The [[History]] implementation to delegate navigation requests to.\r\n */\r\n function Router(container, history) {\r\n var _this = this;\r\n /**\r\n * The parent router, or null if this instance is not a child router.\r\n */\r\n this.parent = null;\r\n this.options = {};\r\n /**\r\n * The defaults used when a viewport lacks specified content\r\n */\r\n this.viewPortDefaults = {};\r\n /**\r\n * Extension point to transform the document title before it is built and displayed.\r\n * By default, child routers delegate to the parent router, and the app router\r\n * returns the title unchanged.\r\n */\r\n this.transformTitle = function (title) {\r\n if (_this.parent) {\r\n return _this.parent.transformTitle(title);\r\n }\r\n return title;\r\n };\r\n this.container = container;\r\n this.history = history;\r\n this.reset();\r\n }\r\n /**\r\n * Fully resets the router's internal state. Primarily used internally by the framework when multiple calls to setRoot are made.\r\n * Use with caution (actually, avoid using this). Do not use this to simply change your navigation model.\r\n */\r\n Router.prototype.reset = function () {\r\n var _this = this;\r\n this.viewPorts = {};\r\n this.routes = [];\r\n this.baseUrl = '';\r\n this.isConfigured = false;\r\n this.isNavigating = false;\r\n this.isExplicitNavigation = false;\r\n this.isExplicitNavigationBack = false;\r\n this.isNavigatingFirst = false;\r\n this.isNavigatingNew = false;\r\n this.isNavigatingRefresh = false;\r\n this.isNavigatingForward = false;\r\n this.isNavigatingBack = false;\r\n this.couldDeactivate = false;\r\n this.navigation = [];\r\n this.currentInstruction = null;\r\n this.viewPortDefaults = {};\r\n this._fallbackOrder = 100;\r\n this._recognizer = new RouteRecognizer();\r\n this._childRecognizer = new RouteRecognizer();\r\n this._configuredPromise = new Promise(function (resolve) {\r\n _this._resolveConfiguredPromise = resolve;\r\n });\r\n };\r\n Object.defineProperty(Router.prototype, \"isRoot\", {\r\n /**\r\n * Gets a value indicating whether or not this [[Router]] is the root in the router tree. I.e., it has no parent.\r\n */\r\n get: function () {\r\n return !this.parent;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Registers a viewPort to be used as a rendering target for activated routes.\r\n *\r\n * @param viewPort The viewPort.\r\n * @param name The name of the viewPort. 'default' if unspecified.\r\n */\r\n Router.prototype.registerViewPort = function (viewPort, name) {\r\n name = name || 'default';\r\n this.viewPorts[name] = viewPort;\r\n };\r\n /**\r\n * Returns a Promise that resolves when the router is configured.\r\n */\r\n Router.prototype.ensureConfigured = function () {\r\n return this._configuredPromise;\r\n };\r\n /**\r\n * Configures the router.\r\n *\r\n * @param callbackOrConfig The [[RouterConfiguration]] or a callback that takes a [[RouterConfiguration]].\r\n */\r\n Router.prototype.configure = function (callbackOrConfig) {\r\n var _this = this;\r\n this.isConfigured = true;\r\n var result = callbackOrConfig;\r\n var config;\r\n if (typeof callbackOrConfig === 'function') {\r\n config = new RouterConfiguration();\r\n result = callbackOrConfig(config);\r\n }\r\n return Promise\r\n .resolve(result)\r\n .then(function (c) {\r\n if (c && c.exportToRouter) {\r\n config = c;\r\n }\r\n config.exportToRouter(_this);\r\n _this.isConfigured = true;\r\n _this._resolveConfiguredPromise();\r\n });\r\n };\r\n /**\r\n * Navigates to a new location.\r\n *\r\n * @param fragment The URL fragment to use as the navigation destination.\r\n * @param options The navigation options.\r\n */\r\n Router.prototype.navigate = function (fragment, options) {\r\n if (!this.isConfigured && this.parent) {\r\n return this.parent.navigate(fragment, options);\r\n }\r\n this.isExplicitNavigation = true;\r\n return this.history.navigate(_resolveUrl(fragment, this.baseUrl, this.history._hasPushState), options);\r\n };\r\n /**\r\n * Navigates to a new location corresponding to the route and params specified. Equivallent to [[Router.generate]] followed\r\n * by [[Router.navigate]].\r\n *\r\n * @param route The name of the route to use when generating the navigation location.\r\n * @param params The route parameters to be used when populating the route pattern.\r\n * @param options The navigation options.\r\n */\r\n Router.prototype.navigateToRoute = function (route, params, options) {\r\n var path = this.generate(route, params);\r\n return this.navigate(path, options);\r\n };\r\n /**\r\n * Navigates back to the most recent location in history.\r\n */\r\n Router.prototype.navigateBack = function () {\r\n this.isExplicitNavigationBack = true;\r\n this.history.navigateBack();\r\n };\r\n /**\r\n * Creates a child router of the current router.\r\n *\r\n * @param container The [[Container]] to provide to the child router. Uses the current [[Router]]'s [[Container]] if unspecified.\r\n * @returns {Router} The new child Router.\r\n */\r\n Router.prototype.createChild = function (container) {\r\n var childRouter = new Router(container || this.container.createChild(), this.history);\r\n childRouter.parent = this;\r\n return childRouter;\r\n };\r\n /**\r\n * Generates a URL fragment matching the specified route pattern.\r\n *\r\n * @param name The name of the route whose pattern should be used to generate the fragment.\r\n * @param params The route params to be used to populate the route pattern.\r\n * @param options If options.absolute = true, then absolute url will be generated; otherwise, it will be relative url.\r\n * @returns {string} A string containing the generated URL fragment.\r\n */\r\n Router.prototype.generate = function (nameOrRoute, params, options) {\r\n if (params === void 0) { params = {}; }\r\n if (options === void 0) { options = {}; }\r\n // A child recognizer generates routes for potential child routes. Any potential child route is added\r\n // to the childRoute property of params for the childRouter to recognize. When generating routes, we\r\n // use the childRecognizer when childRoute params are available to generate a child router enabled route.\r\n var recognizer = 'childRoute' in params ? this._childRecognizer : this._recognizer;\r\n var hasRoute = recognizer.hasRoute(nameOrRoute);\r\n if (!hasRoute) {\r\n if (this.parent) {\r\n return this.parent.generate(nameOrRoute, params, options);\r\n }\r\n throw new Error(\"A route with name '\" + nameOrRoute + \"' could not be found. Check that `name: '\" + nameOrRoute + \"'` was specified in the route's config.\");\r\n }\r\n var path = recognizer.generate(nameOrRoute, params);\r\n var rootedPath = _createRootedPath(path, this.baseUrl, this.history._hasPushState, options.absolute);\r\n return options.absolute ? \"\" + this.history.getAbsoluteRoot() + rootedPath : rootedPath;\r\n };\r\n /**\r\n * Creates a [[NavModel]] for the specified route config.\r\n *\r\n * @param config The route config.\r\n */\r\n Router.prototype.createNavModel = function (config) {\r\n var navModel = new NavModel(this, 'href' in config\r\n ? config.href\r\n // potential error when config.route is a string[] ?\r\n : config.route);\r\n navModel.title = config.title;\r\n navModel.order = config.nav;\r\n navModel.href = config.href;\r\n navModel.settings = config.settings;\r\n navModel.config = config;\r\n return navModel;\r\n };\r\n /**\r\n * Registers a new route with the router.\r\n *\r\n * @param config The [[RouteConfig]].\r\n * @param navModel The [[NavModel]] to use for the route. May be omitted for single-pattern routes.\r\n */\r\n Router.prototype.addRoute = function (config, navModel) {\r\n if (Array.isArray(config.route)) {\r\n var routeConfigs = _ensureArrayWithSingleRoutePerConfig(config);\r\n // the following is wrong. todo: fix this after TS refactoring release\r\n routeConfigs.forEach(this.addRoute.bind(this));\r\n return;\r\n }\r\n validateRouteConfig(config);\r\n if (!('viewPorts' in config) && !config.navigationStrategy) {\r\n config.viewPorts = {\r\n 'default': {\r\n moduleId: config.moduleId,\r\n view: config.view\r\n }\r\n };\r\n }\r\n if (!navModel) {\r\n navModel = this.createNavModel(config);\r\n }\r\n this.routes.push(config);\r\n var path = config.route;\r\n if (path.charAt(0) === '/') {\r\n path = path.substr(1);\r\n }\r\n var caseSensitive = config.caseSensitive === true;\r\n var state = this._recognizer.add({\r\n path: path,\r\n handler: config,\r\n caseSensitive: caseSensitive\r\n });\r\n if (path) {\r\n var settings = config.settings;\r\n delete config.settings;\r\n var withChild = JSON.parse(JSON.stringify(config));\r\n config.settings = settings;\r\n withChild.route = path + \"/*childRoute\";\r\n withChild.hasChildRouter = true;\r\n this._childRecognizer.add({\r\n path: withChild.route,\r\n handler: withChild,\r\n caseSensitive: caseSensitive\r\n });\r\n withChild.navModel = navModel;\r\n withChild.settings = config.settings;\r\n withChild.navigationStrategy = config.navigationStrategy;\r\n }\r\n config.navModel = navModel;\r\n var navigation = this.navigation;\r\n if ((navModel.order || navModel.order === 0) && navigation.indexOf(navModel) === -1) {\r\n if ((!navModel.href && navModel.href !== '') && (state.types.dynamics || state.types.stars)) {\r\n throw new Error('Invalid route config for \"' + config.route + '\" : dynamic routes must specify an \"href:\" to be included in the navigation model.');\r\n }\r\n if (typeof navModel.order !== 'number') {\r\n navModel.order = ++this._fallbackOrder;\r\n }\r\n navigation.push(navModel);\r\n // this is a potential error / inconsistency between browsers\r\n //\r\n // MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort\r\n // If compareFunction(a, b) returns 0, leave a and b unchanged with respect to each other,\r\n // but sorted with respect to all different elements.\r\n // Note: the ECMAscript standard does not guarantee this behaviour,\r\n // and thus not all browsers (e.g. Mozilla versions dating back to at least 2003) respect this.\r\n navigation.sort(function (a, b) { return a.order - b.order; });\r\n }\r\n };\r\n /**\r\n * Gets a value indicating whether or not this [[Router]] or one of its ancestors has a route registered with the specified name.\r\n *\r\n * @param name The name of the route to check.\r\n */\r\n Router.prototype.hasRoute = function (name) {\r\n return !!(this._recognizer.hasRoute(name) || this.parent && this.parent.hasRoute(name));\r\n };\r\n /**\r\n * Gets a value indicating whether or not this [[Router]] has a route registered with the specified name.\r\n *\r\n * @param name The name of the route to check.\r\n */\r\n Router.prototype.hasOwnRoute = function (name) {\r\n return this._recognizer.hasRoute(name);\r\n };\r\n /**\r\n * Register a handler to use when the incoming URL fragment doesn't match any registered routes.\r\n *\r\n * @param config The moduleId, or a function that selects the moduleId, or a [[RouteConfig]].\r\n */\r\n Router.prototype.handleUnknownRoutes = function (config) {\r\n var _this = this;\r\n if (!config) {\r\n throw new Error('Invalid unknown route handler');\r\n }\r\n this.catchAllHandler = function (instruction) {\r\n return _this\r\n ._createRouteConfig(config, instruction)\r\n .then(function (c) {\r\n instruction.config = c;\r\n return instruction;\r\n });\r\n };\r\n };\r\n /**\r\n * Updates the document title using the current navigation instruction.\r\n */\r\n Router.prototype.updateTitle = function () {\r\n var parentRouter = this.parent;\r\n if (parentRouter) {\r\n return parentRouter.updateTitle();\r\n }\r\n var currentInstruction = this.currentInstruction;\r\n if (currentInstruction) {\r\n currentInstruction._updateTitle();\r\n }\r\n return undefined;\r\n };\r\n /**\r\n * Updates the navigation routes with hrefs relative to the current location.\r\n * Note: This method will likely move to a plugin in a future release.\r\n */\r\n Router.prototype.refreshNavigation = function () {\r\n var nav = this.navigation;\r\n for (var i = 0, length_1 = nav.length; i < length_1; i++) {\r\n var current = nav[i];\r\n if (!current.config.href) {\r\n current.href = _createRootedPath(current.relativeHref, this.baseUrl, this.history._hasPushState);\r\n }\r\n else {\r\n current.href = _normalizeAbsolutePath(current.config.href, this.history._hasPushState);\r\n }\r\n }\r\n };\r\n /**\r\n * Sets the default configuration for the view ports. This specifies how to\r\n * populate a view port for which no module is specified. The default is\r\n * an empty view/view-model pair.\r\n */\r\n Router.prototype.useViewPortDefaults = function ($viewPortDefaults) {\r\n // a workaround to have strong typings while not requiring to expose interface ViewPortInstruction\r\n var viewPortDefaults = $viewPortDefaults;\r\n for (var viewPortName in viewPortDefaults) {\r\n var viewPortConfig = viewPortDefaults[viewPortName];\r\n this.viewPortDefaults[viewPortName] = {\r\n moduleId: viewPortConfig.moduleId\r\n };\r\n }\r\n };\r\n /**@internal */\r\n Router.prototype._refreshBaseUrl = function () {\r\n var parentRouter = this.parent;\r\n if (parentRouter) {\r\n this.baseUrl = generateBaseUrl(parentRouter, parentRouter.currentInstruction);\r\n }\r\n };\r\n /**@internal */\r\n Router.prototype._createNavigationInstruction = function (url, parentInstruction) {\r\n if (url === void 0) { url = ''; }\r\n if (parentInstruction === void 0) { parentInstruction = null; }\r\n var fragment = url;\r\n var queryString = '';\r\n var queryIndex = url.indexOf('?');\r\n if (queryIndex !== -1) {\r\n fragment = url.substr(0, queryIndex);\r\n queryString = url.substr(queryIndex + 1);\r\n }\r\n var urlRecognizationResults = this._recognizer.recognize(url);\r\n if (!urlRecognizationResults || !urlRecognizationResults.length) {\r\n urlRecognizationResults = this._childRecognizer.recognize(url);\r\n }\r\n var instructionInit = {\r\n fragment: fragment,\r\n queryString: queryString,\r\n config: null,\r\n parentInstruction: parentInstruction,\r\n previousInstruction: this.currentInstruction,\r\n router: this,\r\n options: {\r\n compareQueryParams: this.options.compareQueryParams\r\n }\r\n };\r\n var result;\r\n if (urlRecognizationResults && urlRecognizationResults.length) {\r\n var first = urlRecognizationResults[0];\r\n var instruction = new NavigationInstruction(Object.assign({}, instructionInit, {\r\n params: first.params,\r\n queryParams: first.queryParams || urlRecognizationResults.queryParams,\r\n config: first.config || first.handler\r\n }));\r\n if (typeof first.handler === 'function') {\r\n result = evaluateNavigationStrategy(instruction, first.handler, first);\r\n }\r\n else if (first.handler && typeof first.handler.navigationStrategy === 'function') {\r\n result = evaluateNavigationStrategy(instruction, first.handler.navigationStrategy, first.handler);\r\n }\r\n else {\r\n result = Promise.resolve(instruction);\r\n }\r\n }\r\n else if (this.catchAllHandler) {\r\n var instruction = new NavigationInstruction(Object.assign({}, instructionInit, {\r\n params: { path: fragment },\r\n queryParams: urlRecognizationResults ? urlRecognizationResults.queryParams : {},\r\n config: null // config will be created by the catchAllHandler\r\n }));\r\n result = evaluateNavigationStrategy(instruction, this.catchAllHandler);\r\n }\r\n else if (this.parent) {\r\n var router = this._parentCatchAllHandler(this.parent);\r\n if (router) {\r\n var newParentInstruction = this._findParentInstructionFromRouter(router, parentInstruction);\r\n var instruction = new NavigationInstruction(Object.assign({}, instructionInit, {\r\n params: { path: fragment },\r\n queryParams: urlRecognizationResults ? urlRecognizationResults.queryParams : {},\r\n router: router,\r\n parentInstruction: newParentInstruction,\r\n parentCatchHandler: true,\r\n config: null // config will be created by the chained parent catchAllHandler\r\n }));\r\n result = evaluateNavigationStrategy(instruction, router.catchAllHandler);\r\n }\r\n }\r\n if (result && parentInstruction) {\r\n this.baseUrl = generateBaseUrl(this.parent, parentInstruction);\r\n }\r\n return result || Promise.reject(new Error(\"Route not found: \" + url));\r\n };\r\n /**@internal */\r\n Router.prototype._findParentInstructionFromRouter = function (router, instruction) {\r\n if (instruction.router === router) {\r\n instruction.fragment = router.baseUrl; // need to change the fragment in case of a redirect instead of moduleId\r\n return instruction;\r\n }\r\n else if (instruction.parentInstruction) {\r\n return this._findParentInstructionFromRouter(router, instruction.parentInstruction);\r\n }\r\n return undefined;\r\n };\r\n /**@internal */\r\n Router.prototype._parentCatchAllHandler = function (router) {\r\n if (router.catchAllHandler) {\r\n return router;\r\n }\r\n else if (router.parent) {\r\n return this._parentCatchAllHandler(router.parent);\r\n }\r\n return false;\r\n };\r\n /**\r\n * @internal\r\n */\r\n Router.prototype._createRouteConfig = function (config, instruction) {\r\n var _this = this;\r\n return Promise\r\n .resolve(config)\r\n .then(function (c) {\r\n if (typeof c === 'string') {\r\n return { moduleId: c };\r\n }\r\n else if (typeof c === 'function') {\r\n return c(instruction);\r\n }\r\n return c;\r\n })\r\n // typing here could be either RouteConfig or RedirectConfig\r\n // but temporarily treat both as RouteConfig\r\n // todo: improve typings precision\r\n .then(function (c) { return typeof c === 'string' ? { moduleId: c } : c; })\r\n .then(function (c) {\r\n c.route = instruction.params.path;\r\n validateRouteConfig(c);\r\n if (!c.navModel) {\r\n c.navModel = _this.createNavModel(c);\r\n }\r\n return c;\r\n });\r\n };\r\n return Router;\r\n}());\r\n/* @internal exported for unit testing */\r\nvar generateBaseUrl = function (router, instruction) {\r\n return \"\" + (router.baseUrl || '') + (instruction.getBaseUrl() || '');\r\n};\r\n/* @internal exported for unit testing */\r\nvar validateRouteConfig = function (config) {\r\n if (typeof config !== 'object') {\r\n throw new Error('Invalid Route Config');\r\n }\r\n if (typeof config.route !== 'string') {\r\n var name_1 = config.name || '(no name)';\r\n throw new Error('Invalid Route Config for \"' + name_1 + '\": You must specify a \"route:\" pattern.');\r\n }\r\n if (!('redirect' in config || config.moduleId || config.navigationStrategy || config.viewPorts)) {\r\n throw new Error('Invalid Route Config for \"' + config.route + '\": You must specify a \"moduleId:\", \"redirect:\", \"navigationStrategy:\", or \"viewPorts:\".');\r\n }\r\n};\r\n/* @internal exported for unit testing */\r\nvar evaluateNavigationStrategy = function (instruction, evaluator, context) {\r\n return Promise\r\n .resolve(evaluator.call(context, instruction))\r\n .then(function () {\r\n if (!('viewPorts' in instruction.config)) {\r\n instruction.config.viewPorts = {\r\n 'default': {\r\n moduleId: instruction.config.moduleId\r\n }\r\n };\r\n }\r\n return instruction;\r\n });\r\n};\n\n/**@internal exported for unit testing */\r\nvar createNextFn = function (instruction, steps) {\r\n var index = -1;\r\n var next = function () {\r\n index++;\r\n if (index < steps.length) {\r\n var currentStep = steps[index];\r\n try {\r\n return currentStep(instruction, next);\r\n }\r\n catch (e) {\r\n return next.reject(e);\r\n }\r\n }\r\n else {\r\n return next.complete();\r\n }\r\n };\r\n next.complete = createCompletionHandler(next, \"completed\" /* Completed */);\r\n next.cancel = createCompletionHandler(next, \"canceled\" /* Canceled */);\r\n next.reject = createCompletionHandler(next, \"rejected\" /* Rejected */);\r\n return next;\r\n};\r\n/**@internal exported for unit testing */\r\nvar createCompletionHandler = function (next, status) {\r\n return function (output) { return Promise\r\n .resolve({\r\n status: status,\r\n output: output,\r\n completed: status === \"completed\" /* Completed */\r\n }); };\r\n};\n\n/**\r\n * The class responsible for managing and processing the navigation pipeline.\r\n */\r\nvar Pipeline = /** @class */ (function () {\r\n function Pipeline() {\r\n /**\r\n * The pipeline steps. And steps added via addStep will be converted to a function\r\n * The actualy running functions with correct step contexts of this pipeline\r\n */\r\n this.steps = [];\r\n }\r\n /**\r\n * Adds a step to the pipeline.\r\n *\r\n * @param step The pipeline step.\r\n */\r\n Pipeline.prototype.addStep = function (step) {\r\n var run;\r\n if (typeof step === 'function') {\r\n run = step;\r\n }\r\n else if (typeof step.getSteps === 'function') {\r\n // getSteps is to enable support open slots\r\n // where devs can add multiple steps into the same slot name\r\n var steps = step.getSteps();\r\n for (var i = 0, l = steps.length; i < l; i++) {\r\n this.addStep(steps[i]);\r\n }\r\n return this;\r\n }\r\n else {\r\n run = step.run.bind(step);\r\n }\r\n this.steps.push(run);\r\n return this;\r\n };\r\n /**\r\n * Runs the pipeline.\r\n *\r\n * @param instruction The navigation instruction to process.\r\n */\r\n Pipeline.prototype.run = function (instruction) {\r\n var nextFn = createNextFn(instruction, this.steps);\r\n return nextFn();\r\n };\r\n return Pipeline;\r\n}());\n\n/**\r\n* Determines if the provided object is a navigation command.\r\n* A navigation command is anything with a navigate method.\r\n*\r\n* @param obj The object to check.\r\n*/\r\nfunction isNavigationCommand(obj) {\r\n return obj && typeof obj.navigate === 'function';\r\n}\r\n/**\r\n* Used during the activation lifecycle to cause a redirect.\r\n*/\r\nvar Redirect = /** @class */ (function () {\r\n /**\r\n * @param url The URL fragment to use as the navigation destination.\r\n * @param options The navigation options.\r\n */\r\n function Redirect(url, options) {\r\n if (options === void 0) { options = {}; }\r\n this.url = url;\r\n this.options = Object.assign({ trigger: true, replace: true }, options);\r\n this.shouldContinueProcessing = false;\r\n }\r\n /**\r\n * Called by the activation system to set the child router.\r\n *\r\n * @param router The router.\r\n */\r\n Redirect.prototype.setRouter = function (router) {\r\n this.router = router;\r\n };\r\n /**\r\n * Called by the navigation pipeline to navigate.\r\n *\r\n * @param appRouter The router to be redirected.\r\n */\r\n Redirect.prototype.navigate = function (appRouter) {\r\n var navigatingRouter = this.options.useAppRouter ? appRouter : (this.router || appRouter);\r\n navigatingRouter.navigate(this.url, this.options);\r\n };\r\n return Redirect;\r\n}());\r\n/**\r\n * Used during the activation lifecycle to cause a redirect to a named route.\r\n */\r\nvar RedirectToRoute = /** @class */ (function () {\r\n /**\r\n * @param route The name of the route.\r\n * @param params The parameters to be sent to the activation method.\r\n * @param options The options to use for navigation.\r\n */\r\n function RedirectToRoute(route, params, options) {\r\n if (params === void 0) { params = {}; }\r\n if (options === void 0) { options = {}; }\r\n this.route = route;\r\n this.params = params;\r\n this.options = Object.assign({ trigger: true, replace: true }, options);\r\n this.shouldContinueProcessing = false;\r\n }\r\n /**\r\n * Called by the activation system to set the child router.\r\n *\r\n * @param router The router.\r\n */\r\n RedirectToRoute.prototype.setRouter = function (router) {\r\n this.router = router;\r\n };\r\n /**\r\n * Called by the navigation pipeline to navigate.\r\n *\r\n * @param appRouter The router to be redirected.\r\n */\r\n RedirectToRoute.prototype.navigate = function (appRouter) {\r\n var navigatingRouter = this.options.useAppRouter ? appRouter : (this.router || appRouter);\r\n navigatingRouter.navigateToRoute(this.route, this.params, this.options);\r\n };\r\n return RedirectToRoute;\r\n}());\n\n/**\r\n * @internal exported for unit testing\r\n */\r\nfunction _buildNavigationPlan(instruction, forceLifecycleMinimum) {\r\n var config = instruction.config;\r\n if ('redirect' in config) {\r\n return buildRedirectPlan(instruction);\r\n }\r\n var prevInstruction = instruction.previousInstruction;\r\n var defaultViewPortConfigs = instruction.router.viewPortDefaults;\r\n if (prevInstruction) {\r\n return buildTransitionPlans(instruction, prevInstruction, defaultViewPortConfigs, forceLifecycleMinimum);\r\n }\r\n // first navigation, only need to prepare a few information for each viewport plan\r\n var viewPortPlans = {};\r\n var viewPortConfigs = config.viewPorts;\r\n for (var viewPortName in viewPortConfigs) {\r\n var viewPortConfig = viewPortConfigs[viewPortName];\r\n if (viewPortConfig.moduleId === null && viewPortName in defaultViewPortConfigs) {\r\n viewPortConfig = defaultViewPortConfigs[viewPortName];\r\n }\r\n viewPortPlans[viewPortName] = {\r\n name: viewPortName,\r\n strategy: \"replace\" /* Replace */,\r\n config: viewPortConfig\r\n };\r\n }\r\n return Promise.resolve(viewPortPlans);\r\n}\r\n/**\r\n * Build redirect plan based on config of a navigation instruction\r\n * @internal exported for unit testing\r\n */\r\nvar buildRedirectPlan = function (instruction) {\r\n var config = instruction.config;\r\n var router = instruction.router;\r\n return router\r\n ._createNavigationInstruction(config.redirect)\r\n .then(function (redirectInstruction) {\r\n var params = {};\r\n var originalInstructionParams = instruction.params;\r\n var redirectInstructionParams = redirectInstruction.params;\r\n for (var key in redirectInstructionParams) {\r\n // If the param on the redirect points to another param, e.g. { route: first/:this, redirect: second/:this }\r\n var val = redirectInstructionParams[key];\r\n if (typeof val === 'string' && val[0] === ':') {\r\n val = val.slice(1);\r\n // And if that param is found on the original instruction then use it\r\n if (val in originalInstructionParams) {\r\n params[key] = originalInstructionParams[val];\r\n }\r\n }\r\n else {\r\n params[key] = redirectInstructionParams[key];\r\n }\r\n }\r\n var redirectLocation = router.generate(redirectInstruction.config, params, instruction.options);\r\n // Special handling for child routes\r\n for (var key in originalInstructionParams) {\r\n redirectLocation = redirectLocation.replace(\":\" + key, originalInstructionParams[key]);\r\n }\r\n var queryString = instruction.queryString;\r\n if (queryString) {\r\n redirectLocation += '?' + queryString;\r\n }\r\n return Promise.resolve(new Redirect(redirectLocation));\r\n });\r\n};\r\n/**\r\n * @param viewPortPlans the Plan record that holds information about built plans\r\n * @internal exported for unit testing\r\n */\r\nvar buildTransitionPlans = function (currentInstruction, previousInstruction, defaultViewPortConfigs, forceLifecycleMinimum) {\r\n var viewPortPlans = {};\r\n var newInstructionConfig = currentInstruction.config;\r\n var hasNewParams = hasDifferentParameterValues(previousInstruction, currentInstruction);\r\n var pending = [];\r\n var previousViewPortInstructions = previousInstruction.viewPortInstructions;\r\n var _loop_1 = function (viewPortName) {\r\n var prevViewPortInstruction = previousViewPortInstructions[viewPortName];\r\n var prevViewPortComponent = prevViewPortInstruction.component;\r\n var newInstructionViewPortConfigs = newInstructionConfig.viewPorts;\r\n // if this is invoked on a viewport without any changes, based on new url,\r\n // newViewPortConfig will be the existing viewport instruction\r\n var nextViewPortConfig = viewPortName in newInstructionViewPortConfigs\r\n ? newInstructionViewPortConfigs[viewPortName]\r\n : prevViewPortInstruction;\r\n if (nextViewPortConfig.moduleId === null && viewPortName in defaultViewPortConfigs) {\r\n nextViewPortConfig = defaultViewPortConfigs[viewPortName];\r\n }\r\n var viewPortActivationStrategy = determineActivationStrategy(currentInstruction, prevViewPortInstruction, nextViewPortConfig, hasNewParams, forceLifecycleMinimum);\r\n var viewPortPlan = viewPortPlans[viewPortName] = {\r\n name: viewPortName,\r\n // ViewPortInstruction can quack like a RouteConfig\r\n config: nextViewPortConfig,\r\n prevComponent: prevViewPortComponent,\r\n prevModuleId: prevViewPortInstruction.moduleId,\r\n strategy: viewPortActivationStrategy\r\n };\r\n // recursively build nav plans for all existing child routers/viewports of this viewport\r\n // this is possible because existing child viewports and routers already have necessary information\r\n // to process the wildcard path from parent instruction\r\n if (viewPortActivationStrategy !== \"replace\" /* Replace */ && prevViewPortInstruction.childRouter) {\r\n var path = currentInstruction.getWildcardPath();\r\n var task = prevViewPortInstruction\r\n .childRouter\r\n ._createNavigationInstruction(path, currentInstruction)\r\n .then(function (childInstruction) {\r\n viewPortPlan.childNavigationInstruction = childInstruction;\r\n return _buildNavigationPlan(childInstruction, \r\n // is it safe to assume viewPortPlan has not been changed from previous assignment?\r\n // if so, can just use local variable viewPortPlanStrategy\r\n // there could be user code modifying viewport plan during _createNavigationInstruction?\r\n viewPortPlan.strategy === \"invoke-lifecycle\" /* InvokeLifecycle */)\r\n .then(function (childPlan) {\r\n if (childPlan instanceof Redirect) {\r\n return Promise.reject(childPlan);\r\n }\r\n childInstruction.plan = childPlan;\r\n // for bluebird ?\r\n return null;\r\n });\r\n });\r\n pending.push(task);\r\n }\r\n };\r\n for (var viewPortName in previousViewPortInstructions) {\r\n _loop_1(viewPortName);\r\n }\r\n return Promise.all(pending).then(function () { return viewPortPlans; });\r\n};\r\n/**\r\n * @param newViewPortConfig if this is invoked on a viewport without any changes, based on new url, newViewPortConfig will be the existing viewport instruction\r\n * @internal exported for unit testing\r\n */\r\nvar determineActivationStrategy = function (currentNavInstruction, prevViewPortInstruction, newViewPortConfig, \r\n// indicates whether there is difference between old and new url params\r\nhasNewParams, forceLifecycleMinimum) {\r\n var newInstructionConfig = currentNavInstruction.config;\r\n var prevViewPortViewModel = prevViewPortInstruction.component.viewModel;\r\n var viewPortPlanStrategy;\r\n if (prevViewPortInstruction.moduleId !== newViewPortConfig.moduleId) {\r\n viewPortPlanStrategy = \"replace\" /* Replace */;\r\n }\r\n else if ('determineActivationStrategy' in prevViewPortViewModel) {\r\n viewPortPlanStrategy = prevViewPortViewModel.determineActivationStrategy.apply(prevViewPortViewModel, currentNavInstruction.lifecycleArgs);\r\n }\r\n else if (newInstructionConfig.activationStrategy) {\r\n viewPortPlanStrategy = newInstructionConfig.activationStrategy;\r\n }\r\n else if (hasNewParams || forceLifecycleMinimum) {\r\n viewPortPlanStrategy = \"invoke-lifecycle\" /* InvokeLifecycle */;\r\n }\r\n else {\r\n viewPortPlanStrategy = \"no-change\" /* NoChange */;\r\n }\r\n return viewPortPlanStrategy;\r\n};\r\n/**@internal exported for unit testing */\r\nvar hasDifferentParameterValues = function (prev, next) {\r\n var prevParams = prev.params;\r\n var nextParams = next.params;\r\n var nextWildCardName = next.config.hasChildRouter ? next.getWildCardName() : null;\r\n for (var key in nextParams) {\r\n if (key === nextWildCardName) {\r\n continue;\r\n }\r\n if (prevParams[key] !== nextParams[key]) {\r\n return true;\r\n }\r\n }\r\n for (var key in prevParams) {\r\n if (key === nextWildCardName) {\r\n continue;\r\n }\r\n if (prevParams[key] !== nextParams[key]) {\r\n return true;\r\n }\r\n }\r\n if (!next.options.compareQueryParams) {\r\n return false;\r\n }\r\n var prevQueryParams = prev.queryParams;\r\n var nextQueryParams = next.queryParams;\r\n for (var key in nextQueryParams) {\r\n if (prevQueryParams[key] !== nextQueryParams[key]) {\r\n return true;\r\n }\r\n }\r\n for (var key in prevQueryParams) {\r\n if (prevQueryParams[key] !== nextQueryParams[key]) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n};\n\n/**\r\n * Transform a navigation instruction into viewport plan record object,\r\n * or a redirect request if user viewmodel demands\r\n */\r\nvar BuildNavigationPlanStep = /** @class */ (function () {\r\n function BuildNavigationPlanStep() {\r\n }\r\n BuildNavigationPlanStep.prototype.run = function (navigationInstruction, next) {\r\n return _buildNavigationPlan(navigationInstruction)\r\n .then(function (plan) {\r\n if (plan instanceof Redirect) {\r\n return next.cancel(plan);\r\n }\r\n navigationInstruction.plan = plan;\r\n return next();\r\n })\r\n .catch(next.cancel);\r\n };\r\n return BuildNavigationPlanStep;\r\n}());\n\n/**\r\n * @internal Exported for unit testing\r\n */\r\nvar loadNewRoute = function (routeLoader, navigationInstruction) {\r\n var loadingPlans = determineLoadingPlans(navigationInstruction);\r\n var loadPromises = loadingPlans.map(function (loadingPlan) { return loadRoute(routeLoader, loadingPlan.navigationInstruction, loadingPlan.viewPortPlan); });\r\n return Promise.all(loadPromises);\r\n};\r\n/**\r\n * @internal Exported for unit testing\r\n */\r\nvar determineLoadingPlans = function (navigationInstruction, loadingPlans) {\r\n if (loadingPlans === void 0) { loadingPlans = []; }\r\n var viewPortPlans = navigationInstruction.plan;\r\n for (var viewPortName in viewPortPlans) {\r\n var viewPortPlan = viewPortPlans[viewPortName];\r\n var childNavInstruction = viewPortPlan.childNavigationInstruction;\r\n if (viewPortPlan.strategy === \"replace\" /* Replace */) {\r\n loadingPlans.push({ viewPortPlan: viewPortPlan, navigationInstruction: navigationInstruction });\r\n if (childNavInstruction) {\r\n determineLoadingPlans(childNavInstruction, loadingPlans);\r\n }\r\n }\r\n else {\r\n var viewPortInstruction = navigationInstruction.addViewPortInstruction({\r\n name: viewPortName,\r\n strategy: viewPortPlan.strategy,\r\n moduleId: viewPortPlan.prevModuleId,\r\n component: viewPortPlan.prevComponent\r\n });\r\n if (childNavInstruction) {\r\n viewPortInstruction.childNavigationInstruction = childNavInstruction;\r\n determineLoadingPlans(childNavInstruction, loadingPlans);\r\n }\r\n }\r\n }\r\n return loadingPlans;\r\n};\r\n/**\r\n * @internal Exported for unit testing\r\n */\r\nvar loadRoute = function (routeLoader, navigationInstruction, viewPortPlan) {\r\n var planConfig = viewPortPlan.config;\r\n var moduleId = planConfig ? planConfig.moduleId : null;\r\n return loadComponent(routeLoader, navigationInstruction, planConfig)\r\n .then(function (component) {\r\n var viewPortInstruction = navigationInstruction.addViewPortInstruction({\r\n name: viewPortPlan.name,\r\n strategy: viewPortPlan.strategy,\r\n moduleId: moduleId,\r\n component: component\r\n });\r\n var childRouter = component.childRouter;\r\n if (childRouter) {\r\n var path = navigationInstruction.getWildcardPath();\r\n return childRouter\r\n ._createNavigationInstruction(path, navigationInstruction)\r\n .then(function (childInstruction) {\r\n viewPortPlan.childNavigationInstruction = childInstruction;\r\n return _buildNavigationPlan(childInstruction)\r\n .then(function (childPlan) {\r\n if (childPlan instanceof Redirect) {\r\n return Promise.reject(childPlan);\r\n }\r\n childInstruction.plan = childPlan;\r\n viewPortInstruction.childNavigationInstruction = childInstruction;\r\n return loadNewRoute(routeLoader, childInstruction);\r\n });\r\n });\r\n }\r\n // ts complains without this, though they are same\r\n return void 0;\r\n });\r\n};\r\n/**\r\n * Load a routed-component based on navigation instruction and route config\r\n * @internal exported for unit testing only\r\n */\r\nvar loadComponent = function (routeLoader, navigationInstruction, config) {\r\n var router = navigationInstruction.router;\r\n var lifecycleArgs = navigationInstruction.lifecycleArgs;\r\n return Promise.resolve()\r\n .then(function () { return routeLoader.loadRoute(router, config, navigationInstruction); })\r\n .then(\r\n /**\r\n * @param component an object carrying information about loaded route\r\n * typically contains information about view model, childContainer, view and router\r\n */\r\n function (component) {\r\n var viewModel = component.viewModel, childContainer = component.childContainer;\r\n component.router = router;\r\n component.config = config;\r\n if ('configureRouter' in viewModel) {\r\n var childRouter_1 = childContainer.getChildRouter();\r\n component.childRouter = childRouter_1;\r\n return childRouter_1\r\n .configure(function (c) { return viewModel.configureRouter(c, childRouter_1, lifecycleArgs[0], lifecycleArgs[1], lifecycleArgs[2]); })\r\n .then(function () { return component; });\r\n }\r\n return component;\r\n });\r\n};\n\n/**\r\n * Abstract class that is responsible for loading view / view model from a route config\r\n * The default implementation can be found in `aurelia-templating-router`\r\n */\r\nvar RouteLoader = /** @class */ (function () {\r\n function RouteLoader() {\r\n }\r\n /**\r\n * Load a route config based on its viewmodel / view configuration\r\n */\r\n // return typing: return typings used to be never\r\n // as it was a throw. Changing it to Promise should not cause any issues\r\n RouteLoader.prototype.loadRoute = function (router, config, navigationInstruction) {\r\n throw new Error('Route loaders must implement \"loadRoute(router, config, navigationInstruction)\".');\r\n };\r\n return RouteLoader;\r\n}());\n\n/**\r\n * A pipeline step responsible for loading a route config of a navigation instruction\r\n */\r\nvar LoadRouteStep = /** @class */ (function () {\r\n function LoadRouteStep(routeLoader) {\r\n this.routeLoader = routeLoader;\r\n }\r\n /**@internal */\r\n LoadRouteStep.inject = function () { return [RouteLoader]; };\r\n /**\r\n * Run the internal to load route config of a navigation instruction to prepare for next steps in the pipeline\r\n */\r\n LoadRouteStep.prototype.run = function (navigationInstruction, next) {\r\n return loadNewRoute(this.routeLoader, navigationInstruction)\r\n .then(next, next.cancel);\r\n };\r\n return LoadRouteStep;\r\n}());\n\n/**\r\n * A pipeline step for instructing a piepline to commit changes on a navigation instruction\r\n */\r\nvar CommitChangesStep = /** @class */ (function () {\r\n function CommitChangesStep() {\r\n }\r\n CommitChangesStep.prototype.run = function (navigationInstruction, next) {\r\n return navigationInstruction\r\n ._commitChanges(/*wait to swap?*/ true)\r\n .then(function () {\r\n navigationInstruction._updateTitle();\r\n return next();\r\n });\r\n };\r\n return CommitChangesStep;\r\n}());\n\n/**\r\n * An optional interface describing the available activation strategies.\r\n * @internal Used internally.\r\n */\r\nvar InternalActivationStrategy;\r\n(function (InternalActivationStrategy) {\r\n /**\r\n * Reuse the existing view model, without invoking Router lifecycle hooks.\r\n */\r\n InternalActivationStrategy[\"NoChange\"] = \"no-change\";\r\n /**\r\n * Reuse the existing view model, invoking Router lifecycle hooks.\r\n */\r\n InternalActivationStrategy[\"InvokeLifecycle\"] = \"invoke-lifecycle\";\r\n /**\r\n * Replace the existing view model, invoking Router lifecycle hooks.\r\n */\r\n InternalActivationStrategy[\"Replace\"] = \"replace\";\r\n})(InternalActivationStrategy || (InternalActivationStrategy = {}));\r\n/**\r\n * The strategy to use when activating modules during navigation.\r\n */\r\n// kept for compat reason\r\nvar activationStrategy = {\r\n noChange: \"no-change\" /* NoChange */,\r\n invokeLifecycle: \"invoke-lifecycle\" /* InvokeLifecycle */,\r\n replace: \"replace\" /* Replace */\r\n};\n\n/**\r\n * Recursively find list of deactivate-able view models\r\n * and invoke the either 'canDeactivate' or 'deactivate' on each\r\n * @internal exported for unit testing\r\n */\r\nvar processDeactivatable = function (navigationInstruction, callbackName, next, ignoreResult) {\r\n var plan = navigationInstruction.plan;\r\n var infos = findDeactivatable(plan, callbackName);\r\n var i = infos.length; // query from inside out\r\n function inspect(val) {\r\n if (ignoreResult || shouldContinue(val)) {\r\n return iterate();\r\n }\r\n return next.cancel(val);\r\n }\r\n function iterate() {\r\n if (i--) {\r\n try {\r\n var viewModel = infos[i];\r\n var result = viewModel[callbackName](navigationInstruction);\r\n return processPotential(result, inspect, next.cancel);\r\n }\r\n catch (error) {\r\n return next.cancel(error);\r\n }\r\n }\r\n navigationInstruction.router.couldDeactivate = true;\r\n return next();\r\n }\r\n return iterate();\r\n};\r\n/**\r\n * Recursively find and returns a list of deactivate-able view models\r\n * @internal exported for unit testing\r\n */\r\nvar findDeactivatable = function (plan, callbackName, list) {\r\n if (list === void 0) { list = []; }\r\n for (var viewPortName in plan) {\r\n var viewPortPlan = plan[viewPortName];\r\n var prevComponent = viewPortPlan.prevComponent;\r\n if ((viewPortPlan.strategy === activationStrategy.invokeLifecycle || viewPortPlan.strategy === activationStrategy.replace)\r\n && prevComponent) {\r\n var viewModel = prevComponent.viewModel;\r\n if (callbackName in viewModel) {\r\n list.push(viewModel);\r\n }\r\n }\r\n if (viewPortPlan.strategy === activationStrategy.replace && prevComponent) {\r\n addPreviousDeactivatable(prevComponent, callbackName, list);\r\n }\r\n else if (viewPortPlan.childNavigationInstruction) {\r\n findDeactivatable(viewPortPlan.childNavigationInstruction.plan, callbackName, list);\r\n }\r\n }\r\n return list;\r\n};\r\n/**\r\n * @internal exported for unit testing\r\n */\r\nvar addPreviousDeactivatable = function (component, callbackName, list) {\r\n var childRouter = component.childRouter;\r\n if (childRouter && childRouter.currentInstruction) {\r\n var viewPortInstructions = childRouter.currentInstruction.viewPortInstructions;\r\n for (var viewPortName in viewPortInstructions) {\r\n var viewPortInstruction = viewPortInstructions[viewPortName];\r\n var prevComponent = viewPortInstruction.component;\r\n var prevViewModel = prevComponent.viewModel;\r\n if (callbackName in prevViewModel) {\r\n list.push(prevViewModel);\r\n }\r\n addPreviousDeactivatable(prevComponent, callbackName, list);\r\n }\r\n }\r\n};\r\n/**\r\n * @internal exported for unit testing\r\n */\r\nvar processActivatable = function (navigationInstruction, callbackName, next, ignoreResult) {\r\n var infos = findActivatable(navigationInstruction, callbackName);\r\n var length = infos.length;\r\n var i = -1; // query from top down\r\n function inspect(val, router) {\r\n if (ignoreResult || shouldContinue(val, router)) {\r\n return iterate();\r\n }\r\n return next.cancel(val);\r\n }\r\n function iterate() {\r\n var _a;\r\n i++;\r\n if (i < length) {\r\n try {\r\n var current_1 = infos[i];\r\n var result = (_a = current_1.viewModel)[callbackName].apply(_a, current_1.lifecycleArgs);\r\n return processPotential(result, function (val) { return inspect(val, current_1.router); }, next.cancel);\r\n }\r\n catch (error) {\r\n return next.cancel(error);\r\n }\r\n }\r\n return next();\r\n }\r\n return iterate();\r\n};\r\n/**\r\n * Find list of activatable view model and add to list (3rd parameter)\r\n * @internal exported for unit testing\r\n */\r\nvar findActivatable = function (navigationInstruction, callbackName, list, router) {\r\n if (list === void 0) { list = []; }\r\n var plan = navigationInstruction.plan;\r\n Object\r\n .keys(plan)\r\n .forEach(function (viewPortName) {\r\n var viewPortPlan = plan[viewPortName];\r\n var viewPortInstruction = navigationInstruction.viewPortInstructions[viewPortName];\r\n var viewPortComponent = viewPortInstruction.component;\r\n var viewModel = viewPortComponent.viewModel;\r\n if ((viewPortPlan.strategy === activationStrategy.invokeLifecycle\r\n || viewPortPlan.strategy === activationStrategy.replace)\r\n && callbackName in viewModel) {\r\n list.push({\r\n viewModel: viewModel,\r\n lifecycleArgs: viewPortInstruction.lifecycleArgs,\r\n router: router\r\n });\r\n }\r\n var childNavInstruction = viewPortPlan.childNavigationInstruction;\r\n if (childNavInstruction) {\r\n findActivatable(childNavInstruction, callbackName, list, viewPortComponent.childRouter || router);\r\n }\r\n });\r\n return list;\r\n};\r\nvar shouldContinue = function (output, router) {\r\n if (output instanceof Error) {\r\n return false;\r\n }\r\n if (isNavigationCommand(output)) {\r\n if (typeof output.setRouter === 'function') {\r\n output.setRouter(router);\r\n }\r\n return !!output.shouldContinueProcessing;\r\n }\r\n if (output === undefined) {\r\n return true;\r\n }\r\n return output;\r\n};\r\n/**\r\n * wraps a subscription, allowing unsubscribe calls even if\r\n * the first value comes synchronously\r\n */\r\nvar SafeSubscription = /** @class */ (function () {\r\n function SafeSubscription(subscriptionFunc) {\r\n this._subscribed = true;\r\n this._subscription = subscriptionFunc(this);\r\n if (!this._subscribed) {\r\n this.unsubscribe();\r\n }\r\n }\r\n Object.defineProperty(SafeSubscription.prototype, \"subscribed\", {\r\n get: function () {\r\n return this._subscribed;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n SafeSubscription.prototype.unsubscribe = function () {\r\n if (this._subscribed && this._subscription) {\r\n this._subscription.unsubscribe();\r\n }\r\n this._subscribed = false;\r\n };\r\n return SafeSubscription;\r\n}());\r\n/**\r\n * A function to process return value from `activate`/`canActivate` steps\r\n * Supports observable/promise\r\n *\r\n * For observable, resolve at first next() or on complete()\r\n */\r\nvar processPotential = function (obj, resolve, reject) {\r\n // if promise like\r\n if (obj && typeof obj.then === 'function') {\r\n return Promise.resolve(obj).then(resolve).catch(reject);\r\n }\r\n // if observable\r\n if (obj && typeof obj.subscribe === 'function') {\r\n var obs_1 = obj;\r\n return new SafeSubscription(function (sub) { return obs_1.subscribe({\r\n next: function () {\r\n if (sub.subscribed) {\r\n sub.unsubscribe();\r\n resolve(obj);\r\n }\r\n },\r\n error: function (error) {\r\n if (sub.subscribed) {\r\n sub.unsubscribe();\r\n reject(error);\r\n }\r\n },\r\n complete: function () {\r\n if (sub.subscribed) {\r\n sub.unsubscribe();\r\n resolve(obj);\r\n }\r\n }\r\n }); });\r\n }\r\n // else just resolve\r\n try {\r\n return resolve(obj);\r\n }\r\n catch (error) {\r\n return reject(error);\r\n }\r\n};\n\n/**\r\n * A pipeline step responsible for finding and activating method `canDeactivate` on a view model of a route\r\n */\r\nvar CanDeactivatePreviousStep = /** @class */ (function () {\r\n function CanDeactivatePreviousStep() {\r\n }\r\n CanDeactivatePreviousStep.prototype.run = function (navigationInstruction, next) {\r\n return processDeactivatable(navigationInstruction, 'canDeactivate', next);\r\n };\r\n return CanDeactivatePreviousStep;\r\n}());\r\n/**\r\n * A pipeline step responsible for finding and activating method `canActivate` on a view model of a route\r\n */\r\nvar CanActivateNextStep = /** @class */ (function () {\r\n function CanActivateNextStep() {\r\n }\r\n CanActivateNextStep.prototype.run = function (navigationInstruction, next) {\r\n return processActivatable(navigationInstruction, 'canActivate', next);\r\n };\r\n return CanActivateNextStep;\r\n}());\r\n/**\r\n * A pipeline step responsible for finding and activating method `deactivate` on a view model of a route\r\n */\r\nvar DeactivatePreviousStep = /** @class */ (function () {\r\n function DeactivatePreviousStep() {\r\n }\r\n DeactivatePreviousStep.prototype.run = function (navigationInstruction, next) {\r\n return processDeactivatable(navigationInstruction, 'deactivate', next, true);\r\n };\r\n return DeactivatePreviousStep;\r\n}());\r\n/**\r\n * A pipeline step responsible for finding and activating method `activate` on a view model of a route\r\n */\r\nvar ActivateNextStep = /** @class */ (function () {\r\n function ActivateNextStep() {\r\n }\r\n ActivateNextStep.prototype.run = function (navigationInstruction, next) {\r\n return processActivatable(navigationInstruction, 'activate', next, true);\r\n };\r\n return ActivateNextStep;\r\n}());\n\n/**\r\n * A multi-slots Pipeline Placeholder Step for hooking into a pipeline execution\r\n */\r\nvar PipelineSlot = /** @class */ (function () {\r\n function PipelineSlot(container, name, alias) {\r\n this.steps = [];\r\n this.container = container;\r\n this.slotName = name;\r\n this.slotAlias = alias;\r\n }\r\n PipelineSlot.prototype.getSteps = function () {\r\n var _this = this;\r\n return this.steps.map(function (x) { return _this.container.get(x); });\r\n };\r\n return PipelineSlot;\r\n}());\r\n/**\r\n * Class responsible for creating the navigation pipeline.\r\n */\r\nvar PipelineProvider = /** @class */ (function () {\r\n function PipelineProvider(container) {\r\n this.container = container;\r\n this.steps = [\r\n BuildNavigationPlanStep,\r\n CanDeactivatePreviousStep,\r\n LoadRouteStep,\r\n createPipelineSlot(container, \"authorize\" /* Authorize */),\r\n CanActivateNextStep,\r\n createPipelineSlot(container, \"preActivate\" /* PreActivate */, 'modelbind'),\r\n // NOTE: app state changes start below - point of no return\r\n DeactivatePreviousStep,\r\n ActivateNextStep,\r\n createPipelineSlot(container, \"preRender\" /* PreRender */, 'precommit'),\r\n CommitChangesStep,\r\n createPipelineSlot(container, \"postRender\" /* PostRender */, 'postcomplete')\r\n ];\r\n }\r\n /**@internal */\r\n PipelineProvider.inject = function () { return [Container]; };\r\n /**\r\n * Create the navigation pipeline.\r\n */\r\n PipelineProvider.prototype.createPipeline = function (useCanDeactivateStep) {\r\n var _this = this;\r\n if (useCanDeactivateStep === void 0) { useCanDeactivateStep = true; }\r\n var pipeline = new Pipeline();\r\n this.steps.forEach(function (step) {\r\n if (useCanDeactivateStep || step !== CanDeactivatePreviousStep) {\r\n pipeline.addStep(_this.container.get(step));\r\n }\r\n });\r\n return pipeline;\r\n };\r\n /**@internal */\r\n PipelineProvider.prototype._findStep = function (name) {\r\n // Steps that are not PipelineSlots are constructor functions, and they will automatically fail. Probably.\r\n return this.steps.find(function (x) { return x.slotName === name || x.slotAlias === name; });\r\n };\r\n /**\r\n * Adds a step into the pipeline at a known slot location.\r\n */\r\n PipelineProvider.prototype.addStep = function (name, step) {\r\n var found = this._findStep(name);\r\n if (found) {\r\n var slotSteps = found.steps;\r\n // prevent duplicates\r\n if (!slotSteps.includes(step)) {\r\n slotSteps.push(step);\r\n }\r\n }\r\n else {\r\n throw new Error(\"Invalid pipeline slot name: \" + name + \".\");\r\n }\r\n };\r\n /**\r\n * Removes a step from a slot in the pipeline\r\n */\r\n PipelineProvider.prototype.removeStep = function (name, step) {\r\n var slot = this._findStep(name);\r\n if (slot) {\r\n var slotSteps = slot.steps;\r\n slotSteps.splice(slotSteps.indexOf(step), 1);\r\n }\r\n };\r\n /**\r\n * Clears all steps from a slot in the pipeline\r\n * @internal\r\n */\r\n PipelineProvider.prototype._clearSteps = function (name) {\r\n if (name === void 0) { name = ''; }\r\n var slot = this._findStep(name);\r\n if (slot) {\r\n slot.steps = [];\r\n }\r\n };\r\n /**\r\n * Resets all pipeline slots\r\n */\r\n PipelineProvider.prototype.reset = function () {\r\n this._clearSteps(\"authorize\" /* Authorize */);\r\n this._clearSteps(\"preActivate\" /* PreActivate */);\r\n this._clearSteps(\"preRender\" /* PreRender */);\r\n this._clearSteps(\"postRender\" /* PostRender */);\r\n };\r\n return PipelineProvider;\r\n}());\r\n/**@internal */\r\nvar createPipelineSlot = function (container, name, alias) {\r\n return new PipelineSlot(container, name, alias);\r\n};\n\nvar logger = getLogger('app-router');\r\n/**\r\n * The main application router.\r\n */\r\nvar AppRouter = /** @class */ (function (_super) {\r\n __extends(AppRouter, _super);\r\n function AppRouter(container, history, pipelineProvider, events) {\r\n var _this = _super.call(this, container, history) || this;\r\n _this.pipelineProvider = pipelineProvider;\r\n _this.events = events;\r\n return _this;\r\n }\r\n /**@internal */\r\n AppRouter.inject = function () { return [Container, History, PipelineProvider, EventAggregator]; };\r\n /**\r\n * Fully resets the router's internal state. Primarily used internally by the framework when multiple calls to setRoot are made.\r\n * Use with caution (actually, avoid using this). Do not use this to simply change your navigation model.\r\n */\r\n AppRouter.prototype.reset = function () {\r\n _super.prototype.reset.call(this);\r\n this.maxInstructionCount = 10;\r\n if (!this._queue) {\r\n this._queue = [];\r\n }\r\n else {\r\n this._queue.length = 0;\r\n }\r\n };\r\n /**\r\n * Loads the specified URL.\r\n *\r\n * @param url The URL fragment to load.\r\n */\r\n AppRouter.prototype.loadUrl = function (url) {\r\n var _this = this;\r\n return this\r\n ._createNavigationInstruction(url)\r\n .then(function (instruction) { return _this._queueInstruction(instruction); })\r\n .catch(function (error) {\r\n logger.error(error);\r\n restorePreviousLocation(_this);\r\n });\r\n };\r\n /**\r\n * Registers a viewPort to be used as a rendering target for activated routes.\r\n *\r\n * @param viewPort The viewPort. This is typically a element in Aurelia default impl\r\n * @param name The name of the viewPort. 'default' if unspecified.\r\n */\r\n AppRouter.prototype.registerViewPort = function (viewPort, name) {\r\n var _this = this;\r\n // having strong typing without changing public API\r\n var $viewPort = viewPort;\r\n _super.prototype.registerViewPort.call(this, $viewPort, name);\r\n // beside adding viewport to the registry of this instance\r\n // AppRouter also configure routing/history to start routing functionality\r\n // There are situation where there are more than 1 element at root view\r\n // in that case, still only activate once via the following guard\r\n if (!this.isActive) {\r\n var viewModel_1 = this._findViewModel($viewPort);\r\n if ('configureRouter' in viewModel_1) {\r\n // If there are more than one element at root view\r\n // use this flag to guard against configure method being invoked multiple times\r\n // this flag is set inside method configure\r\n if (!this.isConfigured) {\r\n // replace the real resolve with a noop to guarantee that any action in base class Router\r\n // won't resolve the configurePromise prematurely\r\n var resolveConfiguredPromise_1 = this._resolveConfiguredPromise;\r\n this._resolveConfiguredPromise = function () { };\r\n return this\r\n .configure(function (config) {\r\n return Promise\r\n .resolve(viewModel_1.configureRouter(config, _this))\r\n // an issue with configure interface. Should be fixed there\r\n // todo: fix this via configure interface in router\r\n .then(function () { return config; });\r\n })\r\n .then(function () {\r\n _this.activate();\r\n resolveConfiguredPromise_1();\r\n });\r\n }\r\n }\r\n else {\r\n this.activate();\r\n }\r\n }\r\n // when a viewport is added dynamically to a root view that is already activated\r\n // just process the navigation instruction\r\n else {\r\n this._dequeueInstruction();\r\n }\r\n return Promise.resolve();\r\n };\r\n /**\r\n * Activates the router. This instructs the router to begin listening for history changes and processing instructions.\r\n *\r\n * @params options The set of options to activate the router with.\r\n */\r\n AppRouter.prototype.activate = function (options) {\r\n if (this.isActive) {\r\n return;\r\n }\r\n this.isActive = true;\r\n // route handler property is responsible for handling url change\r\n // the interface of aurelia-history isn't clear on this perspective\r\n this.options = Object.assign({ routeHandler: this.loadUrl.bind(this) }, this.options, options);\r\n this.history.activate(this.options);\r\n this._dequeueInstruction();\r\n };\r\n /**\r\n * Deactivates the router.\r\n */\r\n AppRouter.prototype.deactivate = function () {\r\n this.isActive = false;\r\n this.history.deactivate();\r\n };\r\n /**@internal */\r\n AppRouter.prototype._queueInstruction = function (instruction) {\r\n var _this = this;\r\n return new Promise(function (resolve) {\r\n instruction.resolve = resolve;\r\n _this._queue.unshift(instruction);\r\n _this._dequeueInstruction();\r\n });\r\n };\r\n /**@internal */\r\n AppRouter.prototype._dequeueInstruction = function (instructionCount) {\r\n var _this = this;\r\n if (instructionCount === void 0) { instructionCount = 0; }\r\n return Promise.resolve().then(function () {\r\n if (_this.isNavigating && !instructionCount) {\r\n // ts complains about inconsistent returns without void 0\r\n return void 0;\r\n }\r\n var instruction = _this._queue.shift();\r\n _this._queue.length = 0;\r\n if (!instruction) {\r\n // ts complains about inconsistent returns without void 0\r\n return void 0;\r\n }\r\n _this.isNavigating = true;\r\n var navtracker = _this.history.getState('NavigationTracker');\r\n var currentNavTracker = _this.currentNavigationTracker;\r\n if (!navtracker && !currentNavTracker) {\r\n _this.isNavigatingFirst = true;\r\n _this.isNavigatingNew = true;\r\n }\r\n else if (!navtracker) {\r\n _this.isNavigatingNew = true;\r\n }\r\n else if (!currentNavTracker) {\r\n _this.isNavigatingRefresh = true;\r\n }\r\n else if (currentNavTracker < navtracker) {\r\n _this.isNavigatingForward = true;\r\n }\r\n else if (currentNavTracker > navtracker) {\r\n _this.isNavigatingBack = true;\r\n }\r\n if (!navtracker) {\r\n navtracker = Date.now();\r\n _this.history.setState('NavigationTracker', navtracker);\r\n }\r\n _this.currentNavigationTracker = navtracker;\r\n instruction.previousInstruction = _this.currentInstruction;\r\n var maxInstructionCount = _this.maxInstructionCount;\r\n if (!instructionCount) {\r\n _this.events.publish(\"router:navigation:processing\" /* Processing */, { instruction: instruction });\r\n }\r\n else if (instructionCount === maxInstructionCount - 1) {\r\n logger.error(instructionCount + 1 + \" navigation instructions have been attempted without success. Restoring last known good location.\");\r\n restorePreviousLocation(_this);\r\n return _this._dequeueInstruction(instructionCount + 1);\r\n }\r\n else if (instructionCount > maxInstructionCount) {\r\n throw new Error('Maximum navigation attempts exceeded. Giving up.');\r\n }\r\n var pipeline = _this.pipelineProvider.createPipeline(!_this.couldDeactivate);\r\n return pipeline\r\n .run(instruction)\r\n .then(function (result) { return processResult(instruction, result, instructionCount, _this); })\r\n .catch(function (error) {\r\n return { output: error instanceof Error ? error : new Error(error) };\r\n })\r\n .then(function (result) { return resolveInstruction(instruction, result, !!instructionCount, _this); });\r\n });\r\n };\r\n /**@internal */\r\n AppRouter.prototype._findViewModel = function (viewPort) {\r\n if (this.container.viewModel) {\r\n return this.container.viewModel;\r\n }\r\n if (viewPort.container) {\r\n var container = viewPort.container;\r\n while (container) {\r\n if (container.viewModel) {\r\n this.container.viewModel = container.viewModel;\r\n return container.viewModel;\r\n }\r\n container = container.parent;\r\n }\r\n }\r\n return undefined;\r\n };\r\n return AppRouter;\r\n}(Router));\r\nvar processResult = function (instruction, result, instructionCount, router) {\r\n if (!(result && 'completed' in result && 'output' in result)) {\r\n result = result || {};\r\n result.output = new Error(\"Expected router pipeline to return a navigation result, but got [\" + JSON.stringify(result) + \"] instead.\");\r\n }\r\n var finalResult = null;\r\n var navigationCommandResult = null;\r\n if (isNavigationCommand(result.output)) {\r\n navigationCommandResult = result.output.navigate(router);\r\n }\r\n else {\r\n finalResult = result;\r\n if (!result.completed) {\r\n if (result.output instanceof Error) {\r\n logger.error(result.output.toString());\r\n }\r\n restorePreviousLocation(router);\r\n }\r\n }\r\n return Promise.resolve(navigationCommandResult)\r\n .then(function (_) { return router._dequeueInstruction(instructionCount + 1); })\r\n .then(function (innerResult) { return finalResult || innerResult || result; });\r\n};\r\nvar resolveInstruction = function (instruction, result, isInnerInstruction, router) {\r\n instruction.resolve(result);\r\n var eventAggregator = router.events;\r\n var eventArgs = { instruction: instruction, result: result };\r\n if (!isInnerInstruction) {\r\n router.isNavigating = false;\r\n router.isExplicitNavigation = false;\r\n router.isExplicitNavigationBack = false;\r\n router.isNavigatingFirst = false;\r\n router.isNavigatingNew = false;\r\n router.isNavigatingRefresh = false;\r\n router.isNavigatingForward = false;\r\n router.isNavigatingBack = false;\r\n router.couldDeactivate = false;\r\n var eventName = void 0;\r\n if (result.output instanceof Error) {\r\n eventName = \"router:navigation:error\" /* Error */;\r\n }\r\n else if (!result.completed) {\r\n eventName = \"router:navigation:canceled\" /* Canceled */;\r\n }\r\n else {\r\n var queryString = instruction.queryString ? ('?' + instruction.queryString) : '';\r\n router.history.previousLocation = instruction.fragment + queryString;\r\n eventName = \"router:navigation:success\" /* Success */;\r\n }\r\n eventAggregator.publish(eventName, eventArgs);\r\n eventAggregator.publish(\"router:navigation:complete\" /* Complete */, eventArgs);\r\n }\r\n else {\r\n eventAggregator.publish(\"router:navigation:child:complete\" /* ChildComplete */, eventArgs);\r\n }\r\n return result;\r\n};\r\nvar restorePreviousLocation = function (router) {\r\n var previousLocation = router.history.previousLocation;\r\n if (previousLocation) {\r\n router.navigate(previousLocation, { trigger: false, replace: true });\r\n }\r\n else if (router.fallbackRoute) {\r\n router.navigate(router.fallbackRoute, { trigger: true, replace: true });\r\n }\r\n else {\r\n logger.error('Router navigation failed, and no previous location or fallbackRoute could be restored.');\r\n }\r\n};\n\n/**\r\n* The status of a Pipeline.\r\n*/\r\nvar PipelineStatus;\r\n(function (PipelineStatus) {\r\n PipelineStatus[\"Completed\"] = \"completed\";\r\n PipelineStatus[\"Canceled\"] = \"canceled\";\r\n PipelineStatus[\"Rejected\"] = \"rejected\";\r\n PipelineStatus[\"Running\"] = \"running\";\r\n})(PipelineStatus || (PipelineStatus = {}));\n\n/**\r\n * A list of known router events used by the Aurelia router\r\n * to signal the pipeline has come to a certain state\r\n */\r\n// const enum is preserved in tsconfig\r\nvar RouterEvent;\r\n(function (RouterEvent) {\r\n RouterEvent[\"Processing\"] = \"router:navigation:processing\";\r\n RouterEvent[\"Error\"] = \"router:navigation:error\";\r\n RouterEvent[\"Canceled\"] = \"router:navigation:canceled\";\r\n RouterEvent[\"Complete\"] = \"router:navigation:complete\";\r\n RouterEvent[\"Success\"] = \"router:navigation:success\";\r\n RouterEvent[\"ChildComplete\"] = \"router:navigation:child:complete\";\r\n})(RouterEvent || (RouterEvent = {}));\n\n/**\r\n * Available pipeline slot names to insert interceptor into router pipeline\r\n */\r\n// const enum is preserved in tsconfig\r\nvar PipelineSlotName;\r\n(function (PipelineSlotName) {\r\n /**\r\n * Authorization slot. Invoked early in the pipeline,\r\n * before `canActivate` hook of incoming route\r\n */\r\n PipelineSlotName[\"Authorize\"] = \"authorize\";\r\n /**\r\n * Pre-activation slot. Invoked early in the pipeline,\r\n * Invoked timing:\r\n * - after Authorization slot\r\n * - after canActivate hook on new view model\r\n * - before deactivate hook on old view model\r\n * - before activate hook on new view model\r\n */\r\n PipelineSlotName[\"PreActivate\"] = \"preActivate\";\r\n /**\r\n * Pre-render slot. Invoked later in the pipeline\r\n * Invokcation timing:\r\n * - after activate hook on new view model\r\n * - before commit step on new navigation instruction\r\n */\r\n PipelineSlotName[\"PreRender\"] = \"preRender\";\r\n /**\r\n * Post-render slot. Invoked last in the pipeline\r\n */\r\n PipelineSlotName[\"PostRender\"] = \"postRender\";\r\n})(PipelineSlotName || (PipelineSlotName = {}));\n\nexport { ActivateNextStep, AppRouter, BuildNavigationPlanStep, CanActivateNextStep, CanDeactivatePreviousStep, CommitChangesStep, DeactivatePreviousStep, LoadRouteStep, NavModel, NavigationInstruction, Pipeline, PipelineProvider, PipelineSlotName, PipelineStatus, Redirect, RedirectToRoute, RouteLoader, Router, RouterConfiguration, RouterEvent, activationStrategy, isNavigationCommand };\n//# sourceMappingURL=aurelia-router.js.map\n"],"names":[],"sourceRoot":""}