function rootService(n,t,i){function f(){if($m.defined(window.MOGI)===!1){setTimeout(f,5);return}r.Profile.getInfo();MOGI.IsAuth?(r.Profile.Message.GetMessage(),$cache.remove("mogi:info")):$cache.setJson("mogi:info",MOGI);r.Favorite.loadCache()}var r=n,u;r.ngMsg=function(n){return(n.$touched||n.$submitted||!1)&&n.$error};r.isSlideOpened=!1;r.openSlideMenu=function(){if(r.isSlideOpened){r.closeSlideMenu();return}r.isSlideOpened=!0;$getById("mogi-slide-menu").style.left="0px";$getById("mogi-slide-overlay").style.display="block";document.body.style.overflow="hidden"};r.closeSlideMenu=function(){$getById("mogi-slide-menu").style.left="calc(-100vw - 100px)";$getById("mogi-slide-overlay").style.display="none";document.body.style.overflow="auto";r.isSlideOpened=!1};r.isOpenNav=!1;r.openNav=function(){if(r.isOpenNav){r.closeNav();return}r.isOpenNav=!0;$getById("slidemenu").style.left="0px";$getById("mogi-overlay").style.display="block";document.body.style.overflow="hidden"};r.closeNav=function(){$getById("slidemenu").style.left="-250px";$getById("mogi-overlay").style.display="none";document.body.style.overflow="auto";r.isOpenNav=!1};r.Profile={Data:{ClientId:null,ProfileId:0,FirstName:"",LastName:"",Avatar:"",Email:"",TotalFavorite:0,IsAuth:!1,Alert:null,LevelId:0,SupportStaff:{FullName:"",Mobile:"",Skype:"",Zalo:"",UserName:""}},getInfo:function(){var i=r.Profile.Data,n=window.MOGI;for(var u in i)i[u]=n[u];n.Token!==""&&(t.defaults.headers.common.Authorization=n.Token)},isAuth:function(){return this.Data.IsAuth},isNormal:function(){return this.Data.LevelId===0||this.Data.LevelId===1},getUserTypeLabel:function(){let n=mogiResUtils.getLevelById(this.Data.LevelId);return!n||!n.n?"":"Thành viên "+n.n},openZalo:function(){if(this.Data.SupportStaff.Zalo!==""||this.Data.SupportStaff.Zalo!==null){let n="https://zalo.me/"+this.Data.SupportStaff.Zalo;window.open(n,"_blank")}},openDialer:function(){this.Data.SupportStaff.Mobile!==""&&this.Data.SupportStaff.Mobile!==null&&(document.location.href="tel:"+this.Data.SupportStaff.Mobile)},getAvatar:function(){var n=this.Data.Avatar;return n===""?'<\/i>':'avatar'},getFavorite:function(){var n=this.Data.TotalFavorite;return n<10?n:"9+"},savedAlert:function(){var n=r.Profile.Data.Alert;return n?n.AlertSearchId>0:!1},Message:{Total:0,Items:[],Inboxs:[],HasValue:!1,HasMsg:!1,HasInbox:!1,KeyMsg:"mogi:msg",KeyInbox:"mogi:inbox",IsRead:function(n,t,i,r){var u=t.MessageId;n.push(t);t.Read=t.Read||!1;i[u]&&(t.Read=!0,r[u]=!0)},GetMessage:function(){var n={msg:{},inbox:{}},i={};i.msg=$cache.getJson(this.KeyMsg,{});i.inbox=$cache.getJson(this.KeyInbox,{});t({method:"GET",url:mogiRoutes.Common.GetMessage+"/"+MOGI.Member}).then(function(t){var f=t.data,u=r.Profile.Message,e,o;for(u.Total+=f.length,u.HasMsg=f.length>0,u.HasValue|=u.HasMsg,e=0,o=f.length;e0,u.HasValue|=u.HasInbox,e=0,o=f.length;e0&&t.get(n).then(function(n){n.data.forEach(function(n){n!==null&&(t.items[parseInt(n,10)]=!0)})}):this.loadCache()},loadCache:function(){var n=this,t;n.loaded||(n.loaded=!0,t=$cache.getJson(this.key,[]),r.Profile.Data.TotalFavorite=t.length,t.forEach(function(t){n.items[t]=!0}))},get:function(n){return t({method:"POST",url:mogiRoutes.Common.Favorite_GetList,data:n})},remove:function(n){return t({method:"POST",url:mogiRoutes.Common.Favorite_Remove+"?propertyId="+n})},add:function(n){return t({method:"POST",url:mogiRoutes.Common.Favorite_Add+"?propertyId="+n})},update:function(n){var t=r.Profile.Data;n=t.TotalFavorite+n;t.TotalFavorite=Math.max(0,n)},addRemove:function(n,t,i){var r=this.items[n]||!1;this.cache(n,r);r===!1?(this.items[n]=!0,this.add(n).then(function(){}),this.update(1),i&&window.mogiTracking&&mogiTracking.savePost(i)):(delete this.items[n],this.remove(n).then(function(){}),this.update(-1));t&&t.currentTarget.classList.toggle("favorited")},cache:function(n,t){var i=$cache.getJson(this.key,[]),r=i.indexOf(n);t?r!==-1&&i.splice(r,1):r===-1&&i.push(n);i.length>this.max&&(i=i.slice(i.length-this.max));$cache.setJson(this.key,i)}};r.TemplateTopMenuUrl=window.TemplateTopMenuUrl;u=window.template_layout_topmenu;$m.object(u)===!0&&$m.defined(i.get(u.url))===!1&&i.put(u.url,u.data);f()}function lazyLoad(n){if(lazy.length===0||lazyLoadCounter>3e3){var t=lozad(".lozad",{threshold:.1,root:n});t.observe()}else lazyLoadCounter+=20,setTimeout(lazyLoad,20)}function commonServices(n,t,i){this.AlertSearch=function(n,r){var u=t.open({templateUrl:"/scripts/app/templates/alertsearchstatus.html",controller:["$scope","$filter","$uibModalInstance","profileServices","obj",function(n,t,i,r,u){n.Msg=mogiDatas.Msg;n.Data={AlertSearchId:u.AlertSearchId||0,Title:u.Title||"Nhận thông báo",ReceiveEmailType:u.ReceiveEmailType||136,HashKey:u.HashKey,Rent:u.ForRent,json:u.json||null};n.List=mogiResUtils.syscodeUtils.getAlertType();n.close=function(){i.dismiss("cancel")};n.update=function(){r.updateAlertSearch(n.Data).then(function(t){t=t.data;t.Status&&(u.ReceiveEmailType=t.Data.ReceiveEmailType,u.ReceiveEmailTypeName=mogiResUtils.getSysCode(u.ReceiveEmailType));i.close(n.Data)})}}],backdrop:"static",resolve:{obj:function(){return n}}});u.result.then(function(n){i.getUserData().then(function(t){if(t=t.data,t.Status&&!t.Data.IsVerifiedEmail&&n.ReceiveEmailType!==mogiConst.ReceiveEmailType.None){window.location.assign("/profile/verifyemail");return}return r(!0)})},function(){return r(!1)})};this.SendFeedBack=function(t){return n({method:"POST",url:mogiRoutes.Common.FeedBack,data:t})}}function imageServices(n){function t(t,i,r,u){if(t.type.indexOf("image/")!=0){u(mogiDatas.Msg.Msg_ProfileImage_Type_Error);return}if(t.size>=5242880){u(mogiDatas.Msg.Msg_ProfileImage_Size_Error);return}t.upload=n.upload({url:mogiRoutes.Upload.UploadImage,headers:{"optional-header":"header-value"},data:{referCode:i,file:t}});t.upload.then(function(n){if(t.result=n.data,n.data!=null&&n.data.success){var i={Url:n.data.PublishUrl,MediaId:n.data.MediaId,isUsed:!1,isChecked:!1,MediaTypeId:n.data.MediaTypeId,ServerId:n.data.ServerId,MediaUrl:n.data.MediaUrl,style:{},SmallUrl:function(){return this.Url.replace(this.MediaUrl,"thumb-small/"+this.MediaUrl)},AvatarUrl:function(){return this.Url.replace(this.MediaUrl,"thumb-avatar/"+this.MediaUrl)}};r&&r(i)}else u(n.data.error)},function(n){n.status>0&&u&&u(mogiDatas.Msg.Msg_ProfileImage_Type_Error)},function(n){t.progress=Math.min(100,parseInt(100*n.loaded/n.total))});t.upload.xhr(function(){})}return service={UploadImage:t}}function propertyServices(n){function i(t){return n({method:"POST",url:mogiRoutes.Property.TopService,data:t})}function r(t){return n({method:"POST",url:mogiRoutes.Property.SendMessageToBroker,data:t})}function t(n){var i=$("#favorite-total"),t=parseInt(i.html(),0),r;t+=n;t=Math.max(0,t);i.html(t);r=$("#favorite-icon");r.toggleClass("favorited",t>0)}function u(t){return n({method:"POST",url:mogiRoutes.Property.MapViewData,data:t})}function f(i){return t(1),n({method:"POST",url:mogiRoutes.Common.Favorite_GetList,data:i})}function e(i){return t(-1),n({method:"POST",url:mogiRoutes.Common.Favorite_Remove+"?propertyId="+i})}function o(i){return t(1),n({method:"POST",url:mogiRoutes.Common.Favorite_Add+"?propertyId="+i})}function s(){return n({method:"GET",url:mogiRoutes.Property.ReportMessages})}function h(t){return n({method:"POST",url:mogiRoutes.Property.ReportAbuse,data:t})}function c(t){return n({method:"GET",url:mogiRoutes.Property.MarketGetByDistrict+"?districtId="+t})}function l(){return n({method:"GET",url:mogiRoutes.Property.GetBankInterestRates})}function a(t,i){return n({method:"GET",url:mogiRoutes.Property.GetPropertyByStreet+"?streetId="+t+"&p="+i})}function v(t,i,r){return n({method:"GET",url:mogiRoutes.HousePrice.GetHistoryPropertyByStreet+"?streetId="+t+"&fromArea="+i+"&toArea="+r})}return{SearchMap:u,RemoveFavorite:e,AddFavorite:o,GetFavorites:f,SendMessageToAgent:r,GetMessages:s,SendReport:h,TopService:i,GetNext:function(t){var i=$.param(t);return n({method:"GET",url:mogiRoutes.Property.GetNext+"?"+i})},MarketGetByDistrict:c,GetBankInterestRates:l,GetPropertyByStreet:a,GetHistoryPropertyByStreet:v}}var ngFileUpload,mogiPropertyTypes,mogiResUtils,mogiApp;if(function(n,t){function gt(n){var t=n.length,r=i.type(n);return i.isWindow(n)?!1:1===n.nodeType&&t?!0:"array"===r||"function"!==r&&(0===t||"number"==typeof t&&t>0&&t-1 in n)}function te(n){var t=ni[n]={};return i.each(n.match(s)||[],function(n,i){t[i]=!0}),t}function ur(n,r,u,f){if(i.acceptData(n)){var h,o,c=i.expando,l=n.nodeType,s=l?i.cache:n,e=l?n[c]:n[c]&&c;if(e&&s[e]&&(f||s[e].data)||u!==t||"string"!=typeof r)return e||(e=l?n[c]=b.pop()||i.guid++:c),s[e]||(s[e]=l?{}:{toJSON:i.noop}),("object"==typeof r||"function"==typeof r)&&(f?s[e]=i.extend(s[e],r):s[e].data=i.extend(s[e].data,r)),o=s[e],f||(o.data||(o.data={}),o=o.data),u!==t&&(o[i.camelCase(r)]=u),"string"==typeof r?(h=o[r],null==h&&(h=o[i.camelCase(r)])):h=o,h}}function fr(n,t,r){if(i.acceptData(n)){var e,o,s=n.nodeType,u=s?i.cache:n,f=s?n[i.expando]:i.expando;if(u[f]){if(t&&(e=r?u[f]:u[f].data)){for(i.isArray(t)?t=t.concat(i.map(t,i.camelCase)):(t in e)?t=[t]:(t=i.camelCase(t),t=(t in e)?[t]:t.split(" ")),o=t.length;o--;)delete e[t[o]];if(r?!ti(e):!i.isEmptyObject(e))return}(r||(delete u[f].data,ti(u[f])))&&(s?i.cleanData([n],!0):i.support.deleteExpando||u!=u.window?delete u[f]:u[f]=null)}}}function er(n,r,u){if(u===t&&1===n.nodeType){var f="data-"+r.replace(rr,"-$1").toLowerCase();if(u=n.getAttribute(f),"string"==typeof u){try{u="true"===u?!0:"false"===u?!1:"null"===u?null:+u+""===u?+u:ir.test(u)?i.parseJSON(u):u}catch(e){}i.data(n,r,u)}else u=t}return u}function ti(n){for(var t in n)if(("data"!==t||!i.isEmptyObject(n[t]))&&"toJSON"!==t)return!1;return!0}function ct(){return!0}function g(){return!1}function cr(){try{return r.activeElement}catch(n){}}function ar(n,t){do n=n[t];while(n&&1!==n.nodeType);return n}function fi(n,t,r){if(i.isFunction(t))return i.grep(n,function(n,i){return!!t.call(n,i,n)!==r});if(t.nodeType)return i.grep(n,function(n){return n===t!==r});if("string"==typeof t){if(oe.test(t))return i.filter(t,n,r);t=i.filter(t,n)}return i.grep(n,function(n){return i.inArray(n,t)>=0!==r})}function vr(n){var i=yr.split("|"),t=n.createDocumentFragment();if(t.createElement)while(i.length)t.createElement(i.pop());return t}function gr(n,t){return i.nodeName(n,"table")&&i.nodeName(1===t.nodeType?t:t.firstChild,"tr")?n.getElementsByTagName("tbody")[0]||n.appendChild(n.ownerDocument.createElement("tbody")):n}function nu(n){return n.type=(null!==i.find.attr(n,"type"))+"/"+n.type,n}function tu(n){var t=ye.exec(n.type);return t?n.type=t[1]:n.removeAttribute("type"),n}function hi(n,t){for(var u,r=0;null!=(u=n[r]);r++)i._data(u,"globalEval",!t||i._data(t[r],"globalEval"))}function iu(n,t){if(1===t.nodeType&&i.hasData(n)){var u,f,o,s=i._data(n),r=i._data(t,s),e=s.events;if(e){delete r.handle;r.events={};for(u in e)for(f=0,o=e[u].length;o>f;f++)i.event.add(t,u,e[u][f])}r.data&&(r.data=i.extend({},r.data))}}function be(n,t){var r,f,u;if(1===t.nodeType){if(r=t.nodeName.toLowerCase(),!i.support.noCloneEvent&&t[i.expando]){u=i._data(t);for(f in u.events)i.removeEvent(t,f,u.handle);t.removeAttribute(i.expando)}"script"===r&&t.text!==n.text?(nu(t).text=n.text,tu(t)):"object"===r?(t.parentNode&&(t.outerHTML=n.outerHTML),i.support.html5Clone&&n.innerHTML&&!i.trim(t.innerHTML)&&(t.innerHTML=n.innerHTML)):"input"===r&&oi.test(n.type)?(t.defaultChecked=t.checked=n.checked,t.value!==n.value&&(t.value=n.value)):"option"===r?t.defaultSelected=t.selected=n.defaultSelected:("input"===r||"textarea"===r)&&(t.defaultValue=n.defaultValue)}}function u(n,r){var s,e,h=0,f=typeof n.getElementsByTagName!==o?n.getElementsByTagName(r||"*"):typeof n.querySelectorAll!==o?n.querySelectorAll(r||"*"):t;if(!f)for(f=[],s=n.childNodes||n;null!=(e=s[h]);h++)!r||i.nodeName(e,r)?f.push(e):i.merge(f,u(e,r));return r===t||r&&i.nodeName(n,r)?i.merge([n],f):f}function ke(n){oi.test(n.type)&&(n.defaultChecked=n.checked)}function ou(n,t){if(t in n)return t;for(var r=t.charAt(0).toUpperCase()+t.slice(1),u=t,i=eu.length;i--;)if(t=eu[i]+r,t in n)return t;return u}function ut(n,t){return n=t||n,"none"===i.css(n,"display")||!i.contains(n.ownerDocument,n)}function su(n,t){for(var f,r,o,e=[],u=0,s=n.length;s>u;u++)r=n[u],r.style&&(e[u]=i._data(r,"olddisplay"),f=r.style.display,t?(e[u]||"none"!==f||(r.style.display=""),""===r.style.display&&ut(r)&&(e[u]=i._data(r,"olddisplay",au(r.nodeName)))):e[u]||(o=ut(r),(f&&"none"!==f||!o)&&i._data(r,"olddisplay",o?f:i.css(r,"display"))));for(u=0;s>u;u++)r=n[u],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?e[u]||"":"none"));return n}function hu(n,t,i){var r=to.exec(t);return r?Math.max(0,r[1]-(i||0))+(r[2]||"px"):t}function cu(n,t,r,u,f){for(var e=r===(u?"border":"content")?4:"width"===t?1:0,o=0;4>e;e+=2)"margin"===r&&(o+=i.css(n,r+p[e],!0,f)),u?("content"===r&&(o-=i.css(n,"padding"+p[e],!0,f)),"margin"!==r&&(o-=i.css(n,"border"+p[e]+"Width",!0,f))):(o+=i.css(n,"padding"+p[e],!0,f),"padding"!==r&&(o+=i.css(n,"border"+p[e]+"Width",!0,f)));return o}function lu(n,t,r){var e=!0,u="width"===t?n.offsetWidth:n.offsetHeight,f=v(n),o=i.support.boxSizing&&"border-box"===i.css(n,"boxSizing",!1,f);if(0>=u||null==u){if(u=y(n,t,f),(0>u||null==u)&&(u=n.style[t]),lt.test(u))return u;e=o&&(i.support.boxSizingReliable||u===n.style[t]);u=parseFloat(u)||0}return u+cu(n,t,r||(o?"border":"content"),e,f)+"px"}function au(n){var u=r,t=uu[n];return t||(t=vu(n,u),"none"!==t&&t||(rt=(rt||i("