var __assign,NineYi;(function(n){var t;(function(t){var i;(function(t){var i=function(){function t(t,i,r,u,f,e,o,s,h,c,l,a,v,y,p,w,b,k,d,g,nt,tt){var rt,it,ft,ut;v===void 0&&(v=[]);rt=this;this.$scope=t;this.$element=i;this.$log=r;this.$window=u;this.$location=f;this.$cookies=e;this.OfficialShopProfile=o;this.FreezeBodyUtility=s;this.MainMenuUtility=h;this.UrlUtility=c;this.GoogleAnalyticsUtility=l;this.CurrentLocale=a;this.AvailableLanguages=v;this.EnableLanguageSwitcher=y;this.CurrencyCode=p;this.AvailableCurrencies=w;this.EnableCurrencySwitcher=b;this.market=k;this.shopId=d;this.trackingUtility=g;this.ShopService=nt;this.ShopFunction=tt;this.isUseAccurateComparison=null;this.isMultiShopCategoryHeaderMenuEnabled=!1;this.checkIsDefaultUseAccurateComparison=function(){var n=window.nineyi&&window.nineyi.env||undefined,i=rt.market,t=rt.shopId,r=n==="Dev"||n==="QA",u=[88,123,348,357,576,815,1194,1279,1317,1736,2345,4800,7756,10011,11185,18793,35895,36039,37868,38124,38164,38566,39336,39353,40015,40156,40312,40358,40569,40589,40916,41080,41165,41217,41277,26613,9820,12557,38125].concat([40259,41218,41219]);return i==="TW"&&(r?[225].indexOf(t)>-1:u.indexOf(t)>-1)};it=this.$element[0];typeof this.OfficialShopProfile!="undefined"&&typeof it!="undefined"?this.OfficialShopProfile.BrowserMode===n.WebStore.Frontend.BE.Device.DeviceModeEnum.Mobile&&(ft=it.querySelector("#layout-header"),ut=ft.getAttribute("data-effect-css-class"),this.$scope.$watch(function(){return rt.FreezeBodyUtility.IsFreeze},function(n){n&&it.classList.contains(ut)&&it.classList.remove(ut)})):this.$log.error("OfficialShopProfile is undefined");this.SelectedLanguage=v.filter(function(n){return n.Lang===a})[0];this.SelectedCurrency=w.filter(function(n){return n.code===p})[0];this.isDefaultUseAccurateComparison=this.checkIsDefaultUseAccurateComparison();this.isMultiShopCategoryHeaderMenuEnabled=this.ShopFunction&&this.ShopFunction.IsEnabledMultiShopCategory||!1}return t.prototype.OpenMenu=function(n){this.MainMenuUtility.Open(n)},t.prototype.ChangeLanguage=function(n){n.Lang!==this.CurrentLocale&&(this.GoogleAnalyticsUtility.TrackEvent("Language","select_content","("+n.Lang+")"+n.Display),this.trackingUtility.trackSelectContent({id:"",linkUrl:"",name:n.Lang,contentType:"Language"}),this.SelectedLanguage=n,window.location.href=this.UrlUtility.AppendParameter(window.location.href,"lang",n.Lang))},t.prototype.ChangeCurrency=function(n){n.code!==this.CurrencyCode&&(this.GoogleAnalyticsUtility.TrackEvent("Currency","select_content","("+n.code+")"+n.display),this.trackingUtility.trackSelectContent({id:"",linkUrl:"",name:n.code,contentType:"Currency"}),this.SelectedCurrency=n,this.$cookies.put("currency",n.code,{path:"/"}),this.$window.location.reload())},t.prototype.TrackLanguageCurrencyView=function(n,t,i){var r=i;this.GoogleAnalyticsUtility.TrackEvent(n,t,i)},t.$inject=["$scope","$element","$log","$window","$location","$cookies","OfficialShopProfile","FreezeBodyUtility","MainMenuUtility","UrlUtility","GoogleAnalyticsUtility","CurrentLocale","AvailableLanguages","EnableLanguageSwitcher","CurrencyCode","AvailableCurrencies","EnableCurrencySwitcher","Market","ShopId","TrackingUtility","ShopService","ShopFunction",],t}();t.HeaderController=i;angular.module("NineYi.Mall.Controllers").controller("HeaderController",i)})(i=t.Controllers||(t.Controllers={}))})(t=n.Mall||(n.Mall={}))})(NineYi||(NineYi={})),function(n){var t;(function(t){var i;(function(t){var i=function(){function t(n,t,i,r,u,f,e,o,s,h,c,l,a,v,y){this.shopId=n;this.$scope=t;this.$log=i;this.DeviceValue=r;this.$window=u;this.$timeout=f;this.$translate=e;this.activityService=o;this.OfficialOriginDomain=s;this.CmsShopInfo=h;this.CmsServiceImmediate=c;this.CmsService=l;this.CmsThemeUtility=a;this.OfficialShopProfile=v;this.ActivityServiceImmediate=y;e.onReady(this.Init.bind(this))}return t.prototype.Init=function(){var t=this;this.CmsShopInfo&&this.CmsShopInfo.EnableCms&&this.OfficialShopProfile.BrowserMode===n.WebStore.Frontend.BE.Device.DeviceModeEnum.Desktop?this.CmsServiceImmediate.GetCmsThemePromise.then(function(n){n&&(t.ActivityMenuSwitch=!!t.CmsThemeUtility.GetActivityMenuSwitch(n),t.ActivityMenuSwitch&&t.GetActivityList(),t.ActivityMenuTitle=t.CmsThemeUtility.GetActivityMenu(n).title||t.$translate.instant("frontend.typescripts.shared.latest_events"))}):(this.GetActivityList(),this.ActivityMenuTitle=this.$translate.instant("frontend.typescripts.shared.latest_events"))},t.prototype.GetActivityList=function(){var n=this;this.$log.info("Get ActivityList - start");this.ActivityServiceImmediate.GetActivityList(this.shopId).then(function(t){(n.ActivityMenuSwitch=n.CmsShopInfo&&n.CmsShopInfo.EnableCms?n.ActivityMenuSwitch&&t.length>0:t.length>0,t.length!==0)&&(n.ActivityList=t.map(function(t){return t.Activity_Url=n.OfficialOriginDomain+"/v2/activity/"+t.Activity_Id+"?layout=official",t}),n.$log.info("Get ActivityList - Finish"))})},t.$inject=["ShopId","$scope","$log","DeviceValue","$window","$timeout","$translate","ActivityService","OfficialOriginDomain","CmsShopInfo","CmsServiceImmediate","CmsService","CmsThemeUtility","OfficialShopProfile","ActivityServiceImmediate"],t}();t.HeaderActivityController=i;angular.module("NineYi.Theme.Components").controller("HeaderActivityController",i)})(i=t.Controllers||(t.Controllers={}))})(t=n.Mall||(n.Mall={}))}(NineYi||(NineYi={})),function(n){var t;(function(t){var i;(function(t){var i=function(){function t(t,i,r,u,f,e,o,s,h,c,l,a){var v=this;this.$scope=t;this.$log=i;this.$window=r;this.shopId=u;this.shopService=f;this.ShopCategoryServiceImmediate=e;this.OfficialServiceImmediate=o;this.OfficialShopProfile=s;this.CmsShopInfo=h;this.CmsServiceImmediate=c;this.CmsThemeUtility=l;this.ShopFunction=a;this.ShowBars=!1;this.FreeGiftList=[];this.IsOpendMenu=!1;this.CmsShopInfo&&this.CmsShopInfo.EnableCms&&this.OfficialShopProfile.BrowserMode===n.WebStore.Frontend.BE.Device.DeviceModeEnum.Desktop?this.CmsServiceImmediate.GetCmsThemePromise.then(function(n){v.$log.debug("取得CMS Theme Config",n);n&&(v.CategoryMenuSwitch=v.CmsThemeUtility.GetCategoryMenuSwitch(n),v.CategoryMenuSwitch&&(v.InitialProductCategoryList(),v.InitialPromotionList()))}):(this.CategoryMenuSwitch=!0,this.InitialProductCategoryList(),this.InitialPromotionList())}return t.prototype.InitialPromotionList=function(){var n=this;this.IsLoadedPromotionList=!1;this.OfficialServiceImmediate.GetOfficialPromotionTargetListPromise.then(function(t){for(var u,r,i=0;i<=t.length-1;i++)if(u=t[i].ConditionDiscountTypeDef,t[i].Targets.length>0&&u==="FreeGift")for(r=0;r<=t[i].Targets.length-1;r++)n.FreeGiftList.push(t[i].Targets[r]);n.IsLoadedPromotionList=!0})},t.prototype.InitialProductCategoryList=function(){var n=this,t=this.ShopFunction&&this.ShopFunction.IsEnabledMultiShopCategory||!1;t?this.ShopCategoryServiceImmediate.GetShopCategoryTreeListByLevel(this.shopId).then(function(t){if(typeof t!="undefined"){var i=t.Data;n.MultiShopCategoryListInfo=i}}):this.shopService.GetProductCategoryList(this.shopId).then(function(t){typeof t!="undefined"&&(n.ShopCategoryListInfo=t)})},t.$inject=["$scope","$log","$window","ShopId","ShopService","ShopCategoryServiceImmediate","OfficialServiceImmediate","OfficialShopProfile","CmsShopInfo","CmsServiceImmediate","CmsThemeUtility","ShopFunction",],t}();t.HeaderCategoryMenuController=i;angular.module("NineYi.Mall.Controllers").controller("HeaderCategoryMenuController",i)})(i=t.Controllers||(t.Controllers={}))})(t=n.Mall||(n.Mall={}))}(NineYi||(NineYi={})),function(n){var t;(function(n){var t;(function(n){var t=function(){function n(n,t,i){this.$scope=n;this.$log=t;this.$window=i;this.IsOpenMenu=!1}return n.prototype.OpenMenu=function(){this.IsOpenMenu=!0},n.prototype.CloseMenu=function(){this.IsOpenMenu=!1},n.$inject=["$scope","$log","$window",],n}();n.HeaderMultiLevelMenuController=t;angular.module("NineYi.Mall.Controllers").controller("HeaderMultiLevelMenuController",t)})(t=n.Controllers||(n.Controllers={}))})(t=n.Mall||(n.Mall={}))}(NineYi||(NineYi={})),function(n){var t;(function(t){var i;(function(t){var i=function(){function t(n,t,i,r,u,f,e,o,s,h,c){var l=this;this.value=n;this.$scope=t;this.$log=i;this.$window=r;this.$translate=u;this.shopId=f;this.officialService=e;this.appDownloadUtility=o;this.DialogUtility=s;this.LocalizationConfig=h;this.DefaultCountry=c;this.ShowTouchDownloadApp=!1;this.IsFocusInput=!1;this.IsTouchDevice=n.isTouchDevice;this.$translate.onReady(function(){switch(l.DefaultCountry){case"TW":l.CellPhonePlaceholder=l.$translate.instant("frontend.typescripts.shared.mobile_number_TW");break;default:l.CellPhonePlaceholder=l.$translate.instant("frontend.typescripts.shared.mobile_number")}})}return t.prototype.SendDownloadMessage=function(t){t.stopPropagation();var i=this.LocalizationConfig.Common.validateCellPhoneNumber?n.Mall.Configs.RegexPattern.Phone:n.Mall.Configs.RegexPattern.NumberOnly;i.test(this.CellPhone)?this.GetAppDownLoadLink():this.DialogUtility.Notice(this.$translate.instant("frontend.typescripts.components.invalid_mobile_number"));this.ShowTouchDownloadApp=!1;this.IsFocusInput=!1},t.prototype.GetAppDownLoadLink=function(){var n=this;this.$log.info("Get AppDownLoadLink - Start");this.officialService.GetAppDownLoadLink(this.shopId,this.CellPhone).then(function(t){n.$log.info("Get AppDownLoadLink - End");n.appDownloadUtility.ShowDownloadLinkResult(n.CellPhone,t.ReturnCode);n.CellPhone=""})},t.$inject=["Mall.Value","$scope","$log","$window","$translate","ShopId","OfficialService","AppDownloadUtility","DialogUtility","LocalizationConfig","DefaultCountry"],t}();t.HeaderDownloadAppController=i;angular.module("NineYi.Theme.Components").controller("HeaderDownloadAppController",i)})(i=t.Controllers||(t.Controllers={}))})(t=n.Mall||(n.Mall={}))}(NineYi||(NineYi={})),function(n){var t;(function(n){var t;(function(n){var t=function(){function n(n,t,i,r,u,f,e,o,s,h,c,l,a,v){var y=this;this.shopId=n;this.$rootScope=t;this.value=i;this.$scope=r;this.$log=u;this.$window=f;this.$translate=e;this.authService=o;this.AuthServiceImmediate=s;this.VipMemberService=h;this.googleAnalyticsUtility=c;this.dialogUtility=l;this.favoriteUtility=a;this.officialOriginDomain=v;this.IsLogin=!1;this.IsTouchDevice=i.isTouchDevice;this.$log.info("Get Auth IsLogin - Start");this.AuthServiceImmediate.IsLoginPromise.then(function(n){y.IsLogin=n;y.$log.info("Get Auth IsLogin - Finish",n)})}return n.prototype.ToggleMyAccountMenu=function(n){n.preventDefault();n.stopPropagation();this.IsShowMyAccountMenu=!this.IsShowMyAccountMenu},n.prototype.TrackEvent=function(n,t,i,r){this.googleAnalyticsUtility.TrackEvent(n,t,i,r)},n.prototype.Login=function(n){n.preventDefault();n.stopPropagation();var t=encodeURIComponent(this.$window.location.href.replace(this.$window.location.hash,""));this.$window.location.href="/Login/HttpLoginRelayToHttps/?rt="+t+"&reason=notlogin"},n.prototype.Logout=function(n){var t=this;n.preventDefault();n.stopPropagation();this.authService.Logout().then(function(){t.dialogUtility.Toast(t.$translate.instant("frontend.typescripts.shared.logout_success"),t.dialogUtility.ToastModeEnum.Success).then(function(){t.$window.location.href=t.officialOriginDomain?t.officialOriginDomain:"/"})})},n.$inject=["ShopId","$rootScope","Mall.Value","$scope","$log","$window","$translate","AuthService","AuthServiceImmediate","VipMemberService","GoogleAnalyticsUtility","DialogUtility","FavoriteUtility","OfficialOriginDomain"],n}();n.HeaderMyAccountController=t;angular.module("NineYi.Mall.Controllers").controller("HeaderMyAccountController",t)})(t=n.Controllers||(n.Controllers={}))})(t=n.Mall||(n.Mall={}))}(NineYi||(NineYi={})),function(n){var t;(function(n){var t;(function(n){var t=function(){function n(n,t,i,r,u,f,e,o,s,h,c,l){var a=this;this.$scope=n;this.$rootScope=t;this.$log=i;this.$window=r;this.$timeout=u;this.$translate=f;this.ShopId=e;this.ShoppingCartService=o;this.googleAnalyticsEcommerceUtility=s;this.AdobeAnalyticsUtility=h;this.dialogUtility=c;this.trackingUtility=l;this.ShoppingCartCount=0;this.RefreshShoppingCartCount();t.$on("RefreshShoppingCartCount",function(){a.$log.info("Event - RefreshShoppingCartCount");a.RefreshShoppingCartCount()})}return n.prototype.RefreshShoppingCartCount=function(){var n=this;this.ShoppingCartService.GetCount(this.ShopId).then(function(t){n.ShoppingCartCount=t;n.ShoppingCartPreviewData=null})},n.prototype.LoadShoppingCartPreview=function(){var n=this;this.ShoppingCartPreviewData||(this.$log.info("Get ShoppingCart Preview - Start",this.ShopId),this.ShoppingCartService.GetPreview(this.ShopId).then(function(t){n.$log.info("Get ShoppingCart Preview - Finish",t);n.ShoppingCartPreviewData=t}))},n.prototype.RemoveFromShoppingCart=function(n,t){var i=this,r=t.PointsPayPair?"PointsPay":"",u=t.PointsPayPair?t.PointsPayPair.PointsPayId:0;this.ShoppingCartService.RemoveItem(this.ShopId,t.SalePageId,t.SaleProductSKUId,t.SalePageGroupSeq,r,u).then(function(){i.ShoppingCartPreviewData.ShopList[0].SalePageList.splice(n,1);i.dialogUtility.Toast(i.$translate.instant("frontend.typescripts.shared.removal_success"),i.dialogUtility.ToastModeEnum.Success);i.trackingUtility.trackingSdkRemoveFromCart({id:t.SalePageId,name:t.Title,price:t.Price,quantity:t.Qty,skuId:t.SaleProductSKUId,suggestPrice:null});i.ShoppingCartCount=i.ShoppingCartPreviewData.ShopList[0].SalePageList.length;i.ShoppingCartPreviewData=null;i.LoadShoppingCartPreview()})},n.prototype.CheckOut=function(){var n="/V2/ShoppingCart/Index?shopId="+this.ShopId;this.trackingUtility.trackSelectContent({contentType:"TabBar",linkUrl:n,id:null,name:"ShoppingCart"});this.$window.location.href=n},n.$inject=["$scope","$rootScope","$log","$window","$timeout","$translate","ShopId","ShoppingCartService","GoogleAnalyticsEcommerceUtility","AdobeAnalyticsUtility","DialogUtility","TrackingUtility",],n}();n.HeaderShoppingCartController=t;angular.module("NineYi.Theme.Components").controller("HeaderShoppingCartController",t)})(t=n.Controllers||(n.Controllers={}))})(t=n.Mall||(n.Mall={}))}(NineYi||(NineYi={})),function(n){var t;(function(n){var t;(function(n){var t=function(){function n(n,t,i,r,u,f,e,o,s,h){var c=this;this.$log=n;this.$translate=t;this.LayoutTemplateDataServiceImmediate=i;this.OfficialShopProfile=r;this.CmsShopInfo=u;this.CmsServiceImmediate=f;this.CmsThemeUtility=e;this.TrackingUtility=o;this.Market=s;this.shopId=h;this.MultiLevelMenuEnableShopListForTwQA=[235,12195];this.MultiLevelMenuEnableShopListForTwProd=[36437,815,40916,40187,18793,41309];this.MultiLevelMenuEnableShopListForHkProd=[2];this.MultiLevelMenuEnableShopListForMyProd=[200017];this.IsEnableMultiLevelMenu=!1;this.checkIsEnableMultiLevelMenu=function(){var n=window.nineyi&&window.nineyi.env||undefined,t=n==="Dev"||n==="QA";return t?c.Market==="TW"&&c.MultiLevelMenuEnableShopListForTwQA.indexOf(c.shopId)>-1:c.Market==="TW"?c.MultiLevelMenuEnableShopListForTwProd.indexOf(c.shopId)>-1:c.Market==="HK"?c.MultiLevelMenuEnableShopListForHkProd.indexOf(c.shopId)>-1:c.Market==="MY"?c.MultiLevelMenuEnableShopListForMyProd.indexOf(c.shopId)>-1:!1};t.onReady(function(){c.CmsShopInfo&&c.CmsShopInfo.EnableCms?c.CmsServiceImmediate.GetCmsThemePromise.then(function(n){if(n)try{var r=c.CmsThemeUtility.GetCustomLinkListMenuSwitch(n),i=c.CmsThemeUtility.GetCustomLinkListMenu(n);r&&i&&i.length>0&&(i.map(function(n){n.additionalChildList=n.additionalChildList||[];n.text=n.text||t.instant("frontend.typescripts.shared.text_link");n.childList&&n.childList.length>0&&n.childList.map(function(n){n.text=n.text||t.instant("frontend.typescripts.shared.text_link")});n.additionalChildList&&n.additionalChildList.length>0&&n.additionalChildList.map(function(n){n.itemList&&n.itemList.length>0&&n.itemList.map(function(n){n.text=n.text||t.instant("frontend.typescripts.shared.text_link")})})}),c.CmsCustomLinks=i,c.IsEnableMultiLevelMenu=c.checkIsEnableMultiLevelMenu())}catch(u){c.GetCustomLinkFromLayoutTemplateData()}}):c.GetCustomLinkFromLayoutTemplateData()})}return n.prototype.GetCustomLinkFromLayoutTemplateData=function(){var n=this;this.LayoutTemplateDataServiceImmediate.GetCustomLinkPromise.then(function(t){n.CustomLinks=t.Data.filter(function(n){return n.Data.length>0});n.$log.debug("取得自訂連結資料CustomLinks"+n.CustomLinks)})},n.prototype.OnCustomLinkItemClick=function(n,t){this.TrackingUtility.trackSelectContent({contentType:"NavMenu",linkUrl:t,id:null,name:n})},n.$inject=["$log","$translate","LayoutTemplateDataServiceImmediate","OfficialShopProfile","CmsShopInfo","CmsServiceImmediate","CmsThemeUtility","TrackingUtility","Market","ShopId",],n}();n.HeaderCustomLinksController=t;angular.module("NineYi.Mall.Controllers").controller("HeaderCustomLinksController",t)})(t=n.Controllers||(n.Controllers={}))})(t=n.Mall||(n.Mall={}))}(NineYi||(NineYi={})),function(n){var t;(function(t){var i;(function(t){var i=function(){function t(n,t,i,r,u,f,e,o,s,h,c,l){var a=this;this.config=n;this.$rootScope=t;this.$scope=i;this.$log=r;this.$translate=u;this.ShopId=f;this.OfficialService=e;this.appDownloadUtility=o;this.DialogUtility=s;this.LocalizationConfig=h;this.DefaultCountry=c;this.ShopService=l;this.ShopService.GetEnableDisplayStoreList(this.ShopId).then(function(n){a.EnableDisplayStoreList=!!n.Data});this.$translate.onReady(function(){switch(a.DefaultCountry){case"TW":a.CellPhonePlaceholder=a.$translate.instant("frontend.typescripts.shared.mobile_number_TW");break;default:a.CellPhonePlaceholder=a.$translate.instant("frontend.typescripts.shared.mobile_number")}})}return t.prototype.sendDownloadMessage=function(t){t.stopPropagation();var i=this.LocalizationConfig.Common.validateCellPhoneNumber?n.Mall.Configs.RegexPattern.Phone:n.Mall.Configs.RegexPattern.NumberOnly;i.test(this.cellphone)?this.GetAppDownLoadLink():this.DialogUtility.Notice(this.$translate.instant("frontend.typescripts.components.invalid_mobile_number"))},t.prototype.GetAppDownLoadLink=function(){var n=this;this.$log.info("Get AppDownLoadLink - Start");this.OfficialService.GetAppDownLoadLink(this.ShopId,this.cellphone).then(function(t){n.$log.info("Get AppDownLoadLink - End");n.appDownloadUtility.ShowDownloadLinkResult(n.cellphone,t.ReturnCode);n.cellphone=""})},t.$inject=["Mall.Config","$rootScope","$scope","$log","$translate","ShopId","OfficialService","AppDownloadUtility","DialogUtility","LocalizationConfig","DefaultCountry","ShopService"],t}();t.SharedFooterController=i;angular.module("NineYi.Mall.Controllers").controller("SharedFooterController",i)})(i=t.Controllers||(t.Controllers={}))})(t=n.Mall||(n.Mall={}))}(NineYi||(NineYi={}));__assign=this&&this.__assign||Object.assign||function(n){for(var t,r,i=1,u=arguments.length;i<u;i++){t=arguments[i];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},function(n){var t;(function(t){var i;(function(t){var i=function(){function t(n,t,i,r,u,f,e,o,s,h,c,l,a,v,y,p,w,b,k,d,g,nt,tt,it,rt,ut,ft,et,ot,st,ht,ct,lt,at,vt,yt,pt,wt,bt,kt,dt,gt){et===void 0&&(et=[]);var ni=this;this.shopId=n;this.$scope=t;this.$log=i;this.$q=r;this.config=u;this.$window=f;this.$translate=e;this.googleAnalyticsUtility=o;this.OfficialServiceImmediate=s;this.ShopService=h;this.shopServiceImmediate=c;this.salePageCategoryId=l;this.UrlUtility=a;this.activityService=v;this.promotionV2ServiceImmediate=y;this.couponServiceImmediate=p;this.eCouponServiceImmediate=w;this.memberInviteImmediate=b;this.MainMenuUtility=k;this.RefUtility=d;this.PageValue=g;this.OfficialShopProfile=nt;this.OfficialOriginDomain=tt;this.CmsShopInfo=it;this.CmsServiceImmediate=rt;this.CmsThemeUtility=ut;this.DialogUtility=ft;this.AvailableLanguages=et;this.CurrentLocale=ot;this.CurrencyCode=st;this.EnableLanguageSwitcher=ht;this.VipMemberService=ct;this.AvailableCurrencies=lt;this.EnableCurrencySwitcher=at;this.DeepLinkService=vt;this.ActivityServiceImmediate=yt;this.TrackingUtility=pt;this.LocalizationConfig=wt;this.AppNotificationService=bt;this.RetailStoreService=kt;this.CookieUtility=dt;this.Market=gt;this.FreeGiftList=[];this.ServiceTypeList=[];this.MultiLevelMenuEnableShopListForTwQA=[235,12195];this.MultiLevelMenuEnableShopListForTwProd=[36437,815,40916,40187,18793,41309];this.MultiLevelMenuEnableShopListForHkProd=[2];this.MultiLevelMenuEnableShopListForMyProd=[200017];this.IsEnableMultiLevelMenu=!1;this.checkIsEnableMultiLevelMenu=function(){var n=window.nineyi&&window.nineyi.env||undefined,t=n==="Dev"||n==="QA";return t?ni.Market==="TW"&&ni.MultiLevelMenuEnableShopListForTwQA.indexOf(ni.shopId)>-1:ni.Market==="TW"?ni.MultiLevelMenuEnableShopListForTwProd.indexOf(ni.shopId)>-1:ni.Market==="HK"?ni.MultiLevelMenuEnableShopListForHkProd.indexOf(ni.shopId)>-1:ni.Market==="MY"?ni.MultiLevelMenuEnableShopListForMyProd.indexOf(ni.shopId)>-1:!1};this.ShopService.GetEnableDisplayStoreList(this.shopId).then(function(n){ni.EnableDisplayStoreList=!!n.Data});e.onReady(this.Init.bind(this))}return t.prototype.Init=function(){var t=this;this.CmsShopInfo&&this.CmsShopInfo.EnableCms&&this.OfficialShopProfile.BrowserMode===n.WebStore.Frontend.BE.Device.DeviceModeEnum.Mobile?this.InitialCmsCustomListMenu():(this.ActivityMenuCaption=this.$translate.instant("frontend.typescripts.shared.events_and_discounts"),this.ActivityMenuTitle=this.$translate.instant("frontend.typescripts.shared.latest_events"));this.InitialCategoryMenu();this.CurrentLanguage=this.AvailableLanguages.filter(function(n){return n.Lang===t.CurrentLocale})[0];this.HasStoreInfo=this.OfficialShopProfile.StoreTotalCount>0;this.couponServiceImmediate.GetCouponListPromise.then(function(n){t.HasCoupon=n&&n.length>0});this.$scope.$watch(function(){return t.MainMenuUtility.HasOpenmenu},function(n){n&&(t.HasStoreInfo||t.HasCoupon)&&t.GetVipMemberCustomLinkSettings()})},t.prototype.SetActiveLink=function(n,t){this.SimpleMode=!1;var i=this;if(t===this.config.allSalePageCategoryId){n[0].active=!0;return}[].slice.call(n).forEach(function(n){if(+n.Id==+t){n.active=!0;n.ChildList&&n.ChildList.length>0&&(i.SimpleMode=!0,n.selected=!0);return}n.ChildList&&[].slice.call(n.ChildList).forEach(function(r){if(+r.Id==+t){r.active=!0;n.selected=!0;i.SimpleMode=!0;return}})})},t.prototype.ToggleCategoryLevel1=function(n){n.selected=!n.selected},t.prototype.ClickCategoryLevel1=function(n){if(n.ChildList&&n.ChildList.length>0)this.ToggleCategoryLevel1(n);else{n.active=!0;var t=this.OfficialOriginDomain+"/v2/official/SalePageCategory/"+n.Id;this.$window.location.href=this.ActiveServiceType?t+"?serviceType="+this.ActiveServiceType:t;this.TrackEvent("全站_Header","Menu","商品分類")}},t.prototype.HasFreeGift=function(n){return this.FreeGiftList.indexOf(n.Id)>=0},t.prototype.OpenMenu=function(n){this.MainMenuUtility.Open(n)},t.prototype.TrackEvent=function(n,t,i,r){this.googleAnalyticsUtility.TrackEvent(n,t,i,r)},t.prototype.GoToDownloadApp=function(){var n=this,t=this.RefUtility.GetUtmDeeplinkTarget();this.DeepLinkService.GetDeepLink(t).then(function(t){n.$window.location.href=t.Data}).catch(function(){n.$window.location.href=n.RefUtility.ReplaceRefUrl(n.PageValue.CurrentPage)})},t.prototype.CloseMenu=function(){this.MainMenuUtility.Close()},t.prototype.ShowSwitchServiceTypeModal=function(){this.DialogUtility.Custom({title:null,model:{serviceTypeList:this.ServiceTypeList,selectedServiceType:this.ActiveServiceType,handleServiceTypeChange:this.HandleServiceTypeChange.bind(this)},backdrop:!0,templateUrl:"/V2/TypeScripts/Modules/Shared/switchServiceTypeModal.html",windowClass:"switch-service-type__modal",controller:"SwitchServiceTypeModalController as SwitchServiceTypeModalCtrl"})},t.prototype.GetServiceTypeList=function(n){var i=this,t=this.$q.defer();return this.AppNotificationService.GetMobileAppSettings(n).then(function(n){n?t.resolve(n.FilterServiceTypes||[]):t.resolve([])}).catch(function(n){i.$log.error("GetMobileAppSettings Error ",n);t.reject()}),t.promise},Object.defineProperty(t.prototype,"ServiceTypeText",{get:function(){var t=this,n=_.find(this.ServiceTypeList,function(n){return n.Type===t.ActiveServiceType});return n?n.Text:""},enumerable:!0,configurable:!0}),t.prototype.SetServiceType=function(n){var t=this.ServiceTypeList[0];n&&this.ServiceTypeList.some(function(t){return t.Type===n})?(this.ActiveServiceType=n,this.$window.localStorage.setItem("ActiveServiceType",JSON.stringify(n))):(this.ActiveServiceType=t?t.Type:"",this.$window.localStorage.setItem("ActiveServiceType",JSON.stringify(t.Type)))},t.prototype.HandleServiceTypeChange=function(n){if(n==="Normal"){window.open("https://pxbox.es.pxmart.com.tw?openExternalBrowser=1&utm_source=pxgo&utm_medium=channel");return}this.SetServiceType(n);this.GetCategoryMenuWithServiceType(n)},t.prototype.GetCategoryMenuWithServiceType=function(n){var t=this,i=+this.CookieUtility.GetCookie("rsLocId");this.ShopService.GetProductCategoryList(this.shopId,n,i).then(function(n){t.MapCategoryMenu(n)}).catch(function(n){t.$log.error("GetProductCategoryList Error ",n);t.MapCategoryMenu(null)})},Object.defineProperty(t.prototype,"EmptyCategoryListInfoText",{get:function(){return this.Market==="PX"?this.ActiveServiceType==="RetailStore"&&this.IsRetailStoreSelected?this.$translate.instant("frontend.typescripts.shared.not_support_for_just_an_hour"):this.$translate.instant("frontend.typescripts.shared.shop_category_is_in_preparation"):""},enumerable:!0,configurable:!0}),t.prototype.ShowSwitchLanguageModal=function(n){var t=n;this.googleAnalyticsUtility.TrackEvent("Language","click",n);this.DialogUtility.Custom({title:null,model:null,backdrop:!0,templateUrl:"/V2/TypeScripts/Modules/Shared/switchLocaleModal.html",windowClass:"switch-locale__modal",controller:"SwitchLanguageModalController as SwitchLocaleModalCtrl"})},t.prototype.ShowSwitchCurrencyModal=function(n){var t=n;this.googleAnalyticsUtility.TrackEvent("Currency","click",n);this.DialogUtility.Custom({title:null,model:null,backdrop:!0,templateUrl:"/V2/TypeScripts/Modules/Shared/switchLocaleModal.html",windowClass:"switch-locale__modal",controller:"SwitchCurrencyModalController as SwitchLocaleModalCtrl"})},t.prototype.CheckHasDiscountPromotion=function(){var t=this,n=this.$q.defer();return this.HasDiscountPromotion=!1,this.promotionV2ServiceImmediate.GetPromotionListPromise.then(function(i){t.HasDiscountPromotion=i.ReturnCode==="API0001"&&i.Data.PromotionCount>0;n.resolve()}).catch(function(){n.reject()}),n.promise},t.prototype.CheckPromoCodeMGOSetting=function(){var t=this,n=this.$q.defer();return this.HasDiscountPromotion=!1,this.memberInviteImmediate.GetPromoCodeMGOSetting(this.shopId).then(function(i){t.IsShowInvitationEvent=i;n.resolve()}).catch(function(){n.reject()}),n.promise},t.prototype.CheckHasECoupon=function(){var t=this,n=this.$q.defer();return this.eCouponServiceImmediate.GetOfficialECouponListPromise.then(function(i){i&&i[0]&&(t.HasECoupon=i[0].ECouponList.length>0);n.resolve()}).catch(function(){n.reject()}),n.promise},t.prototype.InitialActivityList=function(){var n=this,t=this.$q.defer();return this.$log.info("Get ActivityList - start"),this.ActivityServiceImmediate.GetActivityList(this.shopId).then(function(i){i&&(n.ActivityMenuSwitch=n.CmsShopInfo&&n.CmsShopInfo.EnableCms?n.ActivityMenuSwitch&&i.length>0:i.length>0,n.ActivityList=i.map(function(t){return t.Activity_Url=n.OfficialOriginDomain+"/v2/activity/"+t.Activity_Id+"?layout=official",t}));n.$log.info("Get ActivityList - Finish");t.resolve()}).catch(function(){t.reject()}),t.promise},t.prototype.InitialCategoryMenu=function(){var t=this,i;this.shopServiceImmediate.GetShopCategoryListPromise.then(function(i){t.Market==="PX"&&t.OfficialShopProfile.BrowserMode===n.WebStore.Frontend.BE.Device.DeviceModeEnum.Mobile?t.GetServiceTypeList(t.shopId).then(function(n){t.ServiceTypeList=n;var i=JSON.parse(t.$window.localStorage.getItem("ActiveServiceType"));t.HandleServiceTypeChange(i)}).catch(function(){t.$log.error("GetServiceTypeList Error");t.MapCategoryMenu(i)}):t.MapCategoryMenu(i)});this.OfficialServiceImmediate.GetOfficialPromotionTargetListPromise.then(function(n){for(var u,r,i=0;i<=n.length-1;i++)if(u=n[i].ConditionDiscountTypeDef,n[i].Targets.length>0&&u==="FreeGift")for(r=0;r<=n[i].Targets.length-1;r++)t.FreeGiftList.push(n[i].Targets[r]);t.IsLoadedPromotionList=!0});i=[this.InitialActivityList(),this.CheckHasDiscountPromotion(),this.CheckHasECoupon(),this.CheckPromoCodeMGOSetting()];this.$q.all(i).then(function(){t.IsShowActivityAndOffers=t.HasECoupon||t.ActivityList&&t.ActivityList.length>0||t.HasDiscountPromotion})},t.prototype.MapCategoryMenu=function(n){var t=this,i;this.ShopCategoryData=n;this.CategoryMenuSwitch=this.CmsShopInfo&&this.CmsShopInfo.EnableCms?this.CategoryMenuSwitch:!0;this.ShopCategoryData&&this.ShopCategoryData.List.length>0?typeof this.salePageCategoryId!="undefined"?this.SetActiveLink(this.ShopCategoryData.List,this.salePageCategoryId):(i=parseInt(this.UrlUtility.GetQuerystring("cid")),i&&(this.salePageCategoryId=i,this.SetActiveLink(this.ShopCategoryData.List,this.salePageCategoryId))):this.Market==="PX"&&this.ShopCategoryData&&this.ShopCategoryData.List.length===0&&this.RetailStoreService.GetHadSelectedService().then(function(n){var i=n.ReturnCode,r=n.Data,u=n.Message;i==="API0001"?t.IsRetailStoreSelected=!!r:(t.IsRetailStoreSelected=!1,t.$log.error("GetHadSelectedRetailStoreService Error ",u))}).catch(function(n){t.IsRetailStoreSelected=!1;t.$log.error("GetHadSelectedRetailStoreService Error ",n)})},t.prototype.CheckIsLinkMatchCurrentUrl=function(n){var t=this.$window.location,i="//"+t.hostname+t.pathname;return i===n||""+t.protocol+i===n},t.prototype.InitialCmsCustomListMenu=function(){var n=this;this.CmsServiceImmediate.GetCmsThemePromise.then(function(t){var r;if(t){var u=n.CmsThemeUtility.GetCustomLinkListMenuSwitch(t),i=n.CmsThemeUtility.GetCustomLinkListMenu(t),f=n.CmsThemeUtility.GetCustomLinkListMenuTitle(t);u&&i&&i.length>0&&(i.map(function(t){t.text=t.text||n.$translate.instant("frontend.typescripts.shared.text_link");var i=null;return t.additionalChildList&&t.additionalChildList.length>0&&(t.additionalChildListData=t.additionalChildList.reduce(function(t,r){return __assign({},t,(u={},u[r.parentItemKey]=r.itemList.map(function(t){t.text=t.text||n.$translate.instant("frontend.typescripts.shared.text_link");var u=n.CheckIsLinkMatchCurrentUrl(t.linkUrl);return t.isFocus=u,u&&(i=r.parentItemKey),t}),u));var u},{})),t.childList&&t.childList.length>0?t.childList.forEach(function(r){if(t.additionalChildListData&&t.additionalChildListData[r.itemKey])return r.SwitchCmsCustomLinks=r.itemKey===i,r;var u=n.CheckIsLinkMatchCurrentUrl(r.linkUrl);return r.isFocus=u,t.SwitchCmsCustomLinks=u,r}):t.isFocus=n.CheckIsLinkMatchCurrentUrl(t.linkUrl),t}),n.CmsCustomLinks=i,n.CmsCustomLinkTitle=f,n.IsShowCmsCustomLinks=!0,n.IsEnableMultiLevelMenu=n.checkIsEnableMultiLevelMenu());n.ActivityMenuSwitch=n.CmsThemeUtility.GetActivityMenuSwitch(t);n.CategoryMenuSwitch=n.CmsThemeUtility.GetCategoryMenuSwitch(t);r=n.CmsThemeUtility.GetActivityMenu(t);n.ActivityMenuCaption=n.ActivityMenuSwitch?r.caption:null;n.ActivityMenuTitle=r.title||n.$translate.instant("frontend.typescripts.shared.latest_events")}})},t.prototype.GetVipMemberCustomLinkSettings=function(){var n=this;this.VipMemberService.VipMemberCustomLinkData?this.SetCustomLinkConfigurationList(this.VipMemberService.VipMemberCustomLinkData):this.VipMemberService.GetVipMemberCustomLinkSettings().then(function(t){t.ReturnCode==="API0001"&&n.SetCustomLinkConfigurationList(t.Data)})},t.prototype.SetCustomLinkConfigurationList=function(t){var i=this,r=n.WebStore.Frontend.BE.Shop.CustomLinkShowPositionEnum[n.WebStore.Frontend.BE.Shop.CustomLinkShowPositionEnum.MobileWebSideBar];this.customLinkConfigurationList=[];t.forEach(function(n){n.IsEnable&&n.ShowPositions.indexOf(r)>-1&&i.customLinkConfigurationList.push(n)})},t.prototype.OnCustomLinkItemClick=function(n,t){this.TrackingUtility.trackSelectContent({contentType:"NavMenu",linkUrl:t,id:null,name:n})},t.$inject=["ShopId","$scope","$log","$q","Mall.Config","$window","$translate","GoogleAnalyticsUtility","OfficialServiceImmediate","ShopService","ShopServiceImmediate","SalePageCategoryId","UrlUtility","ActivityService","PromotionV2ServiceImmediate","CouponServiceImmediate","ECouponServiceImmediate","memberInviteImmediate","MainMenuUtility","RefUtility","PageValue","OfficialShopProfile","OfficialOriginDomain","CmsShopInfo","CmsServiceImmediate","CmsThemeUtility","DialogUtility","AvailableLanguages","CurrentLocale","CurrencyCode","EnableLanguageSwitcher","VipMemberService","AvailableCurrencies","EnableCurrencySwitcher","DeepLinkService","ActivityServiceImmediate","TrackingUtility","LocalizationConfig","AppNotificationService","RetailStoreService","CookieUtility","Market",],t}();t.AsideCategoryMenuController=i;angular.module("NineYi.Mall.Controllers").controller("AsideCategoryMenuController",i)})(i=t.Controllers||(t.Controllers={}))})(t=n.Mall||(n.Mall={}))}(NineYi||(NineYi={})),function(n){var t;(function(n){var t;(function(n){var t=function(){function n(n,t,i,r,u,f){this.$scope=n;this.$log=t;this.ShopId=i;this.SalePageCategoryId=r;this.ShopCategoryService=u;this.ShopCategoryServiceImmediate=f;this.Init()}return n.prototype.Init=function(){var n=this;this.SalePageCategoryId?this.ShopCategoryService.GetShopCategoryTreeByShopCategoryId(this.ShopId,this.SalePageCategoryId).then(function(t){n.ShopCategoryBreadcrumb=n.GetBreadcrumbList(t.Data.Breadcrumb);n.ActiveShopCategoryBreadcrumb=t.Data.Breadcrumb.filter(function(t){return t.Id===n.SalePageCategoryId})[0];n.ShopCategoryBreadcrumb.length>1?n.MultiShopCategoryData=n.GetMultiShopCategoryData([t.Data.Tree]).filter(function(n){return n.isActive||n.isChild||n.isNeighbor}):n.ShopCategoryServiceImmediate.GetShopCategoryTreeListByLevel(n.ShopId).then(function(t){n.MultiShopCategoryData=n.GetMultiShopCategoryData(t.Data.List).filter(function(n){return n.isActive||n.isChild||n.isNeighbor})})}):this.ShopCategoryServiceImmediate.GetShopCategoryTreeListByLevel(this.ShopId).then(function(t){n.MultiShopCategoryData=t.Data.List.reduce(function(t,i){return t.push(n.CheckMultiShopCategoryData(i,n.ActiveShopCategoryBreadcrumb,n.ShopCategoryBreadcrumb)),t},[])})},n.prototype.GetBreadcrumbList=function(n){var t=this;return n.filter(function(n){return n.Id!==t.SalePageCategoryId})},n.prototype.GetMultiShopCategoryData=function(n){var t=this,i=[];return n.forEach(function(n){var r=t.CheckMultiShopCategoryData(n,t.ActiveShopCategoryBreadcrumb,t.ShopCategoryBreadcrumb);i.push(r);n.ChildList&&n.ChildList.length>0&&(i=i.concat(t.GetMultiShopCategoryData(n.ChildList)))}),i},n.prototype.CheckMultiShopCategoryData=function(n,t,i){return t?{id:n.Id,isActive:n.Id===t.Id,isChild:n.ParentId===t.Id,isNeighbor:(i.some(function(t){return t.Id===n.ParentId})||i.length===0&&n.Level===1)&&n.Level===t.Level,name:n.Name}:{id:n.Id,isActive:!1,isChild:!1,isNeighbor:!1,name:n.Name}},n.$inject=["$scope","$log","ShopId","SalePageCategoryId","ShopCategoryService","ShopCategoryServiceImmediate"],n}();n.AsideMultiLevelMenuController=t;angular.module("NineYi.Mall.Controllers").controller("AsideMultiLevelMenuController",t)})(t=n.Controllers||(n.Controllers={}))})(t=n.Mall||(n.Mall={}))}(NineYi||(NineYi={})),function(n){var t;(function(n){var t;(function(n){var t=function(){function n(n,t){this.$log=n;this.ComponentControlFactory=t;this.IsEnable=!1;this.IsEnable=this.ComponentControlFactory.IsEnableToolbox}return n.$inject=["$log","ComponentControlFactory"],n}();n.CommonToolboxController=t;angular.module("NineYi.Mall.Controllers").controller("CommonToolboxController",t)})(t=n.Controllers||(n.Controllers={}))})(t=n.Mall||(n.Mall={}))}(NineYi||(NineYi={})),function(n){var t;(function(n){var t;(function(n){var t=function(){function n(n,t,i,r){this.config=n;this.WebApiFactory=t;this.$q=i;this.$http=r}return n.prototype.GetShopPayShippingTypeDisplaySettingList=function(n){var t=this.$q.defer(),i=this.WebApiFactory.getWebApiUrl("/Shop/GetShopPayShippingTypeDisplaySettingList/"+n);return this.$http.get(i).then(function(n){n.data.ReturnCode==="API0001"?t.resolve(n.data):t.reject()}).catch(t.reject),t.promise},n.prototype.GetShopContractSetting=function(n){var t=this.$q.defer(),i=this.WebApiFactory.getWebApiUrl("/Shop/GetShopContractSetting/"+n);return this.$http.get(i).then(function(n){t.resolve(n.data)}).catch(t.reject),t.promise},n.prototype.GetShopCategoryList=function(n){var t=this.$q.defer(),i=this.WebApiFactory.getWebApiUrl("/Shop/GetShopCategoryListV2/"+n),r={id:n};return this.$http.get(i,r).then(function(n){t.resolve(n.data)}).catch(t.reject),t.promise},n.prototype.GetProductCategoryList=function(n,t,i){var r=this.$q.defer(),u=this.WebApiFactory.getWebApiUrl("/Shop/GetShopCategoryListV3/"+n+"?serviceType="+t+"&locationId="+i);return this.$http.get(u).then(function(n){r.resolve(n.data)}).catch(r.reject),r.promise},n.prototype.GetShopAppName=function(n,t){var r=this,i=this.$q.defer(),u=this.WebApiFactory.getWebApiUrl("/Shop/GetShopAppName/"+n+"?osType="+t),f={shopId:n,osType:t};return this.$http.get(u,f).then(function(n){i.resolve(n.data);r.AppName=n.data.Data.length>0&&n.data.Data[0].appName?n.data.Data[0].appName:""}).catch(i.reject),i.promise},n.prototype.GetVipMemberDisplaySettings=function(n){var t=this.$q.defer(),i=this.WebApiFactory.getWebApiUrl("/Shop/GetVipMemberDisplaySettings/"+n);return this.$http.get(i,{}).then(function(n){t.resolve(n.data)}).catch(t.reject),t.promise},n.prototype.GetOverseaShippingStatement=function(n){var t=this.$q.defer(),i=this.WebApiFactory.getWebApiUrl("/Shop/GetOverseaShippingStatement/"+n);return this.$http.get(i).then(function(n){t.resolve(n.data)}).catch(function(n){t.reject(n.data)}),t.promise},n.prototype.GetGlobalPaymentDetailInfo=function(n){var t=this.$q.defer(),i=this.config.webapiUrl+"/Shop/GetGlobalPaymentDetailInfo/"+n;return this.$http.get(i).then(function(n){t.resolve(n.data)}).catch(function(n){t.reject(n)}),t.promise},n.prototype.GetIsShowOfflineOrderDescription=function(n){var t=this.$q.defer(),i=this.WebApiFactory.getWebApiUrl("/Shop/IsShowOfflineOrderDescription/"+n);return this.$http.get(i).then(function(n){t.resolve(n.data)}).catch(t.reject),t.promise},n.prototype.GetPurchaseNotesSetting=function(n){var t=this.$q.defer(),i=this.WebApiFactory.getWebApiUrl("/Shop/GetPurchaseNotesSetting/"+n);return this.$http.get(i).then(function(n){t.resolve(n.data)}).catch(function(n){t.reject(n.data)}),t.promise},n.prototype.GetEnableDisplayStoreList=function(n){var t=this.$q.defer(),i=this.WebApiFactory.getWebApiUrl("/Shop/GetEnableDisplayStoreList/"+n);return this.$http.get(i).then(function(n){t.resolve(n.data)}).catch(function(n){t.reject(n.data)}),t.promise},n.$inject=["Mall.Config","WebApiFactory","$q","$http"],n}();n.ShopService=t;angular.module("NineYi.Mall.Services").service("ShopService",t)})(t=n.Services||(n.Services={}))})(t=n.Mall||(n.Mall={}))}(NineYi||(NineYi={}))