@bpost/bp-address-auto-complete-by-component 1.0.25 → 1.0.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/VERSION.md +17 -0
- package/bpost-bp-address-auto-complete-by-component.metadata.json +1 -1
- package/bundles/bpost-bp-address-auto-complete-by-component.umd.js +56 -8
- package/bundles/bpost-bp-address-auto-complete-by-component.umd.js.map +1 -1
- package/bundles/bpost-bp-address-auto-complete-by-component.umd.min.js +1 -1
- package/bundles/bpost-bp-address-auto-complete-by-component.umd.min.js.map +1 -1
- package/esm2015/lib/lib-address-autocomplete-by-component.component.js +21 -6
- package/esm2015/lib/locality/locality.component.js +21 -3
- package/esm2015/lib/model/query-parameters.model.js +2 -2
- package/esm2015/lib/services/adress.service.js +2 -1
- package/esm2015/lib/services/http.service.js +15 -2
- package/esm2015/lib/utils/prefill-data.js +3 -1
- package/esm5/lib/lib-address-autocomplete-by-component.component.js +21 -6
- package/esm5/lib/locality/locality.component.js +21 -3
- package/esm5/lib/model/query-parameters.model.js +2 -2
- package/esm5/lib/services/adress.service.js +2 -1
- package/esm5/lib/services/http.service.js +16 -3
- package/esm5/lib/utils/prefill-data.js +3 -1
- package/fesm2015/bpost-bp-address-auto-complete-by-component.js +57 -9
- package/fesm2015/bpost-bp-address-auto-complete-by-component.js.map +1 -1
- package/fesm5/bpost-bp-address-auto-complete-by-component.js +58 -10
- package/fesm5/bpost-bp-address-auto-complete-by-component.js.map +1 -1
- package/lib/lib-address-autocomplete-by-component.component.d.ts +5 -1
- package/lib/model/query-parameters.model.d.ts +1 -1
- package/lib/services/adress.service.d.ts +1 -0
- package/lib/services/http.service.d.ts +4 -1
- package/lib/utils/prefill-data.d.ts +1 -0
- package/package.json +1 -1
|
@@ -12,5 +12,5 @@
|
|
|
12
12
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
13
13
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
14
|
PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
-
***************************************************************************** */var p=function(){return(p=Object.assign||function(e){for(var t,s=1,i=arguments.length;s<i;s++)for(var r in t=arguments[s])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};function h(e,t,s,i){var r,o=arguments.length,n=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,s,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(n=(o<3?r(n):o>3?r(t,s,n):r(t,s))||n);return o>3&&n&&Object.defineProperty(t,s,n),n}function u(e){var t="function"==typeof Symbol&&Symbol.iterator,s=t&&e[t],i=0;if(s)return s.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}var c,d,g,m=function(){function e(){}return e.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e},token:e,providedIn:"root"}),e=h([t.Injectable({providedIn:"root"})],e)}();(c=e.ValidationMessageOptionType||(e.ValidationMessageOptionType={})).EMIT="EMIT",c.SHOW="SHOW",(d=e.ValidationMessageType||(e.ValidationMessageType={})).Address_Not_Found="address-not-found",d.Address_Validated="address-validated",d.Service_Unavailable="service-unavailable",(g=e.ADDRESSLEVEL||(e.ADDRESSLEVEL={}))[g.BOX_NUMBER=1]="BOX_NUMBER",g[g.STREET_NUMBER=2]="STREET_NUMBER",g[g.STREET=3]="STREET",g[g.LOCALITY=4]="LOCALITY";var f,y=function(){function e(e){Object.assign(this,e)}return e.prototype.sortByPostalCode=function(e){this.sortByPostalCodeLocalityName=e},e.prototype.sortByLocalityname=function(e){this.sortByLocalityNamePostalCode=e},e.prototype.sortByStreet=function(e){this.sortByStreetName=e},e.prototype.sortByStreetNb=function(e){this.sortByStreetNumber=e},e.prototype.sortByBox=function(e){this.sortbyBoxNumber=e},e}(),b=function(){function e(e){this.httpClient=e,this.openConnections=0}return e.prototype.get=function(e,t){return this.request("GET",e,t)},e.prototype.request=function(e,t,i){var r=this;return i=i||{},this.openConnections++,this.httpClient.request(e,t,i).pipe(s.map((function(e){return r.handleResponse(e)})),s.catchError((function(e){return r.handleError(e)})))},e.prototype.handleResponse=function(e){return this.openConnections--,e},e.prototype.handleError=function(e){return this.openConnections--,i.throwError(e)},e.ctorParameters=function(){return[{type:r.HttpClient}]},e.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e(t.ɵɵinject(r.HttpClient))},token:e,providedIn:"root"}),e=h([t.Injectable({providedIn:"root"})],e)}(),S=function(e){var t=this;this.sequenceNumber=e.sequenceNumber,e.topSuggestions&&e.topSuggestions.length>0&&(this.topSuggestions=[],e.topSuggestions.forEach((function(e){t.topSuggestions.push(new v(e))})))},v=function(e){this.address=e.address?new C(e.address):null},C=function(e){this.municipalityId=e.municipalityId,this.subMunicipalityId=e.subMunicipalityId,this.detectedLanguage=e.detectedLanguage,this.geoSanction=e.geoSanction,this.searchBarString=e.searchBarString,this.string=e.string,this.municipalityName=e.municipalityName,this.localityName=e.localityName,this.postalCode=e.postalCode},x=function(e){var t=this;this.sequenceNumber=e.sequenceNumber,e.topSuggestions&&e.topSuggestions.length>0&&(this.topSuggestions=[],e.topSuggestions.forEach((function(e){t.topSuggestions.push(new E(e))})))},E=function(e){this.address=e.address?new N(e.address):null},N=function(e){this.municipalityId=e.municipalityId,this.subMunicipalityId=e.subMunicipalityId,this.detectedLanguage=e.detectedLanguage,this.geoSanction=e.geoSanction,this.searchBarString=e.searchBarString,this.string=e.string,this.municipalityName=e.municipalityName,this.localityName=e.localityName,this.postalCode=e.postalCode},I=function(e){var t=this;this.sequenceNumber=e.sequenceNumber,e.topSuggestions&&e.topSuggestions.length>0&&(this.topSuggestions=[],e.topSuggestions.forEach((function(e){t.topSuggestions.push(new w(e))})))},w=function(e){this.address=e.address?new T(e.address):null},T=function(e){this.municipalityId=e.municipalityId,this.subMunicipalityId=e.subMunicipalityId,this.detectedLanguage=e.detectedLanguage,this.geoSanction=e.geoSanction,this.searchBarString=e.searchBarString,this.string=e.string,this.municipalityName=e.municipalityName,this.localityName=e.localityName,this.postalCode=e.postalCode},L=function(){function e(e){this.httpService=e,this.domain="http://10.194.73.9:8080",this.localityURL=this.domain+"/AddressAutoComplete/autocomplete/locality?IncludeGeographicalSanction=true"}return e.prototype.getLocality=function(e,t){var i=this,r=""!==e?e:this.localityURL,o={params:t};return this.httpService.get(r,o).pipe(s.tap((function(e){return i.handleGetLocality(e)})),s.catchError((function(e){return i.handleError(e)})))},e.prototype.handleGetLocality=function(e){return new S(e.response)},e.prototype.getStreet=function(e,t,i,r){var o=this,n=e,a={params:r};return n=(n=n.replace("$postalCode",i)).replace("$localityName",t),this.httpService.get(n,a).pipe(s.tap((function(e){return o.handleGetStreet(e)})),s.catchError((function(e){return o.handleError(e)})))},e.prototype.handleGetStreet=function(e){return new x(e.response)},e.prototype.getBox=function(e,t,i,r){var o=this,n=e,a={params:r};return n=(n=n.replace("$postalCode",i)).replace("$localityName",t),this.httpService.get(n,a).pipe(s.tap((function(e){return o.handleGetBox(e)})),s.catchError((function(e){return o.handleError(e)})))},e.prototype.handleGetBox=function(e){return new I(e.response)},e.prototype.handleError=function(e){return i.throwError(e)},e.ctorParameters=function(){return[{type:b}]},e.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e(t.ɵɵinject(b))},token:e,providedIn:"root"}),e=h([t.Injectable({providedIn:"root"})],e)}(),D=function(){function e(){this.inputLanguageEvent=new i.BehaviorSubject(void 0),this.currentLang=this.inputLanguageEvent.asObservable()}return e.prototype.changeLang=function(e){this.inputLanguageEvent.next(e)},e.prototype.isLocaleDutch=function(){return this.isPreferredLocale("nl")},e.prototype.isLocaleFrench=function(){return this.isPreferredLocale("fr")},e.prototype.isLocaleGerman=function(){return this.isPreferredLocale("de")},e.prototype.isPreferredLocale=function(e){return 0===(this.inputLanguageEvent.getValue()||window.navigator.userSelectedLanguage||window.navigator.userLanguage||window.navigator.language).indexOf(e)},e.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e},token:e,providedIn:"root"}),e=h([t.Injectable({providedIn:"root"})],e)}(),M=[{base:"A",letters:"AⒶAÀÁÂẦẤẪẨÃĀĂẰẮẴẲȦǠÄǞẢÅǺǍȀȂẠẬẶḀĄȺⱯ"},{base:"AA",letters:"Ꜳ"},{base:"AE",letters:"ÆǼǢ"},{base:"AO",letters:"Ꜵ"},{base:"AU",letters:"Ꜷ"},{base:"AV",letters:"ꜸꜺ"},{base:"AY",letters:"Ꜽ"},{base:"B",letters:"BⒷBḂḄḆɃƂƁ"},{base:"C",letters:"CⒸCĆĈĊČÇḈƇȻꜾ"},{base:"D",letters:"DⒹDḊĎḌḐḒḎĐƋƊƉꝹ"},{base:"DZ",letters:"DZDŽ"},{base:"Dz",letters:"DzDž"},{base:"E",letters:"EⒺEÈÉÊỀẾỄỂẼĒḔḖĔĖËẺĚȄȆẸỆȨḜĘḘḚƐƎ"},{base:"F",letters:"FⒻFḞƑꝻ"},{base:"G",letters:"GⒼGǴĜḠĞĠǦĢǤƓꞠꝽꝾ"},{base:"H",letters:"HⒽHĤḢḦȞḤḨḪĦⱧⱵꞍ"},{base:"I",letters:"IⒾIÌÍÎĨĪĬİÏḮỈǏȈȊỊĮḬƗ"},{base:"J",letters:"JⒿJĴɈ"},{base:"K",letters:"KⓀKḰǨḲĶḴƘⱩꝀꝂꝄꞢ"},{base:"L",letters:"LⓁLĿĹĽḶḸĻḼḺŁȽⱢⱠꝈꝆꞀ"},{base:"LJ",letters:"LJ"},{base:"Lj",letters:"Lj"},{base:"M",letters:"MⓂMḾṀṂⱮƜ"},{base:"N",letters:"NⓃNǸŃÑṄŇṆŅṊṈȠƝꞐꞤ"},{base:"NJ",letters:"NJ"},{base:"Nj",letters:"Nj"},{base:"O",letters:"OⓄOÒÓÔỒỐỖỔÕṌȬṎŌṐṒŎȮȰÖȪỎŐǑȌȎƠỜỚỠỞỢỌỘǪǬØǾƆƟꝊꝌ"},{base:"OI",letters:"Ƣ"},{base:"OO",letters:"Ꝏ"},{base:"OU",letters:"Ȣ"},{base:"OE",letters:"Œ"},{base:"oe",letters:"œ"},{base:"P",letters:"PⓅPṔṖƤⱣꝐꝒꝔ"},{base:"Q",letters:"QⓆQꝖꝘɊ"},{base:"R",letters:"RⓇRŔṘŘȐȒṚṜŖṞɌⱤꝚꞦꞂ"},{base:"S",letters:"SⓈSẞŚṤŜṠŠṦṢṨȘŞⱾꞨꞄ"},{base:"T",letters:"TⓉTṪŤṬȚŢṰṮŦƬƮȾꞆ"},{base:"TZ",letters:"Ꜩ"},{base:"U",letters:"UⓊUÙÚÛŨṸŪṺŬÜǛǗǕǙỦŮŰǓȔȖƯỪỨỮỬỰỤṲŲṶṴɄ"},{base:"V",letters:"VⓋVṼṾƲꝞɅ"},{base:"VY",letters:"Ꝡ"},{base:"W",letters:"WⓌWẀẂŴẆẄẈⱲ"},{base:"X",letters:"XⓍXẊẌ"},{base:"Y",letters:"YⓎYỲÝŶỸȲẎŸỶỴƳɎỾ"},{base:"Z",letters:"ZⓏZŹẐŻŽẒẔƵȤⱿⱫꝢ"},{base:"a",letters:"aⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐ"},{base:"aa",letters:"ꜳ"},{base:"ae",letters:"æǽǣ"},{base:"ao",letters:"ꜵ"},{base:"au",letters:"ꜷ"},{base:"av",letters:"ꜹꜻ"},{base:"ay",letters:"ꜽ"},{base:"b",letters:"bⓑbḃḅḇƀƃɓ"},{base:"c",letters:"cⓒcćĉċčçḉƈȼꜿↄ"},{base:"d",letters:"dⓓdḋďḍḑḓḏđƌɖɗꝺ"},{base:"dz",letters:"dzdž"},{base:"e",letters:"eⓔeèéêềếễểẽēḕḗĕėëẻěȅȇẹệȩḝęḙḛɇɛǝ"},{base:"f",letters:"fⓕfḟƒꝼ"},{base:"g",letters:"gⓖgǵĝḡğġǧģǥɠꞡᵹꝿ"},{base:"h",letters:"hⓗhĥḣḧȟḥḩḫẖħⱨⱶɥ"},{base:"hv",letters:"ƕ"},{base:"i",letters:"iⓘiìíîĩīĭïḯỉǐȉȋịįḭɨı"},{base:"j",letters:"jⓙjĵǰɉ"},{base:"k",letters:"kⓚkḱǩḳķḵƙⱪꝁꝃꝅꞣ"},{base:"l",letters:"lⓛlŀĺľḷḹļḽḻſłƚɫⱡꝉꞁꝇ"},{base:"lj",letters:"lj"},{base:"m",letters:"mⓜmḿṁṃɱɯ"},{base:"n",letters:"nⓝnǹńñṅňṇņṋṉƞɲʼnꞑꞥ"},{base:"nj",letters:"nj"},{base:"o",letters:"oⓞoòóôồốỗổõṍȭṏōṑṓŏȯȱöȫỏőǒȍȏơờớỡởợọộǫǭøǿɔꝋꝍɵ"},{base:"oi",letters:"ƣ"},{base:"ou",letters:"ȣ"},{base:"oo",letters:"ꝏ"},{base:"p",letters:"pⓟpṕṗƥᵽꝑꝓꝕ"},{base:"q",letters:"qⓠqɋꝗꝙ"},{base:"r",letters:"rⓡrŕṙřȑȓṛṝŗṟɍɽꝛꞧꞃ"},{base:"s",letters:"sⓢsßśṥŝṡšṧṣṩșşȿꞩꞅẛ"},{base:"t",letters:"tⓣtṫẗťṭțţṱṯŧƭʈⱦꞇ"},{base:"tz",letters:"ꜩ"},{base:"u",letters:"uⓤuùúûũṹūṻŭüǜǘǖǚủůűǔȕȗưừứữửựụṳųṷṵʉ"},{base:"v",letters:"vⓥvṽṿʋꝟʌ"},{base:"vy",letters:"ꝡ"},{base:"w",letters:"wⓦwẁẃŵẇẅẘẉⱳ"},{base:"x",letters:"xⓧxẋẍ"},{base:"y",letters:"yⓨyỳýŷỹȳẏÿỷẙỵƴɏỿ"},{base:"z",letters:"zⓩzźẑżžẓẕƶȥɀⱬꝣ"}],A=function(){function e(){var e=this;this.defaultDiacriticsRemovalMap=M,this.diacriticsMap={},this.defaultDiacriticsRemovalMap.forEach((function(t){return t.letters.split("").forEach((function(s){return e.diacriticsMap[s]=t.base}))}))}return e.prototype.removeDiacritics=function(e){var t=this;return null==e?e:e.replace(/[^\u0000-\u007E]/g,(function(e){return t.diacriticsMap[e]||e}))},e.prototype.ngOnDestroy=function(){this.diacriticsMap={}},e.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e},token:e,providedIn:"root"}),e=h([t.Injectable({providedIn:"root"})],e)}(),O=function(){function e(){}return e.findSingle=function(e,t){return e?e.querySelector(t):null},e.scrollInView=function(e,t){var s=getComputedStyle(e).getPropertyValue("borderTopWidth"),i=s?parseFloat(s):0,r=getComputedStyle(e).getPropertyValue("paddingTop"),o=r?parseFloat(r):0,n=e.getBoundingClientRect(),a=t.getBoundingClientRect().top+document.body.scrollTop-(n.top+document.body.scrollTop)-i-o,l=e.scrollTop,p=e.clientHeight,h=this.getOuterHeight(t);a<0?e.scrollTop=l+a:a+h>p&&(e.scrollTop=l+a-p+h)},e.getInnerHeight=function(e){var t=e.offsetHeight,s=getComputedStyle(e);return t+=parseFloat(s.paddingTop)+parseFloat(s.paddingBottom)},e.getOuterHeight=function(e,t){var s=e.offsetHeight;if(t){var i=getComputedStyle(e);s+=parseFloat(i.marginTop)+parseFloat(i.marginBottom)}return s},e.getHeight=function(e){var t=e.offsetHeight,s=getComputedStyle(e);return t-=parseFloat(s.paddingTop)+parseFloat(s.paddingBottom)+parseFloat(s.borderTopWidth)+parseFloat(s.borderBottomWidth)},e}();!function(e){e.SOURCE_PREFILLED="Prefilled"}(f||(f={}));var P,B=function(e,t){this.addressLevel=e,this.prefillData=t};!function(e){e.LOCALITY="LOCALITY",e.STREET="STREET",e.STREET_NUMBER="STREET_NUMBER",e.BOX_NUMBER="BOX_NUMBER"}(P||(P={}));var V=function(){function s(e,s,i,r){this.addressService=e,this.localeService=s,this.translateService=i,this.unicodeService=r,this.labelResourceKey="common.label.postalCode",this.messageOption="Y",this.maxSuggesionCount=5,this.visibleSuggestionCount=5,this.sortCriteria="",this.showDebugMessageToConsole=!0,this.messageChanged=new t.EventEmitter,this.addressChanged=new t.EventEmitter,this.focusEvent=new t.EventEmitter,this.blurEvent=new t.EventEmitter,this.textChangeEvent=new t.EventEmitter,this.clearInputEventEmitter=new t.EventEmitter,this.prefillEventEmitter=new t.EventEmitter,this.validationMessageCode=null,this.validationMessageOptions=null,this.prefilling=!1,this.isPrefillWithNoMatch=!1}return Object.defineProperty(s.prototype,"inputLang",{set:function(e){var t=this;this.localeService.changeLang(e),this.translateService.use(e).subscribe((function(e){t.onChangedLanguage()}))},enumerable:!0,configurable:!0}),s.prototype.ngOnInit=function(){this.searchText="",this.addressIsValidated=!1,this.suggestionValidationMessage="",this.suggestions=[],this.previousIndex=-1,this.lastSearchValue="",this.wordList=[],this.suggestionsWordList=[],this.bpTypeAhead="",this.placeHolderText="",this.skipNextBlur=!1,this.errorCode=null,this.selectedIndex=-1,this.typeAheadWord="",this.collapseDropdown=!1,this.sequenceNumber=0,this.consumedNumber=0,this.setSearchText(""),this.onChangedLanguage()},s.prototype.ngAfterViewChecked=function(){if(this.selectionChanged){var e=this.localityList.nativeElement;setTimeout((function(){var t=O.findSingle(e,"li.active");t&&O.scrollInView(e,t)}),1),this.selectionChanged=!1}},s.prototype.ngOnChanges=function(t){t&&(t.hasOwnProperty("prefillData")&&!t.prefillData.firstChange&&(this.prefilling=!0,this.searchText=this.loadParams(t.prefillData.currentValue),this.showDebugMessageToConsole&&console.log("locality::ngOnChanges - loadParame result:",this.searchText),this.bpTypeAhead="",""!==this.searchText&&this.minLevel===e.ADDRESSLEVEL.LOCALITY&&(this.collapseDropdown=!0,this.prefillData.prefillMunicipalityName=this.transformMunicipalityInLowercaseAndWithoutDiacritics(this.prefillData.parameters.municipalityName),this.onInputChange(f.SOURCE_PREFILLED))),t.hasOwnProperty("inputText")&&!t.inputText.firstChange&&this.notEqualIgnoreCase(this.searchText,t.inputText.currentValue)&&(this.clearWidget(),this.searchText=t.inputText.currentValue))},s.prototype.transformMunicipalityInLowercaseAndWithoutDiacritics=function(e){var t=null;return null!=e&&(t=(t=this.unicodeService.removeDiacritics(e)).toLowerCase()),this.showDebugMessageToConsole&&console.log("prefill municipality",t),t},s.prototype.ngOnDestroy=function(){this.subscription&&this.subscription.unsubscribe()},s.prototype.buildInputWordList=function(){var e,t,s,i;if(this.wordList=this.searchText.split(/[\s, ]+/),this.suggestions&&this.wordList)try{for(var r=u(this.suggestions),o=r.next();!o.done;o=r.next()){var n=o.value;if(n&&n.hasOwnProperty("string")){var a=function(e){var t=l.startsWithIgnoreDiacritics(n.string,e);if(t>=0){var s=n.string.substr(t,e.length),i=l.wordList.find((function(e){return e.toLowerCase()===s.toLowerCase()}));null==i&&l.wordList.push(s)}},l=this;try{for(var p=(s=void 0,u(this.wordList)),h=p.next();!h.done;h=p.next()){a(h.value)}}catch(e){s={error:e}}finally{try{h&&!h.done&&(i=p.return)&&i.call(p)}finally{if(s)throw s.error}}}}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}},s.prototype.stringStartsWithIgnoreDiacritics=function(e,t){var s=this.unicodeService.removeDiacritics(null!=e?e.toLowerCase():e),i=this.unicodeService.removeDiacritics(null!=t?t.toLowerCase():t);return-1!==s.slice(0,i.length).toLowerCase().indexOf(i)},s.prototype.buildTypeAhead=function(e){if(e===f.SOURCE_PREFILLED)return!1;if(this.mayAddTypeAhead()){var t=this.searchText.split(/[\s, ]+/),s=t[t.length-1];if(this.suggestions.some(function(e){return!(!e||!e.hasOwnProperty("string"))&&e.string.split(/[\s-]+/).some(function(e){if(this.stringStartsWithIgnoreDiacritics(e,s))return this.typeAheadWord=e,!0}.bind(this))}.bind(this))){var i=this.typeAheadWord.slice(s.length,this.typeAheadWord.length).toLowerCase();this.bpTypeAhead=this.searchText+i}}},s.prototype.clearConnectionErrorMessage=function(){if(this.errorCode){var e=this.translateService.instant(this.errorCode);this.suggestionValidationMessage===e&&this.clearSuggestionValidationMessage(),this.errorCode=null}},s.prototype.clearTypeAhead=function(){this.bpTypeAhead=""},s.prototype.emitTranslatedValidationMessage=function(t,s){if(null!=t)switch(t){case e.ValidationMessageType.Address_Not_Found:case e.ValidationMessageType.Address_Validated:case e.ValidationMessageType.Service_Unavailable:var i=this.translateService.instant("common.message."+t);this.messageChanged.emit({messageType:t,translatedMessage:i});break;default:console.error("Unable to emit validation message - message key NOT supported!",t)}else console.warn("Unable to emit validation message - message key is invalid!",t)},s.prototype.generateParameters=function(){var e=new y({id:this.sequenceNumber,q:this.searchText,maxNumberOfSuggestions:this.maxSuggesionCount});switch(this.sortCriteria){case"P":e.sortByPostalCode(!0);break;case"L":e.sortByLocalityname(!0)}return e},s.prototype.getTopSuggestions=function(e){var t=this;this.sequenceNumber+=1;var s=this.generateParameters();this.showDebugMessageToConsole&&console.log("LOCALITY calling service params",s),this.searchText&&(this.subscription=this.addressService.getLocality(this.baseUrl,s).subscribe((function(s){t.showDebugMessageToConsole&&console.log("locality suggestions received:",s),t.handleGetLocalityResponse(s,e),e===f.SOURCE_PREFILLED?(t.isPrefillWithNoMatch=!0!==t.prefillData.prefillMunicipalityPerfectMatchFound,t.prefillAnalyzeData()):t.isPrefillWithNoMatch=!1}),(function(){return t.handleGetLocalityError()})))},s.prototype.getTextColor=function(){return!0===this.isPrefillWithNoMatch?"orangered":""},s.prototype.handleGetLocalityResponse=function(e,t){this.showDebugMessageToConsole&&console.log("handleGetLocalityResponse",e),e&&e.response&&e.response.sequenceNumber&&e.response.sequenceNumber>=this.consumedNumber&&e.response.topSuggestions&&(this.consumedNumber=e.response.sequenceNumber,this.clearSuggestions(),this.parseTopSuggestions(e.response.topSuggestions,t),this.buildTypeAhead(t),this.clearConnectionErrorMessage(),this.buildInputWordList()),this.collapseDropdown=!0===this.prefilling&&null!==this.prefillData&&!this.prefillData.parameters.onFocusShowSuggestionsAfterPrefill},s.prototype.handleGetLocalityError=function(){this.setConnectionErrorMessage()},s.prototype.isBrowserIE=function(){return/msie\s|trident\/|edge\//i.test(window.navigator.userAgent)},s.prototype.isDropdownClicked=function(e){return"bpaac-locality-dropdown"===(e.explicitOriginalTarget||document.activeElement).id},s.prototype.isString=function(e){return e.constructor===String},s.prototype.loadParams=function(e){var t="";return null!==e&&null!==e.parameters&&(e.parameters.hasOwnProperty("minLevel")&&(this.minLevel=e.parameters.minLevel),e.parameters.hasOwnProperty("postalCode")&&this.isString(e.parameters.postalCode)&&(t=e.parameters.postalCode),e.parameters.hasOwnProperty("municipalityName")&&this.isString(e.parameters.municipalityName)&&(t+=" "+e.parameters.municipalityName)),t},s.prototype.mayShowClearButton=function(){return this.searchText.length>0},s.prototype.mayAddTypeAhead=function(){return 0!==this.searchText.length&&/[^\s, \\\/]$/.test(this.searchText)},s.prototype.notEqualIgnoreCase=function(e,t){return e.toLowerCase()!==t.toLowerCase()},s.prototype.onBlur=function(t){this.isBrowserIE()&&this.isDropdownClicked(t)?this.localitySearchInput.nativeElement.focus():this.skipNextBlur?this.skipNextBlur=!1:(this.collapseDropdown=!0,this.blurEvent.emit(e.ADDRESSLEVEL.LOCALITY))},s.prototype.onFocus=function(){this.collapseDropdown=!1,this.skipNextBlur=!1,this.focusEvent.emit(e.ADDRESSLEVEL.LOCALITY)},s.prototype.onInputClick=function(){this.showDebugMessageToConsole&&console.log("locality click")},s.prototype.onInputChange=function(e){this.collapseDropdown=!1,this.resetArrowSelectedIndex(),e||(this.prefilling=!1,this.valueChanged()),this.clearSuggestionValidationMessage(),""===this.searchText?(this.sequenceNumber+=1,this.consumedNumber=this.sequenceNumber,this.clearSuggestions()):this.getTopSuggestions(e),this.buildInputWordList()},s.prototype.parseSingleSuggestion=function(e,t){var s,i,r;if(this.localeService.isLocaleFrench()&&e.hasOwnProperty("french")?r=e.french:this.localeService.isLocaleDutch()&&e.hasOwnProperty("dutch")?r=e.dutch:this.localeService.isLocaleGerman()&&e.hasOwnProperty("german")?r=e.german:e.hasOwnProperty("address")&&(r=e.address),r){if(e.messages&&(r.messages=e.messages),this.suggestions.push(r),"Y"===this.messageOption&&r.hasOwnProperty("messages"))try{for(var o=u(r.messages),n=o.next();!n.done;n=o.next()){var a=n.value,l=this.translateMessage(a);null!==l&&(a.translatedMessage=l)}}catch(e){s={error:e}}finally{try{n&&!n.done&&(i=o.return)&&i.call(o)}finally{if(s)throw s.error}}t===f.SOURCE_PREFILLED&&(e.address=r,this.prefillCheckForPerfectMatch(e))}},s.prototype.prefillCheckForPerfectMatch=function(e){var t=e.address;if(/*! this.prefillData.prefillMunicipalityPerfectMatchFound &&*/t.postalCode===this.prefillData.parameters.postalCode){this.showDebugMessageToConsole&&console.log("LOCALITY - PREFILL - checking suggestion for perfect match",this.prefillData,e);var s=this.transformMunicipalityInLowercaseAndWithoutDiacritics(t.localityName),i=this.transformMunicipalityInLowercaseAndWithoutDiacritics(t.municipalityName);s!==this.prefillData.prefillMunicipalityName&&i!==this.prefillData.prefillMunicipalityName||(this.prefillData.prefillMunicipalityPerfectMatchFound=!0,this.prefillData.prefillMunicipalityPerfectMatchSuggestion=e,this.searchText=t.postalCode+" "+t.localityName,this.showDebugMessageToConsole&&console.log("LOCALITY - PREFILL - Perfect match:",e))}},s.prototype.prefillAnalyzeData=function(){!0===this.prefillData.prefillMunicipalityPerfectMatchFound&&(this.collapseDropdown=!0),this.prefillEventEmitter.emit(new B(e.ADDRESSLEVEL.LOCALITY,this.prefillData))},s.prototype.parseTopSuggestions=function(e,t){var s,i;if(this.showDebugMessageToConsole&&console.log("locality - parse suggestions",e),e.constructor===Array)try{for(var r=u(e),o=r.next();!o.done;o=r.next()){var n=o.value;this.parseSingleSuggestion(n,t)}}catch(e){s={error:e}}finally{try{o&&!o.done&&(i=r.return)&&i.call(r)}finally{if(s)throw s.error}}else this.parseSingleSuggestion(e,t)},s.prototype.resetArrowSelectedIndex=function(){this.selectedIndex=-1},s.prototype.startsWithIgnoreDiacritics=function(e,t){var s=this.unicodeService.removeDiacritics(null!=e?e.toLowerCase():e),i=this.unicodeService.removeDiacritics(null!=t?t.toLowerCase():t);return s.indexOf(i)},s.prototype.valueChanged=function(){this.textChangeEvent.emit(this.searchText)},s.prototype.clearInput=function(e,t){void 0===t&&(t=!0),this.clearSuggestions(),this.bpTypeAhead="",this.setSearchText(""),this.resetArrowSelectedIndex(),this.previousIndex=-1,this.lastSearchValue="",this.clearSuggestionValidationMessage(),this.clearSelectedAddress(),this.valueChanged(),this.clearConnectionErrorMessage(),!0===e&&this.localitySearchInput.nativeElement.focus(),t&&this.clearInputEventEmitter.emit(P.LOCALITY)},s.prototype.clearSearchText=function(){this.searchText=""},s.prototype.clearSelectedAddress=function(){this.addressChanged.emit(null),this.addressIsValidated=!1},s.prototype.clearSuggestionValidationMessage=function(){this.addressIsValidated=!1,this.suggestionValidationMessage="",this.messageChanged.emit({messageType:null,translatedMessage:this.suggestionValidationMessage}),this.validationMessageOptions=null,this.validationMessageCode=null},s.prototype.clearSuggestions=function(){this.wordList=[],this.suggestions=[],this.suggestionsWordList=[]},s.prototype.clickSuggestion=function(e,t){this.isPrefillWithNoMatch=!1,e.preventDefault(),this.clearTypeAhead(),this.resetArrowSelectedIndex(),this.setSearchText(t.string),this.collapseDropdown=!0,this.addressIsValidated=!0,this.clearSuggestions(),this.setSelectedAddress(t)},s.prototype.clearWidget=function(){this.clearSearchText(),this.clearSuggestions(),this.clearTypeAhead(),this.prefillData=null,this.prefilling=!1},s.prototype.cursorIsOnSuggestionList=function(){return this.selectedIndex>=0},s.prototype.onChangedLanguage=function(){var e=this;this.translateService.get("locality.placeholder.input-placeholder").subscribe((function(t){e.placeHolderText=t}))},s.prototype.changeSelection=function(){this.suggestions.length>0&&(this.selectionChanged=!0)},s.prototype.moveArrowSelectedIndexDown=function(){this.selectedIndex+1!==this.suggestions.length&&(this.selectedIndex++,this.changeSelection(),this.setSearchTextBasedOnArrowSelection(this.selectedIndex,this.selectedIndex-1))},s.prototype.moveArrowSelectedIndexUp=function(){this.selectedIndex-1!=-2&&(this.selectedIndex--,this.changeSelection(),this.setSearchTextBasedOnArrowSelection(this.selectedIndex,this.selectedIndex+1))},s.prototype.checkKeyDown=function(e){switch(e.which){case 40:e.preventDefault(),this.moveArrowSelectedIndexDown();break;case 38:e.preventDefault(),this.moveArrowSelectedIndexUp();break;case 39:e.preventDefault(),this.cursorIsOnSuggestionList()?this.clickSuggestion(e,this.suggestions[this.selectedIndex]):this.typeAheadWord&&this.typeAheadIsShown()&&(this.setSearchText(this.bpTypeAhead),this.typeAheadWord="");break;case 9:this.addressIsValidated||(e.preventDefault(),this.selectFirstInListOfSuggesions());break;case 46:e.ctrlKey&&this.clearWidget();break;case 13:e.preventDefault(),this.cursorIsOnSuggestionList()&&this.clickSuggestion(e,this.suggestions[this.selectedIndex]);break;default:this.clearTypeAhead()}},s.prototype.setConnectionErrorMessage=function(){this.errorCode=e.ValidationMessageType.Service_Unavailable,this.emitTranslatedValidationMessage(e.ValidationMessageType.Service_Unavailable)},s.prototype.setSelectedAddress=function(e){this.addressChanged.emit(e)},s.prototype.translateMessage=function(e){switch(e.key){case"subl":if(e.args&&2===e.args.length)return this.translateService.instant("locality.suggestion.message.subl",{sub:e.args[0],principal:e.args[1]})}return null},s.prototype.typeAheadIsShown=function(){return this.bpTypeAhead&&this.bpTypeAhead.length>0},s.prototype.selectFirstInListOfSuggesions=function(){this.selectedIndex=0,this.changeSelection(),this.setSearchTextBasedOnArrowSelection(this.selectedIndex,this.selectedIndex-1)},s.prototype.setSearchText=function(e){this.searchText=e},s.prototype.setSearchTextBasedOnArrowSelection=function(e,t){void 0===e||this.suggestions.length<=0||(-1!==e?(-1===t&&(this.lastSearchValue=this.searchText),this.setSearchText(this.suggestions[this.selectedIndex].string),this.clearTypeAhead()):this.setSearchText(this.lastSearchValue))},s.ctorParameters=function(){return[{type:L},{type:D},{type:o.TranslateService},{type:A}]},h([t.ViewChild("localitySearchInput",{static:!1})],s.prototype,"localitySearchInput",void 0),h([t.ViewChild("localityList",{static:!1})],s.prototype,"localityList",void 0),h([t.Input()],s.prototype,"labelResourceKey",void 0),h([t.Input()],s.prototype,"messageOption",void 0),h([t.Input()],s.prototype,"maxSuggesionCount",void 0),h([t.Input()],s.prototype,"visibleSuggestionCount",void 0),h([t.Input()],s.prototype,"sortCriteria",void 0),h([t.Input()],s.prototype,"baseUrl",void 0),h([t.Input()],s.prototype,"inputText",void 0),h([t.Input()],s.prototype,"prefillData",void 0),h([t.Input()],s.prototype,"showDebugMessageToConsole",void 0),h([t.Input()],s.prototype,"inputLang",null),h([t.Output()],s.prototype,"messageChanged",void 0),h([t.Output()],s.prototype,"addressChanged",void 0),h([t.Output()],s.prototype,"focusEvent",void 0),h([t.Output()],s.prototype,"blurEvent",void 0),h([t.Output()],s.prototype,"textChangeEvent",void 0),h([t.Output()],s.prototype,"clearInputEventEmitter",void 0),h([t.Output()],s.prototype,"prefillEventEmitter",void 0),s=h([t.Component({selector:"bp-locality",template:'<span *ngIf="labelResourceKey">{{ labelResourceKey | translate}}</span>\n<div class="bpaac-dropdown">\n <div class="bpaac-search-bar">\n <div class="bpaac-input-width">\n \n <input type="text" #localitySearchInput class="bpaac-input" \n (keydown)="checkKeyDown($event)" (input)="onInputChange()"\n [style.color]=" getTextColor() "\n [(ngModel)]="searchText" id="localityInputField" [attr.placeholder]="placeHolderText" autocomplete="off"\n (blur)="onBlur($event)" (focus)="onFocus()" (click)="onInputClick()"/>\n <div id="bpaac-clear-locality-button" \n *ngIf="mayShowClearButton()"\n (click)="clearInput(true)" class="bpaac-clear">\n </div>\n </div>\n \x3c!--<div ng-transclude></div>--\x3e\n <input id="bpaac-locality-typeahead" type="text" disabled autocomplete="off" [(ngModel)]="bpTypeAhead" />\n </div>\n <div [hidden]="collapseDropdown" class="bpaac-dropdown-menu-container" *ngIf="suggestions && suggestions.length>0">\n <div #localityList [appVisibleSuggestion]="visibleSuggestionCount" id="bpaac-locality-dropdown" \n class="bpaac-dropdown-menu">\n <ul role="listbox" id="bpaac-locality-suggestionsList" class="list-unstyled">\n <li role="option" \n *ngFor="let option of suggestions; let idx = index" \n [ngClass]="{\'active\':(selectedIndex==idx)}" (mousedown)="clickSuggestion($event, option)"\n (mouseenter)="selectedIndex=idx" (mouseleave)="selectedIndex=-1">\n <span *ngIf="option" [innerHtml]="option.string | highlightSuggestion : wordList"></span> \n <span *ngIf="messageOption === \'P\' && option.messages"> ({{option.municipalityName}})</span><br />\n <ng-container *ngIf="messageOption === \'Y\'">\n <span *ngFor="let message of option.messages" \n class="bpaac-suggestion-message"\n [innerHtml]="message.translatedMessage"></span> \n </ng-container>\n </li>\n </ul>\n </div>\n </div>\n</div>',styles:[""]})],s)}(),R=function(){function s(e,s,i,r){this.addressService=e,this.localeService=s,this.translateService=i,this.unicodeService=r,this.subscription=null,this.labelResourceKey="common.label.streetName",this.maxSuggesionCount=5,this.visibleSuggesionCount=5,this.sortCriteria="",this.showDebugMessageToConsole=!0,this.messageOption="Y",this.messageChanged=new t.EventEmitter,this.addressChanged=new t.EventEmitter,this.focusEvent=new t.EventEmitter,this.blurEvent=new t.EventEmitter,this.textChangeEvent=new t.EventEmitter,this.clearInputEventEmitter=new t.EventEmitter,this.prefillEventEmitter=new t.EventEmitter,this.validationMessageCode=null,this.validationMessageOptions=null,this.prefilling=!1,this.isPrefillWithNoMatch=!1}return Object.defineProperty(s.prototype,"inputLang",{set:function(e){var t=this;this.localeService.changeLang(e),this.translateService.use(e).subscribe((function(e){t.onChangedLanguage()}))},enumerable:!0,configurable:!0}),s.prototype.ngOnInit=function(){this.searchText="",this.addressIsValidated=!1,this.suggestionValidationMessage="",this.suggestions=[],this.previousIndex=-1,this.lastSearchValue="",this.wordList=[],this.suggestionsWordList=[],this.bpTypeAhead="",this.placeHolderText="",this.skipNextBlur=!1,this.errorCode=null,this.selectedIndex=-1,this.typeAheadWord="",this.collapseDropdown=!1,this.sequenceNumber=1,this.consumedNumber=1,this.setSearchText(""),this.onChangedLanguage()},s.prototype.ngOnDestroy=function(){this.subscription&&this.subscription.unsubscribe()},s.prototype.onChangedLanguage=function(){var e=this;this.translateService.get("street.placeholder.input-placeholder").subscribe((function(t){e.placeHolderText=t}))},s.prototype.ngAfterViewChecked=function(){if(this.selectionChanged){var e=this.streetList.nativeElement;setTimeout((function(){var t=O.findSingle(e,"li.active");t&&O.scrollInView(e,t)}),1),this.selectionChanged=!1}},s.prototype.ngOnChanges=function(t){t&&(t.hasOwnProperty("prefillData")&&!t.prefillData.firstChange&&(this.prefilling=!0,this.searchText=this.loadParams(t.prefillData.currentValue),""!==this.searchText&&this.minLevel===e.ADDRESSLEVEL.STREET&&(this.collapseDropdown=!0,this.prefillData.prefillStreetName=this.transformStreetNameInLowercaseAndWithoutDiacritics(this.prefillData.parameters.streetName),this.onInputChange(f.SOURCE_PREFILLED))),t.hasOwnProperty("inputText")&&!t.inputText.firstChange&&this.notEqualIgnoreCase(this.searchText,t.inputText.currentValue)&&(this.clearWidget(),this.searchText=t.inputText.currentValue),!t.hasOwnProperty("postalCode")||t.postalCode.firstChange||t.hasOwnProperty("prefillData")||(this.minLevel=e.ADDRESSLEVEL.STREET,""===t.postalCode.currentValue&&(this.clearWidget(),this.valueChanged())))},s.prototype.transformStreetNameInLowercaseAndWithoutDiacritics=function(e){var t=null;return null!=e&&(t=(t=this.unicodeService.removeDiacritics(e)).toLowerCase()),this.showDebugMessageToConsole&&console.log("prefill streetName",t),t},s.prototype.onClearInputEvent=function(e,t){this.clearInput(t)},s.prototype.onBlur=function(t){this.isBrowserIE()&&this.isDropdownClicked(t)?this.streetSearchInput.nativeElement.focus():this.skipNextBlur?this.skipNextBlur=!1:(this.collapseDropdown=!0,this.blurEvent.emit(e.ADDRESSLEVEL.STREET))},s.prototype.isBrowserIE=function(){return/msie\s|trident\/|edge\//i.test(window.navigator.userAgent)},s.prototype.isDropdownClicked=function(e){return"bpaac-street-dropdown"===(e.explicitOriginalTarget||document.activeElement).id},s.prototype.onFocus=function(){this.collapseDropdown=!1,this.showDebugMessageToConsole&&console.log("street comp - onFocus",this.prefilling,this.prefillData,this.collapseDropdown),this.skipNextBlur=!1,this.focusEvent.emit(e.ADDRESSLEVEL.STREET)},s.prototype.mayShowDropdown=function(){return this.suggestions.length>0&&!this.collapseDropdown},s.prototype.buildInputWordList=function(){var e,t,s,i;if(this.wordList=this.searchText.split(/[\s, ]+/),this.suggestions&&this.wordList)try{for(var r=u(this.suggestions),o=r.next();!o.done;o=r.next()){var n=o.value;if(n&&n.hasOwnProperty("string")){var a=function(e){var t=l.startsWithIgnoreDiacritics(n.string,e);if(t>=0){var s=n.string.substr(t,e.length),i=l.wordList.find((function(e){return e.toLowerCase()===s.toLowerCase()}));null==i&&l.wordList.push(s)}},l=this;try{for(var p=(s=void 0,u(this.wordList)),h=p.next();!h.done;h=p.next()){a(h.value)}}catch(e){s={error:e}}finally{try{h&&!h.done&&(i=p.return)&&i.call(p)}finally{if(s)throw s.error}}}}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}},s.prototype.startsWithIgnoreDiacritics=function(e,t){var s=this.unicodeService.removeDiacritics(null!=e?e.toLowerCase():e),i=this.unicodeService.removeDiacritics(null!=t?t.toLowerCase():t);return s.indexOf(i)},s.prototype.mayAddTypeAhead=function(){return 0!==this.searchText.length&&/[^\s, \\\/]$/.test(this.searchText)},s.prototype.valueChanged=function(){this.textChangeEvent.emit(this.searchText)},s.prototype.buildTypeAhead=function(e){if(e===f.SOURCE_PREFILLED)return!1;if(this.mayAddTypeAhead()){var t=this.searchText.split(/[\s, ]+/),s=t[t.length-1];if(this.suggestions.some(function(e){return!(!e||!e.hasOwnProperty("string"))&&e.string.split(/[\s-]+/).some(function(e){if(this.stringStartsWithIgnoreDiacritics(e,s))return this.typeAheadWord=e,!0}.bind(this))}.bind(this))){var i=this.typeAheadWord.slice(s.length,this.typeAheadWord.length).toLowerCase();this.bpTypeAhead=this.searchText+i}}},s.prototype.stringStartsWithIgnoreDiacritics=function(e,t){var s=this.unicodeService.removeDiacritics(null!=e?e.toLowerCase():e),i=this.unicodeService.removeDiacritics(null!=t?t.toLowerCase():t);return-1!==s.slice(0,i.length).toLowerCase().indexOf(i)},s.prototype.getTopSuggestions=function(e){var t=this;this.sequenceNumber+=1;var s=this.generateParameters();this.showDebugMessageToConsole&&console.log("STREET calling service params",s),this.searchText&&(this.subscription=this.addressService.getStreet(this.baseUrl,this.locality,this.postalCode,s).subscribe((function(s){t.handleGetStreetResponse(s,e),e===f.SOURCE_PREFILLED?(t.isPrefillWithNoMatch=!0!==t.prefillData.prefillStreetPerfectMatchFound,t.prefillAnalyzeData()):t.isPrefillWithNoMatch=!1}),(function(){return t.handleGetStreetError()})))},s.prototype.getTextColor=function(){return!0===this.isPrefillWithNoMatch?"orangered":""},s.prototype.loadParams=function(e){var t="";return null!==e&&null!==e.parameters&&(e.parameters.hasOwnProperty("minLevel")&&(this.minLevel=e.parameters.minLevel),e.parameters.hasOwnProperty("postalCode")&&this.isString(e.parameters.postalCode)&&(this.postalCode=e.parameters.postalCode),e.parameters.hasOwnProperty("municipalityName")&&this.isString(e.parameters.municipalityName)&&(this.locality=e.parameters.municipalityName),e.parameters.hasOwnProperty("streetName")&&this.isString(e.parameters.streetName)&&this.isParamsComplete()&&(t=e.parameters.streetName)),t},s.prototype.isString=function(e){return null!=e&&e.constructor===String},s.prototype.isValid=function(e){return this.isString(e)&&""!==e},s.prototype.isParamsComplete=function(){return this.isValid(this.postalCode)&&this.isValid(this.locality)},s.prototype.generateParameters=function(){var e=new y({id:this.sequenceNumber,q:this.searchText,postalCode:this.postalCode,locality:this.locality,maxNumberOfSuggestions:this.maxSuggesionCount});return"S"===this.sortCriteria&&e.sortByStreet(!0),e},s.prototype.handleGetStreetResponse=function(e,t){e&&e.response&&e.response.sequenceNumber&&e.response.sequenceNumber>=this.consumedNumber&&e.response.topSuggestions&&(this.consumedNumber=e.response.sequenceNumber,this.clearSuggestions(),this.parseTopSuggestions(e.response.topSuggestions,t),this.buildTypeAhead(t),this.clearConnectionErrorMessage(),this.buildInputWordList()),this.collapseDropdown=!0===this.prefilling&&null!==this.prefillData&&!this.prefillData.parameters.onFocusShowSuggestionsAfterPrefill},s.prototype.handleGetStreetError=function(){this.setConnectionErrorMessage()},s.prototype.setConnectionErrorMessage=function(){this.errorCode=e.ValidationMessageType.Service_Unavailable,this.emitTranslatedValidationMessage(e.ValidationMessageType.Service_Unavailable)},s.prototype.clearConnectionErrorMessage=function(){if(this.errorCode){var e=this.translateService.instant(this.errorCode);this.suggestionValidationMessage===e&&this.clearSuggestionValidationMessage(),this.errorCode=null}},s.prototype.parseTopSuggestions=function(e,t){var s,i;if(e.constructor===Array)try{for(var r=u(e),o=r.next();!o.done;o=r.next()){var n=o.value;this.parseSingleSuggestion(n,t)}}catch(e){s={error:e}}finally{try{o&&!o.done&&(i=r.return)&&i.call(r)}finally{if(s)throw s.error}}else this.parseSingleSuggestion(e,t)},s.prototype.parseSingleSuggestion=function(e,t){var s;this.localeService.isLocaleFrench()&&e.hasOwnProperty("french")?s=e.french:this.localeService.isLocaleDutch()&&e.hasOwnProperty("dutch")?s=e.dutch:this.localeService.isLocaleGerman()&&e.hasOwnProperty("german")?s=e.german:e.hasOwnProperty("address")&&(s=e.address),s&&(e.messages&&(s.messages=e.messages),this.suggestions.push(s),t===f.SOURCE_PREFILLED&&(e.address=s,this.prefillCheckForPerfectMatch(e)))},s.prototype.prefillCheckForPerfectMatch=function(e){this.showDebugMessageToConsole&&console.log("street - checking suggestion for perfect match",this.prefillData,e);var t=e.address,s=this.transformStreetNameInLowercaseAndWithoutDiacritics(t.localityName),i=this.transformStreetNameInLowercaseAndWithoutDiacritics(t.municipalityName);s!==this.prefillData.prefillMunicipalityName&&i!==this.prefillData.prefillMunicipalityName||this.transformStreetNameInLowercaseAndWithoutDiacritics(t.streetName)===this.prefillData.prefillStreetName&&(this.prefillData.prefillStreetPerfectMatchFound=!0,this.prefillData.prefillStreetPerfectMatchSuggestion=e,this.searchText=t.streetName)},s.prototype.onInputChange=function(e){this.collapseDropdown=!1,this.resetArrowSelectedIndex(),e||(this.prefilling=!1,this.valueChanged()),this.clearSuggestionValidationMessage(),""===this.searchText?(this.sequenceNumber+=1,this.consumedNumber=this.sequenceNumber,this.clearSuggestions()):this.getTopSuggestions(e),this.buildInputWordList()},s.prototype.prefillAnalyzeData=function(){!0===this.prefillData.prefillStreetPerfectMatchFound&&(this.collapseDropdown=!0),this.prefillEventEmitter.emit(new B(e.ADDRESSLEVEL.STREET,this.prefillData))},s.prototype.clickSuggestion=function(e,t){this.isPrefillWithNoMatch=!1,this.showDebugMessageToConsole&&console.log("streetNumber::clickSuggestion",e,t),null==e||e.preventDefault(),this.clearTypeAhead(),this.resetArrowSelectedIndex(),this.setSearchText(t.string),this.collapseDropdown=!0,this.addressIsValidated=!0,e&&this.clearSuggestions(),this.setSelectedAddress(t)},s.prototype.setSelectedAddress=function(e){this.addressChanged.emit(e)},s.prototype.clearSelectedAddress=function(){this.addressChanged.emit(null),this.addressIsValidated=!1},s.prototype.emitTranslatedValidationMessage=function(t,s){if(null!=t)switch(t){case e.ValidationMessageType.Address_Not_Found:case e.ValidationMessageType.Address_Validated:case e.ValidationMessageType.Service_Unavailable:var i=this.translateService.instant(t);this.messageChanged.emit({messageType:t,translatedMessage:i});break;default:console.error("Unable to emit validation message - message key NOT supported!",t)}else console.warn("Unable to emit validation message - message key is invalid!",t)},s.prototype.showAddressIsValidated=function(){this.emitTranslatedValidationMessage(e.ValidationMessageType.Address_Validated)},s.prototype.checkKeyDown=function(e){switch(e.which){case 40:e.preventDefault(),this.moveArrowSelectedIndexDown();break;case 38:e.preventDefault(),this.moveArrowSelectedIndexUp();break;case 39:e.preventDefault(),this.cursorIsOnSuggestionList()?this.clickSuggestion(e,this.suggestions[this.selectedIndex]):this.typeAheadWord&&this.typeAheadIsShown()&&(this.setSearchText(this.bpTypeAhead),this.typeAheadWord="");break;case 9:this.addressIsValidated||e.shiftKey||(e.preventDefault(),this.selectFirstInListOfSuggesions());break;case 46:e.ctrlKey&&this.clearWidget();break;case 13:e.preventDefault(),this.cursorIsOnSuggestionList()&&this.clickSuggestion(e,this.suggestions[this.selectedIndex]);break;default:this.clearTypeAhead()}},s.prototype.clearWidget=function(){this.addressIsValidated=!1,this.clearSearchText(),this.clearSuggestions(),this.clearTypeAhead(),this.prefillData=null,this.prefilling=!1},s.prototype.clearSearchText=function(){this.searchText=""},s.prototype.typeAheadIsShown=function(){return this.bpTypeAhead&&this.bpTypeAhead.length>0},s.prototype.resetArrowSelectedIndex=function(){this.selectedIndex=-1},s.prototype.moveArrowSelectedIndexDown=function(){this.selectedIndex+1!==this.suggestions.length&&(this.selectedIndex++,this.changeSelection(),this.setSearchTextBasedOnArrowSelection(this.selectedIndex,this.selectedIndex-1))},s.prototype.moveArrowSelectedIndexUp=function(){this.selectedIndex-1!=-2&&(this.selectedIndex--,this.changeSelection(),this.setSearchTextBasedOnArrowSelection(this.selectedIndex,this.selectedIndex+1))},s.prototype.cursorIsOnSuggestionList=function(){return this.selectedIndex>=0},s.prototype.setSearchTextBasedOnArrowSelection=function(e,t){void 0===e||this.suggestions.length<=0||(-1!==e?(-1===t&&(this.lastSearchValue=this.searchText),this.setSearchText(this.suggestions[this.selectedIndex].string),this.clearTypeAhead()):this.setSearchText(this.lastSearchValue))},s.prototype.mayShowClearButton=function(){return this.searchText.length>0},s.prototype.clearInput=function(e,t){void 0===t&&(t=!0),this.clearWidget(),this.resetArrowSelectedIndex(),this.previousIndex=-1,this.lastSearchValue="",this.clearSuggestionValidationMessage(),this.valueChanged(),this.clearConnectionErrorMessage(),!0===e&&this.streetSearchInput.nativeElement.focus(),t&&this.clearInputEventEmitter.emit(P.STREET)},s.prototype.clearSuggestions=function(){this.wordList=[],this.suggestions=[],this.suggestionsWordList=[]},s.prototype.clearTypeAhead=function(){this.bpTypeAhead=""},s.prototype.clearSuggestionValidationMessage=function(){this.suggestionValidationMessage="",this.addressIsValidated=!1,this.messageChanged.emit({messageType:null,translatedMessage:this.suggestionValidationMessage}),this.validationMessageOptions=null,this.validationMessageCode=null},s.prototype.setSearchText=function(e){this.searchText=e},s.prototype.selectFirstInListOfSuggesions=function(){this.selectedIndex=0,this.changeSelection(),this.setSearchTextBasedOnArrowSelection(this.selectedIndex,this.selectedIndex-1)},s.prototype.changeSelection=function(){this.suggestions.length>0&&(this.selectionChanged=!0)},s.prototype.suggestionMouseLeave=function(){this.selectedIndex=-1},s.prototype.notEqualIgnoreCase=function(e,t){return e.toLowerCase()!==t.toLowerCase()},s.prototype.showAddressNotFoundMessage=function(){this.emitTranslatedValidationMessage(e.ValidationMessageType.Address_Not_Found)},s.prototype.isDisabled=function(){return""===this.locality||""===this.postalCode||this.minLevel>e.ADDRESSLEVEL.STREET},s.prototype.onInputClick=function(){this.showDebugMessageToConsole&&console.log("street click"),this.prefilling=!1,this.collapseDropdown=!1},s.ctorParameters=function(){return[{type:L},{type:D},{type:o.TranslateService},{type:A}]},h([t.ViewChild("streetSearchInput",{static:!1})],s.prototype,"streetSearchInput",void 0),h([t.ViewChild("streetList",{static:!1})],s.prototype,"streetList",void 0),h([t.Input()],s.prototype,"labelResourceKey",void 0),h([t.Input()],s.prototype,"maxSuggesionCount",void 0),h([t.Input()],s.prototype,"visibleSuggesionCount",void 0),h([t.Input()],s.prototype,"sortCriteria",void 0),h([t.Input()],s.prototype,"baseUrl",void 0),h([t.Input()],s.prototype,"prefillData",void 0),h([t.Input()],s.prototype,"showDebugMessageToConsole",void 0),h([t.Input()],s.prototype,"postalCode",void 0),h([t.Input()],s.prototype,"locality",void 0),h([t.Input()],s.prototype,"inputText",void 0),h([t.Input()],s.prototype,"messageOption",void 0),h([t.Input()],s.prototype,"inputLang",null),h([t.Output()],s.prototype,"messageChanged",void 0),h([t.Output()],s.prototype,"addressChanged",void 0),h([t.Output()],s.prototype,"focusEvent",void 0),h([t.Output()],s.prototype,"blurEvent",void 0),h([t.Output()],s.prototype,"textChangeEvent",void 0),h([t.Output()],s.prototype,"clearInputEventEmitter",void 0),h([t.Output()],s.prototype,"prefillEventEmitter",void 0),s=h([t.Component({selector:"bp-street",template:'<span *ngIf="labelResourceKey">{{ labelResourceKey | translate}}</span>\n<div class="bpaac-dropdown">\n <div class="bpaac-search-bar">\n <div class="bpaac-input-width">\n \x3c!-- [disabled]="isDisabled()" --\x3e\n <input type="text" #streetSearchInput class="bpaac-input" \n [style.background-color]="!isParamsComplete() ? \'lightgrey\' : \'\'" \n [style.color]=" getTextColor() "\n [disabled]="!locality || locality.trim().length === 0" (keydown)="checkKeyDown($event)" \n (input)="onInputChange()" (click)="onInputClick()"\n [(ngModel)]="searchText" id="streetInputField" [attr.placeholder]="placeHolderText" autocomplete="off"\n (blur)="onBlur($event)" (focus)="onFocus()" />\n <div id="bpaac-clear-street-button" *ngIf="mayShowClearButton()" (click)="clearInput(true)" class="bpaac-clear">\n </div>\n </div>\n \x3c!--<div ng-transclude></div>--\x3e\n <input id="bpaac-street-typeahead" type="text" disabled autocomplete="off" [(ngModel)]="bpTypeAhead" />\n </div>\n <div [hidden]="collapseDropdown" class="bpaac-dropdown-menu-container" *ngIf="suggestions && suggestions.length>0">\n <div #streetList [appVisibleSuggestion]="visibleSuggesionCount" id="bpaac-street-dropdown" class="bpaac-dropdown-menu">\n <ul role="listbox" id="bpaac-street-suggestionsList" class="list-unstyled">\n <li role="option" *ngFor="let option of suggestions; let idx = index" [ngClass]="{\'active\':(selectedIndex==idx)}" (mousedown)="clickSuggestion($event, option)"\n (mouseenter)="selectedIndex=idx" (mouseleave)="selectedIndex=-1">\n <span *ngIf="option" [innerHtml]="option.string | highlightSuggestion : wordList"></span>\n </li>\n </ul>\n </div>\n </div>\n</div>\n',styles:[""]})],s)}(),k=function(){function s(e,s,i,r){this.addressService=e,this.localeService=s,this.translateService=i,this.unicodeService=r,this.showDebugMessageToConsole=!0,this.labelResourceKey="common.label.streetNumber",this.maxSuggesionCount=5,this.visibleSuggesionCount=5,this.sortCriteria="",this.messageOption="Y",this.messageChanged=new t.EventEmitter,this.addressChanged=new t.EventEmitter,this.focusEvent=new t.EventEmitter,this.blurEvent=new t.EventEmitter,this.textChangeEvent=new t.EventEmitter,this.emptyResponseEvent=new t.EventEmitter,this.clearInputEventEmitter=new t.EventEmitter,this.prefillEventEmitter=new t.EventEmitter,this.addressIsValidated=!1,this.addressIsComplete=!1,this.validationMessageCode=null,this.validationMessageOptions=null,this.prefilling=!1,this.isPrefillWithNoMatch=!1}return Object.defineProperty(s.prototype,"inputLang",{set:function(e){var t=this;this.localeService.changeLang(e),this.translateService.use(e).subscribe((function(e){t.onChangedLanguage()}))},enumerable:!0,configurable:!0}),s.prototype.ngOnInit=function(){this.searchText="",this.addressIsValidated=!1,this.addressIsComplete=!1,this.suggestionValidationMessage="",this.suggestions=[],this.previousIndex=-1,this.lastSearchValue="",this.wordList=[],this.suggestionsWordList=[],this.bpTypeAhead="",this.placeHolderText="",this.skipNextBlur=!1,this.errorCode=null,this.selectedIndex=-1,this.typeAheadWord="",this.collapseDropdown=!0,this.sequenceNumber=1,this.consumedNumber=1,this.setSearchText(""),this.setEmptyResponseText(),this.emptyResponse=!0,this.onChangedLanguage()},s.prototype.ngOnDestroy=function(){this.subscription&&this.subscription.unsubscribe()},s.prototype.onChangedLanguage=function(){var e=this;this.translateService.get("streetNumber.placeholder.input-placeholder").subscribe((function(t){e.placeHolderText=t,e.setEmptyResponseText()}))},s.prototype.ngAfterViewChecked=function(){if(this.selectionChanged){var e=this.streetNumberList.nativeElement;setTimeout((function(){var t=O.findSingle(e,"li.active");t&&O.scrollInView(e,t)}),1),this.selectionChanged=!1}},s.prototype.ngOnChanges=function(t){t&&(!t.hasOwnProperty("streetName")||t.streetName.firstChange||t.hasOwnProperty("prefillData")||this.prefilling||(this.minLevel=e.ADDRESSLEVEL.STREET_NUMBER,this.showDebugMessageToConsole&&console.warn("street number - ngOnchanges - streetName changes detection"),""===t.streetName.currentValue&&(this.clearWidget(),this.valueChanged())),!t.hasOwnProperty("inputText")||t.inputText.firstChange||this.prefilling||(this.showDebugMessageToConsole&&console.warn("street number - ngOnchanges - inputText changes detection",this.searchText,t.inputText.currentValue),this.notEqualIgnoreCase(this.searchText,t.inputText.currentValue)&&(this.showDebugMessageToConsole&&console.warn("street number - ngOnchanges - inputText changes detection -> calling clearWidget() !"),this.clearWidget(),this.searchText=t.inputText.currentValue)),t.hasOwnProperty("prefillData")&&!t.prefillData.firstChange&&(this.prefilling=!0,this.addressIsComplete=!1,this.searchText=this.loadParams(t.prefillData.currentValue),""!==this.searchText&&this.minLevel===e.ADDRESSLEVEL.STREET_NUMBER&&(this.collapseDropdown=!0,this.prefillData.prefillStreetNumber=this.transformStreetNumberInLowercaseAndWithoutDiacritics(this.prefillData.parameters.streetNumber),this.onInputChange(f.SOURCE_PREFILLED))))},s.prototype.transformStreetNumberInLowercaseAndWithoutDiacritics=function(e){var t=null;return null!=e&&(t=(t=this.unicodeService.removeDiacritics(e)).toLowerCase()),t},s.prototype.notEqualIgnoreCase=function(e,t){return e.toLowerCase()!==t.toLowerCase()},s.prototype.setEmptyResponseText=function(){this.emptyResponseText=this.translateService.instant("streetNumber.message.not-in-list")},s.prototype.onBlur=function(t){this.isBrowserIE()&&this.isDropdownClicked(t)?this.streetNumberSearchInput.nativeElement.focus():this.skipNextBlur?this.skipNextBlur=!1:(this.collapseDropdown=!0,this.blurEvent.emit(e.ADDRESSLEVEL.STREET_NUMBER))},s.prototype.isBrowserIE=function(){return/msie\s|trident\/|edge\//i.test(window.navigator.userAgent)},s.prototype.isDropdownClicked=function(e){return"bpaac-streetnumber-dropdown"===(e.explicitOriginalTarget||document.activeElement).id},s.prototype.onFocus=function(){this.collapseDropdown=!1,this.skipNextBlur=!1,this.focusEvent.emit(e.ADDRESSLEVEL.STREET_NUMBER)},s.prototype.valueChanged=function(){this.textChangeEvent.emit(this.searchText)},s.prototype.mayShowDropdown=function(){return this.suggestions.length>0&&!this.collapseDropdown},s.prototype.buildInputWordList=function(){this.wordList=this.searchText.split(/[\s, ]+/)},s.prototype.mayAddTypeAhead=function(){return 0!==this.searchText.length&&/[^\s, \\\/]$/.test(this.searchText)},s.prototype.buildTypeAhead=function(e){if(e===f.SOURCE_PREFILLED)return!1;if(this.mayAddTypeAhead()){var t=this.searchText.split(/[\s, ]+/),s=t[t.length-1];if(this.suggestions.some(function(e){return!(!e||!e.hasOwnProperty("string"))&&e.string.split(/[\s-]+/).some(function(e){if(this.stringStartsWithIgnoreDiacritics(e,s))return this.typeAheadWord=e,!0}.bind(this))}.bind(this))){var i=this.typeAheadWord.slice(s.length,this.typeAheadWord.length).toLowerCase();this.bpTypeAhead=this.searchText+i}}},s.prototype.stringStartsWithIgnoreDiacritics=function(e,t){return e=null!=e?e.toLowerCase():e,t=null!=t?t.toLowerCase():t,-1!==this.unicodeService.removeDiacritics(e).slice(0,t.length).toLowerCase().indexOf(this.unicodeService.removeDiacritics(t))},s.prototype.getBackgroundColor=function(){return this.isParamsComplete()?"":"lightgrey"},s.prototype.getTopSuggestions=function(e){var t=this;this.sequenceNumber+=1;var s=this.generateParameters();this.showDebugMessageToConsole&&console.log("STREET-NUMBER calling service params",s),this.searchText&&(this.subscription=this.addressService.getStreet(this.baseUrl,this.locality,this.postalCode,s).subscribe((function(s){t.showDebugMessageToConsole&&console.log("STREET-NUMBER service response",s),t.handleGetStreetResponse(s,e),e===f.SOURCE_PREFILLED?(t.isPrefillWithNoMatch=!0!==t.prefillData.prefillStreetNumberPerfectMatchFound,t.prefillAnalyzeData()):t.isPrefillWithNoMatch=!1}),(function(){return t.handleGetStreetError()})))},s.prototype.getTextColor=function(){return!0===this.isPrefillWithNoMatch?"orangered":""},s.prototype.prefillAnalyzeData=function(){!0===this.prefillData.prefillStreetNumberPerfectMatchFound&&(this.collapseDropdown=!0),this.prefillEventEmitter.emit(new B(e.ADDRESSLEVEL.STREET_NUMBER,this.prefillData))},s.prototype.loadParams=function(e){var t="";return null!==e&&null!==e.parameters&&(e.parameters.hasOwnProperty("minLevel")&&(this.minLevel=e.parameters.minLevel),e.parameters.hasOwnProperty("postalCode")&&this.isString(e.parameters.postalCode)&&(this.postalCode=e.parameters.postalCode),e.parameters.hasOwnProperty("municipalityName")&&this.isString(e.parameters.municipalityName)&&(this.locality=e.parameters.municipalityName),e.parameters.hasOwnProperty("streetName")&&this.isString(e.parameters.streetName)&&(this.streetName=e.parameters.streetName),e.parameters.hasOwnProperty("streetNumber")&&this.isString(e.parameters.streetNumber)&&this.isParamsComplete()&&(t=e.parameters.streetNumber)),t},s.prototype.isString=function(e){return null!=e&&e.constructor===String},s.prototype.isValid=function(e){return this.isString(e)&&""!==e},s.prototype.isParamsComplete=function(){return this.isValid(this.postalCode)&&this.isValid(this.locality)&&this.isValid(this.streetName)},s.prototype.generateParameters=function(){var e=new y({id:this.sequenceNumber,q:this.searchText,postalCode:this.postalCode,locality:this.locality,street:this.streetName,maxNumberOfSuggestions:this.maxSuggesionCount});return"S"===this.sortCriteria&&e.sortByStreetNb(!0),e},s.prototype.handleGetStreetResponse=function(e,t){e&&e.response&&e.response.sequenceNumber&&e.response.sequenceNumber>=this.consumedNumber&&e.response.topSuggestions&&(this.consumedNumber=e.response.sequenceNumber,this.clearSuggestions(),this.parseTopSuggestions(e.response.topSuggestions,t),this.buildTypeAhead(t),this.clearConnectionErrorMessage(),this.buildInputWordList()),this.collapseDropdown=!0===this.prefilling&&null!==this.prefillData&&!this.prefillData.parameters.onFocusShowSuggestionsAfterPrefill},s.prototype.handleGetStreetError=function(){this.setConnectionErrorMessage()},s.prototype.setConnectionErrorMessage=function(){this.errorCode="service-unavailable",this.emitTranslatedValidationMessage(e.ValidationMessageType.Service_Unavailable)},s.prototype.clearConnectionErrorMessage=function(){if(this.errorCode){var e=this.translateService.instant(this.errorCode);this.suggestionValidationMessage===e&&this.clearSuggestionValidationMessage(),this.errorCode=null}},s.prototype.parseTopSuggestions=function(e,t){var s,i;if(e.constructor===Array){try{for(var r=u(e),o=r.next();!o.done;o=r.next()){var n=o.value;this.parseSingleSuggestion(n,t)}}catch(e){s={error:e}}finally{try{o&&!o.done&&(i=r.return)&&i.call(r)}finally{if(s)throw s.error}}if(t){if(this.prefilling&&this.notInListAllowed&&!1===this.prefillData.prefillStreetNumberPerfectMatchFound&&null!==this.prefillData.prefillStreetNumber&&void 0!==this.prefillData.prefillStreetNumber&&this.prefillData.prefillStreetNumber.length>0){var a=this.prefillBuildNotInListSuggestion();this.showDebugMessageToConsole&&console.log("STREET NUMBER - PREFILL NOT IN LIST SUGGESTION:",a),this.prefillCheckForPerfectMatch(a)}}else(0===e.length||this.emptyResponse)&&this.notInListAllowed&&this.suggestions.push({string:this.searchText,"not-in-list":!0})}else this.parseSingleSuggestion(e,t)},s.prototype.prefillBuildNotInListSuggestion=function(){var e={string:this.searchText,"not-in-list":!0},t=this.prefillData.prefillStreetPerfectMatchSuggestion,s=p(p({},t.address),e);delete s.mailBoxid,delete s.suffixId,s.houseNumber=s.string,s.searchBarString=s.string;var i=!1;if(this.prefillData.parameters.hasOwnProperty("boxNumber")){var r=this.prefillData.parameters.boxNumber;i=!(null!=r&&r.length>0)}else i=!0;return!0===i&&(s.isComplete=i),t.address=s,t},s.prototype.parseSingleSuggestion=function(e,t){var s;this.localeService.isLocaleFrench()&&e.hasOwnProperty("french")?s=e.french:this.localeService.isLocaleDutch()&&e.hasOwnProperty("dutch")?s=e.dutch:this.localeService.isLocaleGerman()&&e.hasOwnProperty("german")?s=e.german:e.hasOwnProperty("address")&&(s=e.address),s&&(e.messages&&(s.messages=e.messages),s.houseNumber===this.searchText&&(this.emptyResponse=!1),this.suggestions.push(s),this.showDebugMessageToConsole&&console.log("streetNumber - add suggestion to list",s),t===f.SOURCE_PREFILLED&&(e.address=s,this.prefillCheckForPerfectMatch(e)))},s.prototype.prefillCheckForPerfectMatch=function(e){if(this.addressIsComplete)this.showDebugMessageToConsole&&console.log("streetNumber::prefillCheckForPerfectMatch - Address complete, skipping suggestion check",e);else{this.showDebugMessageToConsole&&console.log("streetNumber - checking suggestion for perfect match",this.prefillData,e);var t=e.address,s=this.transformStreetNumberInLowercaseAndWithoutDiacritics(""+t.houseNumber);this.showDebugMessageToConsole&&console.log("comparing street numbers",s,this.prefillData.prefillStreetNumber),s===""+this.prefillData.prefillStreetNumber&&(this.prefillData.prefillStreetNumberPerfectMatchFound=!0,this.prefillData.prefillStreetNumberPerfectMatchSuggestion=e,this.searchText=t.houseNumber,t.hasOwnProperty("isComplete")&&!0===t.isComplete&&(this.clickSuggestion(null,t),this.addressIsComplete=!0,this.showDebugMessageToConsole&&!0===this.addressIsComplete&&console.log("ADDRESS COMPLETE ON STREET NUMBER !")))}},s.prototype.onInputChange=function(e){this.showDebugMessageToConsole&&console.log("streetNumber::onInputChange",e),this.collapseDropdown=!1,this.addressIsValidated=!1,this.addressIsComplete=!1,this.emptyResponse=!0,this.resetArrowSelectedIndex(),e||(this.prefilling=!1,this.showDebugMessageToConsole&&console.log("streetNumber::onInputChange -> calling valueChanged"),this.valueChanged()),this.clearSuggestionValidationMessage(),""===this.searchText?(this.sequenceNumber+=1,this.consumedNumber=this.sequenceNumber,this.clearSuggestions()):this.getTopSuggestions(e),this.buildInputWordList()},s.prototype.clickSuggestion=function(e,t){if(this.isPrefillWithNoMatch=!1,this.showDebugMessageToConsole&&console.log("streetNumber::clickSuggestion",e,t),null==e||e.preventDefault(),t){this.clearTypeAhead(),this.resetArrowSelectedIndex(),t.string&&this.setSearchText(t.string),this.collapseDropdown=!0;var s=t["not-in-list"],i=null!=s&&!0===s;t["not-in-list"]&&(t=this.modifySelectedAddress(t),this.showDebugMessageToConsole&&console.log("streetNumber::clickSuggestion - NOT-IN-LIST",e,t)),t.hasOwnProperty("isComplete")&&!0===t.isComplete&&!i&&(this.addressIsComplete=!0),this.addressIsValidated=!0,e&&this.clearSuggestions(),this.setSelectedAddress(t)}},s.prototype.modifySelectedAddress=function(e){this.showDebugMessageToConsole&&console.log("street number - combine selectedAddress with not in list",e,this.selectedAddress);var t=p(p({},this.selectedAddress),e);return delete t.latitude,delete t.longitude,delete t.mailboxId,delete t.pdpId,delete t.suffixId,delete t.pdpId,delete t.pdpId,t.houseNumber=t.string,t.searchBarString=t.string,t.isComplete=!0,t},s.prototype.setSelectedAddress=function(e){var t=e["not-in-list"],s=null!=t&&!0===t;this.addressIsComplete=!(!e.hasOwnProperty("isComplete")||!0!==e.isComplete||s),this.addressChanged.emit(e)},s.prototype.clearSelectedAddress=function(){this.addressChanged.emit(null),this.addressIsValidated=!1,this.addressIsComplete=!1},s.prototype.emitTranslatedValidationMessage=function(t,s){if(null!=t)switch(t){case e.ValidationMessageType.Address_Not_Found:case e.ValidationMessageType.Address_Validated:case e.ValidationMessageType.Service_Unavailable:var i=this.translateService.instant(t);this.messageChanged.emit({messageType:t,translatedMessage:i});break;default:console.error("Unable to emit validation message - message key NOT supported!",t)}else console.warn("Unable to emit validation message - message key is invalid!",t)},s.prototype.notifyAddressIsValidated=function(){this.addressIsComplete=!0,this.emitTranslatedValidationMessage(e.ValidationMessageType.Address_Validated)},s.prototype.checkKeyDown=function(e){switch(e.which){case 40:e.preventDefault(),this.moveArrowSelectedIndexDown();break;case 38:e.preventDefault(),this.moveArrowSelectedIndexUp();break;case 39:e.preventDefault(),this.cursorIsOnSuggestionList()?this.clickSuggestion(e,this.suggestions[this.selectedIndex]):this.typeAheadWord&&this.typeAheadIsShown()&&(this.setSearchText(this.bpTypeAhead),this.typeAheadWord="");break;case 9:this.addressIsValidated||e.shiftKey||(e.preventDefault(),this.selectFirstInListOfSuggesions());break;case 46:e.ctrlKey&&this.clearWidget();break;case 13:e.preventDefault(),this.cursorIsOnSuggestionList()&&this.clickSuggestion(e,this.suggestions[this.selectedIndex]);break;default:this.clearTypeAhead()}},s.prototype.clearWidget=function(){this.showDebugMessageToConsole&&console.log("street number:: clearWidget"),this.addressIsValidated=!1,this.addressIsComplete=!1,this.clearSearchText(),this.clearSuggestions(),this.clearTypeAhead(),this.prefillData=null},s.prototype.clearSearchText=function(){this.searchText=""},s.prototype.typeAheadIsShown=function(){return this.bpTypeAhead&&this.bpTypeAhead.length>0},s.prototype.resetArrowSelectedIndex=function(){this.selectedIndex=-1},s.prototype.moveArrowSelectedIndexDown=function(){this.selectedIndex+1!==this.suggestions.length&&(this.selectedIndex++,this.changeSelection(),this.setSearchTextBasedOnArrowSelection(this.selectedIndex,this.selectedIndex-1))},s.prototype.moveArrowSelectedIndexUp=function(){this.selectedIndex-1!=-2&&(this.selectedIndex--,this.changeSelection(),this.setSearchTextBasedOnArrowSelection(this.selectedIndex,this.selectedIndex+1))},s.prototype.cursorIsOnSuggestionList=function(){return this.selectedIndex>=0},s.prototype.setSearchTextBasedOnArrowSelection=function(e,t){void 0===e||this.suggestions.length<=0||(-1!==e?(-1===t&&(this.lastSearchValue=this.searchText),this.setSearchText(this.suggestions[this.selectedIndex].string),this.clearTypeAhead()):this.setSearchText(this.lastSearchValue))},s.prototype.mayShowClearButton=function(){return this.searchText&&this.searchText.length>0},s.prototype.onClearStreetNumberInput=function(e,t){void 0===t&&(t=!0),this.clearWidget(),this.resetArrowSelectedIndex(),this.previousIndex=-1,this.lastSearchValue="",this.clearSuggestionValidationMessage(),this.valueChanged(),this.clearConnectionErrorMessage(),!0===e&&this.streetNumberSearchInput.nativeElement.focus(),t&&this.clearInputEventEmitter.emit(P.STREET_NUMBER)},s.prototype.clearSuggestions=function(){this.wordList=[],this.suggestions=[],this.suggestionsWordList=[]},s.prototype.clearTypeAhead=function(){this.bpTypeAhead=""},s.prototype.clearSuggestionValidationMessage=function(){this.suggestionValidationMessage="",this.addressIsValidated=!1,this.messageChanged.emit({messageType:null,translatedMessage:this.suggestionValidationMessage}),this.validationMessageOptions=null,this.validationMessageCode=null},s.prototype.setSearchText=function(e){this.searchText=e},s.prototype.selectFirstInListOfSuggesions=function(){this.selectedIndex=0,this.changeSelection(),this.setSearchTextBasedOnArrowSelection(this.selectedIndex,this.selectedIndex-1)},s.prototype.changeSelection=function(){this.suggestions.length>0&&(this.selectionChanged=!0)},s.prototype.suggestionMouseLeave=function(){this.selectedIndex=-1},s.prototype.showAddressNotFoundMessage=function(){this.emitTranslatedValidationMessage(e.ValidationMessageType.Address_Not_Found)},s.prototype.isDisabled=function(){return""===this.locality||""===this.postalCode||this.minLevel>e.ADDRESSLEVEL.STREET_NUMBER},s.prototype.onInputClick=function(){this.showDebugMessageToConsole&&console.log("street number click")},s.ctorParameters=function(){return[{type:L},{type:D},{type:o.TranslateService},{type:A}]},h([t.ViewChild("streetNumberSearchInput",{static:!1})],s.prototype,"streetNumberSearchInput",void 0),h([t.ViewChild("streetNumberList",{static:!1})],s.prototype,"streetNumberList",void 0),h([t.Input()],s.prototype,"prefillData",void 0),h([t.Input()],s.prototype,"showDebugMessageToConsole",void 0),h([t.Input()],s.prototype,"labelResourceKey",void 0),h([t.Input()],s.prototype,"maxSuggesionCount",void 0),h([t.Input()],s.prototype,"visibleSuggesionCount",void 0),h([t.Input()],s.prototype,"sortCriteria",void 0),h([t.Input()],s.prototype,"baseUrl",void 0),h([t.Input()],s.prototype,"addressParams",void 0),h([t.Input()],s.prototype,"postalCode",void 0),h([t.Input()],s.prototype,"locality",void 0),h([t.Input()],s.prototype,"streetName",void 0),h([t.Input()],s.prototype,"notInListAllowed",void 0),h([t.Input()],s.prototype,"selectedAddress",void 0),h([t.Input()],s.prototype,"inputLang",null),h([t.Input()],s.prototype,"messageOption",void 0),h([t.Input()],s.prototype,"inputText",void 0),h([t.Output()],s.prototype,"messageChanged",void 0),h([t.Output()],s.prototype,"addressChanged",void 0),h([t.Output()],s.prototype,"focusEvent",void 0),h([t.Output()],s.prototype,"blurEvent",void 0),h([t.Output()],s.prototype,"textChangeEvent",void 0),h([t.Output()],s.prototype,"emptyResponseEvent",void 0),h([t.Output()],s.prototype,"clearInputEventEmitter",void 0),h([t.Output()],s.prototype,"prefillEventEmitter",void 0),s=h([t.Component({selector:"bp-street-number",template:'<span *ngIf="labelResourceKey">{{ labelResourceKey | translate}}</span>\n<div class="bpaac-dropdown">\n <div class="bpaac-search-bar">\n <div class="bpaac-input-width">\n \x3c!-- [disabled]="isDisabled()" --\x3e\n <input type="text" #streetNumberSearchInput class="bpaac-input" \n [style.background-color]="!isParamsComplete() ? \'lightgrey\' : \'\'" \n [style.color]=" getTextColor() "\n [disabled]="!streetName || streetName.trim().length === 0" (keydown)="checkKeyDown($event)" \n (input)="onInputChange()" (click)="onInputClick()"\n [(ngModel)]="searchText" id="streetNumberInputField" \n [attr.title]="placeHolderText" \n [attr.placeholder]="placeHolderText" autocomplete="off"\n (blur)="onBlur($event)" (focus)="onFocus()" />\n <div id="bpaac-clear-streetNb-button" *ngIf="mayShowClearButton()" \n (click)="onClearStreetNumberInput(true)" class="bpaac-clear">\n </div>\n </div>\n \x3c!--<div ng-transclude></div>--\x3e\n <input id="bpaac-streetNb-typeahead" type="text" disabled autocomplete="off" [(ngModel)]="bpTypeAhead" />\n \x3c!-- <span>addressIsComplete: {{ addressIsComplete }}. </span>\n <span>addressIsValidated: {{ addressIsValidated }}. </span> --\x3e\n <span *ngIf="addressIsComplete" class="streetNbChekmark"><span class="checkmark"></span></span>\n </div>\n <div [hidden]="collapseDropdown" class="bpaac-dropdown-menu-container" *ngIf="suggestions && suggestions.length>0">\n <div #streetNumberList [appVisibleSuggestion]="visibleSuggesionCount" \n id="bpaac-streetnumber-dropdown" class="bpaac-dropdown-menu">\n <ul role="listbox" id="bpaac-streetNb-suggestionsList" class="list-unstyled">\n <li role="option" *ngFor="let option of suggestions; let idx = index" [ngClass]="{\'active\':(selectedIndex==idx)}" (mousedown)="clickSuggestion($event, option)"\n (mouseenter)="selectedIndex=idx" (mouseleave)="selectedIndex=-1">\n <span *ngIf="option" [innerHtml]="option[\'not-in-list\'] ? emptyResponseText : option.string | highlightSuggestion : wordList"></span>\n </li>\n </ul>\n </div>\n </div>\n</div>',styles:[""]})],s)}(),W=function(){function s(e,s,i,r){this.addressService=e,this.localeService=s,this.translateService=i,this.unicodeService=r,this.showDebugMessageToConsole=!1,this.labelResourceKey="common.label.boxNumber",this.maxSuggesionCount=5,this.visibleSuggesionCount=5,this.sortCriteria="",this.messageOption="Y",this.messageChanged=new t.EventEmitter,this.addressChanged=new t.EventEmitter,this.focusEvent=new t.EventEmitter,this.blurEvent=new t.EventEmitter,this.textChangeEvent=new t.EventEmitter,this.emptyResponseEvent=new t.EventEmitter,this.clearInputEventEmitter=new t.EventEmitter,this.prefillEventEmitter=new t.EventEmitter,this.validationMessageCode=null,this.validationMessageOptions=null,this.prefilling=!1,this.isPrefillWithNoMatch=!1}return Object.defineProperty(s.prototype,"inputLang",{set:function(e){var t=this;this.localeService.changeLang(e),this.translateService.use(e).subscribe((function(e){t.onChangedLanguage()}))},enumerable:!0,configurable:!0}),s.prototype.ngOnInit=function(){this.searchText="",this.addressIsValidated=!1,this.suggestionValidationMessage="",this.suggestions=[],this.previousIndex=-1,this.lastSearchValue="",this.wordList=[],this.suggestionsWordList=[],this.bpTypeAhead="",this.placeHolderText="",this.skipNextBlur=!1,this.errorCode=null,this.selectedIndex=-1,this.typeAheadWord="",this.collapseDropdown=!0,this.sequenceNumber=1,this.consumedNumber=1,this.setSearchText(""),this.setEmptyResponseText(),this.emptyResponse=!0,this.onChangedLanguage()},s.prototype.ngAfterViewChecked=function(){if(this.selectionChanged){var e=this.boxNumberList.nativeElement;setTimeout((function(){var t=O.findSingle(e,"li.active");t&&O.scrollInView(e,t)}),1),this.selectionChanged=!1}},s.prototype.ngOnChanges=function(t){t&&(t.hasOwnProperty("prefillData")&&!t.prefillData.firstChange&&(this.prefilling=!0,this.searchText=this.loadParams(t.prefillData.currentValue),""!==this.searchText&&this.minLevel===e.ADDRESSLEVEL.BOX_NUMBER&&(this.collapseDropdown=!0,this.prefillData.prefillBoxNumber=this.transformBoxNumberInLowercaseAndWithoutDiacritics(this.prefillData.parameters.boxNumber),this.onInputChange(f.SOURCE_PREFILLED))),!t.hasOwnProperty("streetNumber")||t.streetNumber.firstChange||t.hasOwnProperty("prefillData")||(this.minLevel=e.ADDRESSLEVEL.BOX_NUMBER,this.clearWidget(),this.valueChanged()))},s.prototype.transformBoxNumberInLowercaseAndWithoutDiacritics=function(e){var t=null;return null!=e&&(t=(t=this.unicodeService.removeDiacritics(e)).toLowerCase()),t},s.prototype.ngOnDestroy=function(){this.subscription&&this.subscription.unsubscribe()},s.prototype.onChangedLanguage=function(){var e=this;this.translateService.get("boxNumber.placeholder.input-placeholder").subscribe((function(t){e.placeHolderText=t,e.setEmptyResponseText()}))},s.prototype.setEmptyResponseText=function(){this.emptyResponseText=this.translateService.instant("boxNumber.message.not-in-list")},s.prototype.onClearInputEvent=function(e,t){this.clearInput(t)},s.prototype.onBlur=function(t){this.isBrowserIE()&&this.isDropdownClicked(t)?this.boxNumberSearchInput.nativeElement.focus():this.skipNextBlur?this.skipNextBlur=!1:(this.collapseDropdown=!0,this.blurEvent.emit(e.ADDRESSLEVEL.BOX_NUMBER))},s.prototype.isBrowserIE=function(){return/msie\s|trident\/|edge\//i.test(window.navigator.userAgent)},s.prototype.isDropdownClicked=function(e){return"bpaac-box-dropdown"===(e.explicitOriginalTarget||document.activeElement).id},s.prototype.onFocus=function(){this.collapseDropdown=!1,this.skipNextBlur=!1,this.focusEvent.emit(e.ADDRESSLEVEL.BOX_NUMBER)},s.prototype.valueChanged=function(){this.textChangeEvent.emit(this.searchText)},s.prototype.mayShowDropdown=function(){return this.suggestions.length>0&&!this.collapseDropdown},s.prototype.buildInputWordList=function(){this.wordList=this.searchText.split(/[\s, ]+/)},s.prototype.mayAddTypeAhead=function(e){return e!==f.SOURCE_PREFILLED&&(0!==this.searchText.length&&/[^\s, \\\/]$/.test(this.searchText))},s.prototype.buildTypeAhead=function(e){if(this.mayAddTypeAhead(e)){var t=this.searchText.split(/[\s, ]+/),s=t[t.length-1];if(this.suggestions.some(function(e){return!(!e||!e.hasOwnProperty("string"))&&e.string.split(/[\s-]+/).some(function(e){if(this.stringStartsWithIgnoreDiacritics(e,s))return this.typeAheadWord=e,!0}.bind(this))}.bind(this))){var i=this.typeAheadWord.slice(s.length,this.typeAheadWord.length).toLowerCase();this.bpTypeAhead=this.searchText+i}}},s.prototype.stringStartsWithIgnoreDiacritics=function(e,t){return e=null!=e?e.toLowerCase():e,t=null!=t?t.toLowerCase():t,-1!==this.unicodeService.removeDiacritics(e).slice(0,t.length).toLowerCase().indexOf(this.unicodeService.removeDiacritics(t))},s.prototype.getTopSuggestions=function(e){var t=this;this.sequenceNumber+=1;var s=this.generateParameters();this.showDebugMessageToConsole&&console.log("BOX-NUMBER calling service params",s),this.searchText&&(this.subscription=this.addressService.getBox(this.baseUrl,this.locality,this.postalCode,s).subscribe((function(s){t.handleGetBoxResponse(s,e),e===f.SOURCE_PREFILLED?(t.isPrefillWithNoMatch=!0!==t.prefillData.prefillBoxNumberPerfectMatchFound,t.prefillAnalyzeData()):t.isPrefillWithNoMatch=!1}),(function(){return t.handleGetBoxError()})))},s.prototype.getTextColor=function(){return!0===this.isPrefillWithNoMatch?"orangered":""},s.prototype.prefillAnalyzeData=function(){!0===this.prefillData.prefillBoxNumberPerfectMatchFound&&(this.collapseDropdown=!0),this.prefillEventEmitter.emit(new B(e.ADDRESSLEVEL.BOX_NUMBER,this.prefillData))},s.prototype.loadParams=function(e){var t="";return null!==e&&null!==e.parameters&&(e.parameters.hasOwnProperty("minLevel")&&(this.minLevel=e.parameters.minLevel),e.parameters.hasOwnProperty("postalCode")&&this.isString(e.parameters.postalCode)&&(this.postalCode=e.parameters.postalCode),e.parameters.hasOwnProperty("municipalityName")&&this.isString(e.parameters.municipalityName)&&(this.locality=e.parameters.municipalityName),e.parameters.hasOwnProperty("streetName")&&this.isString(e.parameters.streetName)&&(this.streetName=e.parameters.streetName),e.parameters.hasOwnProperty("streetNumber")&&this.isString(e.parameters.streetNumber)&&(this.streetNumber=e.parameters.streetNumber),e.parameters.hasOwnProperty("boxNumber")&&this.isString(e.parameters.boxNumber)&&this.isParamsComplete()&&(t=e.parameters.boxNumber)),t},s.prototype.isString=function(e){return null!=e&&e.constructor===String},s.prototype.isValid=function(e){return this.isString(e)&&""!==e},s.prototype.isParamsComplete=function(){return this.isValid(this.postalCode)&&this.isValid(this.locality)&&this.isValid(this.streetName)&&this.isValid(this.streetNumber)},s.prototype.generateParameters=function(){var e=new y({id:this.sequenceNumber,q:this.searchText,postalCode:this.postalCode,locality:this.locality,street:this.streetName,streetNumber:this.streetNumber,maxNumberOfSuggestions:this.maxSuggesionCount});return"B"===this.sortCriteria&&e.sortByBox(!0),e},s.prototype.handleGetBoxResponse=function(e,t){e&&e.response&&e.response.sequenceNumber&&e.response.sequenceNumber>=this.consumedNumber&&e.response.topSuggestions&&(this.consumedNumber=e.response.sequenceNumber,this.clearSuggestions(),this.parseTopSuggestions(e.response.topSuggestions,t),this.buildTypeAhead(t),this.clearConnectionErrorMessage(),this.buildInputWordList()),this.collapseDropdown=!0===this.prefilling&&null!==this.prefillData&&!this.prefillData.parameters.onFocusShowSuggestionsAfterPrefill},s.prototype.handleGetBoxError=function(){this.setConnectionErrorMessage()},s.prototype.setConnectionErrorMessage=function(){this.errorCode="service-unavailable",this.emitTranslatedValidationMessage(e.ValidationMessageType.Service_Unavailable)},s.prototype.clearConnectionErrorMessage=function(){if(this.errorCode){var e=this.translateService.instant(this.errorCode);this.suggestionValidationMessage===e&&this.clearSuggestionValidationMessage(),this.errorCode=null}},s.prototype.parseTopSuggestions=function(e,t){var s,i;if(e.constructor===Array){try{for(var r=u(e),o=r.next();!o.done;o=r.next()){var n=o.value;this.parseSingleSuggestion(n,t)}}catch(e){s={error:e}}finally{try{o&&!o.done&&(i=r.return)&&i.call(r)}finally{if(s)throw s.error}}if(t){if(this.prefilling&&this.notInListAllowed&&!1===this.prefillData.prefillBoxNumberPerfectMatchFound&&null!==this.prefillData.prefillBoxNumber&&void 0!==this.prefillData.prefillBoxNumber&&this.prefillData.prefillBoxNumber.length>0){var a=this.prefillBuildNotInListSuggestion();this.showDebugMessageToConsole&&console.log("BOX NUMBER - PREFILL NOT IN LIST SUGGESTION:",a),this.prefillCheckForPerfectMatch(a)}}else(0===e.length||this.emptyResponse)&&this.notInListAllowed&&this.suggestions.push({string:this.searchText,"not-in-list":!0})}else this.parseSingleSuggestion(e,t)},s.prototype.prefillBuildNotInListSuggestion=function(){var e={string:this.searchText,"not-in-list":!0},t=this.prefillData.prefillStreetNumberPerfectMatchSuggestion,s=p(p({},t.address),e);return delete s.mailBoxid,delete s.suffixId,s.boxNumber=s.string,s.searchBarString=s.string,s.isComplete=!0,t.address=s,t},s.prototype.parseSingleSuggestion=function(e,t){var s;this.localeService.isLocaleFrench()&&e.hasOwnProperty("french")?s=e.french:this.localeService.isLocaleDutch()&&e.hasOwnProperty("dutch")?s=e.dutch:this.localeService.isLocaleGerman()&&e.hasOwnProperty("german")?s=e.german:e.hasOwnProperty("address")&&(s=e.address),s&&(e.messages&&(s.messages=e.messages),s.boxNumber===this.searchText&&(this.emptyResponse=!1),this.suggestions.push(s),t===f.SOURCE_PREFILLED&&(e.address=s,this.prefillCheckForPerfectMatch(e)))},s.prototype.prefillCheckForPerfectMatch=function(e){this.showDebugMessageToConsole&&console.log("box number - checking suggestion for perfect match",this.prefillData,e);var t=e.address,s=this.transformBoxNumberInLowercaseAndWithoutDiacritics(""+t.boxNumber);this.showDebugMessageToConsole&&console.log("comparing box numbers",s,this.prefillData.prefillBoxNumber),s===""+this.prefillData.prefillBoxNumber&&(this.prefillData.prefillBoxNumberPerfectMatchFound=!0,this.prefillData.prefillBoxNumberPerfectMatchSuggestion=e,this.searchText=t.boxNumber,t.hasOwnProperty("isComplete")&&!0===t.isComplete&&(this.clickSuggestion(null,t),this.showDebugMessageToConsole&&console.log("ADDRESS COMPLETE ON BOX NUMBER !")))},s.prototype.onInputChange=function(e){this.collapseDropdown=!1,this.emptyResponse=!0,this.resetArrowSelectedIndex(),e||(this.prefilling=!1,this.valueChanged()),this.clearSuggestionValidationMessage(),""===this.searchText?(this.sequenceNumber+=1,this.consumedNumber=this.sequenceNumber,this.clearSuggestions()):this.getTopSuggestions(e),this.buildInputWordList()},s.prototype.clickSuggestion=function(e,t){this.isPrefillWithNoMatch=!1,null==e||e.preventDefault(),t&&(this.clearTypeAhead(),this.resetArrowSelectedIndex(),t.string&&this.setSearchText(t.string),this.collapseDropdown=!0,t["not-in-list"]&&(t=this.modifySelectedAddress(t)),this.addressIsValidated=!0,t.isComplete=!0,this.setSelectedAddress(t))},s.prototype.modifySelectedAddress=function(e){var t=p(p({},this.selectedAddress),e);return delete t.mailBoxid,delete t.suffixId,t.boxNumber=t.string,t.searchBarString=t.string,t.isComplete=!0,t},s.prototype.setSelectedAddress=function(e){this.addressIsValidated=!(!e.hasOwnProperty("isComplete")||!0!==e.isComplete),this.addressChanged.emit(e)},s.prototype.clearSelectedAddress=function(){this.addressChanged.emit(null),this.addressIsValidated=!1},s.prototype.emitTranslatedValidationMessage=function(t,s){if(null!=t)switch(t){case e.ValidationMessageType.Address_Not_Found:case e.ValidationMessageType.Address_Validated:case e.ValidationMessageType.Service_Unavailable:var i=this.translateService.instant(t);this.messageChanged.emit({messageType:t,translatedMessage:i});break;default:console.error("Unable to emit validation message - message key NOT supported!",t)}else console.warn("Unable to emit validation message - message key is invalid!",t)},s.prototype.showAddressIsValidated=function(){this.emitTranslatedValidationMessage(e.ValidationMessageType.Address_Validated)},s.prototype.checkKeyDown=function(e){switch(e.which){case 40:e.preventDefault(),this.moveArrowSelectedIndexDown();break;case 38:e.preventDefault(),this.moveArrowSelectedIndexUp();break;case 39:e.preventDefault(),this.cursorIsOnSuggestionList()?this.clickSuggestion(e,this.suggestions[this.selectedIndex]):this.typeAheadWord&&this.typeAheadIsShown()&&(this.setSearchText(this.bpTypeAhead),this.typeAheadWord="");break;case 9:this.addressIsValidated||e.shiftKey||(e.preventDefault(),this.selectFirstInListOfSuggesions());break;case 46:e.ctrlKey&&this.clearWidget();break;case 13:e.preventDefault(),this.cursorIsOnSuggestionList()&&this.clickSuggestion(e,this.suggestions[this.selectedIndex]);break;default:this.clearTypeAhead()}},s.prototype.clearWidget=function(){this.addressIsValidated=!1,this.clearSearchText(),this.clearSuggestions(),this.clearTypeAhead(),this.prefillData=null},s.prototype.clearSearchText=function(){this.searchText=""},s.prototype.typeAheadIsShown=function(){return this.bpTypeAhead&&this.bpTypeAhead.length>0},s.prototype.resetArrowSelectedIndex=function(){this.selectedIndex=-1},s.prototype.moveArrowSelectedIndexDown=function(){this.selectedIndex+1!==this.suggestions.length&&(this.selectedIndex++,this.changeSelection(),this.setSearchTextBasedOnArrowSelection(this.selectedIndex,this.selectedIndex-1))},s.prototype.moveArrowSelectedIndexUp=function(){this.selectedIndex-1!=-2&&(this.selectedIndex--,this.changeSelection(),this.setSearchTextBasedOnArrowSelection(this.selectedIndex,this.selectedIndex+1))},s.prototype.cursorIsOnSuggestionList=function(){return this.selectedIndex>=0},s.prototype.setSearchTextBasedOnArrowSelection=function(e,t){void 0===e||this.suggestions.length<=0||(-1!==e?(-1===t&&(this.lastSearchValue=this.searchText),this.setSearchText(this.suggestions[this.selectedIndex].string),this.clearTypeAhead()):this.setSearchText(this.lastSearchValue))},s.prototype.mayShowClearButton=function(){return this.searchText.length>0},s.prototype.clearInput=function(e,t){void 0===t&&(t=!0),this.clearWidget(),this.resetArrowSelectedIndex(),this.previousIndex=-1,this.lastSearchValue="",this.clearSuggestionValidationMessage(),this.valueChanged(),this.clearConnectionErrorMessage(),!0===e&&this.boxNumberSearchInput.nativeElement.focus(),t&&this.clearInputEventEmitter.emit(P.BOX_NUMBER)},s.prototype.clearSuggestions=function(){this.wordList=[],this.suggestions=[],this.suggestionsWordList=[]},s.prototype.clearTypeAhead=function(){this.bpTypeAhead=""},s.prototype.clearSuggestionValidationMessage=function(){this.suggestionValidationMessage="",this.addressIsValidated=!1,this.messageChanged.emit({messageType:null,translatedMessage:this.suggestionValidationMessage}),this.validationMessageOptions=null,this.validationMessageCode=null},s.prototype.setSearchText=function(e){this.searchText=e},s.prototype.selectFirstInListOfSuggesions=function(){this.selectedIndex=0,this.changeSelection(),this.setSearchTextBasedOnArrowSelection(this.selectedIndex,this.selectedIndex-1)},s.prototype.changeSelection=function(){this.suggestions.length>0&&(this.selectionChanged=!0)},s.prototype.suggestionMouseLeave=function(){this.selectedIndex=-1},s.prototype.showAddressNotFoundMessage=function(){this.emitTranslatedValidationMessage(e.ValidationMessageType.Address_Not_Found)},s.prototype.isDisabled=function(){return""===this.locality||""===this.postalCode||this.minLevel>e.ADDRESSLEVEL.BOX_NUMBER},s.prototype.onInputClick=function(){this.showDebugMessageToConsole&&console.log("box number click")},s.ctorParameters=function(){return[{type:L},{type:D},{type:o.TranslateService},{type:A}]},h([t.ViewChild("boxNumberSearchInput",{static:!1})],s.prototype,"boxNumberSearchInput",void 0),h([t.ViewChild("boxNumberList",{static:!1})],s.prototype,"boxNumberList",void 0),h([t.Input()],s.prototype,"prefillData",void 0),h([t.Input()],s.prototype,"showDebugMessageToConsole",void 0),h([t.Input()],s.prototype,"labelResourceKey",void 0),h([t.Input()],s.prototype,"maxSuggesionCount",void 0),h([t.Input()],s.prototype,"visibleSuggesionCount",void 0),h([t.Input()],s.prototype,"sortCriteria",void 0),h([t.Input()],s.prototype,"baseUrl",void 0),h([t.Input()],s.prototype,"addressParams",void 0),h([t.Input()],s.prototype,"postalCode",void 0),h([t.Input()],s.prototype,"locality",void 0),h([t.Input()],s.prototype,"streetName",void 0),h([t.Input()],s.prototype,"streetNumber",void 0),h([t.Input()],s.prototype,"selectedAddress",void 0),h([t.Input()],s.prototype,"notInListAllowed",void 0),h([t.Input()],s.prototype,"inputLang",null),h([t.Input()],s.prototype,"messageOption",void 0),h([t.Output()],s.prototype,"messageChanged",void 0),h([t.Output()],s.prototype,"addressChanged",void 0),h([t.Output()],s.prototype,"focusEvent",void 0),h([t.Output()],s.prototype,"blurEvent",void 0),h([t.Output()],s.prototype,"textChangeEvent",void 0),h([t.Output()],s.prototype,"emptyResponseEvent",void 0),h([t.Output()],s.prototype,"clearInputEventEmitter",void 0),h([t.Output()],s.prototype,"prefillEventEmitter",void 0),s=h([t.Component({selector:"bp-box-number",template:'<span *ngIf="labelResourceKey">{{ labelResourceKey | translate}}</span>\n<div class="bpaac-dropdown">\n <div class="bpaac-search-bar">\n <div class="bpaac-input-width">\n \x3c!-- [disabled]="isDisabled()" --\x3e\n <input type="text" #boxNumberSearchInput class="bpaac-input" \n [style.background-color]="!isParamsComplete() ? \'lightgrey\' : \'\'" \n [style.color]=" getTextColor() "\n [disabled]="!streetNumber || streetNumber.trim().length === 0" (keydown)="checkKeyDown($event)" \n (input)="onInputChange()" (click)="onInputClick()"\n [(ngModel)]="searchText" id="boxNumberInputField" [attr.title]="placeHolderText" [attr.placeholder]="placeHolderText" autocomplete="off"\n (blur)="onBlur($event)" (focus)="onFocus()" />\n <div id="bpaac-clear-boxNb-button" *ngIf="mayShowClearButton()" (click)="clearInput(true)" class="bpaac-clear">\n </div>\n </div>\n \x3c!--<div ng-transclude></div>--\x3e\n <input id="bpaac-boxNb-typeahead" type="text" disabled autocomplete="off" [(ngModel)]="bpTypeAhead" />\n <span *ngIf="addressIsValidated" class="boxNbChekmark"><span class="checkmark"></span></span>\n </div>\n <div [hidden]="collapseDropdown" class="bpaac-dropdown-menu-container" *ngIf="suggestions && suggestions.length>0">\n <div #boxNumberList [appVisibleSuggestion]="visibleSuggesionCount" id="bpaac-box-dropdown" class="bpaac-dropdown-menu">\n <ul role="listbox" id="bpaac-boxNb-suggestionsList" class="list-unstyled">\n <li role="option" *ngFor="let option of suggestions; let idx = index" [ngClass]="{\'active\':(selectedIndex==idx)}" \n (mousedown)="clickSuggestion($event, option)"\n (mouseenter)="selectedIndex=idx" (mouseleave)="selectedIndex=-1">\n <span *ngIf="option" [innerHtml]="option[\'not-in-list\'] ? emptyResponseText : option.string | highlightSuggestion : wordList"></span>\n </li>\n </ul>\n </div>\n </div>\n</div>\n',styles:[""]})],s)}(),U=function(e){this.parameters=e,this.prefillMunicipalityName=null,this.prefillMunicipalityPerfectMatchFound=!1,this.prefillMunicipalityPerfectMatchSuggestion=null,this.prefillStreetName=null,this.prefillStreetPerfectMatchFound=!1,this.prefillStreetPerfectMatchSuggestion=null,this.prefillStreetNumber=null,this.prefillStreetNumberPerfectMatchFound=!1,this.prefillStreetNumberPerfectMatchSuggestion=null,this.prefillBoxNumber=null,this.prefillBoxNumberPerfectMatchFound=!1,this.prefillBoxNumberPerfectMatchSuggestion=null,this.ts=null,this.ts=new Date},F=function(){function s(){this.selectedLanguage=null,this.showDebugMessageToConsole=!1,this.notInListAllowed=!0,this.messageOption="Y",this.localityUrl="https://webservices-pub.bpost.be/ws/ExternalMailingAddressProofingCSREST_v1/address/autocomplete/locality",this.maxSuggestionLocality=5,this.visibleSuggestionLocalityCount=5,this.localityPrefillData=null,this.streetUrl="https://webservices-pub.bpost.be/ws/ExternalMailingAddressProofingCSREST_v1/address/autocomplete/street",this.maxSuggestionStreet=5,this.visibleSuggestionStreetCount=5,this.streetPrefillData=null,this.streetNumberUrl="https://webservices-pub.bpost.be/ws/ExternalMailingAddressProofingCSREST_v1/address/autocomplete/streetNumber",this.maxSuggestionStreetNb=5,this.visibleSuggestionStreetNbCount=5,this.streetNumberPrefillData=null,this.boxNumberUrl="https://webservices-pub.bpost.be/ws/ExternalMailingAddressProofingCSREST_v1/address/autocomplete/boxNumber",this.maxSuggestionBoxNb=5,this.visibleSuggestionBoxNbCount=5,this.boxNumberPrefillData=null,this.emittedAddress=null,this.validationMessage={messageType:null,translatedMessage:""},this.addressCompleteEventEmitter=new t.EventEmitter,this.validationMessageEventEmitter=new t.EventEmitter,this.clearInputEventEmitter=new t.EventEmitter,this.processingPrefillData=!1}return Object.defineProperty(s.prototype,"inputLang",{set:function(e){this.setLanguage(e)},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"clearInput",{set:function(e){this.onClearInput(e)},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"validationMessageOption",{set:function(e){this.setValidationMessageOptionFromInput(e)},enumerable:!0,configurable:!0}),s.prototype.ngOnInit=function(){this.addressParams&&(this.prefillData=this.addressParams)},s.prototype.ngOnDestroy=function(){this.subscription&&this.subscription.unsubscribe()},s.prototype.ngOnChanges=function(t){t&&(this.showDebugMessageToConsole&&this.displayParametersChangesToConsole(t),t.hasOwnProperty("addressParams")&&!t.addressParams.firstChange&&(this.processingPrefillData=!0,this.enterPrefillMode(),this.selectedAddress=null,this.notifyAddressComplete(),this.clearWidget(),this.boxNumberPrefillData=null,this.streetNumberPrefillData=null,this.streetPrefillData=null,this.showDebugMessageToConsole&&console.log("lib::widget detected prefilling",this.addressParams),this.addressParams.minLevel=e.ADDRESSLEVEL.LOCALITY,this.localityPrefillData=new U(this.addressParams),this.showDebugMessageToConsole&&console.log("lib::checking locality match... ",this.localityPrefillData)))},s.prototype.displayParametersChangesToConsole=function(e){if(e.hasOwnProperty("messageOption")&&!e.messageOption.firstChange){var t=e.messageOption.currentValue;console.log("lib widget9 - messageOption",t)}if(e.hasOwnProperty("maxSuggestionLocality")&&!e.maxSuggestionLocality.firstChange){t=e.maxSuggestionLocality.currentValue;console.log("lib widget9 - maxSuggestionLocality",t)}if(e.hasOwnProperty("visibleSuggestionLocalityCount")&&!e.visibleSuggestionLocalityCount.firstChange){t=e.visibleSuggestionLocalityCount.currentValue;console.log("lib widget9 - visibleSuggestionLocalityCount",t)}if(e.hasOwnProperty("sortCriteriaLocality")&&!e.sortCriteriaLocality.firstChange){t=e.sortCriteriaLocality.currentValue;console.log("lib widget9 - sortCriteriaLocality",t)}if(e.hasOwnProperty("maxSuggestionStreet")&&!e.maxSuggestionStreet.firstChange){t=e.maxSuggestionStreet.currentValue;console.log("lib widget9 - maxSuggestionStreet",t)}if(e.hasOwnProperty("visibleSuggestionStreetCount")&&!e.visibleSuggestionStreetCount.firstChange){t=e.visibleSuggestionStreetCount.currentValue;console.log("lib widget9 - visibleSuggestionStreetCount",t)}if(e.hasOwnProperty("sortCriteriaStreet")&&!e.sortCriteriaStreet.firstChange){t=e.sortCriteriaStreet.currentValue;console.log("lib widget9 - sortCriteriaStreet",t)}if(e.hasOwnProperty("maxSuggestionStreetNb")&&!e.maxSuggestionStreetNb.firstChange){t=e.maxSuggestionStreetNb.currentValue;console.log("lib widget9 - maxSuggestionStreetNb",t)}if(e.hasOwnProperty("visibleSuggestionStreetNbCount")&&!e.visibleSuggestionStreetNbCount.firstChange){t=e.visibleSuggestionStreetNbCount.currentValue;console.log("lib widget9 - visibleSuggestionStreetNbCount",t)}if(e.hasOwnProperty("sortCriteriaStreetNb")&&!e.sortCriteriaStreetNb.firstChange){t=e.sortCriteriaStreetNb.currentValue;console.log("lib widget9 - sortCriteriaStreetNb",t)}if(e.hasOwnProperty("maxSuggestionBoxNb")&&!e.maxSuggestionBoxNb.firstChange){t=e.maxSuggestionBoxNb.currentValue;console.log("lib widget9 - maxSuggestionBoxNb",t)}if(e.hasOwnProperty("visibleSuggestionBoxNbCount")&&!e.visibleSuggestionBoxNbCount.firstChange){t=e.visibleSuggestionBoxNbCount.currentValue;console.log("lib widget9 - visibleSuggestionBoxNbCount",t)}if(e.hasOwnProperty("sortCriteriaBoxNb")&&!e.sortCriteriaBoxNb.firstChange){t=e.sortCriteriaBoxNb.currentValue;console.log("lib widget9 - sortCriteriaBoxNb",t)}},s.prototype.clearWidget=function(){this.autocompleteBoxNb.clearWidget(),this.autocompleteStreetNb.clearWidget(),this.autocompleteStreet.clearWidget(),this.autocompleteLocality.clearWidget()},s.prototype.changeMinLevel=function(e){this.minLevel=e},s.prototype.onClearInput=function(e){this.showDebugMessageToConsole&&console.log("lib::onClearInput",e),this.quitPrefillMode();var t=null!=e&&e.setFocus;switch(this.minLevel){case 1:this.boxNumber="",this.autocompleteBoxNb.clearInput(t,!1),this.clearInputEventEmitter.emit("BOX_NUMBER");break;case 2:this.boxNumber="",this.streetNumber="",this.autocompleteBoxNb.searchText="",this.autocompleteBoxNb.streetNumber="",this.autocompleteBoxNb.clearInput(t,!1),this.autocompleteStreetNb.onClearStreetNumberInput(t,!1),this.clearInputEventEmitter.emit("STREET_NUMBER");break;case 3:this.boxNumber="",this.streetNumber="",this.street="",this.autocompleteBoxNb.searchText="",this.autocompleteBoxNb.streetNumber="",this.autocompleteBoxNb.clearInput(t,!1),this.autocompleteBoxNb.clearWidget(),this.autocompleteStreetNb.searchText="",this.autocompleteStreetNb.streetName="",this.autocompleteStreetNb.onClearStreetNumberInput(t,!1),this.autocompleteStreet.clearInput(t,!1),this.clearInputEventEmitter.emit("STREET");break;default:this.boxNumber="",this.autocompleteBoxNb&&(this.autocompleteBoxNb.searchText="",this.autocompleteBoxNb.streetNumber="",this.autocompleteBoxNb.clearInput(t,!1)),this.streetNumber="",this.autocompleteStreetNb&&(this.autocompleteStreetNb.searchText="",this.autocompleteStreetNb.streetName="",this.autocompleteStreetNb.onClearStreetNumberInput(t,!1)),this.street="",this.autocompleteStreet&&(this.autocompleteStreet.searchText="",this.autocompleteStreet.clearInput(t,!1)),this.locality="",this.autocompleteLocality&&(this.autocompleteLocality.searchText="",this.autocompleteLocality.clearInput(t,!1)),this.clearInputEventEmitter.emit("LOCALITY")}},s.prototype.getBoxPrefix=function(){var e="";switch(this.selectedLanguage){case"fr":e="BTE";break;case"nl":e="BUS";break;default:e="BOX"}return e},s.prototype.notifyAddressComplete=function(){this.addressCompleteEventEmitter.emit(this.selectedAddress),this.emittedAddress=this.selectedAddress,this.updatePostalCodeLocality(this.emittedAddress)},s.prototype.onClearInputEventEmitter=function(e){this.showDebugMessageToConsole&&console.log("lib::onClearInputEventEmitter",e),this.quitPrefillMode();var t=this.selectedAddress;if(e===P.LOCALITY)this.boxNumber="",this.autocompleteBoxNb&&(this.autocompleteBoxNb.searchText="",this.autocompleteBoxNb.streetNumber="",this.autocompleteBoxNb.clearInput(!1,!1)),this.streetNumber="",this.autocompleteStreetNb&&(this.autocompleteStreetNb.searchText="",this.autocompleteStreetNb.streetName="",this.autocompleteStreetNb.onClearStreetNumberInput(!1,!1)),this.street="",this.autocompleteStreet&&(this.autocompleteStreet.searchText="",this.autocompleteStreet.clearInput(!1,!1)),this.locality="",this.autocompleteLocality&&(this.autocompleteLocality.searchText="",this.autocompleteLocality.clearInput(!1,!1)),t=null;else if(e===P.STREET)this.boxNumber="",this.autocompleteBoxNb&&(this.autocompleteBoxNb.searchText="",this.autocompleteBoxNb.streetNumber="",this.autocompleteBoxNb.clearInput(!1,!1)),this.streetNumber="",this.autocompleteStreetNb&&(this.autocompleteStreetNb.searchText="",this.autocompleteStreetNb.streetName="",this.autocompleteStreetNb.onClearStreetNumberInput(!1,!1)),this.street="",this.autocompleteStreet&&(this.autocompleteStreet.searchText="",this.autocompleteStreet.clearInput(!1,!1)),t=null;else if(e===P.STREET_NUMBER)this.boxNumber="",this.autocompleteBoxNb&&(this.autocompleteBoxNb.searchText="",this.autocompleteBoxNb.streetNumber="",this.autocompleteBoxNb.clearInput(!1,!1)),this.streetNumber="",this.autocompleteStreetNb&&(this.autocompleteStreetNb.searchText="",this.autocompleteStreetNb.onClearStreetNumberInput(!1,!1)),t=null;else if(e===P.BOX_NUMBER){this.boxNumber="",this.autocompleteBoxNb&&(this.autocompleteBoxNb.searchText="",this.autocompleteBoxNb.clearInput(!1,!1));null==t||!t.hasOwnProperty("not-in-list")||t["not-in-list"];var s=!(null==(t=null!==this.streetNumberAddress?this.streetNumberAddress:null)||!t.hasOwnProperty("isComplete")||!0!==t.isComplete);this.autocompleteStreetNb.addressIsComplete=s}this.clearInputEventEmitter.emit(e),null!==this.emittedAddress&&(this.addressCompleteEventEmitter.emit(t),this.emittedAddress=t)},s.prototype.resetLocality=function(e){this.postalCode="",this.locality="",this.quitPrefillMode(),this.onClearInputEventEmitter(P.STREET),this.setAddress(null,4)},s.prototype.resetStreet=function(e){this.street="",this.quitPrefillMode(),this.onClearInputEventEmitter(P.STREET_NUMBER),this.autocompleteStreetNb.addressIsComplete=!1,this.autocompleteStreetNb.streetName="",this.setAddress(null,3)},s.prototype.resetStreetNumber=function(e,t){void 0===t&&(t=!1),this.streetNumber="",this.quitPrefillMode(),this.onClearInputEventEmitter(P.BOX_NUMBER),this.autocompleteBoxNb.addressIsComplete=!1,this.autocompleteBoxNb.streetNumber="",this.setAddress(null,2)},s.prototype.resetBoxNumber=function(e,t){void 0===t&&(t=!1),this.boxNumber="",this.quitPrefillMode(),this.autocompleteBoxNb.addressIsComplete=!1,this.setAddress(null,1)},s.prototype.enterPrefillMode=function(){this.showDebugMessageToConsole&&console.log("lib::enterPrefillMode()"),this.autocompleteBoxNb&&this.autocompleteStreetNb&&this.autocompleteStreet&&this.autocompleteLocality&&(this.autocompleteBoxNb.prefilling=!0,this.autocompleteStreetNb.prefilling=!0,this.autocompleteStreet.prefilling=!0,this.autocompleteLocality.prefilling=!0,this.autocompleteStreet.locality="",this.autocompleteStreetNb.streetName="",this.autocompleteBoxNb.streetNumber="")},s.prototype.quitPrefillMode=function(){this.showDebugMessageToConsole&&console.log("lib::quitPrefillMode()"),this.autocompleteBoxNb&&this.autocompleteStreetNb&&this.autocompleteStreet&&this.autocompleteLocality&&(this.autocompleteBoxNb.prefilling=!1,this.autocompleteStreetNb.prefilling=!1,this.autocompleteStreet.prefilling=!1,this.autocompleteLocality.prefilling=!1),this.processingPrefillData=!1},s.prototype.setAddress=function(e,t){if(this.showDebugMessageToConsole&&console.log("lib::setAddress - address part, level",e,t),null==e){var s=null!==this.selectedAddress&&void 0!==this.selectedAddress;this.selectedAddress=null,this.autocompleteStreetNb.addressIsComplete=!1,this.autocompleteBoxNb.addressIsComplete=!1,s&&this.notifyAddressComplete()}if(e){delete e.messages,this.selectedAddress=e,this.updateCompleteAddress(),this.postalCode=e.postalCode?e.postalCode:"",this.locality=e.localityName?e.localityName:"",this.street=e.streetName?e.streetName:"";null==e||!e.hasOwnProperty("isComplete")||e.isComplete;var i=!(null==e||!e.hasOwnProperty("not-in-list")||!0!==e["not-in-list"]);switch(t){case 4:this.updatePostalCodeLocality(e),this.streetAddress=null,this.streetNumberAddress=null,this.autocompleteStreet.searchText="",this.autocompleteStreetNb.searchText="",this.autocompleteStreetNb.streetName="",this.autocompleteBoxNb.searchText="",this.autocompleteBoxNb.streetNumber="";break;case 3:this.updatePostalCodeLocality(e),this.updateStreetName(e),this.streetAddress=e,this.streetNumberAddress=null,this.autocompleteStreetNb.searchText="",this.autocompleteBoxNb.searchText="",this.autocompleteBoxNb.streetNumber="";break;case 2:this.updatePostalCodeLocality(e),this.updateStreetName(e),this.updateStreetNumber(e),this.streetAddress=e,this.streetNumberAddress=e,e.hasOwnProperty("isComplete")&&!0===e.isComplete?(this.autocompleteStreetNb.addressIsComplete=!0,this.autocompleteBoxNb.streetNumber=i?e.houseNumber:""):this.autocompleteBoxNb.streetNumber=e.houseNumber,this.autocompleteBoxNb.searchText="";break;case 1:i&&(this.autocompleteStreetNb.addressIsComplete=!1)}this.selectedAddress&&void 0===this.selectedAddress.isComplete&&(this.selectedAddress.isComplete=!1),this.selectedAddress.isCompleteNotificationDone=!0,this.notifyAddressComplete()}},s.prototype.setLanguage=function(e){this.selectedLanguage=e},s.prototype.setValidationMessage=function(t){this.validationMessage=t,this.validationMessageOptionType===e.ValidationMessageOptionType.EMIT&&this.validationMessageEventEmitter.emit(t)},s.prototype.updatePostalCodeLocality=function(e){e&&e.postalCode&&e.localityName&&(this.postalCodeLocality=e.postalCode+" "+e.localityName,this.autocompleteLocality.searchText=this.postalCodeLocality)},s.prototype.updateStreetName=function(e){e&&e.streetName&&(this.streetNameInput=e.streetName)},s.prototype.updateStreetNumber=function(e){e&&e.houseNumber&&(this.streetNumberInput=e.houseNumber)},s.prototype.updateCompleteAddress=function(){var e="";e+=this.selectedAddress.streetName?this.selectedAddress.streetName+" ":"",e+=this.selectedAddress.houseNumber?this.selectedAddress.houseNumber+" ":"",e+=this.selectedAddress.boxNumber?this.getBoxPrefix()+" "+this.selectedAddress.boxNumber+" ":"",e+=this.selectedAddress.postalCode?this.selectedAddress.postalCode+" ":"",e+=this.selectedAddress.municipalityName?this.selectedAddress.municipalityName+" ":"",this.completeAddress=e},s.prototype.setValidationMessageOptionFromInput=function(e){this.validationMessageOptionType=e.validationType},s.prototype.onLocalityPrefillEvent=function(t){this.showDebugMessageToConsole&&console.log("lib::locality prefill event received:",t);var s=t.prefillData;if(!0===t.prefillData.prefillMunicipalityPerfectMatchFound){var i=s.prefillMunicipalityPerfectMatchSuggestion.address;this.updatePostalCodeLocality(i),this.addressParams.minLevel=e.ADDRESSLEVEL.STREET,this.prefillData=t.prefillData,this.prefillData.ts=new Date,this.prefillData.parameters.minLevel=e.ADDRESSLEVEL.STREET;var r=this.prefillData.prefillMunicipalityPerfectMatchSuggestion.address,o=r.localityName;this.prefillData.parameters.municipalityName=o,this.prefillData.parameters.postalCode=r.postalCode;var n=this.prefillData.parameters.streetName;null!=n&&""!==n||this.setAddress(i,e.ADDRESSLEVEL.LOCALITY),this.streetPrefillData=this.prefillData}else{var a=s.parameters.postalCode+s.parameters.municipalityName;this.autocompleteStreet.locality="",null!=a&&0!==a.length||this.setAddress(null,e.ADDRESSLEVEL.LOCALITY),this.quitPrefillMode()}},s.prototype.onStreetPrefillEvent=function(t){this.showDebugMessageToConsole&&console.log("lib::street: prefill event received",t);var s=t.prefillData;if(!0===t.prefillData.prefillStreetPerfectMatchFound){var i=s.prefillStreetPerfectMatchSuggestion.address;this.updateStreetName(i),this.addressParams.minLevel=e.ADDRESSLEVEL.STREET_NUMBER,this.prefillData=t.prefillData,this.prefillData.ts=new Date,this.prefillData.parameters.minLevel=e.ADDRESSLEVEL.STREET_NUMBER;var r=this.prefillData.prefillStreetPerfectMatchSuggestion.address,o=r.localityName;this.prefillData.parameters.municipalityName=o,this.prefillData.parameters.postalCode=r.postalCode,this.prefillData.parameters.streetName=r.streetName;var n=this.prefillData.parameters.streetNumber;null!=n&&""!==n||this.setAddress(i,e.ADDRESSLEVEL.STREET),this.streetNumberPrefillData=this.prefillData}else{var a=this.prefillData.parameters.streetName;i=this.prefillData.prefillMunicipalityPerfectMatchSuggestion.address;this.autocompleteStreetNb.streetName="",this.showDebugMessageToConsole&&console.error("lib::onStreetPrefillEvent - NO MATCH AT STREET LEVEL",a),null==a||0===a.length?this.setAddress(i,e.ADDRESSLEVEL.LOCALITY):(i.searchBarString=a,this.setAddress(i,e.ADDRESSLEVEL.STREET)),this.quitPrefillMode()}},s.prototype.onStreetNumberPrefillEvent=function(t){this.showDebugMessageToConsole&&console.log("lib::street number prefill event received:",t);var s=t.prefillData;if(!0===s.prefillStreetNumberPerfectMatchFound){var i=s.prefillStreetNumberPerfectMatchSuggestion.address;this.updateStreetNumber(i),this.autocompleteStreetNb.selectedAddress=i;var r=!(!i||!i.hasOwnProperty("isComplete")||!0!==i.isComplete),o=!(!i||!i.hasOwnProperty("not-in-list")||!0!==i["not-in-list"]);if(r&&!o)this.autocompleteStreetNb.addressIsComplete=!0,this.quitPrefillMode();else{this.addressParams.minLevel=e.ADDRESSLEVEL.BOX_NUMBER,this.prefillData=t.prefillData,this.prefillData.ts=new Date,this.prefillData.parameters.minLevel=e.ADDRESSLEVEL.BOX_NUMBER;var n=this.prefillData.prefillStreetNumberPerfectMatchSuggestion.address,a=n.localityName;this.prefillData.parameters.municipalityName=a,this.prefillData.parameters.municipalityName=a,this.prefillData.parameters.postalCode=n.postalCode,this.prefillData.parameters.streetName=n.streetName,this.prefillData.parameters.streetNumber=n.houseNumber;var l=this.prefillData.parameters.boxNumber;o||null!=l&&""!==l||this.setAddress(i,e.ADDRESSLEVEL.STREET_NUMBER),this.boxNumberPrefillData=this.prefillData}}else{var p=this.prefillData.parameters.streetNumber;i=this.prefillData.prefillStreetPerfectMatchSuggestion.address;this.autocompleteBoxNb.streetNumber="",null==p||0===p.length?this.setAddress(i,e.ADDRESSLEVEL.STREET):(i.searchBarString=p,this.setAddress(i,e.ADDRESSLEVEL.STREET_NUMBER)),this.quitPrefillMode()}},s.prototype.onBoxNumberPrefillEvent=function(t){this.showDebugMessageToConsole&&console.log("lib::prefill: box number event received:",t);var s=t.prefillData;if(!0===s.prefillBoxNumberPerfectMatchFound){var i=s.prefillBoxNumberPerfectMatchSuggestion.address;this.autocompleteBoxNb.selectedAddress=i,this.setAddress(i,e.ADDRESSLEVEL.BOX_NUMBER)}else{var r=this.prefillData.parameters.boxNumber;i=this.prefillData.prefillStreetNumberPerfectMatchSuggestion.address;null==r||0===r.length?this.setAddress(i,e.ADDRESSLEVEL.STREET_NUMBER):(i.searchBarString=r,this.setAddress(i,e.ADDRESSLEVEL.BOX_NUMBER))}this.quitPrefillMode()},h([t.ViewChild(V,{static:!1})],s.prototype,"autocompleteLocality",void 0),h([t.ViewChild(R,{static:!1})],s.prototype,"autocompleteStreet",void 0),h([t.ViewChild(k,{static:!1})],s.prototype,"autocompleteStreetNb",void 0),h([t.ViewChild(W,{static:!1})],s.prototype,"autocompleteBoxNb",void 0),h([t.Input()],s.prototype,"inputLang",null),h([t.Input()],s.prototype,"clearInput",null),h([t.Input()],s.prototype,"validationMessageOption",null),h([t.Input()],s.prototype,"defaultLang",void 0),h([t.Input()],s.prototype,"showDebugMessageToConsole",void 0),h([t.Input()],s.prototype,"minLevel",void 0),h([t.Input()],s.prototype,"notInListAllowed",void 0),h([t.Input()],s.prototype,"addressParams",void 0),h([t.Input()],s.prototype,"messageOption",void 0),h([t.Input()],s.prototype,"localityUrl",void 0),h([t.Input()],s.prototype,"maxSuggestionLocality",void 0),h([t.Input()],s.prototype,"visibleSuggestionLocalityCount",void 0),h([t.Input()],s.prototype,"sortCriteriaLocality",void 0),h([t.Input()],s.prototype,"streetUrl",void 0),h([t.Input()],s.prototype,"maxSuggestionStreet",void 0),h([t.Input()],s.prototype,"visibleSuggestionStreetCount",void 0),h([t.Input()],s.prototype,"sortCriteriaStreet",void 0),h([t.Input()],s.prototype,"streetNumberUrl",void 0),h([t.Input()],s.prototype,"maxSuggestionStreetNb",void 0),h([t.Input()],s.prototype,"visibleSuggestionStreetNbCount",void 0),h([t.Input()],s.prototype,"sortCriteriaStreetNb",void 0),h([t.Input()],s.prototype,"boxNumberUrl",void 0),h([t.Input()],s.prototype,"maxSuggestionBoxNb",void 0),h([t.Input()],s.prototype,"visibleSuggestionBoxNbCount",void 0),h([t.Input()],s.prototype,"sortCriteriaBoxNb",void 0),h([t.Output()],s.prototype,"addressCompleteEventEmitter",void 0),h([t.Output()],s.prototype,"validationMessageEventEmitter",void 0),h([t.Output()],s.prototype,"clearInputEventEmitter",void 0),s=h([t.Component({selector:"bp-lib-address-autocomplete-by-component",template:'\r\n<div class="aacwidget-address-container">\r\n\r\n <div class="bpaac-dropdown-validation" *ngIf="validationMessageOptionType === \'SHOW\' ">\r\n <div class="bpaac-validated-icon" *ngIf="selectedAddress && validationMessage!==null && validationMessage.messageType!==null"></div>\r\n \x3c!-- {{ validationMessage | translate }} --\x3e\r\n {{ validationMessage.translatedMessage }}\r\n </div>\r\n\r\n \x3c!-- bp-aacwidget-autocomplete-locality --\x3e\r\n <bp-locality class="aacwidget-address-locality"\r\n [showDebugMessageToConsole]="showDebugMessageToConsole"\r\n [baseUrl]="localityUrl"\r\n [prefillData]="localityPrefillData"\r\n [labelResourceKey]="\'common.label.postalCode\'"\r\n [inputText]="postalCodeLocality"\r\n [inputLang]="selectedLanguage"\r\n [messageOption]="messageOption"\r\n [sortCriteria]="sortCriteriaLocality"\r\n [maxSuggesionCount]="maxSuggestionLocality" \r\n [visibleSuggestionCount]="visibleSuggestionLocalityCount"\r\n (addressChanged)="setAddress($event, 4)"\r\n (messageChanged)="setValidationMessage($event)"\r\n (focusEvent)="changeMinLevel($event)" \r\n (textChangeEvent)="resetLocality($event)"\r\n (clearInputEventEmitter)="onClearInputEventEmitter($event)"\r\n (prefillEventEmitter)="onLocalityPrefillEvent($event)"></bp-locality>\r\n\r\n <bp-street class="aacwidget-address-street"\r\n [showDebugMessageToConsole]="showDebugMessageToConsole"\r\n [baseUrl]="streetUrl"\r\n [prefillData]="streetPrefillData"\r\n [labelResourceKey]="\'common.label.streetName\'"\r\n [inputText]="streetNameInput"\r\n [inputLang]="selectedLanguage"\r\n [messageOption]="messageOption"\r\n [postalCode]="postalCode"\r\n [locality]="locality"\r\n [sortCriteria]="sortCriteriaStreet" \r\n [maxSuggesionCount]="maxSuggestionStreet"\r\n [visibleSuggesionCount]="visibleSuggestionStreetCount"\r\n (addressChanged)="setAddress($event, 3)"\r\n (messageChanged)="setValidationMessage($event)"\r\n (focusEvent)="changeMinLevel($event)"\r\n (textChangeEvent)="resetStreet($event)"\r\n (clearInputEventEmitter)="onClearInputEventEmitter($event)"\r\n (prefillEventEmitter)="onStreetPrefillEvent($event)"></bp-street>\r\n\r\n <bp-street-number class="aacwidget-address-streetnumber"\r\n [showDebugMessageToConsole]="showDebugMessageToConsole"\r\n [baseUrl]="streetNumberUrl"\r\n [selectedAddress]="streetAddress"\r\n [prefillData]="streetNumberPrefillData"\r\n [labelResourceKey]="\'common.label.streetNumber\'"\r\n [inputText]="streetNumberInput"\r\n [inputLang]="selectedLanguage"\r\n [messageOption]="messageOption"\r\n [postalCode]="postalCode" \r\n [locality]="locality" \r\n [streetName]="street"\r\n [sortCriteria]="sortCriteriaStreetNb"\r\n [maxSuggesionCount]="maxSuggestionStreetNb" \r\n [visibleSuggesionCount]="visibleSuggestionStreetNbCount"\r\n [notInListAllowed]="notInListAllowed"\r\n (addressChanged)="setAddress($event, 2)"\r\n (messageChanged)="setValidationMessage($event)"\r\n (focusEvent)="changeMinLevel($event)"\r\n (textChangeEvent)="resetStreetNumber($event, false)"\r\n (clearInputEventEmitter)="onClearInputEventEmitter($event)"\r\n (prefillEventEmitter)="onStreetNumberPrefillEvent($event)"></bp-street-number>\r\n\r\n <bp-box-number class="aacwidget-address-boxnumber"\r\n [showDebugMessageToConsole]="showDebugMessageToConsole"\r\n [baseUrl]="boxNumberUrl"\r\n [selectedAddress]="streetNumberAddress"\r\n [prefillData]="boxNumberPrefillData"\r\n [labelResourceKey]="\'common.label.boxNumber\'"\r\n [inputLang]="selectedLanguage"\r\n [messageOption]="messageOption"\r\n [postalCode]="postalCode" \r\n [locality]="locality" \r\n [streetName]="street" \r\n [streetNumber]="streetNumber"\r\n [sortCriteria]="sortCriteriaBoxNb" \r\n [maxSuggesionCount]="maxSuggestionBoxNb"\r\n [visibleSuggesionCount]="visibleSuggestionBoxNbCount"\r\n [notInListAllowed]="notInListAllowed"\r\n (messageChanged)="setValidationMessage($event)"\r\n (addressChanged)="setAddress($event, 1)" \r\n (focusEvent)="changeMinLevel($event)"\r\n (textChangeEvent)="resetBoxNumber($event, false)"\r\n (clearInputEventEmitter)="onClearInputEventEmitter($event)"\r\n (prefillEventEmitter)="onBoxNumberPrefillEvent($event)"></bp-box-number>\r\n</div>',styles:[""]})],s)}(),_=function(){function e(e){this.sanitizer=e}return e.prototype.transform=function(e,t){if(!t)return e;if(Array.isArray(t)&&t.length>1)return this.transformForArray(e,t);"."===t?t="\\.":Array.isArray(t)&&1===t.length&&"."===t[0]&&(t[0]="\\.");var s=new RegExp(t,"gi"),i=e.match(s);if(!i)return e;var r=e.replace(s,"<span style='font-weight: bold;'>"+i[0]+"</span>");return this.sanitizer.bypassSecurityTrustHtml(r)},e.prototype.transformForArray=function(e,t){var s,i,r="",o=0;try{for(var n=u(t),a=n.next();!a.done;a=n.next()){var l=a.value;r=++o<t.length?r.concat(l+"|"):r.concat(l)}}catch(e){s={error:e}}finally{try{a&&!a.done&&(i=n.return)&&i.call(n)}finally{if(s)throw s.error}}var p=e.replace(new RegExp("("+r+")","gi"),'<span style="font-weight: bold;">$1</span>');return this.sanitizer.bypassSecurityTrustHtml(p)},e.ctorParameters=function(){return[{type:l.DomSanitizer}]},e=h([t.Pipe({name:"highlightSuggestion"})],e)}(),q=function(){function e(e,t){this.el=e,this.renderer=t}return e.prototype.ngAfterViewChecked=function(){this.showHeight(this.el.nativeElement,this.appVisibleSuggestion)},e.prototype.showHeight=function(e,t){if(e){var s=e.firstElementChild.children;if(s&&0!==s.length){var i=Array.from(s).slice(0,t).reduce((function(e,t){return e+O.getOuterHeight(t)}),7);this.renderer.setStyle(this.el.nativeElement,"maxHeight",i+"px")}}},e.ctorParameters=function(){return[{type:t.ElementRef},{type:t.Renderer2}]},h([t.Input()],e.prototype,"appVisibleSuggestion",void 0),e=h([t.Directive({selector:"[appVisibleSuggestion]"})],e)}(),$=function(){function e(){}return e=h([t.NgModule({declarations:[_,q,F,V,R,k,W],imports:[n.CommonModule,r.HttpClientModule,a.FormsModule,a.ReactiveFormsModule,o.TranslateModule],exports:[F]})],e)}(),j=function(t){this.onFocusShowSuggestionsAfterPrefill=!1,this.ts=null,Object.assign(this,t),this.boxNumber&&""!==this.boxNumber?this.minLevel=e.ADDRESSLEVEL.BOX_NUMBER:this.streetNumber&&""!==this.streetNumber?this.minLevel=e.ADDRESSLEVEL.STREET_NUMBER:this.streetName&&""!==this.streetName?this.minLevel=e.ADDRESSLEVEL.STREET:this.minLevel=e.ADDRESSLEVEL.LOCALITY,this.ts=new Date};e.LibAddressAutocompleteByComponentComponent=F,e.LibAddressAutocompleteByComponentModule=$,e.LibAddressAutocompleteByComponentService=m,e.PrefilledParameters=j,e.ɵa=V,e.ɵb=L,e.ɵc=b,e.ɵd=D,e.ɵe=A,e.ɵf=R,e.ɵg=k,e.ɵh=W,e.ɵi=_,e.ɵj=q,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
15
|
+
***************************************************************************** */var p=function(){return(p=Object.assign||function(e){for(var t,s=1,i=arguments.length;s<i;s++)for(var r in t=arguments[s])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};function h(e,t,s,i){var r,o=arguments.length,n=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,s,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(n=(o<3?r(n):o>3?r(t,s,n):r(t,s))||n);return o>3&&n&&Object.defineProperty(t,s,n),n}function c(e){var t="function"==typeof Symbol&&Symbol.iterator,s=t&&e[t],i=0;if(s)return s.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}var u,d,g,m=function(){function e(){}return e.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e},token:e,providedIn:"root"}),e=h([t.Injectable({providedIn:"root"})],e)}();(u=e.ValidationMessageOptionType||(e.ValidationMessageOptionType={})).EMIT="EMIT",u.SHOW="SHOW",(d=e.ValidationMessageType||(e.ValidationMessageType={})).Address_Not_Found="address-not-found",d.Address_Validated="address-validated",d.Service_Unavailable="service-unavailable",(g=e.ADDRESSLEVEL||(e.ADDRESSLEVEL={}))[g.BOX_NUMBER=1]="BOX_NUMBER",g[g.STREET_NUMBER=2]="STREET_NUMBER",g[g.STREET=3]="STREET",g[g.LOCALITY=4]="LOCALITY";var f,y=function(){function e(e){Object.assign(this,e)}return e.prototype.sortByPostalCode=function(e){this.sortByPostalCodeLocalityName=e},e.prototype.sortByLocalityname=function(e){this.sortByLocalityNamePostalCode=e},e.prototype.sortByStreet=function(e){this.sortByStreetName=e},e.prototype.sortByStreetNb=function(e){this.sortByStreetNumber=e},e.prototype.sortByBox=function(e){this.sortByBoxNumber=e},e}(),b=function(){function e(e){this.httpClient=e,this.openConnections=0,this.apiKey="no-value"}return e.prototype.setApiKey=function(e){this.apiKey=e},e.prototype.getHttpHeaders=function(){var e=new r.HttpHeaders;return e=e.set("x-api-key",this.apiKey)},e.prototype.get=function(e,t){return this.request("GET",e,t)},e.prototype.request=function(e,t,i){var r=this;return i=p(p({},i=i||{}),{headers:this.getHttpHeaders()}),console.log("options:",JSON.stringify(i)),this.openConnections++,this.httpClient.request(e,t,i).pipe(s.map((function(e){return r.handleResponse(e)})),s.catchError((function(e){return r.handleError(e)})))},e.prototype.handleResponse=function(e){return this.openConnections--,e},e.prototype.handleError=function(e){return this.openConnections--,i.throwError(e)},e.ctorParameters=function(){return[{type:r.HttpClient}]},e.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e(t.ɵɵinject(r.HttpClient))},token:e,providedIn:"root"}),e=h([t.Injectable({providedIn:"root"})],e)}(),S=function(e){var t=this;this.sequenceNumber=e.sequenceNumber,e.topSuggestions&&e.topSuggestions.length>0&&(this.topSuggestions=[],e.topSuggestions.forEach((function(e){t.topSuggestions.push(new v(e))})))},v=function(e){this.address=e.address?new C(e.address):null},C=function(e){this.municipalityId=e.municipalityId,this.subMunicipalityId=e.subMunicipalityId,this.detectedLanguage=e.detectedLanguage,this.geoSanction=e.geoSanction,this.searchBarString=e.searchBarString,this.string=e.string,this.municipalityName=e.municipalityName,this.localityName=e.localityName,this.postalCode=e.postalCode},x=function(e){var t=this;this.sequenceNumber=e.sequenceNumber,e.topSuggestions&&e.topSuggestions.length>0&&(this.topSuggestions=[],e.topSuggestions.forEach((function(e){t.topSuggestions.push(new E(e))})))},E=function(e){this.address=e.address?new N(e.address):null},N=function(e){this.municipalityId=e.municipalityId,this.subMunicipalityId=e.subMunicipalityId,this.detectedLanguage=e.detectedLanguage,this.geoSanction=e.geoSanction,this.searchBarString=e.searchBarString,this.string=e.string,this.municipalityName=e.municipalityName,this.localityName=e.localityName,this.postalCode=e.postalCode},I=function(e){var t=this;this.sequenceNumber=e.sequenceNumber,e.topSuggestions&&e.topSuggestions.length>0&&(this.topSuggestions=[],e.topSuggestions.forEach((function(e){t.topSuggestions.push(new w(e))})))},w=function(e){this.address=e.address?new T(e.address):null},T=function(e){this.municipalityId=e.municipalityId,this.subMunicipalityId=e.subMunicipalityId,this.detectedLanguage=e.detectedLanguage,this.geoSanction=e.geoSanction,this.searchBarString=e.searchBarString,this.string=e.string,this.municipalityName=e.municipalityName,this.localityName=e.localityName,this.postalCode=e.postalCode},L=function(){function e(e){this.httpService=e,this.domain="http://10.194.73.9:8080",this.localityURL=this.domain+"/AddressAutoComplete/autocomplete/locality?IncludeGeographicalSanction=true",this.log=!0}return e.prototype.getLocality=function(e,t){var i=this,r=""!==e?e:this.localityURL,o={params:t};return this.httpService.get(r,o).pipe(s.tap((function(e){return i.handleGetLocality(e)})),s.catchError((function(e){return i.handleError(e)})))},e.prototype.handleGetLocality=function(e){return new S(e.response)},e.prototype.getStreet=function(e,t,i,r){var o=this,n=e,a={params:r};return n=(n=n.replace("$postalCode",i)).replace("$localityName",t),this.httpService.get(n,a).pipe(s.tap((function(e){return o.handleGetStreet(e)})),s.catchError((function(e){return o.handleError(e)})))},e.prototype.handleGetStreet=function(e){return new x(e.response)},e.prototype.getBox=function(e,t,i,r){var o=this,n=e,a={params:r};return n=(n=n.replace("$postalCode",i)).replace("$localityName",t),this.httpService.get(n,a).pipe(s.tap((function(e){return o.handleGetBox(e)})),s.catchError((function(e){return o.handleError(e)})))},e.prototype.handleGetBox=function(e){return new I(e.response)},e.prototype.handleError=function(e){return i.throwError(e)},e.ctorParameters=function(){return[{type:b}]},e.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e(t.ɵɵinject(b))},token:e,providedIn:"root"}),e=h([t.Injectable({providedIn:"root"})],e)}(),D=function(){function e(){this.inputLanguageEvent=new i.BehaviorSubject(void 0),this.currentLang=this.inputLanguageEvent.asObservable()}return e.prototype.changeLang=function(e){this.inputLanguageEvent.next(e)},e.prototype.isLocaleDutch=function(){return this.isPreferredLocale("nl")},e.prototype.isLocaleFrench=function(){return this.isPreferredLocale("fr")},e.prototype.isLocaleGerman=function(){return this.isPreferredLocale("de")},e.prototype.isPreferredLocale=function(e){return 0===(this.inputLanguageEvent.getValue()||window.navigator.userSelectedLanguage||window.navigator.userLanguage||window.navigator.language).indexOf(e)},e.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e},token:e,providedIn:"root"}),e=h([t.Injectable({providedIn:"root"})],e)}(),M=[{base:"A",letters:"AⒶAÀÁÂẦẤẪẨÃĀĂẰẮẴẲȦǠÄǞẢÅǺǍȀȂẠẬẶḀĄȺⱯ"},{base:"AA",letters:"Ꜳ"},{base:"AE",letters:"ÆǼǢ"},{base:"AO",letters:"Ꜵ"},{base:"AU",letters:"Ꜷ"},{base:"AV",letters:"ꜸꜺ"},{base:"AY",letters:"Ꜽ"},{base:"B",letters:"BⒷBḂḄḆɃƂƁ"},{base:"C",letters:"CⒸCĆĈĊČÇḈƇȻꜾ"},{base:"D",letters:"DⒹDḊĎḌḐḒḎĐƋƊƉꝹ"},{base:"DZ",letters:"DZDŽ"},{base:"Dz",letters:"DzDž"},{base:"E",letters:"EⒺEÈÉÊỀẾỄỂẼĒḔḖĔĖËẺĚȄȆẸỆȨḜĘḘḚƐƎ"},{base:"F",letters:"FⒻFḞƑꝻ"},{base:"G",letters:"GⒼGǴĜḠĞĠǦĢǤƓꞠꝽꝾ"},{base:"H",letters:"HⒽHĤḢḦȞḤḨḪĦⱧⱵꞍ"},{base:"I",letters:"IⒾIÌÍÎĨĪĬİÏḮỈǏȈȊỊĮḬƗ"},{base:"J",letters:"JⒿJĴɈ"},{base:"K",letters:"KⓀKḰǨḲĶḴƘⱩꝀꝂꝄꞢ"},{base:"L",letters:"LⓁLĿĹĽḶḸĻḼḺŁȽⱢⱠꝈꝆꞀ"},{base:"LJ",letters:"LJ"},{base:"Lj",letters:"Lj"},{base:"M",letters:"MⓂMḾṀṂⱮƜ"},{base:"N",letters:"NⓃNǸŃÑṄŇṆŅṊṈȠƝꞐꞤ"},{base:"NJ",letters:"NJ"},{base:"Nj",letters:"Nj"},{base:"O",letters:"OⓄOÒÓÔỒỐỖỔÕṌȬṎŌṐṒŎȮȰÖȪỎŐǑȌȎƠỜỚỠỞỢỌỘǪǬØǾƆƟꝊꝌ"},{base:"OI",letters:"Ƣ"},{base:"OO",letters:"Ꝏ"},{base:"OU",letters:"Ȣ"},{base:"OE",letters:"Œ"},{base:"oe",letters:"œ"},{base:"P",letters:"PⓅPṔṖƤⱣꝐꝒꝔ"},{base:"Q",letters:"QⓆQꝖꝘɊ"},{base:"R",letters:"RⓇRŔṘŘȐȒṚṜŖṞɌⱤꝚꞦꞂ"},{base:"S",letters:"SⓈSẞŚṤŜṠŠṦṢṨȘŞⱾꞨꞄ"},{base:"T",letters:"TⓉTṪŤṬȚŢṰṮŦƬƮȾꞆ"},{base:"TZ",letters:"Ꜩ"},{base:"U",letters:"UⓊUÙÚÛŨṸŪṺŬÜǛǗǕǙỦŮŰǓȔȖƯỪỨỮỬỰỤṲŲṶṴɄ"},{base:"V",letters:"VⓋVṼṾƲꝞɅ"},{base:"VY",letters:"Ꝡ"},{base:"W",letters:"WⓌWẀẂŴẆẄẈⱲ"},{base:"X",letters:"XⓍXẊẌ"},{base:"Y",letters:"YⓎYỲÝŶỸȲẎŸỶỴƳɎỾ"},{base:"Z",letters:"ZⓏZŹẐŻŽẒẔƵȤⱿⱫꝢ"},{base:"a",letters:"aⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐ"},{base:"aa",letters:"ꜳ"},{base:"ae",letters:"æǽǣ"},{base:"ao",letters:"ꜵ"},{base:"au",letters:"ꜷ"},{base:"av",letters:"ꜹꜻ"},{base:"ay",letters:"ꜽ"},{base:"b",letters:"bⓑbḃḅḇƀƃɓ"},{base:"c",letters:"cⓒcćĉċčçḉƈȼꜿↄ"},{base:"d",letters:"dⓓdḋďḍḑḓḏđƌɖɗꝺ"},{base:"dz",letters:"dzdž"},{base:"e",letters:"eⓔeèéêềếễểẽēḕḗĕėëẻěȅȇẹệȩḝęḙḛɇɛǝ"},{base:"f",letters:"fⓕfḟƒꝼ"},{base:"g",letters:"gⓖgǵĝḡğġǧģǥɠꞡᵹꝿ"},{base:"h",letters:"hⓗhĥḣḧȟḥḩḫẖħⱨⱶɥ"},{base:"hv",letters:"ƕ"},{base:"i",letters:"iⓘiìíîĩīĭïḯỉǐȉȋịįḭɨı"},{base:"j",letters:"jⓙjĵǰɉ"},{base:"k",letters:"kⓚkḱǩḳķḵƙⱪꝁꝃꝅꞣ"},{base:"l",letters:"lⓛlŀĺľḷḹļḽḻſłƚɫⱡꝉꞁꝇ"},{base:"lj",letters:"lj"},{base:"m",letters:"mⓜmḿṁṃɱɯ"},{base:"n",letters:"nⓝnǹńñṅňṇņṋṉƞɲʼnꞑꞥ"},{base:"nj",letters:"nj"},{base:"o",letters:"oⓞoòóôồốỗổõṍȭṏōṑṓŏȯȱöȫỏőǒȍȏơờớỡởợọộǫǭøǿɔꝋꝍɵ"},{base:"oi",letters:"ƣ"},{base:"ou",letters:"ȣ"},{base:"oo",letters:"ꝏ"},{base:"p",letters:"pⓟpṕṗƥᵽꝑꝓꝕ"},{base:"q",letters:"qⓠqɋꝗꝙ"},{base:"r",letters:"rⓡrŕṙřȑȓṛṝŗṟɍɽꝛꞧꞃ"},{base:"s",letters:"sⓢsßśṥŝṡšṧṣṩșşȿꞩꞅẛ"},{base:"t",letters:"tⓣtṫẗťṭțţṱṯŧƭʈⱦꞇ"},{base:"tz",letters:"ꜩ"},{base:"u",letters:"uⓤuùúûũṹūṻŭüǜǘǖǚủůűǔȕȗưừứữửựụṳųṷṵʉ"},{base:"v",letters:"vⓥvṽṿʋꝟʌ"},{base:"vy",letters:"ꝡ"},{base:"w",letters:"wⓦwẁẃŵẇẅẘẉⱳ"},{base:"x",letters:"xⓧxẋẍ"},{base:"y",letters:"yⓨyỳýŷỹȳẏÿỷẙỵƴɏỿ"},{base:"z",letters:"zⓩzźẑżžẓẕƶȥɀⱬꝣ"}],A=function(){function e(){var e=this;this.defaultDiacriticsRemovalMap=M,this.diacriticsMap={},this.defaultDiacriticsRemovalMap.forEach((function(t){return t.letters.split("").forEach((function(s){return e.diacriticsMap[s]=t.base}))}))}return e.prototype.removeDiacritics=function(e){var t=this;return null==e?e:e.replace(/[^\u0000-\u007E]/g,(function(e){return t.diacriticsMap[e]||e}))},e.prototype.ngOnDestroy=function(){this.diacriticsMap={}},e.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e},token:e,providedIn:"root"}),e=h([t.Injectable({providedIn:"root"})],e)}(),O=function(){function e(){}return e.findSingle=function(e,t){return e?e.querySelector(t):null},e.scrollInView=function(e,t){var s=getComputedStyle(e).getPropertyValue("borderTopWidth"),i=s?parseFloat(s):0,r=getComputedStyle(e).getPropertyValue("paddingTop"),o=r?parseFloat(r):0,n=e.getBoundingClientRect(),a=t.getBoundingClientRect().top+document.body.scrollTop-(n.top+document.body.scrollTop)-i-o,l=e.scrollTop,p=e.clientHeight,h=this.getOuterHeight(t);a<0?e.scrollTop=l+a:a+h>p&&(e.scrollTop=l+a-p+h)},e.getInnerHeight=function(e){var t=e.offsetHeight,s=getComputedStyle(e);return t+=parseFloat(s.paddingTop)+parseFloat(s.paddingBottom)},e.getOuterHeight=function(e,t){var s=e.offsetHeight;if(t){var i=getComputedStyle(e);s+=parseFloat(i.marginTop)+parseFloat(i.marginBottom)}return s},e.getHeight=function(e){var t=e.offsetHeight,s=getComputedStyle(e);return t-=parseFloat(s.paddingTop)+parseFloat(s.paddingBottom)+parseFloat(s.borderTopWidth)+parseFloat(s.borderBottomWidth)},e}();!function(e){e.SOURCE_PREFILLED="Prefilled"}(f||(f={}));var P,B=function(e,t){this.addressLevel=e,this.prefillData=t};!function(e){e.LOCALITY="LOCALITY",e.STREET="STREET",e.STREET_NUMBER="STREET_NUMBER",e.BOX_NUMBER="BOX_NUMBER"}(P||(P={}));var V=function(){function s(e,s,i,r){this.addressService=e,this.localeService=s,this.translateService=i,this.unicodeService=r,this.labelResourceKey="common.label.postalCode",this.messageOption="Y",this.maxSuggesionCount=5,this.visibleSuggestionCount=5,this.sortCriteria="",this.showDebugMessageToConsole=!0,this.messageChanged=new t.EventEmitter,this.addressChanged=new t.EventEmitter,this.focusEvent=new t.EventEmitter,this.blurEvent=new t.EventEmitter,this.textChangeEvent=new t.EventEmitter,this.clearInputEventEmitter=new t.EventEmitter,this.prefillEventEmitter=new t.EventEmitter,this.validationMessageCode=null,this.validationMessageOptions=null,this.prefilling=!1,this.isPrefillWithNoMatch=!1}return Object.defineProperty(s.prototype,"inputLang",{set:function(e){var t=this;this.localeService.changeLang(e),this.translateService.use(e).subscribe((function(e){t.onChangedLanguage()}))},enumerable:!0,configurable:!0}),s.prototype.ngOnInit=function(){this.searchText="",this.addressIsValidated=!1,this.suggestionValidationMessage="",this.suggestions=[],this.previousIndex=-1,this.lastSearchValue="",this.wordList=[],this.suggestionsWordList=[],this.bpTypeAhead="",this.placeHolderText="",this.skipNextBlur=!1,this.errorCode=null,this.selectedIndex=-1,this.typeAheadWord="",this.collapseDropdown=!1,this.sequenceNumber=0,this.consumedNumber=0,this.setSearchText(""),this.onChangedLanguage()},s.prototype.ngAfterViewChecked=function(){if(this.selectionChanged){var e=this.localityList.nativeElement;setTimeout((function(){var t=O.findSingle(e,"li.active");t&&O.scrollInView(e,t)}),1),this.selectionChanged=!1}},s.prototype.ngOnChanges=function(t){t&&(t.hasOwnProperty("prefillData")&&!t.prefillData.firstChange&&(this.prefilling=!0,this.searchText=this.loadParams(t.prefillData.currentValue),this.showDebugMessageToConsole&&console.log("locality::ngOnChanges - loadParame result:",this.searchText),this.bpTypeAhead="",""!==this.searchText&&this.minLevel===e.ADDRESSLEVEL.LOCALITY&&(this.collapseDropdown=!0,this.prefillData.prefillMunicipalityName=this.transformMunicipalityInLowercaseAndWithoutDiacritics(this.prefillData.parameters.municipalityName),this.onInputChange(f.SOURCE_PREFILLED))),t.hasOwnProperty("inputText")&&!t.inputText.firstChange&&this.notEqualIgnoreCase(this.searchText,t.inputText.currentValue)&&(this.clearWidget(),this.searchText=t.inputText.currentValue))},s.prototype.transformMunicipalityInLowercaseAndWithoutDiacritics=function(e){var t=null;return null!=e&&(t=(t=this.unicodeService.removeDiacritics(e)).toLowerCase()),this.showDebugMessageToConsole&&console.log("prefill municipality",t),t},s.prototype.ngOnDestroy=function(){this.subscription&&this.subscription.unsubscribe()},s.prototype.buildInputWordList=function(){var e,t,s,i;if(this.wordList=this.searchText.split(/[\s, ]+/),this.suggestions&&this.wordList)try{for(var r=c(this.suggestions),o=r.next();!o.done;o=r.next()){var n=o.value;if(n&&n.hasOwnProperty("string")){var a=function(e){var t=l.startsWithIgnoreDiacritics(n.string,e);if(t>=0){var s=n.string.substr(t,e.length),i=l.wordList.find((function(e){return e.toLowerCase()===s.toLowerCase()}));null==i&&l.wordList.push(s)}},l=this;try{for(var p=(s=void 0,c(this.wordList)),h=p.next();!h.done;h=p.next()){a(h.value)}}catch(e){s={error:e}}finally{try{h&&!h.done&&(i=p.return)&&i.call(p)}finally{if(s)throw s.error}}}}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}},s.prototype.stringStartsWithIgnoreDiacritics=function(e,t){var s=this.unicodeService.removeDiacritics(null!=e?e.toLowerCase():e),i=this.unicodeService.removeDiacritics(null!=t?t.toLowerCase():t);return-1!==s.slice(0,i.length).toLowerCase().indexOf(i)},s.prototype.buildTypeAhead=function(e){if(e===f.SOURCE_PREFILLED)return!1;if(this.mayAddTypeAhead()){var t=this.searchText.split(/[\s, ]+/),s=t[t.length-1];if(this.suggestions.some(function(e){return!(!e||!e.hasOwnProperty("string"))&&e.string.split(/[\s-]+/).some(function(e){if(this.stringStartsWithIgnoreDiacritics(e,s))return this.typeAheadWord=e,!0}.bind(this))}.bind(this))){var i=this.typeAheadWord.slice(s.length,this.typeAheadWord.length).toLowerCase();this.bpTypeAhead=this.searchText+i}}},s.prototype.clearConnectionErrorMessage=function(){if(this.errorCode){var e=this.translateService.instant(this.errorCode);this.suggestionValidationMessage===e&&this.clearSuggestionValidationMessage(),this.errorCode=null}},s.prototype.clearTypeAhead=function(){this.bpTypeAhead=""},s.prototype.emitTranslatedValidationMessage=function(t,s){if(null!=t)switch(t){case e.ValidationMessageType.Address_Not_Found:case e.ValidationMessageType.Address_Validated:case e.ValidationMessageType.Service_Unavailable:var i=this.translateService.instant("common.message."+t);this.messageChanged.emit({messageType:t,translatedMessage:i});break;default:console.error("Unable to emit validation message - message key NOT supported!",t)}else console.warn("Unable to emit validation message - message key is invalid!",t)},s.prototype.generateParameters=function(){var e=new y({id:this.sequenceNumber,q:this.searchText,maxNumberOfSuggestions:this.maxSuggesionCount});switch(this.sortCriteria){case"P":e.sortByPostalCode(!0);break;case"L":e.sortByLocalityname(!0)}return e},s.prototype.getTopSuggestions=function(e){var t=this;this.sequenceNumber+=1;var s=this.generateParameters();this.showDebugMessageToConsole&&console.log("LOCALITY calling service params",s),this.searchText&&(this.subscription=this.addressService.getLocality(this.baseUrl,s).subscribe((function(s){t.showDebugMessageToConsole&&console.log("locality suggestions received:",s),t.handleGetLocalityResponse(s,e),e===f.SOURCE_PREFILLED?(t.isPrefillWithNoMatch=!0!==t.prefillData.prefillMunicipalityPerfectMatchFound,t.prefillAnalyzeData()):t.isPrefillWithNoMatch=!1}),(function(){return t.handleGetLocalityError()})))},s.prototype.getTextColor=function(){return!0===this.isPrefillWithNoMatch?"orangered":""},s.prototype.handleGetLocalityResponse=function(e,t){this.showDebugMessageToConsole&&console.log("handleGetLocalityResponse",e),e&&e.response&&e.response.sequenceNumber&&e.response.sequenceNumber>=this.consumedNumber&&e.response.topSuggestions&&(this.consumedNumber=e.response.sequenceNumber,this.clearSuggestions(),this.parseTopSuggestions(e.response.topSuggestions,t),this.buildTypeAhead(t),this.clearConnectionErrorMessage(),this.buildInputWordList()),this.collapseDropdown=!0===this.prefilling&&null!==this.prefillData&&!this.prefillData.parameters.onFocusShowSuggestionsAfterPrefill},s.prototype.handleGetLocalityError=function(){this.setConnectionErrorMessage()},s.prototype.isBrowserIE=function(){return/msie\s|trident\/|edge\//i.test(window.navigator.userAgent)},s.prototype.isDropdownClicked=function(e){return"bpaac-locality-dropdown"===(e.explicitOriginalTarget||document.activeElement).id},s.prototype.isString=function(e){return e.constructor===String},s.prototype.loadParams=function(e){var t="";return null!==e&&null!==e.parameters&&(e.parameters.hasOwnProperty("minLevel")&&(this.minLevel=e.parameters.minLevel),e.parameters.hasOwnProperty("postalCode")&&this.isString(e.parameters.postalCode)&&(t=e.parameters.postalCode),e.parameters.hasOwnProperty("municipalityName")&&this.isString(e.parameters.municipalityName)&&(t+=" "+e.parameters.municipalityName)),t},s.prototype.mayShowClearButton=function(){return this.searchText.length>0},s.prototype.mayAddTypeAhead=function(){return 0!==this.searchText.length&&/[^\s, \\\/]$/.test(this.searchText)},s.prototype.notEqualIgnoreCase=function(e,t){return e.toLowerCase()!==t.toLowerCase()},s.prototype.onBlur=function(t){this.isBrowserIE()&&this.isDropdownClicked(t)?this.localitySearchInput.nativeElement.focus():this.skipNextBlur?this.skipNextBlur=!1:(this.collapseDropdown=!0,this.blurEvent.emit(e.ADDRESSLEVEL.LOCALITY))},s.prototype.onFocus=function(){this.collapseDropdown=!1,this.skipNextBlur=!1,this.focusEvent.emit(e.ADDRESSLEVEL.LOCALITY)},s.prototype.onInputClick=function(){this.showDebugMessageToConsole&&console.log("locality click")},s.prototype.onInputChange=function(e){this.collapseDropdown=!1,this.resetArrowSelectedIndex(),e||(this.prefilling=!1,this.valueChanged()),this.clearSuggestionValidationMessage(),""===this.searchText?(this.sequenceNumber+=1,this.consumedNumber=this.sequenceNumber,this.clearSuggestions()):this.getTopSuggestions(e),this.buildInputWordList()},s.prototype.parseSingleSuggestion=function(e,t){var s,i,r;if(this.localeService.isLocaleFrench()&&e.hasOwnProperty("french")?r=e.french:this.localeService.isLocaleDutch()&&e.hasOwnProperty("dutch")?r=e.dutch:this.localeService.isLocaleGerman()&&e.hasOwnProperty("german")?r=e.german:e.hasOwnProperty("address")&&(r=e.address),r){if(e.messages&&(r.messages=e.messages),this.suggestions.push(r),"Y"===this.messageOption&&r.hasOwnProperty("messages"))try{for(var o=c(r.messages),n=o.next();!n.done;n=o.next()){var a=n.value,l=this.translateMessage(a);null!==l&&(a.translatedMessage=l)}}catch(e){s={error:e}}finally{try{n&&!n.done&&(i=o.return)&&i.call(o)}finally{if(s)throw s.error}}t===f.SOURCE_PREFILLED&&(e.address=r,this.prefillCheckForPerfectMatch(e))}},s.prototype.prefillCheckForPerfectMatch=function(e){var t=e.address;if(/*! this.prefillData.prefillMunicipalityPerfectMatchFound &&*/t.postalCode===this.prefillData.parameters.postalCode){this.showDebugMessageToConsole&&console.log("LOCALITY - PREFILL - checking suggestion for perfect match",this.prefillData,e);var s=this.transformMunicipalityInLowercaseAndWithoutDiacritics(t.localityName),i=this.transformMunicipalityInLowercaseAndWithoutDiacritics(t.municipalityName);if(s===this.prefillData.prefillMunicipalityName||i===this.prefillData.prefillMunicipalityName){if(!0===this.prefillData.prefillMunicipalityAndLocalityPerfectMatchFound)return this.showDebugMessageToConsole&&console.log("LOCALITY - PREFILL - skipping suggestion:",e),void(this.showDebugMessageToConsole&&console.log("LOCALITY - PREFILL - keeping suggestion:",this.prefillData.prefillMunicipalityPerfectMatchSuggestion));this.prefillData.prefillMunicipalityPerfectMatchFound=!0,this.prefillData.prefillMunicipalityPerfectMatchSuggestion=e,this.searchText=t.postalCode+" "+t.localityName,this.prefillData.prefillMunicipalityAndLocalityPerfectMatchFound=s===this.prefillData.prefillMunicipalityName&&i===this.prefillData.prefillMunicipalityName,!0===this.prefillData.prefillMunicipalityAndLocalityPerfectMatchFound?this.showDebugMessageToConsole&&console.log("LOCALITY - PREFILL - Perfect match - Municipality & location:",e):this.showDebugMessageToConsole&&console.log("LOCALITY - PREFILL - Perfect match:",e)}}},s.prototype.prefillAnalyzeData=function(){!0===this.prefillData.prefillMunicipalityPerfectMatchFound&&(this.collapseDropdown=!0),this.prefillEventEmitter.emit(new B(e.ADDRESSLEVEL.LOCALITY,this.prefillData))},s.prototype.parseTopSuggestions=function(e,t){var s,i;if(this.showDebugMessageToConsole&&console.log("locality - parse suggestions",e),e.constructor===Array)try{for(var r=c(e),o=r.next();!o.done;o=r.next()){var n=o.value;this.parseSingleSuggestion(n,t)}}catch(e){s={error:e}}finally{try{o&&!o.done&&(i=r.return)&&i.call(r)}finally{if(s)throw s.error}}else this.parseSingleSuggestion(e,t)},s.prototype.resetArrowSelectedIndex=function(){this.selectedIndex=-1},s.prototype.startsWithIgnoreDiacritics=function(e,t){var s=this.unicodeService.removeDiacritics(null!=e?e.toLowerCase():e),i=this.unicodeService.removeDiacritics(null!=t?t.toLowerCase():t);return s.indexOf(i)},s.prototype.valueChanged=function(){this.textChangeEvent.emit(this.searchText)},s.prototype.clearInput=function(e,t){void 0===t&&(t=!0),this.clearSuggestions(),this.bpTypeAhead="",this.setSearchText(""),this.resetArrowSelectedIndex(),this.previousIndex=-1,this.lastSearchValue="",this.clearSuggestionValidationMessage(),this.clearSelectedAddress(),this.valueChanged(),this.clearConnectionErrorMessage(),!0===e&&this.localitySearchInput.nativeElement.focus(),t&&this.clearInputEventEmitter.emit(P.LOCALITY)},s.prototype.clearSearchText=function(){this.searchText=""},s.prototype.clearSelectedAddress=function(){this.addressChanged.emit(null),this.addressIsValidated=!1},s.prototype.clearSuggestionValidationMessage=function(){this.addressIsValidated=!1,this.suggestionValidationMessage="",this.messageChanged.emit({messageType:null,translatedMessage:this.suggestionValidationMessage}),this.validationMessageOptions=null,this.validationMessageCode=null},s.prototype.clearSuggestions=function(){this.wordList=[],this.suggestions=[],this.suggestionsWordList=[]},s.prototype.clickSuggestion=function(e,t){this.isPrefillWithNoMatch=!1,e.preventDefault(),this.clearTypeAhead(),this.resetArrowSelectedIndex(),this.setSearchText(t.string),this.collapseDropdown=!0,this.addressIsValidated=!0,this.clearSuggestions(),this.setSelectedAddress(t)},s.prototype.clearWidget=function(){this.clearSearchText(),this.clearSuggestions(),this.clearTypeAhead(),this.prefillData=null,this.prefilling=!1},s.prototype.cursorIsOnSuggestionList=function(){return this.selectedIndex>=0},s.prototype.onChangedLanguage=function(){var e=this;this.translateService.get("locality.placeholder.input-placeholder").subscribe((function(t){e.placeHolderText=t}))},s.prototype.changeSelection=function(){this.suggestions.length>0&&(this.selectionChanged=!0)},s.prototype.moveArrowSelectedIndexDown=function(){this.selectedIndex+1!==this.suggestions.length&&(this.selectedIndex++,this.changeSelection(),this.setSearchTextBasedOnArrowSelection(this.selectedIndex,this.selectedIndex-1))},s.prototype.moveArrowSelectedIndexUp=function(){this.selectedIndex-1!=-2&&(this.selectedIndex--,this.changeSelection(),this.setSearchTextBasedOnArrowSelection(this.selectedIndex,this.selectedIndex+1))},s.prototype.checkKeyDown=function(e){switch(e.which){case 40:e.preventDefault(),this.moveArrowSelectedIndexDown();break;case 38:e.preventDefault(),this.moveArrowSelectedIndexUp();break;case 39:e.preventDefault(),this.cursorIsOnSuggestionList()?this.clickSuggestion(e,this.suggestions[this.selectedIndex]):this.typeAheadWord&&this.typeAheadIsShown()&&(this.setSearchText(this.bpTypeAhead),this.typeAheadWord="");break;case 9:this.addressIsValidated||(e.preventDefault(),this.selectFirstInListOfSuggesions());break;case 46:e.ctrlKey&&this.clearWidget();break;case 13:e.preventDefault(),this.cursorIsOnSuggestionList()&&this.clickSuggestion(e,this.suggestions[this.selectedIndex]);break;default:this.clearTypeAhead()}},s.prototype.setConnectionErrorMessage=function(){this.errorCode=e.ValidationMessageType.Service_Unavailable,this.emitTranslatedValidationMessage(e.ValidationMessageType.Service_Unavailable)},s.prototype.setSelectedAddress=function(e){this.addressChanged.emit(e)},s.prototype.translateMessage=function(e){switch(e.key){case"subl":if(e.args&&2===e.args.length)return this.translateService.instant("locality.suggestion.message.subl",{sub:e.args[0],principal:e.args[1]})}return null},s.prototype.typeAheadIsShown=function(){return this.bpTypeAhead&&this.bpTypeAhead.length>0},s.prototype.selectFirstInListOfSuggesions=function(){this.selectedIndex=0,this.changeSelection(),this.setSearchTextBasedOnArrowSelection(this.selectedIndex,this.selectedIndex-1)},s.prototype.setSearchText=function(e){this.searchText=e},s.prototype.setSearchTextBasedOnArrowSelection=function(e,t){void 0===e||this.suggestions.length<=0||(-1!==e?(-1===t&&(this.lastSearchValue=this.searchText),this.setSearchText(this.suggestions[this.selectedIndex].string),this.clearTypeAhead()):this.setSearchText(this.lastSearchValue))},s.ctorParameters=function(){return[{type:L},{type:D},{type:o.TranslateService},{type:A}]},h([t.ViewChild("localitySearchInput",{static:!1})],s.prototype,"localitySearchInput",void 0),h([t.ViewChild("localityList",{static:!1})],s.prototype,"localityList",void 0),h([t.Input()],s.prototype,"labelResourceKey",void 0),h([t.Input()],s.prototype,"messageOption",void 0),h([t.Input()],s.prototype,"maxSuggesionCount",void 0),h([t.Input()],s.prototype,"visibleSuggestionCount",void 0),h([t.Input()],s.prototype,"sortCriteria",void 0),h([t.Input()],s.prototype,"baseUrl",void 0),h([t.Input()],s.prototype,"inputText",void 0),h([t.Input()],s.prototype,"prefillData",void 0),h([t.Input()],s.prototype,"showDebugMessageToConsole",void 0),h([t.Input()],s.prototype,"inputLang",null),h([t.Output()],s.prototype,"messageChanged",void 0),h([t.Output()],s.prototype,"addressChanged",void 0),h([t.Output()],s.prototype,"focusEvent",void 0),h([t.Output()],s.prototype,"blurEvent",void 0),h([t.Output()],s.prototype,"textChangeEvent",void 0),h([t.Output()],s.prototype,"clearInputEventEmitter",void 0),h([t.Output()],s.prototype,"prefillEventEmitter",void 0),s=h([t.Component({selector:"bp-locality",template:'<span *ngIf="labelResourceKey">{{ labelResourceKey | translate}}</span>\n<div class="bpaac-dropdown">\n <div class="bpaac-search-bar">\n <div class="bpaac-input-width">\n \n <input type="text" #localitySearchInput class="bpaac-input" \n (keydown)="checkKeyDown($event)" (input)="onInputChange()"\n [style.color]=" getTextColor() "\n [(ngModel)]="searchText" id="localityInputField" [attr.placeholder]="placeHolderText" autocomplete="off"\n (blur)="onBlur($event)" (focus)="onFocus()" (click)="onInputClick()"/>\n <div id="bpaac-clear-locality-button" \n *ngIf="mayShowClearButton()"\n (click)="clearInput(true)" class="bpaac-clear">\n </div>\n </div>\n \x3c!--<div ng-transclude></div>--\x3e\n <input id="bpaac-locality-typeahead" type="text" disabled autocomplete="off" [(ngModel)]="bpTypeAhead" />\n </div>\n <div [hidden]="collapseDropdown" class="bpaac-dropdown-menu-container" *ngIf="suggestions && suggestions.length>0">\n <div #localityList [appVisibleSuggestion]="visibleSuggestionCount" id="bpaac-locality-dropdown" \n class="bpaac-dropdown-menu">\n <ul role="listbox" id="bpaac-locality-suggestionsList" class="list-unstyled">\n <li role="option" \n *ngFor="let option of suggestions; let idx = index" \n [ngClass]="{\'active\':(selectedIndex==idx)}" (mousedown)="clickSuggestion($event, option)"\n (mouseenter)="selectedIndex=idx" (mouseleave)="selectedIndex=-1">\n <span *ngIf="option" [innerHtml]="option.string | highlightSuggestion : wordList"></span> \n <span *ngIf="messageOption === \'P\' && option.messages"> ({{option.municipalityName}})</span><br />\n <ng-container *ngIf="messageOption === \'Y\'">\n <span *ngFor="let message of option.messages" \n class="bpaac-suggestion-message"\n [innerHtml]="message.translatedMessage"></span> \n </ng-container>\n </li>\n </ul>\n </div>\n </div>\n</div>',styles:[""]})],s)}(),R=function(){function s(e,s,i,r){this.addressService=e,this.localeService=s,this.translateService=i,this.unicodeService=r,this.subscription=null,this.labelResourceKey="common.label.streetName",this.maxSuggesionCount=5,this.visibleSuggesionCount=5,this.sortCriteria="",this.showDebugMessageToConsole=!0,this.messageOption="Y",this.messageChanged=new t.EventEmitter,this.addressChanged=new t.EventEmitter,this.focusEvent=new t.EventEmitter,this.blurEvent=new t.EventEmitter,this.textChangeEvent=new t.EventEmitter,this.clearInputEventEmitter=new t.EventEmitter,this.prefillEventEmitter=new t.EventEmitter,this.validationMessageCode=null,this.validationMessageOptions=null,this.prefilling=!1,this.isPrefillWithNoMatch=!1}return Object.defineProperty(s.prototype,"inputLang",{set:function(e){var t=this;this.localeService.changeLang(e),this.translateService.use(e).subscribe((function(e){t.onChangedLanguage()}))},enumerable:!0,configurable:!0}),s.prototype.ngOnInit=function(){this.searchText="",this.addressIsValidated=!1,this.suggestionValidationMessage="",this.suggestions=[],this.previousIndex=-1,this.lastSearchValue="",this.wordList=[],this.suggestionsWordList=[],this.bpTypeAhead="",this.placeHolderText="",this.skipNextBlur=!1,this.errorCode=null,this.selectedIndex=-1,this.typeAheadWord="",this.collapseDropdown=!1,this.sequenceNumber=1,this.consumedNumber=1,this.setSearchText(""),this.onChangedLanguage()},s.prototype.ngOnDestroy=function(){this.subscription&&this.subscription.unsubscribe()},s.prototype.onChangedLanguage=function(){var e=this;this.translateService.get("street.placeholder.input-placeholder").subscribe((function(t){e.placeHolderText=t}))},s.prototype.ngAfterViewChecked=function(){if(this.selectionChanged){var e=this.streetList.nativeElement;setTimeout((function(){var t=O.findSingle(e,"li.active");t&&O.scrollInView(e,t)}),1),this.selectionChanged=!1}},s.prototype.ngOnChanges=function(t){t&&(t.hasOwnProperty("prefillData")&&!t.prefillData.firstChange&&(this.prefilling=!0,this.searchText=this.loadParams(t.prefillData.currentValue),""!==this.searchText&&this.minLevel===e.ADDRESSLEVEL.STREET&&(this.collapseDropdown=!0,this.prefillData.prefillStreetName=this.transformStreetNameInLowercaseAndWithoutDiacritics(this.prefillData.parameters.streetName),this.onInputChange(f.SOURCE_PREFILLED))),t.hasOwnProperty("inputText")&&!t.inputText.firstChange&&this.notEqualIgnoreCase(this.searchText,t.inputText.currentValue)&&(this.clearWidget(),this.searchText=t.inputText.currentValue),!t.hasOwnProperty("postalCode")||t.postalCode.firstChange||t.hasOwnProperty("prefillData")||(this.minLevel=e.ADDRESSLEVEL.STREET,""===t.postalCode.currentValue&&(this.clearWidget(),this.valueChanged())))},s.prototype.transformStreetNameInLowercaseAndWithoutDiacritics=function(e){var t=null;return null!=e&&(t=(t=this.unicodeService.removeDiacritics(e)).toLowerCase()),this.showDebugMessageToConsole&&console.log("prefill streetName",t),t},s.prototype.onClearInputEvent=function(e,t){this.clearInput(t)},s.prototype.onBlur=function(t){this.isBrowserIE()&&this.isDropdownClicked(t)?this.streetSearchInput.nativeElement.focus():this.skipNextBlur?this.skipNextBlur=!1:(this.collapseDropdown=!0,this.blurEvent.emit(e.ADDRESSLEVEL.STREET))},s.prototype.isBrowserIE=function(){return/msie\s|trident\/|edge\//i.test(window.navigator.userAgent)},s.prototype.isDropdownClicked=function(e){return"bpaac-street-dropdown"===(e.explicitOriginalTarget||document.activeElement).id},s.prototype.onFocus=function(){this.collapseDropdown=!1,this.showDebugMessageToConsole&&console.log("street comp - onFocus",this.prefilling,this.prefillData,this.collapseDropdown),this.skipNextBlur=!1,this.focusEvent.emit(e.ADDRESSLEVEL.STREET)},s.prototype.mayShowDropdown=function(){return this.suggestions.length>0&&!this.collapseDropdown},s.prototype.buildInputWordList=function(){var e,t,s,i;if(this.wordList=this.searchText.split(/[\s, ]+/),this.suggestions&&this.wordList)try{for(var r=c(this.suggestions),o=r.next();!o.done;o=r.next()){var n=o.value;if(n&&n.hasOwnProperty("string")){var a=function(e){var t=l.startsWithIgnoreDiacritics(n.string,e);if(t>=0){var s=n.string.substr(t,e.length),i=l.wordList.find((function(e){return e.toLowerCase()===s.toLowerCase()}));null==i&&l.wordList.push(s)}},l=this;try{for(var p=(s=void 0,c(this.wordList)),h=p.next();!h.done;h=p.next()){a(h.value)}}catch(e){s={error:e}}finally{try{h&&!h.done&&(i=p.return)&&i.call(p)}finally{if(s)throw s.error}}}}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}},s.prototype.startsWithIgnoreDiacritics=function(e,t){var s=this.unicodeService.removeDiacritics(null!=e?e.toLowerCase():e),i=this.unicodeService.removeDiacritics(null!=t?t.toLowerCase():t);return s.indexOf(i)},s.prototype.mayAddTypeAhead=function(){return 0!==this.searchText.length&&/[^\s, \\\/]$/.test(this.searchText)},s.prototype.valueChanged=function(){this.textChangeEvent.emit(this.searchText)},s.prototype.buildTypeAhead=function(e){if(e===f.SOURCE_PREFILLED)return!1;if(this.mayAddTypeAhead()){var t=this.searchText.split(/[\s, ]+/),s=t[t.length-1];if(this.suggestions.some(function(e){return!(!e||!e.hasOwnProperty("string"))&&e.string.split(/[\s-]+/).some(function(e){if(this.stringStartsWithIgnoreDiacritics(e,s))return this.typeAheadWord=e,!0}.bind(this))}.bind(this))){var i=this.typeAheadWord.slice(s.length,this.typeAheadWord.length).toLowerCase();this.bpTypeAhead=this.searchText+i}}},s.prototype.stringStartsWithIgnoreDiacritics=function(e,t){var s=this.unicodeService.removeDiacritics(null!=e?e.toLowerCase():e),i=this.unicodeService.removeDiacritics(null!=t?t.toLowerCase():t);return-1!==s.slice(0,i.length).toLowerCase().indexOf(i)},s.prototype.getTopSuggestions=function(e){var t=this;this.sequenceNumber+=1;var s=this.generateParameters();this.showDebugMessageToConsole&&console.log("STREET calling service params",s),this.searchText&&(this.subscription=this.addressService.getStreet(this.baseUrl,this.locality,this.postalCode,s).subscribe((function(s){t.handleGetStreetResponse(s,e),e===f.SOURCE_PREFILLED?(t.isPrefillWithNoMatch=!0!==t.prefillData.prefillStreetPerfectMatchFound,t.prefillAnalyzeData()):t.isPrefillWithNoMatch=!1}),(function(){return t.handleGetStreetError()})))},s.prototype.getTextColor=function(){return!0===this.isPrefillWithNoMatch?"orangered":""},s.prototype.loadParams=function(e){var t="";return null!==e&&null!==e.parameters&&(e.parameters.hasOwnProperty("minLevel")&&(this.minLevel=e.parameters.minLevel),e.parameters.hasOwnProperty("postalCode")&&this.isString(e.parameters.postalCode)&&(this.postalCode=e.parameters.postalCode),e.parameters.hasOwnProperty("municipalityName")&&this.isString(e.parameters.municipalityName)&&(this.locality=e.parameters.municipalityName),e.parameters.hasOwnProperty("streetName")&&this.isString(e.parameters.streetName)&&this.isParamsComplete()&&(t=e.parameters.streetName)),t},s.prototype.isString=function(e){return null!=e&&e.constructor===String},s.prototype.isValid=function(e){return this.isString(e)&&""!==e},s.prototype.isParamsComplete=function(){return this.isValid(this.postalCode)&&this.isValid(this.locality)},s.prototype.generateParameters=function(){var e=new y({id:this.sequenceNumber,q:this.searchText,postalCode:this.postalCode,locality:this.locality,maxNumberOfSuggestions:this.maxSuggesionCount});return"S"===this.sortCriteria&&e.sortByStreet(!0),e},s.prototype.handleGetStreetResponse=function(e,t){e&&e.response&&e.response.sequenceNumber&&e.response.sequenceNumber>=this.consumedNumber&&e.response.topSuggestions&&(this.consumedNumber=e.response.sequenceNumber,this.clearSuggestions(),this.parseTopSuggestions(e.response.topSuggestions,t),this.buildTypeAhead(t),this.clearConnectionErrorMessage(),this.buildInputWordList()),this.collapseDropdown=!0===this.prefilling&&null!==this.prefillData&&!this.prefillData.parameters.onFocusShowSuggestionsAfterPrefill},s.prototype.handleGetStreetError=function(){this.setConnectionErrorMessage()},s.prototype.setConnectionErrorMessage=function(){this.errorCode=e.ValidationMessageType.Service_Unavailable,this.emitTranslatedValidationMessage(e.ValidationMessageType.Service_Unavailable)},s.prototype.clearConnectionErrorMessage=function(){if(this.errorCode){var e=this.translateService.instant(this.errorCode);this.suggestionValidationMessage===e&&this.clearSuggestionValidationMessage(),this.errorCode=null}},s.prototype.parseTopSuggestions=function(e,t){var s,i;if(e.constructor===Array)try{for(var r=c(e),o=r.next();!o.done;o=r.next()){var n=o.value;this.parseSingleSuggestion(n,t)}}catch(e){s={error:e}}finally{try{o&&!o.done&&(i=r.return)&&i.call(r)}finally{if(s)throw s.error}}else this.parseSingleSuggestion(e,t)},s.prototype.parseSingleSuggestion=function(e,t){var s;this.localeService.isLocaleFrench()&&e.hasOwnProperty("french")?s=e.french:this.localeService.isLocaleDutch()&&e.hasOwnProperty("dutch")?s=e.dutch:this.localeService.isLocaleGerman()&&e.hasOwnProperty("german")?s=e.german:e.hasOwnProperty("address")&&(s=e.address),s&&(e.messages&&(s.messages=e.messages),this.suggestions.push(s),t===f.SOURCE_PREFILLED&&(e.address=s,this.prefillCheckForPerfectMatch(e)))},s.prototype.prefillCheckForPerfectMatch=function(e){this.showDebugMessageToConsole&&console.log("street - checking suggestion for perfect match",this.prefillData,e);var t=e.address,s=this.transformStreetNameInLowercaseAndWithoutDiacritics(t.localityName),i=this.transformStreetNameInLowercaseAndWithoutDiacritics(t.municipalityName);s!==this.prefillData.prefillMunicipalityName&&i!==this.prefillData.prefillMunicipalityName||this.transformStreetNameInLowercaseAndWithoutDiacritics(t.streetName)===this.prefillData.prefillStreetName&&(this.prefillData.prefillStreetPerfectMatchFound=!0,this.prefillData.prefillStreetPerfectMatchSuggestion=e,this.searchText=t.streetName)},s.prototype.onInputChange=function(e){this.collapseDropdown=!1,this.resetArrowSelectedIndex(),e||(this.prefilling=!1,this.valueChanged()),this.clearSuggestionValidationMessage(),""===this.searchText?(this.sequenceNumber+=1,this.consumedNumber=this.sequenceNumber,this.clearSuggestions()):this.getTopSuggestions(e),this.buildInputWordList()},s.prototype.prefillAnalyzeData=function(){!0===this.prefillData.prefillStreetPerfectMatchFound&&(this.collapseDropdown=!0),this.prefillEventEmitter.emit(new B(e.ADDRESSLEVEL.STREET,this.prefillData))},s.prototype.clickSuggestion=function(e,t){this.isPrefillWithNoMatch=!1,this.showDebugMessageToConsole&&console.log("streetNumber::clickSuggestion",e,t),null==e||e.preventDefault(),this.clearTypeAhead(),this.resetArrowSelectedIndex(),this.setSearchText(t.string),this.collapseDropdown=!0,this.addressIsValidated=!0,e&&this.clearSuggestions(),this.setSelectedAddress(t)},s.prototype.setSelectedAddress=function(e){this.addressChanged.emit(e)},s.prototype.clearSelectedAddress=function(){this.addressChanged.emit(null),this.addressIsValidated=!1},s.prototype.emitTranslatedValidationMessage=function(t,s){if(null!=t)switch(t){case e.ValidationMessageType.Address_Not_Found:case e.ValidationMessageType.Address_Validated:case e.ValidationMessageType.Service_Unavailable:var i=this.translateService.instant(t);this.messageChanged.emit({messageType:t,translatedMessage:i});break;default:console.error("Unable to emit validation message - message key NOT supported!",t)}else console.warn("Unable to emit validation message - message key is invalid!",t)},s.prototype.showAddressIsValidated=function(){this.emitTranslatedValidationMessage(e.ValidationMessageType.Address_Validated)},s.prototype.checkKeyDown=function(e){switch(e.which){case 40:e.preventDefault(),this.moveArrowSelectedIndexDown();break;case 38:e.preventDefault(),this.moveArrowSelectedIndexUp();break;case 39:e.preventDefault(),this.cursorIsOnSuggestionList()?this.clickSuggestion(e,this.suggestions[this.selectedIndex]):this.typeAheadWord&&this.typeAheadIsShown()&&(this.setSearchText(this.bpTypeAhead),this.typeAheadWord="");break;case 9:this.addressIsValidated||e.shiftKey||(e.preventDefault(),this.selectFirstInListOfSuggesions());break;case 46:e.ctrlKey&&this.clearWidget();break;case 13:e.preventDefault(),this.cursorIsOnSuggestionList()&&this.clickSuggestion(e,this.suggestions[this.selectedIndex]);break;default:this.clearTypeAhead()}},s.prototype.clearWidget=function(){this.addressIsValidated=!1,this.clearSearchText(),this.clearSuggestions(),this.clearTypeAhead(),this.prefillData=null,this.prefilling=!1},s.prototype.clearSearchText=function(){this.searchText=""},s.prototype.typeAheadIsShown=function(){return this.bpTypeAhead&&this.bpTypeAhead.length>0},s.prototype.resetArrowSelectedIndex=function(){this.selectedIndex=-1},s.prototype.moveArrowSelectedIndexDown=function(){this.selectedIndex+1!==this.suggestions.length&&(this.selectedIndex++,this.changeSelection(),this.setSearchTextBasedOnArrowSelection(this.selectedIndex,this.selectedIndex-1))},s.prototype.moveArrowSelectedIndexUp=function(){this.selectedIndex-1!=-2&&(this.selectedIndex--,this.changeSelection(),this.setSearchTextBasedOnArrowSelection(this.selectedIndex,this.selectedIndex+1))},s.prototype.cursorIsOnSuggestionList=function(){return this.selectedIndex>=0},s.prototype.setSearchTextBasedOnArrowSelection=function(e,t){void 0===e||this.suggestions.length<=0||(-1!==e?(-1===t&&(this.lastSearchValue=this.searchText),this.setSearchText(this.suggestions[this.selectedIndex].string),this.clearTypeAhead()):this.setSearchText(this.lastSearchValue))},s.prototype.mayShowClearButton=function(){return this.searchText.length>0},s.prototype.clearInput=function(e,t){void 0===t&&(t=!0),this.clearWidget(),this.resetArrowSelectedIndex(),this.previousIndex=-1,this.lastSearchValue="",this.clearSuggestionValidationMessage(),this.valueChanged(),this.clearConnectionErrorMessage(),!0===e&&this.streetSearchInput.nativeElement.focus(),t&&this.clearInputEventEmitter.emit(P.STREET)},s.prototype.clearSuggestions=function(){this.wordList=[],this.suggestions=[],this.suggestionsWordList=[]},s.prototype.clearTypeAhead=function(){this.bpTypeAhead=""},s.prototype.clearSuggestionValidationMessage=function(){this.suggestionValidationMessage="",this.addressIsValidated=!1,this.messageChanged.emit({messageType:null,translatedMessage:this.suggestionValidationMessage}),this.validationMessageOptions=null,this.validationMessageCode=null},s.prototype.setSearchText=function(e){this.searchText=e},s.prototype.selectFirstInListOfSuggesions=function(){this.selectedIndex=0,this.changeSelection(),this.setSearchTextBasedOnArrowSelection(this.selectedIndex,this.selectedIndex-1)},s.prototype.changeSelection=function(){this.suggestions.length>0&&(this.selectionChanged=!0)},s.prototype.suggestionMouseLeave=function(){this.selectedIndex=-1},s.prototype.notEqualIgnoreCase=function(e,t){return e.toLowerCase()!==t.toLowerCase()},s.prototype.showAddressNotFoundMessage=function(){this.emitTranslatedValidationMessage(e.ValidationMessageType.Address_Not_Found)},s.prototype.isDisabled=function(){return""===this.locality||""===this.postalCode||this.minLevel>e.ADDRESSLEVEL.STREET},s.prototype.onInputClick=function(){this.showDebugMessageToConsole&&console.log("street click"),this.prefilling=!1,this.collapseDropdown=!1},s.ctorParameters=function(){return[{type:L},{type:D},{type:o.TranslateService},{type:A}]},h([t.ViewChild("streetSearchInput",{static:!1})],s.prototype,"streetSearchInput",void 0),h([t.ViewChild("streetList",{static:!1})],s.prototype,"streetList",void 0),h([t.Input()],s.prototype,"labelResourceKey",void 0),h([t.Input()],s.prototype,"maxSuggesionCount",void 0),h([t.Input()],s.prototype,"visibleSuggesionCount",void 0),h([t.Input()],s.prototype,"sortCriteria",void 0),h([t.Input()],s.prototype,"baseUrl",void 0),h([t.Input()],s.prototype,"prefillData",void 0),h([t.Input()],s.prototype,"showDebugMessageToConsole",void 0),h([t.Input()],s.prototype,"postalCode",void 0),h([t.Input()],s.prototype,"locality",void 0),h([t.Input()],s.prototype,"inputText",void 0),h([t.Input()],s.prototype,"messageOption",void 0),h([t.Input()],s.prototype,"inputLang",null),h([t.Output()],s.prototype,"messageChanged",void 0),h([t.Output()],s.prototype,"addressChanged",void 0),h([t.Output()],s.prototype,"focusEvent",void 0),h([t.Output()],s.prototype,"blurEvent",void 0),h([t.Output()],s.prototype,"textChangeEvent",void 0),h([t.Output()],s.prototype,"clearInputEventEmitter",void 0),h([t.Output()],s.prototype,"prefillEventEmitter",void 0),s=h([t.Component({selector:"bp-street",template:'<span *ngIf="labelResourceKey">{{ labelResourceKey | translate}}</span>\n<div class="bpaac-dropdown">\n <div class="bpaac-search-bar">\n <div class="bpaac-input-width">\n \x3c!-- [disabled]="isDisabled()" --\x3e\n <input type="text" #streetSearchInput class="bpaac-input" \n [style.background-color]="!isParamsComplete() ? \'lightgrey\' : \'\'" \n [style.color]=" getTextColor() "\n [disabled]="!locality || locality.trim().length === 0" (keydown)="checkKeyDown($event)" \n (input)="onInputChange()" (click)="onInputClick()"\n [(ngModel)]="searchText" id="streetInputField" [attr.placeholder]="placeHolderText" autocomplete="off"\n (blur)="onBlur($event)" (focus)="onFocus()" />\n <div id="bpaac-clear-street-button" *ngIf="mayShowClearButton()" (click)="clearInput(true)" class="bpaac-clear">\n </div>\n </div>\n \x3c!--<div ng-transclude></div>--\x3e\n <input id="bpaac-street-typeahead" type="text" disabled autocomplete="off" [(ngModel)]="bpTypeAhead" />\n </div>\n <div [hidden]="collapseDropdown" class="bpaac-dropdown-menu-container" *ngIf="suggestions && suggestions.length>0">\n <div #streetList [appVisibleSuggestion]="visibleSuggesionCount" id="bpaac-street-dropdown" class="bpaac-dropdown-menu">\n <ul role="listbox" id="bpaac-street-suggestionsList" class="list-unstyled">\n <li role="option" *ngFor="let option of suggestions; let idx = index" [ngClass]="{\'active\':(selectedIndex==idx)}" (mousedown)="clickSuggestion($event, option)"\n (mouseenter)="selectedIndex=idx" (mouseleave)="selectedIndex=-1">\n <span *ngIf="option" [innerHtml]="option.string | highlightSuggestion : wordList"></span>\n </li>\n </ul>\n </div>\n </div>\n</div>\n',styles:[""]})],s)}(),k=function(){function s(e,s,i,r){this.addressService=e,this.localeService=s,this.translateService=i,this.unicodeService=r,this.showDebugMessageToConsole=!0,this.labelResourceKey="common.label.streetNumber",this.maxSuggesionCount=5,this.visibleSuggesionCount=5,this.sortCriteria="",this.messageOption="Y",this.messageChanged=new t.EventEmitter,this.addressChanged=new t.EventEmitter,this.focusEvent=new t.EventEmitter,this.blurEvent=new t.EventEmitter,this.textChangeEvent=new t.EventEmitter,this.emptyResponseEvent=new t.EventEmitter,this.clearInputEventEmitter=new t.EventEmitter,this.prefillEventEmitter=new t.EventEmitter,this.addressIsValidated=!1,this.addressIsComplete=!1,this.validationMessageCode=null,this.validationMessageOptions=null,this.prefilling=!1,this.isPrefillWithNoMatch=!1}return Object.defineProperty(s.prototype,"inputLang",{set:function(e){var t=this;this.localeService.changeLang(e),this.translateService.use(e).subscribe((function(e){t.onChangedLanguage()}))},enumerable:!0,configurable:!0}),s.prototype.ngOnInit=function(){this.searchText="",this.addressIsValidated=!1,this.addressIsComplete=!1,this.suggestionValidationMessage="",this.suggestions=[],this.previousIndex=-1,this.lastSearchValue="",this.wordList=[],this.suggestionsWordList=[],this.bpTypeAhead="",this.placeHolderText="",this.skipNextBlur=!1,this.errorCode=null,this.selectedIndex=-1,this.typeAheadWord="",this.collapseDropdown=!0,this.sequenceNumber=1,this.consumedNumber=1,this.setSearchText(""),this.setEmptyResponseText(),this.emptyResponse=!0,this.onChangedLanguage()},s.prototype.ngOnDestroy=function(){this.subscription&&this.subscription.unsubscribe()},s.prototype.onChangedLanguage=function(){var e=this;this.translateService.get("streetNumber.placeholder.input-placeholder").subscribe((function(t){e.placeHolderText=t,e.setEmptyResponseText()}))},s.prototype.ngAfterViewChecked=function(){if(this.selectionChanged){var e=this.streetNumberList.nativeElement;setTimeout((function(){var t=O.findSingle(e,"li.active");t&&O.scrollInView(e,t)}),1),this.selectionChanged=!1}},s.prototype.ngOnChanges=function(t){t&&(!t.hasOwnProperty("streetName")||t.streetName.firstChange||t.hasOwnProperty("prefillData")||this.prefilling||(this.minLevel=e.ADDRESSLEVEL.STREET_NUMBER,this.showDebugMessageToConsole&&console.warn("street number - ngOnchanges - streetName changes detection"),""===t.streetName.currentValue&&(this.clearWidget(),this.valueChanged())),!t.hasOwnProperty("inputText")||t.inputText.firstChange||this.prefilling||(this.showDebugMessageToConsole&&console.warn("street number - ngOnchanges - inputText changes detection",this.searchText,t.inputText.currentValue),this.notEqualIgnoreCase(this.searchText,t.inputText.currentValue)&&(this.showDebugMessageToConsole&&console.warn("street number - ngOnchanges - inputText changes detection -> calling clearWidget() !"),this.clearWidget(),this.searchText=t.inputText.currentValue)),t.hasOwnProperty("prefillData")&&!t.prefillData.firstChange&&(this.prefilling=!0,this.addressIsComplete=!1,this.searchText=this.loadParams(t.prefillData.currentValue),""!==this.searchText&&this.minLevel===e.ADDRESSLEVEL.STREET_NUMBER&&(this.collapseDropdown=!0,this.prefillData.prefillStreetNumber=this.transformStreetNumberInLowercaseAndWithoutDiacritics(this.prefillData.parameters.streetNumber),this.onInputChange(f.SOURCE_PREFILLED))))},s.prototype.transformStreetNumberInLowercaseAndWithoutDiacritics=function(e){var t=null;return null!=e&&(t=(t=this.unicodeService.removeDiacritics(e)).toLowerCase()),t},s.prototype.notEqualIgnoreCase=function(e,t){return e.toLowerCase()!==t.toLowerCase()},s.prototype.setEmptyResponseText=function(){this.emptyResponseText=this.translateService.instant("streetNumber.message.not-in-list")},s.prototype.onBlur=function(t){this.isBrowserIE()&&this.isDropdownClicked(t)?this.streetNumberSearchInput.nativeElement.focus():this.skipNextBlur?this.skipNextBlur=!1:(this.collapseDropdown=!0,this.blurEvent.emit(e.ADDRESSLEVEL.STREET_NUMBER))},s.prototype.isBrowserIE=function(){return/msie\s|trident\/|edge\//i.test(window.navigator.userAgent)},s.prototype.isDropdownClicked=function(e){return"bpaac-streetnumber-dropdown"===(e.explicitOriginalTarget||document.activeElement).id},s.prototype.onFocus=function(){this.collapseDropdown=!1,this.skipNextBlur=!1,this.focusEvent.emit(e.ADDRESSLEVEL.STREET_NUMBER)},s.prototype.valueChanged=function(){this.textChangeEvent.emit(this.searchText)},s.prototype.mayShowDropdown=function(){return this.suggestions.length>0&&!this.collapseDropdown},s.prototype.buildInputWordList=function(){this.wordList=this.searchText.split(/[\s, ]+/)},s.prototype.mayAddTypeAhead=function(){return 0!==this.searchText.length&&/[^\s, \\\/]$/.test(this.searchText)},s.prototype.buildTypeAhead=function(e){if(e===f.SOURCE_PREFILLED)return!1;if(this.mayAddTypeAhead()){var t=this.searchText.split(/[\s, ]+/),s=t[t.length-1];if(this.suggestions.some(function(e){return!(!e||!e.hasOwnProperty("string"))&&e.string.split(/[\s-]+/).some(function(e){if(this.stringStartsWithIgnoreDiacritics(e,s))return this.typeAheadWord=e,!0}.bind(this))}.bind(this))){var i=this.typeAheadWord.slice(s.length,this.typeAheadWord.length).toLowerCase();this.bpTypeAhead=this.searchText+i}}},s.prototype.stringStartsWithIgnoreDiacritics=function(e,t){return e=null!=e?e.toLowerCase():e,t=null!=t?t.toLowerCase():t,-1!==this.unicodeService.removeDiacritics(e).slice(0,t.length).toLowerCase().indexOf(this.unicodeService.removeDiacritics(t))},s.prototype.getBackgroundColor=function(){return this.isParamsComplete()?"":"lightgrey"},s.prototype.getTopSuggestions=function(e){var t=this;this.sequenceNumber+=1;var s=this.generateParameters();this.showDebugMessageToConsole&&console.log("STREET-NUMBER calling service params",s),this.searchText&&(this.subscription=this.addressService.getStreet(this.baseUrl,this.locality,this.postalCode,s).subscribe((function(s){t.showDebugMessageToConsole&&console.log("STREET-NUMBER service response",s),t.handleGetStreetResponse(s,e),e===f.SOURCE_PREFILLED?(t.isPrefillWithNoMatch=!0!==t.prefillData.prefillStreetNumberPerfectMatchFound,t.prefillAnalyzeData()):t.isPrefillWithNoMatch=!1}),(function(){return t.handleGetStreetError()})))},s.prototype.getTextColor=function(){return!0===this.isPrefillWithNoMatch?"orangered":""},s.prototype.prefillAnalyzeData=function(){!0===this.prefillData.prefillStreetNumberPerfectMatchFound&&(this.collapseDropdown=!0),this.prefillEventEmitter.emit(new B(e.ADDRESSLEVEL.STREET_NUMBER,this.prefillData))},s.prototype.loadParams=function(e){var t="";return null!==e&&null!==e.parameters&&(e.parameters.hasOwnProperty("minLevel")&&(this.minLevel=e.parameters.minLevel),e.parameters.hasOwnProperty("postalCode")&&this.isString(e.parameters.postalCode)&&(this.postalCode=e.parameters.postalCode),e.parameters.hasOwnProperty("municipalityName")&&this.isString(e.parameters.municipalityName)&&(this.locality=e.parameters.municipalityName),e.parameters.hasOwnProperty("streetName")&&this.isString(e.parameters.streetName)&&(this.streetName=e.parameters.streetName),e.parameters.hasOwnProperty("streetNumber")&&this.isString(e.parameters.streetNumber)&&this.isParamsComplete()&&(t=e.parameters.streetNumber)),t},s.prototype.isString=function(e){return null!=e&&e.constructor===String},s.prototype.isValid=function(e){return this.isString(e)&&""!==e},s.prototype.isParamsComplete=function(){return this.isValid(this.postalCode)&&this.isValid(this.locality)&&this.isValid(this.streetName)},s.prototype.generateParameters=function(){var e=new y({id:this.sequenceNumber,q:this.searchText,postalCode:this.postalCode,locality:this.locality,street:this.streetName,maxNumberOfSuggestions:this.maxSuggesionCount});return"S"===this.sortCriteria&&e.sortByStreetNb(!0),e},s.prototype.handleGetStreetResponse=function(e,t){e&&e.response&&e.response.sequenceNumber&&e.response.sequenceNumber>=this.consumedNumber&&e.response.topSuggestions&&(this.consumedNumber=e.response.sequenceNumber,this.clearSuggestions(),this.parseTopSuggestions(e.response.topSuggestions,t),this.buildTypeAhead(t),this.clearConnectionErrorMessage(),this.buildInputWordList()),this.collapseDropdown=!0===this.prefilling&&null!==this.prefillData&&!this.prefillData.parameters.onFocusShowSuggestionsAfterPrefill},s.prototype.handleGetStreetError=function(){this.setConnectionErrorMessage()},s.prototype.setConnectionErrorMessage=function(){this.errorCode="service-unavailable",this.emitTranslatedValidationMessage(e.ValidationMessageType.Service_Unavailable)},s.prototype.clearConnectionErrorMessage=function(){if(this.errorCode){var e=this.translateService.instant(this.errorCode);this.suggestionValidationMessage===e&&this.clearSuggestionValidationMessage(),this.errorCode=null}},s.prototype.parseTopSuggestions=function(e,t){var s,i;if(e.constructor===Array){try{for(var r=c(e),o=r.next();!o.done;o=r.next()){var n=o.value;this.parseSingleSuggestion(n,t)}}catch(e){s={error:e}}finally{try{o&&!o.done&&(i=r.return)&&i.call(r)}finally{if(s)throw s.error}}if(t){if(this.prefilling&&this.notInListAllowed&&!1===this.prefillData.prefillStreetNumberPerfectMatchFound&&null!==this.prefillData.prefillStreetNumber&&void 0!==this.prefillData.prefillStreetNumber&&this.prefillData.prefillStreetNumber.length>0){var a=this.prefillBuildNotInListSuggestion();this.showDebugMessageToConsole&&console.log("STREET NUMBER - PREFILL NOT IN LIST SUGGESTION:",a),this.prefillCheckForPerfectMatch(a)}}else(0===e.length||this.emptyResponse)&&this.notInListAllowed&&this.suggestions.push({string:this.searchText,"not-in-list":!0})}else this.parseSingleSuggestion(e,t)},s.prototype.prefillBuildNotInListSuggestion=function(){var e={string:this.searchText,"not-in-list":!0},t=this.prefillData.prefillStreetPerfectMatchSuggestion,s=p(p({},t.address),e);delete s.mailBoxid,delete s.suffixId,s.houseNumber=s.string,s.searchBarString=s.string;var i=!1;if(this.prefillData.parameters.hasOwnProperty("boxNumber")){var r=this.prefillData.parameters.boxNumber;i=!(null!=r&&r.length>0)}else i=!0;return!0===i&&(s.isComplete=i),t.address=s,t},s.prototype.parseSingleSuggestion=function(e,t){var s;this.localeService.isLocaleFrench()&&e.hasOwnProperty("french")?s=e.french:this.localeService.isLocaleDutch()&&e.hasOwnProperty("dutch")?s=e.dutch:this.localeService.isLocaleGerman()&&e.hasOwnProperty("german")?s=e.german:e.hasOwnProperty("address")&&(s=e.address),s&&(e.messages&&(s.messages=e.messages),s.houseNumber===this.searchText&&(this.emptyResponse=!1),this.suggestions.push(s),this.showDebugMessageToConsole&&console.log("streetNumber - add suggestion to list",s),t===f.SOURCE_PREFILLED&&(e.address=s,this.prefillCheckForPerfectMatch(e)))},s.prototype.prefillCheckForPerfectMatch=function(e){if(this.addressIsComplete)this.showDebugMessageToConsole&&console.log("streetNumber::prefillCheckForPerfectMatch - Address complete, skipping suggestion check",e);else{this.showDebugMessageToConsole&&console.log("streetNumber - checking suggestion for perfect match",this.prefillData,e);var t=e.address,s=this.transformStreetNumberInLowercaseAndWithoutDiacritics(""+t.houseNumber);this.showDebugMessageToConsole&&console.log("comparing street numbers",s,this.prefillData.prefillStreetNumber),s===""+this.prefillData.prefillStreetNumber&&(this.prefillData.prefillStreetNumberPerfectMatchFound=!0,this.prefillData.prefillStreetNumberPerfectMatchSuggestion=e,this.searchText=t.houseNumber,t.hasOwnProperty("isComplete")&&!0===t.isComplete&&(this.clickSuggestion(null,t),this.addressIsComplete=!0,this.showDebugMessageToConsole&&!0===this.addressIsComplete&&console.log("ADDRESS COMPLETE ON STREET NUMBER !")))}},s.prototype.onInputChange=function(e){this.showDebugMessageToConsole&&console.log("streetNumber::onInputChange",e),this.collapseDropdown=!1,this.addressIsValidated=!1,this.addressIsComplete=!1,this.emptyResponse=!0,this.resetArrowSelectedIndex(),e||(this.prefilling=!1,this.showDebugMessageToConsole&&console.log("streetNumber::onInputChange -> calling valueChanged"),this.valueChanged()),this.clearSuggestionValidationMessage(),""===this.searchText?(this.sequenceNumber+=1,this.consumedNumber=this.sequenceNumber,this.clearSuggestions()):this.getTopSuggestions(e),this.buildInputWordList()},s.prototype.clickSuggestion=function(e,t){if(this.isPrefillWithNoMatch=!1,this.showDebugMessageToConsole&&console.log("streetNumber::clickSuggestion",e,t),null==e||e.preventDefault(),t){this.clearTypeAhead(),this.resetArrowSelectedIndex(),t.string&&this.setSearchText(t.string),this.collapseDropdown=!0;var s=t["not-in-list"],i=null!=s&&!0===s;t["not-in-list"]&&(t=this.modifySelectedAddress(t),this.showDebugMessageToConsole&&console.log("streetNumber::clickSuggestion - NOT-IN-LIST",e,t)),t.hasOwnProperty("isComplete")&&!0===t.isComplete&&!i&&(this.addressIsComplete=!0),this.addressIsValidated=!0,e&&this.clearSuggestions(),this.setSelectedAddress(t)}},s.prototype.modifySelectedAddress=function(e){this.showDebugMessageToConsole&&console.log("street number - combine selectedAddress with not in list",e,this.selectedAddress);var t=p(p({},this.selectedAddress),e);return delete t.latitude,delete t.longitude,delete t.mailboxId,delete t.pdpId,delete t.suffixId,delete t.pdpId,delete t.pdpId,t.houseNumber=t.string,t.searchBarString=t.string,t.isComplete=!0,t},s.prototype.setSelectedAddress=function(e){var t=e["not-in-list"],s=null!=t&&!0===t;this.addressIsComplete=!(!e.hasOwnProperty("isComplete")||!0!==e.isComplete||s),this.addressChanged.emit(e)},s.prototype.clearSelectedAddress=function(){this.addressChanged.emit(null),this.addressIsValidated=!1,this.addressIsComplete=!1},s.prototype.emitTranslatedValidationMessage=function(t,s){if(null!=t)switch(t){case e.ValidationMessageType.Address_Not_Found:case e.ValidationMessageType.Address_Validated:case e.ValidationMessageType.Service_Unavailable:var i=this.translateService.instant(t);this.messageChanged.emit({messageType:t,translatedMessage:i});break;default:console.error("Unable to emit validation message - message key NOT supported!",t)}else console.warn("Unable to emit validation message - message key is invalid!",t)},s.prototype.notifyAddressIsValidated=function(){this.addressIsComplete=!0,this.emitTranslatedValidationMessage(e.ValidationMessageType.Address_Validated)},s.prototype.checkKeyDown=function(e){switch(e.which){case 40:e.preventDefault(),this.moveArrowSelectedIndexDown();break;case 38:e.preventDefault(),this.moveArrowSelectedIndexUp();break;case 39:e.preventDefault(),this.cursorIsOnSuggestionList()?this.clickSuggestion(e,this.suggestions[this.selectedIndex]):this.typeAheadWord&&this.typeAheadIsShown()&&(this.setSearchText(this.bpTypeAhead),this.typeAheadWord="");break;case 9:this.addressIsValidated||e.shiftKey||(e.preventDefault(),this.selectFirstInListOfSuggesions());break;case 46:e.ctrlKey&&this.clearWidget();break;case 13:e.preventDefault(),this.cursorIsOnSuggestionList()&&this.clickSuggestion(e,this.suggestions[this.selectedIndex]);break;default:this.clearTypeAhead()}},s.prototype.clearWidget=function(){this.showDebugMessageToConsole&&console.log("street number:: clearWidget"),this.addressIsValidated=!1,this.addressIsComplete=!1,this.clearSearchText(),this.clearSuggestions(),this.clearTypeAhead(),this.prefillData=null},s.prototype.clearSearchText=function(){this.searchText=""},s.prototype.typeAheadIsShown=function(){return this.bpTypeAhead&&this.bpTypeAhead.length>0},s.prototype.resetArrowSelectedIndex=function(){this.selectedIndex=-1},s.prototype.moveArrowSelectedIndexDown=function(){this.selectedIndex+1!==this.suggestions.length&&(this.selectedIndex++,this.changeSelection(),this.setSearchTextBasedOnArrowSelection(this.selectedIndex,this.selectedIndex-1))},s.prototype.moveArrowSelectedIndexUp=function(){this.selectedIndex-1!=-2&&(this.selectedIndex--,this.changeSelection(),this.setSearchTextBasedOnArrowSelection(this.selectedIndex,this.selectedIndex+1))},s.prototype.cursorIsOnSuggestionList=function(){return this.selectedIndex>=0},s.prototype.setSearchTextBasedOnArrowSelection=function(e,t){void 0===e||this.suggestions.length<=0||(-1!==e?(-1===t&&(this.lastSearchValue=this.searchText),this.setSearchText(this.suggestions[this.selectedIndex].string),this.clearTypeAhead()):this.setSearchText(this.lastSearchValue))},s.prototype.mayShowClearButton=function(){return this.searchText&&this.searchText.length>0},s.prototype.onClearStreetNumberInput=function(e,t){void 0===t&&(t=!0),this.clearWidget(),this.resetArrowSelectedIndex(),this.previousIndex=-1,this.lastSearchValue="",this.clearSuggestionValidationMessage(),this.valueChanged(),this.clearConnectionErrorMessage(),!0===e&&this.streetNumberSearchInput.nativeElement.focus(),t&&this.clearInputEventEmitter.emit(P.STREET_NUMBER)},s.prototype.clearSuggestions=function(){this.wordList=[],this.suggestions=[],this.suggestionsWordList=[]},s.prototype.clearTypeAhead=function(){this.bpTypeAhead=""},s.prototype.clearSuggestionValidationMessage=function(){this.suggestionValidationMessage="",this.addressIsValidated=!1,this.messageChanged.emit({messageType:null,translatedMessage:this.suggestionValidationMessage}),this.validationMessageOptions=null,this.validationMessageCode=null},s.prototype.setSearchText=function(e){this.searchText=e},s.prototype.selectFirstInListOfSuggesions=function(){this.selectedIndex=0,this.changeSelection(),this.setSearchTextBasedOnArrowSelection(this.selectedIndex,this.selectedIndex-1)},s.prototype.changeSelection=function(){this.suggestions.length>0&&(this.selectionChanged=!0)},s.prototype.suggestionMouseLeave=function(){this.selectedIndex=-1},s.prototype.showAddressNotFoundMessage=function(){this.emitTranslatedValidationMessage(e.ValidationMessageType.Address_Not_Found)},s.prototype.isDisabled=function(){return""===this.locality||""===this.postalCode||this.minLevel>e.ADDRESSLEVEL.STREET_NUMBER},s.prototype.onInputClick=function(){this.showDebugMessageToConsole&&console.log("street number click")},s.ctorParameters=function(){return[{type:L},{type:D},{type:o.TranslateService},{type:A}]},h([t.ViewChild("streetNumberSearchInput",{static:!1})],s.prototype,"streetNumberSearchInput",void 0),h([t.ViewChild("streetNumberList",{static:!1})],s.prototype,"streetNumberList",void 0),h([t.Input()],s.prototype,"prefillData",void 0),h([t.Input()],s.prototype,"showDebugMessageToConsole",void 0),h([t.Input()],s.prototype,"labelResourceKey",void 0),h([t.Input()],s.prototype,"maxSuggesionCount",void 0),h([t.Input()],s.prototype,"visibleSuggesionCount",void 0),h([t.Input()],s.prototype,"sortCriteria",void 0),h([t.Input()],s.prototype,"baseUrl",void 0),h([t.Input()],s.prototype,"addressParams",void 0),h([t.Input()],s.prototype,"postalCode",void 0),h([t.Input()],s.prototype,"locality",void 0),h([t.Input()],s.prototype,"streetName",void 0),h([t.Input()],s.prototype,"notInListAllowed",void 0),h([t.Input()],s.prototype,"selectedAddress",void 0),h([t.Input()],s.prototype,"inputLang",null),h([t.Input()],s.prototype,"messageOption",void 0),h([t.Input()],s.prototype,"inputText",void 0),h([t.Output()],s.prototype,"messageChanged",void 0),h([t.Output()],s.prototype,"addressChanged",void 0),h([t.Output()],s.prototype,"focusEvent",void 0),h([t.Output()],s.prototype,"blurEvent",void 0),h([t.Output()],s.prototype,"textChangeEvent",void 0),h([t.Output()],s.prototype,"emptyResponseEvent",void 0),h([t.Output()],s.prototype,"clearInputEventEmitter",void 0),h([t.Output()],s.prototype,"prefillEventEmitter",void 0),s=h([t.Component({selector:"bp-street-number",template:'<span *ngIf="labelResourceKey">{{ labelResourceKey | translate}}</span>\n<div class="bpaac-dropdown">\n <div class="bpaac-search-bar">\n <div class="bpaac-input-width">\n \x3c!-- [disabled]="isDisabled()" --\x3e\n <input type="text" #streetNumberSearchInput class="bpaac-input" \n [style.background-color]="!isParamsComplete() ? \'lightgrey\' : \'\'" \n [style.color]=" getTextColor() "\n [disabled]="!streetName || streetName.trim().length === 0" (keydown)="checkKeyDown($event)" \n (input)="onInputChange()" (click)="onInputClick()"\n [(ngModel)]="searchText" id="streetNumberInputField" \n [attr.title]="placeHolderText" \n [attr.placeholder]="placeHolderText" autocomplete="off"\n (blur)="onBlur($event)" (focus)="onFocus()" />\n <div id="bpaac-clear-streetNb-button" *ngIf="mayShowClearButton()" \n (click)="onClearStreetNumberInput(true)" class="bpaac-clear">\n </div>\n </div>\n \x3c!--<div ng-transclude></div>--\x3e\n <input id="bpaac-streetNb-typeahead" type="text" disabled autocomplete="off" [(ngModel)]="bpTypeAhead" />\n \x3c!-- <span>addressIsComplete: {{ addressIsComplete }}. </span>\n <span>addressIsValidated: {{ addressIsValidated }}. </span> --\x3e\n <span *ngIf="addressIsComplete" class="streetNbChekmark"><span class="checkmark"></span></span>\n </div>\n <div [hidden]="collapseDropdown" class="bpaac-dropdown-menu-container" *ngIf="suggestions && suggestions.length>0">\n <div #streetNumberList [appVisibleSuggestion]="visibleSuggesionCount" \n id="bpaac-streetnumber-dropdown" class="bpaac-dropdown-menu">\n <ul role="listbox" id="bpaac-streetNb-suggestionsList" class="list-unstyled">\n <li role="option" *ngFor="let option of suggestions; let idx = index" [ngClass]="{\'active\':(selectedIndex==idx)}" (mousedown)="clickSuggestion($event, option)"\n (mouseenter)="selectedIndex=idx" (mouseleave)="selectedIndex=-1">\n <span *ngIf="option" [innerHtml]="option[\'not-in-list\'] ? emptyResponseText : option.string | highlightSuggestion : wordList"></span>\n </li>\n </ul>\n </div>\n </div>\n</div>',styles:[""]})],s)}(),U=function(){function s(e,s,i,r){this.addressService=e,this.localeService=s,this.translateService=i,this.unicodeService=r,this.showDebugMessageToConsole=!1,this.labelResourceKey="common.label.boxNumber",this.maxSuggesionCount=5,this.visibleSuggesionCount=5,this.sortCriteria="",this.messageOption="Y",this.messageChanged=new t.EventEmitter,this.addressChanged=new t.EventEmitter,this.focusEvent=new t.EventEmitter,this.blurEvent=new t.EventEmitter,this.textChangeEvent=new t.EventEmitter,this.emptyResponseEvent=new t.EventEmitter,this.clearInputEventEmitter=new t.EventEmitter,this.prefillEventEmitter=new t.EventEmitter,this.validationMessageCode=null,this.validationMessageOptions=null,this.prefilling=!1,this.isPrefillWithNoMatch=!1}return Object.defineProperty(s.prototype,"inputLang",{set:function(e){var t=this;this.localeService.changeLang(e),this.translateService.use(e).subscribe((function(e){t.onChangedLanguage()}))},enumerable:!0,configurable:!0}),s.prototype.ngOnInit=function(){this.searchText="",this.addressIsValidated=!1,this.suggestionValidationMessage="",this.suggestions=[],this.previousIndex=-1,this.lastSearchValue="",this.wordList=[],this.suggestionsWordList=[],this.bpTypeAhead="",this.placeHolderText="",this.skipNextBlur=!1,this.errorCode=null,this.selectedIndex=-1,this.typeAheadWord="",this.collapseDropdown=!0,this.sequenceNumber=1,this.consumedNumber=1,this.setSearchText(""),this.setEmptyResponseText(),this.emptyResponse=!0,this.onChangedLanguage()},s.prototype.ngAfterViewChecked=function(){if(this.selectionChanged){var e=this.boxNumberList.nativeElement;setTimeout((function(){var t=O.findSingle(e,"li.active");t&&O.scrollInView(e,t)}),1),this.selectionChanged=!1}},s.prototype.ngOnChanges=function(t){t&&(t.hasOwnProperty("prefillData")&&!t.prefillData.firstChange&&(this.prefilling=!0,this.searchText=this.loadParams(t.prefillData.currentValue),""!==this.searchText&&this.minLevel===e.ADDRESSLEVEL.BOX_NUMBER&&(this.collapseDropdown=!0,this.prefillData.prefillBoxNumber=this.transformBoxNumberInLowercaseAndWithoutDiacritics(this.prefillData.parameters.boxNumber),this.onInputChange(f.SOURCE_PREFILLED))),!t.hasOwnProperty("streetNumber")||t.streetNumber.firstChange||t.hasOwnProperty("prefillData")||(this.minLevel=e.ADDRESSLEVEL.BOX_NUMBER,this.clearWidget(),this.valueChanged()))},s.prototype.transformBoxNumberInLowercaseAndWithoutDiacritics=function(e){var t=null;return null!=e&&(t=(t=this.unicodeService.removeDiacritics(e)).toLowerCase()),t},s.prototype.ngOnDestroy=function(){this.subscription&&this.subscription.unsubscribe()},s.prototype.onChangedLanguage=function(){var e=this;this.translateService.get("boxNumber.placeholder.input-placeholder").subscribe((function(t){e.placeHolderText=t,e.setEmptyResponseText()}))},s.prototype.setEmptyResponseText=function(){this.emptyResponseText=this.translateService.instant("boxNumber.message.not-in-list")},s.prototype.onClearInputEvent=function(e,t){this.clearInput(t)},s.prototype.onBlur=function(t){this.isBrowserIE()&&this.isDropdownClicked(t)?this.boxNumberSearchInput.nativeElement.focus():this.skipNextBlur?this.skipNextBlur=!1:(this.collapseDropdown=!0,this.blurEvent.emit(e.ADDRESSLEVEL.BOX_NUMBER))},s.prototype.isBrowserIE=function(){return/msie\s|trident\/|edge\//i.test(window.navigator.userAgent)},s.prototype.isDropdownClicked=function(e){return"bpaac-box-dropdown"===(e.explicitOriginalTarget||document.activeElement).id},s.prototype.onFocus=function(){this.collapseDropdown=!1,this.skipNextBlur=!1,this.focusEvent.emit(e.ADDRESSLEVEL.BOX_NUMBER)},s.prototype.valueChanged=function(){this.textChangeEvent.emit(this.searchText)},s.prototype.mayShowDropdown=function(){return this.suggestions.length>0&&!this.collapseDropdown},s.prototype.buildInputWordList=function(){this.wordList=this.searchText.split(/[\s, ]+/)},s.prototype.mayAddTypeAhead=function(e){return e!==f.SOURCE_PREFILLED&&(0!==this.searchText.length&&/[^\s, \\\/]$/.test(this.searchText))},s.prototype.buildTypeAhead=function(e){if(this.mayAddTypeAhead(e)){var t=this.searchText.split(/[\s, ]+/),s=t[t.length-1];if(this.suggestions.some(function(e){return!(!e||!e.hasOwnProperty("string"))&&e.string.split(/[\s-]+/).some(function(e){if(this.stringStartsWithIgnoreDiacritics(e,s))return this.typeAheadWord=e,!0}.bind(this))}.bind(this))){var i=this.typeAheadWord.slice(s.length,this.typeAheadWord.length).toLowerCase();this.bpTypeAhead=this.searchText+i}}},s.prototype.stringStartsWithIgnoreDiacritics=function(e,t){return e=null!=e?e.toLowerCase():e,t=null!=t?t.toLowerCase():t,-1!==this.unicodeService.removeDiacritics(e).slice(0,t.length).toLowerCase().indexOf(this.unicodeService.removeDiacritics(t))},s.prototype.getTopSuggestions=function(e){var t=this;this.sequenceNumber+=1;var s=this.generateParameters();this.showDebugMessageToConsole&&console.log("BOX-NUMBER calling service params",s),this.searchText&&(this.subscription=this.addressService.getBox(this.baseUrl,this.locality,this.postalCode,s).subscribe((function(s){t.handleGetBoxResponse(s,e),e===f.SOURCE_PREFILLED?(t.isPrefillWithNoMatch=!0!==t.prefillData.prefillBoxNumberPerfectMatchFound,t.prefillAnalyzeData()):t.isPrefillWithNoMatch=!1}),(function(){return t.handleGetBoxError()})))},s.prototype.getTextColor=function(){return!0===this.isPrefillWithNoMatch?"orangered":""},s.prototype.prefillAnalyzeData=function(){!0===this.prefillData.prefillBoxNumberPerfectMatchFound&&(this.collapseDropdown=!0),this.prefillEventEmitter.emit(new B(e.ADDRESSLEVEL.BOX_NUMBER,this.prefillData))},s.prototype.loadParams=function(e){var t="";return null!==e&&null!==e.parameters&&(e.parameters.hasOwnProperty("minLevel")&&(this.minLevel=e.parameters.minLevel),e.parameters.hasOwnProperty("postalCode")&&this.isString(e.parameters.postalCode)&&(this.postalCode=e.parameters.postalCode),e.parameters.hasOwnProperty("municipalityName")&&this.isString(e.parameters.municipalityName)&&(this.locality=e.parameters.municipalityName),e.parameters.hasOwnProperty("streetName")&&this.isString(e.parameters.streetName)&&(this.streetName=e.parameters.streetName),e.parameters.hasOwnProperty("streetNumber")&&this.isString(e.parameters.streetNumber)&&(this.streetNumber=e.parameters.streetNumber),e.parameters.hasOwnProperty("boxNumber")&&this.isString(e.parameters.boxNumber)&&this.isParamsComplete()&&(t=e.parameters.boxNumber)),t},s.prototype.isString=function(e){return null!=e&&e.constructor===String},s.prototype.isValid=function(e){return this.isString(e)&&""!==e},s.prototype.isParamsComplete=function(){return this.isValid(this.postalCode)&&this.isValid(this.locality)&&this.isValid(this.streetName)&&this.isValid(this.streetNumber)},s.prototype.generateParameters=function(){var e=new y({id:this.sequenceNumber,q:this.searchText,postalCode:this.postalCode,locality:this.locality,street:this.streetName,streetNumber:this.streetNumber,maxNumberOfSuggestions:this.maxSuggesionCount});return"B"===this.sortCriteria&&e.sortByBox(!0),e},s.prototype.handleGetBoxResponse=function(e,t){e&&e.response&&e.response.sequenceNumber&&e.response.sequenceNumber>=this.consumedNumber&&e.response.topSuggestions&&(this.consumedNumber=e.response.sequenceNumber,this.clearSuggestions(),this.parseTopSuggestions(e.response.topSuggestions,t),this.buildTypeAhead(t),this.clearConnectionErrorMessage(),this.buildInputWordList()),this.collapseDropdown=!0===this.prefilling&&null!==this.prefillData&&!this.prefillData.parameters.onFocusShowSuggestionsAfterPrefill},s.prototype.handleGetBoxError=function(){this.setConnectionErrorMessage()},s.prototype.setConnectionErrorMessage=function(){this.errorCode="service-unavailable",this.emitTranslatedValidationMessage(e.ValidationMessageType.Service_Unavailable)},s.prototype.clearConnectionErrorMessage=function(){if(this.errorCode){var e=this.translateService.instant(this.errorCode);this.suggestionValidationMessage===e&&this.clearSuggestionValidationMessage(),this.errorCode=null}},s.prototype.parseTopSuggestions=function(e,t){var s,i;if(e.constructor===Array){try{for(var r=c(e),o=r.next();!o.done;o=r.next()){var n=o.value;this.parseSingleSuggestion(n,t)}}catch(e){s={error:e}}finally{try{o&&!o.done&&(i=r.return)&&i.call(r)}finally{if(s)throw s.error}}if(t){if(this.prefilling&&this.notInListAllowed&&!1===this.prefillData.prefillBoxNumberPerfectMatchFound&&null!==this.prefillData.prefillBoxNumber&&void 0!==this.prefillData.prefillBoxNumber&&this.prefillData.prefillBoxNumber.length>0){var a=this.prefillBuildNotInListSuggestion();this.showDebugMessageToConsole&&console.log("BOX NUMBER - PREFILL NOT IN LIST SUGGESTION:",a),this.prefillCheckForPerfectMatch(a)}}else(0===e.length||this.emptyResponse)&&this.notInListAllowed&&this.suggestions.push({string:this.searchText,"not-in-list":!0})}else this.parseSingleSuggestion(e,t)},s.prototype.prefillBuildNotInListSuggestion=function(){var e={string:this.searchText,"not-in-list":!0},t=this.prefillData.prefillStreetNumberPerfectMatchSuggestion,s=p(p({},t.address),e);return delete s.mailBoxid,delete s.suffixId,s.boxNumber=s.string,s.searchBarString=s.string,s.isComplete=!0,t.address=s,t},s.prototype.parseSingleSuggestion=function(e,t){var s;this.localeService.isLocaleFrench()&&e.hasOwnProperty("french")?s=e.french:this.localeService.isLocaleDutch()&&e.hasOwnProperty("dutch")?s=e.dutch:this.localeService.isLocaleGerman()&&e.hasOwnProperty("german")?s=e.german:e.hasOwnProperty("address")&&(s=e.address),s&&(e.messages&&(s.messages=e.messages),s.boxNumber===this.searchText&&(this.emptyResponse=!1),this.suggestions.push(s),t===f.SOURCE_PREFILLED&&(e.address=s,this.prefillCheckForPerfectMatch(e)))},s.prototype.prefillCheckForPerfectMatch=function(e){this.showDebugMessageToConsole&&console.log("box number - checking suggestion for perfect match",this.prefillData,e);var t=e.address,s=this.transformBoxNumberInLowercaseAndWithoutDiacritics(""+t.boxNumber);this.showDebugMessageToConsole&&console.log("comparing box numbers",s,this.prefillData.prefillBoxNumber),s===""+this.prefillData.prefillBoxNumber&&(this.prefillData.prefillBoxNumberPerfectMatchFound=!0,this.prefillData.prefillBoxNumberPerfectMatchSuggestion=e,this.searchText=t.boxNumber,t.hasOwnProperty("isComplete")&&!0===t.isComplete&&(this.clickSuggestion(null,t),this.showDebugMessageToConsole&&console.log("ADDRESS COMPLETE ON BOX NUMBER !")))},s.prototype.onInputChange=function(e){this.collapseDropdown=!1,this.emptyResponse=!0,this.resetArrowSelectedIndex(),e||(this.prefilling=!1,this.valueChanged()),this.clearSuggestionValidationMessage(),""===this.searchText?(this.sequenceNumber+=1,this.consumedNumber=this.sequenceNumber,this.clearSuggestions()):this.getTopSuggestions(e),this.buildInputWordList()},s.prototype.clickSuggestion=function(e,t){this.isPrefillWithNoMatch=!1,null==e||e.preventDefault(),t&&(this.clearTypeAhead(),this.resetArrowSelectedIndex(),t.string&&this.setSearchText(t.string),this.collapseDropdown=!0,t["not-in-list"]&&(t=this.modifySelectedAddress(t)),this.addressIsValidated=!0,t.isComplete=!0,this.setSelectedAddress(t))},s.prototype.modifySelectedAddress=function(e){var t=p(p({},this.selectedAddress),e);return delete t.mailBoxid,delete t.suffixId,t.boxNumber=t.string,t.searchBarString=t.string,t.isComplete=!0,t},s.prototype.setSelectedAddress=function(e){this.addressIsValidated=!(!e.hasOwnProperty("isComplete")||!0!==e.isComplete),this.addressChanged.emit(e)},s.prototype.clearSelectedAddress=function(){this.addressChanged.emit(null),this.addressIsValidated=!1},s.prototype.emitTranslatedValidationMessage=function(t,s){if(null!=t)switch(t){case e.ValidationMessageType.Address_Not_Found:case e.ValidationMessageType.Address_Validated:case e.ValidationMessageType.Service_Unavailable:var i=this.translateService.instant(t);this.messageChanged.emit({messageType:t,translatedMessage:i});break;default:console.error("Unable to emit validation message - message key NOT supported!",t)}else console.warn("Unable to emit validation message - message key is invalid!",t)},s.prototype.showAddressIsValidated=function(){this.emitTranslatedValidationMessage(e.ValidationMessageType.Address_Validated)},s.prototype.checkKeyDown=function(e){switch(e.which){case 40:e.preventDefault(),this.moveArrowSelectedIndexDown();break;case 38:e.preventDefault(),this.moveArrowSelectedIndexUp();break;case 39:e.preventDefault(),this.cursorIsOnSuggestionList()?this.clickSuggestion(e,this.suggestions[this.selectedIndex]):this.typeAheadWord&&this.typeAheadIsShown()&&(this.setSearchText(this.bpTypeAhead),this.typeAheadWord="");break;case 9:this.addressIsValidated||e.shiftKey||(e.preventDefault(),this.selectFirstInListOfSuggesions());break;case 46:e.ctrlKey&&this.clearWidget();break;case 13:e.preventDefault(),this.cursorIsOnSuggestionList()&&this.clickSuggestion(e,this.suggestions[this.selectedIndex]);break;default:this.clearTypeAhead()}},s.prototype.clearWidget=function(){this.addressIsValidated=!1,this.clearSearchText(),this.clearSuggestions(),this.clearTypeAhead(),this.prefillData=null},s.prototype.clearSearchText=function(){this.searchText=""},s.prototype.typeAheadIsShown=function(){return this.bpTypeAhead&&this.bpTypeAhead.length>0},s.prototype.resetArrowSelectedIndex=function(){this.selectedIndex=-1},s.prototype.moveArrowSelectedIndexDown=function(){this.selectedIndex+1!==this.suggestions.length&&(this.selectedIndex++,this.changeSelection(),this.setSearchTextBasedOnArrowSelection(this.selectedIndex,this.selectedIndex-1))},s.prototype.moveArrowSelectedIndexUp=function(){this.selectedIndex-1!=-2&&(this.selectedIndex--,this.changeSelection(),this.setSearchTextBasedOnArrowSelection(this.selectedIndex,this.selectedIndex+1))},s.prototype.cursorIsOnSuggestionList=function(){return this.selectedIndex>=0},s.prototype.setSearchTextBasedOnArrowSelection=function(e,t){void 0===e||this.suggestions.length<=0||(-1!==e?(-1===t&&(this.lastSearchValue=this.searchText),this.setSearchText(this.suggestions[this.selectedIndex].string),this.clearTypeAhead()):this.setSearchText(this.lastSearchValue))},s.prototype.mayShowClearButton=function(){return this.searchText.length>0},s.prototype.clearInput=function(e,t){void 0===t&&(t=!0),this.clearWidget(),this.resetArrowSelectedIndex(),this.previousIndex=-1,this.lastSearchValue="",this.clearSuggestionValidationMessage(),this.valueChanged(),this.clearConnectionErrorMessage(),!0===e&&this.boxNumberSearchInput.nativeElement.focus(),t&&this.clearInputEventEmitter.emit(P.BOX_NUMBER)},s.prototype.clearSuggestions=function(){this.wordList=[],this.suggestions=[],this.suggestionsWordList=[]},s.prototype.clearTypeAhead=function(){this.bpTypeAhead=""},s.prototype.clearSuggestionValidationMessage=function(){this.suggestionValidationMessage="",this.addressIsValidated=!1,this.messageChanged.emit({messageType:null,translatedMessage:this.suggestionValidationMessage}),this.validationMessageOptions=null,this.validationMessageCode=null},s.prototype.setSearchText=function(e){this.searchText=e},s.prototype.selectFirstInListOfSuggesions=function(){this.selectedIndex=0,this.changeSelection(),this.setSearchTextBasedOnArrowSelection(this.selectedIndex,this.selectedIndex-1)},s.prototype.changeSelection=function(){this.suggestions.length>0&&(this.selectionChanged=!0)},s.prototype.suggestionMouseLeave=function(){this.selectedIndex=-1},s.prototype.showAddressNotFoundMessage=function(){this.emitTranslatedValidationMessage(e.ValidationMessageType.Address_Not_Found)},s.prototype.isDisabled=function(){return""===this.locality||""===this.postalCode||this.minLevel>e.ADDRESSLEVEL.BOX_NUMBER},s.prototype.onInputClick=function(){this.showDebugMessageToConsole&&console.log("box number click")},s.ctorParameters=function(){return[{type:L},{type:D},{type:o.TranslateService},{type:A}]},h([t.ViewChild("boxNumberSearchInput",{static:!1})],s.prototype,"boxNumberSearchInput",void 0),h([t.ViewChild("boxNumberList",{static:!1})],s.prototype,"boxNumberList",void 0),h([t.Input()],s.prototype,"prefillData",void 0),h([t.Input()],s.prototype,"showDebugMessageToConsole",void 0),h([t.Input()],s.prototype,"labelResourceKey",void 0),h([t.Input()],s.prototype,"maxSuggesionCount",void 0),h([t.Input()],s.prototype,"visibleSuggesionCount",void 0),h([t.Input()],s.prototype,"sortCriteria",void 0),h([t.Input()],s.prototype,"baseUrl",void 0),h([t.Input()],s.prototype,"addressParams",void 0),h([t.Input()],s.prototype,"postalCode",void 0),h([t.Input()],s.prototype,"locality",void 0),h([t.Input()],s.prototype,"streetName",void 0),h([t.Input()],s.prototype,"streetNumber",void 0),h([t.Input()],s.prototype,"selectedAddress",void 0),h([t.Input()],s.prototype,"notInListAllowed",void 0),h([t.Input()],s.prototype,"inputLang",null),h([t.Input()],s.prototype,"messageOption",void 0),h([t.Output()],s.prototype,"messageChanged",void 0),h([t.Output()],s.prototype,"addressChanged",void 0),h([t.Output()],s.prototype,"focusEvent",void 0),h([t.Output()],s.prototype,"blurEvent",void 0),h([t.Output()],s.prototype,"textChangeEvent",void 0),h([t.Output()],s.prototype,"emptyResponseEvent",void 0),h([t.Output()],s.prototype,"clearInputEventEmitter",void 0),h([t.Output()],s.prototype,"prefillEventEmitter",void 0),s=h([t.Component({selector:"bp-box-number",template:'<span *ngIf="labelResourceKey">{{ labelResourceKey | translate}}</span>\n<div class="bpaac-dropdown">\n <div class="bpaac-search-bar">\n <div class="bpaac-input-width">\n \x3c!-- [disabled]="isDisabled()" --\x3e\n <input type="text" #boxNumberSearchInput class="bpaac-input" \n [style.background-color]="!isParamsComplete() ? \'lightgrey\' : \'\'" \n [style.color]=" getTextColor() "\n [disabled]="!streetNumber || streetNumber.trim().length === 0" (keydown)="checkKeyDown($event)" \n (input)="onInputChange()" (click)="onInputClick()"\n [(ngModel)]="searchText" id="boxNumberInputField" [attr.title]="placeHolderText" [attr.placeholder]="placeHolderText" autocomplete="off"\n (blur)="onBlur($event)" (focus)="onFocus()" />\n <div id="bpaac-clear-boxNb-button" *ngIf="mayShowClearButton()" (click)="clearInput(true)" class="bpaac-clear">\n </div>\n </div>\n \x3c!--<div ng-transclude></div>--\x3e\n <input id="bpaac-boxNb-typeahead" type="text" disabled autocomplete="off" [(ngModel)]="bpTypeAhead" />\n <span *ngIf="addressIsValidated" class="boxNbChekmark"><span class="checkmark"></span></span>\n </div>\n <div [hidden]="collapseDropdown" class="bpaac-dropdown-menu-container" *ngIf="suggestions && suggestions.length>0">\n <div #boxNumberList [appVisibleSuggestion]="visibleSuggesionCount" id="bpaac-box-dropdown" class="bpaac-dropdown-menu">\n <ul role="listbox" id="bpaac-boxNb-suggestionsList" class="list-unstyled">\n <li role="option" *ngFor="let option of suggestions; let idx = index" [ngClass]="{\'active\':(selectedIndex==idx)}" \n (mousedown)="clickSuggestion($event, option)"\n (mouseenter)="selectedIndex=idx" (mouseleave)="selectedIndex=-1">\n <span *ngIf="option" [innerHtml]="option[\'not-in-list\'] ? emptyResponseText : option.string | highlightSuggestion : wordList"></span>\n </li>\n </ul>\n </div>\n </div>\n</div>\n',styles:[""]})],s)}(),F=function(e){this.parameters=e,this.prefillMunicipalityName=null,this.prefillMunicipalityPerfectMatchFound=!1,this.prefillMunicipalityPerfectMatchSuggestion=null,this.prefillMunicipalityAndLocalityPerfectMatchFound=!1,this.prefillStreetName=null,this.prefillStreetPerfectMatchFound=!1,this.prefillStreetPerfectMatchSuggestion=null,this.prefillStreetNumber=null,this.prefillStreetNumberPerfectMatchFound=!1,this.prefillStreetNumberPerfectMatchSuggestion=null,this.prefillBoxNumber=null,this.prefillBoxNumberPerfectMatchFound=!1,this.prefillBoxNumberPerfectMatchSuggestion=null,this.ts=null,this.ts=new Date},W=function(){function s(e){this.httpService=e,this.selectedLanguage=null,this.baseUrl="https://api.mailops.bpost.cloud/roa-info/externalMailingAddressProofingRest/autocomplete/",this.showDebugMessageToConsole=!1,this.notInListAllowed=!0,this.messageOption="Y",this.localityUrl=this.baseUrl+"locality",this.maxSuggestionLocality=5,this.visibleSuggestionLocalityCount=5,this.localityPrefillData=null,this.streetUrl=this.baseUrl+"street",this.maxSuggestionStreet=5,this.visibleSuggestionStreetCount=5,this.streetPrefillData=null,this.streetNumberUrl=this.baseUrl+"streetNumber",this.maxSuggestionStreetNb=5,this.visibleSuggestionStreetNbCount=5,this.streetNumberPrefillData=null,this.boxNumberUrl=this.baseUrl+"boxNumber",this.maxSuggestionBoxNb=5,this.visibleSuggestionBoxNbCount=5,this.boxNumberPrefillData=null,this.emittedAddress=null,this.validationMessage={messageType:null,translatedMessage:""},this.addressCompleteEventEmitter=new t.EventEmitter,this.validationMessageEventEmitter=new t.EventEmitter,this.clearInputEventEmitter=new t.EventEmitter,this.processingPrefillData=!1,this.apiKey="cyRkKOD73O1DOdgcDLLnsaOiDh6OyOkt3BBT5JU1"}return Object.defineProperty(s.prototype,"inputLang",{set:function(e){this.setLanguage(e)},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"clearInput",{set:function(e){this.onClearInput(e)},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"validationMessageOption",{set:function(e){this.setValidationMessageOptionFromInput(e)},enumerable:!0,configurable:!0}),s.prototype.ngOnInit=function(){this.httpService.setApiKey(this.apiKey),this.addressParams&&(this.prefillData=this.addressParams)},s.prototype.ngOnDestroy=function(){this.subscription&&this.subscription.unsubscribe()},s.prototype.ngOnChanges=function(t){t&&(this.showDebugMessageToConsole&&this.displayParametersChangesToConsole(t),t.hasOwnProperty("apiKey")&&!t.apiKey.firstChange&&this.httpService.setApiKey(this.apiKey),t.hasOwnProperty("addressParams")&&!t.addressParams.firstChange&&(this.processingPrefillData=!0,this.enterPrefillMode(),this.selectedAddress=null,this.notifyAddressComplete(),this.clearWidget(),this.boxNumberPrefillData=null,this.streetNumberPrefillData=null,this.streetPrefillData=null,this.showDebugMessageToConsole&&console.log("lib::widget detected prefilling",this.addressParams),this.addressParams.minLevel=e.ADDRESSLEVEL.LOCALITY,this.localityPrefillData=new F(this.addressParams),this.showDebugMessageToConsole&&console.log("lib::checking locality match... ",this.localityPrefillData)))},s.prototype.displayParametersChangesToConsole=function(e){if(e.hasOwnProperty("messageOption")&&!e.messageOption.firstChange){var t=e.messageOption.currentValue;console.log("lib widget9 - messageOption",t)}if(e.hasOwnProperty("maxSuggestionLocality")&&!e.maxSuggestionLocality.firstChange){t=e.maxSuggestionLocality.currentValue;console.log("lib widget9 - maxSuggestionLocality",t)}if(e.hasOwnProperty("visibleSuggestionLocalityCount")&&!e.visibleSuggestionLocalityCount.firstChange){t=e.visibleSuggestionLocalityCount.currentValue;console.log("lib widget9 - visibleSuggestionLocalityCount",t)}if(e.hasOwnProperty("sortCriteriaLocality")&&!e.sortCriteriaLocality.firstChange){t=e.sortCriteriaLocality.currentValue;console.log("lib widget9 - sortCriteriaLocality",t)}if(e.hasOwnProperty("maxSuggestionStreet")&&!e.maxSuggestionStreet.firstChange){t=e.maxSuggestionStreet.currentValue;console.log("lib widget9 - maxSuggestionStreet",t)}if(e.hasOwnProperty("visibleSuggestionStreetCount")&&!e.visibleSuggestionStreetCount.firstChange){t=e.visibleSuggestionStreetCount.currentValue;console.log("lib widget9 - visibleSuggestionStreetCount",t)}if(e.hasOwnProperty("sortCriteriaStreet")&&!e.sortCriteriaStreet.firstChange){t=e.sortCriteriaStreet.currentValue;console.log("lib widget9 - sortCriteriaStreet",t)}if(e.hasOwnProperty("maxSuggestionStreetNb")&&!e.maxSuggestionStreetNb.firstChange){t=e.maxSuggestionStreetNb.currentValue;console.log("lib widget9 - maxSuggestionStreetNb",t)}if(e.hasOwnProperty("visibleSuggestionStreetNbCount")&&!e.visibleSuggestionStreetNbCount.firstChange){t=e.visibleSuggestionStreetNbCount.currentValue;console.log("lib widget9 - visibleSuggestionStreetNbCount",t)}if(e.hasOwnProperty("sortCriteriaStreetNb")&&!e.sortCriteriaStreetNb.firstChange){t=e.sortCriteriaStreetNb.currentValue;console.log("lib widget9 - sortCriteriaStreetNb",t)}if(e.hasOwnProperty("maxSuggestionBoxNb")&&!e.maxSuggestionBoxNb.firstChange){t=e.maxSuggestionBoxNb.currentValue;console.log("lib widget9 - maxSuggestionBoxNb",t)}if(e.hasOwnProperty("visibleSuggestionBoxNbCount")&&!e.visibleSuggestionBoxNbCount.firstChange){t=e.visibleSuggestionBoxNbCount.currentValue;console.log("lib widget9 - visibleSuggestionBoxNbCount",t)}if(e.hasOwnProperty("sortCriteriaBoxNb")&&!e.sortCriteriaBoxNb.firstChange){t=e.sortCriteriaBoxNb.currentValue;console.log("lib widget9 - sortCriteriaBoxNb",t)}},s.prototype.clearWidget=function(){this.autocompleteBoxNb.clearWidget(),this.autocompleteStreetNb.clearWidget(),this.autocompleteStreet.clearWidget(),this.autocompleteLocality.clearWidget()},s.prototype.changeMinLevel=function(e){this.minLevel=e},s.prototype.onClearInput=function(e){this.showDebugMessageToConsole&&console.log("lib::onClearInput",e),this.quitPrefillMode();var t=null!=e&&e.setFocus;switch(this.minLevel){case 1:this.boxNumber="",this.autocompleteBoxNb.clearInput(t,!1),this.clearInputEventEmitter.emit("BOX_NUMBER");break;case 2:this.boxNumber="",this.streetNumber="",this.autocompleteBoxNb.searchText="",this.autocompleteBoxNb.streetNumber="",this.autocompleteBoxNb.clearInput(t,!1),this.autocompleteStreetNb.onClearStreetNumberInput(t,!1),this.clearInputEventEmitter.emit("STREET_NUMBER");break;case 3:this.boxNumber="",this.streetNumber="",this.street="",this.autocompleteBoxNb.searchText="",this.autocompleteBoxNb.streetNumber="",this.autocompleteBoxNb.clearInput(t,!1),this.autocompleteBoxNb.clearWidget(),this.autocompleteStreetNb.searchText="",this.autocompleteStreetNb.streetName="",this.autocompleteStreetNb.onClearStreetNumberInput(t,!1),this.autocompleteStreet.clearInput(t,!1),this.clearInputEventEmitter.emit("STREET");break;default:this.boxNumber="",this.autocompleteBoxNb&&(this.autocompleteBoxNb.searchText="",this.autocompleteBoxNb.streetNumber="",this.autocompleteBoxNb.clearInput(t,!1)),this.streetNumber="",this.autocompleteStreetNb&&(this.autocompleteStreetNb.searchText="",this.autocompleteStreetNb.streetName="",this.autocompleteStreetNb.onClearStreetNumberInput(t,!1)),this.street="",this.autocompleteStreet&&(this.autocompleteStreet.searchText="",this.autocompleteStreet.clearInput(t,!1)),this.locality="",this.autocompleteLocality&&(this.autocompleteLocality.searchText="",this.autocompleteLocality.clearInput(t,!1)),this.clearInputEventEmitter.emit("LOCALITY")}},s.prototype.getBoxPrefix=function(){var e="";switch(this.selectedLanguage){case"fr":e="BTE";break;case"nl":e="BUS";break;default:e="BOX"}return e},s.prototype.notifyAddressComplete=function(){this.addressCompleteEventEmitter.emit(this.selectedAddress),this.emittedAddress=this.selectedAddress,this.updatePostalCodeLocality(this.emittedAddress)},s.prototype.onClearInputEventEmitter=function(e){this.showDebugMessageToConsole&&console.log("lib::onClearInputEventEmitter",e),this.quitPrefillMode();var t=this.selectedAddress;if(e===P.LOCALITY)this.boxNumber="",this.autocompleteBoxNb&&(this.autocompleteBoxNb.searchText="",this.autocompleteBoxNb.streetNumber="",this.autocompleteBoxNb.clearInput(!1,!1)),this.streetNumber="",this.autocompleteStreetNb&&(this.autocompleteStreetNb.searchText="",this.autocompleteStreetNb.streetName="",this.autocompleteStreetNb.onClearStreetNumberInput(!1,!1)),this.street="",this.autocompleteStreet&&(this.autocompleteStreet.searchText="",this.autocompleteStreet.clearInput(!1,!1)),this.locality="",this.autocompleteLocality&&(this.autocompleteLocality.searchText="",this.autocompleteLocality.clearInput(!1,!1)),t=null;else if(e===P.STREET)this.boxNumber="",this.autocompleteBoxNb&&(this.autocompleteBoxNb.searchText="",this.autocompleteBoxNb.streetNumber="",this.autocompleteBoxNb.clearInput(!1,!1)),this.streetNumber="",this.autocompleteStreetNb&&(this.autocompleteStreetNb.searchText="",this.autocompleteStreetNb.streetName="",this.autocompleteStreetNb.onClearStreetNumberInput(!1,!1)),this.street="",this.autocompleteStreet&&(this.autocompleteStreet.searchText="",this.autocompleteStreet.clearInput(!1,!1)),t=null;else if(e===P.STREET_NUMBER)this.boxNumber="",this.autocompleteBoxNb&&(this.autocompleteBoxNb.searchText="",this.autocompleteBoxNb.streetNumber="",this.autocompleteBoxNb.clearInput(!1,!1)),this.streetNumber="",this.autocompleteStreetNb&&(this.autocompleteStreetNb.searchText="",this.autocompleteStreetNb.onClearStreetNumberInput(!1,!1)),t=null;else if(e===P.BOX_NUMBER){this.boxNumber="",this.autocompleteBoxNb&&(this.autocompleteBoxNb.searchText="",this.autocompleteBoxNb.clearInput(!1,!1));null==t||!t.hasOwnProperty("not-in-list")||t["not-in-list"];var s=!(null==(t=null!==this.streetNumberAddress?this.streetNumberAddress:null)||!t.hasOwnProperty("isComplete")||!0!==t.isComplete);this.autocompleteStreetNb.addressIsComplete=s}this.clearInputEventEmitter.emit(e),null!==this.emittedAddress&&(this.addressCompleteEventEmitter.emit(t),this.emittedAddress=t)},s.prototype.resetLocality=function(e){this.postalCode="",this.locality="",this.quitPrefillMode(),this.onClearInputEventEmitter(P.STREET),this.setAddress(null,4)},s.prototype.resetStreet=function(e){this.street="",this.quitPrefillMode(),this.onClearInputEventEmitter(P.STREET_NUMBER),this.autocompleteStreetNb.addressIsComplete=!1,this.autocompleteStreetNb.streetName="",this.setAddress(null,3)},s.prototype.resetStreetNumber=function(e,t){void 0===t&&(t=!1),this.streetNumber="",this.quitPrefillMode(),this.onClearInputEventEmitter(P.BOX_NUMBER),this.autocompleteBoxNb.addressIsComplete=!1,this.autocompleteBoxNb.streetNumber="",this.setAddress(null,2)},s.prototype.resetBoxNumber=function(e,t){void 0===t&&(t=!1),this.boxNumber="",this.quitPrefillMode(),this.autocompleteBoxNb.addressIsComplete=!1,this.setAddress(null,1)},s.prototype.enterPrefillMode=function(){this.showDebugMessageToConsole&&console.log("lib::enterPrefillMode()"),this.autocompleteBoxNb&&this.autocompleteStreetNb&&this.autocompleteStreet&&this.autocompleteLocality&&(this.autocompleteBoxNb.prefilling=!0,this.autocompleteStreetNb.prefilling=!0,this.autocompleteStreet.prefilling=!0,this.autocompleteLocality.prefilling=!0,this.autocompleteStreet.locality="",this.autocompleteStreetNb.streetName="",this.autocompleteBoxNb.streetNumber="")},s.prototype.quitPrefillMode=function(){this.showDebugMessageToConsole&&console.log("lib::quitPrefillMode()"),this.autocompleteBoxNb&&this.autocompleteStreetNb&&this.autocompleteStreet&&this.autocompleteLocality&&(this.autocompleteBoxNb.prefilling=!1,this.autocompleteStreetNb.prefilling=!1,this.autocompleteStreet.prefilling=!1,this.autocompleteLocality.prefilling=!1),this.processingPrefillData=!1},s.prototype.setAddress=function(e,t){if(this.showDebugMessageToConsole&&console.log("lib::setAddress - address part, level",e,t),null==e){var s=null!==this.selectedAddress&&void 0!==this.selectedAddress;this.selectedAddress=null,this.autocompleteStreetNb.addressIsComplete=!1,this.autocompleteBoxNb.addressIsComplete=!1,s&&this.notifyAddressComplete()}if(e){delete e.messages,this.selectedAddress=e,this.updateCompleteAddress(),this.postalCode=e.postalCode?e.postalCode:"",this.locality=e.localityName?e.localityName:"",this.street=e.streetName?e.streetName:"";null==e||!e.hasOwnProperty("isComplete")||e.isComplete;var i=!(null==e||!e.hasOwnProperty("not-in-list")||!0!==e["not-in-list"]);switch(t){case 4:this.updatePostalCodeLocality(e),this.streetAddress=null,this.streetNumberAddress=null,this.autocompleteStreet.searchText="",this.autocompleteStreetNb.searchText="",this.autocompleteStreetNb.streetName="",this.autocompleteBoxNb.searchText="",this.autocompleteBoxNb.streetNumber="";break;case 3:this.updatePostalCodeLocality(e),this.updateStreetName(e),this.streetAddress=e,this.streetNumberAddress=null,this.autocompleteStreetNb.searchText="",this.autocompleteBoxNb.searchText="",this.autocompleteBoxNb.streetNumber="";break;case 2:this.updatePostalCodeLocality(e),this.updateStreetName(e),this.updateStreetNumber(e),this.streetAddress=e,this.streetNumberAddress=e,e.hasOwnProperty("isComplete")&&!0===e.isComplete?(this.autocompleteStreetNb.addressIsComplete=!0,this.autocompleteBoxNb.streetNumber=i?e.houseNumber:""):this.autocompleteBoxNb.streetNumber=e.houseNumber,this.autocompleteBoxNb.searchText="";break;case 1:i&&(this.autocompleteStreetNb.addressIsComplete=!1)}this.selectedAddress&&void 0===this.selectedAddress.isComplete&&(this.selectedAddress.isComplete=!1),this.selectedAddress.isCompleteNotificationDone=!0,this.notifyAddressComplete()}},s.prototype.setLanguage=function(e){this.selectedLanguage=e},s.prototype.setValidationMessage=function(t){this.validationMessage=t,this.validationMessageOptionType===e.ValidationMessageOptionType.EMIT&&this.validationMessageEventEmitter.emit(t)},s.prototype.updatePostalCodeLocality=function(e){e&&e.postalCode&&e.localityName&&(this.postalCodeLocality=e.postalCode+" "+e.localityName,this.autocompleteLocality.searchText=this.postalCodeLocality)},s.prototype.updateStreetName=function(e){e&&e.streetName&&(this.streetNameInput=e.streetName)},s.prototype.updateStreetNumber=function(e){e&&e.houseNumber&&(this.streetNumberInput=e.houseNumber)},s.prototype.updateCompleteAddress=function(){var e="";e+=this.selectedAddress.streetName?this.selectedAddress.streetName+" ":"",e+=this.selectedAddress.houseNumber?this.selectedAddress.houseNumber+" ":"",e+=this.selectedAddress.boxNumber?this.getBoxPrefix()+" "+this.selectedAddress.boxNumber+" ":"",e+=this.selectedAddress.postalCode?this.selectedAddress.postalCode+" ":"",e+=this.selectedAddress.municipalityName?this.selectedAddress.municipalityName+" ":"",this.completeAddress=e},s.prototype.setValidationMessageOptionFromInput=function(e){this.validationMessageOptionType=e.validationType},s.prototype.onLocalityPrefillEvent=function(t){this.showDebugMessageToConsole&&console.log("lib::locality prefill event received:",t);var s=t.prefillData;if(!0===t.prefillData.prefillMunicipalityPerfectMatchFound){var i=s.prefillMunicipalityPerfectMatchSuggestion.address;this.updatePostalCodeLocality(i),this.addressParams.minLevel=e.ADDRESSLEVEL.STREET,this.prefillData=t.prefillData,this.prefillData.ts=new Date,this.prefillData.parameters.minLevel=e.ADDRESSLEVEL.STREET;var r=this.prefillData.prefillMunicipalityPerfectMatchSuggestion.address,o=r.localityName;this.prefillData.parameters.municipalityName=o,this.prefillData.parameters.postalCode=r.postalCode;var n=this.prefillData.parameters.streetName;null!=n&&""!==n||this.setAddress(i,e.ADDRESSLEVEL.LOCALITY),this.streetPrefillData=this.prefillData}else{var a=s.parameters.postalCode+s.parameters.municipalityName;this.autocompleteStreet.locality="",null!=a&&0!==a.length||this.setAddress(null,e.ADDRESSLEVEL.LOCALITY),this.quitPrefillMode()}},s.prototype.onStreetPrefillEvent=function(t){this.showDebugMessageToConsole&&console.log("lib::street: prefill event received",t);var s=t.prefillData;if(!0===t.prefillData.prefillStreetPerfectMatchFound){var i=s.prefillStreetPerfectMatchSuggestion.address;this.updateStreetName(i),this.addressParams.minLevel=e.ADDRESSLEVEL.STREET_NUMBER,this.prefillData=t.prefillData,this.prefillData.ts=new Date,this.prefillData.parameters.minLevel=e.ADDRESSLEVEL.STREET_NUMBER;var r=this.prefillData.prefillStreetPerfectMatchSuggestion.address,o=r.localityName;this.prefillData.parameters.municipalityName=o,this.prefillData.parameters.postalCode=r.postalCode,this.prefillData.parameters.streetName=r.streetName;var n=this.prefillData.parameters.streetNumber;null!=n&&""!==n||this.setAddress(i,e.ADDRESSLEVEL.STREET),this.streetNumberPrefillData=this.prefillData}else{var a=this.prefillData.parameters.streetName;i=this.prefillData.prefillMunicipalityPerfectMatchSuggestion.address;this.autocompleteStreetNb.streetName="",this.showDebugMessageToConsole&&console.error("lib::onStreetPrefillEvent - NO MATCH AT STREET LEVEL",a),null==a||0===a.length?this.setAddress(i,e.ADDRESSLEVEL.LOCALITY):(i.searchBarString=a,this.setAddress(i,e.ADDRESSLEVEL.STREET)),this.quitPrefillMode()}},s.prototype.onStreetNumberPrefillEvent=function(t){this.showDebugMessageToConsole&&console.log("lib::street number prefill event received:",t);var s=t.prefillData;if(!0===s.prefillStreetNumberPerfectMatchFound){var i=s.prefillStreetNumberPerfectMatchSuggestion.address;this.updateStreetNumber(i),this.autocompleteStreetNb.selectedAddress=i;var r=!(!i||!i.hasOwnProperty("isComplete")||!0!==i.isComplete),o=!(!i||!i.hasOwnProperty("not-in-list")||!0!==i["not-in-list"]);if(r&&!o)this.autocompleteStreetNb.addressIsComplete=!0,this.quitPrefillMode();else{this.addressParams.minLevel=e.ADDRESSLEVEL.BOX_NUMBER,this.prefillData=t.prefillData,this.prefillData.ts=new Date,this.prefillData.parameters.minLevel=e.ADDRESSLEVEL.BOX_NUMBER;var n=this.prefillData.prefillStreetNumberPerfectMatchSuggestion.address,a=n.localityName;this.prefillData.parameters.municipalityName=a,this.prefillData.parameters.municipalityName=a,this.prefillData.parameters.postalCode=n.postalCode,this.prefillData.parameters.streetName=n.streetName,this.prefillData.parameters.streetNumber=n.houseNumber;var l=this.prefillData.parameters.boxNumber;o||null!=l&&""!==l||this.setAddress(i,e.ADDRESSLEVEL.STREET_NUMBER),this.boxNumberPrefillData=this.prefillData}}else{var p=this.prefillData.parameters.streetNumber;i=this.prefillData.prefillStreetPerfectMatchSuggestion.address;this.autocompleteBoxNb.streetNumber="",null==p||0===p.length?this.setAddress(i,e.ADDRESSLEVEL.STREET):(i.searchBarString=p,this.setAddress(i,e.ADDRESSLEVEL.STREET_NUMBER)),this.quitPrefillMode()}},s.prototype.onBoxNumberPrefillEvent=function(t){this.showDebugMessageToConsole&&console.log("lib::prefill: box number event received:",t);var s=t.prefillData;if(!0===s.prefillBoxNumberPerfectMatchFound){var i=s.prefillBoxNumberPerfectMatchSuggestion.address;this.autocompleteBoxNb.selectedAddress=i,this.setAddress(i,e.ADDRESSLEVEL.BOX_NUMBER)}else{var r=this.prefillData.parameters.boxNumber;i=this.prefillData.prefillStreetNumberPerfectMatchSuggestion.address;null==r||0===r.length?this.setAddress(i,e.ADDRESSLEVEL.STREET_NUMBER):(i.searchBarString=r,this.setAddress(i,e.ADDRESSLEVEL.BOX_NUMBER))}this.quitPrefillMode()},s.ctorParameters=function(){return[{type:b}]},h([t.ViewChild(V,{static:!1})],s.prototype,"autocompleteLocality",void 0),h([t.ViewChild(R,{static:!1})],s.prototype,"autocompleteStreet",void 0),h([t.ViewChild(k,{static:!1})],s.prototype,"autocompleteStreetNb",void 0),h([t.ViewChild(U,{static:!1})],s.prototype,"autocompleteBoxNb",void 0),h([t.Input()],s.prototype,"inputLang",null),h([t.Input()],s.prototype,"clearInput",null),h([t.Input()],s.prototype,"validationMessageOption",null),h([t.Input()],s.prototype,"defaultLang",void 0),h([t.Input()],s.prototype,"showDebugMessageToConsole",void 0),h([t.Input()],s.prototype,"minLevel",void 0),h([t.Input()],s.prototype,"notInListAllowed",void 0),h([t.Input()],s.prototype,"addressParams",void 0),h([t.Input()],s.prototype,"messageOption",void 0),h([t.Input()],s.prototype,"localityUrl",void 0),h([t.Input()],s.prototype,"maxSuggestionLocality",void 0),h([t.Input()],s.prototype,"visibleSuggestionLocalityCount",void 0),h([t.Input()],s.prototype,"sortCriteriaLocality",void 0),h([t.Input()],s.prototype,"streetUrl",void 0),h([t.Input()],s.prototype,"maxSuggestionStreet",void 0),h([t.Input()],s.prototype,"visibleSuggestionStreetCount",void 0),h([t.Input()],s.prototype,"sortCriteriaStreet",void 0),h([t.Input()],s.prototype,"streetNumberUrl",void 0),h([t.Input()],s.prototype,"maxSuggestionStreetNb",void 0),h([t.Input()],s.prototype,"visibleSuggestionStreetNbCount",void 0),h([t.Input()],s.prototype,"sortCriteriaStreetNb",void 0),h([t.Input()],s.prototype,"boxNumberUrl",void 0),h([t.Input()],s.prototype,"maxSuggestionBoxNb",void 0),h([t.Input()],s.prototype,"visibleSuggestionBoxNbCount",void 0),h([t.Input()],s.prototype,"sortCriteriaBoxNb",void 0),h([t.Output()],s.prototype,"addressCompleteEventEmitter",void 0),h([t.Output()],s.prototype,"validationMessageEventEmitter",void 0),h([t.Output()],s.prototype,"clearInputEventEmitter",void 0),h([t.Input()],s.prototype,"apiKey",void 0),s=h([t.Component({selector:"bp-lib-address-autocomplete-by-component",template:'\r\n<div class="aacwidget-address-container">\r\n\r\n <div class="bpaac-dropdown-validation" *ngIf="validationMessageOptionType === \'SHOW\' ">\r\n <div class="bpaac-validated-icon" *ngIf="selectedAddress && validationMessage!==null && validationMessage.messageType!==null"></div>\r\n \x3c!-- {{ validationMessage | translate }} --\x3e\r\n {{ validationMessage.translatedMessage }}\r\n </div>\r\n\r\n \x3c!-- bp-aacwidget-autocomplete-locality --\x3e\r\n <bp-locality class="aacwidget-address-locality"\r\n [showDebugMessageToConsole]="showDebugMessageToConsole"\r\n [baseUrl]="localityUrl"\r\n [prefillData]="localityPrefillData"\r\n [labelResourceKey]="\'common.label.postalCode\'"\r\n [inputText]="postalCodeLocality"\r\n [inputLang]="selectedLanguage"\r\n [messageOption]="messageOption"\r\n [sortCriteria]="sortCriteriaLocality"\r\n [maxSuggesionCount]="maxSuggestionLocality" \r\n [visibleSuggestionCount]="visibleSuggestionLocalityCount"\r\n (addressChanged)="setAddress($event, 4)"\r\n (messageChanged)="setValidationMessage($event)"\r\n (focusEvent)="changeMinLevel($event)" \r\n (textChangeEvent)="resetLocality($event)"\r\n (clearInputEventEmitter)="onClearInputEventEmitter($event)"\r\n (prefillEventEmitter)="onLocalityPrefillEvent($event)"></bp-locality>\r\n\r\n <bp-street class="aacwidget-address-street"\r\n [showDebugMessageToConsole]="showDebugMessageToConsole"\r\n [baseUrl]="streetUrl"\r\n [prefillData]="streetPrefillData"\r\n [labelResourceKey]="\'common.label.streetName\'"\r\n [inputText]="streetNameInput"\r\n [inputLang]="selectedLanguage"\r\n [messageOption]="messageOption"\r\n [postalCode]="postalCode"\r\n [locality]="locality"\r\n [sortCriteria]="sortCriteriaStreet" \r\n [maxSuggesionCount]="maxSuggestionStreet"\r\n [visibleSuggesionCount]="visibleSuggestionStreetCount"\r\n (addressChanged)="setAddress($event, 3)"\r\n (messageChanged)="setValidationMessage($event)"\r\n (focusEvent)="changeMinLevel($event)"\r\n (textChangeEvent)="resetStreet($event)"\r\n (clearInputEventEmitter)="onClearInputEventEmitter($event)"\r\n (prefillEventEmitter)="onStreetPrefillEvent($event)"></bp-street>\r\n\r\n <bp-street-number class="aacwidget-address-streetnumber"\r\n [showDebugMessageToConsole]="showDebugMessageToConsole"\r\n [baseUrl]="streetNumberUrl"\r\n [selectedAddress]="streetAddress"\r\n [prefillData]="streetNumberPrefillData"\r\n [labelResourceKey]="\'common.label.streetNumber\'"\r\n [inputText]="streetNumberInput"\r\n [inputLang]="selectedLanguage"\r\n [messageOption]="messageOption"\r\n [postalCode]="postalCode" \r\n [locality]="locality" \r\n [streetName]="street"\r\n [sortCriteria]="sortCriteriaStreetNb"\r\n [maxSuggesionCount]="maxSuggestionStreetNb" \r\n [visibleSuggesionCount]="visibleSuggestionStreetNbCount"\r\n [notInListAllowed]="notInListAllowed"\r\n (addressChanged)="setAddress($event, 2)"\r\n (messageChanged)="setValidationMessage($event)"\r\n (focusEvent)="changeMinLevel($event)"\r\n (textChangeEvent)="resetStreetNumber($event, false)"\r\n (clearInputEventEmitter)="onClearInputEventEmitter($event)"\r\n (prefillEventEmitter)="onStreetNumberPrefillEvent($event)"></bp-street-number>\r\n\r\n <bp-box-number class="aacwidget-address-boxnumber"\r\n [showDebugMessageToConsole]="showDebugMessageToConsole"\r\n [baseUrl]="boxNumberUrl"\r\n [selectedAddress]="streetNumberAddress"\r\n [prefillData]="boxNumberPrefillData"\r\n [labelResourceKey]="\'common.label.boxNumber\'"\r\n [inputLang]="selectedLanguage"\r\n [messageOption]="messageOption"\r\n [postalCode]="postalCode" \r\n [locality]="locality" \r\n [streetName]="street" \r\n [streetNumber]="streetNumber"\r\n [sortCriteria]="sortCriteriaBoxNb" \r\n [maxSuggesionCount]="maxSuggestionBoxNb"\r\n [visibleSuggesionCount]="visibleSuggestionBoxNbCount"\r\n [notInListAllowed]="notInListAllowed"\r\n (messageChanged)="setValidationMessage($event)"\r\n (addressChanged)="setAddress($event, 1)" \r\n (focusEvent)="changeMinLevel($event)"\r\n (textChangeEvent)="resetBoxNumber($event, false)"\r\n (clearInputEventEmitter)="onClearInputEventEmitter($event)"\r\n (prefillEventEmitter)="onBoxNumberPrefillEvent($event)"></bp-box-number>\r\n</div>',styles:[""]})],s)}(),_=function(){function e(e){this.sanitizer=e}return e.prototype.transform=function(e,t){if(!t)return e;if(Array.isArray(t)&&t.length>1)return this.transformForArray(e,t);"."===t?t="\\.":Array.isArray(t)&&1===t.length&&"."===t[0]&&(t[0]="\\.");var s=new RegExp(t,"gi"),i=e.match(s);if(!i)return e;var r=e.replace(s,"<span style='font-weight: bold;'>"+i[0]+"</span>");return this.sanitizer.bypassSecurityTrustHtml(r)},e.prototype.transformForArray=function(e,t){var s,i,r="",o=0;try{for(var n=c(t),a=n.next();!a.done;a=n.next()){var l=a.value;r=++o<t.length?r.concat(l+"|"):r.concat(l)}}catch(e){s={error:e}}finally{try{a&&!a.done&&(i=n.return)&&i.call(n)}finally{if(s)throw s.error}}var p=e.replace(new RegExp("("+r+")","gi"),'<span style="font-weight: bold;">$1</span>');return this.sanitizer.bypassSecurityTrustHtml(p)},e.ctorParameters=function(){return[{type:l.DomSanitizer}]},e=h([t.Pipe({name:"highlightSuggestion"})],e)}(),q=function(){function e(e,t){this.el=e,this.renderer=t}return e.prototype.ngAfterViewChecked=function(){this.showHeight(this.el.nativeElement,this.appVisibleSuggestion)},e.prototype.showHeight=function(e,t){if(e){var s=e.firstElementChild.children;if(s&&0!==s.length){var i=Array.from(s).slice(0,t).reduce((function(e,t){return e+O.getOuterHeight(t)}),7);this.renderer.setStyle(this.el.nativeElement,"maxHeight",i+"px")}}},e.ctorParameters=function(){return[{type:t.ElementRef},{type:t.Renderer2}]},h([t.Input()],e.prototype,"appVisibleSuggestion",void 0),e=h([t.Directive({selector:"[appVisibleSuggestion]"})],e)}(),K=function(){function e(){}return e=h([t.NgModule({declarations:[_,q,W,V,R,k,U],imports:[n.CommonModule,r.HttpClientModule,a.FormsModule,a.ReactiveFormsModule,o.TranslateModule],exports:[W]})],e)}(),H=function(t){this.onFocusShowSuggestionsAfterPrefill=!1,this.ts=null,Object.assign(this,t),this.boxNumber&&""!==this.boxNumber?this.minLevel=e.ADDRESSLEVEL.BOX_NUMBER:this.streetNumber&&""!==this.streetNumber?this.minLevel=e.ADDRESSLEVEL.STREET_NUMBER:this.streetName&&""!==this.streetName?this.minLevel=e.ADDRESSLEVEL.STREET:this.minLevel=e.ADDRESSLEVEL.LOCALITY,this.ts=new Date};e.LibAddressAutocompleteByComponentComponent=W,e.LibAddressAutocompleteByComponentModule=K,e.LibAddressAutocompleteByComponentService=m,e.PrefilledParameters=H,e.ɵa=V,e.ɵb=L,e.ɵc=b,e.ɵd=D,e.ɵe=A,e.ɵf=R,e.ɵg=k,e.ɵh=U,e.ɵi=_,e.ɵj=q,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
16
16
|
//# sourceMappingURL=bpost-bp-address-auto-complete-by-component.umd.min.js.map
|