window.i18njs&&(i18n.t("msg_promotion__delta__percentage"),i18n.t("msg_promotion__delta__capped"),i18n.t("msg_promotion__delta__capped__up_to"),i18n.t("msg_promotion__delta__flat_rate"),i18n.t("msg_promotion__delta__free_shipping"),i18n.t("msg_promotion__delta__discounted_amount"),i18n.t("msg_promotion__delta__percentage_with_cap"),i18n.t("msg_promotion__delta__qualified_for_shipping_subsidy"),i18n.t("msg_promotion__rule__order_total"),i18n.t("msg_promotion__rule__order_total__location_group"),i18n.t("msg_promotion__rule__order_total__location_group__simple"),i18n.t("msg_promotion__rule__order_total__TH"),i18n.t("msg_promotion__rule__order_total__PH"),i18n.t("msg_promotion__rule__order_total__SG"),i18n.t("msg_promotion__rule__order_total__ID"),i18n.t("msg_promotion__rule__order_total__simple__TH"),i18n.t("msg_promotion__rule__order_total__simple__PH"),i18n.t("msg_promotion__rule__order_total__simple__SG"),i18n.t("msg_promotion__ruleset"),i18n.t("msg_promotion__ruleset__VN"),i18n.t("msg_promotion__hint__order_total__TW"),i18n.t("msg_promotion__hint__order_total__TW__cb"),i18n.t("msg_promotion__hint__order_total__VN"),i18n.t("msg_promotion__hint__order_total__MY"),i18n.t("msg_promotion__hint__order_total__MY__cb"),i18n.t("msg_promotion__hint__order_total__SG"),i18n.t("msg_promotion__hint__order_total__SG__cb"),i18n.t("msg_promotion__hint__order_total__ID"),i18n.t("msg_promotion__hint__order_total__ID__cb"),i18n.t("msg_promotion__hint__order_total__TH"),i18n.t("msg_promotion__hint__order_total__TH__cb"),i18n.t("msg_promotion__hint__location_not_supported"),i18n.t("msg_promotion__hint__order_total__PH__cb"),i18n.t("label_free_shipping_cap"),i18n.t("label_lowest_price_guarantee--ID"),i18n.t("label_lowest_price_guarantee--MY"),i18n.t("label_lowest_price_guarantee--PH"),i18n.t("label_lowest_price_guarantee--SG"),i18n.t("label_lowest_price_guarantee--TH"),i18n.t("label_lowest_price_guarantee--TW"),i18n.t("label_lowest_price_guarantee--VN"));var infoService,CROSS_BORDER=["SG","MY","TW","ID","TH"],stock=0,topImage="",quantity=1,isSnapShot=!1,isDeleted=!1,isWeb=!0,isBanned=!1,isReviewing=!1,ITEM_SHARING_TEXT_LIST=null,DISCOUNT_PERCENT=null,DISCOUNT_TEXT=null,image_index=0,panelViewOnly=!1,web_AddToCartOnly=!1,model_selected=null,currency="",addressLevel="city",hasLoadedItemDetails=!1,pendingUpdate=null,djangofyInstance=new BJDjangofy,sourceUrl=null,shopName="",showFreeShipping=!0,itemDataUrl="",_logisticChannelsCache=new BJCacher("/api/v1/logistics/channels/"),hasReportedVideoPlayFullScreen=!1,hasReportedVideoPlayInline=!1,pageViewReported=!1,item_detail=null,timeService=(window.TRACKING_URL_PARAMS_NO_PASSING||(window.TRACKING_URL_PARAMS_NO_PASSING=[]),TRACKING_URL_PARAMS_NO_PASSING.push(window.MARKET_TRACKING_TOKEN_NAME),ShopeeLib.TimeService()),DeliveryTime=ShopeeLib.DeliveryTime;function initShippingFeeHelp(){$(".shipping-fee-help").off("tap").on("tap",function(e){e.stopPropagation(),bridgeCallHandler("showPopUp",{popUp:{message:i18n.t("msg_shipping_fee_help"),buttonType:0,okText:i18n.t("label_ok")}},function(e){})})}function hideWebContent(){$("#message").hide()}"ID"==LOCALE&&(addressLevel="district"),bridgeInit(function(e){e&&(isWeb=!1),plvPreload("item","/item/","v2")});var shippingFeeAddressPicker=null;function setUpAddressPicker(){var e;SHOW_SHIPPING_FEE_PANEL?($("#shipping-fee-with-address-picker,#shipping-fee-selector").on("tap",function(e){$(".shipping-fee-panel-mask").show(),$(".shipping-fee-panel").animate({bottom:"0"},200)}),e=".shipping-fee-panel .deliver-to",$("#shipping-fee-address-picker").find(".ic_orderdetails_address").hide(),$("#shipping-fee-address-picker").find(".ic_arrow_down_black").hide()):e="#shipping-fee-address-picker",shippingFeeAddressPicker=new AddressPicker(e,addressLevel,{save:"session",load:!0,onSelect:[updateShippingFee]})}var shippingFeeUpdater=null;function updateShippingFee(e,t){$("#shipping-fee-with-address-picker").find(".selected-address").text(t),$(".shipping-fee-panel .address-name").text(t),e.state&&e.city&&("city"!=addressLevel&&!e.district||BJUtil.get("/shop/{0}/item/{1}/shipping_info_to_address/".f(shopid,itemid),{state:e.state,city:e.city,district:e.district},function(e){var t,i;ShippingFeeUIHandler(e.promotion_rules,e.shipping_infos),void 0===e.error&&shippingFeeUpdater&&(t=BJUtil.idx(e,"shipping_infos",[]),i=infoService.generateShopChannelDataParameters(t),shippingFeeUpdater(t,i),window._promotionInfoUpdater(shopName,i,e.promotion_rules))}))}function ShippingFeeUIHandler(e,t){var i=infoService.generateShopChannelDataParameters(t),a=DeliveryTime.getItemEstimatedDeliveryTimeText(t,function(e,t){return i18n.t(e).tFormat(t)}),n=$("#delivery-item-djangofy-template").text(),n=new BJDjangofy(n);$(".delivery-list").empty().on("touchmove",function(e){e.stopPropagation()});for(var o=0;o<t.length;o++){var r=t[o],l=i[r.channel.channelid],s=infoService.generateChannelShippingFeeDisplayData(e,r.channel.channelid,l),l=infoService.generateChannelDiscountHint(e,r.channel.channelid,l,itemPrice,cb_option),d=a.channels[r.channel.channelid],d=$(n.render({channel:{delivery_time:d,delivery_text:l,name:r.channel.name,discounted_price:s.discountedShippingFeeString,price:s.estimatedShippingFeeString}}));d.find(".delivery-text").html(d.find(".delivery-text").text()),$(".delivery-list").append(d)}}function _promotionInfoUpdater(e,t,i){var a,n,o=!1;if("VN"==window.LOCALE&&i)for(var r=0;r<i.length;r++)i[r].discount_flag==Constants.LogisticPromotionRuleDiscountFlag.CAPPED&&(o=!0);(showFreeShipping||o)&&((a=$(".shipping-promotion-info-container")).show().removeClass("hide"),n=a.find(".label-shipping-fee-promotion"),""===(e=infoService.generateDiscountString({promotionRules:i,shopName:e,shopEnabledChannelsData:t,crossBorder:cb_option,orderTotal:itemPrice,simpleMode:!1}))?a.hide():n.html(e))}function _formatShippingFee(e,t){return dollarsign_getter(t)+bee_dollarfy(e,t)}function populateChannelSpecificShippingFees(e,t,i,a){0<=Config.CountriesDisplayLogisticWarningItemPage.indexOf(LOCALE)?(e.find(".option-original-shipping-fee").hide(),"unsupported_address"===t||"unsupported_seller_address"===t||"channel_unavailable"===t?e.find(".option-shipping-fee").text(i18n.t("label_address_not_supported")):"shipping_option_unsupported"===t&&e.find(".option-shipping-fee").text(i18n.t("label_shipping_option_unsupported"))):a?(e.find(".option-original-shipping-fee").text(i),e.find(".option-shipping-fee").text(a).addClass("primary-color")):(e.find(".option-original-shipping-fee").hide(),e.find(".option-shipping-fee").text(i))}function populate_shipping_fees(f){var v,t=BJUtil.idx(f,"logistics",[]),y=0<t.length?t[0].channel.channelid:null;$(".slide-out-select-options").empty(),void 0===t||0==t.length?($(".shipping-fee-select").hide(),$(".shipping_fee_included").show().css("display","flex"),$(".border-line--shipping-fee-select").show()):($(".shipping_fee_included").hide(),$(".shipping-fee-select").show(),$(".border-line--shipping-fee-select").show(),shopName=f.shopname,showFreeShipping=f.show_free_shipping,v=!1,shippingFeeUpdater=function(e,t){for(var i=[],a=[],n=$(".slide-out-select-options"),o=!1,r=(n.text(""),DeliveryTime.getItemEstimatedDeliveryTimeText(e,function(e,t){return i18n.t(e).tFormat(t)})),l=0;l<e.length;l++){var s,d,_,c,p,m=e[l];m&&m.channel&&(d=m.channel.channelid,s=m.channel.name,_formatShippingFee(m.cost,currency),_="","TW"==window.LOCALE&&a.push(m.cost),_=(_=(d=r.channels[d])?(_=$("#shipping-option-with-delivery-time-template").text()).replace("#{deliveryTime}",d):$("#shipping-option-template").text()).replace("#{channelName}",s).replace("#{channelid}",m.channel.channelid),m.discount,m.channel.custom_discount&&m.possible_discount&&(o=!0,m.possible_discount),d=infoService.generateChannelDiscountHint(f.promotion_rules,m.channel.channelid,t[m.channel.channelid],itemPrice,cb_option),_=_.replace("#{shippingPromotion}",d),s=$(_),d=t[m.channel.channelid],c=(_=infoService.generateChannelShippingFeeDisplayData(f.promotion_rules,m.channel.channelid,d)).estimatedShippingFeeString,p=_.discountedShippingFeeString,0<=Config.CountriesDisplayLogisticWarningItemPage.indexOf(LOCALE)&&("unsupported_address"===m.warning||"unsupported_seller_address"===m.warning||"channel_unavailable"===m.warning)||(_.possibleShippingFees?i=i.concat(_.possibleShippingFees):i.push(d.discountedShippingFee)),populateChannelSpecificShippingFees(s,m.warning,c,p),n.append(s),m.channel.channelid==y&&s.attr("selected",!0),v|=m.channel.distance_calculation)}var u=0==i.length,h=(0==i.length&&i.push(0),0==a.length&&a.push(0),Math.min.apply(null,i)),g=Math.max.apply(null,i);"TW"==window.LOCALE&&(h=Math.min.apply(null,a),g=Math.max.apply(null,a)),u?$(".selected-shipping-fee").text(i18n.t("label_address_not_supported")):h!==g?$(".selected-shipping-fee").text("{0} - {1}".f(_formatShippingFee(h,currency),_formatShippingFee(g,currency))):$(".selected-shipping-fee").text(_formatShippingFee(h,currency)),Math.min.apply(null,a),r.allChannels?$(".delivery-time").text(r.allChannels):($(".delivery-time-container").hide(),$(".cross-border-shipping-fee .shipping-fee-select-arrow").removeClass("hide")),!o||"TH"!=LOCALE&&"PH"!=LOCALE||$(".shipping-promotion-info").removeClass("hide"),v&&($("#shipping-fee-with-address-picker").removeClass("hide"),$(".cross-border-shipping-fee").addClass("hide"),$("#shipping-fee-selector").addClass("hide"),shippingFeeAddressPicker.selectedAddress||(f.user_default_address?shippingFeeAddressPicker.setAddress(f.user_default_address):shippingFeeAddressPicker.setAddress(Constants.CapitalCityOf[LOCALE])))},_logisticChannelsCache.get(function(e){e=(infoService=ShopeeLib.ShippingFeeInfoService().create(window.LOCALE,window.LANGUAGE,e.channels,function(e,t){e=i18n.t(e);return e=_.isEmpty(t)?e:e.tf(t)},Config.PromotionRuleDisplayConfig[window.LOCALE])).generateShopChannelDataParameters(t);window.shippingFeeUpdater(t,e),window._promotionInfoUpdater(shopName,e,f.promotion_rules)}),$(function(){setTimeout(function(){$(".shipping-fee-select").on("tap",function(e){e.preventDefault(),e.stopImmediatePropagation(),$(".shipping-fee-select").toggleClass("collapsed"),$(".shipping-option-info").toggleClass("hide")})},500),$(".shipping-fee-panel-mask, .confirm-btn").on("tap",function(e){$(".shipping-fee-panel-mask").hide(),$(".shipping-fee-panel").animate({bottom:"-1000px"},200)}),$(".shipping-fee-panel-mask").on("touchmove",function(e){e.stopPropagation(),e.preventDefault()})}))}function populate_comments(e){if(e.item_detail.item_comments){var t=_.template("<div class='image-wrapper'><div class='image' style='background-image:url(\""+ITEM_IMAGE_BASE_URL+"<%= image %>_tn\")'></div></div>");for(s in $("#review-container").text(""),e.item_detail.item_comments)if(e.item_detail.item_comments.hasOwnProperty(s)){for(var i=e.item_detail.item_comments[s],a=$("#review-template").clone(),n=i.comment,o=BJUtil.idx(i,"mentioned")||[],r={},l=[],n=(o.forEach(function(e){var t=n.substr(e.offset,e.length);t in r||(r[t]=!0,l.push({name:t,userid:e.infoid}))}),djangofyInstance.safe_tags_replace(i.comment)),s=0;s<l.length;s++){var d=l[s],c='<span class="at-user clickable_area" data-userid="{0}">{1}</span>'.f(d.userid,d.name);n=n.replace(new RegExp(d.name,"g"),c)}a.find(".right .comment").html(n),BJUtil.listenUser(a.find(".right .comment").find(".at-user")),a.find(".right .time .timetext").html(formatDateLLL(i.ctime)),i.product_items&&i.product_items.length&&i.product_items[0].model_name&&(a.find(".right .variation-name").text(i.product_items[0].model_name),a.find(".right .variation-wrapper").css("display","inline-block")),i.user_pic&&a.find(".left .image").css("background-image","url("+ITEM_IMAGE_BASE_URL+i.user_pic+"_tn)"),a.find(".right .name").html(i.username),0<i.rating_star&&(a.find(".ui-star[data-star="+i.rating_star+"]").addClass("is-selected"),a.find(".buyer-review-part").removeClass("hidden")),a.show(),$("#review-container").append(a);var p=a.find(".item-images"),m=[];if(i.images)for(var u in i.images)i.images.hasOwnProperty(u)&&(m.push(ITEM_IMAGE_BASE_URL+i.images[u]),p.append($(t({image:i.images[u]}))));new ImagePreviewHelper({fullImageDatas:m,getImageIndex:function(e){return e.index()},imageElements:p.find(".image-wrapper")})}$(".fullScreenWrapper").css("z-index",$(".float-bottom").css("z-index")+1),$(".view-all-comments").show(),0==e.item_detail.rating_count[0]?($(".reviews__header__content__title").text(i18n.t("msg_no_ratings_yet")),$(".view-all-comments .text, .view-all-comments .ic_icon").hide(),$(".reviews__header__see-all").hide(),$(".view-all-comments").hide(),$(".reviews__header").css({"border-bottom":"none"})):($(".view-all-comments").addClass("padding-left"),$(".view-all-comments .no-comment").hide(),$(".view-all-comments .leave-a-comment").hide(),$(".view-all-comments .text, .view-all-comments .ic_icon").show(),$(".view-all-comments .text .number").html(e.item_detail.rating_count[0]),$(".view-all-comments").hide(),1==e.item_detail.rating_count[0]&&$(".comment_text").text(i18n.t("label_comment")));var h=e.item_detail.cmt_count-e.item_detail.rating_count[0];h<100?(h<0&&(h=0),$("#comment-button .number").text(h)):$("#comment-button .number").text()}}function reloadComments(){url=jsonURL,getJSON(url,function(e){$("#review-container").empty(),populate_comments(e),pendingUpdate&&window.WebViewJavascriptBridge&&(pendingUpdate.updateComment=!0,window.WebViewJavascriptBridge.callHandler("save",{key:"pending-update",data:JSON.stringify(pendingUpdate),persist:0},function(){}))})}var isImageListPopulated=!1,swiper=null,player=null,videoUrl=null,videoElement=null,isPlayerInited=!1,videoId=null,videoIdx=null;function isFullScreenOnlyVideo(){return null==window._isFullScreenOnlyVideo_&&(window._isFullScreenOnlyVideo_=isShopeeApp()&&isAndroid&&(isChrome30Minus()||!isChrome()&&isAndroid43Minus())),window._isFullScreenOnlyVideo_}function initPlayer(){isPlayerInited||(isPlayerInited=!0,player.initialize(videoElement,videoUrl,!1))}function createPlayer(e,t){var i=dashjs.MediaPlayer().create();return window.videoElement=e,window.videoUrl=t,window.isVideoInited=!1,i}function videoTouchStart(e){e.target.id&&e.target.id.startsWith("videoclip")?(e.target.controls&&(swiper.params.onlyExternal=!0),_android_gatap_temporary_disable_(!0)):(swiper.params.onlyExternal=!1,_android_gatap_temporary_disable_(!1))}var videoHasNativeContinuity=!1;function videoTap(){if(isVerVideo()&&medias){for(var e=-1,t=0;t<medias.length;t++)if(1==medias[t].type){videoHasNativeContinuity||(medias[t].curTime=videoGetProgress()),e=t;break}e<0||(videoHasNativeContinuity||videoPause(),callImages(imageUrls,medias,e),hasReportedVideoPlayFullScreen)||(hasReportedVideoPlayFullScreen=!0,window.BI_ANALYTICS&&BI_ANALYTICS.trackVideoPlay(window.USERID,shopid,itemid,videoId,!0))}}function videoGetProgress(){var e=document.getElementById("videoclip");return e&&e.currentTime?parseInt(e.currentTime):0}function videoSetProgress(e){var t;player?player.seek(e):(t=document.getElementById("videoclip"))&&(t.currentTime=e)}function videoIsPlaying(){var e=document.getElementById("videoclip");return!e||!e.paused}function videoPlay(){var e;isFullScreenOnlyVideo()||($(".ic_play").hide(),hasReportedVideoPlayInline||(hasReportedVideoPlayInline=!0,window.BI_ANALYTICS&&BI_ANALYTICS.trackVideoPlay(window.USERID,shopid,itemid,videoId,!1)),player?(initPlayer(),player.play()):(e=document.getElementById("videoclip"))&&(e=e.play(),window.Promise)&&e instanceof Promise&&e.catch(function(e){_android_gatap_temporary_disable_(!0),console.log("video_play_ex",e)}))}function videoAutoStart(){var t;isFullScreenOnlyVideo()||(isPC()?videoPlay():(t=window.WebViewJavascriptBridge)&&t.callHandler("hasHandler",{handler:"getNetworkInfo"},function(e){0!=e.status&&t.callHandler("getNetworkInfo","",function(e){1==e.networkType&&videoPlay()})}))}function videoPause(){if(!isFullScreenOnlyVideo())if($(".ic_play").show(),player)try{isPlayerInited&&!player.isPaused()&&player.pause()}catch(e){console.log("player.pause.ex",e)}else{var e=document.getElementById("videoclip");e&&!e.paused&&e.pause&&e.pause()}}function onTap_CoverOrPlayBtn(e){e&&(e.stopImmediatePropagation(),e.preventDefault()),isFullScreenOnlyVideo()?isVerVideo()?videoTap():BJUtil.showMsg(i18n.t("msg_upgrade_app_to_play_video")):videoPlay()}function videoMute(){var a;isFullScreenOnlyVideo()||(a=window.WebViewJavascriptBridge)&&a.callHandler("hasHandler",{handler:"muteVideoPlayer"},function(e){var t,i;1==e.status&&(t=100,(i=function(){a.callHandler("muteVideoPlayer",{mute:1},function(e){e&&(0==e.status?0<t&&(setTimeout(function(){i()},100),t--):window.videoHasNativeContinuity=!0)})})())})}var imageUrls=[],medias=[];function populate_image_list(e,t,o){if(!isImageListPopulated){isImageListPopulated=!0;var i=".swiper-container",a=$(i),n=a.find(".swiper-wrapper");if(swiper&&(swiper.destroy(),n.empty()),n.css({width:"100%",height:"100%"}),e&&0!=e.length){a.find(".swiper-slide").remove();for(var r=n.width()||screen.width,l=0;l<e.length;l++){var s,d,_,c,p,m=e[l].id,u=$("<div class='item swiper-slide'>"),h=ITEM_IMAGE_BASE_URL+m,m=ITEM_IMAGE_BASE_URL+m+"_tn",g=(imageUrls.push(h),n.append(u),$("<img>")),f=(0==l&&(topImage=h),$('<img class="img"/>').attr("src",m));f.load(function(i,e,a){function n(t,i){var a=document.createElement("img");a.src=i,a.onload=function(){var e=r/Math.max(a.width,a.height),e=(t.width(a.width*e),t.height(a.height*e),t.attr("src",i),t[0]._swiper_dup_);null!=e?w(t,e):t[0]._loaded_=!0,$(a).remove()}}f.remove(),i.attr("src",e),i.attr("alt",o),i.attr("title",o),i.width(r),i.height(r),setTimeout(function(){var t;window.WebViewJavascriptBridge?(t=window.WebViewJavascriptBridge).callHandler("hasHandler",{handler:"getNetworkInfo"},function(e){0==e.status?n(i,a):t.callHandler("getNetworkInfo","",function(e){(1==e.networkType||2==e.networkType&&"CTRadioAccessTechnologyGPRS"!=e.cellularType&&"CTRadioAccessTechnologyEdge"!=e.cellularType&&"NETWORK_TYPE_EDGE"!=e.cellularType&&"NETWORK_TYPE_UNKNOWN"!=e.cellularType&&"NETWORK_TYPE_GPRS"!=e.cellularType)&&n(i,a)})}):n(i,a)},200)}(g,m,h)),e[l].video_id?(videoId=e[l].video_id,videoIdx=l,m=$('<div class="ic_play video_btn_play"></div>'),s=ITEM_VIDEO_BASE_URL+videoId,p=null,d=isVerVideo()?"":"controls",c='poster="'+h+'"',p=(_=!(isIOS()||isMacSafari()))?(s+="?type=dash",$('<video id="videoclip" data-dashjs-player {muted} {controls} webkit-playsinline {poster}></video>'.replace("{muted}","muted").replace("{controls}",d).replace("{poster}",c))):(s+="?type=hls",$('<video id="videoclip" {muted} {controls} webkit-playsinline {poster}><source src="{videoUrl}" /></video>'.replace("{muted}","muted").replace("{controls}",d).replace("{videoUrl}",s).replace("{poster}",c))),isFullScreenOnlyVideo()&&(p=$()),u.append(p),isPC()||u.append(g),u.append(m),g[0].tapFunc=onTap_CoverOrPlayBtn,p.on("pause",function(){var e=$(".ic_play");this.ended?e.addClass("replay"):e.removeClass("replay"),e.show()}),p.on("play playing",function(){var e=$(".ic_play");e.each(function(){$(this).parents(".item").find("img").hide()[0].tapFunc=null}),e.hide()}),p.on("canplay",function(){var e=$("#videoclip");e.height()>=r-30&&e.css("height",r-30)}),medias.push({mediaUrl:ITEM_VIDEO_BASE_URL+e[l].video_id,type:1}),runAfterDomReady(function(){videoMute()},200),_&&!isFullScreenOnlyVideo()&&(player=createPlayer(document.getElementById("videoclip"),s),initPlayer())):(u.append(g),g[0].tapFunc=function(e){return function(){!BJUtil.isAdultSafe()&&t||callImages(imageUrls,medias,e)}}(l),medias.push({imageUrl:h,type:0}))}$(document).off("touchstart",videoTouchStart).on("touchstart",videoTouchStart),swiper=gswiper_init(i,{onTouchStart:function(e,t){videoTouchStart(t)},onTap:function(e,t){t.target.id&&t.target.id.startsWith("videoclip")&&!t.target.controls&&videoTap()},loop:!1,onSlideChangeStart:function(e,t){(e=$(e.slides[e.activeIndex])).length<=0||((e=e.find("video"))&&0<e.length?videoAutoStart:videoPause)()}}),0<image_index&&swiper.slideTo(image_index),$(".video_btn_play").on("tap",onTap_CoverOrPlayBtn);var v,y;a.find(".swiper-slide-duplicate").each(function(){var e=$(this),t=e.attr("data-swiper-slide-index"),t=a.find('.swiper-slide[data-swiper-slide-index="'+t+'"]:not(.swiper-slide-duplicate)').find("img");t[0]&&(e=e.find("img"),t[0].tapFunc&&(e[0].tapFunc=t[0].tapFunc),t[0]._loaded_?w(t,e):t[0]._swiper_dup_=e)});isShopeeApp()&&isAndroid()&&(v=0,y=setInterval(function(){__android_getSwipeables__(a,!0),10<=++v&&clearInterval(y)},1e3)),gswiper_on_tap(a,swiper,function(e,t){var t=$(t.target);t.hasClass("swiper-button-next")||t.hasClass("swiper-button-prev")||(t=gswiper_get_active_slide(a).find("img"))[0].tapFunc&&t[0].tapFunc()})}else n.append($('<img class="p-cover" src="'+STATIC_URL+'images/img-product-default.png">'))}function w(e,t){t.width(e.width()),t.height(e.height()),t.attr("src",e.attr("src"))}}var CHECKED_ADULT=!1,userid=null,shopUserId=null,shopid=null,username=null,latitude=null,longtitude=null,address=null,isInactive=null,isDeepInactive=null,isOwner=null,itemTitle=null,cb_option=null,itemShopId=null,itemItemId=null,listenFirstCateoryInited=!1,avatar=null,offer_count=null,item_stock=null,item_currency=null,itemid=null,itemName=null,itemDesc=null,itemCurrency=null,itemPrice=null,itemStatus=null,itemCatname=null,itemCatid=null,itemImage=null,itemModels=null,is_blocked_by_owner=null,wholesaleTiers=null,canUseWholesale=null,$flashSaleTimer=null;function populate_item_page(i){if(i.shop&&(userid=i.shop.userid,shopUserId=i.shop.userid,shopid=i.shop.shopid,username=i.shop.account.username,latitude=i.shop.latitude,longtitude=i.shop.longitude,address=i.shop.place,isInactive=isShopInactive(1e3*i.shop.account.last_active_time),isDeepInactive=i.shop.account.inactive),i.deleted)BJUtil.showMsgAndGoBack(i18n.t("label_this_product_delete"));else if(i.notexist)BJUtil.showMsgAndGoBack(i18n.t("msg_the_product_you_are_looking_for_does_not_exist"));else{if(i.banned){if(!i.shop)return;if(!USERID||USERID!=parseInt(i.shop.userid))return void BJUtil.showMsgAndGoBack(i18n.t("msg_the_product_you_are_looking_for_does_not_exist"));isBanned=!0,2==i.item_detail.status&&(isReviewing=!0),$(".update-href").off("tap").on("tap",function(){(bridge=window.WebViewJavascriptBridge).callHandler("showEditProduct",{shopID:i.shop.shopid,itemID:i.itemid},function(e){})})}if(i.error)BJUtil.showMsgAndGoBack(i18n.t("label_unexpected_error"));else if(item_detail=i.item_detail){itemName=item_detail.name,shopid=shopid||item_detail.shopid,isOwner=CURRENT_SHOPID&&CURRENT_SHOPID==shopid,item_detail&&item_detail.currency&&(currency=item_detail.currency),item_detail.catid&&item_detail.catname&&itemName&&item_detail.itemid&&item_detail.shopid&&(n={itemId:item_detail.itemid,itemName:itemName,shopId:item_detail.shopid,categoryId:item_detail.catid,categoryName:item_detail.catname},item_detail.no_sub||(n.subcategoryId=item_detail.sub_catid,n.subcategoryName=item_detail.sub_catname),null!=(DEEP_LINK_URL=constructDeepLinkUrlWithAction(n,null)))&&"undefined"!=typeof updateDeepLinkMeta&&updateDeepLinkMeta(DEEP_LINK_URL);for(var t,e=[],a=0;a<item_detail.image_list.length;a++)e.push({id:item_detail.image_list[a],type:"image"});if(item_detail.flash_sale&&item_detail.flash_sale.promo_images&&item_detail.flash_sale.promo_images.length&&(t=item_detail.flash_sale.promo_images[0],-1<(n=_.findIndex(e,function(e){return e.id==t}))&&e.splice(n,1),e.splice(0,0,{id:t,type:"image"})),item_detail.videos)for(a=0;a<item_detail.videos.length;a++)e.splice(1,0,{id:item_detail.videos[a].thumb_url,type:"video_thumb",video_id:item_detail.videos[a].video_id});populate_image_list(e,item_detail.is_adult,itemName),CHECKED_ADULT||(CHECKED_ADULT=!0,BJUtil.checkAdult(item_detail.is_adult,".swiper-container"));var n=$("#title-name");n.contents().filter(function(){return 3==this.nodeType})[0].nodeValue=itemName;try{$(".has-video-icon").remove(),item_detail.videos&&!$.isEmptyObject(item_detail.videos)&&((o=$(".video-placeholder")).removeClass("hide"),r=parseInt(n.css("line-height")),l=parseInt(n.height()),1==Math.round(l/r)?(o.addClass("hide"),n.append('<span class="ic_productlist_video has-video-icon"></span>')):(n.append('<span class="ic_productlist_video has-video-icon"></span>'),$(".has-video-icon")[0].offsetTop>=l&&($(".has-video-icon").hide(),o.css("margin-top",r+"px").removeClass("hide").removeClass("visibility-hidden"))))}catch(e){console.error(e)}itemTitle=itemName,cb_option=!1,((cb_option=-1!=CROSS_BORDER.indexOf(LOCALE)?item_detail.cb_option:cb_option)?$(".non-cross-border"):$(".cross-border")).hide(),BJUtil.configurePageTitle(itemName),isSnapShot&&(itemShopId=i.item_detail_root.shopid||i.item_detail.shopid,itemItemId=i.item_detail_root.itemid||i.item_detail.itemid,isShopeeWeb()?$(".view-href").attr("href",SeoUtil.getItemUrlSeo(i.item_detail_root.name,itemShopId,itemItemId)):$(".view-href").attr("href","/item/#shopid="+itemShopId+"&itemid="+itemItemId),isDeleted)&&(itemTitle=itemName),isShopeeWeb()&&$(".view-href").on("tap",function(e){e.stopPropagation(),e.preventDefault(),$this=$(this),BJUtil.navigate($this.attr("href"),!0),setTimeout(function(){location.reload()},800)}),item_detail.liked?($("#like-icon").addClass("ic_heart_filled"),$("#like-icon").removeClass("ic_productdetails_like")):($("#like-icon").addClass("ic_productdetails_like"),$("#like-icon").removeClass("ic_heart_filled"));var o,r,n=$("#item-price"),l=(n.empty(),E(item_detail.currency,item_detail.price,item_detail.price_min,item_detail.price_max)),n=(n.append(l),item_detail.has_lowest_price_guarantee&&(o=$("#lowest-price-guarante-djangoy").text(),o=new BJDjangofy(o),r="normal",item_detail.flash_sale&&(r="flash-sale"),i&&i.shop&&i.item_detail.is_official_shop&&(r="official-shop"),o=$(o.render({item_type:r,LOCALE:window.LOCALE})),(item_detail.flash_sale?($(".lowest-price-container-flash-for").empty(),$(".lowest-price-container-flash-for")):($(".lowest-price-container").empty(),$(".lowest-price-container"))).append(o),$(".lowest-price").find(".ic_help .tapable-area").on("tap",function(e){e.preventDefault(),e.stopPropagation(),BJUtil.navigate("/shop/lowest_price_guarantee/")}),$(".lowest-price").on("tap",function(e){var t;isShopeeWeb()?(t={itemId:item_detail.itemid,itemName:item_detail.name,shopId:item_detail.shopid,categoryId:item_detail.catid,categoryName:item_detail.catname},item_detail.no_sub||(t.subcategoryId=item_detail.sub_catid,t.subcategoryName=item_detail.sub_catname),openDeepLinking(DEEP_LINK_URL=constructDeepLinkUrlWithAction(null,JSON.stringify(t)),showPromMsgBuy)):bridgeCallHandler("login",{},function(e){var t;1==e.status&&(e="label_lowest_price_guarantee--"+window.LOCALE,window.APPVER&&window.APPVER<21322?(bridgeCallHandler("copyTextToClipboard",{text:i18n.t(e).replace("__{item}__",location.origin+SeoUtil.getItemUrlSeo(item_detail.name,item_detail.shopid,item_detail.itemid))}),bridgeCallHandler("showPopUp",{popUp:{message:i18n.t("msg_lowest_price_guarantee")}},function(){var e=window.USERID%window.LOWEST_PRICE_GUARANTEE_SHOP.length;bridgeCallHandler("startChat",{userID:window.LOWEST_PRICE_GUARANTEE_SHOP[e].userid,shopID:window.LOWEST_PRICE_GUARANTEE_SHOP[e].shopid})})):(t=window.USERID%window.LOWEST_PRICE_GUARANTEE_SHOP.length,bridgeCallHandler("startChat",{userID:window.LOWEST_PRICE_GUARANTEE_SHOP[t].userid,shopID:window.LOWEST_PRICE_GUARANTEE_SHOP[t].shopid,message:i18n.t(e).replace("__{item}__",location.origin+SeoUtil.getItemUrlSeo(item_detail.name,item_detail.shopid,item_detail.itemid))})))})})),$(".quantity-title .number").html(item_detail.stock),stock=item_detail.stock,$(".soldout_mask").css("opacity",0==stock?1:0),0!=stock&&$(".soldout_mask").hide(),item_detail.show_shopee_verified_label?$(".ic_product_details_verified").removeClass("hidden").off("tap").on("tap",function(e){e.stopPropagation(),e.preventDefault(),bridgeCallHandler("showPopUp",{popUp:{message:i18n.t("msg_shopee_verified_txt"),okText:i18n.t("label_ok"),cancelText:i18n.t("label_learn_more")}},function(e){1==e.buttonClicked&&(e=getFAQAnswerUrl("3637"),BJUtil.navigate(e,!1,!0))})}):$(".ic_product_details_verified").addClass("hidden"),item_detail.show_official_shop_label_in_normal_position&&$(".ic_product_details_officialshop").removeClass("hidden"),item_detail.show_official_shop_label_in_title&&$(".official_detail_label").removeClass("hidden"),$("#sold .number").text("("+item_detail.sold+")"),$("#likes .number").text(item_detail.liked_count),item_detail.cmt_count-item_detail.rating_count[0]),l=(n<100&&$("#comment-button .number").text(n),$(".item-category--first.text")),n=$(".item-category--second.text"),s=$(".item-category--third.text"),d=item_detail.is_category_failed;if(l.toggleClass("item-category--disabled",d),n.toggleClass("item-category--disabled",d),s.toggleClass("item-category--disabled",d),l.html(item_detail.catname),item_detail.catname&&item_detail.catid&&l.attr({"data-catid":item_detail.catid,"data-catname":item_detail.catname,"data-noSub":item_detail.no_sub}),d||listenFirstCateoryInited||(BJUtil.listenCategoryLink(l),listenFirstCateoryInited=!0),n.html(item_detail.sub_catname),!item_detail.sub_catid||!item_detail.sub_catname||item_detail.sub_is_default&&item_detail.third_is_default?($(".item-category--second").css("display","none"),$(".item-category--second.ic_icon").css("display","none")):($(".item-category--second").css("display","inline-block"),$(".item-category--second.ic_icon").css("display","inline-block"),n.attr({"data-catid":item_detail.catid,"data-catname":item_detail.catname,"data-keyword":item_detail.sub_catname,"data-sub-catid":item_detail.sub_catid,"data-sub-catname":item_detail.sub_catname})),n.off("tap"),d||n.on("tap",function(e){e.preventDefault();var t=$(this).data("catid"),i=$(this).data("catname"),a=$(this).data("sub-catid"),n=$(this).data("sub-catname");e.stopPropagation(),isShopeeWeb()?SeoUtil.navigateCategorySubSeo(n,t,a):BJUtil.jumpToSearch({mainCategoryId:t,mainCategoryName:i,subCategoryId:a,subCategoryName:n,inPageReload:!1})}),s.html(item_detail.third_catname),item_detail.third_catname&&item_detail.third_catid&&!item_detail.third_is_default?($(".item-category--third").css("display","inline-block"),$(".item-category--third.ic_icon").css("display","inline-block"),item_detail.no_sub?s.attr({"data-catid":item_detail.catid,"data-catname":item_detail.catname,"data-keyword":item_detail.third_catname}):s.attr({"data-catid":item_detail.catid,"data-catname":item_detail.catname,"data-subcatid":item_detail.sub_catid,"data-subcatname":item_detail.sub_catname,"data-keyword":item_detail.third_catname})):($(".item-category--third").css("display","none"),$(".item-category--third.ic_icon").css("display","none")),s.off("tap"),d||s.on("tap",function(e){e.preventDefault(),e.stopPropagation();var e=$(this),t={mainCategoryId:e.data("catid"),mainCategoryName:e.data("catname"),keyword:e.data("keyword"),inPageReload:!1};e.data("subcatid")&&(t.subCategoryId=e.data("subcatid")),e.data("subcatname")&&(t.subCategoryName=e.data("subcatname")),BJUtil.jumpToSearch(t)}),$.isEmptyObject(item_detail.attributes))$("#item-brand").html(nl2br(item_detail.brand)),""==item_detail.brand&&$(".brand-row").hide();else{$(".brand-row").hide();var c=item_detail.attributes,p=$(".attributes-table"),m=$("#attributes-row-template").text();p.empty();for(var u=0;u<c.length;u++){var h,g=c[u];$.isEmptyObject(g.name)||$.isEmptyObject(g.value)||""===g.name||""===g.value||(g.is_timestamp&&(g.value=formatDateLL(g.value),g.not_tapable=!0),g.is_pending_qc&&(g.not_tapable=!0),h=new BJDjangofy(m),h=$(h.render({attribute:g,ANDROID_FRIENDLY:ANDROID_FRIENDLY})),p.append(h),g.not_tapable)||h.on("tap",function(e){e.preventDefault(),e.stopImmediatePropagation();e=$(this);BJUtil.jumpToSearch({pageType:"attribute",matchid:e.data("attribute-id"),keyword:e.data("attribute-value")})})}p.removeClass("hide")}var f,v,y,w,l=get_translated_condition_text_for_display(item_detail.condition),n=(""!=item_detail.condition&&0!=item_detail.condition&&l||$(".condition-row").hide(),$("#item-condition").html(l),item_detail.models),d=(n&&0!=n.length?$(".model-row").show():$(".model-row").hide(),$("#item-variations").html(function(e){var t,i=[];for(t in e)i[t]=e[t].name;return nl2br(i.join(" / "))}(n)),$("#item-variations").html()),s="<span>"+$("#item-variations").html()+"</span>",l=($("#item-variations").html(s),$("#item-variations span").width()),d=($("#item-variations").html(d),l<=$("#item-variations").width()?$(".variation-holder").find(".ic_arrow_down").hide():$(".variation-holder").find(".ic_arrow_down").show(),$(".variation-holder").off("tap").on("tap",function(e){BJUtil.checkLogin(function(e){$("#buy-button").tap()})}),$(".multi-model-selection").off("tap").on("tap",function(e){BJUtil.checkLogin(function(e){$("#buy-button").tap()})}),isShopeeApp()&&isVer22Plus()||(n=item_detail,s=$("#model_panel_template").text(),s=new BJDjangofy(s,{template_subs:{"shop/item/price.html":$("#price_template").text()}}),s=$(s.render({currency:n.currency,price:n.price,price_min:n.price_min,price_max:n.price_max,stock:n.stock,models:n.models,ITEM_IMAGE_BASE_URL:ITEM_IMAGE_BASE_URL,item_detail:n,can_use_wholesale:n.can_use_wholesale,is_wholesale_open:window.is_wholesale_open,image:n.image_list[0],tier_variations:[],hide_stock_cls:""})),dollarfy_element(s),$("#second-layer").html(s),$("#second-layer .models .model.disabled").length==$("#second-layer .models .model").length-1&&k($("#second-layer .models .model:not(.disabled)")),n=$(".center-container").width(),s=3==window.devicePixelRatio||2.99==window.devicePixelRatio?(n-60)/4:(n-48)/3,n-=24,(f=$("#second-layer .models .model")).css("min-width",s),f.css("max-width",n),f.off("tap").on("tap",function(e){var t=$(this);t.hasClass("disabled")||(k(t),f.removeClass("selected"),t.addClass("selected"))}),onQuantityChange()),$("#item-stock").html(item_detail.stock),BJUtil.globalVersionFallback(function(){$("#item-stock").html(item_detail.stock)},function(){$(".stock-row").addClass("hide")}),i.shop&&""==i.shop.place&&$(".shipfrom-row").hide(),$("#item-days-to-ship .number").text(item_detail.estimated_days),1==item_detail.estimated_days&&$("#item-days-to-ship .texts").text(i18n.t("label_day")),i.shop&&($("#item-shipfrom").contents().filter(function(){return 3==this.nodeType})[0].nodeValue=nl2br(i.shop.place)),parseInt(item_detail.ctime)),l=new Date,s=new Date(1e3*d),b=($("#list-time .text").html(DateDiff.getDiff(s,l)),item_detail.discount&&0==$(".item-title .badge-promotion").length&&!item_detail.flash_sale&&(revertTWDiscountForEnglishIfNeeded(item_detail),d=$("#badge-promotion").text(),s=new BJDjangofy(revertTWDiscountForEnglishIfNeededTemplate(d)),b=$(s.render({item:item_detail,LOCALE:LOCALE})),$(".item-title").prepend(b)),item_detail.discount&&(item_detail.price_min_before_discount&&item_detail.price_min_before_discount!=item_detail.price_max_before_discount&&-1!=item_detail.price_max_before_discount&&-1!=item_detail.price_min_before_discount?((b=document.createElement("div")).className="price-before-discount l14",b.innerHTML=P(item_detail.price_min_before_discount)+" - "+P(item_detail.price_max_before_discount),$("#item-price").prepend(b)):item_detail.price_before_discount&&item_detail.price_before_discount!=item_detail.price&&((b=document.createElement("div")).className="price-before-discount l14",b.innerHTML=$($(".dollarfy_sign")[0]).text()+bee_dollarfy(parseInt(item_detail.price_before_discount),$(".dollarfy_val").attr("currency")),$("#item-price").prepend(b))),$(".dollarfy_sign").attr("dir","ltr"),$(".item-title .badge-soldout").remove(),0!==item_detail.stock||item_detail.flash_sale||(l=$("#badge_soldout_djangofy").text(),d=new BJDjangofy(l),s=$(d.render({LOCALE:LOCALE.toUpperCase()})),$(".item-title").prepend(s)),i),l=(b.item_detail.rating_star,b.item_detail.rating_count?b.item_detail.rating_count[0]:0),d=1<l?i18n.t("label_ratings"):i18n.t("label_rating"),d=(l?("5.0"==(v=Number(b.item_detail.rating_star).toFixed(1))&&(v="5"),$(".item_rating__rating-info__score").text(v+"/5"),window.CONFIG_SHOW_SOLD_COUNT?$(".item_rating__rating-info__count").text("("+l+")"):$(".item_rating__rating-info__count").text("("+l+" "+d+")"),$(".item_rating__rating-info__stars__star").each(function(){var e=$(this),t=e.index();1<=v-t?e.removeClass("ic_rating_score_hollow").addClass("ic_rating_score_solid"):.5<=v-t&&e.removeClass("ic_rating_score_hollow").addClass("ic_rating_score_half")})):($(".item_rating__rating-info").addClass("item_rating__rating-info--norating").text(i18n.t("msg_no_ratings_yet")),$(".reviews__header .item_rating__rating-info").hide()),populate_comments(b),$("#review-template").hide(),item_detail.sold&&window.CONFIG_SHOW_SOLD_COUNT?($(".sold-info").removeClass("hidden"),(s=$(".sold-info__content")).text(i18n.t("label_n_sold").replace("__n__",item_detail.sold)),s.off("tap").on("tap",function(e){e.preventDefault(),e.stopPropagation(),BJUtil.showMsg(i18n.t("msg_sold_count_tooltip"))})):$(".sold-info").addClass("hidden"),i),s=d.item_detail.coin_earn_items;if(s&&(C=_.max(s,function(e){return e.coin_earn}),s=_.min(s,function(e){return e.coin_earn}),C&&C.coin_earn&&(s=C!=s?1==C.coin_earn?i18n.t("msg_get_up_to_number_coins_singular"):i18n.t("msg_get_up_to_number_coins"):1==C.coin_earn?i18n.t("msg_get_number_coins_singular"):i18n.t("msg_get_number_coins"),$(".coin-info__label").text(s.replace("__number__",formatNumber(C.coin_earn))),$(".coin-info").removeClass("hide")),y=d.item_detail.coin_spend_cash_unit,y/=PRICE_INFLATION_FACTOR)&&$(".coin-info__tooltip").off("tap").on("tap",function(e){e.stopPropagation(),e.preventDefault();var e="VN"==window.LOCALE?1e3:1,t=formatNumber(Math.round(1/y*100)/100*e),e=dollarsign_getter(get_default_currency())+"1"*e,t=i18n.t("msg_coin_earn_tooltip").replace("__coinNo__",t).replace("__cashUnit__",e);bridgeCallHandler("showPopUp",{popUp:{message:t,okText:i18n.t("label_ok"),cancelText:i18n.t("label_learn_more")}},function(e){1==e.buttonClicked&&(e=getFAQAnswerUrl("3658"),BJUtil.navigate(e,!1,!0))})}),i.shop)if(window.new_product_design){var I=i.shop,s=$("#shop_part_template").text(),s=new BJDjangofy(s);I.total_avg_star?I.total_avg_star=I.total_avg_star.toFixed(1):I.total_avg_star=Math.round(0)/10,I.join_date_pure=i18n.t("label_ago").replace("__date__",DateDiff.getDiff(new Date(1e3*I.ctime),new Date,!0)),I.review_count=I.rating_good+I.rating_bad+I.rating_normal,I.response_time_string=getSellerResponse(I.response_time),(s=$(s.render({shop:I,ITEM_IMAGE_BASE_URL:ITEM_IMAGE_BASE_URL,isSeller:I.account.is_seller,isInactive:isInactive,isPC:isPC(),isAndroid:isAndroid(),LOCALE:LOCALE}))).off("tap").on("tap",function(e){_track_open_shop_from_product(shopid,itemid),isShopeeWeb()&&(e.preventDefault(),SeoUtil.navigateShopSeo(I.account.username))}),avatar=I.account.portrait?I.account.portrait+"_tn":"",BJUtil.listenLastlogin(s.find(".gray-line span")),BJUtil.listenRates(s.find(".reviews-box")),BJUtil.listenShopItems(s.find(".products-box"),!0),I.show_shopee_verified_label?s.find(".shopee-verified").css("opacity",1):s.find(".shopee-verified").css("opacity",0),I.show_official_shop_label?s.find(".official-shop-mark").css("opacity",1):s.find(".official-shop-mark").css("opacity",0),s.find(".response-rate-box").off("tap").on("tap",function(e){e.preventDefault(),e.stopPropagation(),bridgeCallHandler("showPopUp",{popUp:{message:i18n.t("label_response_rate_text"),okText:i18n.t("label_ok"),cancelText:i18n.t("label_learn_more")}},function(e){1==e.buttonClicked&&(e=getFAQAnswerUrl("2264"),BJUtil.navigate(e,!1,!0))})}),$(".shop-part-container").html(s)}else{var C=i.shop,d=$("#shop-part");d.addClass("old"),d.children("a").attr("href","/shop/#shopid="+C.shopid).attr("username",C.account.username).attr("userid",C.userid),d.off("tap").on("tap",function(e){_track_open_shop_from_product(shopid,itemid)}),avatar=C.account.portrait?(d.find("#seller-thumb").css("background-image","url("+ITEM_IMAGE_BASE_URL+C.account.portrait+"_tn)"),C.account.portrait+"_tn"):"",d.find("#shop-name").text(C.account.username),d.find(".score .number").attr("bscount",-C.rating_bad+C.rating_good),d.find(".product .number").attr("bscount",C.item_count),bscount([d.find(".score .number"),d.find(".product .number")]),0!=i.satisfiedrate?($("#like").show(),$("#like #number").text(i.satisfiedrate+"%")):$("#like").hide()}if(wholesaleTiers=_.map(item_detail.wholesale_tier_list,function(e){return{min:e.min_count,max:e.max_count,price:e.price}}),canUseWholesale=item_detail.can_use_wholesale,s=item_detail,d=i.item_detail.currency,s.wholesale_tier_list&&0!=s.wholesale_tier_list.length&&s.can_use_wholesale&&($(".whole-sale-section").remove(),s={data:s.wholesale_tier_list,currency:d},d=$("#whole_sale_djangofy").text(),d=new BJDjangofy(d),d=$(d.render(s)),dollarfy_element(d),(s=$(".user-interaction-section")).addClass("user-interaction-section--separated"),d.insertBefore(s)),populateFlashSale(item_detail),item_detail.is_pre_order&&item_detail.estimated_days?($(".pre-order__label").text(i18n.t("label_pre_order_ships_in_n_days").replace("__n__",item_detail.estimated_days)),$(".pre-order").removeClass("hidden"),$(".border-line--shipping-fee-select").show()):$(".pre-order").addClass("hidden"),$("#fars #number").text("200m"),item_detail.description&&($("#detail-part .description").empty().html(nl2br(item_detail.description),!0),$("#detail-part .description").html(BJUtil.findHash($("#detail-part .description").html(),item_detail.hashtag_list)),BJUtil.listenHash($("#detail-part .description .hashtag"),!1,!1,_track_open_hashtag_list_from_product_page),$("meta[name=description]").attr("content",item_detail.description),item_detail.hashtag_list)&&(w=[],item_detail.hashtag_list.forEach(function(e){w.push(e.substr(1))}),$("meta[name=keywords]").attr("content",w.join(", "))),i.shop&&(userid=i.shop.userid,shopUserId=i.shop.userid,shopid=i.shop.shopid,username=i.shop.account.username,address=i.shop.place),offer_count=item_detail.offer_count,item_stock=item_detail.stock,item_currency=item_detail.currency,itemid=item_detail.itemid,pendingUpdate={itemId:itemid},itemDesc=item_detail.description,itemCurrency=item_detail.currency,itemPrice=item_detail.price,itemStatus=item_detail.status,itemCatname=item_detail.catname,itemCatid=item_detail.catid,is_blocked_by_owner=item_detail.is_blocked_by_owner,itemImage=0<item_detail.image_list.length?item_detail.image_list[0]:"",item_detail.models){for(var T in itemModels=[],item_detail.models)itemModels.push({modelID:item_detail.models[T].modelid,modelName:item_detail.models[T].name,modelPrice:item_detail.models[T].price,modelStock:item_detail.models[T].stock,modelPriceBeforeDiscount:item_detail.models[T].price_before_discount});0==itemModels.length||isOwner||$(".multi-model-selection").removeClass("hidden")}register_events(),populate_before_item_details_loaded(i),i.shop&&(runAfterDomReady(function(){var e=location.origin+"/backend/CMS/sharingv2.json";getJSON(e,function(e){var t={};t.productName=itemName,t.price=dollarsign_getter(item_detail.currency)+bee_dollarfy(item_detail.price,item_detail.currency),t.link="http://"+location.host.replace("mall.","")+"/"+i.shop.account.username+"/"+item_detail.itemid,item_detail.raw_discount&&(t.raw_discount=item_detail.raw_discount,t.discount=item_detail.discount),ITEM_SHARING_TEXT_LIST=getItemSharingTextList(e[LCOALE_TO_LANG_MAPPING[LOCALE]],t)}).fail(function(e){console.log("fetch_sharing_error",e)}),fetch_shipping_fee(i.item_detail),fetch_recomm(i.item_detail),window.CONFIG_SHOW_FROM_SAME_SHOP_SHOW_SECTION&&fetch_from_same_shop(i.item_detail)},isAndroid()&&isShopeeApp()?500:0),populate_after_item_details_loaded(i)),isSnapShot&&$("#likes,#share-button,#comment-button").off("tap"),BJUtil.configurePageTitle(itemTitle),setTimeout(function(){window.fbq&&fbq("track","ViewContent",{value:item_detail.price/PRICE_INFLATION_FACTOR,currency:item_detail.currency,content_type:"product",content_ids:item_detail.itemid.toString()})},1e3),bridgeCallHandler("trackEvent",{name:"ProductView",valueDict:{country:window.LOCALE,af_content_type:"product",af_content_id:item_detail.itemid.toString(),af_currency:item_detail.currency,af_price:item_detail.price/PRICE_INFLATION_FACTOR}});var S={itemid:item_detail.itemid,shopid:item_detail.shopid,discount:item_detail.raw_discount,show_free_shipping:!!item_detail.show_free_shipping,is_shopee_verified:!!item_detail.is_shopee_verified,refer_urls:[sourceUrl]};ADS_TRACKING.initAdsTracking().then(function(){pageViewReported||ADS_TRACKING.collectAdsTracking(AdsTrackingOperationType.VIEW,{items:[S]}),pageViewReported=!0}),window.T_CRITEO_ID&&window.criteo_q.push({event:"viewItem",item:item_detail.itemid})}}function E(e,t,i,a){var n=$("#price_template").text(),n=new BJDjangofy(n),n=$(n.render({currency:e,price:t,price_min:i,price_max:a,can_use_wholesale:item_detail.can_use_wholesale}));return dollarfy_element(n),n}function k(e){$("#second-layer .models .model").removeClass("selected"),e.addClass("selected"),$("#stock_value").text(e.data("stock"));var t=E(e.data("currency"),e.data("price"),-1,-1);$("#price_value").html(t),$("#quantity_value").val($("#quantity_value").val()>e.data("stock")?e.data("stock"):$("#quantity_value").val()),model_selected=e,updateQuantity(0),onQuantityChange(),$("#ok-button").removeClass("disable"),$(".multi-model-selection .text .main").text(i18n.t("label_selected")+":"),$(".multi-model-selection .text .dec").text(e.text()),$(".multi-model-selection .text .dec").addClass("active").addClass("r14").removeClass("L14")}function P(e){return $($(".dollarfy_sign")[0]).text()+bee_dollarfy(parseInt(e),$(".dollarfy_val").attr("currency"))}}function fetch_recomm(t){var i,e,a;t&&t.itemid&&t.shopid&&(removeFeatureConfig[LOCALE].youMayAlsoLike||(i=t.catid,e="/shop/"+t.shopid+"/item/"+t.itemid+"/recommendation/api/",a={limit:12},i&&(a.catid=encodeURIComponent(i)),e=generateGetUri(e,a),getJSON(e,function(e){e.items&&(-1!==window.navigator.userAgent.toLowerCase().indexOf("asus")&&$(".recommend-products").css("direction","ltr"),populateRecommendProducts(e.items,t.shopid,t.itemid,i))})))}function fetch_from_same_shop(t){var i,e,a;t&&t.itemid&&t.shopid&&(e={limit:12},(i=t.catid)&&(e.catid=encodeURIComponent(i)),a="/shop/"+t.shopid+"/item/"+t.itemid+"/from_same_shop/api/",a=generateGetUri(a,e),getJSON(a,function(e){e.items&&populateFromSameShop(e.items,t.shopid,t.itemid,i)}))}function fetch_shipping_fee(e){e&&e.itemid&&e.shopid&&(0<=Config.HideShippingFeesInItemPage.indexOf(window.LOCALE)||(e="/shop/"+e.shopid+"/item/"+e.itemid+"/shipping_fee/",getJSON(e,function(e){e.logistics&&(setUpAddressPicker(),populate_shipping_fees(e),$(".attribute-name, .attribute-value__content").css("opacity","0.9999"))})))}function populateFlashSale(e){var t,i,a=e.flash_sale,n=$(".flash-sale-header");a&&!$.isEmptyObject(a)?($(".item-title .price .price-inner").addClass("hidden"),n.removeClass("hidden"),n.find(".dollarfy_sign").attr("val",e.currency),a=n.find(".flash-sale-item__price-before-discount"),t=n.find(".flash-sale-item__price"),i=n.find(".price-wrapper"),a.find(".dollarfy_ext_int").text(e.flash_sale.price_before_discount).attr("currency",e.currency),t.find(".dollarfy_ext_int").text(e.flash_sale.price).attr("currency",e.currency),a.find(),dollarfy_element(i),t.width()>i.width()&&(a.addClass("hidden"),t.addClass("truncate")),(i=n.find(".timer")).attr("data-end-time",e.flash_sale.end_time),flashSaleUtil.refreshCountDownTimer(i,!0,function(){window.i18njs&&(i18n.t("msg_flash_deal_has_ended"),i18n.t("msg_flash_sale_has_ended"),i18n.t("msg_shocking_sale_has_ended"));var e="msg_"+window.CONFIG_FLASH_SALE_NAME_KEY+"_has_ended",e=i18n.t(e);bridgeCallHandler("showPopUp",{popUp:{message:e,okText:i18n.t("label_ok")}},function(e){location.reload(!0)})},"ic_buy_digit"),n.find(".flash-sale-stock").html(i18n.t("label_flashsale_n_sold_item_detail").replace("__n__",e.flash_sale.flash_sale_stock-e.flash_sale.stock)),flashSaleUtil.preloadDigitImages(_.template(window.STATIC_URL+"images/ic_buy_<%= currentDigit %><%= nextDigit %>_1.png"))):($(".item-title .price .price-inner").removeClass("hidden"),n.addClass("hidden"),flashSaleUtil.destroy())}function populateRecommendProducts(e,t,i,a){if(e&&4<e.length){var n=scrollTopFunc()+$(window).height()==$(document).height(),o=null,r=[],l=11<e.length;if(window.show_from_same_shop){var s=$(".recommend-products");s.removeClass("hidden"),(o=s.find(".recommend-products__items")).empty(),l&&(s.find(".see-all-wrapper").removeClass("hidden"),(e=e.slice(0,10)).push({covered_see_all:!0,show_see_all_text_as_see_more:!0,price:0,currency:get_default_currency()}));for(var d,_=0;_<e.length;_++)(p=e[_]).itemIndex=_,p.itemid!=i&&(d=BJUtil.renderItemDisplayCard(p,_==e.length-1&&l),r.push(d),dollarfy_element(d,!0))}else{$(".recommend-products-wrapper").removeClass("hidden"),$(".recommend-products__container__header").removeClass("hidden"),(o=$(".recommend-products")).empty(),l&&((c=e[(s=e.length)-1]).itemIndex=s-1,e=e.slice(0,s-1));for(var c,p,m,s=$("#recommend_product_template").text(),u=$("#badge-promotion").text(),h=$("#badge-new").text(),g=new BJDjangofy(s,{template_subs:{"shop/badges/badge_new.html":h,"shop/badges/badge_promotion.html":revertTWDiscountForEnglishIfNeededTemplate(u)}}),_=0;_<e.length;_++)(p=e[_]).itemIndex=_,p.itemid!=i&&(m=$(g.render({item:p,ITEM_IMAGE_BASE_URL:ITEM_IMAGE_BASE_URL,LOCALE:LOCALE})),dollarfy_element(m),r.push(m));c&&(s=$("#recommend_product_see_all_template").text(),h=$(new BJDjangofy(s).render({item:c,ITEM_IMAGE_BASE_URL:ITEM_IMAGE_BASE_URL})),r.push(h),e.push(c))}o.append.apply(o,r),l&&($(".recommend-products__items .see-all-text-wrapper .r14").text(i18n.t("label_see_more_camel")),$(".recommend-products-wrapper .see-all-text.middle-centered-div").off("tap").on("tap",function(){navigateToSeeAll(t,i,a)}),$(".recommend-products__container__header").off("tap").on("tap",function(){navigateToSeeAll(t,i,a)}),$(".recommend-product-see-all, .recommend-products__header, .recommend-products__items .see-all").off("tap").on("tap",function(){navigateToSeeAll(t,i,a)})),__ios_didAddOverflow__(),n&&setTimeout(function(){window.scrollTo(0,document.body.scrollHeight)},0),window.show_from_same_shop?setUpItemDisplayCardTracking(bi_tracking_serializer.TrackingSectionType.SECTION_TYPE_YOU_MAY_ALSO_LIKE,".recommend-products__items",".item-card-display",e,".recommend-products__header"):((new RecommendProductView).init(),setUpItemDisplayCardTracking(bi_tracking_serializer.TrackingSectionType.SECTION_TYPE_YOU_MAY_ALSO_LIKE,".recommend-products",".recommend-product",e,".see-all-text"))}}function populateFromSameShop(e,t,i,a){if(e&&4<e.length){for(var n=scrollTopFunc()+$(window).height()==$(document).height(),o=11<e.length,r=$(".from-same-shop"),r=(r.removeClass("hidden"),o&&((e=e.slice(0,10)).push({covered_see_all:!0,show_see_all_text_as_see_more:!0,price:0,currency:get_default_currency()}),r.find(".see-all-wrapper").removeClass("hidden")),r.find(".from-same-shop__items")),l=(r.empty(),[]),s=0;s<e.length;s++){var d=e[s];d.itemIndex=s,d.itemid!=i&&(d=BJUtil.renderItemDisplayCard(d,s==e.length-1&&o),l.push(d))}r.append.apply(r,l),dollarfy_element(r,!0),isPC()||r.addClass("hide-scrollbar"),__ios_didAddOverflow__(),n&&setTimeout(function(){window.scrollTo(0,document.body.scrollHeight)},0),setUpItemDisplayCardTracking(bi_tracking_serializer.TrackingSectionType.SECTION_TYPE_FROM_SAME_SHOP,".from-same-shop__items ",".item-card-display",e,".from-same-shop__header"),o&&($(".from-same-shop__items .see-all-text-wrapper .r14").text(i18n.t("label_see_more_camel")),$(".from-same-shop__header, .from-same-shop__items .see-all").on("tap",function(e){e.preventDefault(),e.stopPropagation(),navigateToFromSameShop(t,i,a)}))}}function navigateToSeeAll(e,t,i){e=location.origin+"/shop/"+e+"/item/"+t+"/recommendation/";i&&(e+="?catid="+encodeURIComponent(i)),bridgeCallHandler("navigate",{url:e,navbar:{title:i18n.t("label_you_may_also_like")},presentModal:0})}function navigateToFromSameShop(e,t,i){e=location.origin+"/shop/"+e+"/item/"+t+"/from_same_shop/";i&&(e+="?catid="+encodeURIComponent(i)),bridgeCallHandler("navigate",{url:e,navbar:{title:i18n.t("label_from_same_shop")},presentModal:0})}function calculateDiscount(e,t){var i,e=parseInt(e),t=parseInt(t);return e!=t&&(t=100*(e-t)/e,i=Math.abs(t-Math.round(t))<.001?parseInt(Math.round(t)):parseInt(Math.floor(t))),"TW"==LOCALE&&(i=100-i)%10==0&&100!=i&&(i/=10),i}var ITEM_MTIME="",jsonURL=($(function(){init(location.hash)}),null);function init(e){var t=parse_hash(e),e=$("#top-image");if(e.css("width","100%"),e.css("height","100%"),t&&t.snapshot&&(isSnapShot=!0),!t||!t.shopid)if(location.search){for(var i,a=location.search.split("?")[1].split("&"),n={},o=0;o<a.length;o++){var r=a[o].split("=");n[r[0]]=r[1]}"sid"in n&&"iid"in n?((t={}).shopid=n.sid,t.itemid=n.iid):(i=SeoUtil.getItem())&&((t={}).shopid=i.shopid,t.itemid=i.itemid)}else(i=SeoUtil.getItem())&&((t=null==t?{}:t).shopid=i.shopid,t.itemid=i.itemid);t&&t.itemid&&t.shopid&&(e="",isSnapShot?(e="/shop/"+t.shopid+"/snapshot_data/"+t.itemid+"/",t.isdeleted&&(isDeleted=!0)):e="/item_data/?shopid="+t.shopid+"&itemid="+t.itemid,$.query.get("show_recommend")&&(e+="?show_recommend=1"),itemDataUrl=e,t.image_index&&(image_index=parseInt(t.image_index)),sourceUrl=t.source_url||document.referrer,setTimeout(function(){t.itemid&&t.shopid&&window._track_item_page_load&&_track_item_page_load(t.itemid,t.shopid)},1050),t.data&&populate_item_page({item_detail:JSON.parse(t.data)}),jsonURL=e,bridge=window.WebViewJavascriptBridge,app_fetch_json(bridge,e,function(e){hasLoadedItemDetails=!0,populate_item_page(e)},function(e,t,i){e&&403==e.status&&BJUtil.showMsgAndGoBack(i18n.t("msg_the_product_you_are_looking_for_does_not_exist"))}),initShippingFeeHelp())}function onBuyButtonTapped(t){var e;is_blocked_by_owner?BJUtil.showSellerBlockedUserPopup():null!=itemModels&&(isShopeeApp()?isIOS()||isVer22Plus()?presentQuantityPanel(t):bridgeCallHandler("login",{},function(e){1==e.status&&presentQuantityPanel(t)}):(e={shopID:shopid,itemID:itemid,stock:stock,userID:shopUserId,price:itemPrice,itemImage:itemImage,variations:itemModels,status:itemStatus,keepUserChoice:0,action:"showQuantityPanel"},t&&(web_AddToCartOnly=!0),_track_buy_action(),BJUtil.globalVersionFallback(function(){openDeepLinking(constructDeepLinkUrlWithAction(null,JSON.stringify(e)),function(){presentQuantityPanel(t)})},function(){openDeepLinking(constructDeepLinkUrlWithAction(null,JSON.stringify(e)),showPromMsgBuy())})))}function presentQuantityPanel(e){isDeepInactive?showDeepInactivePopup():isInactive?showInactivePopup(function(){showQuantityPanel(e)}):showQuantityPanel(e)}function showQuantityPanel(e){(isShopeeApp()&&(isVer21Plus()||0==itemModels.length)?showAppQuantityPanel:showWebQuantityPanel)(e)}function onChatToOfferTapped(e){e.stopPropagation(),e.preventDefault(),setTimeout(function(){window.BI_ANALYTICS&&BI_ANALYTICS.clickItemPageButton(window.USERID,shopid,itemid,"chat")},0);e={shopID:shopid,userID:userid,itemID:itemid};isWeb?isWebChatEnabled()?bridgeCallHandler("startChat",e,function(){}):(e.action="showChat",_track_chat(),openDeepLinking(constructDeepLinkUrlWithAction(null,JSON.stringify(e)),showPromMsgBuy)):window.WebViewJavascriptBridge.callHandler("startChat",e,function(e){})}function register_events(){var e=$(".page-holder").width(),e=(800==e&&($("#float-bottom,#message,#second-layer").css("width",e),$(".lure-hold").css({width:e,bottom:"auto","margin-left":-e/2,left:"50%"}),$("#second-layer").css("width",e),$("#message").css("width",e)),!1),t=!1,i=$("#float-bottom");if(isSnapShot?(i.find(".inner").hide(),$(".btn-bottom-holder").hide(),$(".scrollable .quantity").hide(),i.find(".snapshot_view").show(),panelViewOnly=!0,isDeleted&&($(".snapshot_view .text").text(i18n.t("text_this_product_has_been_deleted")),$(".snapshot_view .view-butt").hide()),e=!0):isBanned?(i.find(".inner").hide(),$(".btn-bottom-holder").hide(),$(".scrollable .quantity").hide(),isReviewing&&i.find(".banned_view .text").text(i18n.t("msg_your_product_under_review")),i.find(".banned_view").show(),e=!0):isOwner&&null!=offer_count&&($(".btn-bottom-holder").hide(),$(".scrollable .quantity").hide(),"IR"==LOCALE||isNewChatSupported()?($("#float-bottom").hide(),t=!0):($("#chat-to-offer").hide(),$("#offer-count").show(),$("#buy-button").hide(),$("#viewoffer").show(),panelViewOnly=!0,0==offer_count?($("#float-bottom").hide(),$(".btn-bottom-holder").hide(),$(".scrollable .quantity").hide(),t=!0):1==offer_count?$("#offer-count").html(i18n.t("label_you_have_n_offer").replace("__number__",1)):$("#offer-count").html(i18n.t("label_you_have_n_offers").replace("__number__",offer_count))),e=!0),e||!isNewBuyerPanelSupported())t||(i.removeClass("hidden"),i.delay(200).animate({bottom:0},200));else{$("#new-chat-to-offer").off("tap").on("tap",onChatToOfferTapped);for(var e=$("#buy-button-new"),t=$("#new-add-to-cart"),i=(e.off("tap").on("tap",function(e){e.stopPropagation(),e.stopImmediatePropagation(),e.preventDefault(),setTimeout(function(){window.BI_ANALYTICS&&BI_ANALYTICS.clickItemPageButton(window.USERID,shopid,itemid,"buy")},0),BJUtil.checkLogin(function(e){onBuyButtonTapped(!1)})}),t.off("tap").on("tap",function(e){e.stopPropagation(),e.stopImmediatePropagation(),e.preventDefault(),setTimeout(function(){window.BI_ANALYTICS&&BI_ANALYTICS.clickItemPageButton(window.USERID,shopid,itemid,"cart")},0),BJUtil.checkLogin(function(e){onBuyButtonTapped(!0)})}),$("#float-bottom-for-buyer")),a=(i.removeClass("hidden"),.8*i.find(".inner")[0].clientWidth),n=i.find(".text"),o=!1,r=0;r<n.length;r++)n[r].clientWidth>a&&(o=!0);if(o){for(r=0;r<n.length;r++)n[r].style.display="none";$("#float-bottom-for-buyer .inner").removeClass("align-bottom").addClass("align-center")}i.delay(200).animate({bottom:0},200)}$("#cover").off("tap").on("tap",function(e){hideWebQuantityPanel(),e.stopPropagation(),e.preventDefault()}),$("#second-layer .top-part-panel .close-btn").off("tap").on("tap",hideWebQuantityPanel),$("#ok-button").off("tap").on("tap",function(e){$(this).hasClass("disable")||(add_to_cart(web_AddToCartOnly),web_AddToCartOnly=!1)}),setShopeeGuaranteeTapHandler(),$("#likes").off("tap").on("tap",function(t){var e;t.stopPropagation(),t.preventDefault(),window.WebViewJavascriptBridge?window.WebViewJavascriptBridge.callHandler("login",{},function(e){1==e.status&&fav_handler(t)}):loggedin?fav_handler(t):(e={shopID:shopid,itemID:itemid,action:"likeItem"},openDeepLinking(constructDeepLinkUrlWithAction(null,JSON.stringify(e)),function(){askLogin()}))}),$("#buy-button").off("tap").on("tap",function(e){e.stopPropagation(),e.stopImmediatePropagation(),e.preventDefault(),onBuyButtonTapped(!1)}),$("#chat-to-offer").off("tap").on("tap",onChatToOfferTapped),$("#viewoffer").off("tap").on("tap",function(e){window.WebViewJavascriptBridge&&window.WebViewJavascriptBridge.callHandler("viewOffer",{shopID:shopid,userID:userid,itemID:itemid},function(e){})}),$("#msg-btn").off("tap").on("tap",function(e){chat()}),$(".quantity .minus").off("tap").on("tap",function(e){e.preventDefault(),updateQuantity(-1)}),$(".quantity .plus").off("tap").on("tap",function(e){e.preventDefault(),updateQuantity(1)}),$("#cover").off("touchmove").on("touchmove",function(e){e.stopPropagation(),e.preventDefault()}),$("#second-layer").off("touchmove").on("touchmove",function(e){e.stopPropagation()}),$("#quantity_value").on("keypress",function(e){var t=parseInt($("#stock_value").html(),10);if(!(48<=e.charCode&&e.charCode<=57&&10*$(this).val()+(e.charCode-48)<=t))return!1}).on("change input",function(){(quantity=$(this).val())||($(this).val(0),quantity=1),quantity=parseInt(quantity),onQuantityChange()}).on("focusout",function(e){$(this).val()?$(this).val(quantity):(quantity=1,quantity=$(this).val(1),onQuantityChange())})}function updateWholeSalePrice(e,t){var i;e.can_use_wholesale&&((i=_.filter(e.wholesale_tier_list,function(e){return!(e.min_count&&t<e.min_count||e.max_count&&t>e.max_count)})).length?($("#second-layer #price_value .dollarfy_val:last").text(bee_dollarfy(i[0].price,e.currency)),$("#second-layer .price__wholesale-label").removeClass("hidden")):($("#second-layer #price_value .dollarfy_val:last").text(bee_dollarfy(e.price,e.currency)),$("#second-layer .price__wholesale-label").addClass("hidden")))}function populate_before_item_details_loaded(e){if($("#comment-button").off("tap").on("tap",function(e){e.stopPropagation(),e.preventDefault(),bridgeCallHandler("showItemComments",{shopID:shopid,itemID:itemid},function(e){})}),$(".item_rating__rating-info, .view-all-comments  .text, .view-all-comments .leave-a-comment, .reviews__header__see-all, .reviews__header__content").off("tap").on("tap",function(e){0!=item_detail.rating_count[0]&&(e.stopPropagation(),e.preventDefault(),BJUtil.navigate("/shop/{0}/item/{1}/rating/".f(shopid,itemid)))}),bridgeInit(function(i){i&&(i.registerHandler("onEventCallback",function(e,t){"report"==e.key?i.callHandler("login",{},function(e){1==e.status&&(e="http://"+location.host+"/shop/"+shopid+"/item/"+itemid+"/report/",bridgeCallHandler("navigate",{url:e,navbar:{title:i18n.t("label_report_this_product")}},function(){}))}):"markAsSold"==e.key||"unmarkAsOpenToSell"==e.key?markAsSoldOrAvailable(e.key,shopid,itemid,function(e){location.reload()}):"share"==e.key?$("#share-button").tap():i.callHandler("showEditProduct",{shopID:shopid,itemID:itemid},function(e){})}),i.callHandler("configureNavBarTitle",{title:itemTitle}),configurePageImpl(i,e.item_detail),bridge_capture_link("/item/",$(".view-href"),function(e,t){keys=parse_hash_general(e);var t=t.parents("li").find(".item-detail .name").text(),i=keys.shopid;return{url:e,config:{},preloadKey:"item",navbar:{title:t,rightItemsConfig:{items:[{type:"more",items:[{type:"home"},{type:"reportitem",itemID:keys.itemid,shopID:i}]}]}}}}))}),window.CONFIG_OFFICIAL_SHOP_RED_THEME){var t=new PopupScrollView;if(t.hideScrollView(),e.item_detail.show_official_shop_label){for(var i=$(".official-shop-selling-points"),a=($(".page-holder").addClass("page-holder--official-shop-item"),t.init(i),i.width()+26),n=i.children().length,o=!0,r=0;r<2*n;r++)a<$(".selling-point").map(function(e,t){return $(t).outerWidth(!0)}).toArray().reduce(function(e,t){return e+t},0)-3&&(o||$(".selling-point:last-child").remove(),i.toggleClass("official-shop-selling-points--compact",o),o=!o);0==i.length&&$(".shopee-guarantee").removeClass("hidden")}else $(".page-holder").removeClass("page-holder--official-shop-item"),$(".official-shop-selling-points").addClass("hidden"),$(".shopee-guarantee").removeClass("hidden")}else $(".shopee-guarantee").removeClass("hidden")}var lat=null,lng=null;function populate_after_item_details_loaded(n){ITEM_MTIME=n.item_detail.mtime,isShopeeApp()||shareInit(n),bridgeInit(function(a){a&&(a.registerHandler("viewWillReappear",function(e){var t,i;e&&e.dataNative&&(e.dataNative.curMedia||e.dataNative.video)?(t=e.dataNative.curMedia||e.dataNative.video,i=t.index,isFullScreenOnlyVideo()||(videoHasNativeContinuity?$("#videoclip").trigger(t.isPlaying?"play":"pause"):setTimeout(function(){((i==videoIdx||null==i)&&(t.curTime&&videoSetProgress(t.curTime),t.isPlaying)?videoPlay:videoPause)()},300)),null!=t.index&&swiper.slideTo(i)):(USERID&&USERID==parseInt(userid)&&getJSON(itemDataUrl,populate_item_page),reloadComments())}),$("#share-button").off("tap").on("tap",function(){var e={shareType:0,shopID:shopid,avatar:avatar,itemID:itemid,itemName:itemName,itemDesc:itemDesc,itemCurrency:itemCurrency,itemPrice:itemPrice,itemImage:itemImage,username:username},t=(e.itemOriginalImage=e.itemImage,n.item_detail.discount&&(n.item_detail.raw_discount,e.watermarkDiscountText="<style color='#EE4D2D'>"+n.item_detail.discount+"</style><style color='#ffffff'>"+i18n.t("label_promotion_off")+"</style>"),location.origin.replace("mall.","")+"/"+username),i=t+"/"+itemid+"/";e.watermarkProductDesc=t,e.url=i,e.mtime=ITEM_MTIME||"",ITEM_SHARING_TEXT_LIST&&(e.sharingText=ITEM_SHARING_TEXT_LIST),a.callHandler("share",e,function(e){})}),bridge_capture_link("/shop/",$("#shop-part a"),function(e,t){parse_hash(e);var t=(t=$(t)).attr("userid"),i=[{type:"home"},{type:"reportuser",userID:t}];return{url:e,preloadKey:"shop",navbar:{isTransparent:1,rightItemsConfig:{items:[{type:"more",items:i=USERID&&USERID==parseInt(t)?[{type:"home"}]:i}]}}}}),bridge_capture_link("",$(".category-row a"),function(e,t){t=t.find(".text").text();return-1!=e.indexOf("categories")?{url:e,navbar:{title:t,searchParam:itemCatid,searchType:1,searchPlaceholder:t,rightItemsConfig:{items:[{type:"search"}]}}}:{url:e,tabs:getCategoryNativeTabs(e),tabRightButton:{type:"button",key:"filter",iconType:"filter"},navbar:{title:t,searchType:1,currentSearchType:0,rightItemsConfig:{items:[{type:"search"},{type:"button",key:"filter",iconType:"filter"}]}}}}))})}function configurePageImpl(e,t){var i,a,n,o,r,l,s,d=[];isOwner?(i=[],l=BJUtil.getIconUrl("ic_product_more_share"),s=BJUtil.getIconUrl("ic_product_more_share_dark"),a=BJUtil.getIconUrl("ic_bankaccount_edit"),n=BJUtil.getIconUrl("ic_bankaccount_edit_dark"),BJUtil.globalVersionFallback(function(){},function(){isSoldOut(t)?i.push({type:"button",key:"unmarkAsOpenToSell",text:i18n.t("label_unmark_as_open_to_sell"),iconUrl:a,iconUrlOnDark:n}):i.push({type:"button",key:"markAsSold",text:i18n.t("label_mark_as_sold"),iconUrl:a,iconUrlOnDark:n})}),i.push({type:"button",key:"share",text:i18n.t("label_share"),iconUrl:l,iconUrlOnDark:s},{type:"home"},{type:"button",key:"edit",text:i18n.t("label_edit_product"),iconUrl:a,iconUrlOnDark:n}),SIMPLE_VERSION||d.push({type:"cart"}),e.callHandler("configurePage",{navbar:{title:itemTitle,rightItemsConfig:{items:d=[{type:"more",items:i}]}}},function(){})):(SIMPLE_VERSION||d.push({type:"cart"}),o=BJUtil.getIconUrl("ic_reportthisuser"),r=BJUtil.getIconUrl("ic_reportthisuser_dark"),l=BJUtil.getIconUrl("ic_product_more_share"),s=BJUtil.getIconUrl("ic_product_more_share_dark"),d.push({type:"more",items:[{type:"button",key:"share",text:i18n.t("label_share"),iconUrl:l,iconUrlOnDark:s},{type:"home"},{type:"button",key:"report",text:i18n.t("label_report_this_product"),iconUrl:o,iconUrlOnDark:r}]}),e.callHandler("configurePage",{navbar:{title:itemTitle,rightItemsConfig:{items:d}}},function(){}))}var keepUserChoice=0;function showAppQuantityPanel(e){var t=$("#new-add-to-cart"),i=t.offset(),a=i.left/$(document).width(),i=(i.left+t.width())/$(document).width(),t=[],n={refererItems:t};t.push({shopID:shopid,itemID:itemid}),stock?bridgeCallHandler("presentAddCart",{shopID:shopid,itemID:itemid,stock:stock,userID:shopUserId,price:itemPrice,itemImage:itemImage,variations:itemModels,status:itemStatus,keepUserChoice:0,viewOnly:panelViewOnly,addOnly:e,addCartStartPercent:a,addCartEndPercent:i,source:JSON.stringify({refer_urls:BJUtil.getTrackingReferUrls(itemid)}),wholesaleTiers:wholesaleTiers,canUseWholesale:canUseWholesale,passBackString:encodeURIComponent(JSON.stringify(n))},function(e){}):bridgeCallHandler("showToast",{toast:{iconType:"failure",message:i18n.t("msg_product_out_of_stock")}})}function callImages(e,t,i){window.WebViewJavascriptBridge&&window.WebViewJavascriptBridge.callHandler("fullScreenImage",{imageUrls:e,medias:t,currentIndex:i,imageX:0,imageY:0,imageWidth:100,imageHeight:100},function(e){})}function updateQuantity(e){quantity=parseInt($("#quantity_value").val(),10)+e,0==e&&model_selected&&(t=model_selected.attr("data-quantity"),quantity=t?parseInt(t,10):0<(i=parseInt($("#stock_value").html(),10))?1:0);var t,i=parseInt($("#stock_value").html(),10);1<=quantity&&quantity<=i?$("#quantity_value").val(quantity):(quantity<1?alert_message(i18n.t("msg_the_quantity_bigger")):i<quantity&&alert_message(i18n.t("msg_the_quantity_smaller")),quantity-=e),onQuantityChange()}function onQuantityChange(){var e=parseInt($("#stock_value").html(),10);$(".minus,.plus").removeClass("disabled"),1==quantity&&$(".minus").addClass("disabled"),quantity==e&&$(".plus").addClass("disabled"),model_selected&&model_selected.attr("data-quantity",quantity),updateWholeSalePrice(item_detail,quantity)}function setPendingLikes(e){var t;pendingUpdate&&(t=window.WebViewJavascriptBridge)&&(pendingUpdate.updateLikes=!0,pendingUpdate.isLiked=e,t.callHandler("save",{key:"pending-update",data:JSON.stringify(pendingUpdate),persist:0},function(){}))}function fav_handler(e){BJUtil.popUserPrivacy();e=$(e.currentTarget).find("#like-icon");e.hasClass("ic_heart_filled")?(e.addClass("ic_productdetails_like"),e.removeClass("ic_heart_filled"),alert_message(i18n.t("msg_deleted_from_your_favorite"),1e3),$("#likes .number").html(0<=parseInt($("#likes .number").html())-1?parseInt($("#likes .number").html())-1:0),$.ajax({url:"/buyer/unlike/shop/"+shopid+"/item/"+itemid+"/",method:"POST",data:{csrfmiddlewaretoken:csrf},timeout:5e3,success:function(e){setPendingLikes(!1)},error:function(e){alert_message(i18n.t("msg_server_error"))}})):(e.removeClass("ic_productdetails_like"),e.addClass("ic_heart_filled"),alert_message(i18n.t("msg_added_to_your_favorite"),1e3),$("#likes .number").html(parseInt($("#likes .number").html())+1),$.ajax({url:"/buyer/like/shop/"+shopid+"/item/"+itemid+"/",method:"POST",data:{csrfmiddlewaretoken:csrf},timeout:5e3,success:function(e){setPendingLikes(!0)},error:function(e){alert_message(i18n.t("msg_server_error"))}}))}var DEEP_LINK_URL=null;function constructDeepLinkUrl(e){var t;return"undefined"!=typeof constructCategoryPageUrlJson&&e.categoryId&&e.categoryName&&e.shopId&&e.itemId&&e.itemName&&(t=constructCategoryPageUrlJson(e),e=constructItemPageUrlJson(e),t)&&e?"home?navRoute="+encodeDeepLinkUrl({paths:[t,e]}):null}var constructDeepLinkUrlWithAction=function(){var n=null;return function(e,t){if(null==n){if(null==e)return null;n=e}var i,a;return"undefined"!=typeof constructCategoryPageUrlJson&&n.categoryId&&n.categoryName&&n.shopId&&n.itemId&&n.itemName&&(e=null,a=$.extend({},n),n.subcategoryId&&n.subcategoryName&&(e=constructCategoriesPageUrlJson(n),a.categoryId=n.subcategoryId,a.categoryName=n.subcategoryName),a=constructCategoryPageUrlJson(a),i=constructItemPageUrlJson(n),a)&&i?(a={paths:[a,i]},e&&a.paths.unshift(e),t&&(a.lastPageTrigger=t),"home?navRoute="+encodeDeepLinkUrl(a)):null}}();function openDeepLinking(e,t){DEEP_LINK_URL||e?openApp(e||DEEP_LINK_URL,t):t()}function markAsSoldOrAvailable(e,t,i,a){var n="markAsSold"==e?0:1e3,e=_.clone(itemModels);_.each(e,function(e){e.modelStock=n}),bridgeCallHandler("editProduct",{shopID:t,itemID:i,variations:e,stock:n},a)}function showPromMsgBuy(){showProm(i18n.t("msg_buy_btn_pop"))}var hasSetShopeeGuaranteeTapHandler=!1;function setShopeeGuaranteeTapHandler(){var e,t;hasSetShopeeGuaranteeTapHandler||(hasSetShopeeGuaranteeTapHandler=!0,e=$("a.shopee-guarantee"),t=e.attr("_href"),window.WebViewJavascriptBridge?(e.attr("href",""),e.off("tap").on("tap",function(e){e.stopImmediatePropagation(),e.preventDefault();e=location.origin+t;bridgeCallHandler("navigate",{url:e})})):e.attr("href",t))}function isSoldOut(e){return 0==e.stock}var INACTIVE_DAYS=Config.InactiveDays[LOCALE]||7,DEEP_INACTIVE_DAYS=Config.DeepInactiveDays[LOCALE]||14;function isShopInactive(e){var t=+new Date;return 24*INACTIVE_DAYS*60*60*1e3<t-e}function isShopDeepInactive(e){var t=+new Date;return 24*DEEP_INACTIVE_DAYS*60*60*1e3<t-e}function showInactivePopup(t){var i=isShopeeWeb()||isIOS()||isNewChatSupported();bridgeCallHandler("showPopUp",{popUp:{message:i18n.t("msg_inactive_sellers_popup").replace("__date__",INACTIVE_DAYS),buttonType:1,okText:i18n.t("msg_inactive_sellers_popup_buy_anyway"),cancelText:i?i18n.t("label_chat_to_offer"):i18n.t("btn_go_back")}},function(e){0==e.buttonClicked?t&&t():1==e.buttonClicked&&i&&$("#chat-to-offer").trigger("tap")})}function showDeepInactivePopup(){bridgeCallHandler("showPopUp",{popUp:{message:i18n.t("msg_real_inactive_sellers_popup").replace("__deep_inactive__",DEEP_INACTIVE_DAYS),buttonType:1,okText:i18n.t("label_chat_to_offer"),cancelText:i18n.t("label_cancel")}},function(e){0==e.buttonClicked&&$("#chat-to-offer").trigger("tap")})}var TRACK_ITEM_RECOMMEND_EXISTED={};function setUpItemDisplayCardTracking(i,e,t,a,n){var o,r,l,s;function d(e){e=(e=e instanceof jQuery?e[0]:e).dataset.index;return a[e]}window.BI_ANALYTICS&&!TRACK_ITEM_RECOMMEND_EXISTED[i]&&(TRACK_ITEM_RECOMMEND_EXISTED[i]=!0,o=function(e){BI_ANALYTICS.trackingWithProto({operation:bi_tracking_serializer.TrackingOperationType.IMPRESSION,page_type:bi_tracking_serializer.TrackingPageType.PAGE_TYPE_PRODUCT_DETAIL,page_section:i,target_type:bi_tracking_serializer.TrackingTargetType.TARGET_TYPE_ITEM,item:e.items})},r=e,l=t,$(r).length&&((s=new TrackScrollController).init(function(e,t,i){o&&o({items:i})},"itemIndex"),s.addBatchItem(new ScrollBatchItem(document.querySelector(r),l,d))),$(e).find(t).on("tap",catchAllException(function(){var e=$(this),t=d(e),t={operation:bi_tracking_serializer.TrackingOperationType.CLICK,page_type:bi_tracking_serializer.TrackingPageType.PAGE_TYPE_PRODUCT_DETAIL,page_section:i,target_type:bi_tracking_serializer.TrackingTargetType.TARGET_TYPE_ITEM,item:[t]};e.hasClass("see-all")&&(t.target_type=bi_tracking_serializer.TrackingTargetType.TARGET_TYPE_SEE_MORE_BUTTON),BI_ANALYTICS.trackingWithProto(t)})),$(n).on("tap",catchAllException(function(){var e={operation:bi_tracking_serializer.TrackingOperationType.CLICK,page_type:bi_tracking_serializer.TrackingPageType.PAGE_TYPE_PRODUCT_DETAIL,page_section:i,target_type:bi_tracking_serializer.TrackingTargetType.TARGET_TYPE_SEE_MORE_LINK};BI_ANALYTICS.trackingWithProto(e)})))}plvInit("/item/");
//# sourceMappingURL=../../source_maps/shop/item.js.map
