var Domify_TEMPLATE_SETTING={interpolate:/\{\{(.+?)\}\}/g,escape:/\{\<(.+?)\>\}/g,evaluate:/\{\%([\s\S]+?)\%\}/g},IE_STYLE_NAME="_style",BLANK_IMAGE_URL=window.STATIC_URL+"images/blank.gif",EVENT_ITEM_CARD_TAPPED=(Domify=function(e){var o=Domify_TEMPLATE_SETTING,s=[],l=[],d=[],c=[],p=[],u=[],f=[],m=[],h=[],i="url("+BLANK_IMAGE_URL+")";function g(e,i,t,n){0<=e.indexOf(t)||(e.push(t),i.push(_.template(n,o)))}function y(e){return e&&null!=e.match(/\{[\{\%\<]/g)}return function e(i){if(i&&i.nodeType){var t=i.attributes;if(t)if(isIE()){for(var n=null,o=0;o<t.length;o++)(a=t[o])&&(y(a.value)?a.name==IE_STYLE_NAME?(g(d,p,a,a.value),c.push(i)):g(s,l,a,a.value):a.name==IE_STYLE_NAME&&(n=a.value));n&&i.setAttribute("style",n)}else for(var a,o=0;o<t.length;o++)(a=t[o])&&y(a.value)&&g(s,l,a,a.value);if("IMG"==i.nodeName&&y(decodeURIComponent(i.src))&&m.indexOf(i)<0&&m.push(i),"DIV"==i.nodeName&&i.className&&0<=i.className.indexOf("domify-bg-img")&&i.style&&h.indexOf(i)<0&&h.push(i),i.nodeType==Node.TEXT_NODE)y(i.textContent)&&g(u,f,i,i.textContent);else{var r=i.childNodes;if(r)for(o=0;o<r.length;o++)e(r[o])}}}(e=e),{render:function(e){for(var i=0;i<u.length;i++){var t=u[i],n=f[i](e);t.textContent!=n&&(t.textContent=n)}for(i=0;i<s.length;i++){var o=s[i],a=l[i](e);o.value!=a&&(o.value=a)}if(isIE())for(i=0;i<d.length;i++){t=c[i],a=p[i](e);t.getAttribute("style")!=a&&t.setAttribute("style",a)}},resetImages:function(){for(var e=0;e<h.length;e++)h[e].style.backgroundImage=i;for(e=0;e<m.length;e++)m[e].src=BLANK_IMAGE_URL}}},"BATCH-ITEM-CARD-TAPPED");function convertItemDataForTracking(e){var i={itemid:e.itemid,shopid:e.shopid};return e.info&&(i.info=e.info),e.recommendation_info&&(i.recommendation_info=e.recommendation_info),e.from&&(i.from=e.from),void 0!==e.algorithm&&(i.algorithm=e.algorithm),e.hasOwnProperty("batch_item_index")&&(i.item_index=e.batch_item_index),e.adsid?(i.is_ads=1,i.location_in_ads=BJUtil.calculateLocationInAds(e.batch_item_index)):(i.is_ads=0,i.location_in_ads=null),i}(BatchItem=function(){var l,J,t=!1,p=!0,i="simple",W=!1,e=M,u=location.pathname+(location.pathname.endsWith("/")?"":"/")+"api/"+location.search,G="GET",V={},F=!1,f=0,m=20,Y=!1,h=!1,g=null,j=!1,K="item-list",y=!1,n=$(window),q=$(document),d=$(".loading-text"),o=$(".nomore"),X=".empty_holder",a=null,v=null,z=0,c=!0,w=new GTapManager,Q=!1,b=[],T=!1,Z=!0,ee=null,I=0,k=0,ie=null,O=null,te=0,s=null,E=null,ne=null,x=0,A=[],S=[],oe=!0,ae=!1,re=null,se=!1,le=null,_e=!1,C=null,de=null,ce=null,pe=null,ue=null,fe=null,me=!1,he=null,ge="newest",ye=null,L=null;function ve(e){e&&("card_type"in e&&(i=e.card_type,W="simple"!=i),"isLoadMore"in e&&((p=e.isLoadMore)||d.hide()),"preloaded"in e&&(preloaded=e.preloaded),"apiUrl"in e&&(u=e.apiUrl),"apiMethod"in e&&(G=e.apiMethod),"apiPostData"in e&&(V=e.apiPostData),"skipBridgeCache"in e&&(F=e.skipBridgeCache),"root"in e&&(K=e.root,g&&fi()),"onLoadCallback"in e&&(l=e.onLoadCallback),"onFailCallback"in e&&(J=e.onFailCallback),"skipAnimation"in e&&e.skipAnimation,"keepAbnormalItems"in e&&(Q=e.keepAbnormalItems),"needDropWord"in e&&(y=e.needDropWord),"excludeItemIds"in e&&(b=e.excludeItemIds),"initialBatchLimit"in e&&(m=e.initialBatchLimit),"initialOffset"in e&&(f=e.initialOffset),"displayBatchOverride"in e&&e.displayBatchOverride,"isInBoostPage"in e&&(T=e.isInBoostPage),"skipCheckAdult"in e&&(j=e.skipCheckAdult),"retryOnNetworkError"in e&&(Z=e.retryOnNetworkError),"recycleNodes"in e&&(oe=e.recycleNodes),"ROOT_Y"in e&&(O=e.ROOT_Y),"ROOT_Y_OFFSET"in e&&(te=e.ROOT_Y_OFFSET),"ROOT_WIDTH"in e&&(s=e.ROOT_WIDTH),"ROOT_HEIGHT"in e&&(ne=e.ROOT_HEIGHT),"ROOT_BASIC_HEIGHT"in e&&(E=e.ROOT_BASIC_HEIGHT),"onLoadEndCallback"in e&&(ee=e.onLoadEndCallback),"cardTemplate"in e&&(v=e.cardTemplate),"boostManager"in e&&(re=e.boostManager),"emptyHolderClassName"in e&&(X=e.emptyHolderClassName,a=$(X)),"initialBatch"in e&&(le=e.initialBatch),"skipPrepareRoot"in e&&(_e=e.skipPrepareRoot),"funcOnTapItemCard"in e&&(C=e.funcOnTapItemCard),"funcOnTapShop"in e&&(de=e.funcOnTapShop),"funcOnHeightChange"in e&&(ce=e.funcOnHeightChange),"WINDOW_HEIGHT"in e&&(x=e.WINDOW_HEIGHT),"searchKeyword"in e&&(pe=e.searchKeyword),"sortType"in e&&(ue=e.sortType),"funcGetShopUserName"in e&&(fe=e.funcGetShopUserName),"hideOfficialShopLabel"in e&&(me=e.hideOfficialShopLabel),"onAdsItemAppear"in e&&(he=e.onAdsItemAppear),"offsetStr"in e&&(ge=e.offsetStr),"parseResFunc"in e&&(ye=e.parseResFunc),"offsetObj"in e&&(L=e.offsetObj)),window.batch_item_pagination_number&&(f=m*(batch_item_pagination_number-1))}function we(e){ae=!0;for(var i=0;i<A.length;i++){var t=A[i];t.__node__&&N(t)}}function be(i){var t,n;i&&i.__node__&&(t=i.__node__,n=t.find(".mask-for-owner"),i.owner_attr=M,i.item_status_for_owner="owner_normal",n.find(".button").hide(),n.css("visibility","hidden"),t.fadeOut(function(){var e=A.indexOf(i);0<=e&&A.splice(e,1),Ke(i),t.css("display",""),Pe(!0),H(!0,!0),t.find(".margin-holder").css("opacity",0),i.dismissed=!0,n.find(".button").show()}))}function Te(e){var i,t,n,o,a,r,s,l,_=$(e.currentTarget);return e.preventDefault(),e.stopPropagation(),_.hasClass("ic_close_white")?(n=e,n=$(n.currentTarget),void((t=B(n))&&(i=n.parents(".mask-for-owner"),n=t.shopid,o=t.itemid,i.fadeOut(function(){i.css("display",""),t.owner_attr=M,t.item_status_for_owner="owner_normal",N(t)}),$.post("/shop/"+n+"/item/"+o+"/mark_done/",{csrfmiddlewaretoken:csrf},function(e){}).fail(function(e){})))):_.hasClass("owner_new")?Ie(e):_.hasClass("owner_deleted")?(n=e,n=$(n.currentTarget),void((a=B(n))&&(n.parents(".mask-for-owner"),n=a.shopid,o=a.itemid,$.post("/shop/"+n+"/item/"+o+"/dismiss/",{csrfmiddlewaretoken:csrf},function(e){console.log(e),0==e?be(a):alert_message(i18n.t("msg_server_error")+" ("+e+")")}).fail(function(e){alert_message(i18n.t("msg_server_error"))})))):_.hasClass("owner_reviewing")||_.hasClass("owner_banned")||_.hasClass("action--update-product")?(r=e,r=$(r.currentTarget),void((l=B(r))&&(isShopOnVacation&&3==l.status?alert_message(i18n.t("msg_seller_on_vacation")):(r.parents(".mask-for-owner"),r.parents("li"),r=l.shopid,s=l.itemid,l.is_category_failed&&window.BI_ANALYTICS&&BI_ANALYTICS.updateWrongCategoryEdit({shop_id:r,product_id:s,view:1}),window.WebViewJavascriptBridge?window.WebViewJavascriptBridge.callHandler("showEditProduct",{itemID:s,shopID:r},function(e){}):showProm(i18n.t("msg_edit_btn_pop")))))):_.hasClass("owner_offensive_hide")?(e.preventDefault(),msg="MY"==window.LOCALE?i18n.t("msg_product_offensive_hide_my"):i18n.t("msg_product_offensive_hide"),void bridgeCallHandler("showPopUp",{popUp:{message:msg,okText:i18n.t("label_ok")}})):_.hasClass("owner_bank_new")?(e.preventDefault(),void bridgeCallHandler("showMissingBankScamPopup",{urlQueryString:"return_page=me"})):_.hasClass("owner_new_unlisted")?Ie(e):void 0}function Ie(e){var i,t,n,o,a,r,s,l,_=B($(e.currentTarget));_&&(i=_.shopid,t=_.itemid,n=fe?fe(i,t):"",o=_.name,a=_.description,r=_.currency,s=_.price,_=_.image,l=location.origin.replace("mall.","")+"/"+n+"/"+t+"/",e.preventDefault(),window.WebViewJavascriptBridge?window.WebViewJavascriptBridge.callHandler("share",{shopID:i,itemID:t,itemName:o,itemDesc:a,itemCurrency:r,itemPrice:s,itemImage:_,username:n,url:l},function(e){}):showProm(i18n.t("msg_edit_btn_pop")))}function ke(e){e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation(),Ae(e,be)}function Oe(e){e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation();var i=$(".btn-hide.active");i.removeClass("active"),i&&i[0]==e.currentTarget||$(e.currentTarget).addClass("active"),$(e.currentTarget).find(".btn-hide-pop-out").off("tap").on("tap",function(e){e.preventDefault(),e.stopPropagation();var i,t=B($(e.currentTarget));t&&(e=t.itemid,i=t.shopid,e&&(e={itemid:parseInt(e),csrfmiddlewaretoken:csrf,shopid:parseInt(i)},null!=window.CURRENT_JUST_FOR_YOU_BATCH?(e.home_batch=window.CURRENT_JUST_FOR_YOU_BATCH,e.is_home=!0):e.is_home=!1,$.post("/hide_just_for_you/api/",e,function(){be(t),alert_message_nonblock(i18n.t("msg_hide_item_success"))})))})}function Ee(e){e.preventDefault(),e.stopPropagation();e="";"ID"==LOCALE?e=i18n.t("msg_id_free_shipping"):"TH"==LOCALE?e=i18n.t("msg_free_shipping_th"):"TW"==LOCALE?e=i18n.t("msg_free_shipping_tw"):"MY"==LOCALE?e=i18n.t("label_shipping_promotion_van_my"):"VN"==LOCALE?e=i18n.t("msg_free_shipping_vn"):"SG"==LOCALE?e=i18n.t("msg_free_shipping_sg"):"PH"==LOCALE&&(e=i18n.t("msg_free_shipping_ph")),bridgeCallHandler("showPopUp",{popUp:{message:e,okText:i18n.t("label_ok")}})}function xe(i){i.preventDefault(),i.stopPropagation(),window.WebViewJavascriptBridge?window.WebViewJavascriptBridge.callHandler("login",{},function(e){1==e.status&&Ae(i)}):loggedin?Ae(i):askLogin()}function Ae(e,i){BJUtil.popUserPrivacy();var t,e=$(e.currentTarget),n=B(e);n&&(e.find(".icon_like"),e=n.shopid,t=n.itemid,n.liked?(alert_message(i18n.t("msg_deleted_from_your_favorite"),1e3),n.icon_like="ic_offerlist_like",n.liked=!1,n.liked_count--,N(n),$.ajax({url:"/buyer/unlike/shop/"+e+"/item/"+t+"/",method:"POST",data:{csrfmiddlewaretoken:csrf},timeout:5e3,success:function(e){i&&i(n)},error:function(e){alert_message(i18n.t("msg_server_error"))}})):(alert_message(i18n.t("msg_added_to_your_favorite"),1e3),n.icon_like="ic_offerlist_liked",n.liked=!0,n.liked_count++,N(n),$.ajax({url:"/buyer/like/shop/"+e+"/item/"+t+"/",method:"POST",data:{csrfmiddlewaretoken:csrf},timeout:5e3,success:function(e){i&&i(n)},error:function(e){alert_message(i18n.t("msg_server_error"))}})))}function Se(e){var i=window.WebViewJavascriptBridge;if(!i)return!0;e.preventDefault(),e.stopPropagation();var t,e=B($(e.currentTarget));e&&(t=e.shopid,e=e.itemid,i&&i.callHandler("showItemComments",{shopID:t,itemID:e},function(e){}))}function Ce(e,i){ae=ae||BJUtil.isAdultSafe();var t=e.items,n=t;b&&0<b.length&&(n=t.filter(function(e){return b.indexOf(e.itemid)<0&&(Q||1==e.status)}));for(var o,a,r=0;r<n.length;r++)b.push(n[r].itemid);function s(e){for(var i,t,n=0;n<e.length;n++)i=e[n],t=void 0,isIOS()&&(isShopeeApp()||isChromeIOS())&&i&&((t=new Image).src=i,ni.push(t))}isIOS()&&(o=n.map(function(e,i){return window.ITEM_IMAGE_BASE_URL+e.image+"_tn"}),(a=window.WebViewJavascriptBridge)&&a.appHasHandler("loadImages")?a.callHandler("loadImages",{imageUrls:o},function(){var i,t;s(o),c&&a.appHasHandler("burpScroll")&&(a.callHandler("burpScroll",{},null),i=scrollTopFunc(),t=setInterval(function(){var e=scrollTopFunc();e!=i?i=e:(clearInterval(t),window.scrollTo(window.scrollX,window.scrollY))},50))}):s(o)),l&&l(n),A.push.apply(A,n),t.length<1||e.nomore?Le():d.hide(),i&&i(e);t=f;f+=m,h=!1,0==t&&(m=50)}function Le(){p&&(p=!1,c&&(d.hide(),(0<A.length||0==a.length?o:a).show()),ee&&ee())}function Me(o){return!!p&&(!h&&(h=!0,runAfterDomReady(function(){if(0==f&&le)return d(le),void(le=null);var e=window.WebViewJavascriptBridge;if(e&&e.appHasHandler("ajax")&&0<f){var i,t=[],n={limit:m,need_drop_word:y};for(i in n[ge]=f,n)n.hasOwnProperty(i)&&t.push(encodeURIComponent(i)+"="+encodeURIComponent(n[i]));function o(e){if($.removeCookie("X-Requested-For-"+r),$.removeCookie(Base64.test()+r),e&&e.respCode&&e.body&&200==e.respCode)try{d(JSON.parse(e.body))}catch(e){console.error("ajax: e="+e),c()}else c()}var a=0<=u.indexOf("?")?"&":"?",a=u+(t.length?a+t.join("&"):""),r=(a.startsWith("http")||(a=location.origin+a),parseInt(1e6*Math.random())),s=(a+=(0<=a.indexOf("?")?"&":"?")+"__ck__="+r,aqfgu(a)),l=asfq(s);$.cookie("X-Requested-For-"+r,s,{expires:new Date(curTs()+4e4)}),$.cookie(Base64.test()+r,l,{expires:new Date(curTs()+4e4)});"POST"===G?(_.extend(n,V),e.callHandler("ajax",{url:a,method:"POST",body:JSON.stringify(n),timeout:35e3},o)):e.callHandler("ajax",{url:a,method:"GET",timeout:35e3},o)}else(s={limit:m,need_drop_word:y})[ge]=f,l={cache:!0,dataType:"json",url:u,data:s,success:d},"POST"===G&&(l.method="POST",l.contentType="application/json; charset=utf-8",_.extend(s,V),l.data=JSON.stringify(s)),$.ajax(l).fail(function(e){c()})}),!0));function d(e){if(!(e=ye?ye(e):e)||!e.items)return h=!1,void De(o,"<no-items-in-response>");var i,t,n;window.WebViewJavascriptBridge&&(i=u+"_"+f+"_"+m,t=window.WebViewJavascriptBridge,0==f&&(n=JSON.stringify(e),setTimeout(function(){t.callHandler("save",{key:i,data:n,persist:1},function(e){})},1e3))),Ce(e,o)}function c(){h=!1,De(o,"<timeout>")}}function Ne(e,i){var t;i=i,(t={page:location.pathname+location.search,batchapi:u,userid:window.USERID,limit:m,need_drop_word:y})[ge]=f,t={url:"batch-item-timeout",sent_data:JSON.stringify(t),response_data:i},BJUtil.sentryLog("batch-item-timeout",t,"error"),Z&&setTimeout(function(){Me(e)},5e3),e&&e(null),J&&J()}function De(i,t){var e;F||Y||(window.WebViewJavascriptBridge?(Y=!0,e=u+"_"+f+"_"+m,window.WebViewJavascriptBridge.callHandler("load",{key:e,persist:1},function(e){e.data?Ce(JSON.parse(e.data),i):Ne(i,t),Y=!1})):Ne(i,t))}var Be=-1,Re=-1;function Pe(e){var i;g&&c&&(i=A.length,i=Math.ceil(i/2)*I+E,i=Math.max(i,ie),!e&&i==Be||(Be=i,g.css({height:i+"px"}),Re=q.height(),ce&&ce(Re,Be)))}var He=null,M={},Ue={sold_out:!0,deleted:!0,banned:!0,offensive_hide:!0};function $e(e,i){var t;i.class_adult=!e.is_adult||j||ae?"":"adultcntrl age-"+ADULT_AGE,i.badge_soldout_display="sold_out"==e.item_status?"":"display: none;",i.class_liked=e.liked?"liked":"",i.owner_attr=e.owner_attr||M,i.text_tstamp=se&&e.ctime&&!isNaN(e.ctime)?DateDiff.getDiff(new Date(1e3*e.ctime),new Date):"",T?(i.boost_container_display=e.shopid==CURRENT_SHOPID?"":"display: none;",e.item_status in Ue||e.owner_attr&&"label_verify_user_info"==e.owner_attr.btn_name||is_item_unlisted(e)?i.boost_btn_status="disabled":i.boost_btn_status=e.boostable?"boostable":"boosted",e.boosting?i.boost_btn_text=i18n.t("label_promoting"):e.boosted?i.boost_btn_text=i18n.t("label_promote_in"):i.boost_btn_text=i18n.t("label_promote_now"),e.boosted&&e.ptime&&e.pwait?(t=new Date(1e3*e.ptime+1e3*e.pwait),i.boost_countdown_text=DateDiff.inFullFormat(new Date,t)):i.boost_countdown_text="",i.boost_countdown_display=e.boosted?"":"display: none;"):(i.boost_container_display="display: none;",i.boost_countdown_display="display: none;"),i.mask_for_owner_visibility=$.isEmptyObject(i.owner_attr)?"":"visibility: visible;",i.item_status=$.isEmptyObject(i.owner_attr)?e.item_status:"normal",i.item_after_dismiss_visibility=e.dismissed?"opacity:0":"",is_item_unlisted(e)?(!i.mask_for_owner_visibility||i.mask_for_owner_visibility&&"owner_new_unlisted"===e.item_status_for_owner)&&(i.unlisted_style=""):i.unlisted_style="display:none;"}function Je(e,i){e.item_rating&&_.extend(e,e.item_rating),e.liked?e.icon_like="ic_offerlist_liked":e.icon_like="ic_offerlist_like";var t="",n="",n=isShopeeApp()?t="javascript:void(0)":(t=SeoUtil.getItemUrlSeo(e.name,e.shopid,e.itemid),"/shop/#shopid="+e.shopid);if(revertTWDiscountForEnglishIfNeeded(e),i.text_currency=dollarsign_getter(e.currency),i.text_price=bee_dollarfy(e.price,e.currency),e.price_max!=e.price_min?(i.text_price_max=bee_dollarfy(e.price_max,e.currency),i.price_max_display=""):i.price_max_display="display:none",e.price_before_discount&&e.price_before_discount!=e.price&&e.price_max_before_discount==e.price_min_before_discount&&e.price_min==e.price_max?(i.text_price_before_discount=bee_dollarfy(e.price_before_discount,e.currency),i.price_before_discount_display=""):(i.text_price_before_discount="",i.price_before_discount_display="display: none;"),i.free_shipping_visibility=e.show_free_shipping?"display: inline-block;":"display: none;",i.service_by_shopee_icon_visibility=e.service_by_shopee_flag?"display: inline-block;":"display: none;",i.white_list_visibility=e.white_list?"visibility: visible;":"visibility: hidden;",i.badge_promotion_display=e.discount?"":"display: none;",i.wholesale_display=e.can_use_wholesale?"":"display: none;",i.coin_earn_label_display=e.coin_earn_label?"":"display: none;",me?(i.shopee_verified_display="display: none;",i.official_shop_display="display: none;",i.official_shop_label_in_title_display="display: none;"):(i.shopee_verified_display=e.show_shopee_verified_label?"":"display: none;",i.official_shop_display=e.show_official_shop_label_in_normal_position?"":"display: none;",i.official_shop_label_in_title_display=e.show_official_shop_label_in_title?"":"display: none;"),i.is_shopee_verified=e.is_shopee_verified?"":"display: none;",i.can_use_wholesale=e.can_use_wholesale?"":"display: none;",ue==SEARCH_ENUM.SORT_TYPES.SORTBY_ITEM_SOLD_DESC&&window.SHOW_SOLD_COUNT?(i.like_visibility="display: none;",e.sold?i.sold_empty_visibility="display: none;":i.sold_number_visibility="display: none;"):i.sold_visibility="display: none;",e.badge_icon_type)switch(e.badge_icon_type){case 1:i.service_by_shopee_icon_cls="ic_service_by_shopee--8h";break;case 2:i.service_by_shopee_icon_cls="ic_service_by_shopee--24h";break;case 3:i.service_by_shopee_icon_cls="ic_service_by_shopee--48h";break;case 4:i.service_by_shopee_icon_cls="ic_service_by_shopee--non-special";break;case 5:i.service_by_shopee_icon_cls="ic_service_by_shopee--id-24h";break;case 6:i.service_by_shopee_icon_cls="ic_service_by_shopee--vn-24h";break;case 7:i.service_by_shopee_icon_cls="ic_service_by_shopee--vn-4h";break;case 8:case 9:case 10:case 11:i.service_by_shopee_icon_cls="ic_service_by_shopee--id-24h"}i.price_style="",e.hidden_price_display?(i.price_masked_style="",i.price_style="display: none;"):i.price_masked_style="display: none",e.preview_info&&!window.isShownToOwner?i.class_preview_mask="preview-mask--show-normal":i.class_preview_mask="",e.image?(i.img_url=window.ITEM_IMAGE_BASE_URL+e.image+"_tn",i.bg_img_style="background-image : url("+i.img_url+");"):(i.img_url=BLANK_IMAGE_URL,i.bg_img_style=""),i.item_href=t,i.shop_href=n,e.shopimage?i.shop_img_url=window.ITEM_IMAGE_BASE_URL+e.shopimage+"_tn":i.shop_img_url=BLANK_IMAGE_URL;for(var o=Number(e.rating_star).toFixed(1),a=0;a<5;a++){var r=o-a;i["star_cls_"+a]=1<=r?"ic_rating_score_solid":.5<=r?"ic_rating_score_half":"ic_rating_score_hollow"}e.rating_count&&0<e.rating_count.length&&0<e.rating_count[0]?(i.rating_count_display="("+e.rating_count[0]+")",i.rating_inline_style="",i.rating_empty_inline_style="display:none;"):(i.rating_inline_style="display:none;",i.sold_number_visibility?i.rating_empty_inline_style="display:none;":i.rating_empty_inline_style=""),e.has_lowest_price_guarantee?i.lowest_price_style="":i.lowest_price_style="display:none;",e.adsid?(i.shopee_ads_style="",i.product_video_style="display:none;",he&&f<m&&he()):(i.shopee_ads_style="display:none;",e.videos&&e.videos.length?i.product_video_style="":i.product_video_style="display:none;"),i.owner_warning_cover_attr=e.owner_warning_cover_attr||M,i.warning_cover_for_owner_visibility=$.isEmptyObject(i.owner_warning_cover_attr)?"visibility: hidden;":"visibility: visible;",i.item_name_class="truncate-line2",i.installment_tag_style="display: none;",i.bundle_deal_tag_style="display: none;",(window.CC_INSTALLMENT_PAYMENT_ELIGIBILITY&&e.is_cc_installment_payment_eligible||window.NON_CC_INSTALLMENT_PAYMENT_ELIGIBILITY&&e.is_non_cc_installment_payment_eligible)&&(i.item_name_class="truncate",i.installment_tag_style=""),e.can_use_bundle_deal&&e.bundle_deal_info&&(i.item_name_class="truncate",i.bundle_deal_tag_style="",i.bundle_deal_label=e.bundle_deal_info.bundle_deal_label),e.preview_info&&(i.badge_promotion_display="display: none;",i.wholesale_display="display: none;",i.product_video_style="display: none;",i.bundle_deal_tag_style="display: none;",i.badge_soldout_display="display: none;",i.installment_tag_style="display: none;",i.lowest_price_style="display: none;")}function We(e,i){var t,n;e&&(t=null,i?i._r?$e(i,t=i._r):(Je(i,t={}),$e(i,t),i._r=t):t=He||((r={price_before_discount_display:"display: none;",text_currency:"",text_price:"",text_price_max:"",text_price_before_discount:"",price_max_display:"display: none;",free_shipping_visibility:"display: none;",service_by_shopee_icon_visibility:"display: none;",white_list_visibility:"visibility: hidden;",badge_soldout_display:"display: none;",badge_promotion_display:"display: none;"}).shop_img_url=BLANK_IMAGE_URL,r.img_url=BLANK_IMAGE_URL,r.bg_img_style="background-image : url("+BLANK_IMAGE_URL+");",r.item_href="javascript:void(0)",r.shop_href="javascript:void(0)",r.class_liked="",r.class_adult="",r.boost_container_display="display: none",r.boost_btn_status="",r.boost_btn_text="",r.boost_countdown_display="display: none",r.boost_countdown_text="",r.owner_attr=M,r.mask_for_owner_visibility="visibility: hidden;",r.warning_cover_for_owner_visibility="visibility: hidden;",r.text_tstamp="",r.owner_warning_cover_attr=M,r.item_status="normal",r.item_after_dismiss_visibility="",He=r),i=i||M,(n=Ve()).item=i,n.r=t,e.render(n))}var Ge=null;function Ve(){return Ge=Ge||{ITEM_IMAGE_BASE_URL:window.ITEM_IMAGE_BASE_URL,card_type:i,shop:e,show_shop:W,LOCALE:LOCALE,isInBoostPage:T,CURRENT_SHOPID:window.CURRENT_SHOPID}}function Fe(e,i){var t,n,o;i&&(t=0,n=I*Math.floor(e/2),e%2!=0&&(t=k),isAndroid()?i.css({transform:o="translate3d("+t+"px, "+n+"px, 0)","-webkit-transform":o}):i.css({transform:"translate("+t+"px, "+n+"px)"}),i.data("idx",e))}function N(e){e&&e.__node__&&Ye(e,e.__node__)}function Ye(e,i){We(i[0]._domify_,e),i[0].style.visibility="visible"}function je(e,i,t){var n=A[e];n.__node__||(Ye(n,n=function(e,i,t,n){S.length<=0&&qe(t,n,1);if(!(S.length<=0))return(t=S.pop()).data("idx",e),i.__node__=t}(e,n,i,t)),Fe(e,n))}function Ke(e){var i=e.__node__;i&&(delete e.__node__,i.removeData("idx"),(e=i[0]._domify_)&&e.resetImages(),ti(i),S.push(i))}function qe(e,i,t){if(!(S.length>=t)){if(oe){for(var n=0;n<e;n++)Ke(A[n]);for(n=i;n<A.length;n++)Ke(A[n])}if(S.length<t){for(var o,a,r,s,l=t-S.length,d=(null==D&&(o=[],"none"!=g.css("display")&&(Je(i={name:"wwwwwwwwwwwwwwwww",price:999999999999,currency:get_default_currency(),liked_count:999,cmt_count:999},r={}),$e(i,r),(s=Ve()).item=i,s.r=r,i=_.template(v,Domify_TEMPLATE_SETTING)(s),(c=$(i)).css({opacity:"0"}),g.append(c[0]),c.find(".fix-size").each(function(){var e=$(this),i=Math.floor(e.width()),t=Math.floor(e.height())||i;e.css({width:i+"px",height:t+"px"}),o.push([i,t])}),c.remove()),isIE()&&(v=v.replace(/style.*=/g,IE_STYLE_NAME+"=")),v=revertTWDiscountForEnglishIfNeededTemplate(v),D=$(v),0<o.length&&(a=0,D.find(".fix-size").each(function(){var e=$(this),i=o[a],t=(a++,i[0]),i=i[1];e.css({width:t+"px",height:i+"px"})})),r=k,s=I,D.css({width:r+"px",height:s+"px"}),ti(D)),[]);0<l;){var c=D.clone(),p=new Domify(c[0]);We(c[0]._domify_=p),!function(i){window.WebViewJavascriptBridge?(i.find("a.item-href").each(function(){var e=$(this);e.off("click").off("tap").on("tap",ze),e.on("touchstart",function(e){w.touchstart(e)}),e.on("touchend",function(e){"touchend"==e.type&&w.touchend(e)}),e.on("touchcancel touchmove",function(e){"touchmove"==e.type&&w.touchmove(e)})}),i.find("a.shop-href").each(function(){$(this).off("click").off("tap").on("tap",ei)})):i.find("a.item-href").on("tap",function(e){var i=B($(this));if(i)return C&&C(i,A.indexOf(i)),1==i.item_type&&Qe(i),bridgeCallHandler("navigate",{url:this.href,target:this.target}),!1});i.find(".item_rating__rating-info").off("click").off("tap").on("tap",Ze),i.find(".owner").on("tap",Te),i.find(".item-status .likes").on("tap",xe),i.find(".item-status .comments").on("tap",Se),i.find(".btn-hide").on("tap",Oe),i.find(".unlike").off("tap").on("tap",ke),i.find(".free-shipping-icon").on("tap",Ee),setTimeout(function(){var e=i.find(".likes").width()+i.find(".item_rating").width();i.find(".bottom.normal").width()<e&&i.find(".item_rating__rating-info__count").hide()},0),T&&re&&(re.listenPtimeCountDown(i.find(".pcountdown")),re.listenBoost(i.find(".boost-btn")))}(c),d.push(c),S.push(c),l--}g.append(d)}}}var D=null;function B(e){e=(e=e.hasClass("item-card")?e:e.parents(".item-card")).data("idx");return null==e?null:A[e]}function Xe(e,i,t,n){window.WebViewJavascriptBridge;i&&-1<i.indexOf("review-part")||i&&(!t||i.indexOf(t)<0)||e.hasClass("banned")||((t=n(location.origin+i,e)).preloadKey="item",bridgeCallHandler("navigate",t,null))}function ze(e){var i;w.tap()&&(e.preventDefault(),e.stopPropagation(),(i=B(e=$(this)))&&(q.trigger(EVENT_ITEM_CARD_TAPPED),C&&C(i,A.indexOf(i)),1==i.item_type?Qe(i):Xe(e,"/item/#shopid="+i.shopid+"&itemid="+i.itemid+"&data="+encodeURIComponent(JSON.stringify(i,ii))+"&source_url="+encodeURIComponent(location.href),"/item/",bridge_capture_link_item_callback,i.shopid,i.itemid)))}function Qe(e){var i=null,e=(i=(i="/buyer/seen_item/"==location.pathname?"25":i)?"?dp_from_source="+i:"",location.origin.replace("mall.","")+("ID"==window.LOCALE?"/produk-digital":"/digital-product")+"/m/items/"+e.reference_item_id+i);bridgeCallHandler("navigate",{url:e})}function Ze(e){w.tap()&&(e.preventDefault(),e.stopPropagation(),(e=B($(this)))&&(e="/shop/{0}/item/{1}/rating/".f(e.shopid,e.itemid),BJUtil.navigate(e,!1,!1,{presentModalWebOnly:!0})))}function ei(e){e.preventDefault(),e.stopPropagation();var e=$(this),i=B(e);i&&(de&&de(i,A.indexOf(i)),Xe(e,"/shop/#shopid="+i.shopid,"/shop/",bridge_capture_link_shop_callback))}function ii(e,i){if("__node__"!=e&&"__image__"!=e)return i}function ti(e){e[0].style.visibility="hidden"}var ni=[];var oi=-1,R=-1,P=-1,ai=10,ri=(isAndroid(),4),si=(isAndroid(),.5),li=!1;function H(e,i,t){if(g){var n=Math.max(0,scrollTopFunc()-te-O);if((e||oi!=n)&&!li){li=!0;var o=Math.max(0,2*Math.floor(n/I)),a=2*Math.ceil((n+x)/I);if(e||R<0||P<0||P<o||a<R||U<0&&o-R<ai||0<=U&&P-a<ai){oi=n;o=x,a=x,o=(0<=U?(o*=si,a*=ri):U<0&&(o*=ri,a*=si),Math.max(0,2*Math.floor((n-o)/I))),a=Math.min(A.length,2*Math.ceil((n+x+a)/I));if(e||R!=o||P!=a)if(i){var e=o,r=a;r=Math.min(A.length,r);for(var s=e;s<r;s++)Fe(s,A[s].__node__)}else{var l=o,_=a;_=Math.min(A.length,_);for(var d=0,c=l;c<_;c++)A[c].__node__||d++;if(qe(l,_,d),U<0)for(c=_-1;l<=c;c--)je(c,l,_);else for(c=l;c<_;c++)je(c,l,_);R=l,P=_}}t||(i=6*x,2*Math.ceil((n+x+i)/I)>A.length&&p&&_i()),li=!1}}}function _i(i){!t&&p&&(t=!0,c&&d.show(),!!p&&Me(function(e){Pe(!0),H(!0,!1,!0),t=!1,c&&d.hide(),i&&i(e)})||(c&&d.hide(),t=!1))}var U=0,di=-1,ci=!1;function pi(e,i,t,n){var o;c&&(ci?ci=!1:(n=n||scrollTopFunc(),(isPC()||80<curTs()-z||0==n)&&((o=!(n+x<=Re&&0<=n))||(U=di<n?1:n<di?-1:0,di=n),o||H(0==n,!1),z=curTs()),gtopOnScroll(n)))}function ui(e,i){i=$(e,i);return i=0==i.length?$(e):i}function fi(){x=n.height(),v=v||$("#item-card").text(),g=$("ul."+K),d=ui(".loading-text",g.parent()),o=ui(".nomore",g.parent()),(a=ui(X,g.parent())).hide();var e=g.height(),i=parseInt(g.css("min-height"));null==s&&(s=g.width()),null==ne&&(ne=e),null==E&&(E=e==i?0:e),null==ie&&(ie=ne||0),null==O&&((i=g.offset())&&(O=i.top,(e=scrollTopFunc())<0&&(O-=e)),null==O&&(O=0)),k=Math.ceil(s/2),I=k+106,0<v.indexOf("shop-part")&&(se=!0,I+=25),T&&0<v.indexOf("boost-container")&&(I+=45),q.on(BJUtil.EVENT_DISMISS_ADULT,we)}var mi=!1;function hi(e){e!=c&&(di=-1),e||(mi=!0),c=e}function gi(){return"batch-item-reappear-"+u}var yi=-1,vi=-1,wi=-1,bi=[];function Ti(){d&&d.hide(),d=$(),a=$(),p=!1,o=$()}return{loadData:function(e,i){ve(e);var a,t=null,e=(e&&"restoreToState"in e&&(t=e.restoreToState),fi(),_e||BatchItem.prepareRootNode(g),n.on("scroll",pi),!(e&&e.skipInitialLoad));(e=!t||!function(e,i){if(c){var t=null;try{t=JSON.parse(e)}catch(e){return console.log("batchItem.restoreState.e|apiUrl="+u,e),0}if(t)return e=!0,null!=t.isLoadMore&&(e=t.isLoadMore),null!=t.offset&&(f=t.offset),null!=t.allItems&&(A=t.allItems),Pe(!0),H(!0),l&&l(A),e||Le(),i&&i({items:A}),1}}(t,i)?e:!1)&&_i(i),window.WebViewJavascriptBridge&&(a=window.WebViewJavascriptBridge).registerHandler("viewWillReappear",function(e){a.callHandler("load",{key:"pending-update"},function(e){if(e.data){var i=JSON.parse(e.data);if(i.itemId)for(var t=0;t<A.length;t++){var n=A[t];if(n.itemid==i.itemId){var o="/item_data/?shopid="+n.shopid+"&itemid="+i.itemId;!function(i){getJSON(o,function(e){i.liked=e.item_detail.liked,i.icon_like=e.item_detail.icon_like,i.liked_count=e.item_detail.liked_count,i.cmt_count=e.item_detail.cmt_count,N(i),console.log("pending-update: ",e)}).fail(function(){})}(n),a.callHandler("save",{key:"pending-update",data:"",persist:0},function(){});break}}}})},gi())},destroy:function(){if(window.WebViewJavascriptBridge&&window.WebViewJavascriptBridge.unregisterHandler("viewWillReappear",gi()),n&&n.off("scroll",null,pi),g&&g.css({height:""}),Ti(),A)for(var e=0;e<A.length;e++)Ke(A[e]);A=[],S=[]},markNoMore:Le,options:ve,truncateItems:function(e){g.css({height:""})},tapManager:w,retire:Ti,setActive:hi,foreground:function(){hi(!0),Pe(ci=!0),p?o.hide():(o.show(),d.hide())},background:function(){hi(!1),g&&g.css({height:""})},onScroll:pi,loadCurrentBatch:function(){_i()},render:function(e){H(mi||e),mi=!1},itemOfNode:B,renderItem:N,allItems:function(){return A},itemsOnScreen:function(e){if(e=e||!1,!c)return bi;var i,t=scrollTopFunc(),n=(t!=wi&&(wi=t,i=L&&L.offsetTop?L.offsetTop:0,o=L&&L.offsetBottom?L.offsetBottom:0,vi=(i=(t=t-O+i)+x-o)<=0||Be<=t?yi=-1:e?(yi=Math.max(0,2*Math.round(t/I)),2*Math.round(i/I)):(yi=Math.max(0,2*Math.floor(t/I)),2*Math.ceil(i/I))),yi),o=vi;return n<0||o<0?bi:((e=A.slice(n,o)).map(function(e,i){e.batch_item_index=i+n,e.searchKeyword=pe,e.sortType=ue}),e)},$root:function(){return g},getStateToSave:function(){if(!c)return null;try{return JSON.stringify({allItems:A,isLoadMore:p,offset:f},ii)}catch(e){return console.log("batchItem.getStateToSave.e|apiUrl="+u,e),null}}}}).prepareRootNode=function(e){isIOS()&&!isIPhone6or6sPlus()&&e.css({"-webkit-backface-visibility":"hidden","-webkit-perspective":"1000",transform:"translate3d(0,0,0)"})};
//# sourceMappingURL=../source_maps/batch-item-domify.js.map
