/******************************

> 天翼云盘-每日签到

*******************************

[rewrite local]

^https:\/\/api\.cloud\.189\.cn\/mkt\/userSign\.action? url script-request-header https://git.vsprit.com/shawenguan/Quantumult-X/raw/master/Scripts/telecom/cloud189Helper.js

[MITM]

hostname = api.cloud.189.cn

********************************/

const magicJS = MagicJS(`天翼云盘`, "INFO");
const cloud189UserNameKey = 'cloud189_username';
const cloud189PassWordKey = 'cloud189_password';
const cloud189LoginDataKey = 'cloud189_loginExtData';

async function Main() {
    if (magicJS.isRequest) {
        checkHandleRequest();
    } else {
        let session = '1';
        let username = magicJS.data.read(cloud189UserNameKey, "18022485650", session);
        let password = magicJS.data.read(cloud189PassWordKey, "Sjojo510520@", session);
        magicJS.logger.info(`用户：${username}`);
        let loginExtData = await login(username,password);
        // let loginExtData = await qrScanLogin(username,password);
        if(!loginExtData){
            // // 尝试使用缓存数据来签到
            // loginExtData = magicJS.data.read(cloud189LoginDataKey, null, session);
            // magicJS.logger.info(`尝试使用缓存数据来签到`);
            loginExtData = null;
            magicJS.notification.appendNotifyInfo(`【${username}】登录失败`);
        }else{
            if(loginExtData.cacheUse){
                // 尝试使用缓存数据来签到
                loginExtData = magicJS.data.read(cloud189LoginDataKey, null, session);
                magicJS.logger.info(`尝试使用缓存数据来签到`);
            }else{
                magicJS.data.write(cloud189LoginDataKey, JSON.stringify(loginExtData), session);
                magicJS.logger.info(`登录成功更新数据`);
            }
        }
        if(loginExtData){
            let signInRet = await signIn(loginExtData.lt);
            let msg = '';
            if(signInRet){
                if(signInRet.isSign){
                    msg = `已经签到过了，签到获得${signInRet.netdiskBonus}M空间`;
                }else{
                    msg = `未签到，签到获得${signInRet.netdiskBonus}M空间`;
                }
                magicJS.logger.info(msg);
                magicJS.notification.appendNotifyInfo(msg);
            }
            let drawUrlList = [
                'https://m.cloud.189.cn/v2/drawPrizeMarketDetails.action?taskId=TASK_SIGNIN&activityId=ACT_SIGNIN',
                'https://m.cloud.189.cn/v2/drawPrizeMarketDetails.action?taskId=TASK_SIGNIN_PHOTOS&activityId=ACT_SIGNIN',
                'https://m.cloud.189.cn/v2/drawPrizeMarketDetails.action?taskId=TASK_2022_FLDFS_KJ&activityId=ACT_SIGNIN',
            ];
            for(let i=0; i < drawUrlList.length; i++){
                let drawRet = await lotteryDraw(drawUrlList[i], loginExtData.lt);
                if(drawRet){
                    if(drawRet.errorCode){
                        msg = `抽奖[${i}]失败：${drawRet.errorCode}`;
                    }else{
                        msg = `抽奖[${i}]获得：${drawRet.description}`;
                    }
                    magicJS.logger.info(msg);
                    magicJS.notification.appendNotifyInfo(msg);
                }
                await magicJS.utils.sleep(1000);
            }
        }
        // await logout();
    }
    magicJS.notification.msg('');
    magicJS.done();
}

function checkHandleRequest(){
}

