var MeePortal;(function(n){var t;(function(n){var t;(function(n){var t;(function(){var n=function(){function n(n,t,i){this.serviceConfig=n;this.$q=t;this.ajax=i;this.marketCache={};this.splitExpr=/\s*[;,-]\s*/;this.defaults={nameParts:"first, last",nameSortOrder:Array("prefix","first","middle","last","last2","full","yomilast","yomifirst"),bdayParts:"month, day, year"}}return n.prototype.isAddressFieldVisible=function(n,t){return _.any(this.getMarketInformation(t).addressFields,function(t){return t==n})},n.prototype.addressFieldOrder=function(n,t){return _.indexOf(this.getMarketInformation(t).addressFields,n)+1},n.prototype.birthdayFieldOrder=function(n){return _.indexOf(this.getMarketInformation().birthdayFields,n)+1},n.prototype.isDisplayNameFieldVisible=function(n,t){return _.any(this.getMarketInformation(t).displayNameFields,function(t){return t==n})},n.prototype.displayNameFieldOrder=function(n,t){var i=_.indexOf(this.getMarketInformation(t).displayNameFields,n);return-1==i&&(i=_.indexOf(this.defaults.nameSortOrder,n)),i+1},n.prototype.getCachedListOfCountries=function(){return this.serviceConfig.countries},n.prototype.getCachedCountry=function(n){return this.findCountryByIsoCode(n)},n.prototype.getCachedState=function(n,t){var i=this.findCountryByIsoCode(n);return i&&t?_.find(this.serviceConfig.states[n],function(n){return n.iso==t}):null},n.prototype.getCachedCounty=function(n,t){var i=this.findCountryByIsoCode(n);return i&&t?_.find(this.serviceConfig.counties[n],function(n){return n.iso==t}):null},n.prototype.getListOfStates=function(n){var i=this,t=this.findCountryByIsoCode(n);return t&&t.hasStates?this.serviceConfig.states[n]?this.$q.resolve(this.serviceConfig.states[n]):this.ajax.get({serviceName:"GlobalReadiness",operationName:"MVCACTION.GLOBALREADINESS.API.GETLISTOFSTATES",parentOperationName:"GetListOfStates",url:this.serviceConfig.serviceEndpointRoot+"country/states",data:{isoCode:n},cache:!0}).then(function(t){return i.serviceConfig.states[n]=t.data}):this.$q.resolve([])},n.prototype.getListOfCounties=function(n){var i=this,t=this.findCountryByIsoCode(n);return t&&t.hasCounties?this.serviceConfig.counties[n]?this.$q.resolve(this.serviceConfig.counties[n]):this.ajax.get({serviceName:"GlobalReadiness",operationName:"MVCACTION.GLOBALREADINESS.API.GETLISTOFCOUNTIES",parentOperationName:"GetListOfCounties",url:this.serviceConfig.serviceEndpointRoot+"country/counties",data:{isoCode:n},cache:!0}).then(function(t){return i.serviceConfig.counties[n]=t.data}):this.$q.resolve([])},n.prototype.getMarketInformation=function(n){var t=n||this.serviceConfig.userCountry,i;return this.marketCache[t]||(i=this.findCountryByIsoCode(t),i&&(this.marketCache[t]={displayNameFields:(i.nameParts||this.defaults.nameParts).toLowerCase().split(this.splitExpr),birthdayFields:(i.bdayParts||this.defaults.bdayParts).toLowerCase().split(this.splitExpr),addressFields:(i.addrParts||this.serviceConfig.defaultAddrParts).toLowerCase().split(this.splitExpr)})),this.marketCache[t]||(this.marketCache[t]={displayNameFields:this.defaults.nameParts.split(this.splitExpr),birthdayFields:this.defaults.bdayParts.split(this.splitExpr),addressFields:this.serviceConfig.defaultAddrParts.split(this.splitExpr)}),this.marketCache[t]},n.prototype.findCountryByIsoCode=function(n){return n?_.find(this.serviceConfig.countries,function(t){return n==t.iso}):null},n.$inject=["marketizationConfig","$q","portalAjaxServiceAngular"],n}();angular.module("commonModule").service("marketizationService",n)})(t=n.Services||(n.Services={}))})(t=n.Angular||(n.Angular={}))})(t=n.Shared||(n.Shared={}))})(MeePortal||(MeePortal={}))