{"version":3,"file":"vendors-684599ca.6a6097f6e2aa5afd737e.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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;AC35DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;ACTA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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://web/./node_modules/aurelia-validation/dist/native-modules/aurelia-validation.js","webpack://web/./node_modules/aurelia-webpack-plugin/runtime/empty-entry.js","webpack://web/./node_modules/aurelia-webpack-plugin/runtime/pal-loader-entry.js"],"sourcesContent":["import { LiteralString, Binary, Conditional, LiteralPrimitive, CallMember, AccessMember, AccessScope, AccessKeyed, BindingBehavior, ValueConverter, getContextFor, Parser, bindingBehavior, bindingMode } from 'aurelia-binding';\nimport { BindingLanguage, ViewResources, customAttribute, bindable } from 'aurelia-templating';\nimport { getLogger } from 'aurelia-logging';\nimport { DOM } from 'aurelia-pal';\nimport { Optional, Lazy } from 'aurelia-dependency-injection';\nimport { TaskQueue } from 'aurelia-task-queue';\n\n/**\r\n * Validates objects and properties.\r\n */\r\nvar Validator = /** @class */ (function () {\r\n function Validator() {\r\n }\r\n return Validator;\r\n}());\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}\r\n\r\nfunction __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nfunction __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\n\n/**\r\n * The result of validating an individual validation rule.\r\n */\r\nvar ValidateResult = /** @class */ (function () {\r\n /**\r\n * @param rule The rule associated with the result. Validator implementation specific.\r\n * @param object The object that was validated.\r\n * @param propertyName The name of the property that was validated.\r\n * @param error The error, if the result is a validation error.\r\n */\r\n function ValidateResult(rule, object, propertyName, valid, message) {\r\n if (message === void 0) { message = null; }\r\n this.rule = rule;\r\n this.object = object;\r\n this.propertyName = propertyName;\r\n this.valid = valid;\r\n this.message = message;\r\n this.id = ValidateResult.nextId++;\r\n }\r\n ValidateResult.prototype.toString = function () {\r\n return this.valid ? 'Valid.' : this.message;\r\n };\r\n ValidateResult.nextId = 0;\r\n return ValidateResult;\r\n}());\n\n/**\r\n * Sets, unsets and retrieves rules on an object or constructor function.\r\n */\r\nvar Rules = /** @class */ (function () {\r\n function Rules() {\r\n }\r\n /**\r\n * Applies the rules to a target.\r\n */\r\n Rules.set = function (target, rules) {\r\n if (target instanceof Function) {\r\n target = target.prototype;\r\n }\r\n Object.defineProperty(target, Rules.key, { enumerable: false, configurable: false, writable: true, value: rules });\r\n };\r\n /**\r\n * Removes rules from a target.\r\n */\r\n Rules.unset = function (target) {\r\n if (target instanceof Function) {\r\n target = target.prototype;\r\n }\r\n target[Rules.key] = null;\r\n };\r\n /**\r\n * Retrieves the target's rules.\r\n */\r\n Rules.get = function (target) {\r\n return target[Rules.key] || null;\r\n };\r\n /**\r\n * The name of the property that stores the rules.\r\n */\r\n Rules.key = '__rules__';\r\n return Rules;\r\n}());\n\n// tslint:disable:no-empty\r\nvar ExpressionVisitor = /** @class */ (function () {\r\n function ExpressionVisitor() {\r\n }\r\n ExpressionVisitor.prototype.visitChain = function (chain) {\r\n this.visitArgs(chain.expressions);\r\n };\r\n ExpressionVisitor.prototype.visitBindingBehavior = function (behavior) {\r\n behavior.expression.accept(this);\r\n this.visitArgs(behavior.args);\r\n };\r\n ExpressionVisitor.prototype.visitValueConverter = function (converter) {\r\n converter.expression.accept(this);\r\n this.visitArgs(converter.args);\r\n };\r\n ExpressionVisitor.prototype.visitAssign = function (assign) {\r\n assign.target.accept(this);\r\n assign.value.accept(this);\r\n };\r\n ExpressionVisitor.prototype.visitConditional = function (conditional) {\r\n conditional.condition.accept(this);\r\n conditional.yes.accept(this);\r\n conditional.no.accept(this);\r\n };\r\n ExpressionVisitor.prototype.visitAccessThis = function (access) {\r\n access.ancestor = access.ancestor;\r\n };\r\n ExpressionVisitor.prototype.visitAccessScope = function (access) {\r\n access.name = access.name;\r\n };\r\n ExpressionVisitor.prototype.visitAccessMember = function (access) {\r\n access.object.accept(this);\r\n };\r\n ExpressionVisitor.prototype.visitAccessKeyed = function (access) {\r\n access.object.accept(this);\r\n access.key.accept(this);\r\n };\r\n ExpressionVisitor.prototype.visitCallScope = function (call) {\r\n this.visitArgs(call.args);\r\n };\r\n ExpressionVisitor.prototype.visitCallFunction = function (call) {\r\n call.func.accept(this);\r\n this.visitArgs(call.args);\r\n };\r\n ExpressionVisitor.prototype.visitCallMember = function (call) {\r\n call.object.accept(this);\r\n this.visitArgs(call.args);\r\n };\r\n ExpressionVisitor.prototype.visitPrefix = function (prefix) {\r\n prefix.expression.accept(this);\r\n };\r\n ExpressionVisitor.prototype.visitBinary = function (binary) {\r\n binary.left.accept(this);\r\n binary.right.accept(this);\r\n };\r\n ExpressionVisitor.prototype.visitLiteralPrimitive = function (literal) {\r\n literal.value = literal.value;\r\n };\r\n ExpressionVisitor.prototype.visitLiteralArray = function (literal) {\r\n this.visitArgs(literal.elements);\r\n };\r\n ExpressionVisitor.prototype.visitLiteralObject = function (literal) {\r\n this.visitArgs(literal.values);\r\n };\r\n ExpressionVisitor.prototype.visitLiteralString = function (literal) {\r\n literal.value = literal.value;\r\n };\r\n ExpressionVisitor.prototype.visitArgs = function (args) {\r\n for (var i = 0; i < args.length; i++) {\r\n args[i].accept(this);\r\n }\r\n };\r\n return ExpressionVisitor;\r\n}());\n\nvar ValidationMessageParser = /** @class */ (function () {\r\n function ValidationMessageParser(bindinqLanguage) {\r\n this.bindinqLanguage = bindinqLanguage;\r\n this.emptyStringExpression = new LiteralString('');\r\n this.nullExpression = new LiteralPrimitive(null);\r\n this.undefinedExpression = new LiteralPrimitive(undefined);\r\n this.cache = {};\r\n }\r\n ValidationMessageParser.prototype.parse = function (message) {\r\n if (this.cache[message] !== undefined) {\r\n return this.cache[message];\r\n }\r\n var parts = this.bindinqLanguage.parseInterpolation(null, message);\r\n if (parts === null) {\r\n return new LiteralString(message);\r\n }\r\n var expression = new LiteralString(parts[0]);\r\n for (var i = 1; i < parts.length; i += 2) {\r\n expression = new Binary('+', expression, new Binary('+', this.coalesce(parts[i]), new LiteralString(parts[i + 1])));\r\n }\r\n MessageExpressionValidator.validate(expression, message);\r\n this.cache[message] = expression;\r\n return expression;\r\n };\r\n ValidationMessageParser.prototype.coalesce = function (part) {\r\n // part === null || part === undefined ? '' : part\r\n return new Conditional(new Binary('||', new Binary('===', part, this.nullExpression), new Binary('===', part, this.undefinedExpression)), this.emptyStringExpression, new CallMember(part, 'toString', []));\r\n };\r\n ValidationMessageParser.inject = [BindingLanguage];\r\n return ValidationMessageParser;\r\n}());\r\nvar MessageExpressionValidator = /** @class */ (function (_super) {\r\n __extends(MessageExpressionValidator, _super);\r\n function MessageExpressionValidator(originalMessage) {\r\n var _this = _super.call(this) || this;\r\n _this.originalMessage = originalMessage;\r\n return _this;\r\n }\r\n MessageExpressionValidator.validate = function (expression, originalMessage) {\r\n var visitor = new MessageExpressionValidator(originalMessage);\r\n expression.accept(visitor);\r\n };\r\n MessageExpressionValidator.prototype.visitAccessScope = function (access) {\r\n if (access.ancestor !== 0) {\r\n throw new Error('$parent is not permitted in validation message expressions.');\r\n }\r\n if (['displayName', 'propertyName', 'value', 'object', 'config', 'getDisplayName'].indexOf(access.name) !== -1) {\r\n getLogger('aurelia-validation')\r\n // tslint:disable-next-line:max-line-length\r\n .warn(\"Did you mean to use \\\"$\" + access.name + \"\\\" instead of \\\"\" + access.name + \"\\\" in this validation message template: \\\"\" + this.originalMessage + \"\\\"?\");\r\n }\r\n };\r\n return MessageExpressionValidator;\r\n}(ExpressionVisitor));\n\n/**\r\n * Dictionary of validation messages. [messageKey]: messageExpression\r\n */\r\nvar validationMessages = {\r\n /**\r\n * The default validation message. Used with rules that have no standard message.\r\n */\r\n default: \"${$displayName} is invalid.\",\r\n required: \"${$displayName} is required.\",\r\n matches: \"${$displayName} is not correctly formatted.\",\r\n email: \"${$displayName} is not a valid email.\",\r\n minLength: \"${$displayName} must be at least ${$config.length} character${$config.length === 1 ? '' : 's'}.\",\r\n maxLength: \"${$displayName} cannot be longer than ${$config.length} character${$config.length === 1 ? '' : 's'}.\",\r\n minItems: \"${$displayName} must contain at least ${$config.count} item${$config.count === 1 ? '' : 's'}.\",\r\n maxItems: \"${$displayName} cannot contain more than ${$config.count} item${$config.count === 1 ? '' : 's'}.\",\r\n min: \"${$displayName} must be at least ${$config.constraint}.\",\r\n max: \"${$displayName} must be at most ${$config.constraint}.\",\r\n range: \"${$displayName} must be between or equal to ${$config.min} and ${$config.max}.\",\r\n between: \"${$displayName} must be between but not equal to ${$config.min} and ${$config.max}.\",\r\n equals: \"${$displayName} must be ${$config.expectedValue}.\",\r\n};\r\n/**\r\n * Retrieves validation messages and property display names.\r\n */\r\nvar ValidationMessageProvider = /** @class */ (function () {\r\n function ValidationMessageProvider(parser) {\r\n this.parser = parser;\r\n }\r\n /**\r\n * Returns a message binding expression that corresponds to the key.\r\n * @param key The message key.\r\n */\r\n ValidationMessageProvider.prototype.getMessage = function (key) {\r\n var message;\r\n if (key in validationMessages) {\r\n message = validationMessages[key];\r\n }\r\n else {\r\n message = validationMessages['default'];\r\n }\r\n return this.parser.parse(message);\r\n };\r\n /**\r\n * Formulates a property display name using the property name and the configured\r\n * displayName (if provided).\r\n * Override this with your own custom logic.\r\n * @param propertyName The property name.\r\n */\r\n ValidationMessageProvider.prototype.getDisplayName = function (propertyName, displayName) {\r\n if (displayName !== null && displayName !== undefined) {\r\n return (displayName instanceof Function) ? displayName() : displayName;\r\n }\r\n // split on upper-case letters.\r\n var words = propertyName.toString().split(/(?=[A-Z])/).join(' ');\r\n // capitalize first letter.\r\n return words.charAt(0).toUpperCase() + words.slice(1);\r\n };\r\n ValidationMessageProvider.inject = [ValidationMessageParser];\r\n return ValidationMessageProvider;\r\n}());\n\n/**\r\n * Validates.\r\n * Responsible for validating objects and properties.\r\n */\r\nvar StandardValidator = /** @class */ (function (_super) {\r\n __extends(StandardValidator, _super);\r\n function StandardValidator(messageProvider, resources) {\r\n var _this = _super.call(this) || this;\r\n _this.messageProvider = messageProvider;\r\n _this.lookupFunctions = resources.lookupFunctions;\r\n _this.getDisplayName = messageProvider.getDisplayName.bind(messageProvider);\r\n return _this;\r\n }\r\n /**\r\n * Validates the specified property.\r\n * @param object The object to validate.\r\n * @param propertyName The name of the property to validate.\r\n * @param rules Optional. If unspecified, the rules will be looked up using the metadata\r\n * for the object created by ValidationRules....on(class/object)\r\n */\r\n StandardValidator.prototype.validateProperty = function (object, propertyName, rules) {\r\n return this.validate(object, propertyName, rules || null);\r\n };\r\n /**\r\n * Validates all rules for specified object and it's properties.\r\n * @param object The object to validate.\r\n * @param rules Optional. If unspecified, the rules will be looked up using the metadata\r\n * for the object created by ValidationRules....on(class/object)\r\n */\r\n StandardValidator.prototype.validateObject = function (object, rules) {\r\n return this.validate(object, null, rules || null);\r\n };\r\n /**\r\n * Determines whether a rule exists in a set of rules.\r\n * @param rules The rules to search.\r\n * @parem rule The rule to find.\r\n */\r\n StandardValidator.prototype.ruleExists = function (rules, rule) {\r\n var i = rules.length;\r\n while (i--) {\r\n if (rules[i].indexOf(rule) !== -1) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n };\r\n StandardValidator.prototype.getMessage = function (rule, object, value) {\r\n var expression = rule.message || this.messageProvider.getMessage(rule.messageKey);\r\n // tslint:disable-next-line:prefer-const\r\n var _a = rule.property, propertyName = _a.name, displayName = _a.displayName;\r\n if (propertyName !== null) {\r\n displayName = this.messageProvider.getDisplayName(propertyName, displayName);\r\n }\r\n var overrideContext = {\r\n $displayName: displayName,\r\n $propertyName: propertyName,\r\n $value: value,\r\n $object: object,\r\n $config: rule.config,\r\n // returns the name of a given property, given just the property name (irrespective of the property's displayName)\r\n // split on capital letters, first letter ensured to be capitalized\r\n $getDisplayName: this.getDisplayName\r\n };\r\n return expression.evaluate({ bindingContext: object, overrideContext: overrideContext }, this.lookupFunctions);\r\n };\r\n StandardValidator.prototype.validateRuleSequence = function (object, propertyName, ruleSequence, sequence, results) {\r\n var _this = this;\r\n // are we validating all properties or a single property?\r\n var validateAllProperties = propertyName === null || propertyName === undefined;\r\n var rules = ruleSequence[sequence];\r\n var allValid = true;\r\n // validate each rule.\r\n var promises = [];\r\n var _loop_1 = function (i) {\r\n var rule = rules[i];\r\n // is the rule related to the property we're validating.\r\n // tslint:disable-next-line:triple-equals | Use loose equality for property keys\r\n if (!validateAllProperties && rule.property.name != propertyName) {\r\n return \"continue\";\r\n }\r\n // is this a conditional rule? is the condition met?\r\n if (rule.when && !rule.when(object)) {\r\n return \"continue\";\r\n }\r\n // validate.\r\n var value = rule.property.name === null ? object : object[rule.property.name];\r\n var promiseOrBoolean = rule.condition(value, object);\r\n if (!(promiseOrBoolean instanceof Promise)) {\r\n promiseOrBoolean = Promise.resolve(promiseOrBoolean);\r\n }\r\n promises.push(promiseOrBoolean.then(function (valid) {\r\n var message = valid ? null : _this.getMessage(rule, object, value);\r\n results.push(new ValidateResult(rule, object, rule.property.name, valid, message));\r\n allValid = allValid && valid;\r\n return valid;\r\n }));\r\n };\r\n for (var i = 0; i < rules.length; i++) {\r\n _loop_1(i);\r\n }\r\n return Promise.all(promises)\r\n .then(function () {\r\n sequence++;\r\n if (allValid && sequence < ruleSequence.length) {\r\n return _this.validateRuleSequence(object, propertyName, ruleSequence, sequence, results);\r\n }\r\n return results;\r\n });\r\n };\r\n StandardValidator.prototype.validate = function (object, propertyName, rules) {\r\n // rules specified?\r\n if (!rules) {\r\n // no. attempt to locate the rules.\r\n rules = Rules.get(object);\r\n }\r\n // any rules?\r\n if (!rules || rules.length === 0) {\r\n return Promise.resolve([]);\r\n }\r\n return this.validateRuleSequence(object, propertyName, rules, 0, []);\r\n };\r\n StandardValidator.inject = [ValidationMessageProvider, ViewResources];\r\n return StandardValidator;\r\n}(Validator));\n\n/**\r\n * Validation triggers.\r\n */\r\nvar validateTrigger;\r\n(function (validateTrigger) {\r\n /**\r\n * Manual validation. Use the controller's `validate()` and `reset()` methods\r\n * to validate all bindings.\r\n */\r\n validateTrigger[validateTrigger[\"manual\"] = 0] = \"manual\";\r\n /**\r\n * Validate the binding when the binding's target element fires a DOM \"blur\" event.\r\n */\r\n validateTrigger[validateTrigger[\"blur\"] = 1] = \"blur\";\r\n /**\r\n * Validate the binding when it updates the model due to a change in the view.\r\n */\r\n validateTrigger[validateTrigger[\"change\"] = 2] = \"change\";\r\n /**\r\n * Validate the binding when the binding's target element fires a DOM \"blur\" event and\r\n * when it updates the model due to a change in the view.\r\n */\r\n validateTrigger[validateTrigger[\"changeOrBlur\"] = 3] = \"changeOrBlur\";\r\n /**\r\n * Validate the binding when the binding's target element fires a DOM \"focusout\" event.\r\n * Unlike \"blur\", this event bubbles.\r\n */\r\n validateTrigger[validateTrigger[\"focusout\"] = 4] = \"focusout\";\r\n /**\r\n * Validate the binding when the binding's target element fires a DOM \"focusout\" event or\r\n * when it updates the model due to a change in the view.\r\n */\r\n validateTrigger[validateTrigger[\"changeOrFocusout\"] = 6] = \"changeOrFocusout\";\r\n})(validateTrigger || (validateTrigger = {}));\n\n/**\r\n * Aurelia Validation Configuration API\r\n */\r\nvar GlobalValidationConfiguration = /** @class */ (function () {\r\n function GlobalValidationConfiguration() {\r\n this.validatorType = StandardValidator;\r\n this.validationTrigger = GlobalValidationConfiguration.DEFAULT_VALIDATION_TRIGGER;\r\n }\r\n /**\r\n * Use a custom Validator implementation.\r\n */\r\n GlobalValidationConfiguration.prototype.customValidator = function (type) {\r\n this.validatorType = type;\r\n return this;\r\n };\r\n GlobalValidationConfiguration.prototype.defaultValidationTrigger = function (trigger) {\r\n this.validationTrigger = trigger;\r\n return this;\r\n };\r\n GlobalValidationConfiguration.prototype.getDefaultValidationTrigger = function () {\r\n return this.validationTrigger;\r\n };\r\n /**\r\n * Applies the configuration.\r\n */\r\n GlobalValidationConfiguration.prototype.apply = function (container) {\r\n var validator = container.get(this.validatorType);\r\n container.registerInstance(Validator, validator);\r\n container.registerInstance(GlobalValidationConfiguration, this);\r\n };\r\n GlobalValidationConfiguration.DEFAULT_VALIDATION_TRIGGER = validateTrigger.blur;\r\n return GlobalValidationConfiguration;\r\n}());\n\n/**\r\n * Gets the DOM element associated with the data-binding. Most of the time it's\r\n * the binding.target but sometimes binding.target is an aurelia custom element,\r\n * or custom attribute which is a javascript \"class\" instance, so we need to use\r\n * the controller's container to retrieve the actual DOM element.\r\n */\r\nfunction getTargetDOMElement(binding, view) {\r\n var target = binding.target;\r\n // DOM element\r\n if (target instanceof Element) {\r\n return target;\r\n }\r\n // custom element or custom attribute\r\n // tslint:disable-next-line:prefer-const\r\n for (var i = 0, ii = view.controllers.length; i < ii; i++) {\r\n var controller = view.controllers[i];\r\n if (controller.viewModel === target) {\r\n var element = controller.container.get(DOM.Element);\r\n if (element) {\r\n return element;\r\n }\r\n throw new Error(\"Unable to locate target element for \\\"\" + binding.sourceExpression + \"\\\".\");\r\n }\r\n }\r\n throw new Error(\"Unable to locate target element for \\\"\" + binding.sourceExpression + \"\\\".\");\r\n}\n\nfunction getObject(expression, objectExpression, source) {\r\n var value = objectExpression.evaluate(source, null);\r\n if (value === null || value === undefined || value instanceof Object) {\r\n return value;\r\n }\r\n // tslint:disable-next-line:max-line-length\r\n throw new Error(\"The '\" + objectExpression + \"' part of '\" + expression + \"' evaluates to \" + value + \" instead of an object, null or undefined.\");\r\n}\r\n/**\r\n * Retrieves the object and property name for the specified expression.\r\n * @param expression The expression\r\n * @param source The scope\r\n */\r\nfunction getPropertyInfo(expression, source) {\r\n var originalExpression = expression;\r\n while (expression instanceof BindingBehavior || expression instanceof ValueConverter) {\r\n expression = expression.expression;\r\n }\r\n var object;\r\n var propertyName;\r\n if (expression instanceof AccessScope) {\r\n object = getContextFor(expression.name, source, expression.ancestor);\r\n propertyName = expression.name;\r\n }\r\n else if (expression instanceof AccessMember) {\r\n object = getObject(originalExpression, expression.object, source);\r\n propertyName = expression.name;\r\n }\r\n else if (expression instanceof AccessKeyed) {\r\n object = getObject(originalExpression, expression.object, source);\r\n propertyName = expression.key.evaluate(source);\r\n }\r\n else {\r\n throw new Error(\"Expression '\" + originalExpression + \"' is not compatible with the validate binding-behavior.\");\r\n }\r\n if (object === null || object === undefined) {\r\n return null;\r\n }\r\n return { object: object, propertyName: propertyName };\r\n}\n\nfunction isString(value) {\r\n return Object.prototype.toString.call(value) === '[object String]';\r\n}\r\nfunction isNumber(value) {\r\n return Object.prototype.toString.call(value) === '[object Number]';\r\n}\n\nvar PropertyAccessorParser = /** @class */ (function () {\r\n function PropertyAccessorParser(parser) {\r\n this.parser = parser;\r\n }\r\n PropertyAccessorParser.prototype.parse = function (property) {\r\n if (isString(property) || isNumber(property)) {\r\n return property;\r\n }\r\n var accessorText = getAccessorExpression(property.toString());\r\n var accessor = this.parser.parse(accessorText);\r\n if (accessor instanceof AccessScope\r\n || accessor instanceof AccessMember && accessor.object instanceof AccessScope) {\r\n return accessor.name;\r\n }\r\n throw new Error(\"Invalid property expression: \\\"\" + accessor + \"\\\"\");\r\n };\r\n PropertyAccessorParser.inject = [Parser];\r\n return PropertyAccessorParser;\r\n}());\r\nfunction getAccessorExpression(fn) {\r\n /* tslint:disable:max-line-length */\r\n var classic = /^function\\s*\\([$_\\w\\d]+\\)\\s*\\{(?:\\s*\"use strict\";)?(?:[$_\\s\\w\\d\\/\\*.['\"\\]+;]+)?\\s*return\\s+[$_\\w\\d]+\\.([$_\\w\\d]+)\\s*;?\\s*\\}$/;\r\n /* tslint:enable:max-line-length */\r\n var arrow = /^\\(?[$_\\w\\d]+\\)?\\s*=>\\s*[$_\\w\\d]+\\.([$_\\w\\d]+)$/;\r\n var match = classic.exec(fn) || arrow.exec(fn);\r\n if (match === null) {\r\n throw new Error(\"Unable to parse accessor function:\\n\" + fn);\r\n }\r\n return match[1];\r\n}\n\nvar ValidateEvent = /** @class */ (function () {\r\n function ValidateEvent(\r\n /**\r\n * The type of validate event. Either \"validate\" or \"reset\".\r\n */\r\n type, \r\n /**\r\n * The controller's current array of errors. For an array containing both\r\n * failed rules and passed rules, use the \"results\" property.\r\n */\r\n errors, \r\n /**\r\n * The controller's current array of validate results. This\r\n * includes both passed rules and failed rules. For an array of only failed rules,\r\n * use the \"errors\" property.\r\n */\r\n results, \r\n /**\r\n * The instruction passed to the \"validate\" or \"reset\" event. Will be null when\r\n * the controller's validate/reset method was called with no instruction argument.\r\n */\r\n instruction, \r\n /**\r\n * In events with type === \"validate\", this property will contain the result\r\n * of validating the instruction (see \"instruction\" property). Use the controllerValidateResult\r\n * to access the validate results specific to the call to \"validate\"\r\n * (as opposed to using the \"results\" and \"errors\" properties to access the controller's entire\r\n * set of results/errors).\r\n */\r\n controllerValidateResult) {\r\n this.type = type;\r\n this.errors = errors;\r\n this.results = results;\r\n this.instruction = instruction;\r\n this.controllerValidateResult = controllerValidateResult;\r\n }\r\n return ValidateEvent;\r\n}());\n\n/**\r\n * Orchestrates validation.\r\n * Manages a set of bindings, renderers and objects.\r\n * Exposes the current list of validation results for binding purposes.\r\n */\r\nvar ValidationController = /** @class */ (function () {\r\n function ValidationController(validator, propertyParser, config) {\r\n this.validator = validator;\r\n this.propertyParser = propertyParser;\r\n // Registered bindings (via the validate binding behavior)\r\n this.bindings = new Map();\r\n // Renderers that have been added to the controller instance.\r\n this.renderers = [];\r\n /**\r\n * Validation results that have been rendered by the controller.\r\n */\r\n this.results = [];\r\n /**\r\n * Validation errors that have been rendered by the controller.\r\n */\r\n this.errors = [];\r\n /**\r\n * Whether the controller is currently validating.\r\n */\r\n this.validating = false;\r\n // Elements related to validation results that have been rendered.\r\n this.elements = new Map();\r\n // Objects that have been added to the controller instance (entity-style validation).\r\n this.objects = new Map();\r\n // Promise that resolves when validation has completed.\r\n this.finishValidating = Promise.resolve();\r\n this.eventCallbacks = [];\r\n this.validateTrigger = config instanceof GlobalValidationConfiguration\r\n ? config.getDefaultValidationTrigger()\r\n : GlobalValidationConfiguration.DEFAULT_VALIDATION_TRIGGER;\r\n }\r\n /**\r\n * Subscribe to controller validate and reset events. These events occur when the\r\n * controller's \"validate\"\" and \"reset\" methods are called.\r\n * @param callback The callback to be invoked when the controller validates or resets.\r\n */\r\n ValidationController.prototype.subscribe = function (callback) {\r\n var _this = this;\r\n this.eventCallbacks.push(callback);\r\n return {\r\n dispose: function () {\r\n var index = _this.eventCallbacks.indexOf(callback);\r\n if (index === -1) {\r\n return;\r\n }\r\n _this.eventCallbacks.splice(index, 1);\r\n }\r\n };\r\n };\r\n /**\r\n * Adds an object to the set of objects that should be validated when validate is called.\r\n * @param object The object.\r\n * @param rules Optional. The rules. If rules aren't supplied the Validator implementation will lookup the rules.\r\n */\r\n ValidationController.prototype.addObject = function (object, rules) {\r\n this.objects.set(object, rules);\r\n };\r\n /**\r\n * Removes an object from the set of objects that should be validated when validate is called.\r\n * @param object The object.\r\n */\r\n ValidationController.prototype.removeObject = function (object) {\r\n this.objects.delete(object);\r\n this.processResultDelta('reset', this.results.filter(function (result) { return result.object === object; }), []);\r\n };\r\n /**\r\n * Adds and renders an error.\r\n */\r\n ValidationController.prototype.addError = function (message, object, propertyName) {\r\n if (propertyName === void 0) { propertyName = null; }\r\n var resolvedPropertyName;\r\n if (propertyName === null) {\r\n resolvedPropertyName = propertyName;\r\n }\r\n else {\r\n resolvedPropertyName = this.propertyParser.parse(propertyName);\r\n }\r\n var result = new ValidateResult({ __manuallyAdded__: true }, object, resolvedPropertyName, false, message);\r\n this.processResultDelta('validate', [], [result]);\r\n return result;\r\n };\r\n /**\r\n * Removes and unrenders an error.\r\n */\r\n ValidationController.prototype.removeError = function (result) {\r\n if (this.results.indexOf(result) !== -1) {\r\n this.processResultDelta('reset', [result], []);\r\n }\r\n };\r\n /**\r\n * Adds a renderer.\r\n * @param renderer The renderer.\r\n */\r\n ValidationController.prototype.addRenderer = function (renderer) {\r\n var _this = this;\r\n this.renderers.push(renderer);\r\n renderer.render({\r\n kind: 'validate',\r\n render: this.results.map(function (result) { return ({ result: result, elements: _this.elements.get(result) }); }),\r\n unrender: []\r\n });\r\n };\r\n /**\r\n * Removes a renderer.\r\n * @param renderer The renderer.\r\n */\r\n ValidationController.prototype.removeRenderer = function (renderer) {\r\n var _this = this;\r\n this.renderers.splice(this.renderers.indexOf(renderer), 1);\r\n renderer.render({\r\n kind: 'reset',\r\n render: [],\r\n unrender: this.results.map(function (result) { return ({ result: result, elements: _this.elements.get(result) }); })\r\n });\r\n };\r\n /**\r\n * Registers a binding with the controller.\r\n * @param binding The binding instance.\r\n * @param target The DOM element.\r\n * @param rules (optional) rules associated with the binding. Validator implementation specific.\r\n */\r\n ValidationController.prototype.registerBinding = function (binding, target, rules) {\r\n this.bindings.set(binding, { target: target, rules: rules, propertyInfo: null });\r\n };\r\n /**\r\n * Unregisters a binding with the controller.\r\n * @param binding The binding instance.\r\n */\r\n ValidationController.prototype.unregisterBinding = function (binding) {\r\n this.resetBinding(binding);\r\n this.bindings.delete(binding);\r\n };\r\n /**\r\n * Interprets the instruction and returns a predicate that will identify\r\n * relevant results in the list of rendered validation results.\r\n */\r\n ValidationController.prototype.getInstructionPredicate = function (instruction) {\r\n var _this = this;\r\n if (instruction) {\r\n var object_1 = instruction.object, propertyName_1 = instruction.propertyName, rules_1 = instruction.rules;\r\n var predicate_1;\r\n if (instruction.propertyName) {\r\n predicate_1 = function (x) { return x.object === object_1 && x.propertyName === propertyName_1; };\r\n }\r\n else {\r\n predicate_1 = function (x) { return x.object === object_1; };\r\n }\r\n if (rules_1) {\r\n return function (x) { return predicate_1(x) && _this.validator.ruleExists(rules_1, x.rule); };\r\n }\r\n return predicate_1;\r\n }\r\n else {\r\n return function () { return true; };\r\n }\r\n };\r\n /**\r\n * Validates and renders results.\r\n * @param instruction Optional. Instructions on what to validate. If undefined, all\r\n * objects and bindings will be validated.\r\n */\r\n ValidationController.prototype.validate = function (instruction) {\r\n var _this = this;\r\n // Get a function that will process the validation instruction.\r\n var execute;\r\n if (instruction) {\r\n // tslint:disable-next-line:prefer-const\r\n var object_2 = instruction.object, propertyName_2 = instruction.propertyName, rules_2 = instruction.rules;\r\n // if rules were not specified, check the object map.\r\n rules_2 = rules_2 || this.objects.get(object_2);\r\n // property specified?\r\n if (instruction.propertyName === undefined) {\r\n // validate the specified object.\r\n execute = function () { return _this.validator.validateObject(object_2, rules_2); };\r\n }\r\n else {\r\n // validate the specified property.\r\n execute = function () { return _this.validator.validateProperty(object_2, propertyName_2, rules_2); };\r\n }\r\n }\r\n else {\r\n // validate all objects and bindings.\r\n execute = function () {\r\n var promises = [];\r\n for (var _i = 0, _a = Array.from(_this.objects); _i < _a.length; _i++) {\r\n var _b = _a[_i], object = _b[0], rules = _b[1];\r\n promises.push(_this.validator.validateObject(object, rules));\r\n }\r\n for (var _c = 0, _d = Array.from(_this.bindings); _c < _d.length; _c++) {\r\n var _e = _d[_c], binding = _e[0], rules = _e[1].rules;\r\n var propertyInfo = getPropertyInfo(binding.sourceExpression, binding.source);\r\n if (!propertyInfo || _this.objects.has(propertyInfo.object)) {\r\n continue;\r\n }\r\n promises.push(_this.validator.validateProperty(propertyInfo.object, propertyInfo.propertyName, rules));\r\n }\r\n return Promise.all(promises).then(function (resultSets) { return resultSets.reduce(function (a, b) { return a.concat(b); }, []); });\r\n };\r\n }\r\n // Wait for any existing validation to finish, execute the instruction, render the results.\r\n this.validating = true;\r\n var returnPromise = this.finishValidating\r\n .then(execute)\r\n .then(function (newResults) {\r\n var predicate = _this.getInstructionPredicate(instruction);\r\n var oldResults = _this.results.filter(predicate);\r\n _this.processResultDelta('validate', oldResults, newResults);\r\n if (returnPromise === _this.finishValidating) {\r\n _this.validating = false;\r\n }\r\n var result = {\r\n instruction: instruction,\r\n valid: newResults.find(function (x) { return !x.valid; }) === undefined,\r\n results: newResults\r\n };\r\n _this.invokeCallbacks(instruction, result);\r\n return result;\r\n })\r\n .catch(function (exception) {\r\n // recover, to enable subsequent calls to validate()\r\n _this.validating = false;\r\n _this.finishValidating = Promise.resolve();\r\n return Promise.reject(exception);\r\n });\r\n this.finishValidating = returnPromise;\r\n return returnPromise;\r\n };\r\n /**\r\n * Resets any rendered validation results (unrenders).\r\n * @param instruction Optional. Instructions on what to reset. If unspecified all rendered results\r\n * will be unrendered.\r\n */\r\n ValidationController.prototype.reset = function (instruction) {\r\n var predicate = this.getInstructionPredicate(instruction);\r\n var oldResults = this.results.filter(predicate);\r\n this.processResultDelta('reset', oldResults, []);\r\n this.invokeCallbacks(instruction, null);\r\n };\r\n /**\r\n * Gets the elements associated with an object and propertyName (if any).\r\n */\r\n ValidationController.prototype.getAssociatedElements = function (_a) {\r\n var object = _a.object, propertyName = _a.propertyName;\r\n var elements = [];\r\n for (var _i = 0, _b = Array.from(this.bindings); _i < _b.length; _i++) {\r\n var _c = _b[_i], binding = _c[0], target = _c[1].target;\r\n var propertyInfo = getPropertyInfo(binding.sourceExpression, binding.source);\r\n if (propertyInfo && propertyInfo.object === object && propertyInfo.propertyName === propertyName) {\r\n elements.push(target);\r\n }\r\n }\r\n return elements;\r\n };\r\n ValidationController.prototype.processResultDelta = function (kind, oldResults, newResults) {\r\n // prepare the instruction.\r\n var instruction = {\r\n kind: kind,\r\n render: [],\r\n unrender: []\r\n };\r\n // create a shallow copy of newResults so we can mutate it without causing side-effects.\r\n newResults = newResults.slice(0);\r\n var _loop_1 = function (oldResult) {\r\n // get the elements associated with the old result.\r\n var elements = this_1.elements.get(oldResult);\r\n // remove the old result from the element map.\r\n this_1.elements.delete(oldResult);\r\n // create the unrender instruction.\r\n instruction.unrender.push({ result: oldResult, elements: elements });\r\n // determine if there's a corresponding new result for the old result we are unrendering.\r\n var newResultIndex = newResults.findIndex(function (x) { return x.rule === oldResult.rule && x.object === oldResult.object && x.propertyName === oldResult.propertyName; });\r\n if (newResultIndex === -1) {\r\n // no corresponding new result... simple remove.\r\n this_1.results.splice(this_1.results.indexOf(oldResult), 1);\r\n if (!oldResult.valid) {\r\n this_1.errors.splice(this_1.errors.indexOf(oldResult), 1);\r\n }\r\n }\r\n else {\r\n // there is a corresponding new result...\r\n var newResult = newResults.splice(newResultIndex, 1)[0];\r\n // get the elements that are associated with the new result.\r\n var elements_1 = this_1.getAssociatedElements(newResult);\r\n this_1.elements.set(newResult, elements_1);\r\n // create a render instruction for the new result.\r\n instruction.render.push({ result: newResult, elements: elements_1 });\r\n // do an in-place replacement of the old result with the new result.\r\n // this ensures any repeats bound to this.results will not thrash.\r\n this_1.results.splice(this_1.results.indexOf(oldResult), 1, newResult);\r\n if (!oldResult.valid && newResult.valid) {\r\n this_1.errors.splice(this_1.errors.indexOf(oldResult), 1);\r\n }\r\n else if (!oldResult.valid && !newResult.valid) {\r\n this_1.errors.splice(this_1.errors.indexOf(oldResult), 1, newResult);\r\n }\r\n else if (!newResult.valid) {\r\n this_1.errors.push(newResult);\r\n }\r\n }\r\n };\r\n var this_1 = this;\r\n // create unrender instructions from the old results.\r\n for (var _i = 0, oldResults_1 = oldResults; _i < oldResults_1.length; _i++) {\r\n var oldResult = oldResults_1[_i];\r\n _loop_1(oldResult);\r\n }\r\n // create render instructions from the remaining new results.\r\n for (var _a = 0, newResults_1 = newResults; _a < newResults_1.length; _a++) {\r\n var result = newResults_1[_a];\r\n var elements = this.getAssociatedElements(result);\r\n instruction.render.push({ result: result, elements: elements });\r\n this.elements.set(result, elements);\r\n this.results.push(result);\r\n if (!result.valid) {\r\n this.errors.push(result);\r\n }\r\n }\r\n // render.\r\n for (var _b = 0, _c = this.renderers; _b < _c.length; _b++) {\r\n var renderer = _c[_b];\r\n renderer.render(instruction);\r\n }\r\n };\r\n /**\r\n * Validates the property associated with a binding.\r\n */\r\n ValidationController.prototype.validateBinding = function (binding) {\r\n if (!binding.isBound) {\r\n return;\r\n }\r\n var propertyInfo = getPropertyInfo(binding.sourceExpression, binding.source);\r\n var rules;\r\n var registeredBinding = this.bindings.get(binding);\r\n if (registeredBinding) {\r\n rules = registeredBinding.rules;\r\n registeredBinding.propertyInfo = propertyInfo;\r\n }\r\n if (!propertyInfo) {\r\n return;\r\n }\r\n var object = propertyInfo.object, propertyName = propertyInfo.propertyName;\r\n this.validate({ object: object, propertyName: propertyName, rules: rules });\r\n };\r\n /**\r\n * Resets the results for a property associated with a binding.\r\n */\r\n ValidationController.prototype.resetBinding = function (binding) {\r\n var registeredBinding = this.bindings.get(binding);\r\n var propertyInfo = getPropertyInfo(binding.sourceExpression, binding.source);\r\n if (!propertyInfo && registeredBinding) {\r\n propertyInfo = registeredBinding.propertyInfo;\r\n }\r\n if (registeredBinding) {\r\n registeredBinding.propertyInfo = null;\r\n }\r\n if (!propertyInfo) {\r\n return;\r\n }\r\n var object = propertyInfo.object, propertyName = propertyInfo.propertyName;\r\n this.reset({ object: object, propertyName: propertyName });\r\n };\r\n /**\r\n * Changes the controller's validateTrigger.\r\n * @param newTrigger The new validateTrigger\r\n */\r\n ValidationController.prototype.changeTrigger = function (newTrigger) {\r\n this.validateTrigger = newTrigger;\r\n var bindings = Array.from(this.bindings.keys());\r\n for (var _i = 0, bindings_1 = bindings; _i < bindings_1.length; _i++) {\r\n var binding = bindings_1[_i];\r\n var source = binding.source;\r\n binding.unbind();\r\n binding.bind(source);\r\n }\r\n };\r\n /**\r\n * Revalidates the controller's current set of errors.\r\n */\r\n ValidationController.prototype.revalidateErrors = function () {\r\n for (var _i = 0, _a = this.errors; _i < _a.length; _i++) {\r\n var _b = _a[_i], object = _b.object, propertyName = _b.propertyName, rule = _b.rule;\r\n if (rule.__manuallyAdded__) {\r\n continue;\r\n }\r\n var rules = [[rule]];\r\n this.validate({ object: object, propertyName: propertyName, rules: rules });\r\n }\r\n };\r\n ValidationController.prototype.invokeCallbacks = function (instruction, result) {\r\n if (this.eventCallbacks.length === 0) {\r\n return;\r\n }\r\n var event = new ValidateEvent(result ? 'validate' : 'reset', this.errors, this.results, instruction || null, result);\r\n for (var i = 0; i < this.eventCallbacks.length; i++) {\r\n this.eventCallbacks[i](event);\r\n }\r\n };\r\n ValidationController.inject = [Validator, PropertyAccessorParser, GlobalValidationConfiguration];\r\n return ValidationController;\r\n}());\n\n// tslint:disable:no-bitwise\r\n/**\r\n * Binding behavior. Indicates the bound property should be validated.\r\n */\r\nvar ValidateBindingBehaviorBase = /** @class */ (function () {\r\n function ValidateBindingBehaviorBase(taskQueue) {\r\n this.taskQueue = taskQueue;\r\n }\r\n ValidateBindingBehaviorBase.prototype.bind = function (binding, source, rulesOrController, rules) {\r\n var _this = this;\r\n // identify the target element.\r\n var target = getTargetDOMElement(binding, source);\r\n // locate the controller.\r\n var controller;\r\n if (rulesOrController instanceof ValidationController) {\r\n controller = rulesOrController;\r\n }\r\n else {\r\n controller = source.container.get(Optional.of(ValidationController));\r\n rules = rulesOrController;\r\n }\r\n if (controller === null) {\r\n throw new Error(\"A ValidationController has not been registered.\");\r\n }\r\n controller.registerBinding(binding, target, rules);\r\n binding.validationController = controller;\r\n var trigger = this.getValidateTrigger(controller);\r\n var event = (trigger & validateTrigger.blur) === validateTrigger.blur ? 'blur'\r\n : (trigger & validateTrigger.focusout) === validateTrigger.focusout ? 'focusout'\r\n : null;\r\n var hasChangeTrigger = (trigger & validateTrigger.change) === validateTrigger.change;\r\n binding.isDirty = !hasChangeTrigger;\r\n // validatedOnce is used to control whether controller should validate upon user input\r\n //\r\n // always true when validation trigger doesn't include \"blur\" event (blur/focusout)\r\n // else it will be set to true after (a) the first user input & loss of focus or (b) validation\r\n binding.validatedOnce = hasChangeTrigger && event === null;\r\n if (hasChangeTrigger) {\r\n binding.vbbUpdateSource = binding.updateSource;\r\n // tslint:disable-next-line:only-arrow-functions\r\n // tslint:disable-next-line:space-before-function-paren\r\n binding.updateSource = function (value) {\r\n this.vbbUpdateSource(value);\r\n this.isDirty = true;\r\n if (this.validatedOnce) {\r\n this.validationController.validateBinding(this);\r\n }\r\n };\r\n }\r\n if (event !== null) {\r\n binding.focusLossHandler = function () {\r\n _this.taskQueue.queueMicroTask(function () {\r\n if (binding.isDirty) {\r\n controller.validateBinding(binding);\r\n binding.validatedOnce = true;\r\n }\r\n });\r\n };\r\n binding.validationTriggerEvent = event;\r\n binding.validateTarget = target;\r\n target.addEventListener(event, binding.focusLossHandler);\r\n if (hasChangeTrigger) {\r\n var propertyName_1 = getPropertyInfo(binding.sourceExpression, binding.source).propertyName;\r\n binding.validationSubscription = controller.subscribe(function (event) {\r\n if (!binding.validatedOnce && event.type === 'validate') {\r\n binding.validatedOnce = event.errors.findIndex(function (e) { return e.propertyName === propertyName_1; }) > -1;\r\n }\r\n });\r\n }\r\n }\r\n if (trigger !== validateTrigger.manual) {\r\n binding.standardUpdateTarget = binding.updateTarget;\r\n // tslint:disable-next-line:only-arrow-functions\r\n // tslint:disable-next-line:space-before-function-paren\r\n binding.updateTarget = function (value) {\r\n this.standardUpdateTarget(value);\r\n this.validationController.resetBinding(this);\r\n };\r\n }\r\n };\r\n ValidateBindingBehaviorBase.prototype.unbind = function (binding) {\r\n // reset the binding to it's original state.\r\n if (binding.vbbUpdateSource) {\r\n binding.updateSource = binding.vbbUpdateSource;\r\n binding.vbbUpdateSource = null;\r\n }\r\n if (binding.standardUpdateTarget) {\r\n binding.updateTarget = binding.standardUpdateTarget;\r\n binding.standardUpdateTarget = null;\r\n }\r\n if (binding.focusLossHandler) {\r\n binding.validateTarget.removeEventListener(binding.validationTriggerEvent, binding.focusLossHandler);\r\n binding.focusLossHandler = null;\r\n binding.validateTarget = null;\r\n }\r\n if (binding.validationSubscription) {\r\n binding.validationSubscription.dispose();\r\n binding.validationSubscription = null;\r\n }\r\n binding.validationController.unregisterBinding(binding);\r\n binding.validationController = null;\r\n binding.isDirty = null;\r\n binding.validatedOnce = null;\r\n };\r\n return ValidateBindingBehaviorBase;\r\n}());\n\n/**\r\n * Binding behavior. Indicates the bound property should be validated\r\n * when the validate trigger specified by the associated controller's\r\n * validateTrigger property occurs.\r\n */\r\nvar ValidateBindingBehavior = /** @class */ (function (_super) {\r\n __extends(ValidateBindingBehavior, _super);\r\n function ValidateBindingBehavior() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n ValidateBindingBehavior.prototype.getValidateTrigger = function (controller) {\r\n return controller.validateTrigger;\r\n };\r\n ValidateBindingBehavior.inject = [TaskQueue];\r\n ValidateBindingBehavior = __decorate([\r\n bindingBehavior('validate')\r\n ], ValidateBindingBehavior);\r\n return ValidateBindingBehavior;\r\n}(ValidateBindingBehaviorBase));\r\n/**\r\n * Binding behavior. Indicates the bound property will be validated\r\n * manually, by calling controller.validate(). No automatic validation\r\n * triggered by data-entry or blur will occur.\r\n */\r\nvar ValidateManuallyBindingBehavior = /** @class */ (function (_super) {\r\n __extends(ValidateManuallyBindingBehavior, _super);\r\n function ValidateManuallyBindingBehavior() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n ValidateManuallyBindingBehavior.prototype.getValidateTrigger = function () {\r\n return validateTrigger.manual;\r\n };\r\n ValidateManuallyBindingBehavior.inject = [TaskQueue];\r\n ValidateManuallyBindingBehavior = __decorate([\r\n bindingBehavior('validateManually')\r\n ], ValidateManuallyBindingBehavior);\r\n return ValidateManuallyBindingBehavior;\r\n}(ValidateBindingBehaviorBase));\r\n/**\r\n * Binding behavior. Indicates the bound property should be validated\r\n * when the associated element blurs.\r\n */\r\nvar ValidateOnBlurBindingBehavior = /** @class */ (function (_super) {\r\n __extends(ValidateOnBlurBindingBehavior, _super);\r\n function ValidateOnBlurBindingBehavior() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n ValidateOnBlurBindingBehavior.prototype.getValidateTrigger = function () {\r\n return validateTrigger.blur;\r\n };\r\n ValidateOnBlurBindingBehavior.inject = [TaskQueue];\r\n ValidateOnBlurBindingBehavior = __decorate([\r\n bindingBehavior('validateOnBlur')\r\n ], ValidateOnBlurBindingBehavior);\r\n return ValidateOnBlurBindingBehavior;\r\n}(ValidateBindingBehaviorBase));\r\n/**\r\n * Binding behavior. Indicates the bound property should be validated\r\n * when the associated element is changed by the user, causing a change\r\n * to the model.\r\n */\r\nvar ValidateOnChangeBindingBehavior = /** @class */ (function (_super) {\r\n __extends(ValidateOnChangeBindingBehavior, _super);\r\n function ValidateOnChangeBindingBehavior() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n ValidateOnChangeBindingBehavior.prototype.getValidateTrigger = function () {\r\n return validateTrigger.change;\r\n };\r\n ValidateOnChangeBindingBehavior.inject = [TaskQueue];\r\n ValidateOnChangeBindingBehavior = __decorate([\r\n bindingBehavior('validateOnChange')\r\n ], ValidateOnChangeBindingBehavior);\r\n return ValidateOnChangeBindingBehavior;\r\n}(ValidateBindingBehaviorBase));\r\n/**\r\n * Binding behavior. Indicates the bound property should be validated\r\n * when the associated element blurs or is changed by the user, causing\r\n * a change to the model.\r\n */\r\nvar ValidateOnChangeOrBlurBindingBehavior = /** @class */ (function (_super) {\r\n __extends(ValidateOnChangeOrBlurBindingBehavior, _super);\r\n function ValidateOnChangeOrBlurBindingBehavior() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n ValidateOnChangeOrBlurBindingBehavior.prototype.getValidateTrigger = function () {\r\n return validateTrigger.changeOrBlur;\r\n };\r\n ValidateOnChangeOrBlurBindingBehavior.inject = [TaskQueue];\r\n ValidateOnChangeOrBlurBindingBehavior = __decorate([\r\n bindingBehavior('validateOnChangeOrBlur')\r\n ], ValidateOnChangeOrBlurBindingBehavior);\r\n return ValidateOnChangeOrBlurBindingBehavior;\r\n}(ValidateBindingBehaviorBase));\r\nvar ValidateOnFocusoutBindingBehavior = /** @class */ (function (_super) {\r\n __extends(ValidateOnFocusoutBindingBehavior, _super);\r\n function ValidateOnFocusoutBindingBehavior() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n ValidateOnFocusoutBindingBehavior.prototype.getValidateTrigger = function () {\r\n return validateTrigger.focusout;\r\n };\r\n ValidateOnFocusoutBindingBehavior.inject = [TaskQueue];\r\n ValidateOnFocusoutBindingBehavior = __decorate([\r\n bindingBehavior('validateOnFocusout')\r\n ], ValidateOnFocusoutBindingBehavior);\r\n return ValidateOnFocusoutBindingBehavior;\r\n}(ValidateBindingBehaviorBase));\r\nvar ValidateOnChangeOrFocusoutBindingBehavior = /** @class */ (function (_super) {\r\n __extends(ValidateOnChangeOrFocusoutBindingBehavior, _super);\r\n function ValidateOnChangeOrFocusoutBindingBehavior() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n ValidateOnChangeOrFocusoutBindingBehavior.prototype.getValidateTrigger = function () {\r\n return validateTrigger.changeOrFocusout;\r\n };\r\n ValidateOnChangeOrFocusoutBindingBehavior.inject = [TaskQueue];\r\n ValidateOnChangeOrFocusoutBindingBehavior = __decorate([\r\n bindingBehavior('validateOnChangeOrFocusout')\r\n ], ValidateOnChangeOrFocusoutBindingBehavior);\r\n return ValidateOnChangeOrFocusoutBindingBehavior;\r\n}(ValidateBindingBehaviorBase));\n\n/**\r\n * Creates ValidationController instances.\r\n */\r\nvar ValidationControllerFactory = /** @class */ (function () {\r\n function ValidationControllerFactory(container) {\r\n this.container = container;\r\n }\r\n ValidationControllerFactory.get = function (container) {\r\n return new ValidationControllerFactory(container);\r\n };\r\n /**\r\n * Creates a new controller instance.\r\n */\r\n ValidationControllerFactory.prototype.create = function (validator) {\r\n if (!validator) {\r\n validator = this.container.get(Validator);\r\n }\r\n var propertyParser = this.container.get(PropertyAccessorParser);\r\n var config = this.container.get(GlobalValidationConfiguration);\r\n return new ValidationController(validator, propertyParser, config);\r\n };\r\n /**\r\n * Creates a new controller and registers it in the current element's container so that it's\r\n * available to the validate binding behavior and renderers.\r\n */\r\n ValidationControllerFactory.prototype.createForCurrentScope = function (validator) {\r\n var controller = this.create(validator);\r\n this.container.registerInstance(ValidationController, controller);\r\n return controller;\r\n };\r\n return ValidationControllerFactory;\r\n}());\r\nValidationControllerFactory['protocol:aurelia:resolver'] = true;\n\nvar ValidationErrorsCustomAttribute = /** @class */ (function () {\r\n function ValidationErrorsCustomAttribute(boundaryElement, controllerAccessor) {\r\n this.boundaryElement = boundaryElement;\r\n this.controllerAccessor = controllerAccessor;\r\n this.controller = null;\r\n this.errors = [];\r\n this.errorsInternal = [];\r\n }\r\n ValidationErrorsCustomAttribute.inject = function () {\r\n return [DOM.Element, Lazy.of(ValidationController)];\r\n };\r\n ValidationErrorsCustomAttribute.prototype.sort = function () {\r\n this.errorsInternal.sort(function (a, b) {\r\n if (a.targets[0] === b.targets[0]) {\r\n return 0;\r\n }\r\n // tslint:disable-next-line:no-bitwise\r\n return a.targets[0].compareDocumentPosition(b.targets[0]) & 2 ? 1 : -1;\r\n });\r\n };\r\n ValidationErrorsCustomAttribute.prototype.interestingElements = function (elements) {\r\n var _this = this;\r\n return elements.filter(function (e) { return _this.boundaryElement.contains(e); });\r\n };\r\n ValidationErrorsCustomAttribute.prototype.render = function (instruction) {\r\n var _loop_1 = function (result) {\r\n var index = this_1.errorsInternal.findIndex(function (x) { return x.error === result; });\r\n if (index !== -1) {\r\n this_1.errorsInternal.splice(index, 1);\r\n }\r\n };\r\n var this_1 = this;\r\n for (var _i = 0, _a = instruction.unrender; _i < _a.length; _i++) {\r\n var result = _a[_i].result;\r\n _loop_1(result);\r\n }\r\n for (var _b = 0, _c = instruction.render; _b < _c.length; _b++) {\r\n var _d = _c[_b], result = _d.result, elements = _d.elements;\r\n if (result.valid) {\r\n continue;\r\n }\r\n var targets = this.interestingElements(elements);\r\n if (targets.length) {\r\n this.errorsInternal.push({ error: result, targets: targets });\r\n }\r\n }\r\n this.sort();\r\n this.errors = this.errorsInternal;\r\n };\r\n ValidationErrorsCustomAttribute.prototype.bind = function () {\r\n if (!this.controller) {\r\n this.controller = this.controllerAccessor();\r\n }\r\n // this will call render() with the side-effect of updating this.errors\r\n this.controller.addRenderer(this);\r\n };\r\n ValidationErrorsCustomAttribute.prototype.unbind = function () {\r\n if (this.controller) {\r\n this.controller.removeRenderer(this);\r\n }\r\n };\r\n __decorate([\r\n bindable({ defaultBindingMode: bindingMode.oneWay })\r\n ], ValidationErrorsCustomAttribute.prototype, \"controller\", void 0);\r\n __decorate([\r\n bindable({ primaryProperty: true, defaultBindingMode: bindingMode.twoWay })\r\n ], ValidationErrorsCustomAttribute.prototype, \"errors\", void 0);\r\n ValidationErrorsCustomAttribute = __decorate([\r\n customAttribute('validation-errors')\r\n ], ValidationErrorsCustomAttribute);\r\n return ValidationErrorsCustomAttribute;\r\n}());\n\nvar ValidationRendererCustomAttribute = /** @class */ (function () {\r\n function ValidationRendererCustomAttribute() {\r\n }\r\n ValidationRendererCustomAttribute.prototype.created = function (view) {\r\n this.container = view.container;\r\n };\r\n ValidationRendererCustomAttribute.prototype.bind = function () {\r\n this.controller = this.container.get(ValidationController);\r\n this.renderer = this.container.get(this.value);\r\n this.controller.addRenderer(this.renderer);\r\n };\r\n ValidationRendererCustomAttribute.prototype.unbind = function () {\r\n this.controller.removeRenderer(this.renderer);\r\n this.controller = null;\r\n this.renderer = null;\r\n };\r\n ValidationRendererCustomAttribute = __decorate([\r\n customAttribute('validation-renderer')\r\n ], ValidationRendererCustomAttribute);\r\n return ValidationRendererCustomAttribute;\r\n}());\n\n/**\r\n * Part of the fluent rule API. Enables customizing property rules.\r\n */\r\nvar FluentRuleCustomizer = /** @class */ (function () {\r\n function FluentRuleCustomizer(property, condition, config, fluentEnsure, fluentRules, parsers) {\r\n if (config === void 0) { config = {}; }\r\n this.fluentEnsure = fluentEnsure;\r\n this.fluentRules = fluentRules;\r\n this.parsers = parsers;\r\n this.rule = {\r\n property: property,\r\n condition: condition,\r\n config: config,\r\n when: null,\r\n messageKey: 'default',\r\n message: null,\r\n sequence: fluentRules.sequence\r\n };\r\n this.fluentEnsure._addRule(this.rule);\r\n }\r\n /**\r\n * Validate subsequent rules after previously declared rules have\r\n * been validated successfully. Use to postpone validation of costly\r\n * rules until less expensive rules pass validation.\r\n */\r\n FluentRuleCustomizer.prototype.then = function () {\r\n this.fluentRules.sequence++;\r\n return this;\r\n };\r\n /**\r\n * Specifies the key to use when looking up the rule's validation message.\r\n */\r\n FluentRuleCustomizer.prototype.withMessageKey = function (key) {\r\n this.rule.messageKey = key;\r\n this.rule.message = null;\r\n return this;\r\n };\r\n /**\r\n * Specifies rule's validation message.\r\n */\r\n FluentRuleCustomizer.prototype.withMessage = function (message) {\r\n this.rule.messageKey = 'custom';\r\n this.rule.message = this.parsers.message.parse(message);\r\n return this;\r\n };\r\n /**\r\n * Specifies a condition that must be met before attempting to validate the rule.\r\n * @param condition A function that accepts the object as a parameter and returns true\r\n * or false whether the rule should be evaluated.\r\n */\r\n FluentRuleCustomizer.prototype.when = function (condition) {\r\n this.rule.when = condition;\r\n return this;\r\n };\r\n /**\r\n * Tags the rule instance, enabling the rule to be found easily\r\n * using ValidationRules.taggedRules(rules, tag)\r\n */\r\n FluentRuleCustomizer.prototype.tag = function (tag) {\r\n this.rule.tag = tag;\r\n return this;\r\n };\r\n ///// FluentEnsure APIs /////\r\n /**\r\n * Target a property with validation rules.\r\n * @param property The property to target. Can be the property name or a property accessor function.\r\n */\r\n FluentRuleCustomizer.prototype.ensure = function (subject) {\r\n return this.fluentEnsure.ensure(subject);\r\n };\r\n /**\r\n * Targets an object with validation rules.\r\n */\r\n FluentRuleCustomizer.prototype.ensureObject = function () {\r\n return this.fluentEnsure.ensureObject();\r\n };\r\n Object.defineProperty(FluentRuleCustomizer.prototype, \"rules\", {\r\n /**\r\n * Rules that have been defined using the fluent API.\r\n */\r\n get: function () {\r\n return this.fluentEnsure.rules;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Applies the rules to a class or object, making them discoverable by the StandardValidator.\r\n * @param target A class or object.\r\n */\r\n FluentRuleCustomizer.prototype.on = function (target) {\r\n return this.fluentEnsure.on(target);\r\n };\r\n ///////// FluentRules APIs /////////\r\n /**\r\n * Applies an ad-hoc rule function to the ensured property or object.\r\n * @param condition The function to validate the rule.\r\n * Will be called with two arguments, the property value and the object.\r\n * Should return a boolean or a Promise that resolves to a boolean.\r\n */\r\n FluentRuleCustomizer.prototype.satisfies = function (condition, config) {\r\n return this.fluentRules.satisfies(condition, config);\r\n };\r\n /**\r\n * Applies a rule by name.\r\n * @param name The name of the custom or standard rule.\r\n * @param args The rule's arguments.\r\n */\r\n FluentRuleCustomizer.prototype.satisfiesRule = function (name) {\r\n var _a;\r\n var args = [];\r\n for (var _i = 1; _i < arguments.length; _i++) {\r\n args[_i - 1] = arguments[_i];\r\n }\r\n return (_a = this.fluentRules).satisfiesRule.apply(_a, __spreadArrays([name], args));\r\n };\r\n /**\r\n * Applies the \"required\" rule to the property.\r\n * The value cannot be null, undefined or whitespace.\r\n */\r\n FluentRuleCustomizer.prototype.required = function () {\r\n return this.fluentRules.required();\r\n };\r\n /**\r\n * Applies the \"matches\" rule to the property.\r\n * Value must match the specified regular expression.\r\n * null, undefined and empty-string values are considered valid.\r\n */\r\n FluentRuleCustomizer.prototype.matches = function (regex) {\r\n return this.fluentRules.matches(regex);\r\n };\r\n /**\r\n * Applies the \"email\" rule to the property.\r\n * null, undefined and empty-string values are considered valid.\r\n */\r\n FluentRuleCustomizer.prototype.email = function () {\r\n return this.fluentRules.email();\r\n };\r\n /**\r\n * Applies the \"minLength\" STRING validation rule to the property.\r\n * null, undefined and empty-string values are considered valid.\r\n */\r\n FluentRuleCustomizer.prototype.minLength = function (length) {\r\n return this.fluentRules.minLength(length);\r\n };\r\n /**\r\n * Applies the \"maxLength\" STRING validation rule to the property.\r\n * null, undefined and empty-string values are considered valid.\r\n */\r\n FluentRuleCustomizer.prototype.maxLength = function (length) {\r\n return this.fluentRules.maxLength(length);\r\n };\r\n /**\r\n * Applies the \"minItems\" ARRAY validation rule to the property.\r\n * null and undefined values are considered valid.\r\n */\r\n FluentRuleCustomizer.prototype.minItems = function (count) {\r\n return this.fluentRules.minItems(count);\r\n };\r\n /**\r\n * Applies the \"maxItems\" ARRAY validation rule to the property.\r\n * null and undefined values are considered valid.\r\n */\r\n FluentRuleCustomizer.prototype.maxItems = function (count) {\r\n return this.fluentRules.maxItems(count);\r\n };\r\n /**\r\n * Applies the \"min\" NUMBER validation rule to the property.\r\n * Value must be greater than or equal to the specified constraint.\r\n * null and undefined values are considered valid.\r\n */\r\n FluentRuleCustomizer.prototype.min = function (value) {\r\n return this.fluentRules.min(value);\r\n };\r\n /**\r\n * Applies the \"max\" NUMBER validation rule to the property.\r\n * Value must be less than or equal to the specified constraint.\r\n * null and undefined values are considered valid.\r\n */\r\n FluentRuleCustomizer.prototype.max = function (value) {\r\n return this.fluentRules.max(value);\r\n };\r\n /**\r\n * Applies the \"range\" NUMBER validation rule to the property.\r\n * Value must be between or equal to the specified min and max.\r\n * null and undefined values are considered valid.\r\n */\r\n FluentRuleCustomizer.prototype.range = function (min, max) {\r\n return this.fluentRules.range(min, max);\r\n };\r\n /**\r\n * Applies the \"between\" NUMBER validation rule to the property.\r\n * Value must be between but not equal to the specified min and max.\r\n * null and undefined values are considered valid.\r\n */\r\n FluentRuleCustomizer.prototype.between = function (min, max) {\r\n return this.fluentRules.between(min, max);\r\n };\r\n /**\r\n * Applies the \"equals\" validation rule to the property.\r\n * null, undefined and empty-string values are considered valid.\r\n */\r\n FluentRuleCustomizer.prototype.equals = function (expectedValue) {\r\n return this.fluentRules.equals(expectedValue);\r\n };\r\n return FluentRuleCustomizer;\r\n}());\r\n/**\r\n * Part of the fluent rule API. Enables applying rules to properties and objects.\r\n */\r\nvar FluentRules = /** @class */ (function () {\r\n function FluentRules(fluentEnsure, parsers, property) {\r\n this.fluentEnsure = fluentEnsure;\r\n this.parsers = parsers;\r\n this.property = property;\r\n /**\r\n * Current rule sequence number. Used to postpone evaluation of rules until rules\r\n * with lower sequence number have successfully validated. The \"then\" fluent API method\r\n * manages this property, there's usually no need to set it directly.\r\n */\r\n this.sequence = 0;\r\n }\r\n /**\r\n * Sets the display name of the ensured property.\r\n */\r\n FluentRules.prototype.displayName = function (name) {\r\n this.property.displayName = name;\r\n return this;\r\n };\r\n /**\r\n * Applies an ad-hoc rule function to the ensured property or object.\r\n * @param condition The function to validate the rule.\r\n * Will be called with two arguments, the property value and the object.\r\n * Should return a boolean or a Promise that resolves to a boolean.\r\n */\r\n FluentRules.prototype.satisfies = function (condition, config) {\r\n return new FluentRuleCustomizer(this.property, condition, config, this.fluentEnsure, this, this.parsers);\r\n };\r\n /**\r\n * Applies a rule by name.\r\n * @param name The name of the custom or standard rule.\r\n * @param args The rule's arguments.\r\n */\r\n FluentRules.prototype.satisfiesRule = function (name) {\r\n var _this = this;\r\n var args = [];\r\n for (var _i = 1; _i < arguments.length; _i++) {\r\n args[_i - 1] = arguments[_i];\r\n }\r\n var rule = FluentRules.customRules[name];\r\n if (!rule) {\r\n // standard rule?\r\n rule = this[name];\r\n if (rule instanceof Function) {\r\n return rule.call.apply(rule, __spreadArrays([this], args));\r\n }\r\n throw new Error(\"Rule with name \\\"\" + name + \"\\\" does not exist.\");\r\n }\r\n var config = rule.argsToConfig ? rule.argsToConfig.apply(rule, args) : undefined;\r\n return this.satisfies(function (value, obj) {\r\n var _a;\r\n return (_a = rule.condition).call.apply(_a, __spreadArrays([_this, value, obj], args));\r\n }, config)\r\n .withMessageKey(name);\r\n };\r\n /**\r\n * Applies the \"required\" rule to the property.\r\n * The value cannot be null, undefined or whitespace.\r\n */\r\n FluentRules.prototype.required = function () {\r\n return this.satisfies(function (value) {\r\n return value !== null\r\n && value !== undefined\r\n && !(isString(value) && !/\\S/.test(value));\r\n }).withMessageKey('required');\r\n };\r\n /**\r\n * Applies the \"matches\" rule to the property.\r\n * Value must match the specified regular expression.\r\n * null, undefined and empty-string values are considered valid.\r\n */\r\n FluentRules.prototype.matches = function (regex) {\r\n return this.satisfies(function (value) { return value === null || value === undefined || value.length === 0 || regex.test(value); })\r\n .withMessageKey('matches');\r\n };\r\n /**\r\n * Applies the \"email\" rule to the property.\r\n * null, undefined and empty-string values are considered valid.\r\n */\r\n FluentRules.prototype.email = function () {\r\n // regex from https://html.spec.whatwg.org/multipage/forms.html#valid-e-mail-address\r\n /* tslint:disable:max-line-length */\r\n return this.matches(/^[a-zA-Z0-9.!#$%&'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/)\r\n /* tslint:enable:max-line-length */\r\n .withMessageKey('email');\r\n };\r\n /**\r\n * Applies the \"minLength\" STRING validation rule to the property.\r\n * null, undefined and empty-string values are considered valid.\r\n */\r\n FluentRules.prototype.minLength = function (length) {\r\n return this.satisfies(function (value) { return value === null || value === undefined || value.length === 0 || value.length >= length; }, { length: length })\r\n .withMessageKey('minLength');\r\n };\r\n /**\r\n * Applies the \"maxLength\" STRING validation rule to the property.\r\n * null, undefined and empty-string values are considered valid.\r\n */\r\n FluentRules.prototype.maxLength = function (length) {\r\n return this.satisfies(function (value) { return value === null || value === undefined || value.length === 0 || value.length <= length; }, { length: length })\r\n .withMessageKey('maxLength');\r\n };\r\n /**\r\n * Applies the \"minItems\" ARRAY validation rule to the property.\r\n * null and undefined values are considered valid.\r\n */\r\n FluentRules.prototype.minItems = function (count) {\r\n return this.satisfies(function (value) { return value === null || value === undefined || value.length >= count; }, { count: count })\r\n .withMessageKey('minItems');\r\n };\r\n /**\r\n * Applies the \"maxItems\" ARRAY validation rule to the property.\r\n * null and undefined values are considered valid.\r\n */\r\n FluentRules.prototype.maxItems = function (count) {\r\n return this.satisfies(function (value) { return value === null || value === undefined || value.length <= count; }, { count: count })\r\n .withMessageKey('maxItems');\r\n };\r\n /**\r\n * Applies the \"min\" NUMBER validation rule to the property.\r\n * Value must be greater than or equal to the specified constraint.\r\n * null and undefined values are considered valid.\r\n */\r\n FluentRules.prototype.min = function (constraint) {\r\n return this.satisfies(function (value) { return value === null || value === undefined || value >= constraint; }, { constraint: constraint })\r\n .withMessageKey('min');\r\n };\r\n /**\r\n * Applies the \"max\" NUMBER validation rule to the property.\r\n * Value must be less than or equal to the specified constraint.\r\n * null and undefined values are considered valid.\r\n */\r\n FluentRules.prototype.max = function (constraint) {\r\n return this.satisfies(function (value) { return value === null || value === undefined || value <= constraint; }, { constraint: constraint })\r\n .withMessageKey('max');\r\n };\r\n /**\r\n * Applies the \"range\" NUMBER validation rule to the property.\r\n * Value must be between or equal to the specified min and max.\r\n * null and undefined values are considered valid.\r\n */\r\n FluentRules.prototype.range = function (min, max) {\r\n return this.satisfies(function (value) { return value === null || value === undefined || (value >= min && value <= max); }, { min: min, max: max })\r\n .withMessageKey('range');\r\n };\r\n /**\r\n * Applies the \"between\" NUMBER validation rule to the property.\r\n * Value must be between but not equal to the specified min and max.\r\n * null and undefined values are considered valid.\r\n */\r\n FluentRules.prototype.between = function (min, max) {\r\n return this.satisfies(function (value) { return value === null || value === undefined || (value > min && value < max); }, { min: min, max: max })\r\n .withMessageKey('between');\r\n };\r\n /**\r\n * Applies the \"equals\" validation rule to the property.\r\n * null and undefined values are considered valid.\r\n */\r\n FluentRules.prototype.equals = function (expectedValue) {\r\n return this.satisfies(function (value) { return value === null || value === undefined || value === '' || value === expectedValue; }, { expectedValue: expectedValue })\r\n .withMessageKey('equals');\r\n };\r\n FluentRules.customRules = {};\r\n return FluentRules;\r\n}());\r\n/**\r\n * Part of the fluent rule API. Enables targeting properties and objects with rules.\r\n */\r\nvar FluentEnsure = /** @class */ (function () {\r\n function FluentEnsure(parsers) {\r\n this.parsers = parsers;\r\n /**\r\n * Rules that have been defined using the fluent API.\r\n */\r\n this.rules = [];\r\n }\r\n /**\r\n * Target a property with validation rules.\r\n * @param property The property to target. Can be the property name or a property accessor\r\n * function.\r\n */\r\n FluentEnsure.prototype.ensure = function (property) {\r\n this.assertInitialized();\r\n var name = this.parsers.property.parse(property);\r\n var fluentRules = new FluentRules(this, this.parsers, { name: name, displayName: null });\r\n return this.mergeRules(fluentRules, name);\r\n };\r\n /**\r\n * Targets an object with validation rules.\r\n */\r\n FluentEnsure.prototype.ensureObject = function () {\r\n this.assertInitialized();\r\n var fluentRules = new FluentRules(this, this.parsers, { name: null, displayName: null });\r\n return this.mergeRules(fluentRules, null);\r\n };\r\n /**\r\n * Applies the rules to a class or object, making them discoverable by the StandardValidator.\r\n * @param target A class or object.\r\n */\r\n FluentEnsure.prototype.on = function (target) {\r\n Rules.set(target, this.rules);\r\n return this;\r\n };\r\n /**\r\n * Adds a rule definition to the sequenced ruleset.\r\n * @internal\r\n */\r\n FluentEnsure.prototype._addRule = function (rule) {\r\n while (this.rules.length < rule.sequence + 1) {\r\n this.rules.push([]);\r\n }\r\n this.rules[rule.sequence].push(rule);\r\n };\r\n FluentEnsure.prototype.assertInitialized = function () {\r\n if (this.parsers) {\r\n return;\r\n }\r\n throw new Error(\"Did you forget to add \\\".plugin('aurelia-validation')\\\" to your main.js?\");\r\n };\r\n FluentEnsure.prototype.mergeRules = function (fluentRules, propertyName) {\r\n // tslint:disable-next-line:triple-equals | Use loose equality for property keys\r\n var existingRules = this.rules.find(function (r) { return r.length > 0 && r[0].property.name == propertyName; });\r\n if (existingRules) {\r\n var rule = existingRules[existingRules.length - 1];\r\n fluentRules.sequence = rule.sequence;\r\n if (rule.property.displayName !== null) {\r\n fluentRules = fluentRules.displayName(rule.property.displayName);\r\n }\r\n }\r\n return fluentRules;\r\n };\r\n return FluentEnsure;\r\n}());\r\n/**\r\n * Fluent rule definition API.\r\n */\r\nvar ValidationRules = /** @class */ (function () {\r\n function ValidationRules() {\r\n }\r\n ValidationRules.initialize = function (messageParser, propertyParser) {\r\n this.parsers = {\r\n message: messageParser,\r\n property: propertyParser\r\n };\r\n };\r\n /**\r\n * Target a property with validation rules.\r\n * @param property The property to target. Can be the property name or a property accessor function.\r\n */\r\n ValidationRules.ensure = function (property) {\r\n return new FluentEnsure(ValidationRules.parsers).ensure(property);\r\n };\r\n /**\r\n * Targets an object with validation rules.\r\n */\r\n ValidationRules.ensureObject = function () {\r\n return new FluentEnsure(ValidationRules.parsers).ensureObject();\r\n };\r\n /**\r\n * Defines a custom rule.\r\n * @param name The name of the custom rule. Also serves as the message key.\r\n * @param condition The rule function.\r\n * @param message The message expression\r\n * @param argsToConfig A function that maps the rule's arguments to a \"config\"\r\n * object that can be used when evaluating the message expression.\r\n */\r\n ValidationRules.customRule = function (name, condition, message, argsToConfig) {\r\n validationMessages[name] = message;\r\n FluentRules.customRules[name] = { condition: condition, argsToConfig: argsToConfig };\r\n };\r\n /**\r\n * Returns rules with the matching tag.\r\n * @param rules The rules to search.\r\n * @param tag The tag to search for.\r\n */\r\n ValidationRules.taggedRules = function (rules, tag) {\r\n return rules.map(function (x) { return x.filter(function (r) { return r.tag === tag; }); });\r\n };\r\n /**\r\n * Returns rules that have no tag.\r\n * @param rules The rules to search.\r\n */\r\n ValidationRules.untaggedRules = function (rules) {\r\n return rules.map(function (x) { return x.filter(function (r) { return r.tag === undefined; }); });\r\n };\r\n /**\r\n * Removes the rules from a class or object.\r\n * @param target A class or object.\r\n */\r\n ValidationRules.off = function (target) {\r\n Rules.unset(target);\r\n };\r\n return ValidationRules;\r\n}());\n\n// Exports\r\n/**\r\n * Configures the plugin.\r\n */\r\nfunction configure(\r\n// tslint:disable-next-line:ban-types\r\nframeworkConfig, callback) {\r\n // the fluent rule definition API needs the parser to translate messages\r\n // to interpolation expressions.\r\n var messageParser = frameworkConfig.container.get(ValidationMessageParser);\r\n var propertyParser = frameworkConfig.container.get(PropertyAccessorParser);\r\n ValidationRules.initialize(messageParser, propertyParser);\r\n // configure...\r\n var config = new GlobalValidationConfiguration();\r\n if (callback instanceof Function) {\r\n callback(config);\r\n }\r\n config.apply(frameworkConfig.container);\r\n // globalize the behaviors.\r\n if (frameworkConfig.globalResources) {\r\n frameworkConfig.globalResources(ValidateBindingBehavior, ValidateManuallyBindingBehavior, ValidateOnBlurBindingBehavior, ValidateOnFocusoutBindingBehavior, ValidateOnChangeBindingBehavior, ValidateOnChangeOrBlurBindingBehavior, ValidateOnChangeOrFocusoutBindingBehavior, ValidationErrorsCustomAttribute, ValidationRendererCustomAttribute);\r\n }\r\n}\n\nexport { configure, GlobalValidationConfiguration, getTargetDOMElement, getPropertyInfo, PropertyAccessorParser, getAccessorExpression, ValidateBindingBehavior, ValidateManuallyBindingBehavior, ValidateOnBlurBindingBehavior, ValidateOnChangeBindingBehavior, ValidateOnChangeOrBlurBindingBehavior, ValidateOnFocusoutBindingBehavior, ValidateOnChangeOrFocusoutBindingBehavior, ValidateEvent, ValidateResult, validateTrigger, ValidationController, ValidationControllerFactory, ValidationErrorsCustomAttribute, ValidationRendererCustomAttribute, Validator, Rules, StandardValidator, validationMessages, ValidationMessageProvider, ValidationMessageParser, MessageExpressionValidator, FluentRuleCustomizer, FluentRules, FluentEnsure, ValidationRules };\n","// This file contains an empty module that does nothing.\r\n// It's meant to be added as an entry point to the main bundle\r\n// and helps reliably adding some Aurelia dependencies that are attached \r\n// to no module in particular, such as `includeAll` results or `aureliaApp`.\r\n//\r\n// Trying to attach those dependencies to, for example, 'aurelia-bootstrapper' \r\n// is unreliable if 'aurelia-bootstrapper' is in a DLL outside the bundle.\r\n//\r\n// Trying to attach to 'aurelia-loader-webpack' works well, unless a user\r\n// configures a customized loader instead (unlikely, but in theory supported).\r\n","// With default aurelia-loader-webpack config, this module is added as an extra entry\r\n// before any other code executes so that PAL.Loader is properly configured.\r\n// There are several tricky points worth noticing.\r\n// \r\n// We don't add aurelia-loader-webpack itself as an entry point (used to until 2.0 RC2)\r\n// because it (transitively) brings too much bagage with itself, most notably polyfills.\r\n// This made it super-hard to add other polyfills before Aurelia's and led to various bugs.\r\n//\r\n// We don't add custom code in aurelia-pal or aurelia-loader or aurelia-bootstrapper to detect\r\n// the Webpack environment and configure the loader because they might live in a DLL.\r\n// If they do, they would bring aurelia-loader-webpack along in the DLL and this is a special \r\n// library that *has to be in the main chunk.*\r\n//\r\n// The over-complicated design I've settled upon in the end is to use this special module\r\n// as an entry point that configures aurelia-loader-webpack. It has minimal static imports:\r\n// just aurelia-pal, which itself has no other dependencies and doesn't run much code.\r\n// It hacks the loader field into a getter so that it can synchronously load aurelia-loader-webpack\r\n// just in time when it is demanded by aurelia-bootstrapper.\r\n// This enables users to load polyfills before aurelia-loader-webpack is actually loaded.\r\n\r\nimport { PLATFORM } from \"aurelia-pal\";\r\n\r\nvar Loader;\r\n\r\nObject.defineProperty(PLATFORM, \"Loader\", {\r\n get: function() {\r\n return Loader || (Loader = require(\"aurelia-loader-webpack\").WebpackLoader);\r\n },\r\n set: function(value) {\r\n Loader = value;\r\n }\r\n});\r\n"],"names":[],"sourceRoot":""}