async function getLoginJumpUrl(url){
    return new Promise((resolve, reject) => {
        let body = ``;
        let options = {
            url: url,
            headers: {
                "Accept": "*/*",
                "Accept-Encoding": "gzip, deflate, br",
                "Accept-Language": "zh-cn",
                "Connection": "keep-alive",
                "Content-Type": "application/x-www-form-urlencoded",
            },
            body: body
        }

        magicJS.http.get(options).then(resp => {
            const htmlText = resp.body;
            try {
                // magicJS.logger.info(`页面数据：${htmlText}`);
                // magicJS.logger.info(`响应头部：${JSON.stringify(resp.headers)}`);//无有用头部信息
                let urlMatch = htmlText.match(/https?:\/\/[^\s'"]+/); // 正则表达式匹配
                if(urlMatch){
                    resolve(urlMatch[0]);
                }
            } catch (err) {
                resolve();
            }
        }).catch(err => {
            const msg = `获取页面数据异常\n${JSON.stringify(err)}`;
            magicJS.logger.error(msg);
            reject(msg);
        });
    });
}


async function getLoginAccoutUrlInfo(url){
    return new Promise((resolve, reject) => {
        let body = ``;
        let options = {
            url: url,
            headers: {
                "Accept": "*/*",
                "Accept-Encoding": "gzip, deflate, br",
                "Accept-Language": "zh-cn",
                "Connection": "keep-alive",
                "Content-Type": "application/x-www-form-urlencoded",
            },
            body: body
        }
        magicJS.http.get(options).then(resp => {
            const htmlText = resp.body;
            try {
                // magicJS.logger.info(`页面数据：${htmlText}`);
                let urlMatch = htmlText.match(/<a id="j-tab-login-link"[^>]*href="([^"]+)"/); // 正则表达式匹配
                if(urlMatch){
                    let cookieData = magicJS.parseSetCookies(resp.headers['Set-Cookie'] || '');
                    let cookieDict = {};
                    for(let i=0; i < cookieData.length; i++){
                        let info = cookieData[i];
                        let name = info.name;
                        let value = info.value;
                        if(value == ''){
                            continue;
                        }
                        cookieDict[name] = value;
                    }
                    resolve({url: urlMatch[1], cookie: cookieDict});
                }else{
                    resolve();
                }
            } catch (err) {
                magicJS.logger.error(err);
                resolve();
            }
        }).catch(err => {
            const msg = `获取页面数据异常\n${JSON.stringify(err)}`;
            magicJS.logger.error(msg);
            reject(msg);
        });
    });
}


async function getLoginUrlInfo(){
    let retUrl = null;
    let retCookie = {};
    let entryUrl = 'https://m.cloud.189.cn/udb/udb_login.jsp?pageId=1&pageKey=default&clientType=wap&redirectURL=https://m.cloud.189.cn/zhuanti/2021/shakeLottery/index.html';
    let jumpUrl = await getLoginJumpUrl(entryUrl);
    if(jumpUrl){
        let retInfo = await getLoginAccoutUrlInfo(jumpUrl);
        if(retInfo){
            retUrl = retInfo.url;
            retCookie = retInfo.cookie;
        }
    }
    magicJS.logger.info(`LoginUrl: ${retUrl}`);
    return {url: retUrl, cookie: retCookie};
}


function getFieldFromText(regexPattern, text, index=1) {
    const re = new RegExp(regexPattern);
    let matches = text.match(re);
    if(matches && matches.length > 0){
        return matches[index];
    }
    return null;
}

function getLoginData(url, cookieDict){
    return new Promise((resolve, reject) => {
        if(!url){
            resolve();
            return;
        }
        let body = ``;
        let options = {
            url: url,
            headers: {
                "Accept": "*/*",
                "Accept-Encoding": "gzip, deflate, br",
                "Accept-Language": "zh-cn",
                "Connection": "keep-alive",
                "Content-Type": "application/x-www-form-urlencoded",
            },
            body: body
        }
        magicJS.http.get(options).then(resp => {
            const htmlText = resp.body;
            try {
                // magicJS.logger.info(`接口数据：${htmlText}`);
                let captchaToken = getFieldFromText(`captchaToken' value='(.+?)'`, htmlText);
                let lt = getFieldFromText(`lt = "(.+?)"`, htmlText);
                let returnUrl = getFieldFromText(`returnUrl= '(.+?)'`, htmlText);
                let paramId = getFieldFromText(`paramId = "(.+?)"`, htmlText);
                let j_rsakey = getFieldFromText(`j_rsaKey" value="(.+?)"`, htmlText);
                let REQID = getFieldFromText(`&REQID=(.+?)&`, htmlText);
                let retData = {
                    captchaToken: captchaToken,
                    lt: lt,
                    returnUrl: returnUrl,
                    paramId: paramId,
                    j_rsakey: j_rsakey,
                    REQID: REQID,
                    JSESSIONID: cookieDict.JSESSIONID
                };
                let cookieData = magicJS.parseSetCookies(resp.headers['Set-Cookie'] || '');
                for(let i=0; i < cookieData.length; i++){
                    let info = cookieData[i];
                    let name = info.name;
                    let value = info.value;
                    if(value == ''){
                        continue;
                    }
                    if(name == 'pageOp' || name == 'QRCODE'){
                        retData[name] = value;
                    }
                }
                magicJS.logger.log(JSON.stringify(retData));
                resolve(retData);
            } catch (err) {
                magicJS.logger.error(err);
                resolve();
            }
        }).catch(err => {
            const msg = `获取数据异常\n${JSON.stringify(err)}`;
            magicJS.logger.error(msg);
            reject(msg);
        });
    });
}


const BI_RM = "0123456789abcdefghijklmnopqrstuvwxyz".split("");
const B64MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
function int2char(a) {
    return BI_RM[a];
}

function b64tohex(a) {
    let d = "";
    let e = 0;
    let c = 0;
    for (let i = 0; i < a.length; i++) {
        if (a.charAt(i) !== "=") {
            const v = B64MAP.indexOf(a.charAt(i));
            if (e === 0) {
                e = 1;
                d += int2char(v >> 2);
                c = 3 & v;
            } else if (e === 1) {
                e = 2;
                d += int2char(c << 2 | v >> 4);
                c = 15 & v;
            } else if (e === 2) {
                e = 3;
                d += int2char(c);
                d += int2char(v >> 2);
                c = 3 & v;
            } else {
                e = 0;
                d += int2char(c << 2 | v >> 4);
                d += int2char(15 & v);
            }
        }
    }
    if (e === 1) {
        d += int2char(c << 2);
    }
    return d;
}

function rsaEncode(j_rsakey, text) {
    let JSEncrypt = createJSEncrypt();
    let crypt = new JSEncrypt();
    crypt.setPublicKey(j_rsakey);
    let ciphertext = crypt.encrypt(text);
    // let CryptoJS = createCryptoJS();
    // let wordArray = CryptoJS.enc.Utf8.parse(ciphertext);
    // let base64Data = CryptoJS.enc.Base64.stringify(wordArray).toString();
    return b64tohex(ciphertext);
}


async function checkLogin(username, password, extData){
    return new Promise((resolve, reject) => {
        username = rsaEncode(extData.j_rsakey, username);
        password = rsaEncode(extData.j_rsakey, password);
        let reqData = {
            appKey: "cloud",
            accountType: '01',
            userName: `{RSA}${username}`,
            password: `{RSA}${password}`,
            validateCode: "",
            captchaToken: extData.captchaToken,
            returnUrl: extData.returnUrl,
            mailSuffix: "@189.cn",
            paramId: extData.paramId,
        };
        // 表单数据
        let body = magicJS.objToQueryStr(reqData,true);
        magicJS.logger.info(`body= ${body}`);
        let options = {
            url: `https://open.e.189.cn/api/logbox/oauth2/loginSubmit.do`,
            headers: {
                "Accept": "*/*",
                "Accept-Encoding": "gzip, deflate, br",
                "Accept-Language": "zh-cn",
                "Connection": "keep-alive",
                "Referer": 'https://open.e.189.cn/',
                "User-Agent": 'Mozilla/5.0 (iPhone; CPU iPhone OS 16_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1',
                "LT": extData.lt,
            },
            body: body,
        };
        magicJS.http.post(options).then(resp => {
            const rspData = resp.body;
            try {
                // magicJS.logger.info(`登录响应头部：${JSON.stringify(resp.headers)}`);
                magicJS.logger.info(`登录响应数据：${JSON.stringify(rspData)}`);
                resolve(rspData);
            } catch (err) {
                resolve(null);
            }
        }).catch(err => {
            const msg = `登录异常\n${JSON.stringify(err)}`;
            magicJS.logger.error(msg);
            resolve(null);
        });
    });
}


async function tryJumpToUrl(url){
    return new Promise((resolve, reject) => {
        let body = ``;
        let options = {
            url: url,
            headers: {
                "Accept": "*/*",
                "Accept-Encoding": "gzip, deflate, br",
                "Accept-Language": "zh-cn",
                "Connection": "keep-alive",
                "Content-Type": "application/x-www-form-urlencoded",
            },
            body: body
        }
        magicJS.http.get(options).then(resp => {
            const htmlText = resp.body;
            try {
                // magicJS.logger.info(`获取[${url}]页面数据：\n${htmlText}`);
                resolve(resp);
            } catch (err) {
                resolve();
            }
        }).catch(err => {
            const msg = `获取[${url}]页面数据异常\n${JSON.stringify(err)}`;
            magicJS.logger.error(msg);
            reject(msg);
        });
    });
}

function login(username, password){
    return new Promise(async (resolve, reject) => {
        const retInfo = await getLoginUrlInfo();
        let extData = null;
        if(retInfo.url){
            extData = await getLoginData(retInfo.url, retInfo.cookie);
        }
        if(!extData){
            resolve({cacheUse: 1});
            return;
        }
        let loginData = await checkLogin(username, password, extData);
        if(loginData && loginData.result == 0){
            // toUrl=做任务 抽好礼
            await tryJumpToUrl(loginData.toUrl);
            resolve(extData);
        }else{
            resolve(null);
        }
    });
}

function logout(){
    return new Promise((resolve, reject) => {
        let rand = Date.now();
        let url = `https://cloud.189.cn/api/portal/logout.action?redirectURL=https://cloud.189.cn/web/login.html`;
        let options = {
            url: url,
            headers: {
                "Accept": "*/*",
                "Accept-Encoding": "gzip, deflate, br",
                "Accept-Language": "zh-cn",
                "Host": "m.cloud.189.cn",
                "Connection": "keep-alive",
                "Content-Type": "application/x-www-form-urlencoded",
                'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 16_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 Ecloud/10.1.4 (iPhone; 025EAA3307-34DD-47B0-94C1-62AC27D169B7; appStore) iOS/16.6.1',
            },
            body: ``
        }
        magicJS.http.get(options).then(resp => {
            try {
                const rspData = resp.body;
                magicJS.logger.info(`登出数据：${JSON.stringify(rspData)}`);
                resolve(rspData);
            } catch (err) {
                resolve();
            }
        }).catch(err => {
            const msg = `登出异常\n${JSON.stringify(err)}`;
            magicJS.logger.error(msg);
            reject(msg);
        });
    });
}


async function signIn(lt){
    return new Promise((resolve, reject) => {
        let rand = Date.now();
        let reqData ={
            version: '10.1.4',//8.6.3
            rand: rand,
            clientType: 'TELEIPHONE',//TELEANDROID
            model: 'iPhone',//SM-G930K
            osFamily: 'iOS',
            osVersion: '16.6.1',
        };
        let url = `https://api.cloud.189.cn/mkt/userSign.action?${magicJS.objToQueryStr(reqData)}`;
        let options = {
            url: url,
            headers: {
                "Accept": "*/*",
                "Referer": "https://m.cloud.189.cn/zhuanti/2016/sign/index.jsp?albumBackupOpened=1",
                "Accept-Encoding": "gzip, deflate, br",
                "Accept-Language": "zh-cn",
                "Host": "m.cloud.189.cn",
                "Connection": "keep-alive",
                "Content-Type": "application/x-www-form-urlencoded",
                'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 16_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 Ecloud/10.1.4 (iPhone; 025EAA3307-34DD-47B0-94C1-62AC27D169B7; appStore) iOS/16.6.1',
                "LT": lt,
            },
            body: ``
        };
        magicJS.http.get(options).then(resp => {
            try {
                const rspData = resp.body;
                magicJS.logger.info(`签到数据：${JSON.stringify(rspData)}`);
                resolve(rspData);
            } catch (err) {
                resolve();
            }
        }).catch(err => {
            let msg = `签到异常\n${err.stack || err.message}`;
            if(err.response){
                msg += `\n${JSON.stringify(err.response.body)}\n`;
            }
            magicJS.logger.error(msg);
            resolve();
        });
    });
}


async function lotteryDraw(url, lt){
    return new Promise((resolve, reject) => {
        let rand = Date.now();
        let options = {
            url: url,
            headers: {
                "Accept": "*/*",
                "Referer": "https://m.cloud.189.cn/zhuanti/2016/sign/index.jsp?albumBackupOpened=1",
                "Accept-Encoding": "gzip, deflate, br",
                "Accept-Language": "zh-cn",
                "Host": "m.cloud.189.cn",
                "Connection": "keep-alive",
                "Content-Type": "application/x-www-form-urlencoded",
                'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 16_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 Ecloud/10.1.4 (iPhone; 025EAA3307-34DD-47B0-94C1-62AC27D169B7; appStore) iOS/16.6.1',
                "LT": lt,
            },
            body: ``
        }
        magicJS.http.get(options).then(resp => {
            try {
                const rspData = resp.body;
                // magicJS.logger.info(`抽奖数据：${JSON.stringify(rspData)}`);
                resolve(rspData);
            } catch (err) {
                resolve();
            }
        }).catch(err => {
            const msg = `抽奖异常\n${JSON.stringify(err)}`;
            magicJS.logger.error(msg);
            reject(msg);
        });
    });
}

function generateRandomHex(length) {
    let hexString = '';
    for (let i = 0; i < length; i++) {
        let randomHex = Math.floor(Math.random() * 16).toString(16);
        hexString += randomHex;
    }
    return hexString;
}

async function checkWapLogin(username, password, extData){
    return new Promise(async (resolve, reject) => {
        username = rsaEncode(extData.j_rsakey, username);
        password = rsaEncode(extData.j_rsakey, password);
        let reqData = {
            appType: "wap",
            appKey: "cloud",
            accountType: '02',
            dynamicCheck: false,
            userName: `{RSA}${username}`,
            epd: `{RSA}${password}`,
            validateCode: "",
            captchaToken: extData.captchaToken,
            returnUrl: extData.returnUrl,
            isOauth2: false,
            state: '',
            paramId: extData.paramId,
            lt: extData.lt,
            REQID: extData.REQID || generateRandomHex(16),
            callbackMsg: 'callbackMsg',
        };
        let cookieData = {
            "isSetCookie": 1,
            "GRAYNUMBER": "B64274D9475A54D406616FF4EB01E26E",
            "DEVICEID": "DA64A6047ABEAC149EA6DD30A38CC0FA=0C3E335A89CFE785599532B97FE68F02",
            "GUID": "c294a989d68d49e0bc0f3bae427ba000",
            "wnormal.client.static.version": "2.88",
            "wnormal.visited": "true",
            //以下几个动态生成的
            "QRCODE": extData.QRCODE,
            "pageOp": extData.pageOp,
            "JSESSIONID": extData.JSESSIONID,
        }
        magicJS.logger.info(`cookieData=${JSON.stringify(cookieData)}`);
        let body = magicJS.objToQueryStr(reqData,true);
        magicJS.logger.info(`body= ${body}`);
        let options = {
            url: `https://open.e.189.cn/api/logbox/oauth2/loginSubmit.do?${body}`,
            headers: {
                "Accept": "*/*",
                "Accept-Encoding": "gzip, deflate, br",
                "Accept-Language": "zh-cn",
                "Connection": "keep-alive",
                "LT": extData.lt,
                "Referer": 'https://open.e.189.cn/',
                "User-Agent": 'Mozilla/5.0 (iPhone; CPU iPhone OS 16_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1',
                // "Cookie": magicJS.serializeCookies(cookieData),//不要设置
            },
            body: ``,
        };
        magicJS.http.get(options).then(resp => {
            try {
                let rspData = resp.body;
                if(typeof rspData == 'string'){
                    rspData = JSON.parse(/\(([\s\S]*?)\)/.exec(rspData)[1]);
                }
                magicJS.logger.info(`登录响应数据：${JSON.stringify(rspData)}`);
                resolve(rspData);
            } catch (err) {
                magicJS.logger.error(err);
                resolve();
            }
        }).catch(err => {
            let msg = `获取页面数据异常\n${err.stack || err.message}`;
            if(err.response){
                msg += `\n${JSON.stringify(err.response.body)}\n`;
            }
            magicJS.logger.error(msg);
            resolve();
        });
    });
}

function wapLogin(username, password){
    return new Promise(async (resolve, reject) => {
        let retInfo = await getLoginUrlInfo();
        let extData = null;
        if(retInfo.url){
            extData = await getLoginData(retInfo.url, retInfo.cookie);
        }
        if(!extData){
            resolve({cacheUse: 1});
            return;
        }
        let loginData = await checkWapLogin(username, password, extData);
        if(loginData && loginData.result == 0){
            // toUrl=做任务 抽好礼
            await tryJumpToUrl(loginData.toUrl);
            resolve(extData);
        }else{
            resolve(null);
        }
    });
}


async function getLoginQRScanUrl(url){
    return new Promise((resolve, reject) => {
        let body = ``;
        let options = {
            url: url,
            headers: {
                "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
                "Accept-Encoding": "gzip, deflate, br",
                "Accept-Language": "zh-CN,zh-Hans;q=0.9",
                "Connection": "keep-alive",
                // 'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 16_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1',
                // "Sec-Fetch-Mode": "navigate",
                // "Sec-Fetch-Dest": "document",
                // "Sec-Fetch-Site": "none",
            },
            body: body
        }
        magicJS.http.get(options).then(resp => {
            const htmlText = resp.body;
            try {
                // magicJS.logger.info(`页面数据：${htmlText}`);
                magicJS.logger.info(`响应头部：${JSON.stringify(resp.headers)}`);
                let urlMatch = htmlText.match(/saomaurl=([\s\S]*)/); // 正则表达式匹配
                if(urlMatch){
                    resolve(urlMatch[1]);
                }else{
                    resolve();
                }
            } catch (err) {
                resolve();
            }
        }).catch(err => {
            const msg = `获取页面数据异常\n${JSON.stringify(err)}`;
            magicJS.logger.error(msg);
            reject(msg);
        });
    });
}

async function getLoginScanJumpUrl(url){
    return new Promise((resolve, reject) => {
        let body = ``;
        let options = {
            url: url,
            headers: {
                "Accept": "*/*",
                "Accept-Encoding": "gzip, deflate, br",
                "Accept-Language": "zh-cn",
                "Connection": "keep-alive",
                "Content-Type": "application/x-www-form-urlencoded",
                'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 16_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1',
            },
            body: body
        }

        magicJS.http.get(options).then(resp => {
            const htmlText = resp.body;
            try {
                magicJS.logger.info(`页面数据：${htmlText}`);
                magicJS.logger.info(`响应头部：${JSON.stringify(resp.headers)}`);
                let urlMatch = htmlText.match(/https?:\/\/[^\s'"]+/); // 正则表达式匹配
                if(urlMatch){
                    resolve(urlMatch[0]);
                }
            } catch (err) {
                resolve();
            }
        }).catch(err => {
            const msg = `获取页面数据异常\n${JSON.stringify(err)}`;
            magicJS.logger.error(msg);
            reject(msg);
        });
    });
}

async function getAppConf(reqId, lt, toUrl){
    return new Promise((resolve, reject) => {
        let body = `version=2.0&appKey=cloud`;
        let headers = {
            "Accept": "*/*",
            "Accept-Encoding": "gzip, deflate, br",
            "Accept-Language": "zh-cn",
            "Connection": "keep-alive",
            "Content-Type": "application/x-www-form-urlencoded",
            'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 16_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1',
        };
        headers.reqId = reqId;
        headers.lt = lt;
        headers.referer = toUrl;
        let options = {
            url: 'https://open.e.189.cn/api/logbox/oauth2/appConf.do',
            headers: headers,
            body: body
        }
        magicJS.http.post(options).then(resp => {
            try {
                let data = resp.body;
                magicJS.logger.info(`获取App配置: ${JSON.stringify(data)}`);
                resolve(data);
            } catch (err) {
                resolve();
            }
        }).catch(err => {
            const msg = `获取App配置异常\n${JSON.stringify(err)}`;
            magicJS.logger.error(msg);
            reject(msg);
        });
    });
}

async function getEncryptConf(){
    return new Promise((resolve, reject) => {
        let body = `appId=cloud`;
        let headers = {
            "Accept": "*/*",
            "Accept-Encoding": "gzip, deflate, br",
            "Accept-Language": "zh-cn",
            "Connection": "keep-alive",
            "Content-Type": "application/x-www-form-urlencoded",
            'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 16_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1',
        };
        let options = {
            url: 'https://open.e.189.cn/api/logbox/config/encryptConf.do',
            headers: headers,
            body: body
        }
        magicJS.http.post(options).then(resp => {
            try {
                let data = resp.body;
                magicJS.logger.info(`响应头部：${JSON.stringify(resp.headers)}`);
                magicJS.logger.info(`获取RSA公共密钥数据: ${JSON.stringify(data)}`);
                resolve(data);
            } catch (err) {
                resolve();
            }
        }).catch(err => {
            const msg = `获取RSA公共密钥异常\n${JSON.stringify(err)}`;
            magicJS.logger.error(msg);
            reject(msg);
        });
    });
}

async function getCaptchaData(lt, toUrl){
    return new Promise((resolve, reject) => {
        let body = `appId=cloud`;
        let headers = {
            "Accept": "*/*",
            "Accept-Encoding": "gzip, deflate, br",
            "Accept-Language": "zh-cn",
            "Connection": "keep-alive",
            "Content-Type": "application/x-www-form-urlencoded",
            'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 16_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1',
        };
        headers.lt = lt;
        headers.referer = toUrl;
        let options = {
            url: 'https://open.e.189.cn/api/logbox/oauth2/needcaptcha.do',
            headers: headers,
            body: body
        }
        magicJS.http.post(options).then(resp => {
            try {
                let data = resp.body;
                magicJS.logger.info(`获取Captcha数据: ${JSON.stringify(data)}`);
                resolve(data);
            } catch (err) {
                resolve();
            }
        }).catch(err => {
            const msg = `获取Captcha异常\n${JSON.stringify(err)}`;
            magicJS.logger.error(msg);
            reject(msg);
        });
    });
}


async function qrScanLogin(){
    let sInitUrl = 'https://cloud.189.cn/api/portal/loginUrl.action?redirectURL=https://cloud.189.cn/web/redirect.html?returnURL=%2Fmain.action';
    let jumpUrl = await getLoginQRScanUrl(sInitUrl);
    if(jumpUrl){
        await getLoginScanJumpUrl(jumpUrl);
    }
    // await getAppConf();
    await getEncryptConf();
    // await getCaptchaData();
    return null;
}


Main()
.catch((e) => magicJS.log(`-\n ${e}`))
.finally(() => magicJS.done());


//---SyncByPyScript---MagicJS3-start
function MagicJS(e="MagicJS",t="INFO"){const n=()=>{const e="undefined"!=typeof $loon,t="undefined"!=typeof $task,r="undefined"!=typeof module,n="undefined"!=typeof $httpClient&&!e,o="undefined"!=typeof $storm,i="undefined"!=typeof $environment&&void 0!==$environment["stash-build"];var s=n||e||o||i;const a="undefined"!=typeof importModule;return{isLoon:e,isQuanX:t,isNode:r,isSurge:n,isStorm:o,isStash:i,isSurgeLike:s,isScriptable:a,get name(){return e?"Loon":t?"QuantumultX":r?"NodeJS":n?"Surge":a?"Scriptable":"unknown"},get build(){return n?$environment["surge-build"]:i?$environment["stash-build"]:o?$storm.buildVersion:void 0},get language(){if(n||i)return $environment.language},get version(){return n?$environment["surge-version"]:i?$environment["stash-version"]:o?$storm.appVersion:r?process.version:void 0},get system(){return n?$environment.system:r?process.platform:void 0},get systemVersion(){if(o)return $storm.systemVersion},get deviceName(){if(o)return $storm.deviceName}}},o=(r,e="INFO")=>{let n=e,t="\n";const o={SNIFFER:6,DEBUG:5,INFO:4,NOTIFY:3,WARNING:2,ERROR:1,CRITICAL:0,NONE:-1},i={SNIFFER:"",DEBUG:"",INFO:"",NOTIFY:"",WARNING:"❗ ",ERROR:"❌ ",CRITICAL:"❌ ",NONE:""},s=(e,t="INFO")=>{o[n]<o[t.toUpperCase()]||console.log(`██[${r}][${t}]`+i[t.toUpperCase()]+e+"\n")};return{getLevel:()=>n,setLevel:e=>{n=e},sniffer:(...e)=>{e=e.join(t);s(e,"SNIFFER")},log:(...e)=>{e=e.join(t);console.log(`██[${r}]`+e+"\n")},debug:(...e)=>{e=e.join(t);s(e,"DEBUG")},info:(...e)=>{e=e.join(t);s(e,"INFO")},notify:(...e)=>{e=e.join(t);s(e,"NOTIFY")},warning:(...e)=>{e=e.join(t);s(e,"WARNING")},error:(...e)=>{e=e.join(t);s(e,"ERROR")},retry:(...e)=>{e=e.join(t);s(e,"RETRY")}}};return new class{constructor(e,t){var r;this._startTime=Date.now(),this.version="3.0.0",this.scriptName=e,this.env=n(),this.logger=o(e,t),this.http="function"==typeof MagicHttp?MagicHttp(this.env,this.logger):void 0,this.data="function"==typeof MagicData?MagicData(this.env,this.logger):void 0,this.notification="function"==typeof MagicNotification?MagicNotification(this.scriptName,this.env,this.logger,this.http):void 0,this.utils="function"==typeof MagicUtils?MagicUtils(this.env,this.logger):void 0,this.qinglong="function"==typeof MagicQingLong?MagicQingLong(this.env,this.data,this.logger):void 0,void 0!==this.data&&(t=this.data.read("magic_loglevel"),r=this.data.read("magic_bark_url"),t&&this.logger.setLevel(t.toUpperCase()),r)&&this.notification.setBark(r),this.logger.info(e+", 开始执行!")}get isRequest(){return"undefined"!=typeof $request}get isStrictRequest(){return"undefined"!=typeof $request&&"undefined"==typeof $response}get isResponse(){return"undefined"!=typeof $response}get isDebug(){return"DEBUG"===this.logger.level}get request(){return"undefined"!=typeof $request?$request:void 0}get response(){if("undefined"!=typeof $response)return $response.hasOwnProperty("status")&&($response.statusCode=$response.status),$response.hasOwnProperty("statusCode")&&($response.status=$response.statusCode),$response}log(...e){this.logger.log(e)}toStr(e,t=null){try{return JSON.stringify(e)}catch{return t}}toObj(e,t=null){try{return JSON.parse(e)}catch{return t}}checkRecordRequestBody(){if(this.isRequest){var t=$request.body;if(t){var r=this.env,n=$request.path;let e=this.scriptName+"#"+n.replace("/","_");e=e.replace("?","#"),r.isQuanX&&$prefs.setValueForKey(t,e),(r.isLoon||r.isSurge)&&$persistentStore.write(t,e),r.isNode&&require("fs").writeFileSync(e+".json",t,{flag:"w"},e=>console.log(e))}}}getRequestBody(){var e=this.env,t=$request.path;let r=this.scriptName+"#"+t.replace("/","_");if(r=r.replace("?","#"),e.isSurge||e.isLoon)return $persistentStore.read(r);if(e.isQuanX)return $prefs.valueForKey(r);if(e.isNode){t=r+".json",e=require("fs");if(!e.existsSync(t))return JSON.parse(e.readFileSync(t))}}getResponseBody(){if($response)return $response.body}parseCookies(e,t=!1){let r={};return t?e&&e.split(";").forEach(function(e){e=e.split("=");r[e.shift().trim()]=decodeURIComponent(e.join("="))}):e&&e.split(";").forEach(function(e){e=e.split("=");r[e.shift().trim()]=e.join("=")}),r}serializeCookies(e,t=!1){var r=[];if(t)for(var n in e){var o=e[n],n=n+"="+encodeURIComponent(o);r.push(n)}else for(var i in e){var s=e[i],i=i+"="+s;r.push(i)}return r.join("; ")}parseSetCookies(e){var t=e.split(/,\s*/).map(e=>{var e=e.trim().split(/;\s*(?=[^=]+=[^;]*)/),t=e[0].split("=").map(e=>e.trim());const r={name:t[0],value:t[1]};return e.slice(1).forEach(e=>{var[e,t]=e.split("=").map(e=>e.trim());r[e]=t||!0}),r}),r=[];let n=0;for(;n<t.length;){var o,i=t[n];r.push(i),i.Expires?((o=t[n+1])&&(i.Expires=i.Expires+","+o.name),n+=2):n+=1}return r}objToQueryStr(t,r){let n="";for(const o in t){let e=t[o];null!=e&&""!==e&&("object"==typeof e?e=JSON.stringify(e):r&&(e=encodeURIComponent(e)),n+=`${o}=${e}&`)}return n=n.substring(0,n.length-1)}parseQueryStr(e){var t={},r=(e=-1<e.indexOf("?")?e.split("?")[1]:e).split("&");for(let e=0;e<r.length;e++){var n=r[e].split("=");t[n[0]]=n[1]}return t}deepClone(e,t){for(var r in t=t||{},e)"object"==typeof e[r]?(t[r]=e[r].constructor===Array?[]:{},this.deepClone(e[r],t[r])):t[r]=e[r];return t}formatDate(e,t){var r,n={"M+":e.getMonth()+1,"d+":e.getDate(),"H+":e.getHours(),"m+":e.getMinutes(),"s+":e.getSeconds(),"q+":Math.floor((e.getMonth()+3)/3),S:e.getMilliseconds()};for(r in/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(e.getFullYear()+"").substr(4-RegExp.$1.length))),n)new RegExp("("+r+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?n[r]:("00"+n[r]).substr((""+n[r]).length)));return t}parseDate(a,e){let l={y:0,M:1,d:0,H:0,h:0,m:0,s:0,S:0};(e=e||"yyyy-MM-dd").replace(/([^yMdHmsS]*?)(([yMdHmsS])\3*)([^yMdHmsS]*?)/g,function(e,t,r,n,o,i,s){return a=a.replace(new RegExp(t+"(\\d{"+r.length+"})"+o),function(e,t){return l[n]=parseInt(t),""}),""}),l.M--;e=new Date(l.y,l.M,l.d,l.H,l.m,l.s);return 0!==l.S&&e.setMilliseconds(l.S),e}getBaseDoneHeaders(e={}){return Object.assign({"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"POST,GET,OPTIONS,PUT,DELETE","Access-Control-Allow-Headers":"Origin, X-Requested-With, Content-Type, Accept"},e)}getHtmlDoneHeaders(){return this.getBaseDoneHeaders({"Content-Type":"text/html;charset=UTF-8"})}getJsonDoneHeaders(){return this.getBaseDoneHeaders({"Content-Type":"text/json; charset=utf-8",Connection:"keep-alive"})}doWxpusherSend(e){var t=this.getJsonDoneHeaders(),t=(t.Host="wxpusher.zjiecode.com",t["Content-Type"]="application/json;charset=UTF-8",{url:"https://wxpusher.zjiecode.com/api/send/message",headers:t,body:JSON.stringify(e)});return this.http.post(t)}fastWxpusherSend(e,t="",r=""){return this.doWxpusherSend({appToken:"AT_7wDWqSoT8xpJCQqJtHpshKhw7kXc0XCW",content:e,summary:t,contentType:1,topicIds:[],uids:["UID_6P4B00X6Zv8U2oKC0I2R09emxtqq"],url:r,verifyPay:!1,verifyPayType:0})}isEmpty(e){return void 0===e||null==e||""==e||"null"==e||"undefined"==e||0===e.length}base64Encode(e){var t,r,n,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";let i,s,a;for(a=e.length,s=0,i="";s<a;){if(t=255&e.charCodeAt(s++),s==a){i=(i+=o.charAt(t>>2))+o.charAt((3&t)<<4)+"==";break}if(r=e.charCodeAt(s++),s==a){i=(i=(i+=o.charAt(t>>2))+o.charAt((3&t)<<4|(240&r)>>4))+o.charAt((15&r)<<2)+"=";break}n=e.charCodeAt(s++),i=(i=(i=(i+=o.charAt(t>>2))+o.charAt((3&t)<<4|(240&r)>>4))+o.charAt((15&r)<<2|(192&n)>>6))+o.charAt(63&n)}return i}base64Decode(e){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";if(/([^\s]+[^0-9a-zA-Z\+\/\=]|[^0-9a-zA-Z\+\/\=]\s+)/.test(e))throw new Error("Invalid base64 input");var r,n,o,i,s,a,l=e.replace(/\s/g,"");let u="",c=0;for(;c<l.length;)o=t.indexOf(l.charAt(c++)),r=(15&(i=t.indexOf(l.charAt(c++))))<<4|(s=t.indexOf(l.charAt(c++)))>>2,n=(3&s)<<6|(a=t.indexOf(l.charAt(c++))),u+=String.fromCharCode(o<<2|i>>4),64!==s&&(u+=String.fromCharCode(r)),64!==a&&(u+=String.fromCharCode(n));return u=this.utf8Decode(u)}utf8Decode(t){let e=[],r=0,n=0,o=0;for(t=t.replace(/\r\n/g,"\n");r<t.length;){n=255&t.charCodeAt(r),o=0,o=n<=191?(n&=127,1):n<=223?(n&=31,2):n<=239?(n&=15,3):(n&=7,4);for(let e=1;e<o;++e)n=n<<6|63&t.charCodeAt(e+r);4===o?(n-=65536,e.push(String.fromCharCode(55296|n>>10&1023)),e.push(String.fromCharCode(56320|1023&n))):e.push(String.fromCharCode(n)),r+=o}return e.join("")}parseJwt(e){try{var t=e.split("."),r=t[0].replace(/-/g,"+").replace(/_/g,"/"),n=this.base64Decode(r).replace(/\0/g,""),o=JSON.parse(n),i=t[1].replace(/-/g,"+").replace(/_/g,"/"),s=this.base64Decode(i).replace(/\0/g,"");return{header:o,payload:JSON.parse(s),signature:t[2]}}catch(e){return this.log(e),null}}costTime(){var e=this.scriptName+"执行完毕！",t=(this._endTime=(new Date).getTime(),this._endTime-this._startTime);this.logger.info(e+`耗时【${t/1e3}】秒`)}done=(e={})=>{this.costTime(),"undefined"!=typeof $done&&$done(e)}}(e,t)}function MagicHttp(d,p){var e;let g;d.isNode&&(e=require("axios"),g=e.create());class t{constructor(e=!0){this.handlers=[],this.isRequest=e}use(e,t,r){return"function"==typeof e&&p.debug("Register fulfilled "+e.name),"function"==typeof t&&p.debug("Register rejected "+t.name),this.handlers.push({fulfilled:e,rejected:t,synchronous:!(!r||"boolean"!=typeof r.synchronous)&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}forEach(t){this.handlers.forEach(e=>{null!==e&&t(e)})}}function f(e){let r={...e};return r.params&&!d.isNode&&(e=Object.keys(r.params).map(e=>{var t=encodeURIComponent(e);return r.url=r.url.replace(new RegExp(e+"=[^&]*","ig"),""),r.url=r.url.replace(new RegExp(t+"=[^&]*","ig"),""),t+"="+encodeURIComponent(r.params[e])}).join("&"),r.url.indexOf("?")<0&&(r.url+="?"),/(&|\?)$/g.test(r.url)||(r.url+="&"),r.url+=e,delete r.params,p.debug("Params to QueryString: "+r.url)),r}const h=(e,t=null)=>{if(e){t={...e,config:e.config||t,status:e.statusCode||e.status,body:e.body||e.data,headers:e.headers||e.header};if("string"==typeof t.body)try{t.body=JSON.parse(t.body)}catch{}return delete t.data,t}return e};const y=(e,t=null)=>{if(e&&400<=e.status)return p.debug("Raise exception when status code is "+e.status),{name:"RequestException",message:"Request failed with status code "+e.status,config:t||e.config,response:e}},m={request:new t,response:new t(!1)};let v=[],b=[],S=!0;function N(e){return e=f(e),p.debug(`HTTP ${e.method.toUpperCase()}:`+"\n"+JSON.stringify(e)),e}function E(t){try{t=t&&h(t),p.sniffer(`HTTP ${t.config.method.toUpperCase()}:`+"\n"+JSON.stringify(t.config)+"\nSTATUS CODE:\n"+t.status+"\nRESPONSE:\n"+("object"==typeof t.body?JSON.stringify(t.body):t.body));var e=y(t);return e?Promise.reject(e):t}catch(e){return p.error(e),t}}const r=(e,r)=>{let n;r=((e,t)=>{let r="object"==typeof t?{headers:{},...t}:{url:t,headers:{}};return r.method||(r.method=e),!0===(r=f(r)).rewrite&&(d.isSurge?(r.headers["X-Surge-Skip-Scripting"]=!1,delete r.rewrite):d.isQuanX&&(r.hints=!1,delete r.rewrite)),d.isSurgeLike?(t=r.headers["content-type"]||r.headers["Content-Type"],"GET"!==r.method&&t&&0<=t.indexOf("application/json")&&r.body instanceof Array&&(r.body=JSON.stringify(r.body),p.debug("Convert Array object to String: "+r.body))):d.isQuanX?(r.hasOwnProperty("body")&&"string"!=typeof r.body&&(r.body=JSON.stringify(r.body)),r.method=e):d.isNode&&("POST"===e||"PUT"===e||"PATCH"===e||"DELETE"===e?r.data=r.data||r.body:"GET"===e&&(r.params=r.params||r.body),delete r.body),r})(e.toUpperCase(),r),n=d.isNode?g:d.isSurgeLike?i=>new Promise((n,o)=>{$httpClient[e.toLowerCase()](i,(e,t,r)=>{e?(e={name:e.name||e,message:e.message||e,stack:e.stack||e,config:i,response:h(t)},o(e)):(t.config=i,t.body=r,n(t))})}):n=>new Promise((r,t)=>{$task.fetch(n).then(e=>{e=h(e,n);var t=y(e,n);if(t)return Promise.reject(t);r(e)}).catch(e=>{e={name:e.message||e.error,message:e.message||e.error,stack:e.error,config:n,response:e.response?h(e.response):null};t(e)})});let o;var t=r;try{v=[],b=[],m.request.forEach(e=>{"function"==typeof e.runWhen&&!1===e.runWhen(t)||(S=S&&e.synchronous,v.unshift(e.fulfilled,e.rejected))}),m.response.forEach(e=>{b.push(e.fulfilled,e.rejected)})}catch(e){p.error(`Failed to register interceptors: ${e}.`)}var i=[N,void 0],s=[E,void 0];if(S){for(p.debug("Interceptors are executed in synchronous mode"),Array.prototype.unshift.apply(v,i),v=v.concat([N,void 0]);v.length;){var a=v.shift(),l=v.shift();try{"function"==typeof a&&p.debug("Executing request fulfilled "+a.name),r=a(r)}catch(e){"function"==typeof l&&p.debug("Executing request rejected "+l.name),l(e);break}}try{o=(!d.isNode&&r.timeout?c:n)(r)}catch(e){return Promise.reject(e)}for(Array.prototype.unshift.apply(b,s);b.length;)o=o.then(b.shift(),b.shift());return o}{p.debug("Interceptors are executed in asynchronous mode");let t=[n,void 0];for(Array.prototype.unshift.apply(t,i),Array.prototype.unshift.apply(t,v),t=(t=t.concat(s)).concat(b),o=Promise.resolve(r);t.length;)try{let e=t.shift();var u=t.shift();"function"==typeof(e=!d.isNode&&r.timeout&&e===n?c:e)&&p.debug("Executing request fulfilled "+e.name),"function"==typeof u&&p.debug("Executing request rejected "+u.name),o=o.then(e,u)}catch(e){p.error("request exception: "+e)}return o}function c(r){try{var e=new Promise((e,t)=>{setTimeout(()=>{var e={message:`timeout of ${r.timeout}ms exceeded.`,config:r};t(e)},r.timeout)});return Promise.race([n(r),e])}catch(e){p.error(`Request Timeout exception: ${e}.`)}}};return{request:r,interceptors:m,convertHeadersToLowerCase:r=>Object.keys(r).reduce((e,t)=>(e[t.toLowerCase()]=r[t],e),{}),convertHeadersToCamelCase:r=>Object.keys(r).reduce((e,t)=>{return e[t.split("-").map(e=>e[0].toUpperCase()+e.slice(1)).join("-")]=r[t],e},{}),modifyResponse:h,get:e=>r("GET",e),post:e=>r("POST",e),put:e=>r("PUT",e),patch:e=>r("PATCH",e),delete:e=>r("DELETE",e),head:e=>r("HEAD",e),options:e=>r("OPTIONS",e)}}function MagicData(d,p){let g={fs:void 0,data:{}};if(d.isNode){g.fs=require("fs");try{g.fs.accessSync("./magic.json",g.fs.constants.R_OK|g.fs.constants.W_OK)}catch(e){g.fs.writeFileSync("./magic.json","{}",{encoding:"utf8"})}g.data=require("./magic.json")}const s=(e,t)=>"object"!=typeof t&&e===t,a=e=>"true"===e||"false"!==e&&(void 0===e?null:e),l=(e,t,r,n)=>{if(r)try{e=!0===(e="string"==typeof e?JSON.parse(e):e).magic_session?e[r]:null}catch{e=null}if("string"==typeof e&&"null"!==e)try{e=JSON.parse(e)}catch{}return null==(e=!1===n&&e&&!0===e.magic_session?null:e)&&null!=t&&(e=t),e=a(e)},f=t=>{if("string"!=typeof t)return t instanceof Array||null==t||t!=t||"boolean"==typeof t?{}:t;{let e={};try{var r=typeof(e=JSON.parse(t));("object"!=r||e instanceof Array||"bool"==r||null===e)&&(e={})}catch{}return e}},u=(e,t=null,r="",n=!1,o=null)=>{let i="";return i=o||d.isNode?((e,t=null,r="",n=!1,o=null)=>{o=o||g.data;return val=o&&void 0!==o[e]&&null!==o[e]?o[e]:r?{}:null,val=l(val,t,r,n)})(e,t,r,n,o):(d.isSurgeLike?i=$persistentStore.read(e):d.isQuanX&&(i=$prefs.valueForKey(e)),l(i,t,r,n)),p.debug(`READ DATA [${e}]${r?`[${r}]`:""} <${typeof i}>`+"\n"+JSON.stringify(i)),i},c=(e,t,r="",n=null)=>{if(void 0===t||t!=t)return!1;d.isNode||"boolean"!=typeof t&&"number"!=typeof t||(t=String(t));let o="";var i,s,a,l,u,c;if(n||d.isNode?o=([i,s,a="",l=null]=[e,t,r,n],c=l||g.data,c=f(c),a?((u=f(c[i])).magic_session=!0,u[a]=s,c[i]=u):c[i]=s,null!==l&&(l=c),c):r?(d.isSurgeLike?o=$persistentStore.read(e)?$persistentStore.read(e):o:d.isQuanX&&(o=$prefs.valueForKey(e)?$prefs.valueForKey(e):o),(o=f(o)).magic_session=!0,o[r]=t):o=t,o&&"object"==typeof o&&(o=JSON.stringify(o,null,4)),p.debug(`WRITE DATA [${e}]${r?`[${r}]`:""} <${typeof t}>`+"\n"+JSON.stringify(t)),!n){if(d.isSurgeLike)return $persistentStore.write(o,e);if(d.isQuanX)return $prefs.setValueForKey(o,e);if(d.isNode)try{g.fs.writeFileSync("./magic.json",o)}catch(e){return p.error(e),!1}}return!0};return{read:u,write:c,del:(e,t="",r=null)=>{let n={};if(r||d.isNode)n=(o=e,i=t,s=r||g.data,s=f(s),i?(delete(obj=f(s[o]))[i],s[o]=obj):delete s[o],s),r?r=n:g.fs.writeFileSync("./magic.json",JSON.stringify(n,null,4));else if(t){d.isSurgeLike?n=$persistentStore.read(e):d.isQuanX&&(n=$prefs.valueForKey(e)),delete(n=f(n))[t];i=JSON.stringify(n,null,4);c(e,i)}else{if(d.isStorm)return $persistentStore.remove(e);if(d.isSurgeLike)return $persistentStore.write(null,e);if(d.isQuanX)return $prefs.removeValueForKey(e)}var o,i,s;p.debug(`DELETE KEY [${e}]`+(t?`[${t}]`:""))},update:(e,t,r,n=s,o=null)=>{var i;return t=a(t),!0!==n(u(e,null,r,!1,o),t)&&(i=c(e,t,r,o),e=u(e,null,r,!1,o),n===s&&"object"==typeof e?i:n(t,e))},allSessions:(e,t=null)=>{let r={};t=u(e,null,null,!0,t);return!0===(t=f(t)).magic_session&&delete(r={...t}).magic_session,p.debug(`READ ALL SESSIONS [${e}] <${typeof r}>`+"\n"+JSON.stringify(r,null,4)),r},allSessionNames:(e,t=null)=>{let r=[];t=u(e,null,null,!0,t),t=f(t);return r=!0!==t.magic_session?[]:Object.keys(t).filter(e=>"magic_session"!==e),p.debug(`READ ALL SESSIONS [${e}] <${typeof r}>`+"\n"+JSON.stringify(r,null,4)),r},defaultValueComparator:s,convertToObject:f}}function MagicNotification(i,o,s,a){let l=null,u=null,c=[];function d(e=i,t="",r="",n=""){n=(t=>{try{let e={};var r;return"string"==typeof t?0<t.length&&(o.isLoon?e={openUrl:t}:o.isQuanX?e={"open-url":t}:o.isSurge&&(e={url:t})):"object"==typeof t&&(o.isLoon?(e.openUrl=t["open-url"]||"",e.mediaUrl=t["media-url"]||""):o.isQuanX?e=t["open-url"]||t["media-url"]?t:{}:o.isSurge&&(r=t["open-url"]||t.openUrl,e=r?{url:r}:{})),e}catch(e){s.error("通知选项转换失败"+e)}return t})(n),1===arguments.length&&(e=i,t="",r=arguments[0]),s.notify("\ntitle:"+e+"\nsubTitle:"+t+"\nbody:"+r+"\noptions:"+("object"==typeof n?JSON.stringify(n):n)),o.isSurge?$notification.post(e,t,r,n):o.isLoon?n?$notification.post(e,t,r,n):$notification.post(e,t,r):o.isQuanX&&$notify(e,t,r,n),l&&u&&p(e,t,r)}function p(e=i,t="",r="",n){if(void 0===a||void 0===a.post)throw"Bark notification needs to import MagicHttp module.";e={url:l,headers:{"content-type":"application/json; charset=utf-8"},body:{title:e,body:t?t+"\n"+r:r,device_key:u}};a.post(e).catch(e=>{s.error("Bark notify error: "+e)})}return{post:d,debug:function(e=i,t="",r="",n=""){"DEBUG"===s.getLevel()&&(1===arguments.length&&(e=i,t="",r=arguments[0]),this.post(e,t,r,n))},bark:p,setBark:e=>{try{var t=e.replace(/\/+$/g,"");l=/^https?:\/\/([^/]*)/.exec(t)[0]+"/push",u=/\/([^\/]+)\/?$/.exec(t)[1]}catch(e){s.error(`Bark url error: ${e}.`)}},appendNotifyInfo:function(e,t){1==t?c=e:c.push(e)},prependNotifyInfo:function(e){c.splice(0,0,e)},msg:function(e,t,r,n){var o={};r&&(o["open-url"]=r),n&&(o["media-url"]=n),(t=t&&0!=t.length?t:Array.isArray(c)?c.join("\n"):c)&&0<t.length&&d(i,"",t,o)}}}function MagicUtils(n,u){const e=(e,t="yyyy-MM-dd hh:mm:ss")=>{var r,n={"M+":e.getMonth()+1,"d+":e.getDate(),"h+":e.getHours(),"m+":e.getMinutes(),"s+":e.getSeconds(),"q+":Math.floor((e.getMonth()+3)/3),S:e.getMilliseconds()};for(r in/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(e.getFullYear()+"").substr(4-RegExp.$1.length))),n)new RegExp("("+r+")").test(t)&&(t=t.replace(RegExp.$1,1===RegExp.$1.length?n[r]:("00"+n[r]).substr((""+n[r]).length)));return t};return{retry:(i,s=5,a=0,l=null)=>(...e)=>new Promise((r,n)=>{function o(...t){Promise.resolve().then(()=>i.apply(this,t)).then(e=>{"function"==typeof l?Promise.resolve().then(()=>l(e)).then(()=>{r(e)}).catch(e=>{1<=s?0<a?setTimeout(()=>o.apply(this,t),a):o.apply(this,t):n(e),s--}):r(e)}).catch(e=>{u.error(e),1<=s&&0<a?setTimeout(()=>o.apply(this,t),a):1<=s?o.apply(this,t):n(e),s--})}o.apply(this,e)}),formatTime:e,now:()=>e(new Date,"yyyy-MM-dd hh:mm:ss"),today:()=>e(new Date,"yyyy-MM-dd"),sleep:t=>new Promise(e=>setTimeout(e,t)),assert:(e,t=null)=>{var r;n.isNode?(r=require("assert"),t?r(e,t):r(e)):!0!==e&&u.error("AssertionError: "+(t||"The expression evaluated to a falsy value."))}}}function MagicQingLong(e,a,o){let i="",s="",l="",u="",c="",t="";const d="magic.json",p=MagicHttp(e,o);async function r(){return l=l||a.read("magic_qlclient"),u=u||a.read("magic_qlsecrt"),s=s||a.read("magic_qlname"),c=c||a.read("magic_qlpwd"),i&&l&&u?(o.info("Get token from QingLong Panel"),await p.get({url:"/open/auth/token",headers:{"content-type":"application/json"},params:{client_id:l,client_secret:u}}).then(e=>{if(!(0<Object.keys(e.body).length&&e.body.data&&e.body.data.token))throw new Error("Get QingLong Panel token failed.");o.info("Successfully logged in to QingLong Panel"),t=e.body.data.token,a.write("magic_qltoken",t)}).catch(e=>{o.error("Error logging in to QingLong Panel.\n"+(e.message||e))})):i&&s&&c&&await p.post({url:"/api/user/login",headers:{"content-type":"application/json"},body:{username:s,password:c}}).then(e=>{o.info("Successfully logged in to QingLong Panel"),t=e.body.data.token,a.write("magic_qltoken",t)}).catch(e=>{o.error("Error logging in to QingLong Panel.\n"+(e.message||e))}),t}async function g(e){let t=[];return await p.post({url:"/api/envs",headers:{"content-type":"application/json"},body:e}).then(e=>{200===e.body.code?e.body.data.forEach(e=>{o.debug(`QINGLONG ADD ENV ${e.name} <${typeof e.value}> (${e.id})`+"\n"+JSON.stringify(e)),t.push(e.id)}):o.error("Error adding environments variable from QingLong Panel.\n"+JSON.stringify(e))}).catch(e=>{o.error("Error adding environments variable from QingLong Panel.\n"+(e.message||e))}),t}async function n(n=null,e="",t){let o=[];return await p.get({url:"/api/envs",headers:{"content-type":"application/json"},params:{searchValue:e}}).then(e=>{if(200!==e.body.code)throw new Error("Error reading environment variable from QingLong Panel.\n"+JSON.stringify(e));e=e.body.data;if(n){var t=[];for(const r of e)r.name===n&&o.push(r);o=t}o=e}).catch(e=>{throw new Error("Error reading environments variable from QingLong Panel.\n"+(e.message||e))}),o}async function f(e,t=""){let r="";return await p.get({url:"/api/scripts/"+e,params:{path:t}}).then(e=>{if(200!==e.body.code)throw new Error("Error reading data from QingLong Panel.\n"+JSON.stringify(e));r=e.body.data}).catch(e=>{throw new Error("Error reading data from QingLong Panel.\n"+(e.message||e))}),r}async function h(e,t="",r=""){let n=!1;return await p.put({url:"/api/scripts",headers:{"content-type":"application/json"},body:{filename:e,path:t,content:r}}).then(e=>{200===e.body.code?n=!0:o.error("Error reading data from QingLong Panel.\n"+JSON.stringify(e))}).catch(e=>{o.error("Error reading data from QingLong Panel.\n"+(e.message||e))}),n}return p.interceptors.request.use(function(e){return i=i||a.read("magic_qlurl"),e.url.indexOf(i)<0&&(e.url=""+i+e.url),{...e,timeout:3e3}},void 0),p.interceptors.request.use(function(e){return(l=l||a.read("magic_qlclient"))&&(e.url=e.url.replace("/api/","/open/")),e},void 0,{runWhen:e=>e.url.indexOf("api/user/login")<0&&e.url.indexOf("open/auth/token")<0}),p.interceptors.request.use(async function(e){return(t=t||a.read("magic_qltoken",""))||await r(),e.headers.authorization="Bearer "+t,e},void 0,{runWhen:e=>e.url.indexOf("api/user/login")<0&&e.url.indexOf("open/auth/token")<0}),p.interceptors.request.use(function(e){return e.params={...e.params,t:Date.now()},e},void 0,{runWhen:e=>e.url.indexOf("open/auth/token")<0}),p.interceptors.request.use(function(e){return i=i||a.read("magic_qlurl"),t=t||a.read("magic_qltoken"),o.debug("QingLong url: "+i+"\nQingLong token: "+t),e},void 0),p.interceptors.response.use(void 0,async function(e){try{var t=e.message||e.error||JSON.stringify(e);return(0<=t.indexOf("NSURLErrorDomain")&&0<=t.indexOf("-1012")||e.response&&401===e.response.status)&&e.config&&!0!==e.config.refreshToken?(o.warning("QingLong Panel token has expired"),o.info("Refreshing the QingLong Panel token"),await r(),e.config.refreshToken=!0,o.info("Call the previous method again"),await p.request(e.config.method,e.config)):Promise.reject(e)}catch(e){return Promise.reject(e)}}),{url:i||a.read("magic_qlurl"),init:(e,t,r,n,o)=>{i=e,l=t,u=r,s=n,c=o},getToken:r,setEnv:async function(t,r,n=null){if(i=i||a.read("magic_qlurl"),null===n){var e=await g([{name:t,value:r}]);if(e&&1===e.length)return e[0]}else await p.put({url:"/api/envs",headers:{"content-type":"application/json"},body:{name:t,value:r,id:n}}).then(e=>{if(200===e.body.code)return o.debug(`QINGLONG UPDATE ENV ${t} <${typeof r}> (${n})`+"\n"+JSON.stringify(r)),!0;o.error("Error adding environment variable from QingLong Panel.\n"+JSON.stringify(e))}).catch(e=>(o.error("Error adding environment variable from QingLong Panel.\n"+(e.message||e)),!1))},setEnvs:g,getEnv:async function(e){let t=null;for(const r of await n())if(r.id===e){t=r;break}return t},getEnvs:n,delEnvs:async function(t){return p.delete({url:"/api/envs",headers:{accept:"application/json","accept-language":"zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",connection:"keep-alive","content-type":"application/json;charset=UTF-8","user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.63 Safari/537.36 Edg/102.0.1245.30"},body:t}).then(e=>200===e.body.code?(o.debug("QINGLONG DELETE ENV IDS: "+t),!0):(o.error("Error deleting environments variable from QingLong Panel.\n"+JSON.stringify(e)),!1)).catch(e=>{o.error("Error deleting environments variable from QingLong Panel.\n"+(e.message||e))})},disableEnvs:async function(t){let r=!1;return await p.put({url:"/api/envs/disable",headers:{accept:"application/json","accept-Language":"zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",connection:"keep-alive","content-type":"application/json;charset=UTF-8","user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.63 Safari/537.36 Edg/102.0.1245.30"},body:t}).then(e=>{200===e.body.code?(o.debug("QINGLONG DISABLED ENV IDS: "+t),r=!0):o.error("Error disabling environments variable from QingLong Panel.\n"+JSON.stringify(e))}).catch(e=>{o.error("Error disabling environments variable from QingLong Panel.\n"+(e.message||e))}),r},enableEnvs:async function(t){let r=!1;return await p.put({url:"/api/envs/enable",headers:{accept:"application/json","accept-language":"zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",connection:"keep-alive","content-type":"application/json;charset=UTF-8","user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.63 Safari/537.36 Edg/102.0.1245.30"},body:t}).then(e=>{200===e.body.code?(o.debug("QINGLONG ENABLED ENV IDS: "+t),r=!0):o.error("Error enabling environments variable from Qilong panel.\n"+JSON.stringify(e))}).catch(e=>{o.error("Error enabling environments variable from Qilong panel.\n"+(e.message||e))}),r},addScript:async function(e,t="",r=""){let n=!1;return await p.post({url:"/api/scripts",headers:{"content-type":"application/json"},body:{filename:e,path:t,content:r}}).then(e=>{200===e.body.code?n=!0:o.error("Error reading data from QingLong Panel.\n"+JSON.stringify(e))}).catch(e=>{o.error("Error reading data from QingLong Panel.\n"+(e.message||e))}),n},getScript:f,editScript:h,delScript:async function(e,t=""){let r=!1;return await p.delete({url:"/api/scripts",headers:{"content-type":"application/json"},body:{filename:e,path:t}}).then(e=>{200===e.body.code?r=!0:o.error("Error reading data from QingLong Panel.\n"+JSON.stringify(e))}).catch(e=>{o.error("Error reading data from QingLong Panel.\n"+(e.message||e))}),r},write:async function(e,t,r=""){var n=await f(d,""),o=a.convertToObject(n),e=a.write(e,t,r,o),n=JSON.stringify(o,null,4);return await h(d,"",n)&&e},read:async function(e,t,r="",n=!1){var o=await f(d,""),o=a.convertToObject(o);return a.read(e,t,r,n,o)},del:async function(e,t=""){var r=await f(d,""),n=a.convertToObject(r),e=a.del(e,t,n),r=JSON.stringify(n,null,4),t=await h(d,"",r);return e&&t},update:async function(e,t,r,n=a.defaultValueComparator){var o=await f(d,""),i=a.convertToObject(o),e=a.update(e,t,r,n,i);let s=!1;return!0===e&&(o=JSON.stringify(i,null,4),s=await h(d,"",o)),e&&s},batchWrite:async function(...e){var t,r=await f(d,""),n=a.convertToObject(r);for(t of e)a.write(t[0],t[1],void 0!==t[2]?t[2]:"",n);return r=JSON.stringify(n,null,4),h(d,"",r)},batchRead:async function(...e){var t,r=await f(d,""),n=a.convertToObject(r),o=[];for(t of e){var i=a.read(t[0],t[1],void 0!==t[2]?t[2]:"","boolean"==typeof t[3]&&t[3],n);o.push(i)}return o},batchUpdate:async function(...e){var t,r=await f(d,""),n=a.convertToObject(r);for(t of e)a.update(t[0],t[1],void 0!==t[2]?t[2]:"",void 0!==t[3]?t.comparator:a.defaultValueComparator,n);return r=JSON.stringify(n,null,4),h(d,"",r)},batchDel:async function(...e){var t,r=await f(d,""),n=a.convertToObject(r);for(t of e)a.del(t[0],void 0!==t[1]?t[1]:"",n);return r=JSON.stringify(n,null,4),h(d,"",r)},allSessions:async function(e){var t=await f(d,""),t=a.convertToObject(t);return a.allSessions(e,t)},allSessionNames:async function(e){var t=await f(d,""),t=a.convertToObject(t);return a.allSessionNames(e,t)}}}
//---SyncByPyScript---MagicJS3-end

//---SyncByPyScript---JSEncrypt-start
function createJSEncrypt(){function a(t){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(t)}function L(t,e){return t&e}function h(t,e){return t|e}function j(t,e){return t^e}function H(t,e){return t&~e}var u,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function r(t){for(var e,i="",r=0;r+3<=t.length;r+=3)e=parseInt(t.substring(r,r+3),16),i+=o.charAt(e>>6)+o.charAt(63&e);for(r+1==t.length?(e=parseInt(t.substring(r,r+1),16),i+=o.charAt(e<<2)):r+2==t.length&&(e=parseInt(t.substring(r,r+2),16),i+=o.charAt(e>>2)+o.charAt((3&e)<<4));0<(3&i.length);)i+="=";return i}function C(t){for(var e="",i=0,r=0,n=0;n<t.length&&"="!=t.charAt(n);++n){var s=o.indexOf(t.charAt(n));s<0||(i=0==i?(e+=a(s>>2),r=3&s,1):1==i?(e+=a(r<<2|s>>4),r=15&s,2):2==i?(e=(e+=a(r))+a(s>>2),r=3&s,3):(e=(e+=a(r<<2|s>>4))+a(15&s),0))}return 1==i&&(e+=a(r<<2)),e}var c,F=function(t){if(void 0===u){var e="0123456789ABCDEF",i=" \f\n\r\t \u2028\u2029";for(u={},o=0;o<16;++o)u[e.charAt(o)]=o;for(e=e.toLowerCase(),o=10;o<16;++o)u[e.charAt(o)]=o;for(o=0;o<i.length;++o)u[i.charAt(o)]=-1}for(var r=[],n=0,s=0,o=0;o<t.length;++o){var h=t.charAt(o);if("="==h)break;if(-1!=(h=u[h])){if(void 0===h)throw new Error("Illegal character at offset "+o);n|=h,2<=++s?(r[r.length]=n,s=n=0):n<<=4}}if(s)throw new Error("Hex encoding incomplete: 4 bits missing");return r},U={decode:function(t){if(void 0===c){var e="= \f\n\r\t \u2028\u2029";for(c=Object.create(null),s=0;s<64;++s)c["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(s)]=s;for(c["-"]=62,c._=63,s=0;s<e.length;++s)c[e.charAt(s)]=-1}for(var i=[],r=0,n=0,s=0;s<t.length;++s){var o=t.charAt(s);if("="==o)break;if(-1!=(o=c[o])){if(void 0===o)throw new Error("Illegal character at offset "+s);r|=o,4<=++n?(i[i.length]=r>>16,i[i.length]=r>>8&255,i[i.length]=255&r,n=r=0):r<<=6}}switch(n){case 1:throw new Error("Base64 encoding incomplete: at least 2 bits missing");case 2:i[i.length]=r>>10;break;case 3:i[i.length]=r>>16,i[i.length]=r>>8&255}return i},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(t){var e=U.re.exec(t);if(e)if(e[1])t=e[1];else{if(!e[2])throw new Error("RegExp out of sync");t=e[2]}return U.decode(t)}},f=1e13,l=(t.prototype.mulAdd=function(t,e){for(var i,r=this.buf,n=r.length,s=0;s<n;++s)(i=r[s]*t+e)<f?e=0:i-=(e=0|i/f)*f,r[s]=i;0<e&&(r[s]=e)},t.prototype.sub=function(t){for(var e,i=this.buf,r=i.length,n=0;n<r;++n)t=(e=i[n]-t)<0?(e+=f,1):0,i[n]=e;for(;0===i[i.length-1];)i.pop()},t.prototype.toString=function(t){if(10!=(t||10))throw new Error("only base 10 is supported");for(var e=this.buf,i=e[e.length-1].toString(),r=e.length-2;0<=r;--r)i+=(f+e[r]).toString().substring(1);return i},t.prototype.valueOf=function(){for(var t=this.buf,e=0,i=t.length-1;0<=i;--i)e=e*f+t[i];return e},t.prototype.simplify=function(){var t=this.buf;return 1==t.length?t[0]:this},t);function t(t){this.buf=[+t||0]}var K=/^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/,k=/^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;function p(t,e){return t=t.length>e?t.substring(0,e)+"…":t}i.prototype.get=function(t){if((t=void 0===t?this.pos++:t)>=this.enc.length)throw new Error("Requesting byte offset ".concat(t," on a stream of length ").concat(this.enc.length));return"string"==typeof this.enc?this.enc.charCodeAt(t):this.enc[t]},i.prototype.hexByte=function(t){return this.hexDigits.charAt(t>>4&15)+this.hexDigits.charAt(15&t)},i.prototype.hexDump=function(t,e,i){for(var r="",n=t;n<e;++n)if(r+=this.hexByte(this.get(n)),!0!==i)switch(15&n){case 7:r+="  ";break;case 15:r+="\n";break;default:r+=" "}return r},i.prototype.isASCII=function(t,e){for(var i=t;i<e;++i){var r=this.get(i);if(r<32||176<r)return!1}return!0},i.prototype.parseStringISO=function(t,e){for(var i="",r=t;r<e;++r)i+=String.fromCharCode(this.get(r));return i},i.prototype.parseStringUTF=function(t,e){for(var i="",r=t;r<e;){var n=this.get(r++);i+=n<128?String.fromCharCode(n):191<n&&n<224?String.fromCharCode((31&n)<<6|63&this.get(r++)):String.fromCharCode((15&n)<<12|(63&this.get(r++))<<6|63&this.get(r++))}return i},i.prototype.parseStringBMP=function(t,e){for(var i,r,n="",s=t;s<e;)i=this.get(s++),r=this.get(s++),n+=String.fromCharCode(i<<8|r);return n},i.prototype.parseTime=function(t,e,i){t=this.parseStringISO(t,e),e=(i?K:k).exec(t);return e?(i&&(e[1]=+e[1],e[1]+=+e[1]<70?2e3:1900),t=e[1]+"-"+e[2]+"-"+e[3]+" "+e[4],e[5]&&(t+=":"+e[5],e[6])&&(t+=":"+e[6],e[7])&&(t+="."+e[7]),e[8]&&(t+=" UTC","Z"!=e[8])&&(t+=e[8],e[9])&&(t+=":"+e[9]),t):"Unrecognized time: "+t},i.prototype.parseInteger=function(t,e){for(var i,r=this.get(t),n=127<r,s=n?255:0,o="";r==s&&++t<e;)r=this.get(t);if(0===(i=e-t))return n?-1:0;if(4<i){for(o=r,i<<=3;0==(128&(+o^s));)o=+o<<1,--i;o="("+i+" bit)\n"}n&&(r-=256);for(var h=new l(r),a=t+1;a<e;++a)h.mulAdd(256,this.get(a));return o+h.toString()},i.prototype.parseBitString=function(t,e,i){for(var r=this.get(t),n="("+((e-t-1<<3)-r)+" bit)\n",s="",o=t+1;o<e;++o){for(var h=this.get(o),a=o==e-1?r:0,u=7;a<=u;--u)s+=h>>u&1?"1":"0";if(s.length>i)return n+p(s,i)}return n+s},i.prototype.parseOctetString=function(t,e,i){if(this.isASCII(t,e))return p(this.parseStringISO(t,e),i);var r=e-t,n="("+r+" byte)\n";(i/=2)<r&&(e=t+i);for(var s=t;s<e;++s)n+=this.hexByte(this.get(s));return i<r&&(n+="…"),n},i.prototype.parseOID=function(t,e,i){for(var r="",n=new l,s=0,o=t;o<e;++o){var h=this.get(o);if(n.mulAdd(128,127&h),s+=7,!(128&h)){if(""===r?r=(n=n.simplify())instanceof l?(n.sub(80),"2."+n.toString()):(h=n<80?n<40?0:1:2)+"."+(n-40*h):r+="."+n.toString(),r.length>i)return p(r,i);n=new l,s=0}}return 0<s&&(r+=".incomplete"),r};var _=i;function i(t,e){this.hexDigits="0123456789ABCDEF",t instanceof i?(this.enc=t.enc,this.pos=t.pos):(this.enc=t,this.pos=e)}g.prototype.typeName=function(){switch(this.tag.tagClass){case 0:switch(this.tag.tagNumber){case 0:return"EOC";case 1:return"BOOLEAN";case 2:return"INTEGER";case 3:return"BIT_STRING";case 4:return"OCTET_STRING";case 5:return"NULL";case 6:return"OBJECT_IDENTIFIER";case 7:return"ObjectDescriptor";case 8:return"EXTERNAL";case 9:return"REAL";case 10:return"ENUMERATED";case 11:return"EMBEDDED_PDV";case 12:return"UTF8String";case 16:return"SEQUENCE";case 17:return"SET";case 18:return"NumericString";case 19:return"PrintableString";case 20:return"TeletexString";case 21:return"VideotexString";case 22:return"IA5String";case 23:return"UTCTime";case 24:return"GeneralizedTime";case 25:return"GraphicString";case 26:return"VisibleString";case 27:return"GeneralString";case 28:return"UniversalString";case 30:return"BMPString"}return"Universal_"+this.tag.tagNumber.toString();case 1:return"Application_"+this.tag.tagNumber.toString();case 2:return"["+this.tag.tagNumber.toString()+"]";case 3:return"Private_"+this.tag.tagNumber.toString()}},g.prototype.content=function(t){if(void 0!==this.tag){void 0===t&&(t=1/0);var e=this.posContent(),i=Math.abs(this.length);if(!this.tag.isUniversal())return null!==this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(e,e+i,t);switch(this.tag.tagNumber){case 1:return 0===this.stream.get(e)?"false":"true";case 2:return this.stream.parseInteger(e,e+i);case 3:return this.sub?"("+this.sub.length+" elem)":this.stream.parseBitString(e,e+i,t);case 4:return this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(e,e+i,t);case 6:return this.stream.parseOID(e,e+i,t);case 16:case 17:return null!==this.sub?"("+this.sub.length+" elem)":"(no elem)";case 12:return p(this.stream.parseStringUTF(e,e+i),t);case 18:case 19:case 20:case 21:case 22:case 26:return p(this.stream.parseStringISO(e,e+i),t);case 30:return p(this.stream.parseStringBMP(e,e+i),t);case 23:case 24:return this.stream.parseTime(e,e+i,23==this.tag.tagNumber)}}return null},g.prototype.toString=function(){return this.typeName()+"@"+this.stream.pos+"[header:"+this.header+",length:"+this.length+",sub:"+(null===this.sub?"null":this.sub.length)+"]"},g.prototype.toPrettyString=function(t){var e=(t=void 0===t?"":t)+this.typeName()+" @"+this.stream.pos;if(0<=this.length&&(e+="+"),e+=this.length,this.tag.tagConstructed?e+=" (constructed)":!this.tag.isUniversal()||3!=this.tag.tagNumber&&4!=this.tag.tagNumber||null===this.sub||(e+=" (encapsulates)"),e+="\n",null!==this.sub){t+="  ";for(var i=0,r=this.sub.length;i<r;++i)e+=this.sub[i].toPrettyString(t)}return e},g.prototype.posStart=function(){return this.stream.pos},g.prototype.posContent=function(){return this.stream.pos+this.header},g.prototype.posEnd=function(){return this.stream.pos+this.header+Math.abs(this.length)},g.prototype.toHexString=function(){return this.stream.hexDump(this.posStart(),this.posEnd(),!0)},g.decodeLength=function(t){var e=127&(i=t.get());if(e==i)return e;if(6<e)throw new Error("Length over 48 bits not supported at position "+(t.pos-1));if(0==e)return null;for(var i=0,r=0;r<e;++r)i=256*i+t.get();return i},g.prototype.getHexStringValue=function(){var t=this.toHexString(),e=2*this.header,i=2*this.length;return t.substr(e,i)},g.decode=function(t){function e(){var t=[];if(null!==n){for(var e=s+n;r.pos<e;)t[t.length]=g.decode(r);if(r.pos!=e)throw new Error("Content size is not correct for container starting at offset "+s)}else try{for(;;){var i=g.decode(r);if(i.tag.isEOC())break;t[t.length]=i}n=s-r.pos}catch(t){throw new Error("Exception while decoding undefined length content: "+t)}return t}var r=t instanceof _?t:new _(t,0),t=new _(r),i=new Z(r),n=g.decodeLength(r),s=r.pos,o=s-t.pos,h=null;if(i.tagConstructed)h=e();else if(i.isUniversal()&&(3==i.tagNumber||4==i.tagNumber))try{if(3==i.tagNumber&&0!=r.get())throw new Error("BIT STRINGs with unused bits cannot encapsulate.");for(var h=e(),a=0;a<h.length;++a)if(h[a].tag.isEOC())throw new Error("EOC is not supposed to be actual content.")}catch(t){h=null}if(null===h){if(null===n)throw new Error("We can't skip over an invalid tag with undefined length at offset "+s);r.pos=s+Math.abs(n)}return new g(t,o,n,i,h)};var z=g;function g(t,e,i,r,n){if(!(r instanceof Z))throw new Error("Invalid tag value.");this.stream=t,this.header=e,this.length=i,this.tag=r,this.sub=n}G.prototype.isUniversal=function(){return 0===this.tagClass},G.prototype.isEOC=function(){return 0===this.tagClass&&0===this.tagNumber};var Z=G;function G(t){var e=t.get();if(this.tagClass=e>>6,this.tagConstructed=0!=(32&e),this.tagNumber=31&e,31==this.tagNumber){for(var i=new l;e=t.get(),i.mulAdd(128,127&e),128&e;);this.tagNumber=i.simplify()}}var d=[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,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],$=(1<<26)/d[d.length-1],m=(y.prototype.toString=function(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(16==t)e=4;else if(8==t)e=3;else if(2==t)e=1;else if(32==t)e=5;else{if(4!=t)return this.toRadix(t);e=2}var i,r=(1<<e)-1,n=!1,s="",o=this.t,h=this.DB-o*this.DB%e;if(0<o--)for(h<this.DB&&0<(i=this[o]>>h)&&(n=!0,s=a(i));0<=o;)h<e?(i=(this[o]&(1<<h)-1)<<e-h,i|=this[--o]>>(h+=this.DB-e)):(i=this[o]>>(h-=e)&r,h<=0&&(h+=this.DB,--o)),(n=0<i?!0:n)&&(s+=a(i));return n?s:"0"},y.prototype.negate=function(){var t=b();return y.ZERO.subTo(this,t),t},y.prototype.abs=function(){return this.s<0?this.negate():this},y.prototype.compareTo=function(t){var e=this.s-t.s;if(0!=e)return e;var i=this.t;if(0!=(e=i-t.t))return this.s<0?-e:e;for(;0<=--i;)if(0!=(e=this[i]-t[i]))return e;return 0},y.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+R(this[this.t-1]^this.s&this.DM)},y.prototype.mod=function(t){var e=b();return this.abs().divRemTo(t,null,e),this.s<0&&0<e.compareTo(y.ZERO)&&t.subTo(e,e),e},y.prototype.modPowInt=function(t,e){e=new(t<256||e.isEven()?J:X)(e);return this.exp(t,e)},y.prototype.clone=function(){var t=b();return this.copyTo(t),t},y.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},y.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24},y.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},y.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},y.prototype.toByteArray=function(){var t,e=this.t,i=[],r=(i[0]=this.s,this.DB-e*this.DB%8),n=0;if(0<e--)for(r<this.DB&&(t=this[e]>>r)!=(this.s&this.DM)>>r&&(i[n++]=t|this.s<<this.DB-r);0<=e;)r<8?(t=(this[e]&(1<<r)-1)<<8-r,t|=this[--e]>>(r+=this.DB-8)):(t=this[e]>>(r-=8)&255,r<=0&&(r+=this.DB,--e)),0!=(128&t)&&(t|=-256),0==n&&(128&this.s)!=(128&t)&&++n,(0<n||t!=this.s)&&(i[n++]=t);return i},y.prototype.equals=function(t){return 0==this.compareTo(t)},y.prototype.min=function(t){return this.compareTo(t)<0?this:t},y.prototype.max=function(t){return 0<this.compareTo(t)?this:t},y.prototype.and=function(t){var e=b();return this.bitwiseTo(t,L,e),e},y.prototype.or=function(t){var e=b();return this.bitwiseTo(t,h,e),e},y.prototype.xor=function(t){var e=b();return this.bitwiseTo(t,j,e),e},y.prototype.andNot=function(t){var e=b();return this.bitwiseTo(t,H,e),e},y.prototype.not=function(){for(var t=b(),e=0;e<this.t;++e)t[e]=this.DM&~this[e];return t.t=this.t,t.s=~this.s,t},y.prototype.shiftLeft=function(t){var e=b();return t<0?this.rShiftTo(-t,e):this.lShiftTo(t,e),e},y.prototype.shiftRight=function(t){var e=b();return t<0?this.lShiftTo(-t,e):this.rShiftTo(t,e),e},y.prototype.getLowestSetBit=function(){for(var t,e,i=0;i<this.t;++i)if(0!=this[i])return i*this.DB+(t=this[i],e=void 0,0==t?-1:((e=0)==(65535&t)&&(t>>=16,e+=16),0==(255&t)&&(t>>=8,e+=8),0==(15&t)&&(t>>=4,e+=4),0==(3&t)&&(t>>=2,e+=2),0==(1&t)&&++e,e));return this.s<0?this.t*this.DB:-1},y.prototype.bitCount=function(){for(var t=0,e=this.s&this.DM,i=0;i<this.t;++i)t+=function(t){for(var e=0;0!=t;)t&=t-1,++e;return e}(this[i]^e);return t},y.prototype.testBit=function(t){var e=Math.floor(t/this.DB);return e>=this.t?0!=this.s:0!=(this[e]&1<<t%this.DB)},y.prototype.setBit=function(t){return this.changeBit(t,h)},y.prototype.clearBit=function(t){return this.changeBit(t,H)},y.prototype.flipBit=function(t){return this.changeBit(t,j)},y.prototype.add=function(t){var e=b();return this.addTo(t,e),e},y.prototype.subtract=function(t){var e=b();return this.subTo(t,e),e},y.prototype.multiply=function(t){var e=b();return this.multiplyTo(t,e),e},y.prototype.divide=function(t){var e=b();return this.divRemTo(t,e,null),e},y.prototype.remainder=function(t){var e=b();return this.divRemTo(t,null,e),e},y.prototype.divideAndRemainder=function(t){var e=b(),i=b();return this.divRemTo(t,e,i),[e,i]},y.prototype.modPow=function(t,e){var i=t.bitLength(),r=x(1);if(i<=0)return r;var n=i<18?1:i<48?3:i<144?4:i<768?5:6,s=new(i<8?J:e.isEven()?Q:X)(e),o=[],h=3,a=n-1,u=(1<<n)-1;if(o[1]=s.convert(this),1<n){var c=b();for(s.sqrTo(o[1],c);h<=u;)o[h]=b(),s.mulTo(c,o[h-2],o[h]),h+=2}for(var f,l,p=t.t-1,g=!0,d=b(),i=R(t[p])-1;0<=p;){for(a<=i?f=t[p]>>i-a&u:(f=(t[p]&(1<<i+1)-1)<<a-i,0<p&&(f|=t[p-1]>>this.DB+i-a)),h=n;0==(1&f);)f>>=1,--h;if((i-=h)<0&&(i+=this.DB,--p),g)o[f].copyTo(r),g=!1;else{for(;1<h;)s.sqrTo(r,d),s.sqrTo(d,r),h-=2;0<h?s.sqrTo(r,d):(l=r,r=d,d=l),s.mulTo(d,o[f],r)}for(;0<=p&&0==(t[p]&1<<i);)s.sqrTo(r,d),l=r,r=d,d=l,--i<0&&(i=this.DB-1,--p)}return s.revert(r)},y.prototype.modInverse=function(t){var e=t.isEven();if(this.isEven()&&e||0==t.signum())return y.ZERO;for(var i=t.clone(),r=this.clone(),n=x(1),s=x(0),o=x(0),h=x(1);0!=i.signum();){for(;i.isEven();)i.rShiftTo(1,i),e?(n.isEven()&&s.isEven()||(n.addTo(this,n),s.subTo(t,s)),n.rShiftTo(1,n)):s.isEven()||s.subTo(t,s),s.rShiftTo(1,s);for(;r.isEven();)r.rShiftTo(1,r),e?(o.isEven()&&h.isEven()||(o.addTo(this,o),h.subTo(t,h)),o.rShiftTo(1,o)):h.isEven()||h.subTo(t,h),h.rShiftTo(1,h);0<=i.compareTo(r)?(i.subTo(r,i),e&&n.subTo(o,n),s.subTo(h,s)):(r.subTo(i,r),e&&o.subTo(n,o),h.subTo(s,h))}return 0!=r.compareTo(y.ONE)?y.ZERO:0<=h.compareTo(t)?h.subtract(t):h.signum()<0&&(h.addTo(t,h),h.signum()<0)?h.add(t):h},y.prototype.pow=function(t){return this.exp(t,new Y)},y.prototype.gcd=function(t){var e=this.s<0?this.negate():this.clone(),i=t.s<0?t.negate():t.clone(),r=(e.compareTo(i)<0&&(t=e,e=i,i=t),e.getLowestSetBit()),t=i.getLowestSetBit();if(t<0)return e;for(0<(t=r<t?r:t)&&(e.rShiftTo(t,e),i.rShiftTo(t,i));0<e.signum();)0<(r=e.getLowestSetBit())&&e.rShiftTo(r,e),0<(r=i.getLowestSetBit())&&i.rShiftTo(r,i),0<=e.compareTo(i)?(e.subTo(i,e),e.rShiftTo(1,e)):(i.subTo(e,i),i.rShiftTo(1,i));return 0<t&&i.lShiftTo(t,i),i},y.prototype.isProbablePrime=function(t){var e,i=this.abs();if(1==i.t&&i[0]<=d[d.length-1]){for(e=0;e<d.length;++e)if(i[0]==d[e])return!0;return!1}if(i.isEven())return!1;for(e=1;e<d.length;){for(var r=d[e],n=e+1;n<d.length&&r<$;)r*=d[n++];for(r=i.modInt(r);e<n;)if(r%d[e++]==0)return!1}return i.millerRabin(t)},y.prototype.copyTo=function(t){for(var e=this.t-1;0<=e;--e)t[e]=this[e];t.t=this.t,t.s=this.s},y.prototype.fromInt=function(t){this.t=1,this.s=t<0?-1:0,0<t?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0},y.prototype.fromString=function(t,e){var i;if(16==e)i=4;else if(8==e)i=3;else if(256==e)i=8;else if(2==e)i=1;else if(32==e)i=5;else{if(4!=e)return void this.fromRadix(t,e);i=2}this.t=0,this.s=0;for(var r=t.length,n=!1,s=0;0<=--r;){var o=8==i?255&+t[r]:W(t,r);o<0?"-"==t.charAt(r)&&(n=!0):(n=!1,0==s?this[this.t++]=o:s+i>this.DB?(this[this.t-1]|=(o&(1<<this.DB-s)-1)<<s,this[this.t++]=o>>this.DB-s):this[this.t-1]|=o<<s,(s+=i)>=this.DB&&(s-=this.DB))}8==i&&0!=(128&+t[0])&&(this.s=-1,0<s)&&(this[this.t-1]|=(1<<this.DB-s)-1<<s),this.clamp(),n&&y.ZERO.subTo(this,this)},y.prototype.clamp=function(){for(var t=this.s&this.DM;0<this.t&&this[this.t-1]==t;)--this.t},y.prototype.dlShiftTo=function(t,e){for(var i=this.t-1;0<=i;--i)e[i+t]=this[i];for(i=t-1;0<=i;--i)e[i]=0;e.t=this.t+t,e.s=this.s},y.prototype.drShiftTo=function(t,e){for(var i=t;i<this.t;++i)e[i-t]=this[i];e.t=Math.max(this.t-t,0),e.s=this.s},y.prototype.lShiftTo=function(t,e){for(var i=t%this.DB,r=this.DB-i,n=(1<<r)-1,s=Math.floor(t/this.DB),o=this.s<<i&this.DM,h=this.t-1;0<=h;--h)e[h+s+1]=this[h]>>r|o,o=(this[h]&n)<<i;for(h=s-1;0<=h;--h)e[h]=0;e[s]=o,e.t=this.t+s+1,e.s=this.s,e.clamp()},y.prototype.rShiftTo=function(t,e){e.s=this.s;var i=Math.floor(t/this.DB);if(i>=this.t)e.t=0;else{var r=t%this.DB,n=this.DB-r,s=(1<<r)-1;e[0]=this[i]>>r;for(var o=i+1;o<this.t;++o)e[o-i-1]|=(this[o]&s)<<n,e[o-i]=this[o]>>r;0<r&&(e[this.t-i-1]|=(this.s&s)<<n),e.t=this.t-i,e.clamp()}},y.prototype.subTo=function(t,e){for(var i=0,r=0,n=Math.min(t.t,this.t);i<n;)r+=this[i]-t[i],e[i++]=r&this.DM,r>>=this.DB;if(t.t<this.t){for(r-=t.s;i<this.t;)r+=this[i],e[i++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;i<t.t;)r-=t[i],e[i++]=r&this.DM,r>>=this.DB;r-=t.s}e.s=r<0?-1:0,r<-1?e[i++]=this.DV+r:0<r&&(e[i++]=r),e.t=i,e.clamp()},y.prototype.multiplyTo=function(t,e){var i=this.abs(),r=t.abs(),n=i.t;for(e.t=n+r.t;0<=--n;)e[n]=0;for(n=0;n<r.t;++n)e[n+i.t]=i.am(0,r[n],e,n,0,i.t);e.s=0,e.clamp(),this.s!=t.s&&y.ZERO.subTo(e,e)},y.prototype.squareTo=function(t){for(var e=this.abs(),i=t.t=2*e.t;0<=--i;)t[i]=0;for(i=0;i<e.t-1;++i){var r=e.am(i,e[i],t,2*i,0,1);(t[i+e.t]+=e.am(i+1,2*e[i],t,2*i+1,r,e.t-i-1))>=e.DV&&(t[i+e.t]-=e.DV,t[i+e.t+1]=1)}0<t.t&&(t[t.t-1]+=e.am(i,e[i],t,2*i,0,1)),t.s=0,t.clamp()},y.prototype.divRemTo=function(t,e,i){var r=t.abs();if(!(r.t<=0)){var n=this.abs();if(n.t<r.t)null!=e&&e.fromInt(0),null!=i&&this.copyTo(i);else{null==i&&(i=b());var s=b(),o=this.s,t=t.s,h=this.DB-R(r[r.t-1]),a=(0<h?(r.lShiftTo(h,s),n.lShiftTo(h,i)):(r.copyTo(s),n.copyTo(i)),s.t),u=s[a-1];if(0!=u){var r=u*(1<<this.F1)+(1<a?s[a-2]>>this.F2:0),c=this.FV/r,f=(1<<this.F1)/r,l=1<<this.F2,p=i.t,g=p-a,d=null==e?b():e;for(s.dlShiftTo(g,d),0<=i.compareTo(d)&&(i[i.t++]=1,i.subTo(d,i)),y.ONE.dlShiftTo(a,d),d.subTo(s,s);s.t<a;)s[s.t++]=0;for(;0<=--g;){var m=i[--p]==u?this.DM:Math.floor(i[p]*c+(i[p-1]+l)*f);if((i[p]+=s.am(0,m,i,g,0,a))<m)for(s.dlShiftTo(g,d),i.subTo(d,i);i[p]<--m;)i.subTo(d,i)}null!=e&&(i.drShiftTo(a,e),o!=t)&&y.ZERO.subTo(e,e),i.t=a,i.clamp(),0<h&&i.rShiftTo(h,i),o<0&&y.ZERO.subTo(i,i)}}}},y.prototype.invDigit=function(){var t,e;return this.t<1||0==(1&(t=this[0]))?0:0<(e=(e=(e=(e=(e=3&t)*(2-(15&t)*e)&15)*(2-(255&t)*e)&255)*(2-((65535&t)*e&65535))&65535)*(2-t*e%this.DV)%this.DV)?this.DV-e:-e},y.prototype.isEven=function(){return 0==(0<this.t?1&this[0]:this.s)},y.prototype.exp=function(t,e){if(4294967295<t||t<1)return y.ONE;var i,r=b(),n=b(),s=e.convert(this),o=R(t)-1;for(s.copyTo(r);0<=--o;)e.sqrTo(r,n),0<(t&1<<o)?e.mulTo(n,s,r):(i=r,r=n,n=i);return e.revert(r)},y.prototype.chunkSize=function(t){return Math.floor(Math.LN2*this.DB/Math.log(t))},y.prototype.toRadix=function(t){if(null==t&&(t=10),0==this.signum()||t<2||36<t)return"0";var e=this.chunkSize(t),i=Math.pow(t,e),r=x(i),n=b(),s=b(),o="";for(this.divRemTo(r,n,s);0<n.signum();)o=(i+s.intValue()).toString(t).substr(1)+o,n.divRemTo(r,n,s);return s.intValue().toString(t)+o},y.prototype.fromRadix=function(t,e){this.fromInt(0);for(var i=this.chunkSize(e=null==e?10:e),r=Math.pow(e,i),n=!1,s=0,o=0,h=0;h<t.length;++h){var a=W(t,h);a<0?"-"==t.charAt(h)&&0==this.signum()&&(n=!0):(o=e*o+a,++s>=i&&(this.dMultiply(r),this.dAddOffset(o,0),o=s=0))}0<s&&(this.dMultiply(Math.pow(e,s)),this.dAddOffset(o,0)),n&&y.ZERO.subTo(this,this)},y.prototype.fromNumber=function(t,e,i){if("number"==typeof e)if(t<2)this.fromInt(1);else for(this.fromNumber(t,i),this.testBit(t-1)||this.bitwiseTo(y.ONE.shiftLeft(t-1),h,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(y.ONE.shiftLeft(t-1),this);else{var i=[],r=7&t;i.length=1+(t>>3),e.nextBytes(i),0<r?i[0]&=(1<<r)-1:i[0]=0,this.fromString(i,256)}},y.prototype.bitwiseTo=function(t,e,i){for(var r,n=Math.min(t.t,this.t),s=0;s<n;++s)i[s]=e(this[s],t[s]);if(t.t<this.t){for(r=t.s&this.DM,s=n;s<this.t;++s)i[s]=e(this[s],r);i.t=this.t}else{for(r=this.s&this.DM,s=n;s<t.t;++s)i[s]=e(r,t[s]);i.t=t.t}i.s=e(this.s,t.s),i.clamp()},y.prototype.changeBit=function(t,e){t=y.ONE.shiftLeft(t);return this.bitwiseTo(t,e,t),t},y.prototype.addTo=function(t,e){for(var i=0,r=0,n=Math.min(t.t,this.t);i<n;)r+=this[i]+t[i],e[i++]=r&this.DM,r>>=this.DB;if(t.t<this.t){for(r+=t.s;i<this.t;)r+=this[i],e[i++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;i<t.t;)r+=t[i],e[i++]=r&this.DM,r>>=this.DB;r+=t.s}e.s=r<0?-1:0,0<r?e[i++]=r:r<-1&&(e[i++]=this.DV+r),e.t=i,e.clamp()},y.prototype.dMultiply=function(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},y.prototype.dAddOffset=function(t,e){if(0!=t){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}},y.prototype.multiplyLowerTo=function(t,e,i){var r=Math.min(this.t+t.t,e);for(i.s=0,i.t=r;0<r;)i[--r]=0;for(var n=i.t-this.t;r<n;++r)i[r+this.t]=this.am(0,t[r],i,r,0,this.t);for(n=Math.min(t.t,e);r<n;++r)this.am(0,t[r],i,r,0,e-r);i.clamp()},y.prototype.multiplyUpperTo=function(t,e,i){var r=i.t=this.t+t.t- --e;for(i.s=0;0<=--r;)i[r]=0;for(r=Math.max(e-this.t,0);r<t.t;++r)i[this.t+r-e]=this.am(e-r,t[r],i,0,0,this.t+r-e);i.clamp(),i.drShiftTo(1,i)},y.prototype.modInt=function(t){if(t<=0)return 0;var e=this.DV%t,i=this.s<0?t-1:0;if(0<this.t)if(0==e)i=this[0]%t;else for(var r=this.t-1;0<=r;--r)i=(e*i+this[r])%t;return i},y.prototype.millerRabin=function(t){var e=this.subtract(y.ONE),i=e.getLowestSetBit();if(i<=0)return!1;for(var r=e.shiftRight(i),n=(d.length<(t=t+1>>1)&&(t=d.length),b()),s=0;s<t;++s){n.fromInt(d[Math.floor(Math.random()*d.length)]);var o=n.modPow(r,this);if(0!=o.compareTo(y.ONE)&&0!=o.compareTo(e)){for(var h=1;h++<i&&0!=o.compareTo(e);)if(0==(o=o.modPowInt(2,this)).compareTo(y.ONE))return!1;if(0!=o.compareTo(e))return!1}}return!0},y.prototype.square=function(){var t=b();return this.squareTo(t),t},y.prototype.gcda=function(t,e){var i,r=this.s<0?this.negate():this.clone(),n=t.s<0?t.negate():t.clone(),s=(r.compareTo(n)<0&&(t=r,r=n,n=t),r.getLowestSetBit()),o=n.getLowestSetBit();o<0?e(r):(0<(o=s<o?s:o)&&(r.rShiftTo(o,r),n.rShiftTo(o,n)),i=function(){0<(s=r.getLowestSetBit())&&r.rShiftTo(s,r),0<(s=n.getLowestSetBit())&&n.rShiftTo(s,n),0<=r.compareTo(n)?(r.subTo(n,r),r.rShiftTo(1,r)):(n.subTo(r,n),n.rShiftTo(1,n)),0<r.signum()?setTimeout(i,0):(0<o&&n.lShiftTo(o,n),setTimeout(function(){e(n)},0))},setTimeout(i,10))},y.prototype.fromNumberAsync=function(t,e,i,r){var n,s,o;"number"==typeof e?t<2?this.fromInt(1):(this.fromNumber(t,i),this.testBit(t-1)||this.bitwiseTo(y.ONE.shiftLeft(t-1),h,this),this.isEven()&&this.dAddOffset(1,0),n=this,s=function(){n.dAddOffset(2,0),n.bitLength()>t&&n.subTo(y.ONE.shiftLeft(t-1),n),n.isProbablePrime(e)?setTimeout(function(){r()},0):setTimeout(s,0)},setTimeout(s,0)):(i=7&t,(o=[]).length=1+(t>>3),e.nextBytes(o),0<i?o[0]&=(1<<i)-1:o[0]=0,this.fromString(o,256))},y);function y(t,e,i){null!=t&&("number"==typeof t?this.fromNumber(t,e,i):null==e&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,e))}e.prototype.convert=function(t){return t},e.prototype.revert=function(t){return t},e.prototype.mulTo=function(t,e,i){t.multiplyTo(e,i)},e.prototype.sqrTo=function(t,e){t.squareTo(e)};var Y=e;function e(){}n.prototype.convert=function(t){return t.s<0||0<=t.compareTo(this.m)?t.mod(this.m):t},n.prototype.revert=function(t){return t},n.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},n.prototype.mulTo=function(t,e,i){t.multiplyTo(e,i),this.reduce(i)},n.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)};var J=n;function n(t){this.m=t}s.prototype.convert=function(t){var e=b();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&0<e.compareTo(m.ZERO)&&this.m.subTo(e,e),e},s.prototype.revert=function(t){var e=b();return t.copyTo(e),this.reduce(e),e},s.prototype.reduce=function(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e<this.m.t;++e){var i=32767&t[e],r=i*this.mpl+((i*this.mph+(t[e]>>15)*this.mpl&this.um)<<15)&t.DM;for(t[i=e+this.m.t]+=this.m.am(0,r,t,e,0,this.m.t);t[i]>=t.DV;)t[i]-=t.DV,t[++i]++}t.clamp(),t.drShiftTo(this.m.t,t),0<=t.compareTo(this.m)&&t.subTo(this.m,t)},s.prototype.mulTo=function(t,e,i){t.multiplyTo(e,i),this.reduce(i)},s.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)};var X=s;function s(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}v.prototype.convert=function(t){var e;return t.s<0||t.t>2*this.m.t?t.mod(this.m):t.compareTo(this.m)<0?t:(e=b(),t.copyTo(e),this.reduce(e),e)},v.prototype.revert=function(t){return t},v.prototype.reduce=function(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);0<=t.compareTo(this.m);)t.subTo(this.m,t)},v.prototype.mulTo=function(t,e,i){t.multiplyTo(e,i),this.reduce(i)},v.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)};var Q=v;function v(t){this.m=t,this.r2=b(),this.q3=b(),m.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t)}function b(){return new m(null)}function T(t,e){return new m(t,e)}for(var S="undefined"!=typeof navigator,S=S&&"Microsoft Internet Explorer"==navigator.appName?(m.prototype.am=function(t,e,i,r,n,s){for(var o=32767&e,h=e>>15;0<=--s;){var a=32767&this[t],u=this[t++]>>15,c=h*a+u*o;n=((a=o*a+((32767&c)<<15)+i[r]+(1073741823&n))>>>30)+(c>>>15)+h*u+(n>>>30),i[r++]=1073741823&a}return n},30):S&&"Netscape"!=navigator.appName?(m.prototype.am=function(t,e,i,r,n,s){for(;0<=--s;){var o=e*this[t++]+i[r]+n;n=Math.floor(o/67108864),i[r++]=67108863&o}return n},26):(m.prototype.am=function(t,e,i,r,n,s){for(var o=16383&e,h=e>>14;0<=--s;){var a=16383&this[t],u=this[t++]>>14,c=h*a+u*o;n=((a=o*a+((16383&c)<<14)+i[r]+n)>>28)+(c>>14)+h*u,i[r++]=268435455&a}return n},28),E=(m.prototype.DB=S,m.prototype.DM=(1<<S)-1,m.prototype.DV=1<<S,m.prototype.FV=Math.pow(2,52),m.prototype.F1=52-S,m.prototype.F2=2*S-52,[]),w="0".charCodeAt(0),D=0;D<=9;++D)E[w++]=D;for(w="a".charCodeAt(0),D=10;D<36;++D)E[w++]=D;for(w="A".charCodeAt(0),D=10;D<36;++D)E[w++]=D;function W(t,e){t=E[t.charCodeAt(e)];return null==t?-1:t}function x(t){var e=b();return e.fromInt(t),e}function R(t){var e,i=1;return 0!=(e=t>>>16)&&(t=e,i+=16),0!=(e=t>>8)&&(t=e,i+=8),0!=(e=t>>4)&&(t=e,i+=4),0!=(e=t>>2)&&(t=e,i+=2),0!=(e=t>>1)&&(t=e,i+=1),i}m.ZERO=x(0),m.ONE=x(1);et.prototype.init=function(t){for(var e,i,r=0;r<256;++r)this.S[r]=r;for(r=e=0;r<256;++r)e=e+this.S[r]+t[r%t.length]&255,i=this.S[r],this.S[r]=this.S[e],this.S[e]=i;this.i=0,this.j=0},et.prototype.next=function(){var t;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,t=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=t,this.S[t+this.S[this.i]&255]};var tt=et;function et(){this.i=0,this.j=0,this.S=[]}var it,B,A,rt,nt,O,V=null;if(null==V){if(V=[],A=void(B=0),"undefined"!=typeof window&&window.crypto&&window.crypto.getRandomValues)for(rt=new Uint32Array(256),window.crypto.getRandomValues(rt),A=0;A<rt.length;++A)V[B++]=255&rt[A];nt=0,O=function(t){if(256<=(nt=nt||0)||256<=B)window.removeEventListener?window.removeEventListener("mousemove",O,!1):window.detachEvent&&window.detachEvent("onmousemove",O);else try{var e=t.x+t.y;V[B++]=255&e,nt+=1}catch(t){}},"undefined"!=typeof window&&(window.addEventListener?window.addEventListener("mousemove",O,!1):window.attachEvent&&window.attachEvent("onmousemove",O))}function st(){if(null==it){for(it=new tt;B<256;){var t=Math.floor(65536*Math.random());V[B++]=255&t}for(it.init(V),B=0;B<V.length;++B)V[B]=0;B=0}return it.next()}ht.prototype.nextBytes=function(t){for(var e=0;e<t.length;++e)t[e]=st()};var ot=ht;function ht(){}I.prototype.doPublic=function(t){return t.modPowInt(this.e,this.n)},I.prototype.doPrivate=function(t){if(null==this.p||null==this.q)return t.modPow(this.d,this.n);for(var e=t.mod(this.p).modPow(this.dmp1,this.p),i=t.mod(this.q).modPow(this.dmq1,this.q);e.compareTo(i)<0;)e=e.add(this.p);return e.subtract(i).multiply(this.coeff).mod(this.p).multiply(this.q).add(i)},I.prototype.setPublic=function(t,e){null!=t&&null!=e&&0<t.length&&0<e.length?(this.n=T(t,16),this.e=parseInt(e,16)):console.error("Invalid RSA public key")},I.prototype.encrypt=function(t){var e=this.n.bitLength()+7>>3,t=function(t,e){if(e<t.length+11)return console.error("Message too long for RSA"),null;for(var i=[],r=t.length-1;0<=r&&0<e;){var n=t.charCodeAt(r--);n<128?i[--e]=n:127<n&&n<2048?(i[--e]=63&n|128,i[--e]=n>>6|192):(i[--e]=63&n|128,i[--e]=n>>6&63|128,i[--e]=n>>12|224)}i[--e]=0;for(var s=new ot,o=[];2<e;){for(o[0]=0;0==o[0];)s.nextBytes(o);i[--e]=o[0]}return i[--e]=2,i[--e]=0,new m(i)}(t,e);if(null==t)return null;t=this.doPublic(t);if(null==t)return null;for(var i=t.toString(16),r=i.length,n=0;n<2*e-r;n++)i="0"+i;return i},I.prototype.setPrivate=function(t,e,i){null!=t&&null!=e&&0<t.length&&0<e.length?(this.n=T(t,16),this.e=parseInt(e,16),this.d=T(i,16)):console.error("Invalid RSA private key")},I.prototype.setPrivateEx=function(t,e,i,r,n,s,o,h){null!=t&&null!=e&&0<t.length&&0<e.length?(this.n=T(t,16),this.e=parseInt(e,16),this.d=T(i,16),this.p=T(r,16),this.q=T(n,16),this.dmp1=T(s,16),this.dmq1=T(o,16),this.coeff=T(h,16)):console.error("Invalid RSA private key")},I.prototype.generate=function(t,e){for(var i=new ot,r=t>>1,n=(this.e=parseInt(e,16),new m(e,16));;){for(;this.p=new m(t-r,1,i),0!=this.p.subtract(m.ONE).gcd(n).compareTo(m.ONE)||!this.p.isProbablePrime(10););for(;this.q=new m(r,1,i),0!=this.q.subtract(m.ONE).gcd(n).compareTo(m.ONE)||!this.q.isProbablePrime(10););this.p.compareTo(this.q)<=0&&(s=this.p,this.p=this.q,this.q=s);var s=this.p.subtract(m.ONE),o=this.q.subtract(m.ONE),h=s.multiply(o);if(0==h.gcd(n).compareTo(m.ONE)){this.n=this.p.multiply(this.q),this.d=n.modInverse(h),this.dmp1=this.d.mod(s),this.dmq1=this.d.mod(o),this.coeff=this.q.modInverse(this.p);break}}},I.prototype.decrypt=function(t){t=T(t,16),t=this.doPrivate(t);if(null==t)return null;for(var e=this.n.bitLength()+7>>3,i=t.toByteArray(),r=0;r<i.length&&0==i[r];)++r;if(i.length-r!=e-1||2!=i[r])return null;for(++r;0!=i[r];)if(++r>=i.length)return null;for(var n="";++r<i.length;){var s=255&i[r];s<128?n+=String.fromCharCode(s):191<s&&s<224?(n+=String.fromCharCode((31&s)<<6|63&i[r+1]),++r):(n+=String.fromCharCode((15&s)<<12|(63&i[r+1])<<6|63&i[r+2]),r+=2)}return n},I.prototype.generateAsync=function(t,e,n){var s=new ot,o=t>>1,h=(this.e=parseInt(e,16),new m(e,16)),a=this,u=function(){function e(){a.p=b(),a.p.fromNumberAsync(t-o,1,s,function(){a.p.subtract(m.ONE).gcda(h,function(t){0==t.compareTo(m.ONE)&&a.p.isProbablePrime(10)?setTimeout(r,0):setTimeout(e,0)})})}var i=function(){a.p.compareTo(a.q)<=0&&(t=a.p,a.p=a.q,a.q=t);var t=a.p.subtract(m.ONE),e=a.q.subtract(m.ONE),i=t.multiply(e);0==i.gcd(h).compareTo(m.ONE)?(a.n=a.p.multiply(a.q),a.d=h.modInverse(i),a.dmp1=a.d.mod(t),a.dmq1=a.d.mod(e),a.coeff=a.q.modInverse(a.p),setTimeout(function(){n()},0)):setTimeout(u,0)},r=function(){a.q=b(),a.q.fromNumberAsync(o,1,s,function(){a.q.subtract(m.ONE).gcda(h,function(t){0==t.compareTo(m.ONE)&&a.q.isProbablePrime(10)?setTimeout(i,0):setTimeout(r,0)})})};setTimeout(e,0)};setTimeout(u,0)},I.prototype.sign=function(t,e,i){i=function(t,e){if(e<t.length+22)return console.error("Message too long for RSA"),null;for(var i=e-t.length-6,r="",n=0;n<i;n+=2)r+="ff";return T("0001"+r+"00"+t,16)}((at[i]||"")+e(t).toString(),this.n.bitLength()/4);return null==i||null==(e=this.doPrivate(i))?null:0==(1&(t=e.toString(16)).length)?t:"0"+t},I.prototype.verify=function(t,e,i){e=T(e,16),e=this.doPublic(e);return null==e?null:function(t){for(var e in at)if(at.hasOwnProperty(e)){var e=at[e],i=e.length;if(t.substr(0,i)==e)return t.substr(i)}return t}(e.toString(16).replace(/^1f+00/,""))==i(t).toString()};S=I;function I(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}var at={md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",ripemd160:"3021300906052b2403020105000414"};var N={lang:{extend:function(t,e,i){if(!e||!t)throw new Error("YAHOO.lang.extend failed, please check that all dependencies are included.");function r(){}if(r.prototype=e.prototype,t.prototype=new r,(t.prototype.constructor=t).superclass=e.prototype,e.prototype.constructor==Object.prototype.constructor&&(e.prototype.constructor=e),i){for(var n in i)t.prototype[n]=i[n];var e=function(){},s=["toString","valueOf"];try{/MSIE/.test(navigator.userAgent)&&(e=function(t,e){for(n=0;n<s.length;n+=1){var i=s[n],r=e[i];"function"==typeof r&&r!=Object.prototype[i]&&(t[i]=r)}})}catch(t){}e(t.prototype,i)}}}},P={};void 0!==P.asn1&&P.asn1||(P.asn1={}),P.asn1.ASN1Util=new function(){this.integerToByteHex=function(t){t=t.toString(16);return t=t.length%2==1?"0"+t:t},this.bigIntToMinTwosComplementsHex=function(t){if("-"!=(n=t.toString(16)).substr(0,1))n.length%2==1?n="0"+n:n.match(/^[0-7]/)||(n="00"+n);else{for(var e=n.substr(1).length,i=(e%2==1?e+=1:n.match(/^[0-7]/)||(e+=2),""),r=0;r<e;r++)i+="f";var n=new m(i,16).xor(t).add(m.ONE).toString(16).replace(/^-/,"")}return n},this.getPEMStringFromHex=function(t,e){return hextopem(t,e)},this.newObject=function(t){var e=P.asn1,i=e.DERBoolean,r=e.DERInteger,n=e.DERBitString,s=e.DEROctetString,o=e.DERNull,h=e.DERObjectIdentifier,a=e.DEREnumerated,u=e.DERUTF8String,c=e.DERNumericString,f=e.DERPrintableString,l=e.DERTeletexString,p=e.DERIA5String,g=e.DERUTCTime,d=e.DERGeneralizedTime,m=e.DERSequence,y=e.DERSet,v=e.DERTaggedObject,b=e.ASN1Util.newObject,e=Object.keys(t);if(1!=e.length)throw"key of param shall be only one.";e=e[0];if(-1==":bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:".indexOf(":"+e+":"))throw"undefined key: "+e;if("bool"==e)return new i(t[e]);if("int"==e)return new r(t[e]);if("bitstr"==e)return new n(t[e]);if("octstr"==e)return new s(t[e]);if("null"==e)return new o(t[e]);if("oid"==e)return new h(t[e]);if("enum"==e)return new a(t[e]);if("utf8str"==e)return new u(t[e]);if("numstr"==e)return new c(t[e]);if("prnstr"==e)return new f(t[e]);if("telstr"==e)return new l(t[e]);if("ia5str"==e)return new p(t[e]);if("utctime"==e)return new g(t[e]);if("gentime"==e)return new d(t[e]);if("seq"==e){for(var T=t[e],S=[],E=0;E<T.length;E++){var w=b(T[E]);S.push(w)}return new m({array:S})}if("set"==e){for(T=t[e],S=[],E=0;E<T.length;E++){w=b(T[E]);S.push(w)}return new y({array:S})}if("tag"==e){i=t[e];if("[object Array]"===Object.prototype.toString.call(i)&&3==i.length)return r=b(i[2]),new v({tag:i[0],explicit:i[1],obj:r});n={};if(void 0!==i.explicit&&(n.explicit=i.explicit),void 0!==i.tag&&(n.tag=i.tag),void 0===i.obj)throw"obj shall be specified for 'tag'.";return n.obj=b(i.obj),new v(n)}},this.jsonToASN1HEX=function(t){return this.newObject(t).getEncodedHex()}},P.asn1.ASN1Util.oidHexToInt=function(t){for(var e="",i=parseInt(t.substr(0,2),16),e=Math.floor(i/40)+"."+i%40,r="",n=2;n<t.length;n+=2){var s=("00000000"+parseInt(t.substr(n,2),16).toString(2)).slice(-8);r+=s.substr(1,7),"0"==s.substr(0,1)&&(e=e+"."+new m(r,2).toString(10),r="")}return e},P.asn1.ASN1Util.oidIntToHex=function(t){var h=function(t){t=t.toString(16);return t=1==t.length?"0"+t:t};if(!t.match(/^[0-9.]+$/))throw"malformed oid string: "+t;var e="",i=t.split("."),t=40*parseInt(i[0])+parseInt(i[1]);e+=h(t),i.splice(0,2);for(var r=0;r<i.length;r++)e+=function(t){for(var e="",i=7-(s=new m(t,10).toString(2)).length%7,r=(7==i&&(i=0),""),n=0;n<i;n++)r+="0";for(var s=r+s,n=0;n<s.length-1;n+=7){var o=s.substr(n,7);n!=s.length-7&&(o="1"+o),e+=h(parseInt(o,2))}return e}(i[r]);return e},P.asn1.ASN1Object=function(){this.getLengthHexFromValue=function(){if(void 0===this.hV||null==this.hV)throw"this.hV is null or undefined.";if(this.hV.length%2==1)throw"value hex must be even length: n="+"".length+",v="+this.hV;var t=this.hV.length/2,e=t.toString(16);if(e.length%2==1&&(e="0"+e),t<128)return e;var i=e.length/2;if(15<i)throw"ASN.1 length too long to represent by 8x: n = "+t.toString(16);return(128+i).toString(16)+e},this.getEncodedHex=function(){return null!=this.hTLV&&!this.isModified||(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getValueHex=function(){return this.getEncodedHex(),this.hV},this.getFreshValueHex=function(){return""}},P.asn1.DERAbstractString=function(t){P.asn1.DERAbstractString.superclass.constructor.call(this);this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=stohex(this.s)},this.setStringHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&("string"==typeof t?this.setString(t):void 0!==t.str?this.setString(t.str):void 0!==t.hex&&this.setStringHex(t.hex))},N.lang.extend(P.asn1.DERAbstractString,P.asn1.ASN1Object),P.asn1.DERAbstractTime=function(t){P.asn1.DERAbstractTime.superclass.constructor.call(this);this.localDateToUTC=function(t){return utc=t.getTime()+6e4*t.getTimezoneOffset(),new Date(utc)},this.formatDate=function(t,e,i){var r=this.zeroPadding,t=this.localDateToUTC(t),n=String(t.getFullYear()),e=("utc"==e&&(n=n.substr(2,2)),r(String(t.getMonth()+1),2)),n=n+e+r(String(t.getDate()),2)+r(String(t.getHours()),2)+r(String(t.getMinutes()),2)+r(String(t.getSeconds()),2);return(n=!0===i&&0!=(e=t.getMilliseconds())?n+"."+r(String(e),3).replace(/[0]+$/,""):n)+"Z"},this.zeroPadding=function(t,e){return t.length>=e?t:new Array(e-t.length+1).join("0")+t},this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=stohex(t)},this.setByDateValue=function(t,e,i,r,n,s){t=new Date(Date.UTC(t,e-1,i,r,n,s,0));this.setByDate(t)},this.getFreshValueHex=function(){return this.hV}},N.lang.extend(P.asn1.DERAbstractTime,P.asn1.ASN1Object),P.asn1.DERAbstractStructured=function(t){P.asn1.DERAbstractString.superclass.constructor.call(this);this.setByASN1ObjectArray=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array=t},this.appendASN1Object=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array.push(t)},this.asn1Array=new Array,void 0!==t&&void 0!==t.array&&(this.asn1Array=t.array)},N.lang.extend(P.asn1.DERAbstractStructured,P.asn1.ASN1Object),P.asn1.DERBoolean=function(){P.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV="0101ff"},N.lang.extend(P.asn1.DERBoolean,P.asn1.ASN1Object),P.asn1.DERInteger=function(t){P.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=P.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){t=new m(String(t),10);this.setByBigInteger(t)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.bigint?this.setByBigInteger(t.bigint):void 0!==t.int?this.setByInteger(t.int):"number"==typeof t?this.setByInteger(t):void 0!==t.hex&&this.setValueHex(t.hex))},N.lang.extend(P.asn1.DERInteger,P.asn1.ASN1Object),P.asn1.DERBitString=function(t){var e;void 0!==t&&void 0!==t.obj&&(e=P.asn1.ASN1Util.newObject(t.obj),t.hex="00"+e.getEncodedHex()),P.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(t){this.hTLV=null,this.isModified=!0,this.hV=t},this.setUnusedBitsAndHexValue=function(t,e){if(t<0||7<t)throw"unused bits shall be from 0 to 7: u = "+t;t="0"+t;this.hTLV=null,this.isModified=!0,this.hV=t+e},this.setByBinaryString=function(t){var e=8-(t=t.replace(/0+$/,"")).length%8;8==e&&(e=0);for(var i=0;i<=e;i++)t+="0";for(var r="",i=0;i<t.length-1;i+=8){var n=t.substr(i,8),n=parseInt(n,2).toString(16);r+=n=1==n.length?"0"+n:n}this.hTLV=null,this.isModified=!0,this.hV="0"+e+r},this.setByBooleanArray=function(t){for(var e="",i=0;i<t.length;i++)1==t[i]?e+="1":e+="0";this.setByBinaryString(e)},this.newFalseArray=function(t){for(var e=new Array(t),i=0;i<t;i++)e[i]=!1;return e},this.getFreshValueHex=function(){return this.hV},void 0!==t&&("string"==typeof t&&t.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(t):void 0!==t.hex?this.setHexValueIncludingUnusedBits(t.hex):void 0!==t.bin?this.setByBinaryString(t.bin):void 0!==t.array&&this.setByBooleanArray(t.array))},N.lang.extend(P.asn1.DERBitString,P.asn1.ASN1Object),P.asn1.DEROctetString=function(t){var e;void 0!==t&&void 0!==t.obj&&(e=P.asn1.ASN1Util.newObject(t.obj),t.hex=e.getEncodedHex()),P.asn1.DEROctetString.superclass.constructor.call(this,t),this.hT="04"},N.lang.extend(P.asn1.DEROctetString,P.asn1.DERAbstractString),P.asn1.DERNull=function(){P.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"},N.lang.extend(P.asn1.DERNull,P.asn1.ASN1Object),P.asn1.DERObjectIdentifier=function(t){var h=function(t){t=t.toString(16);return t=1==t.length?"0"+t:t};P.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT="06",this.setValueHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.setValueOidString=function(t){if(!t.match(/^[0-9.]+$/))throw"malformed oid string: "+t;var e="",i=t.split("."),t=40*parseInt(i[0])+parseInt(i[1]);e+=h(t),i.splice(0,2);for(var r=0;r<i.length;r++)e+=function(t){for(var e="",i=7-(s=new m(t,10).toString(2)).length%7,r=(7==i&&(i=0),""),n=0;n<i;n++)r+="0";for(var s=r+s,n=0;n<s.length-1;n+=7){var o=s.substr(n,7);n!=s.length-7&&(o="1"+o),e+=h(parseInt(o,2))}return e}(i[r]);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.setValueName=function(t){var e=P.asn1.x509.OID.name2oid(t);if(""===e)throw"DERObjectIdentifier oidName undefined: "+t;this.setValueOidString(e)},this.getFreshValueHex=function(){return this.hV},void 0!==t&&("string"==typeof t?t.match(/^[0-2].[0-9.]+$/)?this.setValueOidString(t):this.setValueName(t):void 0!==t.oid?this.setValueOidString(t.oid):void 0!==t.hex?this.setValueHex(t.hex):void 0!==t.name&&this.setValueName(t.name))},N.lang.extend(P.asn1.DERObjectIdentifier,P.asn1.ASN1Object),P.asn1.DEREnumerated=function(t){P.asn1.DEREnumerated.superclass.constructor.call(this),this.hT="0a",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=P.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){t=new m(String(t),10);this.setByBigInteger(t)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.int?this.setByInteger(t.int):"number"==typeof t?this.setByInteger(t):void 0!==t.hex&&this.setValueHex(t.hex))},N.lang.extend(P.asn1.DEREnumerated,P.asn1.ASN1Object),P.asn1.DERUTF8String=function(t){P.asn1.DERUTF8String.superclass.constructor.call(this,t),this.hT="0c"},N.lang.extend(P.asn1.DERUTF8String,P.asn1.DERAbstractString),P.asn1.DERNumericString=function(t){P.asn1.DERNumericString.superclass.constructor.call(this,t),this.hT="12"},N.lang.extend(P.asn1.DERNumericString,P.asn1.DERAbstractString),P.asn1.DERPrintableString=function(t){P.asn1.DERPrintableString.superclass.constructor.call(this,t),this.hT="13"},N.lang.extend(P.asn1.DERPrintableString,P.asn1.DERAbstractString),P.asn1.DERTeletexString=function(t){P.asn1.DERTeletexString.superclass.constructor.call(this,t),this.hT="14"},N.lang.extend(P.asn1.DERTeletexString,P.asn1.DERAbstractString),P.asn1.DERIA5String=function(t){P.asn1.DERIA5String.superclass.constructor.call(this,t),this.hT="16"},N.lang.extend(P.asn1.DERIA5String,P.asn1.DERAbstractString),P.asn1.DERUTCTime=function(t){P.asn1.DERUTCTime.superclass.constructor.call(this,t),this.hT="17",this.setByDate=function(t){this.hTLV=null,this.isModified=!0,this.date=t,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return void 0===this.date&&void 0===this.s&&(this.date=new Date,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(this.s)),this.hV},void 0!==t&&(void 0!==t.str?this.setString(t.str):"string"==typeof t&&t.match(/^[0-9]{12}Z$/)?this.setString(t):void 0!==t.hex?this.setStringHex(t.hex):void 0!==t.date&&this.setByDate(t.date))},N.lang.extend(P.asn1.DERUTCTime,P.asn1.DERAbstractTime),P.asn1.DERGeneralizedTime=function(t){P.asn1.DERGeneralizedTime.superclass.constructor.call(this,t),this.hT="18",this.withMillis=!1,this.setByDate=function(t){this.hTLV=null,this.isModified=!0,this.date=t,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return void 0===this.date&&void 0===this.s&&(this.date=new Date,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)),this.hV},void 0!==t&&(void 0!==t.str?this.setString(t.str):"string"==typeof t&&t.match(/^[0-9]{14}Z$/)?this.setString(t):void 0!==t.hex?this.setStringHex(t.hex):void 0!==t.date&&this.setByDate(t.date),!0===t.millis)&&(this.withMillis=!0)},N.lang.extend(P.asn1.DERGeneralizedTime,P.asn1.DERAbstractTime),P.asn1.DERSequence=function(t){P.asn1.DERSequence.superclass.constructor.call(this,t),this.hT="30",this.getFreshValueHex=function(){for(var t="",e=0;e<this.asn1Array.length;e++)t+=this.asn1Array[e].getEncodedHex();return this.hV=t,this.hV}},N.lang.extend(P.asn1.DERSequence,P.asn1.DERAbstractStructured),P.asn1.DERSet=function(t){P.asn1.DERSet.superclass.constructor.call(this,t),this.hT="31",this.sortFlag=!0,this.getFreshValueHex=function(){for(var t=new Array,e=0;e<this.asn1Array.length;e++){var i=this.asn1Array[e];t.push(i.getEncodedHex())}return 1==this.sortFlag&&t.sort(),this.hV=t.join(""),this.hV},void 0!==t&&void 0!==t.sortflag&&0==t.sortflag&&(this.sortFlag=!1)},N.lang.extend(P.asn1.DERSet,P.asn1.DERAbstractStructured),P.asn1.DERTaggedObject=function(t){P.asn1.DERTaggedObject.superclass.constructor.call(this),this.hT="a0",this.hV="",this.isExplicit=!0,this.asn1Object=null,this.setASN1Object=function(t,e,i){this.hT=e,this.isExplicit=t,this.asn1Object=i,this.isExplicit?(this.hV=this.asn1Object.getEncodedHex(),this.hTLV=null,this.isModified=!0):(this.hV=null,this.hTLV=i.getEncodedHex(),this.hTLV=this.hTLV.replace(/^../,e),this.isModified=!1)},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.tag&&(this.hT=t.tag),void 0!==t.explicit&&(this.isExplicit=t.explicit),void 0!==t.obj)&&(this.asn1Object=t.obj,this.setASN1Object(this.isExplicit,this.hT,this.asn1Object))},N.lang.extend(P.asn1.DERTaggedObject,P.asn1.ASN1Object),ut=function(t,e){return(ut=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){t.__proto__=e}:function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}))(t,e)};(function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}ut(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)})(M,ct=S),M.prototype.parseKey=function(t){try{var e=0,i=0,r=/^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/.test(t)?F(t):U.unarmor(t),n=z.decode(r);if(9===(n=3===n.sub.length?n.sub[2].sub[0]:n).sub.length){e=n.sub[1].getHexStringValue(),this.n=T(e,16),i=n.sub[2].getHexStringValue(),this.e=parseInt(i,16);var s=n.sub[3].getHexStringValue(),o=(this.d=T(s,16),n.sub[4].getHexStringValue()),h=(this.p=T(o,16),n.sub[5].getHexStringValue()),a=(this.q=T(h,16),n.sub[6].getHexStringValue()),u=(this.dmp1=T(a,16),n.sub[7].getHexStringValue()),c=(this.dmq1=T(u,16),n.sub[8].getHexStringValue());this.coeff=T(c,16)}else{if(2!==n.sub.length)return!1;var f,i=(n.sub[0].sub?(e=(f=n.sub[1].sub[0]).sub[0].getHexStringValue(),this.n=T(e,16),f):(e=n.sub[0].getHexStringValue(),this.n=T(e,16),n)).sub[1].getHexStringValue();this.e=parseInt(i,16)}return!0}catch(t){return!1}},M.prototype.getPrivateBaseKey=function(){var t={array:[new P.asn1.DERInteger({int:0}),new P.asn1.DERInteger({bigint:this.n}),new P.asn1.DERInteger({int:this.e}),new P.asn1.DERInteger({bigint:this.d}),new P.asn1.DERInteger({bigint:this.p}),new P.asn1.DERInteger({bigint:this.q}),new P.asn1.DERInteger({bigint:this.dmp1}),new P.asn1.DERInteger({bigint:this.dmq1}),new P.asn1.DERInteger({bigint:this.coeff})]};return new P.asn1.DERSequence(t).getEncodedHex()},M.prototype.getPrivateBaseKeyB64=function(){return r(this.getPrivateBaseKey())},M.prototype.getPublicBaseKey=function(){var t=new P.asn1.DERSequence({array:[new P.asn1.DERObjectIdentifier({oid:"1.2.840.113549.1.1.1"}),new P.asn1.DERNull]}),e=new P.asn1.DERSequence({array:[new P.asn1.DERInteger({bigint:this.n}),new P.asn1.DERInteger({int:this.e})]}),e=new P.asn1.DERBitString({hex:"00"+e.getEncodedHex()});return new P.asn1.DERSequence({array:[t,e]}).getEncodedHex()},M.prototype.getPublicBaseKeyB64=function(){return r(this.getPublicBaseKey())},M.wordwrap=function(t,e){return e=e||64,t&&t.match(RegExp("(.{1,"+e+"})( +|$\n?)|(.{1,"+e+"})","g")).join("\n")},M.prototype.getPrivateKey=function(){var t="-----BEGIN RSA PRIVATE KEY-----\n";return t+(M.wordwrap(this.getPrivateBaseKeyB64())+"\n")+"-----END RSA PRIVATE KEY-----"},M.prototype.getPublicKey=function(){var t="-----BEGIN PUBLIC KEY-----\n";return t+(M.wordwrap(this.getPublicBaseKeyB64())+"\n")+"-----END PUBLIC KEY-----"},M.hasPublicKeyProperty=function(t){return(t=t||{}).hasOwnProperty("n")&&t.hasOwnProperty("e")},M.hasPrivateKeyProperty=function(t){return(t=t||{}).hasOwnProperty("n")&&t.hasOwnProperty("e")&&t.hasOwnProperty("d")&&t.hasOwnProperty("p")&&t.hasOwnProperty("q")&&t.hasOwnProperty("dmp1")&&t.hasOwnProperty("dmq1")&&t.hasOwnProperty("coeff")},M.prototype.parsePropertiesFrom=function(t){this.n=t.n,this.e=t.e,t.hasOwnProperty("d")&&(this.d=t.d,this.p=t.p,this.q=t.q,this.dmp1=t.dmp1,this.dmq1=t.dmq1,this.coeff=t.coeff)};var ut,ct,ft=M;function M(t){var e=ct.call(this)||this;return t&&("string"==typeof t?e.parseKey(t):(M.hasPrivateKeyProperty(t)||M.hasPublicKeyProperty(t))&&e.parsePropertiesFrom(t)),e}S="undefined"==typeof process||null==(N=process.env)?void 0:N.npm_package_version;function q(t){this.default_key_size=(t=(t=void 0===t?{}:t)||{}).default_key_size?parseInt(t.default_key_size,10):1024,this.default_public_exponent=t.default_public_exponent||"010001",this.log=t.log||!1,this.key=null}return q.prototype.setKey=function(t){this.log&&this.key&&console.warn("A key was already set, overriding existing."),this.key=new ft(t)},q.prototype.setPrivateKey=function(t){this.setKey(t)},q.prototype.setPublicKey=function(t){this.setKey(t)},q.prototype.decrypt=function(t){try{return this.getKey().decrypt(C(t))}catch(t){return!1}},q.prototype.encrypt=function(t){try{return r(this.getKey().encrypt(t))}catch(t){return!1}},q.prototype.sign=function(t,e,i){try{return r(this.getKey().sign(t,e,i))}catch(t){return!1}},q.prototype.verify=function(t,e,i){try{return this.getKey().verify(t,C(e),i)}catch(t){return!1}},q.prototype.getKey=function(t){if(!this.key){if(this.key=new ft,t&&"[object Function]"==={}.toString.call(t))return void this.key.generateAsync(this.default_key_size,this.default_public_exponent,t);this.key.generate(this.default_key_size,this.default_public_exponent)}return this.key},q.prototype.getPrivateKey=function(){return this.getKey().getPrivateKey()},q.prototype.getPrivateKeyB64=function(){return this.getKey().getPrivateBaseKeyB64()},q.prototype.getPublicKey=function(){return this.getKey().getPublicKey()},q.prototype.getPublicKeyB64=function(){return this.getKey().getPublicBaseKeyB64()},q.version=S,q}
//---SyncByPyScript---JSEncrypt-end

//---SyncByPyScript---w_md5-start
function hex_md5(r,n){function a(r,n){return r<<n|r>>>32-n}function i(r,n){var t=2147483648&r,e=2147483648&n,o=1073741824&r,u=1073741824&n,r=(1073741823&r)+(1073741823&n);return o&u?2147483648^r^t^e:o|u?1073741824&r?3221225472^r^t^e:1073741824^r^t^e:r^t^e}function t(r,n,t,e,o,u,f){return r=i(r,i(i(n&t|~n&e,o),f)),i(a(r,u),n)}function e(r,n,t,e,o,u,f){return r=i(r,i(i(n&e|t&~e,o),f)),i(a(r,u),n)}function o(r,n,t,e,o,u,f){return r=i(r,i(i(n^t^e,o),f)),i(a(r,u),n)}function u(r,n,t,e,o,u,f){return r=i(r,i(i(t^(n|~e),o),f)),i(a(r,u),n)}function f(r){for(var n="",t="",e=0;e<=3;e++)n+=(t="0"+(r>>>8*e&255).toString(16)).substr(t.length-2,2);return n}Array();for(var h,c,d,C,m=function(r){for(var n,t=r.length,e=16*(1+((e=t+8)-e%64)/64),o=Array(e-1),u=0,f=0;f<t;)u=f%4*8,o[n=(f-f%4)/4]=o[n]|r.charCodeAt(f)<<u,f++;return o[n=(f-f%4)/4]=o[n]|128<<(u=f%4*8),o[e-2]=t<<3,o[e-1]=t>>>29,o}(r=function(r){r=r.replace(/\r\n/g,"\n");for(var n="",t=0;t<r.length;t++){var e=r.charCodeAt(t);e<128?n+=String.fromCharCode(e):n=127<e&&e<2048?(n+=String.fromCharCode(e>>6|192))+String.fromCharCode(63&e|128):(n=(n+=String.fromCharCode(e>>12|224))+String.fromCharCode(e>>6&63|128))+String.fromCharCode(63&e|128)}return n}(r)),_=1732584193,g=4023233417,p=2562383102,x=271733878,v=0;v<m.length;v+=16)_=t(h=_,c=g,d=p,C=x,m[v+0],7,3614090360),x=t(x,_,g,p,m[v+1],12,3905402710),p=t(p,x,_,g,m[v+2],17,606105819),g=t(g,p,x,_,m[v+3],22,3250441966),_=t(_,g,p,x,m[v+4],7,4118548399),x=t(x,_,g,p,m[v+5],12,1200080426),p=t(p,x,_,g,m[v+6],17,2821735955),g=t(g,p,x,_,m[v+7],22,4249261313),_=t(_,g,p,x,m[v+8],7,1770035416),x=t(x,_,g,p,m[v+9],12,2336552879),p=t(p,x,_,g,m[v+10],17,4294925233),g=t(g,p,x,_,m[v+11],22,2304563134),_=t(_,g,p,x,m[v+12],7,1804603682),x=t(x,_,g,p,m[v+13],12,4254626195),p=t(p,x,_,g,m[v+14],17,2792965006),_=e(_,g=t(g,p,x,_,m[v+15],22,1236535329),p,x,m[v+1],5,4129170786),x=e(x,_,g,p,m[v+6],9,3225465664),p=e(p,x,_,g,m[v+11],14,643717713),g=e(g,p,x,_,m[v+0],20,3921069994),_=e(_,g,p,x,m[v+5],5,3593408605),x=e(x,_,g,p,m[v+10],9,38016083),p=e(p,x,_,g,m[v+15],14,3634488961),g=e(g,p,x,_,m[v+4],20,3889429448),_=e(_,g,p,x,m[v+9],5,568446438),x=e(x,_,g,p,m[v+14],9,3275163606),p=e(p,x,_,g,m[v+3],14,4107603335),g=e(g,p,x,_,m[v+8],20,1163531501),_=e(_,g,p,x,m[v+13],5,2850285829),x=e(x,_,g,p,m[v+2],9,4243563512),p=e(p,x,_,g,m[v+7],14,1735328473),_=o(_,g=e(g,p,x,_,m[v+12],20,2368359562),p,x,m[v+5],4,4294588738),x=o(x,_,g,p,m[v+8],11,2272392833),p=o(p,x,_,g,m[v+11],16,1839030562),g=o(g,p,x,_,m[v+14],23,4259657740),_=o(_,g,p,x,m[v+1],4,2763975236),x=o(x,_,g,p,m[v+4],11,1272893353),p=o(p,x,_,g,m[v+7],16,4139469664),g=o(g,p,x,_,m[v+10],23,3200236656),_=o(_,g,p,x,m[v+13],4,681279174),x=o(x,_,g,p,m[v+0],11,3936430074),p=o(p,x,_,g,m[v+3],16,3572445317),g=o(g,p,x,_,m[v+6],23,76029189),_=o(_,g,p,x,m[v+9],4,3654602809),x=o(x,_,g,p,m[v+12],11,3873151461),p=o(p,x,_,g,m[v+15],16,530742520),_=u(_,g=o(g,p,x,_,m[v+2],23,3299628645),p,x,m[v+0],6,4096336452),x=u(x,_,g,p,m[v+7],10,1126891415),p=u(p,x,_,g,m[v+14],15,2878612391),g=u(g,p,x,_,m[v+5],21,4237533241),_=u(_,g,p,x,m[v+12],6,1700485571),x=u(x,_,g,p,m[v+3],10,2399980690),p=u(p,x,_,g,m[v+10],15,4293915773),g=u(g,p,x,_,m[v+1],21,2240044497),_=u(_,g,p,x,m[v+8],6,1873313359),x=u(x,_,g,p,m[v+15],10,4264355552),p=u(p,x,_,g,m[v+6],15,2734768916),g=u(g,p,x,_,m[v+13],21,1309151649),_=u(_,g,p,x,m[v+4],6,4149444226),x=u(x,_,g,p,m[v+11],10,3174756917),p=u(p,x,_,g,m[v+2],15,718787259),g=u(g,p,x,_,m[v+9],21,3951481745),_=i(_,h),g=i(g,c),p=i(p,d),x=i(x,C);return(32==n?f(_)+f(g)+f(p)+f(x):f(g)+f(p)).toLowerCase()}function createWMd5(){var r={hex_md5_16:function(r){return hex_md5(r,16)},hex_md5_16Upper:function(r){return hex_md5(r,16).toUpperCase()},hex_md5_32:function(r){return hex_md5(r,32)},hex_md5_32Upper:function(r){return hex_md5(r,32).toUpperCase()}};return r}
//---SyncByPyScript---w_md5-end

//---SyncByPyScript---CryptoJS-start
function createCryptoJS(){var r=Object.getOwnPropertyNames,u=(e=>"undefined"!=typeof require?require:"undefined"!=typeof Proxy?new Proxy(e,{get:(e,t)=>("undefined"!=typeof require?require:e)[t]}):e)(function(e){if("undefined"!=typeof require)return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')}),e=(e,t)=>function(){return t||(0,e[r(e)[0]])((t={exports:{}}).exports,t),t.exports},y=e({"(disabled):crypto"(){}}),n=e({"core.js"(e,t){var r,i;i=function(){var i,f=Math;if("undefined"!=typeof window&&window.crypto&&(i=window.crypto),"undefined"!=typeof self&&self.crypto&&(i=self.crypto),!(i=!(i=!(i="undefined"!=typeof globalThis&&globalThis.crypto?globalThis.crypto:i)&&"undefined"!=typeof window&&window.msCrypto?window.msCrypto:i)&&"undefined"!=typeof global&&global.crypto?global.crypto:i)&&"function"==typeof u)try{i=y()}catch(e){}var r=Object.create||function(e){return t.prototype=e,e=new t,t.prototype=null,e};function t(){}var e={},n=e.lib={},o=n.Base={extend:function(e){var t=r(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),(t.init.prototype=t).$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},h=n.WordArray=o.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||s).stringify(this)},concat:function(e){var t=this.words,r=e.words,i=this.sigBytes,n=e.sigBytes;if(this.clamp(),i%4)for(var o=0;o<n;o++){var c=r[o>>>2]>>>24-o%4*8&255;t[i+o>>>2]|=c<<24-(i+o)%4*8}else for(var s=0;s<n;s+=4)t[i+s>>>2]=r[s>>>2];return this.sigBytes+=n,this},clamp:function(){var e=this.words,t=this.sigBytes;e[t>>>2]&=4294967295<<32-t%4*8,e.length=f.ceil(t/4)},clone:function(){var e=o.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r<e;r+=4)t.push(function(){if(i){if("function"==typeof i.getRandomValues)try{return i.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof i.randomBytes)try{return i.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")}());return new h.init(t,e)}}),c=e.enc={},s=c.Hex={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],n=0;n<r;n++){var o=t[n>>>2]>>>24-n%4*8&255;i.push((o>>>4).toString(16)),i.push((15&o).toString(16))}return i.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i<t;i+=2)r[i>>>3]|=parseInt(e.substr(i,2),16)<<24-i%8*4;return new h.init(r,t/2)}},a=c.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],n=0;n<r;n++){var o=t[n>>>2]>>>24-n%4*8&255;i.push(String.fromCharCode(o))}return i.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i<t;i++)r[i>>>2]|=(255&e.charCodeAt(i))<<24-i%4*8;return new h.init(r,t)}},d=c.Utf8={stringify:function(e){try{return decodeURIComponent(escape(a.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return a.parse(unescape(encodeURIComponent(e)))}},p=n.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new h.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=d.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(e){var t,r=this._data,i=r.words,n=r.sigBytes,o=this.blockSize,c=n/(4*o),s=(c=e?f.ceil(c):f.max((0|c)-this._minBufferSize,0))*o,e=f.min(4*s,n);if(s){for(var a=0;a<s;a+=o)this._doProcessBlock(i,a);t=i.splice(0,s),r.sigBytes-=e}return new h.init(t,e)},clone:function(){var e=o.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),l=(n.Hasher=p.extend({cfg:o.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){p.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(r){return function(e,t){return new r.init(t).finalize(e)}},_createHmacHelper:function(r){return function(e,t){return new l.HMAC.init(r,t).finalize(e)}}}),e.algo={});return e},"object"==typeof(r=e)?t.exports=e=i():"function"==typeof define&&define.amd?define([],i):r.CryptoJS=i()}}),o=e({"x64-core.js"(e,t){var r,i;i=function(e){var t,n,o;return t=e.lib,n=t.Base,o=t.WordArray,(t=e.x64={}).Word=n.extend({init:function(e,t){this.high=e,this.low=t}}),t.WordArray=n.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:8*e.length},toX32:function(){for(var e=this.words,t=e.length,r=[],i=0;i<t;i++){var n=e[i];r.push(n.high),r.push(n.low)}return o.create(r,this.sigBytes)},clone:function(){for(var e=n.clone.call(this),t=e.words=this.words.slice(0),r=t.length,i=0;i<r;i++)t[i]=t[i].clone();return e}}),e},"object"==typeof(r=e)?t.exports=e=i(n()):"function"==typeof define&&define.amd?define(["./core"],i):i(r.CryptoJS)}}),c=e({"lib-typedarrays.js"(e,t){var r,i;i=function(e){var t,n;return"function"==typeof ArrayBuffer&&(t=e.lib.WordArray,n=t.init,(t.init=function(e){if((e=(e=e instanceof ArrayBuffer?new Uint8Array(e):e)instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e)instanceof Uint8Array){for(var t=e.byteLength,r=[],i=0;i<t;i++)r[i>>>2]|=e[i]<<24-i%4*8;n.call(this,r,t)}else n.apply(this,arguments)}).prototype=t),e.lib.WordArray},"object"==typeof(r=e)?t.exports=e=i(n()):"function"==typeof define&&define.amd?define(["./core"],i):i(r.CryptoJS)}}),s=e({"enc-utf16.js"(e,t){var r,i;i=function(e){var n=e.lib.WordArray,t=e.enc;function c(e){return e<<8&4278255360|e>>>8&16711935}return t.Utf16=t.Utf16BE={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],n=0;n<r;n+=2){var o=t[n>>>2]>>>16-n%4*8&65535;i.push(String.fromCharCode(o))}return i.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i<t;i++)r[i>>>1]|=e.charCodeAt(i)<<16-i%2*16;return n.create(r,2*t)}},t.Utf16LE={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],n=0;n<r;n+=2){var o=c(t[n>>>2]>>>16-n%4*8&65535);i.push(String.fromCharCode(o))}return i.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i<t;i++)r[i>>>1]|=c(e.charCodeAt(i)<<16-i%2*16);return n.create(r,2*t)}},e.enc.Utf16},"object"==typeof(r=e)?t.exports=e=i(n()):"function"==typeof define&&define.amd?define(["./core"],i):i(r.CryptoJS)}}),a=e({"enc-base64.js"(e,t){var r,i;i=function(e){var u;return u=e.lib.WordArray,e.enc.Base64={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=this._map,n=(e.clamp(),[]),o=0;o<r;o+=3)for(var c=(t[o>>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,s=0;s<4&&o+.75*s<r;s++)n.push(i.charAt(c>>>6*(3-s)&63));var a=i.charAt(64);if(a)for(;n.length%4;)n.push(a);return n.join("")},parse:function(e){var t=e.length,r=this._map;if(!(i=this._reverseMap))for(var i=this._reverseMap=[],n=0;n<r.length;n++)i[r.charCodeAt(n)]=n;for(var o,c,s=r.charAt(64),a=(s&&-1!==(s=e.indexOf(s))&&(t=s),e),f=t,h=i,d=[],p=0,l=0;l<f;l++)l%4&&(o=h[a.charCodeAt(l-1)]<<l%4*2,c=h[a.charCodeAt(l)]>>>6-l%4*2,d[p>>>2]|=(o|c)<<24-p%4*8,p++);return u.create(d,p)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},e.enc.Base64},"object"==typeof(r=e)?t.exports=e=i(n()):"function"==typeof define&&define.amd?define(["./core"],i):i(r.CryptoJS)}}),f=e({"enc-base64url.js"(e,t){var r,i;i=function(e){var u;return u=e.lib.WordArray,e.enc.Base64url={stringify:function(e,t=!0){for(var r=e.words,i=e.sigBytes,n=t?this._safe_map:this._map,o=(e.clamp(),[]),c=0;c<i;c+=3)for(var s=(r[c>>>2]>>>24-c%4*8&255)<<16|(r[c+1>>>2]>>>24-(c+1)%4*8&255)<<8|r[c+2>>>2]>>>24-(c+2)%4*8&255,a=0;a<4&&c+.75*a<i;a++)o.push(n.charAt(s>>>6*(3-a)&63));var f=n.charAt(64);if(f)for(;o.length%4;)o.push(f);return o.join("")},parse:function(e,t=!0){var r=e.length,i=t?this._safe_map:this._map;if(!(n=this._reverseMap))for(var n=this._reverseMap=[],o=0;o<i.length;o++)n[i.charCodeAt(o)]=o;for(var c,s,t=i.charAt(64),a=(t&&-1!==(t=e.indexOf(t))&&(r=t),e),f=r,h=n,d=[],p=0,l=0;l<f;l++)l%4&&(c=h[a.charCodeAt(l-1)]<<l%4*2,s=h[a.charCodeAt(l)]>>>6-l%4*2,d[p>>>2]|=(c|s)<<24-p%4*8,p++);return u.create(d,p)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"},e.enc.Base64url},"object"==typeof(r=e)?t.exports=e=i(n()):"function"==typeof define&&define.amd?define(["./core"],i):i(r.CryptoJS)}}),h=e({"md5.js"(e,t){var r,i;i=function(e){for(var a=Math,t=e,r=(n=t.lib).WordArray,i=n.Hasher,n=t.algo,C=[],o=0;o<64;o++)C[o]=4294967296*a.abs(a.sin(o+1))|0;function A(e,t,r,i,n,o,c){e=e+(t&r|~t&i)+n+c;return(e<<o|e>>>32-o)+t}function H(e,t,r,i,n,o,c){e=e+(t&i|r&~i)+n+c;return(e<<o|e>>>32-o)+t}function j(e,t,r,i,n,o,c){e=e+(t^r^i)+n+c;return(e<<o|e>>>32-o)+t}function z(e,t,r,i,n,o,c){e=e+(r^(t|~i))+n+c;return(e<<o|e>>>32-o)+t}return n=n.MD5=i.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var i=t+r,n=e[i];e[i]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8)}var o=this._hash.words,c=e[t+0],s=e[t+1],a=e[t+2],f=e[t+3],h=e[t+4],d=e[t+5],p=e[t+6],l=e[t+7],u=e[t+8],y=e[t+9],_=e[t+10],v=e[t+11],g=e[t+12],B=e[t+13],m=e[t+14],w=e[t+15],b=A(o[0],x=o[1],S=o[2],k=o[3],c,7,C[0]),k=A(k,b,x,S,s,12,C[1]),S=A(S,k,b,x,a,17,C[2]),x=A(x,S,k,b,f,22,C[3]);b=A(b,x,S,k,h,7,C[4]),k=A(k,b,x,S,d,12,C[5]),S=A(S,k,b,x,p,17,C[6]),x=A(x,S,k,b,l,22,C[7]),b=A(b,x,S,k,u,7,C[8]),k=A(k,b,x,S,y,12,C[9]),S=A(S,k,b,x,_,17,C[10]),x=A(x,S,k,b,v,22,C[11]),b=A(b,x,S,k,g,7,C[12]),k=A(k,b,x,S,B,12,C[13]),S=A(S,k,b,x,m,17,C[14]),b=H(b,x=A(x,S,k,b,w,22,C[15]),S,k,s,5,C[16]),k=H(k,b,x,S,p,9,C[17]),S=H(S,k,b,x,v,14,C[18]),x=H(x,S,k,b,c,20,C[19]),b=H(b,x,S,k,d,5,C[20]),k=H(k,b,x,S,_,9,C[21]),S=H(S,k,b,x,w,14,C[22]),x=H(x,S,k,b,h,20,C[23]),b=H(b,x,S,k,y,5,C[24]),k=H(k,b,x,S,m,9,C[25]),S=H(S,k,b,x,f,14,C[26]),x=H(x,S,k,b,u,20,C[27]),b=H(b,x,S,k,B,5,C[28]),k=H(k,b,x,S,a,9,C[29]),S=H(S,k,b,x,l,14,C[30]),b=j(b,x=H(x,S,k,b,g,20,C[31]),S,k,d,4,C[32]),k=j(k,b,x,S,u,11,C[33]),S=j(S,k,b,x,v,16,C[34]),x=j(x,S,k,b,m,23,C[35]),b=j(b,x,S,k,s,4,C[36]),k=j(k,b,x,S,h,11,C[37]),S=j(S,k,b,x,l,16,C[38]),x=j(x,S,k,b,_,23,C[39]),b=j(b,x,S,k,B,4,C[40]),k=j(k,b,x,S,c,11,C[41]),S=j(S,k,b,x,f,16,C[42]),x=j(x,S,k,b,p,23,C[43]),b=j(b,x,S,k,y,4,C[44]),k=j(k,b,x,S,g,11,C[45]),S=j(S,k,b,x,w,16,C[46]),b=z(b,x=j(x,S,k,b,a,23,C[47]),S,k,c,6,C[48]),k=z(k,b,x,S,l,10,C[49]),S=z(S,k,b,x,m,15,C[50]),x=z(x,S,k,b,d,21,C[51]),b=z(b,x,S,k,g,6,C[52]),k=z(k,b,x,S,f,10,C[53]),S=z(S,k,b,x,_,15,C[54]),x=z(x,S,k,b,s,21,C[55]),b=z(b,x,S,k,u,6,C[56]),k=z(k,b,x,S,w,10,C[57]),S=z(S,k,b,x,p,15,C[58]),x=z(x,S,k,b,B,21,C[59]),b=z(b,x,S,k,h,6,C[60]),k=z(k,b,x,S,v,10,C[61]),S=z(S,k,b,x,a,15,C[62]),x=z(x,S,k,b,y,21,C[63]),o[0]=o[0]+b|0,o[1]=o[1]+x|0,o[2]=o[2]+S|0,o[3]=o[3]+k|0},_doFinalize:function(){for(var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes,n=(t[i>>>5]|=128<<24-i%32,a.floor(r/4294967296)),n=(t[15+(64+i>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),t[14+(64+i>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),e.sigBytes=4*(t.length+1),this._process(),this._hash),o=n.words,c=0;c<4;c++){var s=o[c];o[c]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8)}return n},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}}),t.MD5=i._createHelper(n),t.HmacMD5=i._createHmacHelper(n),e.MD5},"object"==typeof(r=e)?t.exports=e=i(n()):"function"==typeof define&&define.amd?define(["./core"],i):i(r.CryptoJS)}}),d=e({"sha1.js"(e,t){var r,i;i=function(e){var t,r,i,n,h;return r=(t=e).lib,i=r.WordArray,n=r.Hasher,r=t.algo,h=[],r=r.SHA1=n.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],o=r[2],c=r[3],s=r[4],a=0;a<80;a++){h[a]=a<16?0|e[t+a]:(f=h[a-3]^h[a-8]^h[a-14]^h[a-16])<<1|f>>>31;var f=(i<<5|i>>>27)+s+h[a];f+=a<20?1518500249+(n&o|~n&c):a<40?1859775393+(n^o^c):a<60?(n&o|n&c|o&c)-1894007588:(n^o^c)-899497514,s=c,c=o,o=n<<30|n>>>2,n=i,i=f}r[0]=r[0]+i|0,r[1]=r[1]+n|0,r[2]=r[2]+o|0,r[3]=r[3]+c|0,r[4]=r[4]+s|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[14+(64+i>>>9<<4)]=Math.floor(r/4294967296),t[15+(64+i>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}}),t.SHA1=n._createHelper(r),t.HmacSHA1=n._createHmacHelper(r),e.SHA1},"object"==typeof(r=e)?t.exports=e=i(n()):"function"==typeof define&&define.amd?define(["./core"],i):i(r.CryptoJS)}}),p=e({"sha256.js"(e,t){var r,i;i=function(e){var n=Math,t=e,r=(o=t.lib).WordArray,i=o.Hasher,o=t.algo,c=[],u=[];function s(e){return 4294967296*(e-(0|e))|0}for(var a=2,f=0;f<64;)!function(e){for(var t=n.sqrt(e),r=2;r<=t;r++)if(!(e%r))return;return 1}(a)||(f<8&&(c[f]=s(n.pow(a,.5))),u[f]=s(n.pow(a,1/3)),f++),a++;var y=[],o=o.SHA256=i.extend({_doReset:function(){this._hash=new r.init(c.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],o=r[2],c=r[3],s=r[4],a=r[5],f=r[6],h=r[7],d=0;d<64;d++){y[d]=d<16?0|e[t+d]:(((p=y[d-15])<<25|p>>>7)^(p<<14|p>>>18)^p>>>3)+y[d-7]+(((p=y[d-2])<<15|p>>>17)^(p<<13|p>>>19)^p>>>10)+y[d-16];var p=i&n^i&o^n&o,l=h+((s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25))+(s&a^~s&f)+u[d]+y[d],h=f,f=a,a=s,s=c+l|0,c=o,o=n,n=i,i=l+(((i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22))+p)|0}r[0]=r[0]+i|0,r[1]=r[1]+n|0,r[2]=r[2]+o|0,r[3]=r[3]+c|0,r[4]=r[4]+s|0,r[5]=r[5]+a|0,r[6]=r[6]+f|0,r[7]=r[7]+h|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[14+(64+i>>>9<<4)]=n.floor(r/4294967296),t[15+(64+i>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});return t.SHA256=i._createHelper(o),t.HmacSHA256=i._createHmacHelper(o),e.SHA256},"object"==typeof(r=e)?t.exports=e=i(n()):"function"==typeof define&&define.amd?define(["./core"],i):i(r.CryptoJS)}}),l=e({"sha224.js"(e,t){var r,i;i=function(e){var t,r,i,n;return r=(t=e).lib.WordArray,i=t.algo,n=i.SHA256,i=i.SHA224=n.extend({_doReset:function(){this._hash=new r.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=n._doFinalize.call(this);return e.sigBytes-=4,e}}),t.SHA224=n._createHelper(i),t.HmacSHA224=n._createHmacHelper(i),e.SHA224},"object"==typeof(r=e)?t.exports=e=i(n(),p()):"function"==typeof define&&define.amd?define(["./core","./sha256"],i):i(r.CryptoJS)}}),_=e({"sha512.js"(e,t){var r,i;i=function(e){var t=e,r=t.lib.Hasher,i=(o=t.x64).Word,n=o.WordArray,o=t.algo;function c(){return i.create.apply(i,arguments)}for(var t1=[c(1116352408,3609767458),c(1899447441,602891725),c(3049323471,3964484399),c(3921009573,2173295548),c(961987163,4081628472),c(1508970993,3053834265),c(2453635748,2937671579),c(2870763221,3664609560),c(3624381080,2734883394),c(310598401,1164996542),c(607225278,1323610764),c(1426881987,3590304994),c(1925078388,4068182383),c(2162078206,991336113),c(2614888103,633803317),c(3248222580,3479774868),c(3835390401,2666613458),c(4022224774,944711139),c(264347078,2341262773),c(604807628,2007800933),c(770255983,1495990901),c(1249150122,1856431235),c(1555081692,3175218132),c(1996064986,2198950837),c(2554220882,3999719339),c(2821834349,766784016),c(2952996808,2566594879),c(3210313671,3203337956),c(3336571891,1034457026),c(3584528711,2466948901),c(113926993,3758326383),c(338241895,168717936),c(666307205,1188179964),c(773529912,1546045734),c(1294757372,1522805485),c(1396182291,2643833823),c(1695183700,2343527390),c(1986661051,1014477480),c(2177026350,1206759142),c(2456956037,344077627),c(2730485921,1290863460),c(2820302411,3158454273),c(3259730800,3505952657),c(3345764771,106217008),c(3516065817,3606008344),c(3600352804,1432725776),c(4094571909,1467031594),c(275423344,851169720),c(430227734,3100823752),c(506948616,1363258195),c(659060556,3750685593),c(883997877,3785050280),c(958139571,3318307427),c(1322822218,3812723403),c(1537002063,2003034995),c(1747873779,3602036899),c(1955562222,1575990012),c(2024104815,1125592928),c(2227730452,2716904306),c(2361852424,442776044),c(2428436474,593698344),c(2756734187,3733110249),c(3204031479,2999351573),c(3329325298,3815920427),c(3391569614,3928383900),c(3515267271,566280711),c(3940187606,3454069534),c(4118630271,4000239992),c(116418474,1914138554),c(174292421,2731055270),c(289380356,3203993006),c(460393269,320620315),c(685471733,587496836),c(852142971,1086792851),c(1017036298,365543100),c(1126000580,2618297676),c(1288033470,3409855158),c(1501505948,4234509866),c(1607167915,987167468),c(1816402316,1246189591)],r1=[],s=0;s<80;s++)r1[s]=c();return o=o.SHA512=r.extend({_doReset:function(){this._hash=new n.init([new i.init(1779033703,4089235720),new i.init(3144134277,2227873595),new i.init(1013904242,4271175723),new i.init(2773480762,1595750129),new i.init(1359893119,2917565137),new i.init(2600822924,725511199),new i.init(528734635,4215389547),new i.init(1541459225,327033209)])},_doProcessBlock:function(P,F){for(var e=this._hash.words,t=e[0],r=e[1],i=e[2],n=e[3],o=e[4],c=e[5],s=e[6],e=e[7],W=t.high,a=t.low,O=r.high,f=r.low,I=i.high,h=i.low,U=n.high,d=n.low,K=o.high,p=o.low,X=c.high,l=c.low,L=s.high,u=s.low,T=e.high,y=e.low,_=W,v=a,g=O,B=f,m=I,w=h,q=U,b=d,k=K,S=p,N=X,x=l,Z=L,G=u,V=T,Q=y,C=0;C<80;C++)var A,H,j=r1[C],z=(C<16?(H=j.high=0|P[F+2*C],A=j.low=0|P[F+2*C+1]):(J=(M=r1[C-15]).high,M=M.low,R=(E=r1[C-2]).high,E=E.low,D=(z=r1[C-7]).high,z=z.low,$=(Y=r1[C-16]).high,H=(H=((J>>>1|M<<31)^(J>>>8|M<<24)^J>>>7)+D+((A=(D=(M>>>1|J<<31)^(M>>>8|J<<24)^(M>>>7|J<<25))+z)>>>0<D>>>0?1:0))+((R>>>19|E<<13)^(R<<3|E>>>29)^R>>>6)+((A+=M=(E>>>19|R<<13)^(E<<3|R>>>29)^(E>>>6|R<<26))>>>0<M>>>0?1:0),A+=J=Y.low,j.high=H=H+$+(A>>>0<J>>>0?1:0),j.low=A),k&N^~k&Z),D=S&x^~S&G,E=_&g^_&m^g&m,R=(v>>>28|_<<4)^(v<<30|_>>>2)^(v<<25|_>>>7),M=t1[C],Y=M.high,$=M.low,J=Q+((S>>>14|k<<18)^(S>>>18|k<<14)^(S<<23|k>>>9)),j=V+((k>>>14|S<<18)^(k>>>18|S<<14)^(k<<23|S>>>9))+(J>>>0<Q>>>0?1:0),e1=R+(v&B^v&w^B&w),V=Z,Q=G,Z=N,G=x,N=k,x=S,k=q+(j=j+z+((J=J+D)>>>0<D>>>0?1:0)+Y+((J=J+$)>>>0<$>>>0?1:0)+H+((J=J+A)>>>0<A>>>0?1:0))+((S=b+J|0)>>>0<b>>>0?1:0)|0,q=m,b=w,m=g,w=B,g=_,B=v,_=j+(((_>>>28|v<<4)^(_<<30|v>>>2)^(_<<25|v>>>7))+E+(e1>>>0<R>>>0?1:0))+((v=J+e1|0)>>>0<J>>>0?1:0)|0;a=t.low=a+v,t.high=W+_+(a>>>0<v>>>0?1:0),f=r.low=f+B,r.high=O+g+(f>>>0<B>>>0?1:0),h=i.low=h+w,i.high=I+m+(h>>>0<w>>>0?1:0),d=n.low=d+b,n.high=U+q+(d>>>0<b>>>0?1:0),p=o.low=p+S,o.high=K+k+(p>>>0<S>>>0?1:0),l=c.low=l+x,c.high=X+N+(l>>>0<x>>>0?1:0),u=s.low=u+G,s.high=L+Z+(u>>>0<G>>>0?1:0),y=e.low=y+Q,e.high=T+V+(y>>>0<Q>>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[30+(128+i>>>10<<5)]=Math.floor(r/4294967296),t[31+(128+i>>>10<<5)]=r,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=r.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32}),t.SHA512=r._createHelper(o),t.HmacSHA512=r._createHmacHelper(o),e.SHA512},"object"==typeof(r=e)?t.exports=e=i(n(),o()):"function"==typeof define&&define.amd?define(["./core","./x64-core"],i):i(r.CryptoJS)}}),v=e({"sha384.js"(e,t){var r,i;i=function(e){var t,r,i,n,o;return r=(t=e).x64,i=r.Word,n=r.WordArray,r=t.algo,o=r.SHA512,r=r.SHA384=o.extend({_doReset:function(){this._hash=new n.init([new i.init(3418070365,3238371032),new i.init(1654270250,914150663),new i.init(2438529370,812702999),new i.init(355462360,4144912697),new i.init(1731405415,4290775857),new i.init(2394180231,1750603025),new i.init(3675008525,1694076839),new i.init(1203062813,3204075428)])},_doFinalize:function(){var e=o._doFinalize.call(this);return e.sigBytes-=16,e}}),t.SHA384=o._createHelper(r),t.HmacSHA384=o._createHmacHelper(r),e.SHA384},"object"==typeof(r=e)?t.exports=e=i(n(),o(),_()):"function"==typeof define&&define.amd?define(["./core","./x64-core","./sha512"],i):i(r.CryptoJS)}}),g=e({"sha3.js"(e,t){var r,i;i=function(e){for(var h=Math,t=e,d=(n=t.lib).WordArray,i=n.Hasher,r=t.x64.Word,n=t.algo,C=[],A=[],H=[],o=1,c=0,s=0;s<24;s++){C[o+5*c]=(s+1)*(s+2)/2%64;var a=(2*o+3*c)%5;o=c%5,c=a}for(o=0;o<5;o++)for(c=0;c<5;c++)A[o+5*c]=c+(2*o+3*c)%5*5;for(var f=1,p=0;p<24;p++){for(var l,u=0,y=0,_=0;_<7;_++)1&f&&((l=(1<<_)-1)<32?y^=1<<l:u^=1<<l-32),128&f?f=f<<1^113:f<<=1;H[p]=r.create(u,y)}for(var j=[],v=0;v<25;v++)j[v]=r.create();return n=n.SHA3=i.extend({cfg:i.cfg.extend({outputLength:512}),_doReset:function(){for(var e=this._state=[],t=0;t<25;t++)e[t]=new r.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(e,t){for(var r=this._state,i=this.blockSize/2,n=0;n<i;n++){var o=e[t+2*n],c=e[t+2*n+1],o=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8);(b=r[n]).high^=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8),b.low^=o}for(var s=0;s<24;s++){for(var a=0;a<5;a++){for(var f=0,h=0,d=0;d<5;d++)f^=(b=r[a+5*d]).high,h^=b.low;var p=j[a];p.high=f,p.low=h}for(a=0;a<5;a++)for(var l=j[(a+4)%5],u=j[(a+1)%5],y=u.high,u=u.low,f=l.high^(y<<1|u>>>31),h=l.low^(u<<1|y>>>31),d=0;d<5;d++)(b=r[a+5*d]).high^=f,b.low^=h;for(var _=1;_<25;_++){var v=(b=r[_]).high,g=b.low,B=C[_],v=(h=B<32?(f=v<<B|g>>>32-B,g<<B|v>>>32-B):(f=g<<B-32|v>>>64-B,v<<B-32|g>>>64-B),j[A[_]]);v.high=f,v.low=h}var m=j[0],w=r[0];m.high=w.high,m.low=w.low;for(a=0;a<5;a++)for(d=0;d<5;d++){var b=r[_=a+5*d],k=j[_],S=j[(a+1)%5+5*d],x=j[(a+2)%5+5*d];b.high=k.high^~S.high&x.high,b.low=k.low^~S.low&x.low}b=r[0],m=H[s];b.high^=m.high,b.low^=m.low}},_doFinalize:function(){for(var e=this._data,t=e.words,r=(this._nDataBytes,8*e.sigBytes),i=32*this.blockSize,n=(t[r>>>5]|=1<<24-r%32,t[(h.ceil((1+r)/i)*i>>>5)-1]|=128,e.sigBytes=4*t.length,this._process(),this._state),r=this.cfg.outputLength/8,o=r/8,c=[],s=0;s<o;s++){var a=n[s],f=a.high,a=a.low,f=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8);c.push(16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8)),c.push(f)}return new d.init(c,r)},clone:function(){for(var e=i.clone.call(this),t=e._state=this._state.slice(0),r=0;r<25;r++)t[r]=t[r].clone();return e}}),t.SHA3=i._createHelper(n),t.HmacSHA3=i._createHmacHelper(n),e.SHA3},"object"==typeof(r=e)?t.exports=e=i(n(),o()):"function"==typeof define&&define.amd?define(["./core","./x64-core"],i):i(r.CryptoJS)}}),B=e({"ripemd160.js"(e,t){var r,i;i=function(e){function k(e,t,r){return e&t|~e&r}function S(e,t,r){return e&r|t&~r}function x(e,t){return e<<t|e>>>32-t}var t,r,i,n,C,A,H,j,z,D;return Math,r=(t=e).lib,i=r.WordArray,n=r.Hasher,r=t.algo,C=i.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),A=i.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),H=i.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),j=i.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),z=i.create([0,1518500249,1859775393,2400959708,2840853838]),D=i.create([1352829926,1548603684,1836072691,2053994217,0]),r=r.RIPEMD160=n.extend({_doReset:function(){this._hash=i.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var i=t+r,n=e[i];e[i]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8)}for(var o,c,s,a,f,h,d=this._hash.words,p=z.words,l=D.words,u=C.words,y=A.words,_=H.words,v=j.words,g=o=d[0],B=c=d[1],m=s=d[2],w=a=d[3],b=f=d[4],r=0;r<80;r+=1)h=(h=x(h=(h=o+e[t+u[r]]|0)+(r<16?(c^s^a)+p[0]:r<32?k(c,s,a)+p[1]:r<48?((c|~s)^a)+p[2]:r<64?S(c,s,a)+p[3]:(c^(s|~a))+p[4])|0,_[r]))+f|0,o=f,f=a,a=x(s,10),s=c,c=h,h=(h=x(h=(h=g+e[t+y[r]]|0)+(r<16?(B^(m|~w))+l[0]:r<32?S(B,m,w)+l[1]:r<48?((B|~m)^w)+l[2]:r<64?k(B,m,w)+l[3]:(B^m^w)+l[4])|0,v[r]))+b|0,g=b,b=w,w=x(m,10),m=B,B=h;h=d[1]+s+w|0,d[1]=d[2]+a+b|0,d[2]=d[3]+f+g|0,d[3]=d[4]+o+B|0,d[4]=d[0]+c+m|0,d[0]=h},_doFinalize:function(){for(var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes,i=(t[i>>>5]|=128<<24-i%32,t[14+(64+i>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),e.sigBytes=4*(t.length+1),this._process(),this._hash),n=i.words,o=0;o<5;o++){var c=n[o];n[o]=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8)}return i},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}}),t.RIPEMD160=n._createHelper(r),t.HmacRIPEMD160=n._createHmacHelper(r),e.RIPEMD160},"object"==typeof(r=e)?t.exports=e=i(n()):"function"==typeof define&&define.amd?define(["./core"],i):i(r.CryptoJS)}}),m=e({"hmac.js"(e,t){var r,i;i=function(e){var t,s;t=e.lib.Base,s=e.enc.Utf8,e.algo.HMAC=t.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=s.parse(t));for(var r=e.blockSize,i=4*r,e=((t=t.sigBytes>i?e.finalize(t):t).clamp(),this._oKey=t.clone()),t=this._iKey=t.clone(),n=e.words,o=t.words,c=0;c<r;c++)n[c]^=1549556828,o[c]^=909522486;e.sigBytes=t.sigBytes=i,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,e=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(e))}})},"object"==typeof(r=e)?t.exports=e=i(n()):"function"==typeof define&&define.amd?define(["./core"],i):i(r.CryptoJS)}}),w=e({"pbkdf2.js"(e,t){var r,i;i=function(e){var t,r,i,v,n,g,o;return r=(t=e).lib,i=r.Base,v=r.WordArray,r=t.algo,n=r.SHA1,g=r.HMAC,o=r.PBKDF2=i.extend({cfg:i.extend({keySize:4,hasher:n,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r=this.cfg,i=g.create(r.hasher,e),n=v.create(),o=v.create([1]),c=n.words,s=o.words,a=r.keySize,f=r.iterations;c.length<a;){for(var h=i.update(t).finalize(o),d=(i.reset(),h.words),p=d.length,l=h,u=1;u<f;u++){l=i.finalize(l),i.reset();for(var y=l.words,_=0;_<p;_++)d[_]^=y[_]}n.concat(h),s[0]++}return n.sigBytes=4*a,n}}),t.PBKDF2=function(e,t,r){return o.create(r).compute(e,t)},e.PBKDF2},"object"==typeof(r=e)?t.exports=e=i(n(),d(),m()):"function"==typeof define&&define.amd?define(["./core","./sha1","./hmac"],i):i(r.CryptoJS)}}),b=e({"evpkdf.js"(e,t){var r,i;i=function(e){var t,r,i,h,n,o;return r=(t=e).lib,i=r.Base,h=r.WordArray,r=t.algo,n=r.MD5,o=r.EvpKDF=i.extend({cfg:i.extend({keySize:4,hasher:n,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r,i=this.cfg,n=i.hasher.create(),o=h.create(),c=o.words,s=i.keySize,a=i.iterations;c.length<s;){r&&n.update(r),r=n.update(e).finalize(t),n.reset();for(var f=1;f<a;f++)r=n.finalize(r),n.reset();o.concat(r)}return o.sigBytes=4*s,o}}),t.EvpKDF=function(e,t,r){return o.create(r).compute(e,t)},e.EvpKDF},"object"==typeof(r=e)?t.exports=e=i(n(),d(),m()):"function"==typeof define&&define.amd?define(["./core","./sha1","./hmac"],i):i(r.CryptoJS)}}),k=e({"cipher-core.js"(e,t){var r,i;i=function(e){function n(e){return"string"==typeof e?y:u}function o(e,t,r){var i,n=this._iv;n?(i=n,this._iv=c):i=this._prevBlock;for(var o=0;o<r;o++)e[t+o]^=i[o]}var c,t,r,s,i,a,f,h,d,p,l,u,y;e.lib.Cipher||(t=(e=e).lib,r=t.Base,s=t.WordArray,i=t.BufferedBlockAlgorithm,(a=e.enc).Utf8,f=a.Base64,h=e.algo.EvpKDF,d=t.Cipher=i.extend({cfg:r.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,r){this.cfg=this.cfg.extend(r),this._xformMode=e,this._key=t,this.reset()},reset:function(){i.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(i){return{encrypt:function(e,t,r){return n(t).encrypt(i,e,t,r)},decrypt:function(e,t,r){return n(t).decrypt(i,e,t,r)}}}}),t.StreamCipher=d.extend({_doFinalize:function(){return this._process(!0)},blockSize:1}),a=e.mode={},p=t.BlockCipherMode=r.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}}),p=a.CBC=((a=p.extend()).Encryptor=a.extend({processBlock:function(e,t){var r=this._cipher,i=r.blockSize;o.call(this,e,t,i),r.encryptBlock(e,t),this._prevBlock=e.slice(t,t+i)}}),a.Decryptor=a.extend({processBlock:function(e,t){var r=this._cipher,i=r.blockSize,n=e.slice(t,t+i);r.decryptBlock(e,t),o.call(this,e,t,i),this._prevBlock=n}}),a),a=(e.pad={}).Pkcs7={pad:function(e,t){for(var t=4*t,r=t-e.sigBytes%t,i=r<<24|r<<16|r<<8|r,n=[],o=0;o<r;o+=4)n.push(i);t=s.create(n,r);e.concat(t)},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},t.BlockCipher=d.extend({cfg:d.cfg.extend({mode:p,padding:a}),reset:function(){d.reset.call(this);var e,t=this.cfg,r=t.iv,t=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=t.createEncryptor:(e=t.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,r&&r.words):(this._mode=e.call(t,this,r&&r.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4}),l=t.CipherParams=r.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),p=(e.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,e=e.salt,e=e?s.create([1398893684,1701076831]).concat(e).concat(t):t;return e.toString(f)},parse:function(e){var t,e=f.parse(e),r=e.words;return 1398893684==r[0]&&1701076831==r[1]&&(t=s.create(r.slice(2,4)),r.splice(0,4),e.sigBytes-=16),l.create({ciphertext:e,salt:t})}},u=t.SerializableCipher=r.extend({cfg:r.extend({format:p}),encrypt:function(e,t,r,i){i=this.cfg.extend(i);var n=e.createEncryptor(r,i),t=n.finalize(t),n=n.cfg;return l.create({ciphertext:t,key:r,iv:n.iv,algorithm:e,mode:n.mode,padding:n.padding,blockSize:e.blockSize,formatter:i.format})},decrypt:function(e,t,r,i){return i=this.cfg.extend(i),t=this._parse(t,i.format),e.createDecryptor(r,i).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),a=(e.kdf={}).OpenSSL={execute:function(e,t,r,i){i=i||s.random(8);e=h.create({keySize:t+r}).compute(e,i),r=s.create(e.words.slice(t),4*r);return e.sigBytes=4*t,l.create({key:e,iv:r,salt:i})}},y=t.PasswordBasedCipher=u.extend({cfg:u.cfg.extend({kdf:a}),encrypt:function(e,t,r,i){r=(i=this.cfg.extend(i)).kdf.execute(r,e.keySize,e.ivSize),i.iv=r.iv,e=u.encrypt.call(this,e,t,r.key,i);return e.mixIn(r),e},decrypt:function(e,t,r,i){i=this.cfg.extend(i),t=this._parse(t,i.format);r=i.kdf.execute(r,e.keySize,e.ivSize,t.salt);return i.iv=r.iv,u.decrypt.call(this,e,t,r.key,i)}}))},"object"==typeof(r=e)?t.exports=e=i(n(),b()):"function"==typeof define&&define.amd?define(["./core","./evpkdf"],i):i(r.CryptoJS)}}),S=e({"mode-cfb.js"(e,t){var r,i;i=function(e){function o(e,t,r,i){var n,o=this._iv;o?(n=o.slice(0),this._iv=void 0):n=this._prevBlock,i.encryptBlock(n,0);for(var c=0;c<r;c++)e[t+c]^=n[c]}var t;return e.mode.CFB=((t=e.lib.BlockCipherMode.extend()).Encryptor=t.extend({processBlock:function(e,t){var r=this._cipher,i=r.blockSize;o.call(this,e,t,i,r),this._prevBlock=e.slice(t,t+i)}}),t.Decryptor=t.extend({processBlock:function(e,t){var r=this._cipher,i=r.blockSize,n=e.slice(t,t+i);o.call(this,e,t,i,r),this._prevBlock=n}}),t),e.mode.CFB},"object"==typeof(r=e)?t.exports=e=i(n(),k()):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],i):i(r.CryptoJS)}}),x=e({"mode-ctr.js"(e,t){var r,i;i=function(e){var t,r;return e.mode.CTR=(t=e.lib.BlockCipherMode.extend(),r=t.Encryptor=t.extend({processBlock:function(e,t){var r=this._cipher,i=r.blockSize,n=this._iv,o=this._counter,c=(n&&(o=this._counter=n.slice(0),this._iv=void 0),o.slice(0));r.encryptBlock(c,0),o[i-1]=o[i-1]+1|0;for(var s=0;s<i;s++)e[t+s]^=c[s]}}),t.Decryptor=r,t),e.mode.CTR},"object"==typeof(r=e)?t.exports=e=i(n(),k()):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],i):i(r.CryptoJS)}}),C=e({"mode-ctr-gladman.js"(e,t){var r,i;i=function(e){function a(e){var t,r,i;return 255==(e>>24&255)?(r=e>>8&255,i=255&e,255===(t=e>>16&255)?(t=0,255===r?(r=0,255===i?i=0:++i):++r):++t,e=0,e=(e+=t<<16)+(r<<8)+i):e+=1<<24,e}var t,r;return e.mode.CTRGladman=(t=e.lib.BlockCipherMode.extend(),r=t.Encryptor=t.extend({processBlock:function(e,t){var r=this._cipher,i=r.blockSize,n=this._iv,o=this._counter,c=(n&&(o=this._counter=n.slice(0),this._iv=void 0),0===((n=o)[0]=a(n[0]))&&(n[1]=a(n[1])),o.slice(0));r.encryptBlock(c,0);for(var s=0;s<i;s++)e[t+s]^=c[s]}}),t.Decryptor=r,t),e.mode.CTRGladman},"object"==typeof(r=e)?t.exports=e=i(n(),k()):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],i):i(r.CryptoJS)}}),A=e({"mode-ofb.js"(e,t){var r,i;i=function(e){var t,r;return e.mode.OFB=(t=e.lib.BlockCipherMode.extend(),r=t.Encryptor=t.extend({processBlock:function(e,t){var r=this._cipher,i=r.blockSize,n=this._iv,o=this._keystream;n&&(o=this._keystream=n.slice(0),this._iv=void 0),r.encryptBlock(o,0);for(var c=0;c<i;c++)e[t+c]^=o[c]}}),t.Decryptor=r,t),e.mode.OFB},"object"==typeof(r=e)?t.exports=e=i(n(),k()):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],i):i(r.CryptoJS)}}),H=e({"mode-ecb.js"(e,t){var r,i;i=function(e){var t;return e.mode.ECB=((t=e.lib.BlockCipherMode.extend()).Encryptor=t.extend({processBlock:function(e,t){this._cipher.encryptBlock(e,t)}}),t.Decryptor=t.extend({processBlock:function(e,t){this._cipher.decryptBlock(e,t)}}),t),e.mode.ECB},"object"==typeof(r=e)?t.exports=e=i(n(),k()):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],i):i(r.CryptoJS)}}),j=e({"pad-ansix923.js"(e,t){var r,i;i=function(e){return e.pad.AnsiX923={pad:function(e,t){var r=e.sigBytes,t=4*t,t=t-r%t,r=r+t-1;e.clamp(),e.words[r>>>2]|=t<<24-r%4*8,e.sigBytes+=t},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},e.pad.Ansix923},"object"==typeof(r=e)?t.exports=e=i(n(),k()):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],i):i(r.CryptoJS)}}),z=e({"pad-iso10126.js"(e,t){var r,i;i=function(r){return r.pad.Iso10126={pad:function(e,t){t*=4,t-=e.sigBytes%t;e.concat(r.lib.WordArray.random(t-1)).concat(r.lib.WordArray.create([t<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},r.pad.Iso10126},"object"==typeof(r=e)?t.exports=e=i(n(),k()):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],i):i(r.CryptoJS)}}),D=e({"pad-iso97971.js"(e,t){var r,i;i=function(r){return r.pad.Iso97971={pad:function(e,t){e.concat(r.lib.WordArray.create([2147483648],1)),r.pad.ZeroPadding.pad(e,t)},unpad:function(e){r.pad.ZeroPadding.unpad(e),e.sigBytes--}},r.pad.Iso97971},"object"==typeof(r=e)?t.exports=e=i(n(),k()):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],i):i(r.CryptoJS)}}),E=e({"pad-zeropadding.js"(e,t){var r,i;i=function(e){return e.pad.ZeroPadding={pad:function(e,t){t*=4;e.clamp(),e.sigBytes+=t-(e.sigBytes%t||t)},unpad:function(e){for(var t=e.words,r=e.sigBytes-1,r=e.sigBytes-1;0<=r;r--)if(t[r>>>2]>>>24-r%4*8&255){e.sigBytes=r+1;break}}},e.pad.ZeroPadding},"object"==typeof(r=e)?t.exports=e=i(n(),k()):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],i):i(r.CryptoJS)}}),R=e({"pad-nopadding.js"(e,t){var r,i;i=function(e){return e.pad.NoPadding={pad:function(){},unpad:function(){}},e.pad.NoPadding},"object"==typeof(r=e)?t.exports=e=i(n(),k()):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],i):i(r.CryptoJS)}}),M=e({"format-hex.js"(e,t){var r,i;i=function(e){var t,r;return t=e.lib.CipherParams,r=e.enc.Hex,e.format.Hex={stringify:function(e){return e.ciphertext.toString(r)},parse:function(e){e=r.parse(e);return t.create({ciphertext:e})}},e.format.Hex},"object"==typeof(r=e)?t.exports=e=i(n(),k()):"function"==typeof define&&define.amd?define(["./core","./cipher-core"],i):i(r.CryptoJS)}}),J=e({"aes.js"(e,t){var r,i;i=function(e){for(var t=e,r=t.lib.BlockCipher,i=t.algo,f=[],n=[],o=[],c=[],s=[],a=[],h=[],d=[],p=[],l=[],u=[],y=0;y<256;y++)u[y]=y<128?y<<1:y<<1^283;for(var _=0,v=0,y=0;y<256;y++){var g=v^v<<1^v<<2^v<<3^v<<4,B=u[n[f[_]=g=g>>>8^255&g^99]=_],m=u[B],w=u[m],b=257*u[g]^16843008*g;o[_]=b<<24|b>>>8,c[_]=b<<16|b>>>16,s[_]=b<<8|b>>>24,a[_]=b,h[g]=(b=16843009*w^65537*m^257*B^16843008*_)<<24|b>>>8,d[g]=b<<16|b>>>16,p[g]=b<<8|b>>>24,l[g]=b,_?(_=B^u[u[u[w^B]]],v^=u[u[v]]):_=v=1}var k=[0,1,2,4,8,16,32,64,128,27,54],i=i.AES=r.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4,i=4*(1+(this._nRounds=6+r)),n=this._keySchedule=[],o=0;o<i;o++)o<r?n[o]=t[o]:(a=n[o-1],o%r?6<r&&o%r==4&&(a=f[a>>>24]<<24|f[a>>>16&255]<<16|f[a>>>8&255]<<8|f[255&a]):(a=f[(a=a<<8|a>>>24)>>>24]<<24|f[a>>>16&255]<<16|f[a>>>8&255]<<8|f[255&a],a^=k[o/r|0]<<24),n[o]=n[o-r]^a);for(var c=this._invKeySchedule=[],s=0;s<i;s++){var a,o=i-s;a=s%4?n[o]:n[o-4],c[s]=s<4||o<=4?a:h[f[a>>>24]]^d[f[a>>>16&255]]^p[f[a>>>8&255]]^l[f[255&a]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,o,c,s,a,f)},decryptBlock:function(e,t){var r=e[t+1],r=(e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,h,d,p,l,n),e[t+1]);e[t+1]=e[t+3],e[t+3]=r},_doCryptBlock:function(e,t,r,i,n,o,c,s){for(var a=this._nRounds,f=e[t]^r[0],h=e[t+1]^r[1],d=e[t+2]^r[2],p=e[t+3]^r[3],l=4,u=1;u<a;u++)var y=i[f>>>24]^n[h>>>16&255]^o[d>>>8&255]^c[255&p]^r[l++],_=i[h>>>24]^n[d>>>16&255]^o[p>>>8&255]^c[255&f]^r[l++],v=i[d>>>24]^n[p>>>16&255]^o[f>>>8&255]^c[255&h]^r[l++],g=i[p>>>24]^n[f>>>16&255]^o[h>>>8&255]^c[255&d]^r[l++],f=y,h=_,d=v,p=g;y=(s[f>>>24]<<24|s[h>>>16&255]<<16|s[d>>>8&255]<<8|s[255&p])^r[l++],_=(s[h>>>24]<<24|s[d>>>16&255]<<16|s[p>>>8&255]<<8|s[255&f])^r[l++],v=(s[d>>>24]<<24|s[p>>>16&255]<<16|s[f>>>8&255]<<8|s[255&h])^r[l++],g=(s[p>>>24]<<24|s[f>>>16&255]<<16|s[h>>>8&255]<<8|s[255&d])^r[l++];e[t]=y,e[t+1]=_,e[t+2]=v,e[t+3]=g},keySize:8});return t.AES=r._createHelper(i),e.AES},"object"==typeof(r=e)?t.exports=e=i(n(),a(),h(),b(),k()):"function"==typeof define&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],i):i(r.CryptoJS)}}),P=e({"tripledes.js"(e,t){var r,i;i=function(e){var t=e,i=(r=t.lib).WordArray,r=r.BlockCipher,n=t.algo,f=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],h=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],d=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],p=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],l=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],o=n.DES=r.extend({_doReset:function(){for(var e=this._key.words,t=[],r=0;r<56;r++){var i=f[r]-1;t[r]=e[i>>>5]>>>31-i%32&1}for(var n=this._subKeys=[],o=0;o<16;o++){for(var c=n[o]=[],s=d[o],r=0;r<24;r++)c[r/6|0]|=t[(h[r]-1+s)%28]<<31-r%6,c[4+(r/6|0)]|=t[28+(h[r+24]-1+s)%28]<<31-r%6;c[0]=c[0]<<1|c[0]>>>31;for(r=1;r<7;r++)c[r]=c[r]>>>4*(r-1)+3;c[7]=c[7]<<5|c[7]>>>27}for(var a=this._invSubKeys=[],r=0;r<16;r++)a[r]=n[15-r]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,r){this._lBlock=e[t],this._rBlock=e[t+1],u.call(this,4,252645135),u.call(this,16,65535),y.call(this,2,858993459),y.call(this,8,16711935),u.call(this,1,1431655765);for(var i=0;i<16;i++){for(var n=r[i],o=this._lBlock,c=this._rBlock,s=0,a=0;a<8;a++)s|=p[a][((c^n[a])&l[a])>>>0];this._lBlock=c,this._rBlock=o^s}var f=this._lBlock;this._lBlock=this._rBlock,this._rBlock=f,u.call(this,1,1431655765),y.call(this,8,16711935),y.call(this,2,858993459),u.call(this,16,65535),u.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function u(e,t){t=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=t,this._lBlock^=t<<e}function y(e,t){t=(this._rBlock>>>e^this._lBlock)&t;this._lBlock^=t,this._rBlock^=t<<e}return t.DES=r._createHelper(o),n=n.TripleDES=r.extend({_doReset:function(){var e=this._key.words;if(2!==e.length&&4!==e.length&&e.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var t=e.slice(0,2),r=e.length<4?e.slice(0,2):e.slice(2,4),e=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=o.createEncryptor(i.create(t)),this._des2=o.createEncryptor(i.create(r)),this._des3=o.createEncryptor(i.create(e))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2}),t.TripleDES=r._createHelper(n),e.TripleDES},"object"==typeof(r=e)?t.exports=e=i(n(),a(),h(),b(),k()):"function"==typeof define&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],i):i(r.CryptoJS)}}),F=e({"rc4.js"(e,t){var r,i;i=function(e){var t=e,r=t.lib.StreamCipher,i=t.algo,n=i.RC4=r.extend({_doReset:function(){for(var e=this._key,t=e.words,r=e.sigBytes,i=this._S=[],n=0;n<256;n++)i[n]=n;for(var n=0,o=0;n<256;n++){var c=n%r,c=t[c>>>2]>>>24-c%4*8&255,o=(o+i[n]+c)%256,c=i[n];i[n]=i[o],i[o]=c}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=o.call(this)},keySize:8,ivSize:0});function o(){for(var e=this._S,t=this._i,r=this._j,i=0,n=0;n<4;n++){var r=(r+e[t=(t+1)%256])%256,o=e[t];e[t]=e[r],e[r]=o,i|=e[(e[t]+e[r])%256]<<24-8*n}return this._i=t,this._j=r,i}return t.RC4=r._createHelper(n),i=i.RC4Drop=n.extend({cfg:n.cfg.extend({drop:192}),_doReset:function(){n._doReset.call(this);for(var e=this.cfg.drop;0<e;e--)o.call(this)}}),t.RC4Drop=r._createHelper(i),e.RC4},"object"==typeof(r=e)?t.exports=e=i(n(),a(),h(),b(),k()):"function"==typeof define&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],i):i(r.CryptoJS)}}),W=e({"rabbit.js"(e,t){var r,i;i=function(e){function a(){for(var e=this._X,t=this._C,r=0;r<8;r++)c[r]=t[r];t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<c[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<c[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<c[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<c[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<c[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<c[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<c[6]>>>0?1:0)|0,this._b=t[7]>>>0<c[7]>>>0?1:0;for(r=0;r<8;r++){var i=e[r]+t[r],n=65535&i,o=i>>>16;s[r]=((n*n>>>17)+n*o>>>15)+o*o^((4294901760&i)*i|0)+((65535&i)*i|0)}e[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,e[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,e[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,e[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,e[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,e[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,e[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,e[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}var t,r,i,n,c,s;return r=(t=e).lib.StreamCipher,i=t.algo,n=[],c=[],s=[],i=i.Rabbit=r.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,r=0;r<4;r++)e[r]=16711935&(e[r]<<8|e[r]>>>24)|4278255360&(e[r]<<24|e[r]>>>8);for(var i=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],n=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]],r=this._b=0;r<4;r++)a.call(this);for(r=0;r<8;r++)n[r]^=i[r+4&7];if(t){var t=t.words,o=t[0],t=t[1],o=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),t=16711935&(t<<8|t>>>24)|4278255360&(t<<24|t>>>8),c=o>>>16|4294901760&t,s=t<<16|65535&o;n[0]^=o,n[1]^=c,n[2]^=t,n[3]^=s,n[4]^=o,n[5]^=c,n[6]^=t,n[7]^=s;for(r=0;r<4;r++)a.call(this)}},_doProcessBlock:function(e,t){var r=this._X;a.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),e[t+i]^=n[i]},blockSize:4,ivSize:2}),t.Rabbit=r._createHelper(i),e.Rabbit},"object"==typeof(r=e)?t.exports=e=i(n(),a(),h(),b(),k()):"function"==typeof define&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],i):i(r.CryptoJS)}}),O=e({"rabbit-legacy.js"(e,t){var r,i;i=function(e){function s(){for(var e=this._X,t=this._C,r=0;r<8;r++)c[r]=t[r];t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<c[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<c[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<c[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<c[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<c[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<c[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<c[6]>>>0?1:0)|0,this._b=t[7]>>>0<c[7]>>>0?1:0;for(r=0;r<8;r++){var i=e[r]+t[r],n=65535&i,o=i>>>16;a[r]=((n*n>>>17)+n*o>>>15)+o*o^((4294901760&i)*i|0)+((65535&i)*i|0)}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}var t,r,i,n,c,a;return r=(t=e).lib.StreamCipher,i=t.algo,n=[],c=[],a=[],i=i.RabbitLegacy=r.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,r=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],i=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]],n=this._b=0;n<4;n++)s.call(this);for(n=0;n<8;n++)i[n]^=r[n+4&7];if(t){var e=t.words,t=e[0],e=e[1],t=16711935&(t<<8|t>>>24)|4278255360&(t<<24|t>>>8),e=16711935&(e<<8|e>>>24)|4278255360&(e<<24|e>>>8),o=t>>>16|4294901760&e,c=e<<16|65535&t;i[0]^=t,i[1]^=o,i[2]^=e,i[3]^=c,i[4]^=t,i[5]^=o,i[6]^=e,i[7]^=c;for(n=0;n<4;n++)s.call(this)}},_doProcessBlock:function(e,t){var r=this._X;s.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),e[t+i]^=n[i]},blockSize:4,ivSize:2}),t.RabbitLegacy=r._createHelper(i),e.RabbitLegacy},"object"==typeof(r=e)?t.exports=e=i(n(),a(),h(),b(),k()):"function"==typeof define&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],i):i(r.CryptoJS)}});return e({"index.js"(e,t){var r,i;i=function(e){return e},"object"==typeof(r=e)?t.exports=e=i(n(),o(),c(),s(),a(),f(),h(),d(),p(),l(),_(),v(),g(),B(),m(),w(),b(),k(),S(),x(),C(),A(),H(),j(),z(),D(),E(),R(),M(),J(),P(),F(),W(),O()):"function"==typeof define&&define.amd?define(["./core","./x64-core","./lib-typedarrays","./enc-utf16","./enc-base64","./enc-base64url","./md5","./sha1","./sha256","./sha224","./sha512","./sha384","./sha3","./ripemd160","./hmac","./pbkdf2","./evpkdf","./cipher-core","./mode-cfb","./mode-ctr","./mode-ctr-gladman","./mode-ofb","./mode-ecb","./pad-ansix923","./pad-iso10126","./pad-iso97971","./pad-zeropadding","./pad-nopadding","./format-hex","./aes","./tripledes","./rc4","./rabbit","./rabbit-legacy"],i):r.CryptoJS=r.CryptoJS}})()}
//---SyncByPyScript---CryptoJS-end