(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
"use strict";var _message=require(9),_i18nEbusinessAmazon=require(7),_index=require(3),_util=require(5),ucI18nEbusinessAmazon={init:function(){var n=this;(0,_util.isShow)()&&(0,_message.sendMessageAsync)(_i18nEbusinessAmazon.MSG_EVENT_I18N_EBUSINESS_AMAZON_SHOW).then(function(e){e&&e.isShowGiftBox&&n.showGiftIndex()})},showGiftIndex:function(){setTimeout(function(){_index.i18nEbusinessAmazonIndex.render()},1e3)}};ucI18nEbusinessAmazon.init();


},{"3":3,"5":5,"7":7,"9":9}],2:[function(require,module,exports){
"use strict";exports.i18nEbusinessAmazonGift=void 0;var _message=require(9),_wowPage=require(10),_util=require(5),_i18nEbusinessAmazon=require(7),_template=require(4),state={surplusCount:0,giftCode:""},$main=void 0,$cancel=void 0,$content=void 0,$loading=void 0,$attention=void 0,$attentionDetail=void 0,$name=void 0,$email=void 0,i18nEbusinessAmazonGift=exports.i18nEbusinessAmazonGift={init:function(){var e=document.createElement("div");e.innerHTML=(0,_template.getMainTemp)(),document.body.appendChild(e),$main=e.querySelector(".uc-i18n-ebusiness-gift"),$cancel=e.querySelector(".uc-i18n-ebusiness-gift-cancel"),$content=e.querySelector(".uc-i18n-ebusiness-gift-content"),$loading=e.querySelector(".uc-i18n-ebusiness-gift-loading"),$attention=e.querySelector(".uc-i18n-ebusiness-gift-attention"),$attentionDetail=e.querySelector(".uc-i18n-ebusiness-gift-attention-detail"),this.drawGift(),this.bindEvent()},bindEvent:function(){var e=this;$content.addEventListener("click",function(t){var i=t.target.id;switch(i){case"uc-i18n-ebusiness-gift-btn-draw":e.drawGift();break;case"uc-i18n-ebusiness-gift-btn-get":e.saveUserInfo()}},!1),$content.addEventListener("focusout",function(t){var i=t.target.id;switch(i){case"uc-i18n-ebusiness-gift-email":e.checkEmail()}},!1),$attention.addEventListener("click",function(e){$attentionDetail.classList.toggle("uc-i18n-ebusiness-gift-hide")},!1),$cancel.addEventListener("click",function(t){e.close()},!1)},drawGift:function(){var e=this;this.showLoading(),(0,_message.sendMessageAsync)(_i18nEbusinessAmazon.MSG_EVENT_I18N_EBUSINESS_AMAZON_DRAW_GIFT).then(function(t){state.isDrawGiftSucc=t.isDrawGiftSucc,state.surplusCount=t.surplusCount,state.prizeID=t.prizeID,state.isDrawGiftSucc?e.updateSucc():e.updateFail(),(0,_wowPage.wowLog)("5.16.1.1.2",{draw:state.isDrawGiftSucc?1:0}),e.hideLoading()})},updateSucc:function(){$main.classList.remove("uc-i18n-ebusiness-gift-fail"),$main.classList.add("uc-i18n-ebusiness-gift-win"),$content.innerHTML=(0,_template.getFormTemp)(),$name=$content.querySelector("#uc-i18n-ebusiness-gift-name"),$email=$content.querySelector("#uc-i18n-ebusiness-gift-email")},updateFail:function(){$main.classList.remove("uc-i18n-ebusiness-gift-win"),$main.classList.add("uc-i18n-ebusiness-gift-fail"),$content.innerHTML=(0,_template.getFailTemp)(state)},saveUserInfo:function(){var e=this;return this.checkUserInfo()?(this.showLoading(),(0,_message.sendMessageAsync)(_i18nEbusinessAmazon.MSG_EVENT_I18N_EBUSINESS_AMAZON_SAVE_USERINFO,{email:$email.value}).then(function(t){e.hideLoading(),t.getGiftSucc?(state.giftCode=t.giftCode,$content.innerHTML=(0,_template.getCodeTemp)(state),e.downloadCodeAsImage(state.giftCode)):alert("Submit failed!")}),void(0,_wowPage.wowLog)("5.16.1.1.4")):void alert("Error name or email format!")},downloadCodeAsImage:function(e){var t=chrome.extension.getURL("res/i18n-ebusiness-amazon/card.png"),i=document.createElement("canvas");i.setAttribute("width",402),i.setAttribute("height",126);var n=i.getContext("2d"),s=new Image;s.crossOrigin="anonymous",s.src=t,console.log(s.complete),s.addEventListener("load",function(){n.drawImage(s,0,0),n.fillStyle="#fff",n.font="bold 30px Arial",n.fillText(e,56,70);var t=document.createElement("a");t.href=i.toDataURL(),t.download="UC SUPER DAY_Voucher Code.png",t.click()})},checkUserInfo:function(){var e=this.checkEmail();return e},checkEmail:function(){var e=$email.value.trim();return e.match(/^([\w\-])+(\.[\w\-]+)*@([\w\-])+((\.[\w\-]+)+)$/)?($email.classList.remove("uc-i18n-ebusiness-gift-input-error"),!0):($email.classList.add("uc-i18n-ebusiness-gift-input-error"),!1)},close:function(){$main.parentElement.removeChild($main),(0,_util.setNeverShow)(),(0,_wowPage.wowLog)("5.16.1.1.3",{close:2})},showLoading:function(){$main.classList.add("uc-i18n-ebusiness-gift-loading")},hideLoading:function(){$main.classList.remove("uc-i18n-ebusiness-gift-loading")}};


},{"10":10,"4":4,"5":5,"7":7,"9":9}],3:[function(require,module,exports){
"use strict";exports.i18nEbusinessAmazonIndex=void 0;var _gift=require(2),_i18nEbusinessAmazon=require(7),_wowPage=require(10),_util=require(5),i18nEbusinessAmazonIndex=exports.i18nEbusinessAmazonIndex={_btnListener:function(){_gift.i18nEbusinessAmazonGift.init()},_close:function(e,n){(0,_wowPage.wowLog)("5.16.1.1.3",{close:e?0:1}),this._remove(),n&&(0,_util.setNeverShow)()},_remove:function(){console.log("[i18n-ebusiness-amazon] remove index"),this._el.parentElement.removeChild(this._el)},render:function(){var e=this,n='\n      <div class="uc-i18n-ebusiness-amazon-index">\n        <div class="uc-i18n-ebusiness-amazon-index-box">\n          <div class="close"></div>\n          <div class="head"></div>\n          <div class="gift-box"></div>\n          <div class="gift-info">5,000 Amazon.in Vouchers (NO Use Limit)</div>\n          <button class="gift-open">OPEN</button>\n        </div>\n      </div>\n    ',i=document.createElement("div");i.innerHTML=n,document.body.appendChild(i),i.querySelector("button").addEventListener("click",function(){e._btnListener(),e._remove()}),i.querySelector(".close").addEventListener("click",function(){e._close(!1,!0)}),this._el=i.querySelector(".uc-i18n-ebusiness-amazon-index"),this.show()},show:function(){var e=this;this._el.style.display="block",setTimeout(function(){e._el.querySelector(".uc-i18n-ebusiness-amazon-index-box").style.top="200px"},10),(0,_wowPage.wowLog)("5.16.1.1.1")}};


},{"10":10,"2":2,"5":5,"7":7}],4:[function(require,module,exports){
"use strict";var getMainTemp=function(){return'\n    <div class="uc-i18n-ebusiness-gift uc-i18n-ebusiness-gift-loading">\n      <div class="uc-i18n-ebusiness-gift-cancel"></div>\n      <div class="uc-i18n-ebusiness-gift-banner"></div>\n      <div class="uc-i18n-ebusiness-gift-content">\n      </div>\n      <div class="uc-i18n-ebusiness-gift-loading-wrap">\n        <div class="uc-i18n-ebusiness-gift-loading-main"></div>\n      </div>\n      <div class="uc-i18n-ebusiness-gift-attention">Attention</div>\n      <div class="uc-i18n-ebusiness-gift-attention-detail uc-i18n-ebusiness-gift-hide">\n        1. If you have any questions about this event, you can <a target="_blank" href="https://feedback.uc.cn/feedback/feedback/index?instance=pc_client_en&lang=en&ver=5.7.16817.1002&url=http://share.ucweb.local/discuz/forum.php?spm=0.0.0.0.2AnFia&mod=viewthread&tid=238888&fromuid=12946&flash_activex_ver=16.0.0.305&flash_pepper_ver=22.0.0.209&sysinfo=bTkwAleSqhuyp0yNJmPaJuSDsGcilCwHXVL5GAejoD7KcJCNE4JnyR3Oqaqs0p%2BxnIFZYLBGZIwD%2BXmDkHH5kvplFYOnXzr2Gz1eIrpkiu6dgJftg51TM%2Bbp%2BcvJ59tiNnyNBl7QEBWFPq%2B%2BMLHGKw%2BFGIMOUU0w9L95AXJqQ5g9IkrgIBG349M7OeVXKl/ZEvnZEELdsK3HoI0a6vE1vrhxmfysis4Mfz%2B5KZu9P2ae2i0Q3FGEDQ2PefLnamxavgBXZotewCl5ES9L1CgIt7i82ZkzwZT3RpviX3mzHZ41WpV9GIL59fBf6cpOsRfgUZYQb25R/0Gfk2toNDAzemJHDYlSAOZ6hVZ716QgYgRAyMpyYfg%3D&service_ticket=wx64c30bf620471d9b25e8db1a858e01&pf=145&uc_param_str=einibicppfmivefrlantcunwsssvjbktchnnsnddds">click here</a> to get help.<br>\n        2. Amazon.in Gift Cards are subject to <a target="_blank" href="https://www.amazon.in/gp/help/customer/display.html%3FnodeId=201522810&app-nav-type=modal/ref=gcui_d_e_tc_o_d_b_w">Terms and Conditions</a>.<br>\n        3. The Organizer reserves the right of final explanations of these Rules in the event the users find them unclear.<br>\n      </div>\n    </div>\n  '},getFormTemp=function(){return'\n    <div class="uc-i18n-ebusiness-gift-voucher">Rs.20 Voucher</div>\n    <br/>\n    <input type="email" id="uc-i18n-ebusiness-gift-email" class="uc-i18n-ebusiness-gift-input" placeholder="Enter Your Email" />\n    <div class="uc-i18n-ebusiness-gift-btn" id="uc-i18n-ebusiness-gift-btn-get">GET IT</div>\n  '},getCodeTemp=function(i){var n='\n    <div class="uc-i18n-ebusiness-gift-card">\n      <span class="uc-i18n-ebusiness-gift-code">'+i.giftCode+'</span>\n    </div>\n    <div class="uc-i18n-ebusiness-gift-btn" id="uc-i18n-ebusiness-gift-btn-draw">\n      DRAW X '+i.surplusCount+"\n    </div>\n  ",e='\n    <div class="uc-i18n-ebusiness-gift-card">\n      <span class="uc-i18n-ebusiness-gift-code">'+i.giftCode+'</span>\n    </div>\n    <div class="uc-i18n-ebusiness-gift-expire">\n      <div>Thanks for your participation.</div>\n      <div>See you next Wednesday!</div>\n    </div>\n  ';return i.surplusCount<=0?e:n},getFailTemp=function(i){var n='\n    <div class="uc-i18n-ebusiness-gift-animation"></div>\n    <div class="uc-i18n-ebusiness-gift-btn" id="uc-i18n-ebusiness-gift-btn-draw">\n      DRAW X '+i.surplusCount+"\n    </div>",e='\n    <div class="uc-i18n-ebusiness-gift-expire">\n      <div>Thanks for your participation.</div>\n      <div>See you next Wednesday!</div>\n    </div>';return i.surplusCount<=0?e:n};exports.getMainTemp=getMainTemp,exports.getFormTemp=getFormTemp,exports.getCodeTemp=getCodeTemp,exports.getFailTemp=getFailTemp;


},{}],5:[function(require,module,exports){
"use strict";var getIsNeverShow=function(){var e=new Date,t=""+e.getFullYear()+e.getMonth()+e.getDate();return localStorage.getItem("i18n-ebusiness-amazon-never-show-"+t)},setNeverShow=function(){var e=new Date,t=""+e.getFullYear()+e.getMonth()+e.getDate();return localStorage.setItem("i18n-ebusiness-amazon-never-show-"+t,!0)},isAmazonHomeLink=function(){var e="",t=location.href;return e=/www\.amazon\.in\S+(&|\?)(tag=ucwebamz3-21$|tag=ucwebamz3-21&)/,e.test(t)&&"/"===location.pathname},isShow=function(){return isAmazonHomeLink()&&!getIsNeverShow()};exports.setNeverShow=setNeverShow,exports.getIsNeverShow=getIsNeverShow,exports.isShow=isShow;


},{}],6:[function(require,module,exports){
"use strict";function defer(){var e=void 0,r=void 0,n=new Promise(function(n,o){e=n,r=o});return{resolve:function(r){e(r)},reject:function(e){r(e)},promise:n}}exports.defer=defer;


},{}],7:[function(require,module,exports){
"use strict";var MSG_EVENT_I18N_EBUSINESS_AMAZON_DRAW_GIFT=exports.MSG_EVENT_I18N_EBUSINESS_AMAZON_DRAW_GIFT="i18n-ebusiness-amazon-draw-gift",MSG_EVENT_I18N_EBUSINESS_AMAZON_SHOW=exports.MSG_EVENT_I18N_EBUSINESS_AMAZON_SHOW="i18n-ebusiness-amazon-show",MSG_EVENT_I18N_EBUSINESS_AMAZON_SAVE_USERINFO=exports.MSG_EVENT_I18N_EBUSINESS_AMAZON_SAVE_USERINFO="i18n-ebusiness-amazon-save-userinfo";


},{}],8:[function(require,module,exports){
"use strict";var MSG_EVENT_STATISTIC_RECORD=exports.MSG_EVENT_STATISTIC_RECORD="statistic-record";


},{}],9:[function(require,module,exports){
"use strict";function sendMessageAsync(e,r){var t=arguments.length<=2||void 0===arguments[2]?{}:arguments[2],n=t.noReply,o=t.extId,s={type:e,data:r,sync:!1,noReply:n,d:"req"};if(n)return sendMsg(o,s),Promise.resolve();var c=guid(),d=(0,_defer.defer)();return s.guid=c,deferCache[c]=d,sendMsg(o,s),d.promise["catch"](noop)}function initPort(){deferCache=Object.create(null);try{extPort=chrome.runtime.connect({name:"page:connect"}),extPort.onMessage.addListener(onMsg),extPort.onDisconnect.addListener(function(){disposePort(),setTimeout(initPort,0)})}catch(e){console.log(e)}}function disposePort(){for(var e in deferCache){var r=deferCache[e];r&&r.reject&&r.reject("disconnect")}deferCache=Object.create(null),extPort=null}function onMsg(e){var r=e.guid,t=e.d,n=deferCache[r];if("postTab"===t){var o=bkMsgHandlers[e.type];o&&o(e.data)}else n&&"res"===t&&(e.success?n.resolve(e.data):n.reject(e.error),delete deferCache[r])}function registerMsgHandler(e,r){"function"==typeof r&&(bkMsgHandlers[e]=r)}function sendMsg(e,r){if(e&&r)throw Error("not support external");r&&(extPort?extPort.postMessage(r):chrome.runtime.sendMessage(r))}function noop(){}function guid(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+Date.now()}exports.sendMessageAsync=sendMessageAsync,exports.registerMsgHandler=registerMsgHandler;var _defer=require(6),deferCache=void 0,bkMsgHandlers=Object.create(null),extPort=void 0;"object"==typeof chrome&&chrome.runtime&&chrome.runtime.onMessage&&chrome.runtime.onMessage.addListener(onMsg),window.addEventListener("unload",function(){extPort.disconnect(),disposePort()}),initPort();


},{"6":6}],10:[function(require,module,exports){
"use strict";function wowLog(s,e){(0,_message.sendMessageAsync)(_statistic.MSG_EVENT_STATISTIC_RECORD,{id:s,param:e},{noReply:!1})}exports.wowLog=wowLog;var _message=require(9),_statistic=require(8);


},{"8":8,"9":9}]},{},[1]);
