/*! For license information please see gysdk-min.js.LICENSE.txt */ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("axios")):"function"==typeof define&&define.amd?define(["axios"],t):"object"==typeof exports?exports.GyManager=t(require("axios")):e.GyManager=t(e.axios)}(window,(function(__WEBPACK_EXTERNAL_MODULE__6__){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=14)}([function(e,t,n){"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.PLATFORM="h5",e.SDK_VERSION="GYH5-1.0.2.0",e.TIME_OUT=3e4,e.PRODUCTION=!0,e.HTTP_HOST=e.PRODUCTION?"https://h-gy.getui.net":"https://geshu-ld.getui.com:5003";e.SERVER_PUBLIC_KEY="-----BEGIN PUBLIC KEY-----"+(e.PRODUCTION?"MHwwDQYJKoZIhvcNAQEBBQADawAwaAJhAJp1rROuvBF7sBSnvLaesj2iFhMcY8aXyLvpnNLKs2wjL3JmEnyr++SlVa35liUlzi83tnAFkn3A9GB7pHBNzawyUkBh8WUhq5bnFIkk2RaDa6+5MpG84DEv52p7RR+aWwIDAQAB":"MHwwDQYJKoZIhvcNAQEBBQADawAwaAJhAMltTBkk0HDen5gSn2gX5n4EoBlaQWc0S+d2X6BEPBWpktX8IJk14QbVRFAB2YJlM7kkq+g2jaDVXo+rEq539xJhBPId7hf1a3hhk/qOF0Z4n8pI0URBEGK/IeJr9Ktb8wIDAQAB")+"-----END PUBLIC KEY-----",e.SERVER_PUBLIC_KEY_ID=e.PRODUCTION?"69d747c4b9f641baf4004be4297e9f3b":"fe078ec968ebae837c563bbc73c4672d"}(r||(r={})),t.default=r},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=r(n(5)),o=r(n(0)),a=r(n(15)),s=r(n(10)),c=r(n(13)),u=r(n(9)),l=r(n(3)),p=r(n(26)),d=n(7);class h{static init(e){this.startInitTime=(new Date).getTime();let t=c.default.getSync(c.default.KEY_GYUID,"");t||(t=this.getUuid(),c.default.setSync(c.default.KEY_GYUID,t)),this.gyuid=t,this.gyuid,this.app=e.app,this.appid=e.appid,this.timeout=e.timeout&&e.timeout>0?e.timeout:o.default.TIME_OUT;const n=e.onResult;p.default.register({success:e=>{this.getMenuKey(n)},failed:e=>{const t=u.default.createProcessId(),r=window.navigator.onLine?d.GyErrorCode.SERVER_RETURN_ERROR:d.GyErrorCode.NO_NET;u.default.uploadBiObj({action:u.default.ACTION_INIT,codeDesc:r,ext:e,processId:t}),i.default.info("init error :"+e),s.default.initStatus=s.default.INIT_FAILED,n(d.GyResponse.create({actionCode:d.GyResponse.CODE_UNKOWN_ERROR,codeDesc:r,processId:t,costTime:(new Date).getTime()-this.startInitTime,metadata:e}))}})}static getMenuKey(e){a.default.getMenuKey({success:t=>{const n=u.default.createProcessId();u.default.uploadBiObj({action:u.default.ACTION_INIT,codeDesc:d.GyErrorCode.SUCCESS,ext:(new Date).getTime()-this.startInitTime,processId:n}),i.default.info("init success"),s.default.initStatus=s.default.INIT_SUCCESS,this.oneLoginWebId=t.oneLoginWebId,this.oneLoginWebKey=t.oneLoginWebKey,this.onePassWebId=t.onePassWebId,this.onePassWebKey=t.onePassWebKey,e(d.GyResponse.create({actionCode:d.GyResponse.CODE_SUCCESS,codeDesc:d.GyErrorCode.SUCCESS,processId:n,costTime:(new Date).getTime()-this.startInitTime}))},failed:t=>{const n=u.default.createProcessId(),r=window.navigator.onLine?d.GyErrorCode.SERVER_RETURN_ERROR:d.GyErrorCode.NO_NET;u.default.uploadBiObj({action:u.default.ACTION_INIT,codeDesc:r,ext:t,processId:n}),i.default.info("init error :"+t),s.default.initStatus=s.default.INIT_FAILED,e(d.GyResponse.create({actionCode:d.GyResponse.CODE_UNKOWN_ERROR,codeDesc:r,processId:n,costTime:(new Date).getTime()-this.startInitTime,metadata:t}))}})}static getUuid(){let e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){let t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}));return l.default.md5(e)}}t.default=h,h.oneLoginWebId="",h.oneLoginWebKey="",h.onePassWebId="",h.onePassWebKey="",h.gyuid="",h.appid="",h.app="",h.startInitTime=0},function(e,t,n){"use strict";function r(e){return Array.isArray?Array.isArray(e):"[object Array]"===m(e)}function i(e){return"boolean"==typeof e}function o(e){return null===e}function a(e){return null==e}function s(e){return"number"==typeof e}function c(e){return"string"==typeof e}function u(e){return"symbol"==typeof e}function l(e){return void 0===e}function p(e){return"[object RegExp]"===m(e)}function d(e){return"object"==typeof e&&null!==e}function h(e){return"[object Date]"===m(e)}function f(e){return"[object Error]"===m(e)||e instanceof Error}function g(e){return"function"==typeof e}function y(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function m(e){return Object.prototype.toString.call(e)}function v(e,t){if(!e)throw new Error(t)}n.r(t),n.d(t,"isArray",(function(){return r})),n.d(t,"isBoolean",(function(){return i})),n.d(t,"isNull",(function(){return o})),n.d(t,"isNullOrUndefined",(function(){return a})),n.d(t,"isNumber",(function(){return s})),n.d(t,"isString",(function(){return c})),n.d(t,"isSymbol",(function(){return u})),n.d(t,"isUndefined",(function(){return l})),n.d(t,"isRegExp",(function(){return p})),n.d(t,"isObject",(function(){return d})),n.d(t,"isDate",(function(){return h})),n.d(t,"isError",(function(){return f})),n.d(t,"isFunction",(function(){return g})),n.d(t,"isPrimitive",(function(){return y})),n.d(t,"objectToString",(function(){return m})),n.d(t,"checkArgument",(function(){return v})),n.d(t,"getNetworkType",(function(){return C}));const b=["cellular","2g","3g","4g","5g","3G/2G"];function C(){var e,t=navigator.userAgent.toLowerCase(),n=navigator.connection||navigator.mozConnection||navigator.webkitConnection||{type:"unknown"};if(/micromessenger/.test(t))if(-1!==t.indexOf("nettype"))e=(e=t.match(/nettype\/\w+/)?t.match(/nettype\/\w+/)[0]:"nettype/unknow").replace("nettype/","");else{var r={"network_type:wifi":"wifi","network_type:edge":"3G/2G","network_type:fail":"fail","network_type:wwan":"3G/2G"};document.addEventListener("WeixinJSBridgeReady",(function(){WeixinJSBridge.invoke("getNetworkType",{},(function(t){e=r[t.err_msg]}))}))}else e=n&&n.type||"unknown";return e&&-1!==b.indexOf(e)?"cellular":"wifi"===e?"wifi":"unknown"}},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=r(n(0)),o=r(n(18));class a{constructor(e){a.init(),this.body=e;let t=o.default.util.encode64(a.aesKey),n=o.default.md.sha256.create();n.update(i.default.SERVER_PUBLIC_KEY_ID+t+e,"utf8"),this.sign=o.default.util.encode64(n.digest().data);let r=o.default.md.md5.create();r.update(this.sign),this.iv=r.digest().data}static init(){if(!this.aesKey||!this.xak){let e=o.default.pki.publicKeyFromPem(i.default.SERVER_PUBLIC_KEY);this.aesKey=o.default.random.getBytesSync(16);let t=e.encrypt(this.aesKey,"RSA-OAEP",{mdf:o.default.mgf.mgf1.create(o.default.md.sha1.create())});this.xak=o.default.util.encode64(t)}}getXTP(e){return e?"4":"3"}getXKD(){return i.default.SERVER_PUBLIC_KEY_ID}getXV(){return"1.0.0.0"}getXTL(){return"10"}getXAK(){return a.xak}getXSG(){return this.sign}getEncryptedBody(){let e=o.default.cipher.createCipher("AES-CFB",a.aesKey);e.start({iv:this.iv}),e.update(o.default.util.createBuffer(this.body,"utf8")),e.finish();const t=e.output,n=new Int8Array(t.length());for(let e=0;ea.time?r:a:r?n=r:a&&(n=a),n)if(1==n.value)t.value=1,t.name="CM";else if(3==n.value)t.value=2,t.name="CU";else{const n=(0,o.getNetworkType)();(e||"wifi"!=n&&"unknown"!=n)&&(t.value=3,t.name="CT")}return t}}(a||(a={})),t.default=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});class r{static info(...e){const t=e.length;if(this.debugMode){switch(e.length){case 1:console.info("[GyH5]",e[0]);break;case 2:console.info("[GyH5]",e[0],e[1]);break;case 3:console.info("[GyH5]",e[0],e[1],e[2]);break;default:console.info("[GyH5]",e)}}else switch(t){case 1:e[0];break;case 2:e[0],e[1];break;case 3:e[0],e[1],e[2]}}static error(...e){switch(e.length){case 1:console.error("[GyH5]",e[0]);break;case 2:console.error("[GyH5]",e[0],e[1]);break;case 3:console.error("[GyH5]",e[0],e[1],e[2]);break;default:console.error("[GyH5]",e)}}}r.debugMode=!1,t.default=r},function(e,t){e.exports=__WEBPACK_EXTERNAL_MODULE__6__},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.CT_ERROR_CODE=t.CU_ERROR_CODE=t.CM_ERROR_CODE=t.PASS_ERROR_CODE=t.LOGIN_ERROR_CODE=t.GyErrorCode=t.CodeDesc=t.codeToMessage=t.codeToGyErrorCode=t.GyResponse=void 0;const i=r(n(4)),o=r(n(5)),a=n(2),s=r(n(1));class c{constructor(){this.gyuid="",this.clientType="h5",this.code=0,this.success=!1,this.processId="",this.errorCode=0,this.errorDesc="",this.operatorType="",this.costTime=-1}static create(e,t=!1){const n=i.default.getOperator(t),r=e.actionCode==c.CODE_SUCCESS,o={gyuid:s.default.gyuid,success:r,code:e.actionCode,clientType:"h5",errorCode:e.codeDesc.code,errorDesc:e.codeDesc.desc,operatorType:n.name,costTime:e.costTime,processId:e.processId};return e.phone&&(o.phone=e.phone),e.accesscode&&(o.accesscode=e.accesscode),!r&&e.metadata&&(o.metadata=e.metadata),o}}t.GyResponse=c,c.CODE_SUCCESS=3e4,c.CODE_UNKOWN_ERROR=30004,c.CODE_PRELOGIN_ERROR=30005,c.CODE_PREVERIFY_ERROR=30007,t.codeToGyErrorCode=function(e,n){try{if(!window.navigator.onLine)return t.GyErrorCode.NO_NET;if("wifi"==(0,a.getNetworkType)())return t.GyErrorCode.NO_MOBILE_DATA;if(n)switch(e){case 10010:case 10030:case 10031:case 10032:case 10040:return t.GyErrorCode.NO_MOBILE_DATA;case 10012:return t.GyErrorCode.PARAM_ERROR;case 4e4:return t.GyErrorCode.UNSUPPORT_OPERATOR;case 30001:return t.GyErrorCode.LOGIN_PAGE_DISMISSED;case 30002:return t.GyErrorCode.SWITCH_LOGIN_PAGE}else switch(e){case 100:case 102:case 103:case 105:case 106:case 107:return t.GyErrorCode.NO_MOBILE_DATA;case 101:return t.GyErrorCode.PARAM_ERROR}}catch(t){o.default.error("codeToGyErrorCode",e,t)}return t.GyErrorCode.OPERATOR_RETURN_ERROR},t.codeToMessage=function(e,n){let r;try{r=n?t.LOGIN_ERROR_CODE[e]:t.PASS_ERROR_CODE[e],r||(r=t.CM_ERROR_CODE[e]),r||(r=t.CU_ERROR_CODE[e]),r||(r=t.CT_ERROR_CODE[e])}catch(t){o.default.error("codeToMessage",e,t)}return r||(r="未知异常"),r};class u{constructor(e,t){this.code=t,this.desc=e}}t.CodeDesc=u,t.GyErrorCode={SUCCESS:new u("gysdk success!",0),SDK_NOT_INITED:new u("gysdk没有初始化!",-1e4),SDK_INIT_ERROR:new u("gysdk初始化失败!",-10001),OPERATE_TIMEOUT:new u("gysdk请求超时!",-10003),OPERATE_DOING:new u("gysdk上一个请求正在进行中,请稍后再试!",-10006),UNKOWN_ERROR:new u("gysdk其他错误,具体见msg!",-10009),PARAM_ERROR:new u("gysdk传入参数错误!",-20100),APPID_EMPTY:new u("gysdk appid为空!",-20101),APPID_INVALID:new u("gysdk appid或者签名无效!",-20102),INVALID_PRELOGIN:new u("gysdk预登录无效!",-20104),NO_NET:new u("gysdk无网络可用!",-20200),NO_SIM_CARD:new u("没有电话卡!",-20201),NO_MOBILE_DATA:new u("未开启蜂窝网络!",-20202),UNSUPPORT_OPERATOR:new u("不支持的运营商!",-20203),SHOW_LOGIN_ERROR:new u("启动登录页失败!",-20304),GET_OPERATOR_APPID_ERROR:new u("获取运营商APPID失败!",-20500),SERVER_RETURN_ERROR:new u("服务器返回错误!",-30001),OPERATOR_RETURN_ERROR:new u("运营商返回错误,具体见metadata!",-40001),LOGIN_PAGE_DISMISSED:new u("退出登录页面!",-20301),SWITCH_LOGIN_PAGE:new u("切换登录!",-20303),AUTH_PAGE_ERROR:new u("授权页面加载异常!",-20304),PRIVACY_NOT_CHECKED:new u("协议未同意!",-20305),UI_NOT_COMPLIANCED:new u("界面不合规!",-20306),ON_CLICK_EXCEPTION:new u("loginOnClickListener异常!",-20307)},t.LOGIN_ERROR_CODE={10010:"pre_get_token 接口网络错误",10012:"pre_get_token 返回错误",10030:"移动获取pretoken接口网络失败",10031:"移动获取token失败",10032:"移动获取脱敏手机号失败,非移动流量访问或者非本机号码",10033:"移动获取脱敏手机号失败",10040:"联通获取token失败",10041:"联通验签失败",4e4:"目前不支持当前运营商",30001:"关闭授权页",30002:"用户点击切换其他登录方式按钮,关闭授权页",10051:"电信预取号失败",10052:"电信授权失败或者校验失败"},t.PASS_ERROR_CODE={100:"pre_gateway接口网络失败",101:"pre_gateway接口返回数据错误",102:"接口网络失败",103:"电信接口失败",104:"移动接口失败",105:"record_token接口网络失败",106:"record_token接口失败",107:"联通接口失败",108:"切换运营商接口失败"},t.CM_ERROR_CODE={102507:"登录超时(授权页点登录按钮时,网络信号较差或者配置的超时时间较短)",103102:"包签名错误(后台填写的 APPID 和对应的包名包签名必须一致)",103111:"错误的运营商请求,可能是用户正在使用代理或者运营商判断失败导致",103511:"服务器 IP 白名单校验失败",103911:"token 请求过于频繁,10 分钟内获取 token 且未使用的数量不超过30个",104201:"token 已失效或不存在,重复校验或失效",105001:"联通卡请求移动 SDK 进行取号失败,或者手机卡运营商识别错误",105002:"移动取号失败,可能物联网卡,不允许取号\t",105003:"电信卡请求移动 SDK 进行取号失败,或者手机卡运营商识别错误",105012:"电信卡请求移动 SDK 进行取号失败,或者手机卡运营商识别错误",105013:"联通卡请求移动 SDK 进行取号失败,或者手机卡运营商识别错误",200072:"CA根证书校验失败"},t.CU_ERROR_CODE={303:"应用访问接口次数超日限额",1001:"请求已失效",3004:"使用 3GNET 网络取号失败",3005:"WIFI 网络下取号失败,或者手机系统限制切换数据失败",3009:"非联通卡请求SDK SDK 进行取号失败,或者手机卡运营商识别错误",3011:"源 IP 鉴权失败,用户的公网非联通 3/4G 网关的 IP",102001:"选择流量通道失败,取号功能必须使用流量访问,在 WIFI 和流量同时开启的情况下,SDK 会选择使用流量进行访问,此返回码代表切换失败!(受不同机型的影响)",201001:"操作频繁请请稍后再试",302002:"网络访问异常 SDK",302003:"服务端数据格式出错",1102:"1、公网 IP 无效;2、同102001 返回码"},t.CT_ERROR_CODE={"-65":"API-request-rates-Exceed-Limitations(调用接口超限),一定时间内连续调用次数较多","-10001":"取号失败 1、3G 网络取号失败","-10006":"电信网络,Mdn取号失败,可能是在非 4G 网络下请求","-10008":"超过预设取号阀值","-10009":"时间戳过期","-10016":"安全参数不完整,安全校验失败","-8003":"网络状况较差或者配置的超时时间较短,请求超时",8e4:"网络状况较差或者配置的超时时间较短,请求超时","-8005":"调用 SDK 前没有调用初始化方法",80103:"调用 SDK 前没有调用初始化方法","-8100":"移动数据网络未开启或者未允许当前 APP 使用移动数据网络",80004:"移动数据网络未开启或者未允许当前 APP 使用移动数据网络","-8104":"网络问题导致 IO 异常",80007:"网络问题导致 IO 异常",30002:"无法识别用户网络,非电信用户服务识别运营商",51114:"获取数据不存在 1、AccessCode 只能使用一次 2、AccessCode 过期(默认一小时缓存)"}},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=r(n(6)),o=n(2),a=r(n(0)),s=r(n(1)),c=r(n(4)),u=r(n(13)),l=r(n(3)),p=n(7);var d;!function(e){function t(e){try{const t={log:e};let r=JSON.stringify(t);const o=new l.default(r),u=o.getEncryptedBody();(0,i.default)({headers:c.default.appendCryptoHeaders({"Content-Type":"application/json; charset=utf-8"},o),timeout:s.default.timeout,method:"POST",url:a.default.HTTP_HOST+"/gylogcenter/json/gyps/v1/type2",data:u,responseType:"arraybuffer"}).then((e=>{const t=o.getDecryptedBody(e.data),n=JSON.parse(t);if(0!=n.errno||"success"!=n.errcode)throw n})).catch((t=>{n(e)}))}catch(e){}}function n(e){try{if(e){const t=r();t.push(e),u.default.setSync(u.default.KEY_HISTORY_BI_DATA,JSON.stringify(t))}}catch(e){}}function r(){try{let e=u.default.getSync(u.default.KEY_HISTORY_BI_DATA,null);if(e)return JSON.parse(e)}catch(e){}return[]}e.ACTION_INIT="init",e.ACTION_PRE_LOGIN="preLogin",e.ACTION_GET_ACCESS_CODE="getAccessCode",e.uploadBiObj=function(e,n=!1){try{const r=e.codeDesc.code==p.GyErrorCode.SUCCESS.code,i=c.default.getOperator(n);let u,l=e.ext;r&&(0,o.isNumber)(l)&&(l={costTime:l}),u=(0,o.isError)(l)?l.message:(0,o.isString)(l)?l:JSON.stringify(l),u?(u=u.replace("|","#"),u=u.replace("\n","#"),u=u.replace("\r","#")):u="";let d=(0,o.getNetworkType)(),h=1;"wifi"==d?(h=2,d=""):"unknown"==d&&(h=0,d=""),t(s.default.appid+"|"+s.default.app+"|"+s.default.gyuid+"|h5|"+a.default.SDK_VERSION+"|"+e.action+"|JY|"+i.value+"|"+h+"|"+r+"|"+(r?200:e.codeDesc.code)+"|"+e.processId+"|"+(new Date).getTime()+"|"+u+"|")}catch(e){}},e.upload=t,e.saveBiData=n,e.getBiDatas=r;let d=0;e.createProcessId=function(){const e=s.default.gyuid+(new Date).getTime()+ ++d;return l.default.md5(e)}}(d||(d={})),t.default=d},function(e,t,n){"use strict";var r,i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const o=i(n(5)),a=i(n(1)),s=i(n(11)),c=i(n(27)),u=i(n(9)),l=n(7);class p{static init(e){if(this.initStatus!=this.INIT_SUCCESS)if(this.initStatus!=this.INIT_ING)try{this.initStatus=this.INIT_ING,o.default.info(`init: appid=${e.appid}`),a.default.init(e)}catch(e){throw this.initStatus=this.INIT_FAILED,e}else o.default.info("sdk is calling init method, repeat call not allowed");else{(0,e.onResult)(l.GyResponse.create({actionCode:l.GyResponse.CODE_SUCCESS,codeDesc:l.GyErrorCode.SUCCESS,processId:"",costTime:0}))}}static oneLogin(e){if(!a.default.oneLoginWebId)return void o.default.error(`app_id:${a.default.appid},应用正在审核中,或者审核未通过`);const t=(new Date).getTime(),n=u.default.createProcessId(),r=e.onTokenSuccess,i=e.onTokenFail;e.app_id=a.default.oneLoginWebId,e.app=a.default.app,e.timeout=a.default.timeout;const p=new s.default.OneLogin(e);p.onTokenSuccess((e=>{c.default.upload(e);const i=(new Date).getTime()-t;u.default.uploadBiObj({action:u.default.ACTION_PRE_LOGIN,codeDesc:l.GyErrorCode.SUCCESS,ext:i,processId:n},!0),r(l.GyResponse.create({actionCode:l.GyResponse.CODE_SUCCESS,codeDesc:l.GyErrorCode.SUCCESS,processId:n,costTime:i,accesscode:c.default.generatePreLoginAccesscode(e),phone:e.phone,metadata:e},!0))})).onTokenFail((e=>{const r=(0,l.codeToGyErrorCode)(e.code,!0),o=Object.assign({desc:(0,l.codeToMessage)(e.code,!0)},e);u.default.uploadBiObj({action:u.default.ACTION_PRE_LOGIN,codeDesc:r,ext:o,processId:n}),i(l.GyResponse.create({actionCode:l.GyResponse.CODE_PRELOGIN_ERROR,codeDesc:r,metadata:o,processId:n,costTime:(new Date).getTime()-t})),p.destory()})),p.gateway()}static onePass(e){if(!a.default.onePassWebId)return void o.default.error(`app_id:${a.default.appid},应用正在审核中,或者审核未通过`);const t=(new Date).getTime(),n=u.default.createProcessId(),r=e.onGatewayFail,i=e.onGatewaySuccess,p=new s.default.OnePass({pre_init:!0,app_id:a.default.onePassWebId,timeout:a.default.timeout});p.onGatewaySuccess((e=>{const r=(new Date).getTime()-t;u.default.uploadBiObj({action:u.default.ACTION_GET_ACCESS_CODE,codeDesc:l.GyErrorCode.SUCCESS,ext:r,processId:n},!0),i(l.GyResponse.create({actionCode:l.GyResponse.CODE_SUCCESS,codeDesc:l.GyErrorCode.SUCCESS,processId:n,costTime:r,accesscode:c.default.generateVerifyAccesscode(e),phone:e.phone,metadata:e},!0))})).onGatewayFail((e=>{const i=(0,l.codeToGyErrorCode)(e.code,!1),o=Object.assign({desc:(0,l.codeToMessage)(e.code,!1)},e);u.default.uploadBiObj({action:u.default.ACTION_GET_ACCESS_CODE,codeDesc:i,ext:o,processId:n}),r(l.GyResponse.create({actionCode:l.GyResponse.CODE_PREVERIFY_ERROR,codeDesc:i,metadata:o,processId:n,costTime:(new Date).getTime()-t}))})),p.gateway({phone:e.phone})}}t.default=p,r=p,p.NOT_INIT=0,p.INIT_ING=1,p.INIT_SUCCESS=2,p.INIT_FAILED=3,p.initStatus=r.NOT_INIT},function(e,t,n){"use strict";n.r(t);let r={OneLogin:n(16),OnePass:n(17)};t.default=r},function(e,t){var n,r,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(e){if(n===setTimeout)return setTimeout(e,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(e){n=o}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(e){r=a}}();var c,u=[],l=!1,p=-1;function d(){l&&c&&(l=!1,c.length?u=c.concat(u):p=-1,u.length&&h())}function h(){if(!l){var e=s(d);l=!0;for(var t=u.length;t;){for(c=u,u=[];++p1)for(var n=1;n{const n=r.getDecryptedBody(t.data),i=JSON.parse(n),o=c.default.adapt(i);if(!o.success)throw p=!0,i;e.success(o.data.jy)})).catch((t=>{p||(0,o.isString)(t)?e.failed(t):(0,o.isError)(t)?e.failed(t.message?t.message:"server error"):e.failed("network error")}))}}(l||(l={})),t.default=l},function(module,exports,__webpack_require__){var e;e=function(){"use strict";function ownKeys(e,t){var n,r=Object.keys(e);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(e),t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)),r}function _objectSpread2(e){for(var t=1;t>5]|=128<>>9<<4)]=t;for(var n=1732584193,r=-271733879,i=-1732584194,o=271733878,a=0;a>16)+(t>>16)+(n>>16)<<16|65535&n}function bit_rol$1(e,t){return e<>>32-t}function str2binl$1(e){for(var t=Array(),n=(1<>5]|=(e[_0x4268("0x75")](r/chrsz$1)&n)<>2]>>r%4*8+4&15)+t.charAt(e[r>>2]>>r%4*8&15);return n}(Ce=function(e){var t=Array[_0x4268("0x59")].forEach,n=Array[_0x4268("0x59")][_0x4268("0x76")];this.each=function(e,n,r){if(null!==e)if(t&&e[_0x4268("0x23")]===t)e[_0x4268("0x23")](n,r);else if(e[_0x4268("0xca")]===+e.length){for(var i=0,o=e[_0x4268("0xca")];i>>16)*s&65535)<<16)&4294967295)<<15|r>>>17))*c+(((r>>>16)*c&65535)<<16)&4294967295)<<13|a>>>19))+((5*(a>>>16)&65535)<<16)&4294967295))+((58964+(n>>>16)&65535)<<16);switch(r=0,i){case 3:r^=(255&e.charCodeAt(u+2))<<16;case 2:r^=(255&e[_0x4268("0x75")](u+1))<<8;case 1:a^=r=(65535&(r=(r=(65535&(r^=255&e[_0x4268("0x75")](u)))*s+(((r>>>16)*s&65535)<<16)&4294967295)<<15|r>>>17))*c+(((r>>>16)*c&65535)<<16)&4294967295}return a^=e[_0x4268("0xca")],a=2246822507*(65535&(a^=a>>>16))+((2246822507*(a>>>16)&65535)<<16)&4294967295,a=3266489909*(65535&(a^=a>>>13))+((3266489909*(a>>>16)&65535)<<16)&4294967295,(a^=a>>>16)>>>0},hasLocalStorage:function(){try{return!!window.localStorage}catch(e){return!0}},hasSessionStorage:function(){try{return!!window.sessionStorage}catch(e){return!0}},isCanvasSupported:function(){var e=document.createElement(_0x4268("0x4b"));return!(!e[_0x4268("0x47")]||!e[_0x4268("0x47")]("2d"))},isIE:function(){return navigator.appName===_0x4268("0x7b")||!(navigator.appName!==_0x4268("0x95")||!/Trident/[_0x4268("0x1")](navigator[_0x4268("0xa5")]))},getPluginsString:function(){return this.isIE()&&this[_0x4268("0xc")]?this[_0x4268("0xd2")]():this.getRegularPluginsString()},getRegularPluginsString:function(){return this.map(navigator[_0x4268("0x61")],(function(e){var t=this[_0x4268("0x76")](e,(function(e){return[e.type,e[_0x4268("0x33")]][_0x4268("0x4a")]("~")}))[_0x4268("0x4a")](",");return[e[_0x4268("0x94")],e[_0x4268("0x38")],t][_0x4268("0x4a")]("::")}),this)[_0x4268("0x4a")](";")},getIEPluginsString:function(){if(window.ActiveXObject){var e=[_0x4268("0xb4"),"AcroPDF.PDF",_0x4268("0x71"),_0x4268("0x69"),_0x4268("0x8a"),_0x4268("0x7d"),_0x4268("0x43"),_0x4268("0xd"),_0x4268("0x82"),_0x4268("0x67"),_0x4268("0xe"),_0x4268("0xcf"),_0x4268("0xa1")];return this[_0x4268("0x76")](e,(function(e){try{return new ActiveXObject(e),e}catch(e){return null}}))[_0x4268("0x4a")](";")}return""},getScreenResolution:function(){return[screen[_0x4268("0xb")],screen[_0x4268("0xbb")]]},getCanvasFingerprint:function(){var e=document.createElement(_0x4268("0x4b")),t=e[_0x4268("0x47")]("2d"),n=_0x4268("0xd3");return t[_0x4268("0xcb")]=_0x4268("0x6"),t[_0x4268("0xb7")]=_0x4268("0xba"),t.textBaseline=_0x4268("0x60"),t[_0x4268("0xc9")]="#f60",t[_0x4268("0x8c")](125,1,62,20),t.fillStyle=_0x4268("0x5f"),t[_0x4268("0x83")](n,2,15),t[_0x4268("0xc9")]=_0x4268("0x0"),t[_0x4268("0x83")](n,4,17),e[_0x4268("0x56")]()}},window.EAccountFingerprint=Ce;var fjs$1=(Cf=window,Cf.fjs=function(e,t){var n,r,i,o,a,s,c=t.sdk_createModal,u=_0x4268("0x8e"),l="jssdk-hy-1.0.0",p="",d={},h="",f="",g="",y="",m=!1,v=0,b=0,C=!1,E=!1,_=!1,S=null,T=null,A=!1,x=function(e,t){var n,r,i="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"[_0x4268("0x54")](""),o=[];if(t=t||i.length,e)for(n=0;ne&&clearInterval(S)}),1e3)},B=function(t){var r;if(t||n[_0x4268("0x3d")])return r={callback:e+_0x4268("0x37"),clientId:t||n.appId,clientType:"10010",finger:y,format:_0x4268("0x8d"),seqNum:x(32),timeStamp:(new Date).getTime(),version:_0x4268("0x62"),authDomainMD5:n.authDomain?hex_md5$1(n[_0x4268("0xa7")]):""},e===_0x4268("0x16")?r[_0x4268("0xa4")]="squ":r.bussinessType="jq",r;P(_0x4268("0x88"),{result:_0x4268("0x2f"),msg:_0x4268("0x3b")})},k=function(e){d=B(e);for(var t=I(d),n="",r=0;r=b+10?(E=!1,C=!1,e!==_0x4268("0x1a")||n.isNoUI?P(_0x4268("0x58"),O({result:"0",tn:s,accessCode:h,number:g,fingerId:y,gwAuth:f,msg:_0x4268("0x28")})):D()):(E=!0,_?j[_0x4268("0x3e")](JSON.stringify({st:y+"",bt:_0x4268("0x24"),authType:"2"})):N())},j={isSupportSDKFunc:function(e,t){return this[e](t)},getJsBrigeSdkFunc:function(e,n,r){if(t[_0x4268("0xc6")]&&_typeof(t[_0x4268("0xc6")][e])===_0x4268("0x90"))return n&&n.length>0?(t[_0x4268("0xc6")][e](n),!0):(t[_0x4268("0xc6")][e](),!0);try{var i={func:e,params:n,successCallBackFunc:r};return t[_0x4268("0xcc")][_0x4268("0x96")].EAccountJsBridge[_0x4268("0x20")](i),!0}catch(e){return!1}},getPreCodeParams:function(e){return j[_0x4268("0x99")]("getPreCodeParams",e,_0x4268("0xa2"))},callbackPreCodeParams:function(e){A||(e=JSON[_0x4268("0x6f")](e),i=e.pk,o=e.ps,a=e.taskId,function(e,t){d={appId:r,clientType:_0x4268("0x15"),format:_0x4268("0x5c"),paramKey:e,paramStr:t,version:_0x4268("0x5e")};for(var i=I(d),o="",a=0;a>5]|=128<>>9<<4)]=t;for(var n=1732584193,r=-271733879,i=-1732584194,o=271733878,a=0;a>16)+(t>>16)+(n>>16)<<16|65535&n}function bit_rol(e,t){return e<>>32-t}function str2binl(e){for(var t=Array(),n=(1<>5]|=(e.charCodeAt(r/chrsz)&n)<>2]>>r%4*8+4&15)+t.charAt(e[r>>2]>>r%4*8&15);return n}function isNative(e){return"function"==typeof e&&/native code/.test(e.toString())}function isNumber(e){return"[object Number]"===Object.prototype.toString.call(e)}function isFunction(e){return"[object Function]"===Object.prototype.toString.call(e)}function isArray(e){return Array.isArray?Array.isArray(e):"[object Array]"===Object.prototype.toString.call(e)}function detecEventSupport(e){var t=document.createElement("div"),n="on".concat(e);return(e=n in t)||(t.setAttribute(n,"xxx"),e="function"==typeof t[n]),t=null,e}!function(_0x8160f,_0x90308c){var _0x49cf5a={utilCreateXHR:function(e){var t=e&&e.window||window;if(t.XMLHttpRequest)return new t.XMLHttpRequest;for(var n=["MSXML2.XMLHTTP.5.0","MSXML2.XMLHTTP.4.0","MSXML2.XMLHTTP.3.0","Microsoft.XMLHTTP"],r=0;r

"+e+"

",document.body.appendChild(n);var r=setTimeout((function(){document.body.removeChild(n),clearTimeout(r)}),t)}var _0x1b41ab={version:"",openType:"",timestamp:_0x413441.dateFormat(new Date,"yyyyMMddhhmmssSSS"),appId:"",traceId:"",msgId:"",sign:"",expandParams:"",isTest:"",errCallback:null,succCallback:null,layerCallback:null,authPageType:"1",userInformation:_0x413441.getFingerPrint(),businessType:"8",status:!1,loading:!0,v:"20220216",resourceHref:"https://www.cmpassport.com/h5/js/jssdk_auth/image/",ifStopGetToken:!1,ifLoadIframe:!1,ifInitOptions:!1,maskLength:0,keytype:"1",maskPhone:"",accessToken:"",authPageUrl:"",authLevel:"",authName:"",customerPrivacyConfig:"",oper:"",operatorNetData:"",clickKeyBoard:0},_0x32d2cb,_0x2c5574,_0x5359a2,_0x923594;function _0x1ddc52(){var e=navigator.userAgent,t="";-1>2,i=(3&a)<<4|(t=e.charCodeAt(u++))>>4,o=(15&t)<<2|(n=e.charCodeAt(u++))>>6,a=63&n,isNaN(t)?o=a=64:isNaN(n)&&(a=64),s=s+c.charAt(r)+c.charAt(i)+c.charAt(o)+c.charAt(a);return s}function _0x2b7501(e){e=e.replace(/\r\n/g,"\n");for(var t="",n=0;n>6|192):(t+=String.fromCharCode(r>>12|224),t+=String.fromCharCode(r>>6&63|128)),t+=String.fromCharCode(63&r|128))}return t}var _0x5ca6c4={getConnection:function(e){""==_0x1b41ab.msgId&&(_0x1b41ab.msgId=_0x413441.getUuId(32,32)),e={appid:e,msgid:_0x1b41ab.msgId,netType:""};try{var t=navigator.connection||navigator.mozConnection||navigator.webkitConnection||{type:"unknown"};e.netType="none"!=t.type&&t.type||"unknown"}catch(t){e.netType="unknown"}return e},init:function(){if(!(event.data.UC_MSG_Method||"https://www.cmpassport.com"!=event.origin&&"https://testcert.cmpassport.com:7002"!=event.origin&&"http://120.197.235.102"!=event.origin)){var e=document.getElementById("auth");try{e.contentWindow.document.write(""),e.contentWindow.document.clear()}catch(e){}e&&(event.data.msgId||event.data.code)&&(e.parentNode.removeChild(e),_0x1b41ab.loading=!0,e=event.data,_0x1b41ab.operatorNetData&&(e.operatorNetData=_0x1b41ab.operatorNetData),"103000"===event.data.code&&0==_0x1b41ab.status?(_0x1b41ab.succCallback(e),_0x8160f.removeEventListener("message",this.init,!1),_0x1b41ab.status=!0):0==_0x1b41ab.status&&(_0x1b41ab.errCallback(e),_0x8160f.removeEventListener("message",this.init,!1),_0x1b41ab.status=!0))}},getTokenInfo:function(e){_0x1b41ab.loading&&(_0x55bc0e.clearLogParam(),_0x1b41ab.status=!1,_0x1b41ab.msgId=e.data.traceId,_0x1b41ab.traceId=e.data.traceId,_0x1b41ab.version=e.data.version,_0x1b41ab.openType=e.data.openType,_0x1b41ab.timestamp=e.data.timestamp,_0x1b41ab.appId=e.data.appId,_0x1b41ab.sign=e.data.sign,_0x1b41ab.timeout=e.data.timeout,_0x1b41ab.expandParams=e.data.expandParams,_0x1b41ab.isTest=e.data.isTest,_0x1b41ab.succCallback=void 0===e.success?function(){}:e.success,_0x1b41ab.errCallback=void 0===e.error?function(){}:e.error,_0x1b41ab.layerCallback=void 0===e.layerCallback?function(){}:e.layerCallback,_0x1b41ab.authPageType=e.data.authPageType||"0",_0x1b41ab.maskLength=0,_0x1b41ab.clickKeyBoard=0,_0x8160f.removeEventListener("message",_0x5ca6c4.init,!1),_0x8160f.addEventListener("message",_0x5ca6c4.init,!1),_0x413441.getSystem(),"unknown"==(e=_0x5ca6c4.getConnection(e.data.appId).netType)||"cellular"==e?("1"==_0x1b41ab.authPageType||"2"==_0x1b41ab.authPageType?_0x1b41ab.ifLoadIframe=!1:(_0x1b41ab.ifLoadIframe=!0,(_0x32d2cb=document.createElement("iframe")).setAttribute("id","auth"),_0x32d2cb.style.display="none",document.body.appendChild(_0x32d2cb)),_0x1b41ab.ifStopGetToken?_0x5ca6c4.getYDPhoneNumber():_0x5ca6c4.endGetToken()):(_0x1b41ab.ifLoadIframe=!1,e={code:"504",message:"网络环境不支持取号",msgId:_0x1b41ab.msgId},this.overGetToken(_0x1b41ab.errCallback,e)))},getYDPhoneNumber:function(){var e=this,t={version:_0x1b41ab.version,timestamp:_0x1b41ab.timestamp,appId:_0x1b41ab.appId,businessType:_0x1b41ab.businessType,traceId:_0x1b41ab.traceId,msgId:_0x1b41ab.traceId,sign:_0x1b41ab.sign,authPageType:_0x1b41ab.authPageType,userInformation:_0x1b41ab.userInformation,expandParams:_0x1b41ab.expandParams},n="0"===_0x1b41ab.isTest?_0x3008ef.httpsPreGetmobile.test01:_0x3008ef.httpsPreGetmobile.pro;try{_0x1b41ab.loading&&(_0x1b41ab.loading=!1,_0x49cf5a.ajax({request:{url:n,method:"post",data:JSON.stringify(t),timeout:_0x1b41ab.timeout},success:function(t){(t=t.result.body).operatorNetData?_0x1b41ab.operatorNetData=t.operatorNetData:_0x1b41ab.operatorNetData="",t.keytype&&(_0x1b41ab.keytype=t.keytype),"103000"===t.resultCode?(_0x1b41ab.accessToken=t.accessToken||"",_0x1b41ab.maskPhone=t.maskPhone||"",_0x1b41ab.authPageUrl=t.authPageUrl||"",_0x1b41ab.authLevel=t.authLevel||"",_0x1b41ab.authName=t.appName||"",_0x1b41ab.customerPrivacyConfig=t.customerPrivacyConfig||"",_0x1b41ab.oper="CM",e.getAuthentication()):(_0x2c45a0.YDData={code:t.resultCode,message:t.resultDesc},_0x1b41ab.ifStopGetToken?e.overGetToken(_0x1b41ab.errCallback):_0x5ca6c4.endGetToken())},error:function(t){_0x2c45a0.YDData={code:"500",message:t.result&&t.result.summary||"网络异常,请检查网络设置"},_0x1b41ab.ifStopGetToken?e.overGetToken(_0x1b41ab.errCallback):_0x5ca6c4.endGetToken()}}))}catch(e){throw new Error(e)}},getAuthentication:function(){var e,t,n;("5"==_0x1b41ab.authLevel||_0x1b41ab.authPageUrl)&&_0x1b41ab.authLevel&&_0x1b41ab.accessToken?"5"!=_0x1b41ab.authLevel&&"4"!=_0x1b41ab.authLevel&&"6"!=_0x1b41ab.authLevel?"2"==_0x1b41ab.authPageType?this.getLayerConf():(_0x32d2cb.style.cssText="width: 100%;height: 100%;border:0;position: fixed;top:0;left:0;right:0;bottom:0;z-index: 999999999999;background: #fff;",e=_0x1b41ab.authPageUrl,n={traceId:_0x1b41ab.traceId,accessToken:_0x1b41ab.accessToken,maskPhone:_0x1b41ab.maskPhone,authLevel:_0x1b41ab.authLevel,authName:_0x1b41ab.authName,userInformation:_0x1b41ab.userInformation,appId:_0x1b41ab.appId,expandParams:_0x1b41ab.expandParams,isTest:_0x1b41ab.isTest,oper:_0x1b41ab.oper},t=e+"?traceId="+_0x1b41ab.traceId+"&accessToken="+_0x1b41ab.accessToken+"&maskPhone="+_0x1b41ab.maskPhone+"&authLevel="+_0x1b41ab.authLevel+"&authName="+_0x1b41ab.authName+"&userInformation="+_0x1b41ab.userInformation+"&appId="+_0x1b41ab.appId+"&expandParams="+_0x1b41ab.expandParams+"&isTest="+_0x1b41ab.isTest+"&oper="+_0x1b41ab.oper+"&from="+window.location.origin+"&authPageType="+_0x1b41ab.authPageType+"&v="+_0x1b41ab.v,_0x32d2cb.src=t,_0x413441.isJSON(_0x1b41ab.customerPrivacyConfig)&&"3"!=_0x1b41ab.authPageType?_0x32d2cb.onload=function(){_0x32d2cb.contentWindow.postMessage(_0x1b41ab.customerPrivacyConfig,e)}:"3"==_0x1b41ab.authPageType&&(_0x32d2cb.onload=function(){_0x32d2cb.contentWindow.postMessage(_0x26e921,e)})):(n={code:"103000",message:"获取AccessToken成功",msgId:_0x1b41ab.msgId,accessToken:_0x1b41ab.accessToken,maskPhone:_0x1b41ab.maskPhone,oper:_0x1b41ab.oper,appId:_0x1b41ab.appId,authLevel:_0x1b41ab.authLevel},this.overGetToken(_0x1b41ab.succCallback,n)):(n={code:"509",message:"参数缺失",msgId:_0x1b41ab.msgId},this.overGetToken(_0x1b41ab.errCallback,n))},authGetToken:function(e){var t=this,n=hex_md5((e.data.maskPhone||_0x1b41ab.maskPhone).replace(/\*+/g,e.data.maskVal)),r=void 0===e.success?function(){}:e.success,i=void 0===e.error?function(){}:e.error,o={header:{interfaceVersion:e.data.version,timestamp:_0x413441.dateFormat(new Date,"yyyyMMddhhmmssSSS"),appId:e.data.appId,businessType:_0x1b41ab.businessType,traceId:e.data.traceId,"Content-Type":"application/json"},body:{accessToken:e.data.accessToken,phone:n,userInformation:_0x1b41ab.userInformation,expandParams:e.data.expandParams}};n="0"===e.data.isTest?_0x3008ef.getToken.test01:_0x3008ef.getToken.pro;try{_0x49cf5a.ajax({request:{headers:o.header,url:n,method:"post",data:JSON.stringify(o.body)},success:function(n){var o;_0x2c5574&&(_0x2c5574.parentNode.removeChild(_0x2c5574),_0x2c5574=null),n=n.result,!e.data.authPageType||"1"!=e.data.authPageType&&"2"!=e.data.authPageType||"104012"==n.resultCode||_0x923594.closeMark(),"103000"===n.resultCode?(o={code:n.resultCode,token:n.data.token,userInformation:_0x1b41ab.userInformation,msgId:e.data.traceId,message:n.desc},t.overAuthGetToken(r,o)):e.data.authPageType&&"104012"===n.resultCode&&"1"!=_0x1b41ab.authLevel&&"5"!=_0x1b41ab.authLevel?_0x923594.showErrorTips("号码有误,请重新填写"):(o={code:n.resultCode,message:n.desc,msgId:e.data.traceId},t.overAuthGetToken(i,o))},error:function(n){!e.data.authPageType||"1"!=e.data.authPageType&&"2"!=e.data.authPageType||(_0x2c5574&&(_0x2c5574.parentNode.removeChild(_0x2c5574),_0x2c5574=null),_0x923594.closeMark());var r={code:"103005",message:"inner error",msgId:e.data.traceId};t.overAuthGetToken(i,r)}})}catch(e){throw new Error(e)}},endGetToken:function(){var e={code:"503",message:"获取token结束",msgId:_0x1b41ab.msgId};this.overGetToken(_0x1b41ab.errCallback,e)},overGetToken:function(e,t){var n;t&&"{}"!=JSON.stringify(t)?n=t:(n=_0x2c45a0).msgId=_0x1b41ab.msgId,_0x1b41ab.operatorNetData&&(n.operatorNetData=_0x1b41ab.operatorNetData),_0x1b41ab.ifLoadIframe&&(_0x32d2cb.parentNode.removeChild(_0x32d2cb),_0x1b41ab.ifLoadIframe=!1),_0x8160f.removeEventListener("message",this.init,!1),e&&e(n),_0x1b41ab.loading=!0},overAuthGetToken:function(e,t){var n;t&&"{}"!=JSON.stringify(t)?n=t:(n=_0x2c45a0).msgId=_0x1b41ab.msgId,_0x1b41ab.operatorNetData&&(n.operatorNetData=_0x1b41ab.operatorNetData),_0x1b41ab.ifLoadIframe&&(_0x32d2cb.parentNode.removeChild(_0x32d2cb),_0x1b41ab.ifLoadIframe=!1),_0x8160f.removeEventListener("message",this.init,!1),e&&e(n),_0x1b41ab.loading=!0},getLayerConf:function(){"2"==_0x1b41ab.authPageType&&_0x5359a2&&0<_0x5359a2.childNodes.length&&_0x923594.closeMark();var e={},t={interfaceVersion:"1.0",traceId:_0x1b41ab.msgId,appId:_0x1b41ab.appId,timestamp:_0x413441.dateFormat(new Date,"yyyyMMddhhmmssSSS"),businessType:_0x1b41ab.businessType},n="0"===_0x1b41ab.isTest?_0x3008ef.getPageOpt.test01:_0x3008ef.getPageOpt.pro;try{_0x49cf5a.ajax({request:{headers:t,url:n,method:"get",data:""},success:function(t){"103000"==(t=t.result).resultCode&&t.data.pageOption&&(e=t.data.pageOption),t=new _0x174327(e),_0x923594=new _0xaddc85(t)},error:function(t){var n=new _0x174327(e);_0x923594=new _0xaddc85(n)}})}catch(t){n=new _0x174327(e),_0x923594=new _0xaddc85(n)}}},_0x55bc0e={A:{logType1:{operType:"onekeylogin",traceid:"",appScene:"0",appid:"",networkType:"",clientType:"",userInformation:"",costtime_GetOwnerAppValidate:"",CMrequestTime_PreGetmobile:"",CMresponseTime_PreGetmobile:"",CM_resultCode:"",CTrequestTime_PreGetmobile:"",CTresponseTime_PreGetmobile:"",CT_resultCode:"",CUrequestTime_PreGetmobile:"",CUresponseTime_PreGetmobile:"",CU_resultCode:"",version:"2"},logType2:{operType:"onekeylogin",traceid:"",appid:"",authpageLoad:"",authpageCostTime:"",authpageType:"",authType:""},logType3:{operType:"onekeylogin",requestTime_GetToken:"",responseTime_GetToken:"",traceid:"",appid:"",loginbuttonClick:"",checkboxClick:"",keyboardClick:"",authpageReturn:""}},clearLogParam:function(){for(var e in this.A)for(var t in this.A[e])"operType"!==t&&"appScene"!==t&&"version"!==t&&(this.A[e][t]="")},setLog:function(e,t,n){this.A[e][t]=n},sendLog:function(e){var t,n=_0x413441.getUuId(32,32),r=hex_md5("2.0"+_0x1b41ab.appId+_0x1b41ab.timestamp+n+"@Fdiwmxy7CBDDQNUI"),i={};for(t in this.A[e])""==this.A[e][t]||(i[t]=this.A[e][t]);var o={header:{sign:r,msgid:n,version:"2.0",appid:_0x1b41ab.appId,systemtime:_0x1b41ab.timestamp,operType:"onekeylogin"},body:{log:i}};r=_0x3008ef.logReport.pro,(n=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP")).open("post",r,!0),n.send(JSON.stringify(o))}},_0x174327=function(e){return this.layerOption={},this.checkparam="1"==_0x1b41ab.authPageType?e:_0x26e921,this.defaultObject=_0x4231be,this.init(),this.layerOption.configBusinessName=e.configBusinessName||"",this.layerOption};_0x174327.prototype={constructor:_0x174327,init:function(){if("1"==_0x1b41ab.authLevel&&(this.defaultObject.phoneStyle.width="60%",this.defaultObject.submitBtnStyle.ifShow=!0),("1"==_0x1b41ab.authLevel||this.checkparam.submitBtnStyle&&this.checkparam.submitBtnStyle.ifShow)&&(this.defaultObject.phoneStyle.high="81px",this.defaultObject.agreeStyle.high="168px"),"1"!=_0x1b41ab.authPageType)if(this.checkparam&&"{}"!=JSON.stringify(this.checkparam))for(var e in this)"function"==typeof this[e]&&0==e.indexOf("check")&&this[e]();else this.layerOption=this.defaultObject;else{_layer_option=_0x4231be;var t=this.checkparam;if(_layer_option.agreeStyle.hrefColor=t.agreeTextColour||_0x4231be.agreeStyle.hrefColor,_layer_option.agreeStyle.checkedImage=t.agreeCheckPic||_0x4231be.agreeStyle.checkedImage,_layer_option.submitBtnStyle.name=t.agreeButtonText||_0x4231be.submitBtnStyle.name,_layer_option.submitBtnStyle.bgColor=t.agreeButtonText||_0x4231be.submitBtnStyle.bgColor,t.customControlsConf&&0!=JSON.parse(t.customControlsConf).length){var n=JSON.parse(t.customControlsConf);for(_layer_option.customControlStyle=[],e=0;e"+this.maskPhone[n]+"";e.className="ydrz-maskphone",e.id=1===this.layerType?"YDRZ_InputPhone":"YDRZ_InputPhone_two",1!==this.layerType&&(this.T.push(e.id),e.setAttribute("data-style","phoneStyle"),this.setPageByOption(e,t,"phoneStyle")),this.k.appendChild(e)}},createLayerPhoneLineByLevel4:function(){if("1"!=this.authLevel){for(var e,t=document.createElement("div"),n=this.styleObj.phoneStyle,r=this,i=1,o=0;o"+this.maskPhone[o]+"";t.className="ydrz-auth-phone",t.id=1===this.layerType?"YDRZ_InputPhone":"YDRZ_InputPhone_two",1!==this.layerType&&(this.T.push(t.id),t.setAttribute("data-style","phoneStyle"),this.setPageByOption(t,n,"phoneStyle")),this.k.appendChild(t),"2"==this.layerType&&_0x2f4a3a.addHandler(t,"click",(function(e){e.stopPropagation(),r.createLayerKeyBoard(!0)}))}},createLayerSubmitBtn:function(){var e,t,n=this.styleObj.submitBtnStyle;n.ifShow&&(e=document.createElement("div"),t=this,e.innerHTML="

"+n.name+"

",e.className="ydrz-submit-btn ydrz-disabled",e.id="YDRZ_Submitbtn",1!==this.layerType&&(this.T.push(e.id),e.setAttribute("data-style","submitBtnStyle"),this.setPageByOption(e,n,"submitBtnStyle")),this.k.appendChild(e),this.submitBtn=document.getElementById("YDRZ_Submitbtn"),_0x2f4a3a.addHandler(this.submitBtn,"click",(function(e){t.C&&t.getAuthToken()})))},createLayerAgreeLine:function(){var e,t,n,r,i,o,a=document.createElement("p"),s=this,c=document.createElement("div"),u=this.styleObj.agreeStyle,l=u.hrefColor,p=u.checkedImage,d=u.fontSize;u.lineHeight,a.innerHTML=("1"==this.authLevel?"我已阅读并同意":"请补充完整号码同意")+function(e,t){var n,r="";if(!Array.isArray(t))return"";r="CT"==_0x1b41ab.oper?""+n.name+"":"CU"==_0x1b41ab.oper?""+n.name+"":""+n.name+"";for(var i=0;i"+o.name+""}return r}(l,u.agreeArr)+"并授权"+this.styleObj.configBusinessName+"使用此号码",c.className="ydrz-p ydrz-v1",c.id="YDRZ_Agreement",(a.style.flex=1)!==this.layerType&&(this.T.push(c.id),c.setAttribute("data-style","agreeStyle"),this.setPageByOption(c,u,"agreeStyle")),c.appendChild((e=d,t=l,n=p,i=document.createElement("input"),o=document.createElement("div"),i.type="checkbox",i.id="YDRZ_Checkbox",i.name="YDRZ_Choose",i.className="ydrz-checkbox",o.style.width=o.style.height=e,o.style.position="relative",o.style.marginRight="6px",o.appendChild(i),i=e,e=parseInt(i)/2.4,r=n?".ydrz-layer-wrap .ydrz-v1 .ydrz-checkbox {vertical-align: text-top;margin:0;overflow:hidden;border-radius: 50%;border: 1px solid #cccccc;padding: 0;width: "+i+";height: "+i+";display: inline-block;outline: none;cursor: pointer;outline: none;appearance: none;-webkit-appearance: none;position: absolute;top:16%;left:0;}.ydrz-layer-wrap .ydrz-v1 .ydrz-checkbox:checked{border: 0;border-radius:0;outline: none;appearance: none;-webkit-appearance: none;margin-right: 6px;width: "+i+";height: "+i+";border: 0;background: url("+n+") no-repeat center top;background-size: 100% 100%;}":".ydrz-layer-wrap .ydrz-v1 .ydrz-checkbox {vertical-align: text-top;margin:0;overflow:hidden;border-radius: 50%;border: 1px solid #cccccc;padding: 0;width: "+i+";height: "+i+";display: inline-block;outline: none;cursor: pointer;outline: none;appearance: none;-webkit-appearance: none;position: absolute;top:16%;left:0;}.ydrz-layer-wrap .ydrz-v1 .ydrz-checkbox:checked {border: 1px solid "+t+';background: transparent;-webkit-tap-highlight-color:transparent;-webkit-tap-highlight-color: rgba(0, 0, 0, 0);tap-highlight-color: rgba(0, 0, 0, 0);}.ydrz-layer-wrap .ydrz-v1 .ydrz-checkbox:checked::after{content: "";position: absolute;left: 0;top: 0;height: '+e+"px;width: "+(4+e)+"px;transform: rotate(-45deg);border: 1px solid "+t+";border-top: none;border-right: none;}",e=document.getElementsByTagName("head")[0],(t=document.createElement("style")).type="text/css",t.styleSheet?t.styleSheet.cssText=r:t.appendChild(document.createTextNode(r)),t.id="add-style-id",e.appendChild(t),o)),c.appendChild(a),this.k.appendChild(c),c=document.getElementById("YDRZ_Checkbox"),_0x2f4a3a.addHandler(c,"click",(function(e){var t;s.C=this.checked,"1"!==s.authLevel&&this.checked&&s.I.length==s.maskLength?(t={code:"103000",msgId:_0x1b41ab.msgId,message:"用户已输入中间四位号码并勾选协议"},_0x1b41ab.layerCallback(t),"3"==s.layerType?s.submitBtn?s.submitBtn.classList.remove("ydrz-disabled"):s.getAuthToken():"2"==s.layerType?s.submitBtn&&s.submitBtn.classList.remove("ydrz-disabled"):s.getAuthToken()):"1"==s.authLevel&&this.checked?s.submitBtn&&s.submitBtn.classList.remove("ydrz-disabled"):s.submitBtn&&s.submitBtn.classList.add("ydrz-disabled")}))},createLayerCloseBtn:function(){var e,t=this.styleObj.closeBtnStyle,n=this;1!==this.layerType&&!t.ifShowBtn||((e=document.createElement("div")).id=1===this.layerType?"YDRZ_Closebtn":"YDRZ_Closebtn_two",e.className="ydrz-close-btn",e.innerHTML='',1!==this.layerType&&(this.T.push(e.id),e.setAttribute("data-style","closeBtnStyle"),this.setPageByOption(e,t,"closeBtnStyle")),this.k.appendChild(e),_0x2f4a3a.addHandler(e,"click",(function(e){n.closeMark(),_0x4fd422.closeKeyBoard();var t={code:"501",msgId:_0x1b41ab.msgId,message:"用户取消授权"};_0x1b41ab.errCallback(t),_0x1b41ab.loading=!0})))},createLayerCustomControl:function(){var e,t,n,r=this.styleObj.customControlStyle,i="1"==this.layerType?(e=document.createElement("div"),t=document.getElementById("YDRZ_Agreement"),n=document.getElementById("YDRZ_Modal"),e.style.position="relative",e.style.width="100%",e.style.height=n.offsetHeight-t.offsetHeight-t.offsetTop+"px",this.k.appendChild(e),e):this.k;if(Array.isArray(r))for(var o=0;o

请稍候...

",document.body.appendChild(_0x2c5574),void _0x5ca6c4.authGetToken({data:{version:_0x1b41ab.version,maskPhone:_0x1b41ab.maskPhone,maskVal:this.I,appId:_0x1b41ab.appId,traceId:_0x1b41ab.traceId,accessToken:_0x1b41ab.accessToken,expandParams:_0x1b41ab.expandParams,isTest:_0x1b41ab.isTest,authPageType:_0x1b41ab.authPageType},success:e,error:t})):(_0x2dd7f0("未勾选协议",1500),void t({code:"508",msgId:_0x1b41ab.msgId,message:"用户未勾选协议"})):(_0x2dd7f0("未补齐4位号码",1500),void t({code:"507",msgId:_0x1b41ab.msgId,message:"用户未补齐4位号码"}))},generateInput:function(e,t,n,r,i){var o;document.all?o=null!=r&&""!=r?document.createElement(''):document.createElement(""+e+"

",(r=document.getElementsByClassName("ydrz-auth-phone")[0]).parentNode.insertBefore(n,r.nextSibling)):(n=document.createElement("div"),r=this.styleObj.errTipStyle,n.classList.add("ydrz-error-tip2-wrap"),n.id="YDRZErrorTips",n.innerHTML="

"+e+"

",this.setPageByOption(n,r,"errTipStyle"),document.body.appendChild(n),i=setTimeout((function(){document.body.removeChild(n),clearTimeout(i)}),t)))},ifOverPage:function(){if("1"!=_0x1b41ab.authPageType)for(var e in this.T)e=this.T[e],(e=document.getElementById(e)).offsetWidth+e.offsetLeft>this.k.offsetWidth&&this.resetPage(e),e.offsetLeft<0&&this.resetPage(e)},resetPage:function(e){var t=e.getAttribute("data-style");e.style.width=_0x4231be[t].width,e.style.left="0px",e.style.right="0px"}};var _0x4fd422=function(){var e,t,n,r,i,o,a,s,c,u,l={COLS:3,WIDTH:"33.3%",TYPE:1,KEYS:[1,2,3,4,5,6,7,8,9," ",0,"<"]},p=!1,d="";return{openKeyBoard:function(h,f,g,y,m,v){if(d=f,c=l,!e){(e=document.createElement("DIV")).className="qs-key-board-wrap",t=document.createElement("DIV"),n=document.createElement("TABLE"),r=document.createElement("TBODY"),t.className="qs-key-board",t.id="qs-keyboard-id",n.border="0";for(var b,C,E=0;E=h?d:d+u,m&&m(d||"")}}(e);break;default:e.stopPropagation(),e.preventDefault()}},"ontouchstart"in document.documentElement?t.addEventListener("touchstart",a,!1):t.addEventListener("click",a,!1),t.addEventListener("touchmove",(function(e){e.preventDefault()}),{passive:!1})}},closeKeyBoard:function t(n){var r,i;p&&(r=document.getElementsByTagName("body")[0].style.paddingBottom,i=(0==document.documentElement.clientHeight?document.body:document.documentElement).clientHeight,document.getElementsByTagName("body")[0].style.paddingBottom=r==.3*i+"px"?"":parseFloat(r)-.3*i+"px",p=!1),e&&(s.removeChild(e),e=null,s.removeEventListener("click",t))},delInput:function(e){d="",e&&e()}}}();_0x8160f.YDRZAuthLogin={getConnection:function(e){return _0x5ca6c4.getConnection(e)},getTokenInfo:function(e){_0x1b41ab.ifStopGetToken=!0,_0x5ca6c4.getTokenInfo(e)},authGetToken:function(e){_0x5ca6c4.authGetToken(e)},endGetToken:function(){_0x1b41ab.ifStopGetToken=!1},CustomControlsInit:function(e,t){_0x26e921=t,_0x5359a2=document.getElementById(e),_0x1b41ab.ifInitOptions=!0},authGetTokenByLayer:function(e,t){_0x923594&&_0x923594.getAuthToken(e,t)},authPageInit:function(e){_0x26e921=e},finger:function(){return _0x1b41ab.userInformation}}}(window);var extend=function(e,t){new _Object(t).O((function(t,n){e[t]=n}))};function _Object(e){this.M=e}function _Array(e){this.L=e||[]}_Object.prototype={O:function(e){var t,n=this.M;for(t in n)Object.prototype.hasOwnProperty.call(n,t)&&e(t,n[t]);return this},F:function(){var e,t=this.M;for(e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}},_Object.create=function(e){return"object"===_typeof(e)&&(Object.create?Object.create(e):((t=function(){}).prototype=e,new t));var t},_Array.prototype={y:function(e){return this.L[e]},D:function(){return this.L.length},P:function(e,t){return new _Array(e=isNumber(t)?this.L.slice(e,t):this.L.slice(e))},N:function(e){return this.L.push(e),this},R:function(e,t){return this.L.splice(e,t||1)},z:function(e){return this.L.join(e)},B:function(e){return new _Array(this.L.concat(e))},Y:function(e){var t=this.L;if(t.map)return new _Array(t.map(e));for(var n=[],r=0,i=t.length;r/g,">"),t.innerHTML=e,this},en:function(e){var t=this.H,n=t.className?t.className.split(" "):[];return new _Array(isArray(e)?e:[e]).U((function(e){var r=PREFIX+e;-1===(e=n).indexOf(r)&&(e.push(r),t.className=e.join(" "))})),this},on:function(e){var t=this.H,n=t.className.split(" ");return new _Array(isArray(e)?e:[e]).U((function(e){-1<(e=n.indexOf(PREFIX+e))&&(n.splice(e,1),t.className=n.join(" "))})),this},in:function(e,t){return this.on(t).en(e),this},rn:function(){var e=this.H,t=e.parentNode;return t&&t.removeChild(e),this},an:function(e){return this.cn({display:e?"inline-block":"block"})},sn:function(){return this.cn({display:"none"})},un:function(e){return this.cn({opacity:e})},ln:function(){return this.H.getBoundingClientRect()},dn:function(e,t){return this.H.scrollTo(e,t)},cn:function(e){var t,n=this.H;for(t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n.style[t]=e[t]);return this},xn:function(e){return this.H.getAttribute(e)},gn:function(e){var t,n=this.H;for(t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t]);return this},fn:function(e){var t=this.H;return document.getElementsByTagName("head")[0].appendChild(t),t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e)),this},pn:function(e){return this.H.appendChild(e.H),this},hn:function(){return new _Element(this.H.parentNode)},_n:function(e){var t=this.H;return(t.currentStyle||window.getComputedStyle(t))[e]},mn:function(){return new _Element(this.H.firstChild)},bn:function(){return"path"===this.H.nodeName?this.H.getTotalLength():0},vn:function(){return this.H.children},wn:function(e){return e.H.appendChild(this.H),this},yn:function(e){var t=this.H;return t.parentNode.removeChild(t),this.wn(e),this},An:function(e){var t=this.H;return new _Object(e).O((function(e,n){t.setAttribute(e,n)})),this},kn:function(e){var t=this.H;return-1===new _Array(t.className?t.className.split(" "):[]).Q(PREFIX+e)?this.en(e):this.on(e),this},Sn:function(e){var t=this,n=t.H,r=n.className.baseVal?n.className.baseVal.split(" "):[];return new _Array(isArray(e)?e:[e]).U((function(e){var n=PREFIX+e;-1===(e=r).indexOf(n)&&(e.push(n),t.An({class:e.join(" ")}))})),t},Tn:function(e){return this.H.appendChild(document.createTextNode(e)),this},t:function(e,t){var n=this,r=function(e){t(new _Event(n,e))};return n.Cn=n.Cn||{},n.Cn[e]?n.Cn[e].push(r):n.Cn[e]=[r],n.nn[e].forEach((function(e){n.En(e,r)})),n},En:function(e,t){var n=this,r=n.H;document.addEventListener?n.En=function(e,t){r.addEventListener(e,t)}:document.attachEvent?n.En=function(e,t){r.attachEvent("on".concat(e),t)}:n.En=function(e,t){r["on".concat(e)]=t},n.En(e,t)},In:function(e,t){var n=this;n.Cn=n.Cn||{};var r=n.Cn[e]||[],i=function(i){n.On(e),t(new _Event(n,i)),new _Array(r).U((function(t){n.nn[e].forEach((function(e){n.En(e,t)}))}))};n.On(e),n.Cn[e]=[t],n.nn[e].forEach((function(e){n.En(e,i)}))},On:function(e){var t=this,n=t.H;if(t.Cn)if(e)t.Cn[e]&&(t.Cn[e].forEach((function(r){t.nn[e].forEach((function(t){document.removeEventListener?n.removeEventListener(t,r):document.detachEvent?n.detachEvent("on".concat(t),r):n["on".concat(e)]=null}))})),t.Cn[e]=[]);else{var r,i=function(r){Object.prototype.hasOwnProperty.call(t.Cn,r)&&t.Cn[r].forEach((function(i){t.nn[r].forEach((function(t){document.removeEventListener?n.removeEventListener(t,i):document.detachEvent?n.detachEvent("on".concat(t),i):n["on".concat(e)]=null}))}))};for(r in t.Cn)i(r);t.Cn=[]}},Mn:function(e,t,n){var r=this;return detecEventSupport(e)?r.t(e,t):setTimeout((function(){t.call(r)}),n||16),r},Ln:function(){var e=this.H;return 1===e.nodeType&&"INPUT"===e.nodeName&&e.checked}},_Element.$=function(e){var t,n;"string"==typeof e?"#"===e[0]?t=document.getElementById(e.slice(1)):"querySelector"in document?t=document.querySelector(e):isFunction(window.jQuery)&&(t=window.jQuery(e)[0]):t=e.length?e[0]:e;try{n=Node.ELEMENT_NODE}catch(e){n=1}try{if(t.nodeType===n)return new _Element(t)}catch(e){return!1}return!1};var compile=function e(t,n,r){var i=t.split("."),o=new _Element(t=i[0]||"div"),a=n;if(n=(i[1]?i.slice(1):[]).map((function(e){return e})).join(" "),-1"]],r=0;r<4;r++){t["tr.cl".concat(r)]={};for(var i=0;i<3;i++){var o=n[r][i];t["tr.cl".concat(r)]["td.shadow_".concat(o)]={}}}var a={},s={};"float"===e.OneLogin.product?a={".return-wrapper_onelogin":_objectSpread2({},e.OneLogin.showBack?{"i.return-icon":{},"span.return-text_onelogin":{}}:"")}:"popup"===e.OneLogin.product&&(s={".header-wrapper_onelogin":{".gt-pop-header-ct":{},".return-wrapper_onelogin":{}}}),s={".geetest_box_wrap_onelogin":{".pupup-wrap_onelogin":{".header-wrap_onelogin":a,".wrap_onelogin":{".pop-header_onelogin":s,".gtlogo-wrap_onelogin":{},".gtnote_onelogin":{},".gtautoPhone_onelogin":{"span.gtautopre_onelogin":{},"span.inputval1":{},"span.inputval2":{},"span.inputval3":{},"span.inputval4":{},"span.gtautosuf_onelogin":{}},".gtest-cm-cus":{},".gtest-tip-ct":{},".gtest-btn_onelogin":{"span.gtest-text_onelogin":{},".loging_onelogin":{}},".gtonelogin-customer-wrapper":{".gtonelogin-customer-inner":{}},"p.operator_protocol_wrapper_onelogin":{"input.checkbox_protocol_onelogin":{},".protocol-warapper_onelogin":{"span.operator_protocol_wrapperp_onelogin":{},"a.o_protocol":{},"span.operator_protocol_wrapperand":{},"a.o_protocol1":{},"span.protocol_dot":{},"a.o_protocol2":{},"span.operator_protocol_wrapperanuse":{}}},".wrapper-footer_onelogin":{}},".gtfooter_onelogin":{".softkeyboard-wrap":{".qs-key-board_onelogin":{"table.gt_table":_objectSpread2({},t)}}},".toast_onelogin":{"i.toast-info-icon_onelogin":{},"span.toast-text_onelogin":{}}}}},s=compile(".gtonelogn",s,e.$1),e.jn(),e.dom=s,e.OneLogin.initType=e.OneLogin.product}},jn:function(){var e=this;e.options;var t=e.$1;t(".gtonelogn")&&t(".gtonelogn").sn().un(0),nextTick((function(){e.appendTo(new _Element(document.body)),e.makeText()}))},close:function(){var e=this,t=e.$1;return new _Promise((function(n){e.clearVal(),t(".gtonelogn").sn().un(0)}))},appendTo:function(e){var t=this.dom;(_Element.$(e)||new _Element(document.body)).pn(t)},open:function(){var e=this,t=e.$1;e.status;var n,r={left:0,center:"50%",right:"100%"};e.maskPhone&&t(".wrap_onelogin")&&(t(".gtest-btn_onelogin")&&t(".gtest-btn_onelogin").on("loading"),t(".wrap_onelogin").en("up").en("_".concat(e.OneLogin.product,"_wrap")),n=r[e.OneLogin.buttonPosition],t(".gtest-btn_onelogin").cn({left:n,transform:"translateX(-".concat(n,")"),width:e.OneLogin.buttonWidth,height:e.OneLogin.buttonHeight,"background-color":e.OneLogin.buttonBackgroundNormal}),t(".gtest-text_onelogin").cn({"font-size":e.OneLogin.buttonFontSize,color:e.OneLogin.fontColor}),r=r[e.OneLogin.customerPosition],e.OneLogin.canSwithch&&t(".gtonelogin-customer-inner").cn({left:r,transform:"translateX(-".concat(r,")")}),e.closeKeyBoard(),e.OneLogin.product&&t(".geetest_box_wrap_onelogin").en("_".concat(e.OneLogin.product)),e.Pn(),e.Fn())},Pn:function(){var e=this,t=e.$1,n=(i=e.maskPhone.split("*"))[0],r=i[i.length-1],i=(i={1:{title:"《中国移动认证服务协议》",link:"https://wap.cmpassport.com/resources/html/contract.html"},2:{title:"《天翼账号服务协议与隐私政策》",link:"https://e.dlife.cn/sdk/agreement/detail.do?hidetop=true&appKey="},3:{title:"《中国联通提供认证服务》",link:"https://hs.wosms.cn/protocol/protocol.html"}})[e.OneLogin.operator]||i[1];t(".gtautopre_onelogin").T(n),t(".gtautosuf_onelogin").T(r),t(".operator_protocol_wrapperp_onelogin").T("登录即同意"),2===e.OneLogin.operator&&(t(".geetest_box_wrap_onelogin").en("ct_auth_iframe"),e.OneLogin.canSwithch&&t(".gtonelogin-customer-inner").cn({display:"none"}),t(".gtest-tip-ct").T("若非本机号码,请返回并切换4G/5G网络使用"),"popup"===e.OneLogin.product&&(t(".gt-pop-header-ct").T("本机号码登录"),t(".gtlogo-wrap_onelogin").cn({display:"none"}))),(e.OneLogin.OLPrivacyTermItem1&&2===e.OneLogin.OLPrivacyTermItem1.length||e.OneLogin.OLPrivacyTermItem2&&2===e.OneLogin.OLPrivacyTermItem2.length)&&(t(".operator_protocol_wrapperand").T("和 "),e.OneLogin.OLPrivacyTermItem1&&t(".o_protocol1").T(e.OneLogin.OLPrivacyTermItem1[0]).gn({href:e.OneLogin.OLPrivacyTermItem1[1]}),e.OneLogin.OLPrivacyTermItem2&&e.OneLogin.OLPrivacyTermItem1&&t(".protocol_dot").T(" 、"),e.OneLogin.OLPrivacyTermItem2&&t(".o_protocol2").T(e.OneLogin.OLPrivacyTermItem2[0]).gn({href:e.OneLogin.OLPrivacyTermItem2[1]})),"6"===e.authLevel?(o=e.maskPhone&&e.maskPhoneNumber(e.maskPhone),t(".gtest-cm-cus").an(),t(".gtest-cm-cus").T(o),t(".gtautoPhone_onelogin").sn(),t(".gtest-btn_onelogin").en("active").cn({"background-color":e.OneLogin.buttonBackgroundActive||e.OneLogin.buttonBackgroundNormal}),t(".gtest-text_onelogin").cn({color:e.OneLogin.fontColorActive||e.OneLogin.fontColor}),e.OneLogin.authBtn=!1,e.OneLogin.keyboardOpen=!1):(t(".gtautoPhone_onelogin").cn({display:"flex"}),t(".gtest-cm-cus").sn(),t(".gtest-btn_onelogin").on("active")),t(".toast-text_onelogin").T("请勾选同意服务条款"),t(".operator_protocol_wrapperanuse").T(" 并使用本机号码登录");var o=e.OneLogin.backText||"返回";t(".return-text_onelogin")&&t(".return-text_onelogin").T(o),e.OneLogin.canSwithch&&t(".gtonelogin-customer-inner").T(e.OneLogin.customerSwitchText),e.OneLogin.logo&&t(".gtlogo-wrap_onelogin").cn({"background-image":"url(".concat(e.OneLogin.logo,")"),width:e.OneLogin.logoWidth}),t(".o_protocol").T(i.title).gn({href:i.link}),e.OneLogin.authBtn||2===e.OneLogin.operator&&"6"!==e.OneLogin.authLevel?t(".gtest-btn_onelogin").cn({display:"none"}):t(".gtest-btn_onelogin").cn({display:"inline-flex"}),t(".gtest-btn_onelogin").t("click",(function(){var n=null,r=t(".checkbox_protocol_onelogin").Ln();"sumit"!==e.OneLogin.status.status&&(r&&!n?(t(".gtest-btn_onelogin").en("loading"),e.OneLogin.status.Nn("sumit")):(t(".toast_onelogin").en("_active"),t(".gtest-btn_onelogin").en("_noclick"),n=setTimeout((function(){t(".toast_onelogin").on("_active"),t(".gtest-btn_onelogin").on("_noclick"),clearTimeout(n)}),2e3)))}));for(var a=1;a<5;a++)t(".inputval".concat(a)).t("click",(function(t){t.V()&&4!==e.maskVal.length||e.openKeyBoard()}));t(".return-wrapper_onelogin")&&t(".return-wrapper_onelogin").t("click",(function(){e.OneLogin.status.Nn("back")})),e.OneLogin.canSwithch&&t(".gtonelogin-customer-inner")&&t(".gtonelogin-customer-inner").t("click",(function(){e.OneLogin.status.Nn("switch")})),(e.OneLogin.keyboardOpen||2===e.OneLogin.operator&&"6"!==e.OneLogin.authLevel)&&e.openKeyBoard()},makeText:function(){var e=this,t=e.$1;e.maskVal="",e.j=0;var n=e.OneLogin.app||"极验验证",r=e.OneLogin.buttonText||"登录";t(".shadow_").en("key-non-icon"),t(".shadow_>").en("del-icon"),t(".gtnote_onelogin").T("请填写完整号码并授权".concat(n,"使用")).cn({"font-size":e.OneLogin.appfontSize});for(var i=[1,2,3,4,5,6,7,8,9,"",0,">"],o=0;o"!==a&&t(".shadow_".concat(a)).T(a),t(".shadow_".concat(a)).t("click",(function(n){n.q();var r,i,o=null;if(!(i=t(".checkbox_protocol_onelogin").Ln())||o)return t(".toast_onelogin").en("_active"),t(".gtest-btn_onelogin").en("_noclick"),void(o=setTimeout((function(){t(".toast_onelogin").on("_active"),t(".gtest-btn_onelogin").on("_noclick"),clearTimeout(o)}),2e3));0!==(i=n.V())&&""===i?"shadow_> geetest_onelogindel-icon"==n.J.target.className&&e.maskVal.length&&"sumit"!==e.OneLogin.status.status&&(e.delKey(i),e.j<4&&(t(".gtest-btn_onelogin").on("active").cn({"background-color":e.OneLogin.buttonBackgroundNormal}),t(".gtest-text_onelogin").cn({color:e.OneLogin.fontColor}))):e.j<4&&(e.j=e.j+1,e.setKey(e.j,i),e.maskVal+=i,t(".gtest-btn_onelogin").on("active").cn({"background-color":e.OneLogin.buttonBackgroundNormal}),t(".gtest-text_onelogin").cn({color:e.OneLogin.fontColor}),4===e.j&&(e.OneLogin.maskVal=e.maskVal,r=null,e.OneLogin.authBtn||2===e.OneLogin.operator?r=setTimeout((function(){e.OneLogin.status.Nn("sumit"),clearTimeout(r)}),60):(t(".gtest-btn_onelogin").en("active").cn({"background-color":e.OneLogin.buttonBackgroundActive||e.OneLogin.buttonBackgroundNormal}),t(".gtest-text_onelogin").cn({color:e.OneLogin.fontColorActive||e.OneLogin.fontColor})),e.closeKeyBoard()))}))}t(".gtest-text_onelogin").T(r)},setKey:function(e,t){(0,this.$1)(".inputval".concat(e)).T(t)},delKey:function(){var e=this,t=e.$1;e.j&&(t(".inputval".concat(e.j)).T(""),e.j=e.j-1,e.maskVal=e.maskVal.substr(0,e.maskVal.length-1)),e.OneLogin.maskVal=e.maskVal},clearVal:function(){var e=this,t=e.$1;if(e.maskVal.length)for(var n=0;n>5]|=128<>>9<<4)]=t;for(var n=1732584193,r=-271733879,i=-1732584194,o=271733878,a=0;a>16)+(t>>16)+(n>>16)<<16|65535&n}function bit_rol(e,t){return e<>>32-t}function str2binl(e){for(var t=Array(),n=(1<>5]|=(e.charCodeAt(r/chrsz)&n)<>2]>>r%4*8+4&15)+t.charAt(e[r>>2]>>r%4*8&15);return n}var opts={getMobileUrl:{test01:"https://120.197.235.102:7009/h5/getMobile",pro:"https://verify.cmpassport.com/h5/getMobile"},getCTaddress:{test01:"http://120.197.235.102/NumberAbility01/h5/getCTaddress.htm",pro:"https://www.cmpassport.com/NumberAbility/h5/getCTaddress.htm"},getCTCUtoken:{test01:"http://120.197.235.102/NumberAbility01/h5/getCTCUtoken.htm",pro:"https://www.cmpassport.com/NumberAbility/h5/getCTCUtoken.htm"},logReport:{pro:"https://log-h5.cmpassport.com:9443/log/logReport"},CUjssdk:{pro:"https://sdk.microwu.com/sdk-deliver/js/verify_mobile_sdk-1.3.0.js"},optparams:{uuid:"",msgId:"",businessType:"1",timestamp:dateFormat(new Date,"yyyyMMddhhmmssSSS"),userInformation:getFingerPrint(),isimge:!1,version:"1.0"}};function uuid(e,t){var n,r,i="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),o=[];if(t=t||i.length,e)for(n=0;n>2,i=(3&t)<<4|(t=e.charCodeAt(u++))>>4,o=(15&t)<<2|(n=e.charCodeAt(u++))>>6,a=63&n,isNaN(t)?o=a=64:isNaN(n)&&(a=64),s=s+c.charAt(r)+c.charAt(i)+c.charAt(o)+c.charAt(a);return s}function _utf8_encode(e){e=e.replace(/\r\n/g,"\n");for(var t="",n=0;n>6|192))+String.fromCharCode(63&r|128):(t=(t+=String.fromCharCode(r>>12|224))+String.fromCharCode(r>>6&63|128))+String.fromCharCode(63&r|128)}return t}YDRZ={getConnection:function(e){""==opts.optparams.msgId&&(opts.optparams.msgId=uuid(32,32));var t=navigator.connection||navigator.mozConnection||navigator.webkitConnection||{type:"unknown"},n=hex_md5("2.0"+e+opts.optparams.timestamp+opts.optparams.msgId+"@Fdiwmxy7CBDDQNUI");return t={appid:e,msgid:opts.optparams.msgId,netType:"none"!=t.type&&t.type||"unknown"},n={header:{sign:n,msgid:opts.optparams.msgId,version:"2.0",appid:e,systemtime:opts.optparams.timestamp},body:{log:{UA:navigator.userAgent,appId:e,msgid:opts.optparams.msgId,netType:t.netType}}},navigator.sendBeacon&&navigator.sendBeacon(opts.logReport.pro,JSON.stringify(n)),t},getSign:function(e,t){return opts.optparams.traceId=uuid(32,32),opts.optparams.msgId=opts.optparams.traceId,opts.optparams.version=t,e+opts.optparams.businessType+opts.optparams.traceId+opts.optparams.timestamp+opts.optparams.msgId+t},getTokenInfo:function(e){opts.optparams.msgId=opts.optparams.traceId;var t={version:opts.optparams.version,timestamp:opts.optparams.timestamp,appId:e.data.appId,businessType:opts.optparams.businessType,traceId:opts.optparams.traceId,sign:e.data.sign,msgId:opts.optparams.traceId,userInformation:opts.optparams.userInformation},n="0"===e.data.isTest?opts.getMobileUrl.test01:opts.getMobileUrl.pro;try{request.ajax({request:{url:n,method:"post",data:JSON.stringify(t)},success:function(t){var n;if("103000"!==t.result.body.resultCode)return n={code:t.result.body.resultCode,message:t.result.body.resultDesc},e.error({code:n.code,message:n.message,msgId:opts.optparams.msgId}),n;n={code:t.result.body.resultCode,token:t.result.body.token,userInformation:opts.optparams.userInformation,message:"获取token成功"},e.success({code:n.code,message:n.message,token:n.token,userInformation:n.userInformation,msgId:opts.optparams.msgId})},error:function(t){var n={code:"500",message:"接口异常,获取token失败"};return e.error({code:n.code,message:n.message,msgId:opts.optparams.msgId}),n}})}catch(e){throw new Error(e)}}};var request={utilCreateXHR:function(e){var t=e&&e.window||window;if(t.XMLHttpRequest)return new t.XMLHttpRequest;for(var n=["MSXML2.XMLHTTP.5.0","MSXML2.XMLHTTP.4.0","MSXML2.XMLHTTP.3.0","Microsoft.XMLHTTP"],r=0;r{if("false"!==n)return!(r="false")}),6e3),e.appKey?e.authenticator?e.ts?void _ajax_get({path:"https://hs.wosms.cn/api/atrace",fullurl:!0,timeout:t.timeout,query:{appKey:e.appKey,authenticator:e.authenticator,ts:e.ts,bwid:e.bwid,signType:"A"}}).R((function(e){if("0000"==e.code){if("false"==r)return o({code:-20,msg:"超时的错误策略"}),!1;const s=e.traceId;var a=e.url.split("&")[0];let c=t.getUrlString(a,"appid");t.jsonp(a,"a",t.timeout).then((a=>{-2==a.authurl&&alert("公网ip错误"),a.authurl?t.jsonp(a.authurl+"/api?appid="+c+"&signType=A","a",t.timeout).then((c=>{let u="";u=c.err_code||"","false"==r?o({code:-20,msg:"超时的错误策略"}):_ajax_get({path:window.atob(e.url.split("&ret_url=")[1]),fullurl:!0,query:{ts:a.ts,code:c.code,province:c.province,err_code:u,signType:"A"},timeout:t.timeout}).R((function(e){if(i(e),"0000"==e.code){if((n="false")==r)return o({code:-20,msg:"超时的错误策略",traceId:s}),!1;i(e)}else o({code:e.code,msg:e.msg,traceId:s})}),(function(e){o({code:"122",msg:"联通在线hs.wosms.cn 接口请求报错或者超时",traceId:s})}))})).catch((e=>{e=e.code?e:{code:"122",msg:"联通在线enrichgw 接口报错",traceId:s},o(e)})):o(a)})).catch((e=>{e=e.code?e:{code:"122",msg:"联通在线nisportal 接口报错",traceId:s},o(e)}))}else o(e)}),(function(){o({code:"122",msg:"联通在线 请求api/atrace 接口出错或者超时"})})):(o({code:-18,msg:"ts不能为空"}),!1):(o({code:-17,msg:"authenticator不能为空"}),!1):(o({code:-16,msg:"appKey不能为空"}),!1)}))},jsonp:function(e,t,n=5e3){return new Promise(((r,i)=>{var o=document.createElement("script");e+="&callback="+t,o.src=e,window[t]=function(e){clearTimeout(a),r(e)},o.onerror=function(e){clearTimeout(a),i(e)},document.body.insertBefore(o,document.body.firstChild);const a=setTimeout((()=>{o.onerror=null,i(new Error({code:"121",msg:"联通在线jsonp超时"}))}),n)}))},getUrlString:function(e,t){for(var n=e.split("?")[1].split("&"),r=0;r{canClick=!0,"0000"===e.code&&n.phone?(r.i(GATEWAY_SUCCESS,{process_id:n.process_id,accesscode:e.accessCode,phone:n.phone}),n.P(e,"0")):(r.i(GATEWAY_FAIL,Error$1.cu_online_pre_error(n.process_id)),n.P(e,"109"))})).catch((e=>{canClick=!0,r.i(GATEWAY_FAIL,Error$1.cu_online_pre_error(n.process_id)),n.P(e,"109")}))},F:function(e,t){var n=this,r=n.G;jsonp({path:e.option[t].url,query:{custId:e.option[t].custid},headers:{"Content-Type":"application/json;chartset=UTF-8",seqId:guid(),Authorization:e.option[t].auth,appId:e.option[t].appid},fullurl:!0,timeout:n.timeout,format:"json"}).R((function(e){canClick=!0,e&&e.success&&e.data.sessionId?(r.i(GATEWAY_SUCCESS,{process_id:n.process_id,phone:n.phone,accesscode:e.data.sessionId}),n.P(e,"0")):(r.i(GATEWAY_FAIL,Error$1.pre_getmobile_result(n.process_id)),n.P(e,"103"))}),(function(){canClick=!0,r.i(GATEWAY_FAIL,Error$1.pre_getmobile_net(n.process_id)),n.P({code:400,msg:"接口请求失败 ||超时"},"400")}))},W:function(){this.process_id=""},o:function(e,t){return this.G.o(e,t),this},P:function(e,t){t=t||"undefined";var n=(e&&"object"==typeof e&&(e=JSON.stringify(e)),this.process_id||e&&e.process_id),r=checkNetInfo();jsonp({protocol:this.protocol,domain:this.gtapi_domain,query:{process_id:n,code:t,metadata:e,cell:r},path:this.log_api,timeout:this.timeout})},$:function(){var e=this;jsonp({protocol:this.protocol,domain:this.gtapi_domain,path:this.config_api,query:{app_id:e.app_id,sdk:"3.0.2",presign:e.OnepassConfig.presign,presign_cu:e.OnepassConfig.presign_cu,clienttype:1,callback:e.OnepassConfig.cb,type:"pre",ts:e.OnepassConfig.ts},timeout:this.timeout}).R((function(t){e.OnepassConfig.haspreASK=!0,t&&200===t.status?(e.OnepassConfig.data=t,e.OnepassConfig.ip=t.data&&1===t.data.operator_rule||!1):(t=guid(),e.OnepassConfig.haspreASK=!0,e.OnepassConfig.ip=!1,e.P({process_id:t,msg:"请求webgetconfig出错"},"101"))}),(function(){var t=guid();e.OnepassConfig.haspreASK=!1,e.OnepassConfig.ip=!1,e.P({process_id:t,msg:"请求webgetconfig失败"},"100")}))},q:function(e,t){var n=this,r=n.G;CUAU.getAuthCode({clientId:e.option[t].client_id,sign:e.option[t].sign,timeout:n.timeout||3e4,result:function(e){"0"==e.code?e.operatorType&&"CU"===e.operatorType&&(canClick=!0,r.i(GATEWAY_SUCCESS,{process_id:n.process_id,phone:n.phone,accesscode:e.accesscode}),n.P(e,"0")):(canClick=!0,r.i(GATEWAY_FAIL,Error$1.cu_token_error(n.process_id)),n.P(e,"107"))}})},L:function(e,t){var n=this;GOP.hookOperator={value:e.data.operator,time:(new Date).getTime()},n.process_id=e.process_id,n.OnepassConfig.haspreASK=!1,e.data&&1===e.data.operator?n.N(e.data,e.data.operator):e.data&&3===e.data.operator?e.data.option[3].client_id?n.q(e.data,e.data.operator):n.D(e.data,e.data.operator):e.data&&4===e.data.operator?this.F(e.data,e.data.operator):n.Y(e.data,e.data.operator,t)}};var data=(e=[],{J:function(t,n){e[t]=n},M:function(t){return e[t]}}),e;function GOP(e){this.X=uid(),this.Z=!0,data.J(this.X,new Onepass(e))}return GOP.version="3.0.2",GOP.prototype={gateway:function(e){return this.Z&&data.M(this.X).O(e),this},onGatewaySuccess:function(e){return this.Z&&data.M(this.X).o(GATEWAY_SUCCESS,e),this},onGatewayFail:function(e){return this.Z&&data.M(this.X).o(GATEWAY_FAIL,e),this},checkNetInfo:function(){return checkNetInfo()}},GOP},module.exports=t()},function(e,t,n){"use strict";n.r(t);let r=n(19);t.default=r},function(e,t,n){(function(t,n,r){window,e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=21)}([function(e,t){e.exports={options:{usePureJavaScript:!1}}},function(e,i,o){(function(i){var a=o(0),s=o(24),c=e.exports=a.util=a.util||{};function u(e){if(8!==e&&16!==e&&24!==e&&32!==e)throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}function l(e){if(this.data="",this.read=0,"string"==typeof e)this.data=e;else if(c.isArrayBuffer(e)||c.isArrayBufferView(e))if(void 0!==t&&e instanceof t)this.data=e.toString("binary");else{var n=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,n)}catch(e){for(var r=0;r15?(i=Date.now(),s(e)):(t.push(e),1===t.length&&a.setAttribute("a",o=!o))}}c.nextTick=c.setImmediate}(),c.isNodejs=void 0!==n&&n.versions&&n.versions.node,c.globalScope=c.isNodejs?i:"undefined"==typeof self?window:self,c.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},c.isArrayBuffer=function(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer},c.isArrayBufferView=function(e){return e&&c.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},c.ByteBuffer=l,c.ByteStringBuffer=l,c.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},c.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},c.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},c.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},c.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var n=this.data;t>0;)1&t&&(n+=e),(t>>>=1)>0&&(e+=e);return this.data=n,this._optimizeConstructedString(t),this},c.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},c.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(c.encodeUtf8(e))},c.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},c.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},c.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},c.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},c.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},c.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))},c.ByteStringBuffer.prototype.putInt=function(e,t){u(t);var n="";do{t-=8,n+=String.fromCharCode(e>>t&255)}while(t>0);return this.putBytes(n)},c.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<0);return t},c.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),n=2<=n&&(t-=n<<1),t},c.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},c.ByteStringBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},c.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},c.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this},c.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},c.ByteStringBuffer.prototype.copy=function(){var e=c.createBuffer(this.data);return e.read=this.read,e},c.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},c.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},c.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this},c.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t=e)return this;t=Math.max(t||this.growSize,e);var n=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),r=new Uint8Array(this.length()+t);return r.set(n),this.data=new DataView(r.buffer),this},c.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},c.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var n=0;n>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},c.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},c.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},c.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this},c.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},c.DataBuffer.prototype.putInt=function(e,t){u(t),this.accommodate(t/8);do{t-=8,this.data.setInt8(this.write++,e>>t&255)}while(t>0);return this},c.DataBuffer.prototype.putSignedInt=function(e,t){return u(t),this.accommodate(t/8),e<0&&(e+=2<0);return t},c.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),n=2<=n&&(t-=n<<1),t},c.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},c.DataBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},c.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},c.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},c.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},c.DataBuffer.prototype.copy=function(){return new c.DataBuffer(this)},c.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this},c.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},c.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},c.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t0;)1&t&&(n+=e),(t>>>=1)>0&&(e+=e);return n},c.xorBytes=function(e,t,n){for(var r="",i="",o="",a=0,s=0;n>0;--n,++a)i=e.charCodeAt(a)^t.charCodeAt(a),s>=10&&(r+=o,o="",s=0),o+=String.fromCharCode(i),++s;return r+o},c.hexToBytes=function(e){var t="",n=0;for(!0&e.length&&(n=1,t+=String.fromCharCode(parseInt(e[0],16)));n>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)};var p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",d=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],h="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";c.encode64=function(e,t){for(var n,r,i,o="",a="",s=0;s>2),o+=p.charAt((3&n)<<4|r>>4),isNaN(r)?o+="==":(o+=p.charAt((15&r)<<2|i>>6),o+=isNaN(i)?"=":p.charAt(63&i)),t&&o.length>t&&(a+=o.substr(0,t)+"\r\n",o=o.substr(t));return a+o},c.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t,n,r,i,o="",a=0;a>4),64!==r&&(o+=String.fromCharCode((15&n)<<4|r>>2),64!==i&&(o+=String.fromCharCode((3&r)<<6|i)));return o},c.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},c.decodeUtf8=function(e){return decodeURIComponent(escape(e))},c.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:s.encode,decode:s.decode}},c.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},c.binary.raw.decode=function(e,t,n){var r=t;r||(r=new Uint8Array(e.length));for(var i=n=n||0,o=0;o>2),o+=p.charAt((3&n)<<4|r>>4),isNaN(r)?o+="==":(o+=p.charAt((15&r)<<2|i>>6),o+=isNaN(i)?"=":p.charAt(63&i)),t&&o.length>t&&(a+=o.substr(0,t)+"\r\n",o=o.substr(t));return a+o},c.binary.base64.decode=function(e,t,n){var r,i,o,a,s=t;s||(s=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var c=0,u=n=n||0;c>4,64!==o&&(s[u++]=(15&i)<<4|o>>2,64!==a&&(s[u++]=(3&o)<<6|a));return t?u-n:s.subarray(0,u)},c.binary.base58.encode=function(e,t){return c.binary.baseN.encode(e,h,t)},c.binary.base58.decode=function(e,t){return c.binary.baseN.decode(e,h,t)},c.text={utf8:{},utf16:{}},c.text.utf8.encode=function(e,t,n){e=c.encodeUtf8(e);var r=t;r||(r=new Uint8Array(e.length));for(var i=n=n||0,o=0;o0&&o.push(n),a=r.lastIndex;var s=t[0][1];switch(s){case"s":case"o":i");break;case"%":o.push("%");break;default:o.push("<%"+s+"?>")}}return o.push(e.substring(a)),o.join("")},c.formatNumber=function(e,t,n,r){var i=e,o=isNaN(t=Math.abs(t))?2:t,a=void 0===n?",":n,s=void 0===r?".":r,c=i<0?"-":"",u=parseInt(i=Math.abs(+i||0).toFixed(o),10)+"",l=u.length>3?u.length%3:0;return c+(l?u.substr(0,l)+s:"")+u.substr(l).replace(/(\d{3})(?=\d)/g,"$1"+s)+(o?a+Math.abs(i-u).toFixed(o).slice(2):"")},c.formatSize=function(e){return e>=1073741824?c.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?c.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?c.formatNumber(e/1024,0)+" KiB":c.formatNumber(e,0)+" bytes"},c.bytesFromIP=function(e){return-1!==e.indexOf(".")?c.bytesFromIPv4(e):-1!==e.indexOf(":")?c.bytesFromIPv6(e):null},c.bytesFromIPv4=function(e){if(4!==(e=e.split(".")).length)return null;for(var t=c.createBuffer(),n=0;nn[r].end-n[r].start&&(r=n.length-1)):n.push({start:s,end:s})}t.push(o)}if(n.length>0){var u=n[r];u.end-u.start>0&&(t.splice(u.start,u.end-u.start+1,""),0===u.start&&t.unshift(""),7===u.end&&t.push(""))}return t.join(":")},c.estimateCores=function(e,t){if("function"==typeof e&&(t=e,e={}),e=e||{},"cores"in c&&!e.update)return t(null,c.cores);if("undefined"!=typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return c.cores=navigator.hardwareConcurrency,t(null,c.cores);if("undefined"==typeof Worker)return c.cores=1,t(null,c.cores);if("undefined"==typeof Blob)return c.cores=2,t(null,c.cores);var n=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",(function(e){for(var t=Date.now(),n=t+4;Date.now()s.st&&i.sti.st&&s.stt){var r=new Error("Too few bytes to parse DER.");throw r.available=e.length(),r.remaining=t,r.requested=n,r}}i.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},i.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},i.create=function(e,t,n,o,a){if(r.util.isArray(o)){for(var s=[],c=0;cn){if(a.strict){var f=new Error("Too few bytes to read ASN.1 value.");throw f.available=t.length(),f.remaining=n,f.requested=h,f}h=n}var g=32==(32&c);if(g)if(p=[],void 0===h)for(;;){if(o(t,n,2),t.bytes(2)===String.fromCharCode(0,0)){t.getBytes(2),n-=2;break}s=t.length(),p.push(e(t,n,r+1,a)),n-=s-t.length()}else for(;h>0;)s=t.length(),p.push(e(t,h,r+1,a)),n-=s-t.length(),h-=s-t.length();if(void 0===p&&u===i.Class.UNIVERSAL&&l===i.Type.BITSTRING&&(d=t.bytes(h)),void 0===p&&a.decodeBitStrings&&u===i.Class.UNIVERSAL&&l===i.Type.BITSTRING&&h>1){var y=t.read,m=n,v=0;if(l===i.Type.BITSTRING&&(o(t,n,1),v=t.getByte(),n--),0===v)try{s=t.length();var b=e(t,n,r+1,{strict:!0,decodeBitStrings:!0}),C=s-t.length();n-=C,l==i.Type.BITSTRING&&C++;var E=b.tagClass;C!==h||E!==i.Class.UNIVERSAL&&E!==i.Class.CONTEXT_SPECIFIC||(p=[b])}catch(e){}void 0===p&&(t.read=y,n=m)}if(void 0===p){if(void 0===h){if(a.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");h=n}if(l===i.Type.BMPSTRING)for(p="";h>0;h-=2)o(t,n,2),p+=String.fromCharCode(t.getInt16()),n-=2;else p=t.getBytes(h),n-=h}var _=void 0===d?null:{bitStringContents:d};return i.create(u,l,g,p,_)}(e,e.length(),0,t);if(t.parseAllBytes&&0!==e.length()){var s=new Error("Unparsed DER bytes remain after ASN.1 parsing.");throw s.byteCount=n,s.remaining=e.length(),s}return a},i.toDer=function(e){var t=r.util.createBuffer(),n=e.tagClass|e.type,o=r.util.createBuffer(),a=!1;if("bitStringContents"in e&&(a=!0,e.original&&(a=i.equals(e,e.original))),a)o.putBytes(e.bitStringContents);else if(e.composed){e.constructed?n|=32:o.putByte(0);for(var s=0;s1&&(0===e.value.charCodeAt(0)&&0==(128&e.value.charCodeAt(1))||255===e.value.charCodeAt(0)&&128==(128&e.value.charCodeAt(1)))?o.putBytes(e.value.substr(1)):o.putBytes(e.value);if(t.putByte(n),o.length()<=127)t.putByte(127&o.length());else{var c=o.length(),u="";do{u+=String.fromCharCode(255&c),c>>>=8}while(c>0);for(t.putByte(128|u.length),s=u.length-1;s>=0;--s)t.putByte(u.charCodeAt(s))}return t.putBuffer(o),t},i.oidToDer=function(e){var t,n,i,o,a=e.split("."),s=r.util.createBuffer();s.putByte(40*parseInt(a[0],10)+parseInt(a[1],10));for(var c=2;c>>=7,t||(o|=128),n.push(o),t=!1}while(i>0);for(var u=n.length-1;u>=0;--u)s.putByte(n[u])}return s},i.derToOid=function(e){var t;"string"==typeof e&&(e=r.util.createBuffer(e));var n=e.getByte();t=Math.floor(n/40)+"."+n%40;for(var i=0;e.length()>0;)i<<=7,128&(n=e.getByte())?i+=127&n:(t+="."+(i+n),i=0);return t},i.utcTimeToDate=function(e){var t=new Date,n=parseInt(e.substr(0,2),10);n=n>=50?1900+n:2e3+n;var r=parseInt(e.substr(2,2),10)-1,i=parseInt(e.substr(4,2),10),o=parseInt(e.substr(6,2),10),a=parseInt(e.substr(8,2),10),s=0;if(e.length>11){var c=e.charAt(10),u=10;"+"!==c&&"-"!==c&&(s=parseInt(e.substr(10,2),10),u+=2)}if(t.setUTCFullYear(n,r,i),t.setUTCHours(o,a,s,0),u&&("+"===(c=e.charAt(u))||"-"===c)){var l=60*parseInt(e.substr(u+1,2),10)+parseInt(e.substr(u+4,2),10);l*=6e4,"+"===c?t.setTime(+t-l):t.setTime(+t+l)}return t},i.generalizedTimeToDate=function(e){var t=new Date,n=parseInt(e.substr(0,4),10),r=parseInt(e.substr(4,2),10)-1,i=parseInt(e.substr(6,2),10),o=parseInt(e.substr(8,2),10),a=parseInt(e.substr(10,2),10),s=parseInt(e.substr(12,2),10),c=0,u=0,l=!1;"Z"===e.charAt(e.length-1)&&(l=!0);var p=e.length-5,d=e.charAt(p);return"+"!==d&&"-"!==d||(u=60*parseInt(e.substr(p+1,2),10)+parseInt(e.substr(p+4,2),10),u*=6e4,"+"===d&&(u*=-1),l=!0),"."===e.charAt(14)&&(c=1e3*parseFloat(e.substr(14),10)),l?(t.setUTCFullYear(n,r,i),t.setUTCHours(o,a,s,c),t.setTime(+t+u)):(t.setFullYear(n,r,i),t.setHours(o,a,s,c)),t},i.dateToUtcTime=function(e){if("string"==typeof e)return e;var t="",n=[];n.push((""+e.getUTCFullYear()).substr(2)),n.push(""+(e.getUTCMonth()+1)),n.push(""+e.getUTCDate()),n.push(""+e.getUTCHours()),n.push(""+e.getUTCMinutes()),n.push(""+e.getUTCSeconds());for(var r=0;r=-128&&e<128)return t.putSignedInt(e,8);if(e>=-32768&&e<32768)return t.putSignedInt(e,16);if(e>=-8388608&&e<8388608)return t.putSignedInt(e,24);if(e>=-2147483648&&e<2147483648)return t.putSignedInt(e,32);var n=new Error("Integer too large; max is 32-bits.");throw n.integer=e,n},i.derToInteger=function(e){"string"==typeof e&&(e=r.util.createBuffer(e));var t=8*e.length();if(t>32)throw new Error("Integer too large; max is 32-bits.");return e.getSignedInt(t)},i.validate=function(e,t,n,o){var a=!1;if(e.tagClass!==t.tagClass&&void 0!==t.tagClass||e.type!==t.type&&void 0!==t.type)o&&(e.tagClass!==t.tagClass&&o.push("["+t.name+'] Expected tag class "'+t.tagClass+'", got "'+e.tagClass+'"'),e.type!==t.type&&o.push("["+t.name+'] Expected type "'+t.type+'", got "'+e.type+'"'));else if(e.constructed===t.constructed||void 0===t.constructed){if(a=!0,t.value&&r.util.isArray(t.value))for(var s=0,c=0;a&&c0&&(o+="\n");for(var s="",c=0;c1?o+="0x"+r.util.bytesToHex(e.value.slice(1)):o+="(none)",e.value.length>0){var d=e.value.charCodeAt(0);1==d?o+=" (1 unused bit shown)":d>1&&(o+=" ("+d+" unused bits shown)")}}else if(e.type===i.Type.OCTETSTRING)a.test(e.value)||(o+="("+e.value+") "),o+="0x"+r.util.bytesToHex(e.value);else if(e.type===i.Type.UTF8)try{o+=r.util.decodeUtf8(e.value)}catch(t){if("URI malformed"!==t.message)throw t;o+="0x"+r.util.bytesToHex(e.value)+" (malformed UTF8)"}else e.type===i.Type.PRINTABLESTRING||e.type===i.Type.IA5String?o+=e.value:a.test(e.value)?o+="0x"+r.util.bytesToHex(e.value):0===e.value.length?o+="[null]":o+=e.value}return o}},function(e,t,n){var r=n(0);r.pki=r.pki||{};var i=e.exports=r.pki.oids=r.oids=r.oids||{};function o(e,t){i[e]=t,i[t]=e}function a(e,t){i[e]=t}o("1.2.840.113549.1.1.1","rsaEncryption"),o("1.2.840.113549.1.1.4","md5WithRSAEncryption"),o("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),o("1.2.840.113549.1.1.7","RSAES-OAEP"),o("1.2.840.113549.1.1.8","mgf1"),o("1.2.840.113549.1.1.9","pSpecified"),o("1.2.840.113549.1.1.10","RSASSA-PSS"),o("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),o("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),o("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),o("1.3.101.112","EdDSA25519"),o("1.2.840.10040.4.3","dsa-with-sha1"),o("1.3.14.3.2.7","desCBC"),o("1.3.14.3.2.26","sha1"),o("1.3.14.3.2.29","sha1WithRSASignature"),o("2.16.840.1.101.3.4.2.1","sha256"),o("2.16.840.1.101.3.4.2.2","sha384"),o("2.16.840.1.101.3.4.2.3","sha512"),o("2.16.840.1.101.3.4.2.4","sha224"),o("2.16.840.1.101.3.4.2.5","sha512-224"),o("2.16.840.1.101.3.4.2.6","sha512-256"),o("1.2.840.113549.2.2","md2"),o("1.2.840.113549.2.5","md5"),o("1.2.840.113549.1.7.1","data"),o("1.2.840.113549.1.7.2","signedData"),o("1.2.840.113549.1.7.3","envelopedData"),o("1.2.840.113549.1.7.4","signedAndEnvelopedData"),o("1.2.840.113549.1.7.5","digestedData"),o("1.2.840.113549.1.7.6","encryptedData"),o("1.2.840.113549.1.9.1","emailAddress"),o("1.2.840.113549.1.9.2","unstructuredName"),o("1.2.840.113549.1.9.3","contentType"),o("1.2.840.113549.1.9.4","messageDigest"),o("1.2.840.113549.1.9.5","signingTime"),o("1.2.840.113549.1.9.6","counterSignature"),o("1.2.840.113549.1.9.7","challengePassword"),o("1.2.840.113549.1.9.8","unstructuredAddress"),o("1.2.840.113549.1.9.14","extensionRequest"),o("1.2.840.113549.1.9.20","friendlyName"),o("1.2.840.113549.1.9.21","localKeyId"),o("1.2.840.113549.1.9.22.1","x509Certificate"),o("1.2.840.113549.1.12.10.1.1","keyBag"),o("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),o("1.2.840.113549.1.12.10.1.3","certBag"),o("1.2.840.113549.1.12.10.1.4","crlBag"),o("1.2.840.113549.1.12.10.1.5","secretBag"),o("1.2.840.113549.1.12.10.1.6","safeContentsBag"),o("1.2.840.113549.1.5.13","pkcs5PBES2"),o("1.2.840.113549.1.5.12","pkcs5PBKDF2"),o("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),o("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),o("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),o("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),o("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),o("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),o("1.2.840.113549.2.7","hmacWithSHA1"),o("1.2.840.113549.2.8","hmacWithSHA224"),o("1.2.840.113549.2.9","hmacWithSHA256"),o("1.2.840.113549.2.10","hmacWithSHA384"),o("1.2.840.113549.2.11","hmacWithSHA512"),o("1.2.840.113549.3.7","des-EDE3-CBC"),o("2.16.840.1.101.3.4.1.2","aes128-CBC"),o("2.16.840.1.101.3.4.1.22","aes192-CBC"),o("2.16.840.1.101.3.4.1.42","aes256-CBC"),o("2.5.4.3","commonName"),o("2.5.4.4","surname"),o("2.5.4.5","serialNumber"),o("2.5.4.6","countryName"),o("2.5.4.7","localityName"),o("2.5.4.8","stateOrProvinceName"),o("2.5.4.9","streetAddress"),o("2.5.4.10","organizationName"),o("2.5.4.11","organizationalUnitName"),o("2.5.4.12","title"),o("2.5.4.13","description"),o("2.5.4.15","businessCategory"),o("2.5.4.17","postalCode"),o("2.5.4.42","givenName"),o("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName"),o("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName"),o("2.16.840.1.113730.1.1","nsCertType"),o("2.16.840.1.113730.1.13","nsComment"),a("2.5.29.1","authorityKeyIdentifier"),a("2.5.29.2","keyAttributes"),a("2.5.29.3","certificatePolicies"),a("2.5.29.4","keyUsageRestriction"),a("2.5.29.5","policyMapping"),a("2.5.29.6","subtreesConstraint"),a("2.5.29.7","subjectAltName"),a("2.5.29.8","issuerAltName"),a("2.5.29.9","subjectDirectoryAttributes"),a("2.5.29.10","basicConstraints"),a("2.5.29.11","nameConstraints"),a("2.5.29.12","policyConstraints"),a("2.5.29.13","basicConstraints"),o("2.5.29.14","subjectKeyIdentifier"),o("2.5.29.15","keyUsage"),a("2.5.29.16","privateKeyUsagePeriod"),o("2.5.29.17","subjectAltName"),o("2.5.29.18","issuerAltName"),o("2.5.29.19","basicConstraints"),a("2.5.29.20","cRLNumber"),a("2.5.29.21","cRLReason"),a("2.5.29.22","expirationDate"),a("2.5.29.23","instructionCode"),a("2.5.29.24","invalidityDate"),a("2.5.29.25","cRLDistributionPoints"),a("2.5.29.26","issuingDistributionPoint"),a("2.5.29.27","deltaCRLIndicator"),a("2.5.29.28","issuingDistributionPoint"),a("2.5.29.29","certificateIssuer"),a("2.5.29.30","nameConstraints"),o("2.5.29.31","cRLDistributionPoints"),o("2.5.29.32","certificatePolicies"),a("2.5.29.33","policyMappings"),a("2.5.29.34","policyConstraints"),o("2.5.29.35","authorityKeyIdentifier"),a("2.5.29.36","policyConstraints"),o("2.5.29.37","extKeyUsage"),a("2.5.29.46","freshestCRL"),a("2.5.29.54","inhibitAnyPolicy"),o("1.3.6.1.4.1.11129.2.4.2","timestampList"),o("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),o("1.3.6.1.5.5.7.3.1","serverAuth"),o("1.3.6.1.5.5.7.3.2","clientAuth"),o("1.3.6.1.5.5.7.3.3","codeSigning"),o("1.3.6.1.5.5.7.3.4","emailProtection"),o("1.3.6.1.5.5.7.3.8","timeStamping")},function(e,t,n){var r=n(0);function i(e,t){r.cipher.registerAlgorithm(e,(function(){return new r.aes.Algorithm(e,t)}))}n(11),n(12),n(1),e.exports=r.aes=r.aes||{},r.aes.startEncrypting=function(e,t,n,r){var i=f({key:e,output:n,decrypt:!1,mode:r});return i.start(t),i},r.aes.createEncryptionCipher=function(e,t){return f({key:e,output:null,decrypt:!1,mode:t})},r.aes.startDecrypting=function(e,t,n,r){var i=f({key:e,output:n,decrypt:!0,mode:r});return i.start(t),i},r.aes.createDecryptionCipher=function(e,t){return f({key:e,output:null,decrypt:!0,mode:t})},r.aes.Algorithm=function(e,t){l||p();var n=this;n.name=e,n.mode=new t({blockSize:16,cipher:{encrypt:function(e,t){return h(n._w,e,t,!1)},decrypt:function(e,t){return h(n._w,e,t,!0)}}}),n._init=!1},r.aes.Algorithm.prototype.initialize=function(e){if(!this._init){var t,n=e.key;if("string"!=typeof n||16!==n.length&&24!==n.length&&32!==n.length){if(r.util.isArray(n)&&(16===n.length||24===n.length||32===n.length)){t=n,n=r.util.createBuffer();for(var i=0;i>>=2,i=0;i>8^255&p^99,o[g]=p,a[p]=g,h=(d=e[p])<<24^p<<16^p<<8^p^d,f=((n=e[g])^(r=e[n])^(i=e[r]))<<24^(g^i)<<16^(g^r^i)<<8^g^n^i;for(var m=0;m<4;++m)c[m][g]=h,u[m][p]=f,h=h<<24|h>>>8,f=f<<24|f>>>8;0===g?g=y=1:(g=n^e[e[e[n^i]]],y^=e[e[y]])}}function d(e,t){for(var n,r=e.slice(0),i=1,a=r.length,c=4*(a+6+1),l=a;l>>16&255]<<24^o[n>>>8&255]<<16^o[255&n]<<8^o[n>>>24]^s[i]<<24,i++):a>6&&l%a==4&&(n=o[n>>>24]<<24^o[n>>>16&255]<<16^o[n>>>8&255]<<8^o[255&n]),r[l]=r[l-a]^n;if(t){for(var p,d=u[0],h=u[1],f=u[2],g=u[3],y=r.slice(0),m=(l=0,(c=r.length)-4);l>>24]]^h[o[p>>>16&255]]^f[o[p>>>8&255]]^g[o[255&p]];r=y}return r}function h(e,t,n,r){var i,s,l,p,d,h,f,g,y,m,v,b,C=e.length/4-1;r?(i=u[0],s=u[1],l=u[2],p=u[3],d=a):(i=c[0],s=c[1],l=c[2],p=c[3],d=o),h=t[0]^e[0],f=t[r?3:1]^e[1],g=t[2]^e[2],y=t[r?1:3]^e[3];for(var E=3,_=1;_>>24]^s[f>>>16&255]^l[g>>>8&255]^p[255&y]^e[++E],v=i[f>>>24]^s[g>>>16&255]^l[y>>>8&255]^p[255&h]^e[++E],b=i[g>>>24]^s[y>>>16&255]^l[h>>>8&255]^p[255&f]^e[++E],y=i[y>>>24]^s[h>>>16&255]^l[f>>>8&255]^p[255&g]^e[++E],h=m,f=v,g=b;n[0]=d[h>>>24]<<24^d[f>>>16&255]<<16^d[g>>>8&255]<<8^d[255&y]^e[++E],n[r?3:1]=d[f>>>24]<<24^d[g>>>16&255]<<16^d[y>>>8&255]<<8^d[255&h]^e[++E],n[2]=d[g>>>24]<<24^d[y>>>16&255]<<16^d[h>>>8&255]<<8^d[255&f]^e[++E],n[r?1:3]=d[y>>>24]<<24^d[h>>>16&255]<<16^d[f>>>8&255]<<8^d[255&g]^e[++E]}function f(e){var t,n="AES-"+((e=e||{}).mode||"CBC").toUpperCase(),i=(t=e.decrypt?r.cipher.createDecipher(n,e.key):r.cipher.createCipher(n,e.key)).start;return t.start=function(e,n){var o=null;n instanceof r.util.ByteBuffer&&(o=n,n={}),(n=n||{}).output=o,n.iv=e,i.call(t,n)},t}},function(e,t,n){var r=n(0);n(1);var i=e.exports=r.pem=r.pem||{};function o(e){for(var t=e.name+": ",n=[],r=function(e,t){return" "+t},i=0;i65&&-1!==a){var s=t[a];","===s?(++a,t=t.substr(0,a)+"\r\n "+t.substr(a)):t=t.substr(0,a)+"\r\n"+s+t.substr(a+1),o=i-a-1,a=-1,++i}else" "!==t[i]&&"\t"!==t[i]&&","!==t[i]||(a=i);return t}function a(e){return e.replace(/^\s+/,"")}i.encode=function(e,t){t=t||{};var n,i="-----BEGIN "+e.type+"-----\r\n";if(e.procType&&(i+=o(n={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]})),e.contentDomain&&(i+=o(n={name:"Content-Domain",values:[e.contentDomain]})),e.dekInfo&&(n={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&n.values.push(e.dekInfo.parameters),i+=o(n)),e.headers)for(var a=0;a=0||!o.gcd(t.n).equals(i.ONE));for(var a=(e=e.multiply(o.modPow(t.e,t.n)).mod(t.n)).mod(t.p).modPow(t.dP,t.p),s=e.mod(t.q).modPow(t.dQ,t.q);a.compareTo(s)<0;)a=a.add(t.p);var c=a.subtract(s).multiply(t.qInv).mod(t.p).multiply(t.q).add(s);return c.multiply(o.modInverse(t.n)).mod(t.n)};function m(e,t,n){var i=r.util.createBuffer(),o=Math.ceil(t.n.bitLength()/8);if(e.length>o-11){var a=new Error("Message is too long for PKCS#1 v1.5 padding.");throw a.length=e.length,a.max=o-11,a}i.putByte(0),i.putByte(n);var s,c=o-3-e.length;if(0===n||1===n){s=0===n?0:255;for(var u=0;u0;){var l=0,p=r.random.getBytes(c);for(u=0;u1;){if(255!==a.getByte()){--a.read;break}++u}else if(2===c)for(u=0;a.length()>1;){if(0===a.getByte()){--a.read;break}++u}if(0!==a.getByte()||u!==o-3-a.length())throw new Error("Encryption block is invalid.");return a.getBytes()}function b(e,t,n){"function"==typeof t&&(n=t,t={});var o={algorithm:{name:(t=t||{}).algorithm||"PRIMEINC",options:{workers:t.workers||2,workLoad:t.workLoad||100,workerScript:t.workerScript}}};function a(){s(e.pBits,(function(t,r){return t?n(t):(e.p=r,null!==e.q?u(t,e.q):void s(e.qBits,u))}))}function s(e,t){r.prime.generateProbablePrime(e,o,t)}function u(t,r){if(t)return n(t);if(e.q=r,e.p.compareTo(e.q)<0){var o=e.p;e.p=e.q,e.q=o}if(0!==e.p.subtract(i.ONE).gcd(e.e).compareTo(i.ONE))return e.p=null,void a();if(0!==e.q.subtract(i.ONE).gcd(e.e).compareTo(i.ONE))return e.q=null,void s(e.qBits,u);if(e.p1=e.p.subtract(i.ONE),e.q1=e.q.subtract(i.ONE),e.phi=e.p1.multiply(e.q1),0!==e.phi.gcd(e.e).compareTo(i.ONE))return e.p=e.q=null,void a();if(e.n=e.p.multiply(e.q),e.n.bitLength()!==e.bits)return e.q=null,void s(e.qBits,u);var l=e.e.modInverse(e.phi);e.keys={privateKey:c.rsa.setPrivateKey(e.n,e.e,l,e.p,e.q,l.mod(e.p1),l.mod(e.q1),e.q.modInverse(e.p)),publicKey:c.rsa.setPublicKey(e.n,e.e)},n(null,e.keys)}"prng"in t&&(o.prng=t.prng),a()}function C(e){var t=e.toString(16);t[0]>="8"&&(t="00"+t);var n=r.util.hexToBytes(t);return n.length>1&&(0===n.charCodeAt(0)&&0==(128&n.charCodeAt(1))||255===n.charCodeAt(0)&&128==(128&n.charCodeAt(1)))?n.substr(1):n}function E(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}function _(e){return r.util.isNodejs&&"function"==typeof o[e]}function S(e){return void 0!==s.globalScope&&"object"==typeof s.globalScope.crypto&&"object"==typeof s.globalScope.crypto.subtle&&"function"==typeof s.globalScope.crypto.subtle[e]}function T(e){return void 0!==s.globalScope&&"object"==typeof s.globalScope.msCrypto&&"object"==typeof s.globalScope.msCrypto.subtle&&"function"==typeof s.globalScope.msCrypto.subtle[e]}function A(e){for(var t=r.util.hexToBytes(e.toString(16)),n=new Uint8Array(t.length),i=0;i0;)l.putByte(0),--p;return l.putBytes(r.util.hexToBytes(u)),l.getBytes()},c.rsa.decrypt=function(e,t,n,o){var a=Math.ceil(t.n.bitLength()/8);if(e.length!==a){var s=new Error("Encrypted message length is invalid.");throw s.length=e.length,s.expected=a,s}var c=new i(r.util.createBuffer(e).toHex(),16);if(c.compareTo(t.n)>=0)throw new Error("Encrypted message is invalid.");for(var u=y(c,t,n).toString(16),l=r.util.createBuffer(),p=a-Math.ceil(u.length/2);p>0;)l.putByte(0),--p;return l.putBytes(r.util.hexToBytes(u)),!1!==o?v(l.getBytes(),t,n):l.getBytes()},c.rsa.createKeyPairGenerationState=function(e,t,n){"string"==typeof e&&(e=parseInt(e,10)),e=e||2048;var o,a=(n=n||{}).prng||r.random,s={nextBytes:function(e){for(var t=a.getBytesSync(e.length),n=0;n>1,pBits:e-(e>>1),pqState:0,num:null,keys:null}).e.fromInt(o.eInt),o},c.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var n=new i(null);n.fromInt(30);for(var r,o=0,a=function(e,t){return e|t},s=+new Date,l=0;null===e.keys&&(t<=0||lp?e.pqState=0:e.num.isProbablePrime(E(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(u[o++%8],0):2===e.pqState?e.pqState=0===e.num.subtract(i.ONE).gcd(e.e).compareTo(i.ONE)?3:0:3===e.pqState&&(e.pqState=0,null===e.p?e.p=e.num:e.q=e.num,null!==e.p&&null!==e.q&&++e.state,e.num=null)}else if(1===e.state)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(2===e.state)e.p1=e.p.subtract(i.ONE),e.q1=e.q.subtract(i.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(3===e.state)0===e.phi.gcd(e.e).compareTo(i.ONE)?++e.state:(e.p=null,e.q=null,e.state=0);else if(4===e.state)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(5===e.state){var h=e.e.modInverse(e.phi);e.keys={privateKey:c.rsa.setPrivateKey(e.n,e.e,h,e.p,e.q,h.mod(e.p1),h.mod(e.q1),e.q.modInverse(e.p)),publicKey:c.rsa.setPublicKey(e.n,e.e)}}l+=(r=+new Date)-s,s=r}return null!==e.keys},c.rsa.generateKeyPair=function(e,t,n,i){if(1===arguments.length?"object"==typeof e?(n=e,e=void 0):"function"==typeof e&&(i=e,e=void 0):2===arguments.length?"number"==typeof e?"function"==typeof t?(i=t,t=void 0):"number"!=typeof t&&(n=t,t=void 0):(n=e,i=t,e=void 0,t=void 0):3===arguments.length&&("number"==typeof t?"function"==typeof n&&(i=n,n=void 0):(i=n,n=t,t=void 0)),n=n||{},void 0===e&&(e=n.bits||2048),void 0===t&&(t=n.e||65537),!r.options.usePureJavaScript&&!n.prng&&e>=256&&e<=16384&&(65537===t||3===t))if(i){if(_("generateKeyPair"))return o.generateKeyPair("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},(function(e,t,n){if(e)return i(e);i(null,{privateKey:c.privateKeyFromPem(n),publicKey:c.publicKeyFromPem(t)})}));if(S("generateKey")&&S("exportKey"))return s.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:A(t),hash:{name:"SHA-256"}},!0,["sign","verify"]).then((function(e){return s.globalScope.crypto.subtle.exportKey("pkcs8",e.privateKey)})).then(void 0,(function(e){i(e)})).then((function(e){if(e){var t=c.privateKeyFromAsn1(a.fromDer(r.util.createBuffer(e)));i(null,{privateKey:t,publicKey:c.setRsaPublicKey(t.n,t.e)})}}));if(T("generateKey")&&T("exportKey")){var u=s.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:A(t),hash:{name:"SHA-256"}},!0,["sign","verify"]);return u.oncomplete=function(e){var t=e.target.result,n=s.globalScope.msCrypto.subtle.exportKey("pkcs8",t.privateKey);n.oncomplete=function(e){var t=e.target.result,n=c.privateKeyFromAsn1(a.fromDer(r.util.createBuffer(t)));i(null,{privateKey:n,publicKey:c.setRsaPublicKey(n.n,n.e)})},n.onerror=function(e){i(e)}},void(u.onerror=function(e){i(e)})}}else if(_("generateKeyPairSync")){var l=o.generateKeyPairSync("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:c.privateKeyFromPem(l.privateKey),publicKey:c.publicKeyFromPem(l.publicKey)}}var p=c.rsa.createKeyPairGenerationState(e,t,n);if(!i)return c.rsa.stepKeyPairGenerationState(p,0),p.keys;b(p,n,i)},c.setRsaPublicKey=c.rsa.setPublicKey=function(e,t){var n={n:e,e:t,encrypt:function(e,t,i){if("string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5"),"RSAES-PKCS1-V1_5"===t)t={encode:function(e,t,n){return m(e,t,2).getBytes()}};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={encode:function(e,t){return r.pkcs1.encode_rsa_oaep(t,e,i)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(t))t={encode:function(e){return e}};else if("string"==typeof t)throw new Error('Unsupported encryption scheme: "'+t+'".');var o=t.encode(e,n,!0);return c.rsa.encrypt(o,n,!0)},verify:function(e,t,i,o){"string"==typeof i?i=i.toUpperCase():void 0===i&&(i="RSASSA-PKCS1-V1_5"),void 0===o&&(o={_parseAllDigestBytes:!0}),"_parseAllDigestBytes"in o||(o._parseAllDigestBytes=!0),"RSASSA-PKCS1-V1_5"===i?i={verify:function(e,t){t=v(t,n,!0);var i=a.fromDer(t,{parseAllBytes:o._parseAllDigestBytes}),s={},c=[];if(!a.validate(i,f,s,c))throw(u=new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value.")).errors=c,u;var u,l=a.derToOid(s.algorithmIdentifier);if(l!==r.oids.md2&&l!==r.oids.md5&&l!==r.oids.sha1&&l!==r.oids.sha224&&l!==r.oids.sha256&&l!==r.oids.sha384&&l!==r.oids.sha512&&l!==r.oids["sha512-224"]&&l!==r.oids["sha512-256"])throw(u=new Error("Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.")).oid=l,u;if((l===r.oids.md2||l===r.oids.md5)&&!("parameters"in s))throw new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value. Missing algorithm identifer NULL parameters.");return e===s.digest}}:"NONE"!==i&&"NULL"!==i&&null!==i||(i={verify:function(e,t){return e===v(t,n,!0)}});var s=c.rsa.decrypt(t,n,!0,!1);return i.verify(e,s,n.n.bitLength())}};return n},c.setRsaPrivateKey=c.rsa.setPrivateKey=function(e,t,n,i,o,a,s,u){var l={n:e,e:t,d:n,p:i,q:o,dP:a,dQ:s,qInv:u,decrypt:function(e,t,n){"string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5");var i=c.rsa.decrypt(e,l,!1,!1);if("RSAES-PKCS1-V1_5"===t)t={decode:v};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={decode:function(e,t){return r.pkcs1.decode_rsa_oaep(t,e,n)}};else{if(-1===["RAW","NONE","NULL",null].indexOf(t))throw new Error('Unsupported encryption scheme: "'+t+'".');t={decode:function(e){return e}}}return t.decode(i,l,!1)},sign:function(e,t){var n=!1;"string"==typeof t&&(t=t.toUpperCase()),void 0===t||"RSASSA-PKCS1-V1_5"===t?(t={encode:g},n=1):"NONE"!==t&&"NULL"!==t&&null!==t||(t={encode:function(){return e}},n=1);var r=t.encode(e,l.n.bitLength());return c.rsa.encrypt(r,l,n)}};return l},c.wrapRsaPrivateKey=function(e){return a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,a.integerToDer(0).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(c.oids.rsaEncryption).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.NULL,!1,"")]),a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,a.toDer(e).getBytes())])},c.privateKeyFromAsn1=function(e){var t,n,o,s,u,d,h,f,g={},y=[];if(a.validate(e,l,g,y)&&(e=a.fromDer(r.util.createBuffer(g.privateKey))),g={},y=[],!a.validate(e,p,g,y)){var m=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw m.errors=y,m}return t=r.util.createBuffer(g.privateKeyModulus).toHex(),n=r.util.createBuffer(g.privateKeyPublicExponent).toHex(),o=r.util.createBuffer(g.privateKeyPrivateExponent).toHex(),s=r.util.createBuffer(g.privateKeyPrime1).toHex(),u=r.util.createBuffer(g.privateKeyPrime2).toHex(),d=r.util.createBuffer(g.privateKeyExponent1).toHex(),h=r.util.createBuffer(g.privateKeyExponent2).toHex(),f=r.util.createBuffer(g.privateKeyCoefficient).toHex(),c.setRsaPrivateKey(new i(t,16),new i(n,16),new i(o,16),new i(s,16),new i(u,16),new i(d,16),new i(h,16),new i(f,16))},c.privateKeyToAsn1=c.privateKeyToRSAPrivateKey=function(e){return a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,a.integerToDer(0).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,C(e.n)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,C(e.e)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,C(e.d)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,C(e.p)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,C(e.q)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,C(e.dP)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,C(e.dQ)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,C(e.qInv))])},c.publicKeyFromAsn1=function(e){var t={},n=[];if(a.validate(e,h,t,n)){var o,s=a.derToOid(t.publicKeyOid);if(s!==c.oids.rsaEncryption)throw(o=new Error("Cannot read public key. Unknown OID.")).oid=s,o;e=t.rsaPublicKey}if(n=[],!a.validate(e,d,t,n))throw(o=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.")).errors=n,o;var u=r.util.createBuffer(t.publicKeyModulus).toHex(),l=r.util.createBuffer(t.publicKeyExponent).toHex();return c.setRsaPublicKey(new i(u,16),new i(l,16))},c.publicKeyToAsn1=c.publicKeyToSubjectPublicKeyInfo=function(e){return a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(c.oids.rsaEncryption).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.NULL,!1,"")]),a.create(a.Class.UNIVERSAL,a.Type.BITSTRING,!1,[c.publicKeyToRSAPublicKey(e)])])},c.publicKeyToRSAPublicKey=function(e){return a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,C(e.n)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,C(e.e))])}},function(e,t,n){var r=n(0);n(2),n(1);var i=e.exports=r.sha1=r.sha1||{};r.md.sha1=r.md.algorithms.sha1=i,i.create=function(){a||(o=String.fromCharCode(128),o+=r.util.fillString(String.fromCharCode(0),64),a=!0);var e=null,t=r.util.createBuffer(),n=new Array(80),i={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){i.messageLength=0,i.fullMessageLength=i.messageLength64=[];for(var n=i.messageLengthSize/4,o=0;o>>0,c>>>0];for(var u=i.fullMessageLength.length-1;u>=0;--u)i.fullMessageLength[u]+=c[1],c[1]=c[0]+(i.fullMessageLength[u]/4294967296>>>0),i.fullMessageLength[u]=i.fullMessageLength[u]>>>0,c[0]=c[1]/4294967296>>>0;return t.putBytes(o),s(e,n,t),(t.read>2048||0===t.length())&&t.compact(),i},i.digest=function(){var a=r.util.createBuffer();a.putBytes(t.bytes());var c,u=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize&i.blockLength-1;a.putBytes(o.substr(0,i.blockLength-u));for(var l=8*i.fullMessageLength[0],p=0;p>>0,a.putInt32(l>>>0),l=c>>>0;a.putInt32(l);var d={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4};s(d,n,a);var h=r.util.createBuffer();return h.putInt32(d.h0),h.putInt32(d.h1),h.putInt32(d.h2),h.putInt32(d.h3),h.putInt32(d.h4),h},i};var o=null,a=!1;function s(e,t,n){for(var r,i,o,a,s,c,u,l=n.length();l>=64;){for(i=e.h0,o=e.h1,a=e.h2,s=e.h3,c=e.h4,u=0;u<16;++u)r=n.getInt32(),t[u]=r,r=(i<<5|i>>>27)+(s^o&(a^s))+c+1518500249+r,c=s,s=a,a=(o<<30|o>>>2)>>>0,o=i,i=r;for(;u<20;++u)r=(r=t[u-3]^t[u-8]^t[u-14]^t[u-16])<<1|r>>>31,t[u]=r,r=(i<<5|i>>>27)+(s^o&(a^s))+c+1518500249+r,c=s,s=a,a=(o<<30|o>>>2)>>>0,o=i,i=r;for(;u<32;++u)r=(r=t[u-3]^t[u-8]^t[u-14]^t[u-16])<<1|r>>>31,t[u]=r,r=(i<<5|i>>>27)+(o^a^s)+c+1859775393+r,c=s,s=a,a=(o<<30|o>>>2)>>>0,o=i,i=r;for(;u<40;++u)r=(r=t[u-6]^t[u-16]^t[u-28]^t[u-32])<<2|r>>>30,t[u]=r,r=(i<<5|i>>>27)+(o^a^s)+c+1859775393+r,c=s,s=a,a=(o<<30|o>>>2)>>>0,o=i,i=r;for(;u<60;++u)r=(r=t[u-6]^t[u-16]^t[u-28]^t[u-32])<<2|r>>>30,t[u]=r,r=(i<<5|i>>>27)+(o&a|s&(o^a))+c+2400959708+r,c=s,s=a,a=(o<<30|o>>>2)>>>0,o=i,i=r;for(;u<80;++u)r=(r=t[u-6]^t[u-16]^t[u-28]^t[u-32])<<2|r>>>30,t[u]=r,r=(i<<5|i>>>27)+(o^a^s)+c+3395469782+r,c=s,s=a,a=(o<<30|o>>>2)>>>0,o=i,i=r;e.h0=e.h0+i|0,e.h1=e.h1+o|0,e.h2=e.h2+a|0,e.h3=e.h3+s|0,e.h4=e.h4+c|0,l-=64}}},function(e,t){},function(e,t,n){var r=n(0);n(1),e.exports=r.cipher=r.cipher||{},r.cipher.algorithms=r.cipher.algorithms||{},r.cipher.createCipher=function(e,t){var n=e;if("string"==typeof n&&(n=r.cipher.getAlgorithm(n))&&(n=n()),!n)throw new Error("Unsupported algorithm: "+e);return new r.cipher.BlockCipher({algorithm:n,key:t,decrypt:!1})},r.cipher.createDecipher=function(e,t){var n=e;if("string"==typeof n&&(n=r.cipher.getAlgorithm(n))&&(n=n()),!n)throw new Error("Unsupported algorithm: "+e);return new r.cipher.BlockCipher({algorithm:n,key:t,decrypt:!0})},r.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),r.cipher.algorithms[e]=t},r.cipher.getAlgorithm=function(e){return(e=e.toUpperCase())in r.cipher.algorithms?r.cipher.algorithms[e]:null};var i=r.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};i.prototype.start=function(e){e=e||{};var t={};for(var n in e)t[n]=e[n];t.decrypt=this._decrypt,this._finish=!1,this._input=r.util.createBuffer(),this.output=e.output||r.util.createBuffer(),this.mode.start(t)},i.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},i.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t)||(this._finish=!0,this.update(),this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t)||this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))}},function(e,t,n){var r=n(0);n(1),r.cipher=r.cipher||{};var i=e.exports=r.cipher.modes=r.cipher.modes||{};function o(e,t){if("string"==typeof e&&(e=r.util.createBuffer(e)),r.util.isArray(e)&&e.length>4){var n=e;e=r.util.createBuffer();for(var i=0;i0))return!0;for(var r=0;r0))return!0;for(var r=0;r0)return!1;var n=e.length(),r=e.at(n-1);return!(r>this.blockSize<<2||(e.truncate(r),0))},i.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},i.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=o(e.iv,this.blockSize),this._prev=this._iv.slice(0)}},i.cbc.prototype.encrypt=function(e,t,n){if(e.length()0))return!0;for(var r=0;r0))return!0;for(var r=0;r0)return!1;var n=e.length(),r=e.at(n-1);return!(r>this.blockSize<<2||(e.truncate(r),0))},i.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=r.util.createBuffer(),this._partialBytes=0},i.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=o(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.cfb.prototype.encrypt=function(e,t,n){var r=e.length();if(0===r)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&r>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear(),i=0;i0)e.read-=this.blockSize;else for(i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!n)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0}},i.cfb.prototype.decrypt=function(e,t,n){var r=e.length();if(0===r)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&r>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear(),i=0;i0)e.read-=this.blockSize;else for(i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!n)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0}},i.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=r.util.createBuffer(),this._partialBytes=0},i.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=o(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.ofb.prototype.encrypt=function(e,t,n){var r=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&r>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear(),i=0;i0)e.read-=this.blockSize;else for(i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!n)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0}},i.ofb.prototype.decrypt=i.ofb.prototype.encrypt,i.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=r.util.createBuffer(),this._partialBytes=0},i.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=o(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.ctr.prototype.encrypt=function(e,t,n){var r=e.length();if(0===r)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&r>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear(),i=0;i0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!n)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0}a(this._inBlock)},i.ctr.prototype.decrypt=i.ctr.prototype.encrypt,i.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=r.util.createBuffer(),this._partialBytes=0,this._R=3774873600},i.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t,n=r.util.createBuffer(e.iv);if(this._cipherLength=0,t="additionalData"in e?r.util.createBuffer(e.additionalData):r.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=r.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var i=n.length();if(12===i)this._j0=[n.getInt32(),n.getInt32(),n.getInt32(),1];else{for(this._j0=[0,0,0,0];n.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[n.getInt32(),n.getInt32(),n.getInt32(),n.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(s(8*i)))}this._inBlock=this._j0.slice(0),a(this._inBlock),this._partialBytes=0,t=r.util.createBuffer(t),this._aDataLength=s(8*t.length());var o=t.length()%this.blockSize;for(o&&t.fillWithByte(0,this.blockSize-o),this._s=[0,0,0,0];t.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()])},i.gcm.prototype.encrypt=function(e,t,n){var r=e.length();if(0===r)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&r>=this.blockSize){for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear(),i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!n)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),a(this._inBlock)},i.gcm.prototype.decrypt=function(e,t,n){var r=e.length();if(r0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),a(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i0;--r)t[r]=e[r]>>>1|(1&e[r-1])<<31;t[0]=e[0]>>>1,n&&(t[0]^=this._R)},i.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],n=0;n<32;++n){var r=e[n/8|0]>>>4*(7-n%8)&15,i=this._m[n][r];t[0]^=i[0],t[1]^=i[1],t[2]^=i[2],t[3]^=i[3]}return t},i.gcm.prototype.ghash=function(e,t,n){return t[0]^=n[0],t[1]^=n[1],t[2]^=n[2],t[3]^=n[3],this.tableMultiply(t)},i.gcm.prototype.generateHashTable=function(e,t){for(var n=8/t,r=4*n,i=16*n,o=new Array(i),a=0;a>>1,i=new Array(n);i[r]=e.slice(0);for(var o=r>>>1;o>0;)this.pow(i[2*o],i[o]=[]),o>>=1;for(o=2;o>>0,s>>>0];for(var u=i.fullMessageLength.length-1;u>=0;--u)i.fullMessageLength[u]+=s[1],s[1]=s[0]+(i.fullMessageLength[u]/4294967296>>>0),i.fullMessageLength[u]=i.fullMessageLength[u]>>>0,s[0]=s[1]/4294967296>>>0;return t.putBytes(o),c(e,n,t),(t.read>2048||0===t.length())&&t.compact(),i},i.digest=function(){var a=r.util.createBuffer();a.putBytes(t.bytes());var s,u=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize&i.blockLength-1;a.putBytes(o.substr(0,i.blockLength-u));for(var l=8*i.fullMessageLength[0],p=0;p>>0,a.putInt32(l>>>0),l=s>>>0;a.putInt32(l);var d={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4,h5:e.h5,h6:e.h6,h7:e.h7};c(d,n,a);var h=r.util.createBuffer();return h.putInt32(d.h0),h.putInt32(d.h1),h.putInt32(d.h2),h.putInt32(d.h3),h.putInt32(d.h4),h.putInt32(d.h5),h.putInt32(d.h6),h.putInt32(d.h7),h},i};var o=null,a=!1,s=null;function c(e,t,n){for(var r,i,o,a,c,u,l,p,d,h,f,g,y,m=n.length();m>=64;){for(c=0;c<16;++c)t[c]=n.getInt32();for(;c<64;++c)r=((r=t[c-2])>>>17|r<<15)^(r>>>19|r<<13)^r>>>10,i=((i=t[c-15])>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,t[c]=r+t[c-7]+i+t[c-16]|0;for(u=e.h0,l=e.h1,p=e.h2,d=e.h3,h=e.h4,f=e.h5,g=e.h6,y=e.h7,c=0;c<64;++c)o=(u>>>2|u<<30)^(u>>>13|u<<19)^(u>>>22|u<<10),a=u&l|p&(u^l),r=y+((h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7))+(g^h&(f^g))+s[c]+t[c],y=g,g=f,f=h,h=d+r>>>0,d=p,p=l,l=u,u=r+(i=o+a)>>>0;e.h0=e.h0+u|0,e.h1=e.h1+l|0,e.h2=e.h2+p|0,e.h3=e.h3+d|0,e.h4=e.h4+h|0,e.h5=e.h5+f|0,e.h6=e.h6+g|0,e.h7=e.h7+y|0,m-=64}}},function(e,t,n){var r=n(0);if(n(6),n(4),n(15),n(2),n(5),n(16),n(7),n(3),n(30),n(8),n(1),void 0===i)var i=r.jsbn.BigInteger;var o=r.asn1,a=r.pki=r.pki||{};e.exports=a.pbe=r.pbe=r.pbe||{};var s=a.oids,c={name:"EncryptedPrivateKeyInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},u={name:"PBES2Algorithms",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},l={name:"pkcs-12PbeParams",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"iterations"}]};function p(e,t){return e.start().update(t).digest().getBytes()}function d(e){var t;if(e){if(!(t=a.oids[o.derToOid(e)])){var n=new Error("Unsupported PRF OID.");throw n.oid=e,n.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],n}}else t="hmacWithSHA1";return h(t)}function h(e){var t=r.md;switch(e){case"hmacWithSHA224":t=r.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":e=e.substr(8).toLowerCase();break;default:var n=new Error("Unsupported PRF algorithm.");throw n.algorithm=e,n.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],n}if(!t||!(e in t))throw new Error("Unknown hash algorithm: "+e);return t[e].create()}a.encryptPrivateKeyInfo=function(e,t,n){(n=n||{}).saltSize=n.saltSize||8,n.count=n.count||2048,n.algorithm=n.algorithm||"aes128",n.prfAlgorithm=n.prfAlgorithm||"sha1";var i,c,u,l=r.random.getBytesSync(n.saltSize),p=n.count,d=o.integerToDer(p);if(0===n.algorithm.indexOf("aes")||"des"===n.algorithm){var f,g,y;switch(n.algorithm){case"aes128":i=16,f=16,g=s["aes128-CBC"],y=r.aes.createEncryptionCipher;break;case"aes192":i=24,f=16,g=s["aes192-CBC"],y=r.aes.createEncryptionCipher;break;case"aes256":i=32,f=16,g=s["aes256-CBC"],y=r.aes.createEncryptionCipher;break;case"des":i=8,f=8,g=s.desCBC,y=r.des.createEncryptionCipher;break;default:throw(_=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=n.algorithm,_}var m="hmacWith"+n.prfAlgorithm.toUpperCase(),v=h(m),b=r.pkcs5.pbkdf2(t,l,p,i,v),C=r.random.getBytesSync(f);(S=y(b)).start(C),S.update(o.toDer(e)),S.finish(),u=S.output.getBytes();var E=function(e,t,n,i){var s=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,e),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,t.getBytes())]);return"hmacWithSHA1"!==i&&s.value.push(o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,r.util.hexToBytes(n.toString(16))),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(a.oids[i]).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,"")])),s}(l,d,i,m);c=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(s.pkcs5PBES2).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(s.pkcs5PBKDF2).getBytes()),E]),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(g).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,C)])])])}else{var _;if("3des"!==n.algorithm)throw(_=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=n.algorithm,_;i=24;var S,T=new r.util.ByteBuffer(l);b=a.pbe.generatePkcs12Key(t,T,1,p,i),C=a.pbe.generatePkcs12Key(t,T,2,p,i),(S=r.des.createEncryptionCipher(b)).start(C),S.update(o.toDer(e)),S.finish(),u=S.output.getBytes(),c=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(s["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,l),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,d.getBytes())])])}return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[c,o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,u)])},a.decryptPrivateKeyInfo=function(e,t){var n=null,i={},s=[];if(!o.validate(e,c,i,s)){var u=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw u.errors=s,u}var l=o.derToOid(i.encryptionOid),p=a.pbe.getCipher(l,i.encryptionParams,t),d=r.util.createBuffer(i.encryptedData);return p.update(d),p.finish()&&(n=o.fromDer(p.output)),n},a.encryptedPrivateKeyToPem=function(e,t){var n={type:"ENCRYPTED PRIVATE KEY",body:o.toDer(e).getBytes()};return r.pem.encode(n,{maxline:t})},a.encryptedPrivateKeyFromPem=function(e){var t=r.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==t.type){var n=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw n.headerType=t.type,n}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return o.fromDer(t.body)},a.encryptRsaPrivateKey=function(e,t,n){if(!(n=n||{}).legacy){var i=a.wrapRsaPrivateKey(a.privateKeyToAsn1(e));return i=a.encryptPrivateKeyInfo(i,t,n),a.encryptedPrivateKeyToPem(i)}var s,c,u,l;switch(n.algorithm){case"aes128":s="AES-128-CBC",u=16,c=r.random.getBytesSync(16),l=r.aes.createEncryptionCipher;break;case"aes192":s="AES-192-CBC",u=24,c=r.random.getBytesSync(16),l=r.aes.createEncryptionCipher;break;case"aes256":s="AES-256-CBC",u=32,c=r.random.getBytesSync(16),l=r.aes.createEncryptionCipher;break;case"3des":s="DES-EDE3-CBC",u=24,c=r.random.getBytesSync(8),l=r.des.createEncryptionCipher;break;case"des":s="DES-CBC",u=8,c=r.random.getBytesSync(8),l=r.des.createEncryptionCipher;break;default:var p=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+n.algorithm+'".');throw p.algorithm=n.algorithm,p}var d=l(r.pbe.opensslDeriveBytes(t,c.substr(0,8),u));d.start(c),d.update(o.toDer(a.privateKeyToAsn1(e))),d.finish();var h={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:s,parameters:r.util.bytesToHex(c).toUpperCase()},body:d.output.getBytes()};return r.pem.encode(h)},a.decryptRsaPrivateKey=function(e,t){var n=null,i=r.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==i.type&&"PRIVATE KEY"!==i.type&&"RSA PRIVATE KEY"!==i.type)throw(u=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".')).headerType=u,u;if(i.procType&&"ENCRYPTED"===i.procType.type){var s,c;switch(i.dekInfo.algorithm){case"DES-CBC":s=8,c=r.des.createDecryptionCipher;break;case"DES-EDE3-CBC":s=24,c=r.des.createDecryptionCipher;break;case"AES-128-CBC":s=16,c=r.aes.createDecryptionCipher;break;case"AES-192-CBC":s=24,c=r.aes.createDecryptionCipher;break;case"AES-256-CBC":s=32,c=r.aes.createDecryptionCipher;break;case"RC2-40-CBC":s=5,c=function(e){return r.rc2.createDecryptionCipher(e,40)};break;case"RC2-64-CBC":s=8,c=function(e){return r.rc2.createDecryptionCipher(e,64)};break;case"RC2-128-CBC":s=16,c=function(e){return r.rc2.createDecryptionCipher(e,128)};break;default:var u;throw(u=new Error('Could not decrypt private key; unsupported encryption algorithm "'+i.dekInfo.algorithm+'".')).algorithm=i.dekInfo.algorithm,u}var l=r.util.hexToBytes(i.dekInfo.parameters),p=c(r.pbe.opensslDeriveBytes(t,l.substr(0,8),s));if(p.start(l),p.update(r.util.createBuffer(i.body)),!p.finish())return n;n=p.output.getBytes()}else n=i.body;return null!==(n="ENCRYPTED PRIVATE KEY"===i.type?a.decryptPrivateKeyInfo(o.fromDer(n),t):o.fromDer(n))&&(n=a.privateKeyFromAsn1(n)),n},a.pbe.generatePkcs12Key=function(e,t,n,i,o,a){var s,c;if(null==a){if(!("sha1"in r.md))throw new Error('"sha1" hash algorithm unavailable.');a=r.md.sha1.create()}var u=a.digestLength,l=a.blockLength,p=new r.util.ByteBuffer,d=new r.util.ByteBuffer;if(null!=e){for(c=0;c=0;c--)B>>=8,B+=A.at(c)+w.at(c),w.setAt(c,255&B);I.putBuffer(w)}C=I,p.putBuffer(S)}return p.truncate(p.length()-o),p},a.pbe.getCipher=function(e,t,n){switch(e){case a.oids.pkcs5PBES2:return a.pbe.getCipherForPBES2(e,t,n);case a.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case a.oids["pbewithSHAAnd40BitRC2-CBC"]:return a.pbe.getCipherForPKCS12PBE(e,t,n);default:var r=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw r.oid=e,r.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],r}},a.pbe.getCipherForPBES2=function(e,t,n){var i,s={},c=[];if(!o.validate(t,u,s,c))throw(i=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=c,i;if((e=o.derToOid(s.kdfOid))!==a.oids.pkcs5PBKDF2)throw(i=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.")).oid=e,i.supportedOids=["pkcs5PBKDF2"],i;if((e=o.derToOid(s.encOid))!==a.oids["aes128-CBC"]&&e!==a.oids["aes192-CBC"]&&e!==a.oids["aes256-CBC"]&&e!==a.oids["des-EDE3-CBC"]&&e!==a.oids.desCBC)throw(i=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.")).oid=e,i.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],i;var l,p,h=s.kdfSalt,f=r.util.createBuffer(s.kdfIterationCount);switch(f=f.getInt(f.length()<<3),a.oids[e]){case"aes128-CBC":l=16,p=r.aes.createDecryptionCipher;break;case"aes192-CBC":l=24,p=r.aes.createDecryptionCipher;break;case"aes256-CBC":l=32,p=r.aes.createDecryptionCipher;break;case"des-EDE3-CBC":l=24,p=r.des.createDecryptionCipher;break;case"desCBC":l=8,p=r.des.createDecryptionCipher}var g=d(s.prfOid),y=r.pkcs5.pbkdf2(n,h,f,l,g),m=s.encIv,v=p(y);return v.start(m),v},a.pbe.getCipherForPKCS12PBE=function(e,t,n){var i={},s=[];if(!o.validate(t,l,i,s))throw(g=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=s,g;var c,u,p,h=r.util.createBuffer(i.salt),f=r.util.createBuffer(i.iterations);switch(f=f.getInt(f.length()<<3),e){case a.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:c=24,u=8,p=r.des.startDecrypting;break;case a.oids["pbewithSHAAnd40BitRC2-CBC"]:c=5,u=8,p=function(e,t){var n=r.rc2.createDecryptionCipher(e,40);return n.start(t,null),n};break;default:var g;throw(g=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.")).oid=e,g}var y=d(i.prfOid),m=a.pbe.generatePkcs12Key(n,h,1,f,c,y);return y.start(),p(m,a.pbe.generatePkcs12Key(n,h,2,f,u,y))},a.pbe.opensslDeriveBytes=function(e,t,n,i){if(null==i){if(!("md5"in r.md))throw new Error('"md5" hash algorithm unavailable.');i=r.md.md5.create()}null===t&&(t="");for(var o=[p(i,e+t)],a=16,s=1;a8?3:1,m=[],v=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=0,C=0;C>>4^_))<<4,E^=t=65535&((_^=t)>>>-16^E),E^=(t=858993459&(E>>>2^(_^=t<<-16)))<<2,E^=t=65535&((_^=t)>>>-16^E),E^=(t=1431655765&(E>>>1^(_^=t<<-16)))<<1,E^=t=16711935&((_^=t)>>>8^E),t=(E^=(t=1431655765&(E>>>1^(_^=t<<8)))<<1)<<8|(_^=t)>>>20&240,E=_<<24|_<<8&16711680|_>>>8&65280|_>>>24&240,_=t;for(var S=0;S>>26,_=_<<2|_>>>26):(E=E<<1|E>>>27,_=_<<1|_>>>27);var T=n[(E&=-15)>>>28]|r[E>>>24&15]|i[E>>>20&15]|o[E>>>16&15]|a[E>>>12&15]|s[E>>>8&15]|c[E>>>4&15],A=u[(_&=-15)>>>28]|l[_>>>24&15]|p[_>>>20&15]|d[_>>>16&15]|h[_>>>12&15]|f[_>>>8&15]|g[_>>>4&15];t=65535&(A>>>16^T),m[b++]=T^t,m[b++]=A^t<<16}}return m}(t),this._init=!0}},i("DES-ECB",r.cipher.modes.ecb),i("DES-CBC",r.cipher.modes.cbc),i("DES-CFB",r.cipher.modes.cfb),i("DES-OFB",r.cipher.modes.ofb),i("DES-CTR",r.cipher.modes.ctr),i("3DES-ECB",r.cipher.modes.ecb),i("3DES-CBC",r.cipher.modes.cbc),i("3DES-CFB",r.cipher.modes.cfb),i("3DES-OFB",r.cipher.modes.ofb),i("3DES-CTR",r.cipher.modes.ctr);var o=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],a=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],s=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],c=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],u=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],l=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],p=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],d=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];function h(e,t,n,r){var i,h,f=32===e.length?3:9;i=3===f?r?[30,-2,-2]:[0,32,2]:r?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var g=t[0],y=t[1];g^=(h=252645135&(g>>>4^y))<<4,g^=(h=65535&(g>>>16^(y^=h)))<<16,g^=h=858993459&((y^=h)>>>2^g),g^=h=16711935&((y^=h<<2)>>>8^g),g=(g^=(h=1431655765&(g>>>1^(y^=h<<8)))<<1)<<1|g>>>31,y=(y^=h)<<1|y>>>31;for(var m=0;m>>4|y<<28)^e[C+1];h=g,g=y,y=h^(a[E>>>24&63]|c[E>>>16&63]|l[E>>>8&63]|d[63&E]|o[_>>>24&63]|s[_>>>16&63]|u[_>>>8&63]|p[63&_])}h=g,g=y,y=h}y=y>>>1|y<<31,y^=h=1431655765&((g=g>>>1|g<<31)>>>1^y),y^=(h=16711935&(y>>>8^(g^=h<<1)))<<8,y^=(h=858993459&(y>>>2^(g^=h)))<<2,y^=h=65535&((g^=h)>>>16^y),y^=h=252645135&((g^=h<<16)>>>4^y),g^=h<<4,n[0]=g,n[1]=y}function f(e){var t,n="DES-"+((e=e||{}).mode||"CBC").toUpperCase(),i=(t=e.decrypt?r.cipher.createDecipher(n,e.key):r.cipher.createCipher(n,e.key)).start;return t.start=function(e,n){var o=null;n instanceof r.util.ByteBuffer&&(o=n,n={}),(n=n||{}).output=o,n.iv=e,i.call(t,n)},t}},function(e,n,r){var i=r(0);r(17),r(2),r(1);var o,a=i.pkcs5=i.pkcs5||{};i.util.isNodejs&&!i.options.usePureJavaScript&&(o=r(10)),e.exports=i.pbkdf2=a.pbkdf2=function(e,n,r,a,s,c){if("function"==typeof s&&(c=s,s=null),i.util.isNodejs&&!i.options.usePureJavaScript&&o.pbkdf2&&(null===s||"object"!=typeof s)&&(o.pbkdf2Sync.length>4||!s||"sha1"===s))return"string"!=typeof s&&(s="sha1"),e=t.from(e,"binary"),n=t.from(n,"binary"),c?4===o.pbkdf2Sync.length?o.pbkdf2(e,n,r,a,(function(e,t){if(e)return c(e);c(null,t.toString("binary"))})):o.pbkdf2(e,n,r,a,s,(function(e,t){if(e)return c(e);c(null,t.toString("binary"))})):4===o.pbkdf2Sync.length?o.pbkdf2Sync(e,n,r,a).toString("binary"):o.pbkdf2Sync(e,n,r,a,s).toString("binary");if(null==s&&(s="sha1"),"string"==typeof s){if(!(s in i.md.algorithms))throw new Error("Unknown hash algorithm: "+s);s=i.md[s].create()}var u=s.digestLength;if(a>4294967295*u){var l=new Error("Derived key is too long.");if(c)return c(l);throw l}var p=Math.ceil(a/u),d=a-(p-1)*u,h=i.hmac.create();h.start(s,e);var f,g,y,m="";if(!c){for(var v=1;v<=p;++v){h.start(null,null),h.update(n),h.update(i.util.int32ToBytes(v)),f=y=h.digest().getBytes();for(var b=2;b<=r;++b)h.start(null,null),h.update(y),g=h.digest().getBytes(),f=i.util.xorBytes(f,g,u),y=g;m+=vp)return c(null,m);h.start(null,null),h.update(n),h.update(i.util.int32ToBytes(v)),f=y=h.digest().getBytes(),b=2,E()}function E(){if(b<=r)return h.start(null,null),h.update(y),g=h.digest().getBytes(),f=i.util.xorBytes(f,g,u),y=g,++b,i.util.setImmediate(E);m+=vt.blockLength&&(t.start(),t.update(a.bytes()),a=t.digest()),n=r.util.createBuffer(),i=r.util.createBuffer(),u=a.length(),c=0;c>14;--o>=0;){var c=16383&this.data[e],u=this.data[e++]>>14,l=s*c+u*a;i=((c=a*c+((16383&l)<<14)+n.data[r]+i)>>28)+(l>>14)+s*u,n.data[r++]=268435455&c}return i}e.exports=i.jsbn=i.jsbn||{},i.jsbn.BigInteger=o,"undefined"==typeof navigator?(o.prototype.am=s,r=28):"Microsoft Internet Explorer"==navigator.appName?(o.prototype.am=function(e,t,n,r,i,o){for(var a=32767&t,s=t>>15;--o>=0;){var c=32767&this.data[e],u=this.data[e++]>>15,l=s*c+u*a;i=((c=a*c+((32767&l)<<15)+n.data[r]+(1073741823&i))>>>30)+(l>>>15)+s*u+(i>>>30),n.data[r++]=1073741823&c}return i},r=30):"Netscape"!=navigator.appName?(o.prototype.am=function(e,t,n,r,i,o){for(;--o>=0;){var a=t*this.data[e++]+n.data[r]+i;i=Math.floor(a/67108864),n.data[r++]=67108863&a}return i},r=26):(o.prototype.am=s,r=28),o.prototype.DB=r,o.prototype.DM=(1<>>16)&&(e=t,n+=16),0!=(t=e>>8)&&(e=t,n+=8),0!=(t=e>>4)&&(e=t,n+=4),0!=(t=e>>2)&&(e=t,n+=2),0!=(t=e>>1)&&(e=t,n+=1),n}function g(e){this.m=e}function y(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function _(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function S(){}function T(e){return e}function A(e){this.r2=a(),this.q3=a(),o.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}g.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},g.prototype.revert=function(e){return e},g.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},g.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},g.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},y.prototype.convert=function(e){var t=a();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(o.ZERO)>0&&this.m.subTo(t,t),t},y.prototype.revert=function(e){var t=a();return e.copyTo(t),this.reduce(t),t},y.prototype.reduce=function(e){for(;e.t<=this.mt2;)e.data[e.t++]=0;for(var t=0;t>15)*this.mpl&this.um)<<15)&e.DM;for(n=t+this.m.t,e.data[n]+=this.m.am(0,r,e,t,0,this.m.t);e.data[n]>=e.DV;)e.data[n]-=e.DV,e.data[++n]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},y.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},y.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},o.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s},o.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0},o.prototype.fromString=function(e,t){var n;if(16==t)n=4;else if(8==t)n=3;else if(256==t)n=8;else if(2==t)n=1;else if(32==t)n=5;else{if(4!=t)return void this.fromRadix(e,t);n=2}this.t=0,this.s=0;for(var r=e.length,i=!1,a=0;--r>=0;){var s=8==n?255&e[r]:d(e,r);s<0?"-"==e.charAt(r)&&(i=!0):(i=!1,0==a?this.data[this.t++]=s:a+n>this.DB?(this.data[this.t-1]|=(s&(1<>this.DB-a):this.data[this.t-1]|=s<=this.DB&&(a-=this.DB))}8==n&&0!=(128&e[0])&&(this.s=-1,a>0&&(this.data[this.t-1]|=(1<0&&this.data[this.t-1]==e;)--this.t},o.prototype.dlShiftTo=function(e,t){var n;for(n=this.t-1;n>=0;--n)t.data[n+e]=this.data[n];for(n=e-1;n>=0;--n)t.data[n]=0;t.t=this.t+e,t.s=this.s},o.prototype.drShiftTo=function(e,t){for(var n=e;n=0;--n)t.data[n+a+1]=this.data[n]>>i|s,s=(this.data[n]&o)<=0;--n)t.data[n]=0;t.data[a]=s,t.t=this.t+a+1,t.s=this.s,t.clamp()},o.prototype.rShiftTo=function(e,t){t.s=this.s;var n=Math.floor(e/this.DB);if(n>=this.t)t.t=0;else{var r=e%this.DB,i=this.DB-r,o=(1<>r;for(var a=n+1;a>r;r>0&&(t.data[this.t-n-1]|=(this.s&o)<>=this.DB;if(e.t>=this.DB;r+=this.s}else{for(r+=this.s;n>=this.DB;r-=e.s}t.s=r<0?-1:0,r<-1?t.data[n++]=this.DV+r:r>0&&(t.data[n++]=r),t.t=n,t.clamp()},o.prototype.multiplyTo=function(e,t){var n=this.abs(),r=e.abs(),i=n.t;for(t.t=i+r.t;--i>=0;)t.data[i]=0;for(i=0;i=0;)e.data[n]=0;for(n=0;n=t.DV&&(e.data[n+t.t]-=t.DV,e.data[n+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(n,t.data[n],e,2*n,0,1)),e.s=0,e.clamp()},o.prototype.divRemTo=function(e,t,n){var r=e.abs();if(!(r.t<=0)){var i=this.abs();if(i.t0?(r.lShiftTo(l,s),i.lShiftTo(l,n)):(r.copyTo(s),i.copyTo(n));var p=s.t,d=s.data[p-1];if(0!=d){var h=d*(1<1?s.data[p-2]>>this.F2:0),g=this.FV/h,y=(1<=0&&(n.data[n.t++]=1,n.subTo(C,n)),o.ONE.dlShiftTo(p,C),C.subTo(s,s);s.t=0;){var E=n.data[--v]==d?this.DM:Math.floor(n.data[v]*g+(n.data[v-1]+m)*y);if((n.data[v]+=s.am(0,E,n,b,0,p))0&&n.rShiftTo(l,n),c<0&&o.ZERO.subTo(n,n)}}},o.prototype.invDigit=function(){if(this.t<1)return 0;var e=this.data[0];if(0==(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},o.prototype.isEven=function(){return 0==(this.t>0?1&this.data[0]:this.s)},o.prototype.exp=function(e,t){if(e>4294967295||e<1)return o.ONE;var n=a(),r=a(),i=t.convert(this),s=f(e)-1;for(i.copyTo(n);--s>=0;)if(t.sqrTo(n,r),(e&1<0)t.mulTo(r,i,n);else{var c=n;n=r,r=c}return t.revert(n)},o.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var n,r=(1<0)for(s>s)>0&&(i=!0,o=p(n));a>=0;)s>(s+=this.DB-t)):(n=this.data[a]>>(s-=t)&r,s<=0&&(s+=this.DB,--a)),n>0&&(i=!0),i&&(o+=p(n));return i?o:"0"},o.prototype.negate=function(){var e=a();return o.ZERO.subTo(this,e),e},o.prototype.abs=function(){return this.s<0?this.negate():this},o.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var n=this.t;if(0!=(t=n-e.t))return this.s<0?-t:t;for(;--n>=0;)if(0!=(t=this.data[n]-e.data[n]))return t;return 0},o.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+f(this.data[this.t-1]^this.s&this.DM)},o.prototype.mod=function(e){var t=a();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(o.ZERO)>0&&e.subTo(t,t),t},o.prototype.modPowInt=function(e,t){var n;return n=e<256||t.isEven()?new g(t):new y(t),this.exp(e,n)},o.ZERO=h(0),o.ONE=h(1),S.prototype.convert=T,S.prototype.revert=T,S.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n)},S.prototype.sqrTo=function(e,t){e.squareTo(t)},A.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=a();return e.copyTo(t),this.reduce(t),t},A.prototype.revert=function(e){return e},A.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},A.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},A.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)};var x=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],I=(1<<26)/x[x.length-1];o.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},o.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),n=Math.pow(e,t),r=h(n),i=a(),o=a(),s="";for(this.divRemTo(r,i,o);i.signum()>0;)s=(n+o.intValue()).toString(e).substr(1)+s,i.divRemTo(r,i,o);return o.intValue().toString(e)+s},o.prototype.fromRadix=function(e,t){this.fromInt(0),null==t&&(t=10);for(var n=this.chunkSize(t),r=Math.pow(t,n),i=!1,a=0,s=0,c=0;c=n&&(this.dMultiply(r),this.dAddOffset(s,0),a=0,s=0))}a>0&&(this.dMultiply(Math.pow(t,a)),this.dAddOffset(s,0)),i&&o.ZERO.subTo(this,this)},o.prototype.fromNumber=function(e,t,n){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,n),this.testBit(e-1)||this.bitwiseTo(o.ONE.shiftLeft(e-1),v,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(o.ONE.shiftLeft(e-1),this);else{var r=new Array,i=7&e;r.length=1+(e>>3),t.nextBytes(r),i>0?r[0]&=(1<>=this.DB;if(e.t>=this.DB;r+=this.s}else{for(r+=this.s;n>=this.DB;r+=e.s}t.s=r<0?-1:0,r>0?t.data[n++]=r:r<-1&&(t.data[n++]=this.DV+r),t.t=n,t.clamp()},o.prototype.dMultiply=function(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},o.prototype.dAddOffset=function(e,t){if(0!=e){for(;this.t<=t;)this.data[this.t++]=0;for(this.data[t]+=e;this.data[t]>=this.DV;)this.data[t]-=this.DV,++t>=this.t&&(this.data[this.t++]=0),++this.data[t]}},o.prototype.multiplyLowerTo=function(e,t,n){var r,i=Math.min(this.t+e.t,t);for(n.s=0,n.t=i;i>0;)n.data[--i]=0;for(r=n.t-this.t;i=0;)n.data[r]=0;for(r=Math.max(t-this.t,0);r0)if(0==t)n=this.data[0]%e;else for(var r=this.t-1;r>=0;--r)n=(t*n+this.data[r])%e;return n},o.prototype.millerRabin=function(e){var t=this.subtract(o.ONE),n=t.getLowestSetBit();if(n<=0)return!1;for(var r,i=t.shiftRight(n),a={nextBytes:function(e){for(var t=0;t=0);var c=r.modPow(i,this);if(0!=c.compareTo(o.ONE)&&0!=c.compareTo(t)){for(var u=1;u++>24},o.prototype.shortValue=function(){return 0==this.t?this.s:this.data[0]<<16>>16},o.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1},o.prototype.toByteArray=function(){var e=this.t,t=new Array;t[0]=this.s;var n,r=this.DB-e*this.DB%8,i=0;if(e-- >0)for(r>r)!=(this.s&this.DM)>>r&&(t[i++]=n|this.s<=0;)r<8?(n=(this.data[e]&(1<>(r+=this.DB-8)):(n=this.data[e]>>(r-=8)&255,r<=0&&(r+=this.DB,--e)),0!=(128&n)&&(n|=-256),0==i&&(128&this.s)!=(128&n)&&++i,(i>0||n!=this.s)&&(t[i++]=n);return t},o.prototype.equals=function(e){return 0==this.compareTo(e)},o.prototype.min=function(e){return this.compareTo(e)<0?this:e},o.prototype.max=function(e){return this.compareTo(e)>0?this:e},o.prototype.and=function(e){var t=a();return this.bitwiseTo(e,m,t),t},o.prototype.or=function(e){var t=a();return this.bitwiseTo(e,v,t),t},o.prototype.xor=function(e){var t=a();return this.bitwiseTo(e,b,t),t},o.prototype.andNot=function(e){var t=a();return this.bitwiseTo(e,C,t),t},o.prototype.not=function(){for(var e=a(),t=0;t=this.t?0!=this.s:0!=(this.data[t]&1<1){var p=a();for(r.sqrTo(s[1],p);c<=l;)s[c]=a(),r.mulTo(p,s[c-2],s[c]),c+=2}var d,m,v=e.t-1,b=!0,C=a();for(i=f(e.data[v])-1;v>=0;){for(i>=u?d=e.data[v]>>i-u&l:(d=(e.data[v]&(1<0&&(d|=e.data[v-1]>>this.DB+i-u)),c=n;0==(1&d);)d>>=1,--c;if((i-=c)<0&&(i+=this.DB,--v),b)s[d].copyTo(o),b=!1;else{for(;c>1;)r.sqrTo(o,C),r.sqrTo(C,o),c-=2;c>0?r.sqrTo(o,C):(m=o,o=C,C=m),r.mulTo(C,s[d],o)}for(;v>=0&&0==(e.data[v]&1<=0?(n.subTo(r,n),t&&i.subTo(s,i),a.subTo(c,a)):(r.subTo(n,r),t&&s.subTo(i,s),c.subTo(a,c))}return 0!=r.compareTo(o.ONE)?o.ZERO:c.compareTo(e)>=0?c.subtract(e):c.signum()<0?(c.addTo(e,c),c.signum()<0?c.add(e):c):c},o.prototype.pow=function(e){return this.exp(e,new S)},o.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),n=e.s<0?e.negate():e.clone();if(t.compareTo(n)<0){var r=t;t=n,n=r}var i=t.getLowestSetBit(),o=n.getLowestSetBit();if(o<0)return t;for(i0&&(t.rShiftTo(o,t),n.rShiftTo(o,n));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=n.getLowestSetBit())>0&&n.rShiftTo(i,n),t.compareTo(n)>=0?(t.subTo(n,t),t.rShiftTo(1,t)):(n.subTo(t,n),n.rShiftTo(1,n));return o>0&&n.lShiftTo(o,n),n},o.prototype.isProbablePrime=function(e){var t,n=this.abs();if(1==n.t&&n.data[0]<=x[x.length-1]){for(t=0;t128)throw new Error('Invalid "nsComment" content.');e.value=i.create(i.Class.UNIVERSAL,i.Type.IA5STRING,!1,e.comment)}else if("subjectKeyIdentifier"===e.name&&t.cert){var h=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=h.toHex(),e.value=i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,h.getBytes())}else if("authorityKeyIdentifier"===e.name&&t.cert){if(e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]),l=e.value.value,e.keyIdentifier){var f=!0===e.keyIdentifier?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;l.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!1,f))}if(e.authorityCertIssuer){var g=[i.create(i.Class.CONTEXT_SPECIFIC,4,!0,[m(!0===e.authorityCertIssuer?t.cert.issuer:e.authorityCertIssuer)])];l.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,g))}if(e.serialNumber){var y=r.util.hexToBytes(!0===e.serialNumber?t.cert.serialNumber:e.serialNumber);l.push(i.create(i.Class.CONTEXT_SPECIFIC,2,!1,y))}}else if("cRLDistributionPoints"===e.name){e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]),l=e.value.value;var v,b=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]),C=i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[]);for(d=0;d2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(p.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(c.validity.notBefore=p[0],c.validity.notAfter=p[1],c.tbsCertificate=n.tbsCertificate,t){c.md=g({signatureOid:c.signatureOid,type:"certificate"});var d=i.toDer(c.tbsCertificate);c.md.update(d.getBytes())}var y=r.md.sha1.create(),m=i.toDer(n.certIssuer);y.update(m.getBytes()),c.issuer.getField=function(e){return h(c.issuer,e)},c.issuer.addField=function(e){v([e]),c.issuer.attributes.push(e)},c.issuer.attributes=o.RDNAttributesAsArray(n.certIssuer),n.certIssuerUniqueId&&(c.issuer.uniqueId=n.certIssuerUniqueId),c.issuer.hash=y.digest().toHex();var b=r.md.sha1.create(),C=i.toDer(n.certSubject);return b.update(C.getBytes()),c.subject.getField=function(e){return h(c.subject,e)},c.subject.addField=function(e){v([e]),c.subject.attributes.push(e)},c.subject.attributes=o.RDNAttributesAsArray(n.certSubject),n.certSubjectUniqueId&&(c.subject.uniqueId=n.certSubjectUniqueId),c.subject.hash=b.digest().toHex(),n.certExtensions?c.extensions=o.certificateExtensionsFromAsn1(n.certExtensions):c.extensions=[],c.publicKey=o.publicKeyFromAsn1(n.subjectPublicKeyInfo),c},o.certificateExtensionsFromAsn1=function(e){for(var t=[],n=0;n1&&(n=c.value.charCodeAt(1),o=c.value.length>2?c.value.charCodeAt(2):0),t.digitalSignature=128==(128&n),t.nonRepudiation=64==(64&n),t.keyEncipherment=32==(32&n),t.dataEncipherment=16==(16&n),t.keyAgreement=8==(8&n),t.keyCertSign=4==(4&n),t.cRLSign=2==(2&n),t.encipherOnly=1==(1&n),t.decipherOnly=128==(128&o)}else if("basicConstraints"===t.name){(c=i.fromDer(t.value)).value.length>0&&c.value[0].type===i.Type.BOOLEAN?t.cA=0!==c.value[0].value.charCodeAt(0):t.cA=!1;var s=null;c.value.length>0&&c.value[0].type===i.Type.INTEGER?s=c.value[0].value:c.value.length>1&&(s=c.value[1].value),null!==s&&(t.pathLenConstraint=i.derToInteger(s))}else if("extKeyUsage"===t.name)for(var c=i.fromDer(t.value),u=0;u1&&(n=c.value.charCodeAt(1)),t.client=128==(128&n),t.server=64==(64&n),t.email=32==(32&n),t.objsign=16==(16&n),t.reserved=8==(8&n),t.sslCA=4==(4&n),t.emailCA=2==(2&n),t.objCA=1==(1&n);else if("subjectAltName"===t.name||"issuerAltName"===t.name){var p;t.altNames=[],c=i.fromDer(t.value);for(var d=0;d=_&&e0&&a.value.push(o.certificateExtensionsToAsn1(e.extensions)),a},o.getCertificationRequestInfo=function(e){return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.version).getBytes()),m(e.subject),o.publicKeyToAsn1(e.publicKey),E(e)])},o.distinguishedNameToAsn1=function(e){return m(e)},o.certificateToAsn1=function(e){var t=e.tbsCertificate||o.getTBSCertificate(e);return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[t,i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.signatureOid).getBytes()),C(e.signatureOid,e.signatureParameters)]),i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},o.certificateExtensionsToAsn1=function(e){var t=i.create(i.Class.CONTEXT_SPECIFIC,3,!0,[]),n=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);t.value.push(n);for(var r=0;rl.validity.notAfter)&&(c={message:"Certificate is not valid yet or has expired.",error:o.certificateError.certificate_expired,notBefore:l.validity.notBefore,notAfter:l.validity.notAfter,now:a}),null===c){if(null===(p=t[0]||e.getIssuer(l))&&l.isIssuer(l)&&(d=!0,p=l),p){var h=p;r.util.isArray(h)||(h=[h]);for(var f=!1;!f&&h.length>0;){p=h.shift();try{f=p.verify(l)}catch(e){}}f||(c={message:"Certificate signature is invalid.",error:o.certificateError.bad_certificate})}null!==c||p&&!d||e.hasCertificate(l)||(c={message:"Certificate is not trusted.",error:o.certificateError.unknown_ca})}if(null===c&&p&&!l.isIssuer(p)&&(c={message:"Certificate issuer is invalid.",error:o.certificateError.bad_certificate}),null===c)for(var g={keyUsage:!0,basicConstraints:!0},y=0;null===c&&yv.pathLenConstraint&&(c={message:"Certificate basicConstraints pathLenConstraint violated.",error:o.certificateError.bad_certificate})}var C=null===c||c.error,E=n.verify?n.verify(C,u,i):C;if(!0!==E)throw!0===C&&(c={message:"The application rejected the certificate.",error:o.certificateError.bad_certificate}),(E||0===E)&&("object"!=typeof E||r.util.isArray(E)?"string"==typeof E&&(c.error=E):(E.message&&(c.message=E.message),E.error&&(c.error=E.error))),c;c=null,s=!1,++u}while(t.length>0);return!0}},function(e,t,n){var r=n(0);n(3),n(1),(e.exports=r.pss=r.pss||{}).create=function(e){3===arguments.length&&(e={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var t,n=e.md,i=e.mgf,o=n.digestLength,a=e.salt||null;if("string"==typeof a&&(a=r.util.createBuffer(a)),"saltLength"in e)t=e.saltLength;else{if(null===a)throw new Error("Salt length not specified or specific salt not given.");t=a.length()}if(null!==a&&a.length()!==t)throw new Error("Given salt length does not match length of given salt.");var s=e.prng||r.random,c={encode:function(e,c){var u,l,p=c-1,d=Math.ceil(p/8),h=e.digest().getBytes();if(d>8*d-p&255;return(C=String.fromCharCode(C.charCodeAt(0)&~E)+C.substr(1))+g+String.fromCharCode(188)},verify:function(e,a,s){var c,u=s-1,l=Math.ceil(u/8);if(a=a.substr(-l),l>8*l-u&255;if(0!=(d.charCodeAt(0)&f))throw new Error("Bits beyond keysize not zero as expected.");var g=i.generate(h,p),y="";for(c=0;c0;)s.push(u%o),u=u/o|0}for(i=0;0===e[i]&&i=0;--i)r+=t[s[i]]}else r=function(e,t){var n=0,r=t.length,i=t.charAt(0),o=[0];for(n=0;n0;)o.push(s%r),s=s/r|0}var c="";for(n=0;0===e.at(n)&&n=0;--n)c+=t[o[n]];return c}(e,t);if(n){var l=new RegExp(".{1,"+n+"}","g");r=r.match(l).join("\r\n")}return r},r.decode=function(e,n){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof n)throw new TypeError('"alphabet" must be a string.');var r=i[n];if(!r){r=i[n]=[];for(var o=0;o>=8;for(;p>0;)c.push(255&p),p>>=8}for(var d=0;e[d]===s&&d>>0,s>>>0];for(var c=i.fullMessageLength.length-1;c>=0;--c)i.fullMessageLength[c]+=s[1],s[1]=s[0]+(i.fullMessageLength[c]/4294967296>>>0),i.fullMessageLength[c]=i.fullMessageLength[c]>>>0,s[0]=s[1]/4294967296>>>0;return t.putBytes(o),l(e,n,t),(t.read>2048||0===t.length())&&t.compact(),i},i.digest=function(){var a=r.util.createBuffer();a.putBytes(t.bytes());var s=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize&i.blockLength-1;a.putBytes(o.substr(0,i.blockLength-s));for(var c,u=0,p=i.fullMessageLength.length-1;p>=0;--p)u=(c=8*i.fullMessageLength[p]+u)/4294967296>>>0,a.putInt32Le(c>>>0);var d={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};l(d,n,a);var h=r.util.createBuffer();return h.putInt32Le(d.h0),h.putInt32Le(d.h1),h.putInt32Le(d.h2),h.putInt32Le(d.h3),h},i};var o=null,a=null,s=null,c=null,u=!1;function l(e,t,n){for(var r,i,o,u,l,p,d,h=n.length();h>=64;){for(i=e.h0,o=e.h1,u=e.h2,l=e.h3,d=0;d<16;++d)t[d]=n.getInt32Le(),r=i+(l^o&(u^l))+c[d]+t[d],i=l,l=u,u=o,o+=r<<(p=s[d])|r>>>32-p;for(;d<32;++d)r=i+(u^l&(o^u))+c[d]+t[a[d]],i=l,l=u,u=o,o+=r<<(p=s[d])|r>>>32-p;for(;d<48;++d)r=i+(o^u^l)+c[d]+t[a[d]],i=l,l=u,u=o,o+=r<<(p=s[d])|r>>>32-p;for(;d<64;++d)r=i+(u^(o|~l))+c[d]+t[a[d]],i=l,l=u,u=o,o+=r<<(p=s[d])|r>>>32-p;e.h0=e.h0+i|0,e.h1=e.h1+o|0,e.h2=e.h2+u|0,e.h3=e.h3+l|0,h-=64}}},function(e,t,n){var r=n(0);n(2),n(1);var i=e.exports=r.sha512=r.sha512||{};r.md.sha512=r.md.algorithms.sha512=i;var o=r.sha384=r.sha512.sha384=r.sha512.sha384||{};o.create=function(){return i.create("SHA-384")},r.md.sha384=r.md.algorithms.sha384=o,r.sha512.sha256=r.sha512.sha256||{create:function(){return i.create("SHA-512/256")}},r.md["sha512/256"]=r.md.algorithms["sha512/256"]=r.sha512.sha256,r.sha512.sha224=r.sha512.sha224||{create:function(){return i.create("SHA-512/224")}},r.md["sha512/224"]=r.md.algorithms["sha512/224"]=r.sha512.sha224,i.create=function(e){if(s||(a=String.fromCharCode(128),a+=r.util.fillString(String.fromCharCode(0),128),c=[[1116352408,3609767458],[1899447441,602891725],[3049323471,3964484399],[3921009573,2173295548],[961987163,4081628472],[1508970993,3053834265],[2453635748,2937671579],[2870763221,3664609560],[3624381080,2734883394],[310598401,1164996542],[607225278,1323610764],[1426881987,3590304994],[1925078388,4068182383],[2162078206,991336113],[2614888103,633803317],[3248222580,3479774868],[3835390401,2666613458],[4022224774,944711139],[264347078,2341262773],[604807628,2007800933],[770255983,1495990901],[1249150122,1856431235],[1555081692,3175218132],[1996064986,2198950837],[2554220882,3999719339],[2821834349,766784016],[2952996808,2566594879],[3210313671,3203337956],[3336571891,1034457026],[3584528711,2466948901],[113926993,3758326383],[338241895,168717936],[666307205,1188179964],[773529912,1546045734],[1294757372,1522805485],[1396182291,2643833823],[1695183700,2343527390],[1986661051,1014477480],[2177026350,1206759142],[2456956037,344077627],[2730485921,1290863460],[2820302411,3158454273],[3259730800,3505952657],[3345764771,106217008],[3516065817,3606008344],[3600352804,1432725776],[4094571909,1467031594],[275423344,851169720],[430227734,3100823752],[506948616,1363258195],[659060556,3750685593],[883997877,3785050280],[958139571,3318307427],[1322822218,3812723403],[1537002063,2003034995],[1747873779,3602036899],[1955562222,1575990012],[2024104815,1125592928],[2227730452,2716904306],[2361852424,442776044],[2428436474,593698344],[2756734187,3733110249],[3204031479,2999351573],[3329325298,3815920427],[3391569614,3928383900],[3515267271,566280711],[3940187606,3454069534],[4118630271,4000239992],[116418474,1914138554],[174292421,2731055270],[289380356,3203993006],[460393269,320620315],[685471733,587496836],[852142971,1086792851],[1017036298,365543100],[1126000580,2618297676],[1288033470,3409855158],[1501505948,4234509866],[1607167915,987167468],[1816402316,1246189591]],(u={})["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],u["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],u["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],u["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],s=!0),void 0===e&&(e="SHA-512"),!(e in u))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=u[e],n=null,i=r.util.createBuffer(),o=new Array(80),p=0;p<80;++p)o[p]=new Array(2);var d=64;switch(e){case"SHA-384":d=48;break;case"SHA-512/256":d=32;break;case"SHA-512/224":d=28}var h={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:d,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){h.messageLength=0,h.fullMessageLength=h.messageLength128=[];for(var e=h.messageLengthSize/4,o=0;o>>0,a>>>0];for(var s=h.fullMessageLength.length-1;s>=0;--s)h.fullMessageLength[s]+=a[1],a[1]=a[0]+(h.fullMessageLength[s]/4294967296>>>0),h.fullMessageLength[s]=h.fullMessageLength[s]>>>0,a[0]=a[1]/4294967296>>>0;return i.putBytes(e),l(n,o,i),(i.read>2048||0===i.length())&&i.compact(),h},h.digest=function(){var t=r.util.createBuffer();t.putBytes(i.bytes());var s,c=h.fullMessageLength[h.fullMessageLength.length-1]+h.messageLengthSize&h.blockLength-1;t.putBytes(a.substr(0,h.blockLength-c));for(var u=8*h.fullMessageLength[0],p=0;p>>0,t.putInt32(u>>>0),u=s>>>0;t.putInt32(u);var d=new Array(n.length);for(p=0;p=128;){for(k=0;k<16;++k)t[k][0]=n.getInt32()>>>0,t[k][1]=n.getInt32()>>>0;for(;k<80;++k)r=(((N=(O=t[k-2])[0])>>>19|(R=O[1])<<13)^(R>>>29|N<<3)^N>>>6)>>>0,i=((N<<13|R>>>19)^(R<<3|N>>>29)^(N<<26|R>>>6))>>>0,o=(((N=(P=t[k-15])[0])>>>1|(R=P[1])<<31)^(N>>>8|R<<24)^N>>>7)>>>0,a=((N<<31|R>>>1)^(N<<24|R>>>8)^(N<<25|R>>>7))>>>0,L=t[k-7],D=t[k-16],R=i+L[1]+a+D[1],t[k][0]=r+L[0]+o+D[0]+(R/4294967296>>>0)>>>0,t[k][1]=R>>>0;for(f=e[0][0],g=e[0][1],y=e[1][0],m=e[1][1],v=e[2][0],b=e[2][1],C=e[3][0],E=e[3][1],_=e[4][0],S=e[4][1],T=e[5][0],A=e[5][1],x=e[6][0],I=e[6][1],w=e[7][0],B=e[7][1],k=0;k<80;++k)l=((_>>>14|S<<18)^(_>>>18|S<<14)^(S>>>9|_<<23))>>>0,p=(x^_&(T^x))>>>0,s=((f>>>28|g<<4)^(g>>>2|f<<30)^(g>>>7|f<<25))>>>0,u=((f<<4|g>>>28)^(g<<30|f>>>2)^(g<<25|f>>>7))>>>0,d=(f&y|v&(f^y))>>>0,h=(g&m|b&(g^m))>>>0,R=B+(((_<<18|S>>>14)^(_<<14|S>>>18)^(S<<23|_>>>9))>>>0)+((I^S&(A^I))>>>0)+c[k][1]+t[k][1],r=w+l+p+c[k][0]+t[k][0]+(R/4294967296>>>0)>>>0,i=R>>>0,o=s+d+((R=u+h)/4294967296>>>0)>>>0,a=R>>>0,w=x,B=I,x=T,I=A,T=_,A=S,_=C+r+((R=E+i)/4294967296>>>0)>>>0,S=R>>>0,C=v,E=b,v=y,b=m,y=f,m=g,f=r+o+((R=i+a)/4294967296>>>0)>>>0,g=R>>>0;R=e[0][1]+g,e[0][0]=e[0][0]+f+(R/4294967296>>>0)>>>0,e[0][1]=R>>>0,R=e[1][1]+m,e[1][0]=e[1][0]+y+(R/4294967296>>>0)>>>0,e[1][1]=R>>>0,R=e[2][1]+b,e[2][0]=e[2][0]+v+(R/4294967296>>>0)>>>0,e[2][1]=R>>>0,R=e[3][1]+E,e[3][0]=e[3][0]+C+(R/4294967296>>>0)>>>0,e[3][1]=R>>>0,R=e[4][1]+S,e[4][0]=e[4][0]+_+(R/4294967296>>>0)>>>0,e[4][1]=R>>>0,R=e[5][1]+A,e[5][0]=e[5][0]+T+(R/4294967296>>>0)>>>0,e[5][1]=R>>>0,R=e[6][1]+I,e[6][0]=e[6][0]+x+(R/4294967296>>>0)>>>0,e[6][1]=R>>>0,R=e[7][1]+B,e[7][0]=e[7][0]+w+(R/4294967296>>>0)>>>0,e[7][1]=R>>>0,U-=128}}},function(e,t,n){var r=n(0);n(4),n(5),n(14),n(7),n(16),n(33),n(20),n(8),n(1),n(19);var i=r.asn1,o=e.exports=r.pki=r.pki||{};o.pemToDer=function(e){var t=r.pem.decode(e)[0];if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert PEM to DER; PEM is encrypted.");return r.util.createBuffer(t.body)},o.privateKeyFromPem=function(e){var t=r.pem.decode(e)[0];if("PRIVATE KEY"!==t.type&&"RSA PRIVATE KEY"!==t.type){var n=new Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');throw n.headerType=t.type,n}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert private key from PEM; PEM is encrypted.");var a=i.fromDer(t.body);return o.privateKeyFromAsn1(a)},o.privateKeyToPem=function(e,t){var n={type:"RSA PRIVATE KEY",body:i.toDer(o.privateKeyToAsn1(e)).getBytes()};return r.pem.encode(n,{maxline:t})},o.privateKeyInfoToPem=function(e,t){var n={type:"PRIVATE KEY",body:i.toDer(e).getBytes()};return r.pem.encode(n,{maxline:t})}},function(e,t,r){var i=r(0);r(1);var o=null;!i.util.isNodejs||i.options.usePureJavaScript||n.versions["node-webkit"]||(o=r(10)),(e.exports=i.prng=i.prng||{}).create=function(e){for(var t={plugin:e,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},n=e.md,r=new Array(32),a=0;a<32;++a)r[a]=n.create();function s(){if(t.pools[0].messageLength>=32)return c();var e=32-t.pools[0].messageLength<<5;t.collect(t.seedFileSync(e)),c()}function c(){t.reseeds=4294967295===t.reseeds?0:t.reseeds+1;var e=t.plugin.md.create();e.update(t.keyBytes);for(var n=1,r=0;r<32;++r)t.reseeds%n==0&&(e.update(t.pools[r].digest().getBytes()),t.pools[r].start()),n<<=1;t.keyBytes=e.digest().getBytes(),e.start(),e.update(t.keyBytes);var i=e.digest().getBytes();t.key=t.plugin.formatKey(t.keyBytes),t.seed=t.plugin.formatSeed(i),t.generated=0}function u(e){var t=null,n=i.util.globalScope,r=n.crypto||n.msCrypto;r&&r.getRandomValues&&(t=function(e){return r.getRandomValues(e)});var o=i.util.createBuffer();if(t)for(;o.length()>16)))<<16,d=4294967295&(l=(2147483647&(l+=u>>15))+(l>>31)),c=0;c<3;++c)p=d>>>(c<<3),p^=Math.floor(256*Math.random()),o.putByte(255&p);return o.getBytes(e)}return t.pools=r,t.pool=0,t.generate=function(e,n){if(!n)return t.generateSync(e);var r=t.plugin.cipher,o=t.plugin.increment,a=t.plugin.formatKey,s=t.plugin.formatSeed,u=i.util.createBuffer();t.key=null,function l(p){if(p)return n(p);if(u.length()>=e)return n(null,u.getBytes(e));if(t.generated>1048575&&(t.key=null),null===t.key)return i.util.nextTick((function(){!function(e){if(t.pools[0].messageLength>=32)return c(),e();var n=32-t.pools[0].messageLength<<5;t.seedFile(n,(function(n,r){if(n)return e(n);t.collect(r),c(),e()}))}(l)}));var d=r(t.key,t.seed);t.generated+=d.length,u.putBytes(d),t.key=a(r(t.key,o(t.seed))),t.seed=s(r(t.key,t.seed)),i.util.setImmediate(l)}()},t.generateSync=function(e){var n=t.plugin.cipher,r=t.plugin.increment,o=t.plugin.formatKey,a=t.plugin.formatSeed;t.key=null;for(var c=i.util.createBuffer();c.length()1048575&&(t.key=null),null===t.key&&s();var u=n(t.key,t.seed);t.generated+=u.length,c.putBytes(u),t.key=o(n(t.key,r(t.seed))),t.seed=a(n(t.key,t.seed))}return c.getBytes(e)},o?(t.seedFile=function(e,t){o.randomBytes(e,(function(e,n){if(e)return t(e);t(null,n.toString())}))},t.seedFileSync=function(e){return o.randomBytes(e).toString()}):(t.seedFile=function(e,t){try{t(null,u(e))}catch(e){t(e)}},t.seedFileSync=u),t.collect=function(e){for(var n=e.length,r=0;r>i&255);t.collect(r)},t.registerWorker=function(e){e===self?t.seedFile=function(e,t){self.addEventListener("message",(function e(n){var r=n.data;r.forge&&r.forge.prng&&(self.removeEventListener("message",e),t(r.forge.prng.err,r.forge.prng.bytes))})),self.postMessage({forge:{prng:{needed:e}}})}:e.addEventListener("message",(function(n){var r=n.data;r.forge&&r.forge.prng&&t.seedFile(r.forge.prng.needed,(function(t,n){e.postMessage({forge:{prng:{err:t,bytes:n}}})}))}))},t}},function(e,t,n){var r=n(0);n(1);var i=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],o=[1,2,3,5],a=function(e,t){return e<>16-t},s=function(e,t){return(65535&e)>>t|e<<16-t&65535};e.exports=r.rc2=r.rc2||{},r.rc2.expandKey=function(e,t){"string"==typeof e&&(e=r.util.createBuffer(e)),t=t||128;var n,o=e,a=e.length(),s=t,c=Math.ceil(s/8),u=255>>(7&s);for(n=a;n<128;n++)o.putByte(i[o.at(n-1)+o.at(n-a)&255]);for(o.setAt(128-c,i[o.at(128-c)&u]),n=127-c;n>=0;n--)o.setAt(n,i[o.at(n+1)^o.at(n+c)]);return o};var c=function(e,t,n){var i,c,u,l,p=!1,d=null,h=null,f=null,g=[];for(e=r.rc2.expandKey(e,t),u=0;u<64;u++)g.push(e.getInt16Le());n?(i=function(e){for(u=0;u<4;u++)e[u]+=g[l]+(e[(u+3)%4]&e[(u+2)%4])+(~e[(u+3)%4]&e[(u+1)%4]),e[u]=a(e[u],o[u]),l++},c=function(e){for(u=0;u<4;u++)e[u]+=g[63&e[(u+3)%4]]}):(i=function(e){for(u=3;u>=0;u--)e[u]=s(e[u],o[u]),e[u]-=g[l]+(e[(u+3)%4]&e[(u+2)%4])+(~e[(u+3)%4]&e[(u+1)%4]),l--},c=function(e){for(u=3;u>=0;u--)e[u]-=g[63&e[(u+3)%4]]});var y=function(e){var t=[];for(u=0;u<4;u++){var r=d.getInt16Le();null!==f&&(n?r^=f.getInt16Le():f.putInt16Le(r)),t.push(65535&r)}l=n?0:63;for(var i=0;i=8;)y([[5,i],[1,c],[6,i],[1,c],[5,i]])},finish:function(e){var t=!0;if(n)if(e)t=e(8,d,!n);else{var r=8===d.length()?8:8-d.length();d.fillWithByte(r,r)}if(t&&(p=!0,m.update()),!n&&(t=0===d.length()))if(e)t=e(8,h,!n);else{var i=h.length(),o=h.at(i-1);o>i?t=!1:h.truncate(o)}return t}}};r.rc2.startEncrypting=function(e,t,n){var i=r.rc2.createEncryptionCipher(e,128);return i.start(t,n),i},r.rc2.createEncryptionCipher=function(e,t){return c(e,t,!0)},r.rc2.startDecrypting=function(e,t,n){var i=r.rc2.createDecryptionCipher(e,128);return i.start(t,n),i},r.rc2.createDecryptionCipher=function(e,t){return c(e,t,!1)}},function(e,t,n){var r=n(0);n(1),n(3),n(9);var i=e.exports=r.pkcs1=r.pkcs1||{};function o(e,t,n){n||(n=r.md.sha1.create());for(var i="",o=Math.ceil(t/n.digestLength),a=0;a>24&255,a>>16&255,a>>8&255,255&a);n.start(),n.update(e+s),i+=n.digest().getBytes()}return i.substring(0,t)}i.encode_rsa_oaep=function(e,t,n){var i,a,s,c;"string"==typeof n?(i=n,a=arguments[3]||void 0,s=arguments[4]||void 0):n&&(i=n.label||void 0,a=n.seed||void 0,s=n.md||void 0,n.mgf1&&n.mgf1.md&&(c=n.mgf1.md)),s?s.start():s=r.md.sha1.create(),c||(c=s);var u=Math.ceil(e.n.bitLength()/8),l=u-2*s.digestLength-2;if(t.length>l)throw(g=new Error("RSAES-OAEP input message length is too long.")).length=t.length,g.maxLength=l,g;i||(i=""),s.update(i,"raw");for(var p=s.digest(),d="",h=l-t.length,f=0;fe&&(a=c(e,t));var h=a.toString(16);i.target.postMessage({hex:h,workLoad:l}),a.dAddOffset(p,0)}}}h()}(e,t,i,o):s(e,t,i,o)}(e,u,o.options,i);throw new Error("Invalid prime generation algorithm: "+o.name)}}function s(e,t,n,o){var a=c(e,t),s=function(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}(a.bitLength());"millerRabinTests"in n&&(s=n.millerRabinTests);var u=10;"maxBlockTime"in n&&(u=n.maxBlockTime),function e(t,n,o,a,s,u,l){var p=+new Date;do{if(t.bitLength()>n&&(t=c(n,o)),t.isProbablePrime(s))return l(null,t);t.dAddOffset(i[a++%8],0)}while(u<0||+new Date-p=0&&i.push(s):i.push(s))}return i}function h(e){if(e.composed||e.constructed){for(var t=r.util.createBuffer(),n=0;n0&&(c=i.create(i.Class.UNIVERSAL,i.Type.SET,!0,p));var d=[],h=[];null!==t&&(h=r.util.isArray(t)?t:[t]);for(var f=[],g=0;g0){var b=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,f),C=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(o.oids.data).getBytes()),i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,i.toDer(b).getBytes())])]);d.push(C)}var E=null;if(null!==e){var _=o.wrapRsaPrivateKey(o.privateKeyToAsn1(e));E=null===n?i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(o.oids.keyBag).getBytes()),i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[_]),c]):i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(o.oids.pkcs8ShroudedKeyBag).getBytes()),i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[o.encryptPrivateKeyInfo(_,n,s)]),c]);var S=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[E]),T=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(o.oids.data).getBytes()),i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,i.toDer(S).getBytes())])]);d.push(T)}var A,x=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,d);if(s.useMac){var I=r.md.sha1.create(),w=new r.util.ByteBuffer(r.random.getBytes(s.saltSize)),B=s.count,k=(e=a.generateKey(n,w,3,B,20),r.hmac.create());k.start(I,e),k.update(i.toDer(x).getBytes());var N=k.getMac();A=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(o.oids.sha1).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")]),i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,N.getBytes())]),i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,w.getBytes()),i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(B).getBytes())])}return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(3).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(o.oids.data).getBytes()),i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,i.toDer(x).getBytes())])]),A])},a.generateKey=r.pbe.generatePkcs12Key},function(e,t,n){var r=n(0);n(4),n(1);var i=r.asn1,o=e.exports=r.pkcs7asn1=r.pkcs7asn1||{};r.pkcs7=r.pkcs7||{},r.pkcs7.asn1=o;var a={name:"ContentInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};o.contentInfoValidator=a;var s={name:"EncryptedContentInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:i.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};o.envelopedDataValidator={name:"EnvelopedData",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(s)},o.encryptedDataValidator={name:"EncryptedData",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"}].concat(s)};var c={name:"SignerInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:i.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:i.Class.UNIVERSAL,type:i.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};o.signedDataValidator={name:"SignedData",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},a,{name:"SignedData.Certificates",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,capture:"signerInfos",optional:!0,value:[c]}]},o.recipientInfoValidator={name:"RecipientInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:i.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter",optional:!0}]},{name:"RecipientInfo.encryptedKey",tagClass:i.Class.UNIVERSAL,type:i.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}},function(e,t,n){var r=n(0);n(36),e.exports=r.mgf=r.mgf||{},r.mgf.mgf1=r.mgf1},function(e,t,n){var r=n(0);n(1),r.mgf=r.mgf||{},(e.exports=r.mgf.mgf1=r.mgf1=r.mgf1||{}).create=function(e){return{generate:function(t,n){for(var i=new r.util.ByteBuffer,o=Math.ceil(n/e.digestLength),a=0;a=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|e}function f(e,t){if(c.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return K(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return F(e).length;default:if(r)return K(e).length;t=(""+t).toLowerCase(),r=!0}}function g(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return k(this,t,n);case"utf8":case"utf-8":return x(this,t,n);case"ascii":return w(this,t,n);case"latin1":case"binary":return B(this,t,n);case"base64":return A(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function y(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function m(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=c.from(t,r)),c.isBuffer(t))return 0===t.length?-1:v(e,t,n,r,i);if("number"==typeof t)return t&=255,c.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):v(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function v(e,t,n,r,i){var o,a=1,s=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,c/=2,n/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var l=-1;for(o=n;os&&(n=s-c),o=n;o>=0;o--){for(var p=!0,d=0;di&&(r=i):r=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function A(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function x(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i239?4:u>223?3:u>191?2:1;if(i+p<=n)switch(p){case 1:u<128&&(l=u);break;case 2:128==(192&(o=e[i+1]))&&(c=(31&u)<<6|63&o)>127&&(l=c);break;case 3:o=e[i+1],a=e[i+2],128==(192&o)&&128==(192&a)&&(c=(15&u)<<12|(63&o)<<6|63&a)>2047&&(c<55296||c>57343)&&(l=c);break;case 4:o=e[i+1],a=e[i+2],s=e[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(c=(15&u)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&c<1114112&&(l=c)}null===l?(l=65533,p=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),i+=p}return function(e){var t=e.length;if(t<=I)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},c.prototype.compare=function(e,t,n,r,i){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0),s=Math.min(o,a),u=this.slice(r,i),l=e.slice(t,n),p=0;pi)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return b(this,e,t,n);case"utf8":case"utf-8":return C(this,e,t,n);case"ascii":return E(this,e,t,n);case"latin1":case"binary":return _(this,e,t,n);case"base64":return S(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var I=4096;function w(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;ir)&&(n=r);for(var i="",o=t;on)throw new RangeError("Trying to access beyond buffer length")}function O(e,t,n,r,i,o){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function L(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i>>8*(r?i:1-i)}function P(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i>>8*(r?i:3-i)&255}function D(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function U(e,t,n,r,o){return o||D(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function M(e,t,n,r,o){return o||D(e,0,n,8),i.write(e,t,n,r,52,8),n+8}c.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(i*=256);)r+=this[e+--t]*i;return r},c.prototype.readUInt8=function(e,t){return t||R(e,1,this.length),this[e]},c.prototype.readUInt16LE=function(e,t){return t||R(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUInt16BE=function(e,t){return t||R(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUInt32LE=function(e,t){return t||R(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUInt32BE=function(e,t){return t||R(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||R(e,t,this.length);for(var r=this[e],i=1,o=0;++o=(i*=128)&&(r-=Math.pow(2,8*t)),r},c.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||R(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},c.prototype.readInt8=function(e,t){return t||R(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){t||R(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){t||R(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return t||R(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return t||R(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readFloatLE=function(e,t){return t||R(e,4,this.length),i.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return t||R(e,4,this.length),i.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return t||R(e,8,this.length),i.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return t||R(e,8,this.length),i.read(this,e,!1,52,8)},c.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||O(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[t]=255&e;++o=0&&(o*=256);)this[t+i]=e/o&255;return t+n},c.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||O(this,e,t,1,255,0),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||O(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):L(this,e,t,!0),t+2},c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||O(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):L(this,e,t,!1),t+2},c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||O(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):P(this,e,t,!0),t+4},c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||O(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):P(this,e,t,!1),t+4},c.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);O(this,e,t,n,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o>0)-s&255;return t+n},c.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);O(this,e,t,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||O(this,e,t,1,127,-128),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||O(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):L(this,e,t,!0),t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||O(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):L(this,e,t,!1),t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||O(this,e,t,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):P(this,e,t,!0),t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||O(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):P(this,e,t,!1),t+4},c.prototype.writeFloatLE=function(e,t,n){return U(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return U(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return M(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return M(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--i)e[i+t]=this[i+n];else if(o<1e3||!c.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function F(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(V,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function G(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}}).call(this,n(8))},function(e,t,n){"use strict";t.byteLength=function(e){var t=u(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){var t,n,r=u(e),a=r[0],s=r[1],c=new o(function(e,t,n){return 3*(t+n)/4-n}(0,a,s)),l=0,p=s>0?a-4:a;for(n=0;n>16&255,c[l++]=t>>8&255,c[l++]=255&t;2===s&&(t=i[e.charCodeAt(n)]<<2|i[e.charCodeAt(n+1)]>>4,c[l++]=255&t);1===s&&(t=i[e.charCodeAt(n)]<<10|i[e.charCodeAt(n+1)]<<4|i[e.charCodeAt(n+2)]>>2,c[l++]=t>>8&255,c[l++]=255&t);return c},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,o=[],a=16383,s=0,c=n-i;sc?c:s+a));1===i?(t=e[n-1],o.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],o.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return o.join("")};for(var r=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,c=a.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function l(e,t,n){for(var i,o,a=[],s=t;s>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return a.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,n,r,i){var o,a,s=8*i-r-1,c=(1<>1,l=-7,p=n?i-1:0,d=n?-1:1,h=e[t+p];for(p+=d,o=h&(1<<-l)-1,h>>=-l,l+=s;l>0;o=256*o+e[t+p],p+=d,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=r;l>0;a=256*a+e[t+p],p+=d,l-=8);if(0===o)o=1-u;else{if(o===c)return a?NaN:1/0*(h?-1:1);a+=Math.pow(2,r),o-=u}return(h?-1:1)*a*Math.pow(2,o-r)},t.write=function(e,t,n,r,i,o){var a,s,c,u=8*o-i-1,l=(1<>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:o-1,f=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-a))<1&&(a--,c*=2),(t+=a+p>=1?d/c:d*Math.pow(2,1-p))*c>=2&&(a++,c/=2),a+p>=l?(s=0,a=l):a+p>=1?(s=(t*c-1)*Math.pow(2,i),a+=p):(s=t*Math.pow(2,p-1)*Math.pow(2,i),a=0));i>=8;e[n+h]=255&s,h+=f,s/=256,i-=8);for(a=a<0;e[n+h]=255&a,h+=f,a/=256,u-=8);e[n+h-f]|=128*g}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){(function(e){var r=void 0!==e&&e||"undefined"!=typeof self&&self||window,i=Function.prototype.apply;function o(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new o(i.call(setTimeout,r,arguments),clearTimeout)},t.setInterval=function(){return new o(i.call(setInterval,r,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(r,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout((function(){e._onTimeout&&e._onTimeout()}),t))},n(25),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,n(8))},function(e,t,n){(function(e,t){!function(e,n){"use strict";if(!e.setImmediate){var r,i,o,a,s,c=1,u={},l=!1,p=e.document,d=Object.getPrototypeOf&&Object.getPrototypeOf(e);d=d&&d.setTimeout?d:e,"[object process]"==={}.toString.call(e.process)?r=function(e){t.nextTick((function(){f(e)}))}:!function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?e.MessageChannel?((o=new MessageChannel).port1.onmessage=function(e){f(e.data)},r=function(e){o.port2.postMessage(e)}):p&&"onreadystatechange"in p.createElement("script")?(i=p.documentElement,r=function(e){var t=p.createElement("script");t.onreadystatechange=function(){f(e),t.onreadystatechange=null,i.removeChild(t),t=null},i.appendChild(t)}):r=function(e){setTimeout(f,0,e)}:(a="setImmediate$"+Math.random()+"$",s=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(a)&&f(+t.data.slice(a.length))},e.addEventListener?e.addEventListener("message",s,!1):e.attachEvent("onmessage",s),r=function(t){e.postMessage(a+t,"*")}),d.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),n=0;n{const n=r.getDecryptedBody(t.data),i=JSON.parse(n),o=c.default.adapt(i);if(o.errno==c.default.ERRNO_SUCCESS)switch(o.result){case 1e3:case 29001:case 29002:e.success(o.data);break;default:throw p=!0,i}})).catch((t=>{p||(0,o.isString)(t)?e.failed(t):(0,o.isError)(t)?e.failed(t.message?t.message:"server error"):e.failed("network error")}))}}(l||(l={})),t.default=l},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=r(n(6)),o=r(n(0)),a=r(n(1)),s=r(n(4)),c=r(n(3));var u;!function(e){e.upload=function(e){const t=s.default.getOperator(!0),n={gyuid:a.default.gyuid,timestamp:(new Date).getTime(),ecountInfo:{processId:e.process_id,accessToken:e.token,authCode:e.auth_code?e.auth_code:"",phone:e.phone?e.phone:""},operatorType:4,newOperatorType:t.value,operatorVersion:"v2",baseInfo:{deviceId:"",appid:a.default.appid,phoneType:"h5",device:{}}};let r=JSON.stringify(n);const u=new c.default(r),l=u.getEncryptedBody();(0,i.default)({headers:s.default.appendCryptoHeaders({"Content-Type":"application/json; charset=utf-8"},u),timeout:a.default.timeout,method:"POST",url:o.default.HTTP_HOST+"/v1/gy/ct_login/token_upload",data:l,responseType:"arraybuffer"}).then((e=>{const t=u.getDecryptedBody(e.data),n=JSON.parse(t),r=s.default.adapt(n);if(!r.success)throw r.msg})).catch((e=>{}))},e.generatePreLoginAccesscode=function(e){let t=e.token,n=e.auth_code;n||(n="");let r=e.process_id;r||(r="");let i=e.phone;i||(i="");const o=s.default.getOperator(!0),a=t+"|"+n+"|"+o.value+"|v2|"+o.value+"|"+r+"|"+i;return c.default.encode64(a).replace("[\\s*\t\n\r]","")},e.generateVerifyAccesscode=function(e){let t=e.accesscode,n=e.process_id;n||(n="");let r=e.phone;r||(r="");const i={accessToken:t,platform:"h5",operatorType:s.default.getOperator(!0).value+"",processId:n,phone:r},o=JSON.stringify(i);return c.default.encode64(o)}}(u||(u={})),t.default=u}])})); //# sourceMappingURL=gysdk.map