$(document).ready((function(){$(".pro-amount-select").change((function(){$(this).parent().prev().val($(this).find(":selected").val())})),$(".pro-value").limitRegex(/^[0-9]{0,16}$/),$(".pro-value-custom").length&&$(".pro-value-custom").limitRegex(/^[0-9]{0,16}$/),document.getElementById("loading-promotion-detail")&&(document.getElementById("loading-promotion-detail").style.display="flex");const e={};function t(e){for(var t=1;e/10>1;)e/=10,t*=10;return t}setTimeout((()=>{$(".pro-amount-select").each((function(){let t=$(this).closest(".promotion-box").data("idpro"),a=[];$(this).children("option").each((function(){let e=$(this).val();a.push(parseInt(e))})),e[`${t}`]=a})),document.getElementById("loading-promotion-detail")&&(document.getElementById("loading-promotion-detail").style.display="none")}),1e3),$(".pro-value").each((function(){let e,a=[];void 0!==$(this).data("max")&&(e=parseInt($(this).data("max").toFixed(0)));let o=.1*$(this).data("max"),n=parseInt($(this).data("min"));if(e!==n){for(a.push(e);e/10>1;)if(e-=o,e>n){var i=t(e),r=e/i,s=Math.floor(r.toFixed(1)*i);a.push(s)}a.push(n)}let m=$(this).parent().find(".pro-amount-select");for(let e=a.length-1;e>=0;e--)$(m).append("")})),$(".pro-value").on("input",(function(){parseInt($(this).data("min"));var e=parseInt($(this).data("max"));if($(this).val()>e&&$(this).val(e),("jdbAA"===_theme.siteName||"Zak168"===_theme.siteName||"dexi777"===_theme.siteName||"jdbjhl"===_theme.siteName||"MWD666"===_theme.siteName||"true788"===_theme.siteName||"rpg666"===_theme.siteName)&&$(this).closest(".input-group").find(".pro-amount-select").length){let e=$(this).closest(".input-group").find(".pro-amount-select").val();$(this).val(e)}})).on("blur",(function(){(""===$(this).val()||parseInt($(this).val())<$(this).data("min"))&&$(this).val($(this).data("min"))})),$(".pro-value-custom").length&&$(".pro-value-custom").on("input",(function(){parseInt($(this).data("min"));var e=parseInt($(this).data("max"));if($(this).val()>e&&$(this).val(e),("jdbAA"===_theme.siteName||"Zak168"===_theme.siteName||"dexi777"===_theme.siteName||"jdbjhl"===_theme.siteName||"MWD666"===_theme.siteName||"true788"===_theme.siteName||"rpg666"===_theme.siteName)&&$(this).closest(".input-group").find(".pro-amount-select").length){let e=$(this).closest(".input-group").find(".pro-amount-select").val();$(this).val(e)}})).on("blur",(function(){(""===$(this).val()||parseInt($(this).val())<$(this).data("min"))&&$(this).val($(this).data("min"))})),$(".join-promotion").on("click",(function(){if(!_theme.logged)return $("#modal_login").modal();let t,a=0,o=$(this).parents(".promotion-box").data("idpro").toString();$(this).parents(".promotion-box").find(".pro-value").length?(t=$(this).parents(".promotion-box").find(".pro-value"),a=parseInt($(this).parents(".promotion-box").find(".pro-value").val())):$(this).parents(".promotion-box").find(".pro-value-custom").length?(t=$(this).parents(".promotion-box").find(".pro-value-custom"),a=parseInt($(this).parents(".promotion-box").find(".pro-value-custom").val())):$(this).parents(".promotion-box").find(".pro-amount-select").length&&(t=$(this).parents(".promotion-box").find(".pro-amount-select"),a=parseInt($(this).parents(".promotion-box").find(".pro-amount-select").val()));var n="B"===$(this).data("display")||"C"===$(this).data("display")||"D"===$(this).data("display")?a:0,i=$(this).data("pro");let r=$(this).data("display"),s=!1,m=!!$(this).data("another_pro")&&$(this).data("another_pro");if("jdbAA"===_theme.siteName||"jdbYG"===_theme.siteName||"myn77"===_theme.siteName||"mmbet99"===_theme.siteName||"MWD666"===_theme.siteName||"shall777"===_theme.siteName||"jdbkk"===_theme.siteName||"gkk777"===_theme.siteName||"bagan888"===_theme.siteName||"jdbjhl"===_theme.siteName||"live368"===_theme.siteName||"jdbkx"===_theme.siteName||"Zak168"===_theme.siteName||"dexi777"===_theme.siteName||"gog777"===_theme.siteName||"mandalay888"==_theme.siteName||"ppg11"==_theme.siteName||"yg168"==_theme.siteName||"spin368"==_theme.siteName||"true788"===_theme.siteName||"topslot"===_theme.siteName||"popeye888"==_theme.siteName||"pro9"==_theme.siteName||"shwe666"===_theme.siteName||"kyat365"==_theme.siteName||"kst777"==_theme.siteName||"shwe999"==_theme.siteName||"jiliam"==_theme.siteName||"rpg666"===_theme.siteName){if($(t).closest(".input-group").find(".pro-amount-select").length){$(t).closest(".input-group").find(".pro-amount-select").val();n=parseInt(n)}"B"===r&&(e[o]?e[o].indexOf(n)<0&&(s=!0):s=!0)}if(s)return swal({title:'Invalid value selector!',text:'Please try new value again',imageUrl:msg_img.fail,imageSize:"100x100",confirmButtonText:"ตกลง"},(function(){}));ajax("/api/approved",(function(e){var t='- กรุณาเปลี่ยนรหัสผ่านใหม่
',a='- กรุณายืนยันบัตรปชช.
',o='- ชื่อบัญชีธนาคาร';let r={};try{r="object"!=typeof e.status?JSON.parse(e.status):e.status,console.log(r)}catch(e){console.log(e)}if(!e.success&&"PAGE_NOT_CHECK_APPROVE"!=e.code&&"MEMBER_APPROVE_NOT_ENABLED"!=e.code){r.status_first_login&&(t=""),r.status_id_card&&(a=""),r.status_bank&&(o="");let e='Please contact the customer service to verify your account before use';return"Ubet89"!==_theme.siteName&&"Ubet78"!==_theme.siteName&&"88fed"!==_theme.siteName||(e='Please wait for confirm before enter'),swal({title:e,text:t+a+o,imageUrl:msg_img.fail,showCancelButton:!1,html:!0,imageSize:"100x100",confirmButtonText:'ตกลง'},(function(){return window.location.href="/new_profile/"}))}swal({title:"ยืนยันการเข้าร่วมโปรโมชั่น",text:"คุณต้องการเข้าร่วมโปรโมชั่นนี้หรือไม่",imageUrl:msg_img.confuse,imageSize:"100x100",showCancelButton:!0,closeOnConfirm:!1,showLoaderOnConfirm:!0,confirmButtonText:"ตกลง",cancelButtonText:"ยกเลิก"},(function(){ajax("/enter_promotion",(function(e){var t=!1;if(e.success)swal({title:"เข้าร่วมโปรโมชั่นเสร็จสมบูรณ์แล้ว.",imageUrl:msg_img.success,confirmButtonText:"ตกลง"},(function(){document.location.href="/"}));else switch(e.msg){case"JOINABLE_BUTTON_IS_CLOSE":case"PROMOTION_IS_CLOSE":t="Cannot join promotion because promotion is closed.";break;case"You not add ID card":t="บัตรประชาชนยังไม่ได้เพิ่ม หรืออนุมัติ.";break;case"The ID promotion is incorrect. Please contact customer service.":t="รหัสโปรโมชั่นไม่ถูกต้อง กรุณาติดต่อฝ่ายบริการลูกค้า.";break;case"ERROR_CANNOT_JOIN_LOCKED_PROMOTION":t="You have already participated in another similar promotion.";break;case"You have not bound the bank card, please bind the bank card and then operate":t="คุณยังไม่ได้เพิ่มข้อมูลผู้ใช้งาน กรุณาเพิ่มข้อมูลผู้ใช้งานก่อนดำเนินการ";break;case"Error, Edit member data failed.":t="ผิดพลาด ไม่สามารถแก้ไขข้อมูลได้";break;case"Error, no such promotion":t="ผิดพลาด ไม่มีรายการนี้";break;case"Get member data error":t="ไม่สามารถเชื่อมต่อข้อมูลผู้ใช้";break;case"The start time of the promotion has not been reached.":t="ยังไม่ถึงเวลาที่เริ่มโปรโมชั่น.","data"in e&&(t=t+" "+e.data);break;case"The promotion has expired.":t="โปรโมชั่นได้หมดอายุแล้ว.";break;case"This promotion is not open yet":t="โปรโมชั่นนี้ยังไม่เปิดใช้งาน";break;case"The required credit to participate in this promotion is not sufficient.":t="มีเครดิตสำหรับการเข้าร่วมโปรโมชั่นนี้ ไม่เพียงพอ.";break;case"The number of participants in this promotion has been full.":t="จำนวนผู้เข้าร่วมโปรโมชั่นนี้เต็มแล้ว.";break;case"The number of participants in this promotion today has been full.":t="จำนวนผู้เข้าร่วมโปรโมชั่นนี้ในวันนี้เต็มแล้ว.";break;case"Cannot join this promotion. Over limit per day":t="Cannot join this promotion. Over limit per day";break;case"Your account is still in this promotion or another promotion.":t="บัญชีของคุณยังอยู่ในโปรโมชั่นนี้ หรือโปรโมชั่นอื่น.";break;case"Before the turnover promotion not enough":t="ค่าเทิร์นโอเวอร์ก่อนหน้านี้มีเพียงพอ";break;case"Balance is not enough.":t="ยอดเงินคงเหลือไม่เพียงพอ.";break;case"Your account has completely already got this promotion.":t="บัญชีของคุณเคยได้รับโปรโมชั่นนี้เรียบร้อยแล้ว.";break;case"MUST_BILL_IN_1_TIME_FIRST":case"MUST_BILL_IN_1_TIME":t="เพื่อเข้าร่วมโปรโมชั่นนี้ คุณต้องทำการฝากเงินอย่างน้อยหนึ่งครั้ง.";break;case"E-Wallet Balance Not Enough.":t="E-Wallet Balance Not Enough.";break;case"Can not enter promotion, Now member playing games.":t="Can not enter promotion, Now member playing games.";break;case"Confirm deletion of the mail?":t="ยืนยันลบข้อความหรือไม่?";break;case"NOT_MUST_BILL_IN":t="เพื่อเข้าร่วมโปรโมชั่นนี้ บัญชีของคุณต้องไม่เคยทำการฝากเงินมาก่อน.";break;case"MUST_BE_FIRST_BILLIN":t="Can not participate in this promotion, Must be the first deposit amount only.";break;case"MUST_BE_SECOND_BILLIN":t="Can not participate in this promotion, Must be the second deposit amount only.";break;case"Your account cannot participate in this promotion. Please try again after":t="บัญชีของคุณไม่สามารถเข้าร่วมโปรโมชั่นนี้ได้ กรุณาลองใหม่อีกครั้งในภายหลัง","data"in e&&(t=t+" "+e.data);break;case"ID Promotion Incorrect":t="ID Promotion Incorrect";break;case"Can not end promotion, please try again after quit game 5 min":t="Can not end promotion, please try again after quit game 5 min";break;case"The number of participation in this promotion has been full":t="Can not join this promotion, This promotion has been full participant.";break;case"ERROR_CANNOT_JOIN_DONE_PROMOTION":t="บัญชีของคุณไม่สามารถเข้าร่วมโปรโมชั่นนี้ได้ เนื่องจากคุณไม่เคยเข้าร่วมโปรโมชั่นที่กำหนดไว้.";break;case"This promotion is not available. Please contact customer service.":t="โปรโมชั่นนี้ไม่สามารถใช้งานได้ กรุณาติดต่อฝ่ายบริการลูกค้า.";break;case"PROMOTION_DEPOSIT_INVALID":t="เพื่อเข้าร่วมโปรโมชั่นนี้ คุณต้องทำการฝากเงินอย่างน้อยหนึ่งครั้งในประเภทที่กำหนด.";break;case"MUST_BILL_IN_ACCUMULATED":t="To participate in this promotion. This is because the total deposit amount is insufficient.";break;case"Your ID has already completed this promotion today.":t="Your ID has already completed this promotion today.";break;default:t=e.msg.includes("Game Provider In Maintenance.")?"Game Provider In Maintenance. "+e.msg.replace("Game Provider In Maintenance.",""):e.msg.includes("Cannot connect to")?"Cannot connect to "+e.msg.replace("Cannot connect to","").replace("Provider","Provider"):e.msg}t&&("You have not bound the bank card, please bind the bank card and then operate"===e.msg?swal({title:"phl63"==_theme.siteName.toLowerCase()?"Please add your bank account or Gcash account and join the promotion":t,imageUrl:msg_img.fail,imageSize:"100x100",confirmButtonText:"ตกลง"},(function(){document.location.href="/new_profile/"})):swal({title:t,imageUrl:msg_img.fail,imageSize:"100x100",confirmButtonText:"ตกลง"},(function(){if("You not confirmed ID card"===e.msg||"You not add ID card"===e.msg)return document.location.href="/new_profile/";"JOINABLE_BUTTON_IS_CLOSE"!==e.msg&&"PROMOTION_IS_CLOSE"!==e.msg||location.reload()})))}),{promotionID:i,promotion_another:m,deposit:parseFloat(n)})}))}),{tab:"promotion"})})),$("#promotion").on("shown.bs.collapse",(function(){var e=window.location.hash;e&&$("html, body,#helpContent").animate({scrollTop:$(e).prev().offset().top-46},300)})).find('a[data-toggle="collapse"]').on("click",(function(){location.hash=$(this).attr("href");var e=window.location.hash;e&&$(".the-content").animate({scrollTop:$(".the-content").scrollTop()+$(e).prev().offset().top-60},300)})),$("table").each((function(e,t){$(t).hasClass("table")||$(t).addClass("table table-bordered")}))}));