';
// }
// $.messager.show(options);
//}
function showLoading() {
$("#loading").show();
}
function closeLoadingButton(){
let close = $(".loadingClose");
if (close) {close.remove();}
$(".loadingMsg").after("
" +
"
");
}
function closeLoading() {
$("#loading").hide();
}
//错误异常的捕获 xin 2023-8-22 10:34:29
window.onerror=function (message, source, lineno, colno, error) {
closeLoadingButton();
console.log(message);
return true; // 防止异常的默认行为
}
/** ***************************************** */
Object.extend = function(destination, source) {
for ( var property in source) {
destination[property] = source[property];
}
return destination;
}
var myapp = function(o) {
this.options = {
url :"", // 你要打开的页面url
vArguments :"window", // 你要向打开的页面传递的数据
dialogWidth :500, // 打开窗口的宽度
dialogHeight :500, // 你打开窗口的高度
center :"yes", // center: {yes | no | 1 | 0 }:窗口是否居中,默认yes,但仍可以指定高度和宽度。
help :"no", // {yes | no | 1 | 0 }:是否显示帮助按钮,默认yes
resizable :"yes", // {yes | no | 1 | 0 } [IE5+]:是否可被改变大小。默认no
status :"yes", // {yes | no | 1 | 0 } [IE5+]:是否显示状态栏。默认为yes[
// Modeless]或no[Modal]。
scroll :"yes", // { yes | no | 1 | 0 | on | off }:指明对话框是否显示滚动条。默认为yes。
callBack :false
};
Object.extend(this.options, o || {});
}
myapp.prototype = {
openNewWin : function(url) {
var options = this.options;
var l = (screen.availWidth - options["dialogWidth"]) / 2;
var h = (screen.availHeight - options["dialogHeight"]) / 2;
var sp = "dialogTop:" + h + "px;dialogLeft:" + l + "px;dialogWidth:"
+ options["dialogWidth"] + "px;dialogHeight:"
+ options["dialogHeight"] + "px;center:" + options["center"]
+ ";help:" + options["help"] + ";resizable:"
+ options["resizable"] + ";status:" + options["status"]
+ ";scroll:" + options["scroll"];
var newWin = null;
if(window.showModalDialog!=undefined){
newWin = window.showModalDialog(options["url"],options["vArguments"], sp);
var call = options["callBack"];
if (typeof call == "function") { // 调用 数据处理函数
call(newWin);
}
}else{
window.open(options["url"],options["vArguments"], "height="+options["dialogHeight"]+",width="+options["dialogWidth"]+",top=300,left=350");
}
// var newWin = window.showModalDialog(options["url"],
// options["vArguments"], sp);
// var call = options["callBack"];
// if (typeof call == "function") {// 调用 数据处理函数
// call(newWin);
//}
},
setOptions : function() {
}
}
/** *************************************************************** */
function encodeURL(url) {
try {
url = parent.encodeURL(url);
} catch (e) {
}
return url;
}
function encodeText(t) {
try {
t = parent.encodeText(t);
} catch (e) {
}
return t;
}
// 为String类添加replaceAll函数
String.prototype.replaceAll = function(AFindText, ARepText) {
raRegExp = new RegExp(AFindText, "g");
return this.replace(raRegExp, ARepText)
}
Array.prototype.del = function(n) { // 为数组添加删除元素的函数
if (n < 0)
return this;
else
return this.slice(0, n).concat(this.slice(n + 1, this.length));
}
function replaceSessonKey(str, callback) { // 替换session值
$.post("/replaceSessionKey.do", {
"paramter" :str
}, function(data) {
callback(data);
});
}
function replacePageValue(str) { // 替换页面值
var list = new Array();
var i = 0;
var temp = null;
var postion = 0;
while (str.indexOf("&", i) != -1) {
i = str.indexOf("&", i) + 1;
postion = str.indexOf("&", i);
if (postion == -1)
break;
temp = str.substring(i, postion);
i = postion + 1;
list.push(temp);
}
for (i = 0; i < list.length; i++) {
temp = getValue(list[i]);
str = str.replaceAll("&" + list[i] + "&",
(temp == null || temp == "null") ? list[i] : temp);
}
return str;
}
function getValue(fieldId, format, row) { // 获取页面值
let value;
try {
//TODO 是实现面板需要根据权限是否为0取不同的值 by danaus 2024-03-08 14:53
value = getDoc(fieldId.toLowerCase(), ".value");
let value_expr = getDoc(fieldId.toLowerCase() + "_expr", ".value");
let value_expr_val = getDoc(fieldId.toLowerCase() + "_expr_val", ".value");
if (value_expr != undefined&&value_expr != null&&value_expr !=="" && value_expr == 0) {
value = value_expr_val;
paramExprs.push(fieldId.toLowerCase());
}
} catch (e) {
value = undefined; // by danaus 出现异常赋值 作为判断识别
}
if (value == null) { // 只有是这种情况才需要继续向下查找 by danaus 原则:如果页面上有这个字段定义,不管它是什么值,都把它替换,如果没有这个字段,就继续向下查找,直到没有 则不用替(传什么就是什么)
if (typeof (mygrid) != "undefined") {
try {
if (row == undefined) {
var tempRow = mygrid.getFristRow(1);//再判断一次,以确定这个字段是否存在于表格,存在才需要提示
if (tempRow != null && tempRow[fieldId.toLowerCase()] != undefined) {
alert("请从表格选中需要执行的行");
return false;
}
}
let orgValue = value; // 保存原值
if (row != undefined) {
value = (row[fieldId.toLowerCase() + "Link"] !== undefined) ? row[fieldId.toLowerCase() + "Link"] : ((row[fieldId.toLowerCase()] == undefined) ? null : row[fieldId.toLowerCase()]);
if (row[fieldId.toLowerCase() + "_expr"] != undefined&& row[fieldId.toLowerCase() + "_expr"]!=="" && row[fieldId.toLowerCase() + "_expr"] === 0) {
//密文,取_expr_val的值
value = row[fieldId.toLowerCase() + "_expr_val"];
paramExprs.push(fieldId.toLowerCase());
}
} else {
value = mygrid.getField(fieldId.toLowerCase());
}
if (value == null && orgValue == null) return fieldId;
} catch (e) {
return fieldId;
}
}
return value;
}else {
if (value == 'null') {
value = "";
}
return value;
}
}
function centerPopup(ctype, callback) { // 2确认 3通过驳回
if (typeof (createPopupPwd) != 'function') {
$.getScript("/js/pwd/inputPwd.js", function() {
createPopupPwd(formId, ctype, callback);
});
} else {
createPopupPwd(formId, ctype, callback);
}
}
var hq={
createPopSelect:function(fid, cfid, doccode, callback) {
if (typeof (openLeaderSelect) != 'function') {
$.getScript("/js/selectLeader/selectLeader.js", function() {
openLeaderSelect(fid, cfid, doccode, callback);
});
} else {
openLeaderSelect(fid, cfid, doccode, callback);
}
}
}
//报表打印
function printButtonLink(formid, reportid, format, param, formtype,
Warnnessage, isDirectPrinter, isSelectPrinter, formats, isFont,isbeforerefreshcontent) {
var flag = checkSession(); // session失效后弹出登录框,flag为true时表示已经失效
if(flag){
return;
}
var Warn =function(){ // 打印前抛出的信息
var json=JSON.parse(Warnnessage.replace(/'/g, "\""));
if(json.parameters != ""){
var temp=json.parameters.split(";");// getSymbol(Warnnessage,'&');
var war=[];
for(var i in temp){
war.push(getDoc(temp[i],'.value'));
}
json.parameters=war.join(";");
}
// else{
// return confirm(Warnnessage);
// }
var warbol=false;
$.ajax({url:'/printReport.do?m=Warnnessage',data:json,type:"POST",async:false,dataType:'json',
success:function(r) {
if(r.state==0){
if(confirm(r.msg)){
warbol=true;
}
} else{
warbol=true;
}
}});
return warbol;
}
if (Warnnessage == "" || Warn()) {
var proParam = "";
let doccodes=[];//多个单据打印的处理(更新打印次数用到)
if ($.trim(param) != "") {
if (param.indexOf("@formid") != -1) {
param = param.replaceAll("@formid", formId);
}
var temp = param.split(";");
for (i = 0; i < temp.length; i++) { // 循环获取报表设置参数的值,从面板和格线里面获取。 2014-10-25
var temp2 = temp[i].split("=");
if (temp2.length < 2) {
if (temp2.length == 1 && temp2[0] == "")
continue;
$.messager.alert("操作提示", formid + "报表参数配置有误:" + param,"warning");
return;
}
var t = null;
var rows=[];
var num=0;
if (typeof (mygrid) != "undefined") {
rows=mygrid.getFieldForNew();
if(rows.length==0){
num=1;
}else {
num = rows.length;
}
}else{ // 没格线则取0;
num=1;
}
proParam += temp2[0]+"=";
var tempx=(temp2[1].replaceAll("&", "")).toLowerCase();
for(var k=0;k0) proParam += ","; // 多个值的时候用逗号(,)隔开。
if ($.trim(tempx) == "") {
continue;
}
t = getValue(tempx.toLowerCase(),null,rows[k]);
if (t==null){
t = tempx;
}else{
if (tempx.toLowerCase() == "doccode" && t != "") {//如果获取到的是单据固定字段名称进入处理
doccodes.push(t);
}
}
//43控件处理
let panM = panMain[panIndex];
if (panM != null) {
if (panM.panInfo[tempx.toLowerCase()] != null) {
if (panM.panInfo[tempx.toLowerCase()].controltype == 43) {
t = $("#" + tempx.toLowerCase()).val();
if (t != null && t != "") {
if (t instanceof Array) {
t = t.join("#p#");//用分号(;)做间隔的话再传参后台会被截断
}
} else {
t = "";
}
}
}
}
proParam += t; // 组装值
}
proParam +=";";
}
proParam = proParam.substring(0, proParam.length - 1);
proParam = encodeURI(encodeURI(proParam)); // 对参数进行编码。(进行二次编码)
}
// var servlet = "/" + format.toLowerCase() + ".do?"
var servlet="/printReport.do?m="+format.toLowerCase()
var doccode = getDoc("doccode", ".value");//只取表头 by danaus 2022/8/17 11:10 getValue('doccode');
if (doccode == null && doccodes.length > 0) {//没找到这个单号,多个单号数组里有值的话就赋值 xin 2023-10-13 10:57:54
doccode = doccodes.join(";");
}
var url = "formId=" + formid + "&reportId=" + reportid + "¶meter=" + proParam+";"
+ "&p=" + Math.round(Math.random() * 100000);
//html方法打印
if (format.toLowerCase() == "html") {
parent.addTab("flash打印", "", "", "", encodeURL("/swf.jsp?parm="
+ url.replaceAll("=", "_pb").replaceAll("&", "_fen")
+ "&format=" + format + "&reportId=" + reportid
+ "&formId=" + formid + "&formtype=" + formtype
+ "&doccode=" + doccode + "&print=" + isDirectPrinter
+ "&Formats=" + formats));
return false;
}
if(isbeforerefreshcontent==1){
//执行更新密码的程序
$.ajax({url:'/printReport.do?m=updatepwd',
data:{'formId':formid,'doccode':doccode},
type:"POST",
async:false,
dataType:'json',
success:function(r) {
if(r.state==-1){
$.messager.alert("操作提示", r.msg,"warning");
}
}
});
}
//如果谷歌浏览器高于50版本才执行最新打印方式否则执行旧版打印方式
if(format.toLowerCase() == "pdf" && getChromeVersion()>50){
//执行pdf打印,添加一个页卡显示。
//viewer.jsp是pdfjs提供的加载pdf文件的容器 -xin 2020-6-12 15:00:30
parent.addTab("PDF报表打印", "", "", "", "/general/pdf/web/viewer.jsp?file="+encodeURL(servlet
+"&"+ url)+"&formId="+formid+"&formType="+formtype+"&reportId="+reportid
+"&printFormat="+format+"&doccode="+doccode+"¶meter="+proParam+"&isDirectPrinter="+isDirectPrinter);
return false;
}
//执行pdf打印,添加一个页卡显示。
parent.addTab(format + "打印", "", "", "", encodeURL(servlet +"&"+url));
//更新打印次数
$.post("/printReport.do?m=number", {
"formId" :formid,
"formType" :formtype,
"reportId" :reportid,
"printFormat" :format,
"doccode" :doccode,
"parameter":proParam
},function(r){
if(r.state==-1){
$.messager.alert("操作提示", r.msg,"warning");
}
});
}
}
//获取谷歌浏览器版本
function getChromeVersion() {
var arr = navigator.userAgent.split(' ');
var chromeVersion = '';
for(var i=0;i < arr.length;i++){
if(/chrome/i.test(arr[i]))
chromeVersion = arr[i]
}
if(chromeVersion){
return Number(chromeVersion.split('/')[1].split('.')[0]);
} else {
return false;
}
}
function getSymbol(sql,split){ // 获取有符号的字段
var splitLength=split.length;
//List list=new ArrayList();
var i=0;
var postion=0;
var list = new Array();
while(sql.indexOf(split,i)!=-1){
i=sql.indexOf(split,i)+splitLength;
postion=sql.indexOf(split, i);
if(postion==-1)break;
var temp=getDoc(sql.substring(i,postion),'.value');
var tefu=sql.substring(i-1,postion+1);
sql=sql.replace(tefu,temp);
i=postion+splitLength;
}
return sql;
}
function getReportPage(fid, rptid, fun) {
$.post("/reportGetPage.do", {
"formId" :fid,
"reportId" :rptid
}, function(d) {
if (typeof fun == "function")
fun(d);
});
}
function recentFilesTo() {
if (typeof formId != "undefined" && typeof formType != "undefined") {
var url = "/recentfiles.do";
var formname = document.title;
var query_string = document.URL;
query_string = (query_string.indexOf("?") == -1) ? "" : query_string
.substring(query_string.indexOf("?") + 1);
$.post(url, {
"formid" :formId,
"formtype" :formType,
"formname" :formname,
"query_string" :query_string
}, '');
}
}
function getDocURL(isNext) {
var doccode = doc('doccode').value;
panIndex = "0";
$.post("/getDoc.do", {
"t_doc" :isNext,
"doccode" :doccode,
"where" :"",
"tUrl" :document.URL
}, function(data) {
if (data != null && data != "") {
location.href = data;
} else {
alert(data);
}
});
}
var postToThis = null; // 接受字段 父页面
var panelToPost = null; // 所需字段 子页面
var inThisFrame = "";
var inChangFrame = "";
var C_Grid = "";
var ispop="";
$( function($) {
if (typeof parent.getIframeAttr != 'undefined') {
inThisFrame = parent.getIframeAttr("id");
inChangFrame = parent.getIframeAttr("pframe");
panelToPost = parent.getIframeAttr("paneltopost")!=undefined?parent.getIframeAttr("paneltopost").split(";"):"";
postToThis = parent.getIframeAttr("posttothis")!=undefined?parent.getIframeAttr("posttothis").split(";"):"";
C_Grid = parent.getIframeAttr("t_grid");
}
//recentFilesTo();
});
// 【帮助】按钮事件函数,点击打开该功能的帮助页面
function openHelpPage(tabtitle)
{
var flag = checkSession(); // session失效后弹出登录框,flag为true时表示已经失效
if(flag){
return;
}
// 获取帮助文件所在目录路径
var a = location.href;
a=a.replace(/(.+\/).*$/g, '$1');
//alert(tabtitle);
//var tabtile=.getElementById("tab_title").value;
// 组合路径并在tab打开页面
try {
//alert("1");
var url=a+"help.jsp";
//alert(url);
parent.addTab(tabtitle+"-"+formId+"-帮助", formId, '','', url);
} catch (e) {
alert(e); // window.open("help.jsp");
}
}
//选择按钮的隐藏和显示
$(function(){
$("#tpselect").hide();
if ((C_Grid != undefined && C_Grid != "" && eval('(' + C_Grid + ')').toP != "" && eval('(' + C_Grid + ')').toP != "null")
|| $.trim(postToThis).length > 0 || self_datafields != "") {
$("#tpselect").show();
$(".selected-icon-container").show();
}
parent.numId = ""; // 设置单号的值
})
// TW添加
function showrestmenu(){
var offset = $('#showRestmenuDiv').offset()
var top = parseInt(offset.top+$('#showRestmenuDiv').height()+5);
if(isTopFixed()) {//固定头部用到 xin 2020-11-10 10:54:20
top=67;
}
$('#restmenuDiv').css({"top":top,"left":offset.left});
$('#restmenuDiv').show();
}
function restmenuclose(){
$('#restmenuDiv').hide();
}
// 打开搜索框和更多
$(function(){
if (navigator.userAgent.match(/iPad|iPhone|Android/i)){
$("#showRestmenuDiv").toggle(function(){
$("#restmenuDiv").bind('touchstart',function(){
showrestmenu();
})
},function(){
if($('div').hasClass("restmenuDiv")){
restmenuclose();
}
});
}
$('#selectinfo').mousedown(function(){
var flag = checkSession(); // session失效后弹出登录框,flag为true时表示已经失效
if(flag){
return;
}
$('#selectDiv').show();
})
$('#selectinfo').mouseup(function(){
$('#queryValue').focus();
})
// 按下回车键执行的函数,先解除绑定,再绑定。解决事件累加而执行二次
$('#queryValue').unbind('keydown').keydown(function(event){
if(event.keyCode == 13){
tw.simpConfirm(); // query.js里面的一个方法
windowClose();
}
})
//更多里面的收藏按钮 -xin 2020-6-23 16:39:45
// if(typeof(formId)!='undefined'){
// try{
// var Evt= $('#layoutIcon');
// $.post('/setIconMenu.do',{'formid':formId},function(data){
// Evt.linkbutton({
// iconCls: (data.state==1?'icon-scok':'icon-scno'),
// text:(data.state==1?'已添加':'添加'),
// title:'为此功能号添加到图标菜单',
// plain:true
// });
// },'json');
// Evt.bind('click',function(){
// alert('进入收藏');
// })
// }catch(e){}
// }
})
function showselectDiv(){
$('#queryValue').focus();
}
// 2、3类型搜索确认事件
function selectSimpConfirm(){
tw.simpConfirm();//query.js里面的一个方法
windowClose();
}
// 2、3类型搜索确认事件
function selectSimpConfirm2(){
tw.confirm2();//query.js里面的一个方法
windowClose();
}
// 2、3类型搜索弹出事件
function select(){
$('#selectDiv').window('open');
}
// 2、3类型搜索的关闭事件
function windowClose(){
$('#selectDiv').dialog('close');
}
// 2、3类型更多按钮弹出事件
function moreSelect(){
var offset = $('#showRestmenuDiv').offset();
var top = parseInt(offset.top+$('#showRestmenuDiv').height()+5);
$('#restmenuDiv').window({"top":top,"left":offset.left});
$('#restmenuDiv').window('open');
}
// 2、3类型更多按钮的关闭事件
function moreWindowClose(){
$('#restmenuDiv').dialog('close');
}
// 设置头部标题的高度
$(function(){
var a = $("#title_top").html();
if(a!=null && typeof($('#top2').val())!="undefined"){
$('#top2').layout('panel', 'north').panel('resize',{height:68});
$('#top2').layout('resize');
}
})
// 窗体类型为20的头部标题的高度设置
function formtype(){
var a = $("#title_top").html();
if(a!=null && typeof($('#top20').val())!="undefined"){
$('#top20').layout('panel', 'north').panel('resize',{height:110});
// $('#h_all').layout('panel', 'north').panel('resize',{height:68});
$('#top20').layout('resize');
//$('#h_all').layout('resize');
}else{
//$('#h_all').layout('panel', 'north3').panel('resize',{height:0});
$('#h_all').layout('panel', 'north').panel('resize',{height:33});
$('#h_all').layout('resize');
}
}
// 系统消息
var flag=false;
function funB(){
var init = $.cookie(userCode);
if(init==null){
$.cookie(userCode,flag);
}
if( $.cookie(userCode)=="false"){
$.post("/messageTip.do",function(data){
var message = data.message;
if(message!=""){
$.messagerTip.lays(300, 220);
$.messagerTip.show(0, message);
flag= $("input[name='isTip']").is(":checked");
$.cookie(userCode,flag,{expires: 1})
}
setTimeout(funB, 300000); // 5分钟调用一次
},"json")
}
}
function isChecked(){
flag= $("input[name='isTip']").is(":checked");
$.cookie(userCode,flag);
}
function checkSession(){
var flag = false;
$.ajax({
type : "post",
url : "/checkSession.do",
async : false,
dataType: "json",
success : function(data){
if(data.status=="fail"){
if($.cookie("dbid")!=null&&$.cookie("dbid")!=""){
parent.deskTopShow('重新登录','/sessionFail.jsp',400,220,'');
flag=true;
}else{ // 不存在cookie,会出错,所以直接返回login页面
location.href="/login.jsp";
}
}
}
});
return flag;
}
function gridSave(){
var flag = checkSession();
if(flag){
return;
}else{
showLoading();
mygrid.save('',function(){
closeLoading();
})
}
}
// 重启服务后生成功能号
$(function(){
$.post("/getRealUrl.do",function(data){
if(data.error=="true"){
alert(data.info);
}else{
if(data.formId!=""){ // 获取需要重新生成的功能号
if(data.formId=="all"){
// addTab('一键生成','','','','/buildv2.do?m=a','',{isFlowChart:true})
$.post('/buildv2.do?m=a');
}else{
$.post('/buildv2.do?m=a',{'list':data.formId});
}
// 将需要生成 的功能号进行清空
$.post('/property.do',{'formId':''});
}
}
},'json')
})
/**
* css样式编辑器 xin 2024-1-29 10:34:34
* @param grid
* @param panel
*/
//getTextCssEdit(option)//option是格线当前行触发的对象可以获取值和返回
var textCssOption={};
function getTextCssEdit(option){
if (option && option.close) {//关闭
if (option.type == 1 && option.value != null) {//给面板赋值
$doc(textCssOption.id).val(option.value);
}
layer.closeAll();
return false;
}
let cssText = "";
let type = 0;
let pindex = 0;
if (typeof (panIndex) != "undefined") {
pindex = panIndex;
}
textCssOption = option;
if (option && option.id) {//获取值(面板)
if (option.index != null) {//取对应元素的控件值
panIndex = option.index;
cssText = $doc(option.id).val();
} else {
cssText = $("#" + option.id).val();
}
type = 1;//面板控件
}
if(option.grid || option.value){//获取值(格线)
cssText=option.value;
}
layer.open({
type: 2,
area: ['400px', '780px'],
closeBtn: 0,
isOutAnim: false,
title: false,
resize: false,
fixed: false,
shade: 0.6,
skin: 'layui-layer-molv',
shadeClose: false, // 点击遮罩区域,关闭弹层,
content: encodeURL('/general/textCssEdit/textCssEdit.html?cssText=' + cssText + '&type=' + type + '&grid=' + option.grid),//cssText有值时候可以传过去
move: false,
success: function (layero, index) {
// createFormElement();
}, cancel: function (index, layero) {
panIndex = pindex;
}, end: function () {
panIndex = pindex;
}
});
}
function checkVersion(){
setTimeout(checkVersion, 86400000);
setTimeout(checkVersion2, 86400000);//24小时调用一次
}
function checkVersion2(){
parent.deskTopShow('版本升级','/versionUpdate/isupdate.jsp?active=zhudong',550,520,'')
}
// 测试$.post
function testfunc(){
$.ajaxError($.post("treeData.jsp"));
}
// 根据单据报表设置的状态显示于隐藏
function reportsdiv(dj,doctaout){
try{
var ent=$('.ReportStatus');
if(ent !=undefined){
$('.ReportStatus').each(function(i){
var status=$(this).data('status')+'';
status=status.split(';');
if(status.indexOf(doctaout)==-1 && status[0]!=""){
$(this).remove();
}
})
}else{
var djs=dj.substring(0,dj.length-1).split("#");
for(var j=0;j>=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}function o(t){for(var e=0;0!=t;)t&=t-1,++e;return e}var h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function c(t){var e,i,r="";for(e=0;e+3<=t.length;e+=3)i=parseInt(t.substring(e,e+3),16),r+=h.charAt(i>>6)+h.charAt(63&i);for(e+1==t.length?(i=parseInt(t.substring(e,e+1),16),r+=h.charAt(i<<2)):e+2==t.length&&(i=parseInt(t.substring(e,e+2),16),r+=h.charAt(i>>2)+h.charAt((3&i)<<4));0<(3&r.length);)r+="=";return r}function f(t){var e,i="",r=0,n=0;for(e=0;e>2),n=3&s,r=1):1==r?(i+=a(n<<2|s>>4),n=15&s,r=2):2==r?(i+=a(n),i+=a(s>>2),n=3&s,r=3):(i+=a(n<<2|s>>4),i+=a(15&s),r=0))}return 1==r&&(i+=a(n<<2)),i}var l,p=function(t,e){return(p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)};var g,d=function(t){var e;if(void 0===l){var i="0123456789ABCDEF",r=" \f\n\r\t \u2028\u2029";for(l={},e=0;e<16;++e)l[i.charAt(e)]=e;for(i=i.toLowerCase(),e=10;e<16;++e)l[i.charAt(e)]=e;for(e=0;e>16,r[r.length]=n>>8&255,r[r.length]=255&n,s=n=0):n<<=6}}switch(s){case 1:throw new Error("Base64 encoding incomplete: at least 2 bits missing");case 2:r[r.length]=n>>10;break;case 3:r[r.length]=n>>16,r[r.length]=n>>8&255}return r},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(t){var e=v.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 v.decode(t)}},m=1e13,y=function(){function t(t){this.buf=[+t||0]}return t.prototype.mulAdd=function(t,e){var i,r,n=this.buf,s=n.length;for(i=0;ie&&(t=t.substring(0,e)+b),t}var w,D=function(){function i(t,e){this.hexDigits="0123456789ABCDEF",t instanceof i?(this.enc=t.enc,this.pos=t.pos):(this.enc=t,this.pos=e)}return i.prototype.get=function(t){if(void 0===t&&(t=this.pos++),t>=this.enc.length)throw new Error("Requesting byte offset "+t+" on a stream of length "+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>u&1?"1":"0";if(s.length>i)return n+E(s,i)}return n+s},i.prototype.parseOctetString=function(t,e,i){if(this.isASCII(t,e))return E(this.parseStringISO(t,e),i);var r=e-t,n="("+r+" byte)\n";(i/=2)i)return E(r,i);n=new y,s=0}}return 0>6,this.tagConstructed=0!=(32&e),this.tagNumber=31&e,31==this.tagNumber){for(var i=new y;e=t.get(),i.mulAdd(128,127&e),128&e;);this.tagNumber=i.simplify()}}return t.prototype.isUniversal=function(){return 0===this.tagClass},t.prototype.isEOC=function(){return 0===this.tagClass&&0===this.tagNumber},t}(),B=[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],A=(1<<26)/B[B.length-1],O=function(){function b(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))}return b.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<>h)&&(n=!0,s=a(i));0<=o;)h>(h+=this.DB-e)):(i=this[o]>>(h-=e)&r,h<=0&&(h+=this.DB,--o)),0>24},b.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},b.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},b.prototype.toByteArray=function(){var t=this.t,e=[];e[0]=this.s;var i,r=this.DB-t*this.DB%8,n=0;if(0>r)!=(this.s&this.DM)>>r&&(e[n++]=i|this.s<>(r+=this.DB-8)):(i=this[t]>>(r-=8)&255,r<=0&&(r+=this.DB,--t)),0!=(128&i)&&(i|=-256),0==n&&(128&this.s)!=(128&i)&&++n,(0=this.t?0!=this.s:0!=(this[e]&1<>n-a&u:(f=(t[p]&(1<>this.DB+n-a)),h=i;0==(1&f);)f>>=1,--h;if((n-=h)<0&&(n+=this.DB,--p),g)o[f].copyTo(s),g=!1;else{for(;1this.DB?(this[this.t-1]|=(o&(1<>this.DB-s):this[this.t-1]|=o<=this.DB&&(s-=this.DB))}8==i&&0!=(128&+t[0])&&(this.s=-1,0>r|o,o=(this[h]&n)<=this.t)e.t=0;else{var r=t%this.DB,n=this.DB-r,s=(1<>r;for(var o=i+1;o>r;0>=this.DB;if(t.t>=this.DB;r+=this.s}else{for(r+=this.s;i>=this.DB;r-=t.s}e.s=r<0?-1:0,r<-1?e[i++]=this.DV+r:0=e.DV&&(t[i+e.t]-=e.DV,t[i+e.t+1]=1)}0>this.F2:0),l=this.FV/f,p=(1<=i&&(this.dMultiply(r),this.dAddOffset(o,0),o=s=0))}0t&&this.subTo(b.ONE.shiftLeft(t-1),this);else{var r=[],n=7&t;r.length=1+(t>>3),e.nextBytes(r),0>=this.DB;if(t.t>=this.DB;r+=this.s}else{for(r+=this.s;i>=this.DB;r+=t.s}e.s=r<0?-1:0,0=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}},b.prototype.multiplyLowerTo=function(t,e,i){var r=Math.min(this.t+t.t,e);for(i.s=0,i.t=r;0>1)&&(t=B.length);for(var n=M(),s=0;st&&n.subTo(b.ONE.shiftLeft(t-1),n),n.isProbablePrime(e)?setTimeout(function(){r()},0):setTimeout(s,0)};setTimeout(s,0)}else{var o=[],h=7&t;o.length=1+(t>>3),e.nextBytes(o),0>15,this.um=(1<>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)},t.prototype.mulTo=function(t,e,i){t.multiplyTo(e,i),this.reduce(i)},t.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},t}(),P=function(){function t(t){this.m=t,this.r2=M(),this.q3=M(),O.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t)}return t.prototype.convert=function(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=M();return t.copyTo(e),this.reduce(e),e},t.prototype.revert=function(t){return t},t.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)},t.prototype.mulTo=function(t,e,i){t.multiplyTo(e,i),this.reduce(i)},t.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},t}();function M(){return new O(null)}function q(t,e){return new O(t,e)}"Microsoft Internet Explorer"==navigator.appName?(O.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},w=30):"Netscape"!=navigator.appName?(O.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},w=26):(O.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},w=28),O.prototype.DB=w,O.prototype.DM=(1<>>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}O.ZERO=F(0),O.ONE=F(1);var K=function(){function t(){this.i=0,this.j=0,this.S=[]}return t.prototype.init=function(t){var e,i,r;for(e=0;e<256;++e)this.S[e]=e;for(e=i=0;e<256;++e)i=i+this.S[e]+t[e%t.length]&255,r=this.S[e],this.S[e]=this.S[i],this.S[i]=r;this.i=0,this.j=0},t.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]},t}();var k,_,z=256,Z=null;if(null==Z){Z=[];var G=void(_=0);if(window.crypto&&window.crypto.getRandomValues){var $=new Uint32Array(256);for(window.crypto.getRandomValues($),G=0;G<$.length;++G)Z[_++]=255&$[G]}var Y=function(t){if(this.count=this.count||0,256<=this.count||z<=_)window.removeEventListener?window.removeEventListener("mousemove",Y,!1):window.detachEvent&&window.detachEvent("onmousemove",Y);else try{var e=t.x+t.y;Z[_++]=255&e,this.count+=1}catch(t){}};window.addEventListener?window.addEventListener("mousemove",Y,!1):window.attachEvent&&window.attachEvent("onmousemove",Y)}function J(){if(null==k){for(k=new K;_>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 X,o=[];2>3);if(null==e)return null;var i=this.doPublic(e);if(null==i)return null;var r=i.toString(16);return 0==(1&r.length)?r:"0"+r},t.prototype.setPrivate=function(t,e,i){null!=t&&null!=e&&0>1;this.e=parseInt(e,16);for(var n=new O(e,16);;){for(;this.p=new O(t-r,1,i),0!=this.p.subtract(O.ONE).gcd(n).compareTo(O.ONE)||!this.p.isProbablePrime(10););for(;this.q=new O(r,1,i),0!=this.q.subtract(O.ONE).gcd(n).compareTo(O.ONE)||!this.q.isProbablePrime(10););if(this.p.compareTo(this.q)<=0){var s=this.p;this.p=this.q,this.q=s}var o=this.p.subtract(O.ONE),h=this.q.subtract(O.ONE),a=o.multiply(h);if(0==a.gcd(n).compareTo(O.ONE)){this.n=this.p.multiply(this.q),this.d=n.modInverse(a),this.dmp1=this.d.mod(o),this.dmq1=this.d.mod(h),this.coeff=this.q.modInverse(this.p);break}}},t.prototype.decrypt=function(t){var e=q(t,16),i=this.doPrivate(e);return null==i?null:function(t,e){var i=t.toByteArray(),r=0;for(;r=i.length)return null;var n="";for(;++r>3)},t.prototype.generateAsync=function(t,e,n){var s=new X,o=t>>1;this.e=parseInt(e,16);var h=new O(e,16),a=this,u=function(){var e=function(){if(a.p.compareTo(a.q)<=0){var t=a.p;a.p=a.q,a.q=t}var e=a.p.subtract(O.ONE),i=a.q.subtract(O.ONE),r=e.multiply(i);0==r.gcd(h).compareTo(O.ONE)?(a.n=a.p.multiply(a.q),a.d=h.modInverse(r),a.dmp1=a.d.mod(e),a.dmq1=a.d.mod(i),a.coeff=a.q.modInverse(a.p),setTimeout(function(){n()},0)):setTimeout(u,0)},i=function(){a.q=M(),a.q.fromNumberAsync(o,1,s,function(){a.q.subtract(O.ONE).gcda(h,function(t){0==t.compareTo(O.ONE)&&a.q.isProbablePrime(10)?setTimeout(e,0):setTimeout(i,0)})})},r=function(){a.p=M(),a.p.fromNumberAsync(t-o,1,s,function(){a.p.subtract(O.ONE).gcda(h,function(t){0==t.compareTo(O.ONE)&&a.p.isProbablePrime(10)?setTimeout(i,0):setTimeout(r,0)})})};setTimeout(r,0)};setTimeout(u,0)},t.prototype.sign=function(t,e,i){var r=function(t,e){if(e=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){var o=new Date(Date.UTC(t,e-1,i,r,n,s,0));this.setByDate(o)},this.getFreshValueHex=function(){return this.hV}},tt.lang.extend(et.asn1.DERAbstractTime,et.asn1.ASN1Object),et.asn1.DERAbstractStructured=function(t){et.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)},tt.lang.extend(et.asn1.DERAbstractStructured,et.asn1.ASN1Object),et.asn1.DERBoolean=function(){et.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV="0101ff"},tt.lang.extend(et.asn1.DERBoolean,et.asn1.ASN1Object),et.asn1.DERInteger=function(t){et.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=et.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){var e=new O(String(t),10);this.setByBigInteger(e)},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))},tt.lang.extend(et.asn1.DERInteger,et.asn1.ASN1Object),et.asn1.DERBitString=function(t){if(void 0!==t&&void 0!==t.obj){var e=et.asn1.ASN1Util.newObject(t.obj);t.hex="00"+e.getEncodedHex()}et.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