nvc.js 10 KB

1
  1. !function(t){var e={};function n(o){if(e[o])return e[o].exports;var a=e[o]={i:o,l:!1,exports:{}};return t[o].call(a.exports,a,a.exports,n),a.l=!0,a.exports}n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:o})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=3)}([function(t,e,n){"use strict";var o=0;function a(t){if(!(this instanceof a))return new a(t);this._state=o,this._onFulfilled=[],this._onRejected=[],this._value=null,this._reason=null,s(t)&&t(r(this.resolve,this),r(this.reject,this))}function c(t,e){if(t!==e)if(function(t){return t&&s(t.then)}(e))try{e.then(function(e){c(t,e)},function(e){t.reject(e)})}catch(e){t.reject(e)}else t.resolve(e);else t.reject(new TypeError("A promise cannot be resolved with itself."))}function i(t,e,n){return function(o){if(s(e))try{var a=e(o);c(t,a)}catch(e){t.reject(e)}else t[n](o)}}function r(t,e){var n=[].slice,o=n.call(arguments,2),a=function(){},c=function(){return t.apply(this instanceof a?this:e,o.concat(n.call(arguments)))};return a.prototype=t.prototype,c.prototype=new a,c}a.prototype={constructor:a,then:function(t,e){var n=new a;return this._onFulfilled.push(i(n,t,"resolve")),this._onRejected.push(i(n,e,"reject")),this.flush(),n},flush:function(){var t=this._state;if(t!==o){var e=1===t?this._onFulfilled.slice():this._onRejected.slice(),n=1===t?this._value:this._reason;setTimeout(function(){l(e,function(t){try{t(n)}catch(t){}})},0),this._onFulfilled=[],this._onRejected=[]}},resolve:function(t){this._state===o&&(this._state=1,this._value=t,this.flush())},reject:function(t){this._state===o&&(this._state=2,this._reason=t,this.flush())},always:function(t){return this.then(t,t)}},a.defer=function(){var t={};return t.promise=new a(function(e,n){t.resolve=e,t.reject=n}),t},a.all=function(t){var e=a.defer(),n=t.length,o=[];return l(t,function(t,a){t.then(function(t){o[a]=t,0===--n&&e.resolve(o)},function(t){e.reject(t)})}),e.promise};var s=function(t){return function(e){return{}.toString.call(e)=="[object "+t+"]"}}("Function");function l(t,e){for(var n=0,o=t.length;n<o;n++)e(t[n],n)}t.exports=a},function(t,e,n){"use strict";var o=window,a=document,c=document.head||document.getElementsByTagName("head")[0],i=n(0);function r(t){var e=[];for(var n in t)t.hasOwnProperty(n)&&e.push(encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e.join("&")}t.exports={loadScript:function(t){var e=i.defer(),n=a.createElement("script");function o(){n.onreadystatechange=n.onload=null,c.removeChild(n),n=null,e.resolve()}return n.charset="utf-8",n.async=!0,"onload"in n?n.onload=o:n.onreadystatechange=function(){/loaded|complete/.test(n.readyState)&&o()},"onerror"in n&&(n.onerror=function(){e.reject()}),setTimeout(function(){e.reject()},3e3),n.src=t,c.appendChild(n),e.promise},jsonp:function(t){var e,n=0;if(t.timeout=3e3,t.times=3,!(t=t||{}).url||!t.callback)throw new Error("参数不合法");var c=("jsonp_"+Math.random()).replace(".",""),i=a.getElementsByTagName("script")[0],s="";t.data?(t.data[t.callback]=c,s+=r(t.data)):s+=t.callback+"="+c;var l=a.createElement("script");i.parentNode.insertBefore(l,i),o[c]=function(n){o[c]=function(){report("回调已执行过,不再执行"),o[c]=null};try{l.parentNode&&l.parentNode.removeChild(l)}catch(t){}clearInterval(e),t.success&&t.success(n)},l.src=t.url+(-1==t.url.indexOf("?")?"?":"&")+s,console.log("jsonp:",l.src),t.timeout&&(e=setInterval(function(){var i;if(++n>=t.times){o[c]=function(){},clearInterval(e);try{l.parentNode&&l.parentNode.removeChild(l)}catch(t){}t.fail(1)}else try{l.parentNode&&l.parentNode.removeChild(l),l=a.createElement("script"),(i=a.getElementsByTagName("script")[0]).parentNode.insertBefore(l,i),l.src=t.url+(-1==t.url.indexOf("?")?"?":"&")+s+"&t="+Math.random()}catch(t){}},t.timeout))},jsonp2:function(t){var e=("jsonp_"+Math.random()).replace(".",""),n=a.getElementsByTagName("script")[0],c="";t.data?(t.data[t.callback]=e,c+=r(t.data)):c+=t.callback+"="+e;var i=a.createElement("script");n.parentNode.insertBefore(i,n),o[e]=function(e){t.success&&t.success(e)},i.src=t.url+(-1==t.url.indexOf("?")?"?":"&")+c},extend:function(t){for(var e,n,o=[].slice.call(arguments),a=o.length,c=1;c<a;c++)for(n in e=o[c])e.hasOwnProperty(n)&&("Flag"===n&&t[n]?t[n]=t[n]|e[n]:t[n]=e[n]);return t}}},function(t,e,n){"use strict";var o=n(1),a={SendMethod:8,LogVal:"_nvc",MaxMCLog:10,MaxKSLog:10,MaxMPLog:50,MaxTCLog:10,MaxFocusLog:1,MPInterval:4,Sync:!0},c="?_t="+Math.ceil((new Date).getTime()/36e5),i={cn:{umid:"https://g.alicdn.com/security/umscript/3.3.25/um.js",awsc:"https://g.alicdn.com/AWSC/AWSC/awsc.js"+c,umid_serUrl:"https://ynuf.aliapp.org/service/um.json",nvc_sendUrl:"https://cf.aliyun.com/nvc/nvcAnalyze.jsonp",nc_url:"https://g.alicdn.com/sd/ncpc/nc.js"+c,nc_h5_url:"https://g.alicdn.com/sd/nch5/index.js"+c,lc_url:"https://g.alicdn.com/sd/quizCaptcha/0.0.1/index.js",lc_url2:"https://g.alicdn.com/mtb/lib-flexible/0.3.4/??flexible_css.js,flexible.js"},us:{umid:"https://aeis.alicdn.com/security/umscript/3.3.25/um.js",umid_serUrl:"https://us.ynuf.aliapp.org/service/um.json"}},r=function(){for(var t,e=document.getElementsByTagName("script"),n=/ctlv?\.js/,o=0;o<e.length;o++)if(t=s(e[o]),n.test(t))return e[o];return e[e.length-1]}().getAttribute("data-env")||"cn";function s(t){return t.hasAttribute?t.src:t.getAttribute("src",4)}t.exports={env:r,url:i[r],map:{def:o.extend({Flag:1670350},a),pc:o.extend({Flag:97422},a),h5:o.extend({Flag:1670350},a)}}},function(t,e,n){"use strict";var o=window;o.__nvc_uaboption=new Object,o.__nvc_uaboption.MPInterval=4,o.__nvc_uaboption.MMInterval=5,o.__nvc_uaboption.MaxMCLog=12,o.__nvc_uaboption.MaxKSLog=14,o.__nvc_uaboption.MaxMPLog=5,o.__nvc_uaboption.MaxFocusLog=6,o.__nvc_uaboption.SendInterval=5,o.__nvc_uaboption.SendMethod=8,o.__nvc_uaboption.GPInterval=50,o.__nvc_uaboption.MaxGPLog=1,o.__nvc_uaboption.MaxTCLog=12,o.__nvc_uaboption.Flag=3767502,o.__nvc_uaboption.OnlyHost=1,o.__nvc_uaboption.MaxMTLog=500,o.__nvc_uaboption.MinMTDwnLog=30,o.__nvc_uaboption.MaxNGPLog=1,NVC_Opt.customWidth||(NVC_Opt.customWidth=300);var a=n(0),c=n(2),i=n(1),r=n(4),s=o.UA_Opt=o.UA_Opt||NVC_Opt;s.Token=NVC_Opt.token,(o.nvc={config:function(){o.UA_Opt&&o.UA_Opt.LogVal||(i.extend(s,c.map.def),s.LogVal&&(o[s.LogVal]=""))}}).config(),o.__nvc__umid="defaultToken1_awsc_not_loaded@@"+location.href+"@@"+(new Date).getTime(),i.loadScript(c.url.awsc).then(function(){o.__nvc__umid="defaultToken1_um_not_loaded@@"+location.href+"@@"+(new Date).getTime(),o.AWSC.use("um",function(t,e){"loaded"===t?(o.__nvc__umid="defaultToken3_init_callback_not_called@@"+location.href+"@@"+(new Date).getTime(),e.init({timeout:3e3,timestamp:(new Date).getTime(),serviceUrl:c.url.umid_serUrl,appName:NVC_Opt.appkey,enableFY:1,jf:1},function(t,e){o.__nvc__umid="success"===t?e.tn:"defaultToken4_init_failed with "+t+"@@"+location.href+"@@"+(new Date).getTime()})):o.__nvc__umid="defaultToken2_load_failed with "+t+"@@"+location.href+"@@"+(new Date).getTime()}),o.AWSC.use("uab",function(t,e){"loaded"===t&&(o.__nvc__uab=e)})}),o.getNVCVal=function(){o.NVC_Data.a=NVC_Opt.appkey,o.NVC_Data.c=NVC_Opt.token,o.NVC_Data.d=NVC_Opt.scene,o.NVC_Data.h=NVC_Opt.trans||{},o.NVC_Data.h.umidToken=o.__nvc__umid;var t=o.NVC_Data;return t.b=o.__nvc__uab&&o.__nvc__uab.getUA&&o.__nvc__uab.getUA(o.__nvc_uaboption)||o[s.LogVal],NVC_Result.nvcPreRes.c&&(t.e=NVC_Result.nvcPreRes.c),NVC_Result.sessionId&&(t.f=NVC_Result.sessionId),NVC_Result.sig&&(t.g=NVC_Result.sig),encodeURIComponent(JSON.stringify(t))},o.getNC=function(){var t=a.defer();return NVC_Opt.popUp&&r.insertDom(1),o.acjs=1,i.loadScript(c.url.nc_url).then(function(){var e={language:"zh_CN",isEnabled:!0,callback:function(t){NVC_Result.sessionId=t.csessionid,NVC_Result.sig=t.sig,NVC_Opt.popUp&&r.hideDom(1),NVC_Opt.nvcCallback&&NVC_Opt.nvcCallback(getNVCVal())},failCallback:function(t){},error:function(t){}},n=new noCaptcha;n.init(i.extend(e,NVC_Opt)),o._nvc_nc=n,t.resolve()}),NVC_Data.c=s.Token,t.promise},o.getLC=function(){var t=a.defer();return NVC_Opt.popUp&&(NVC_Opt.customWidth=480,r.insertDom(3)),i.loadScript(c.url.lc_url).then(function(){var e=new quizCaptcha({appKey:NVC_Opt.appkey,scene:NVC_Opt.scene,renderTo:NVC_Opt.renderTo,popUp:!NVC_Opt.popUp&&NVC_Opt.popUp,success:function(t){NVC_Result.sessionId=t.sessionId,NVC_Result.sig=t.sig,NVC_Opt.popUp&&r.hideDom(3),NVC_Opt.nvcCallback&&NVC_Opt.nvcCallback(getNVCVal()),NVC_Opt.callback&&NVC_Opt.callback({value:t.sig,csessionid:t.sessionId})},token:NVC_Opt.token});e.init(),o._nvc_qc=e,t.resolve()}),NVC_Data.c=s.Token,t.promise},o.getSC=function(){var t=a.defer();return NVC_Opt.popUp&&r.insertDom(2),o.acjs=1,i.loadScript(c.url.nc_url).then(function(){var e={elementID:[],is_Opt:"",type:"scrape",width:300,height:100,isEnabled:!0,timeout:3e3,times:3,language:"cn",foreign:0,apimap:{},objects:["https://img.alicdn.com/tps/TB1BT9jPFXXXXbyXFXXXXXXXXXX-80-80.png"],callback:function(t){NVC_Result.sessionId=t.sessionId,NVC_Result.sig=t.sig,NVC_Opt.popUp&&r.hideDom(2),NVC_Opt.nvcCallback&&NVC_Opt.nvcCallback(getNVCVal())},failCallback:function(t){},error:function(t){}},n=new noCaptcha(i.extend(e,NVC_Opt));o._nvc_sc=n,t.resolve()}),NVC_Data.c=s.Token,t.promise},o.nvcReset=function(){o.NVC_Data&&o.NVC_Data.f&&(o.NVC_Data.f=null),o.NVC_Data&&o.NVC_Data.g&&(o.NVC_Data.g=null),o.NVC_Result&&o.NVC_Result.sessionId&&(o.NVC_Result.sessionId=null),o.NVC_Result&&o.NVC_Result.sig&&(o.NVC_Result.sig=null)},o.NVC_Data={a:NVC_Opt.appkey,c:NVC_Opt.token,d:NVC_Opt.scene},NVC_Opt.trans&&(NVC_Data.h=NVC_Opt.trans),NVC_Data.j={},NVC_Data.j.test=1,400==NVC_Opt.capCode?getNC():600==NVC_Opt.capCode&&getSC()},function(t,e,n){"use strict";var o=document,a=window;function c(){o.getElementById("nc_nvc_wrapper").style.display="none"}t.exports={insertDom:function(t){var e=o.getElementById("nc_nvc_wrapper");if(e)e.style.display="";else{var n=o.createElement("div");n.id="nc_nvc_wrapper",n.style.position="absolute",n.style.zIndex="999",n.style.backgroundColor="white";var c=0;1==t?(n.style.borderBottom="1px solid #ccc",c=17):2==t?(n.style.border="1px solid #ccc",c=165):3==t&&(n.style.border="1px solid #ccc",c=400),n.style.left=parseInt((a.innerWidth-NVC_Opt.customWidth)/2)+"px",n.style.top=parseInt((a.innerHeight-c)/2)+"px",o.getElementById(NVC_Opt.renderTo.substring(1)).appendChild(n),NVC_Opt.renderTo="#nc_nvc_wrapper"}},hideDom:function(t){var e=400;2==t&&(e=800),setTimeout(c,e)}}}]);