Updated built-in MeshCommander with improved IDE-redirect.

This commit is contained in:
Ylian Saint-Hilaire 2022-07-05 21:46:18 -07:00
parent 4c45dca3d6
commit 08feb51616
12 changed files with 6809 additions and 6780 deletions

View File

@ -57,6 +57,9 @@ module.exports = function CreateAmtRemoteIder() {
var IDE_ModeSence_Ls120Error_Recovery_Array = new Buffer([0x00, 0x12, 0x31, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0A, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00]);
var IDE_ModeSence_CDError_Recovery_Array = new Buffer([0x00, 0x0E, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x06, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00]);
// CD info and performance
var RD_CD_DiskInfo = new Buffer([0x00, 0x20, 0x0e, 0x01, 0x01, 0x01, 0x01, 0x20, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]);
var RD_CD_Performance = new Buffer([0x00, 0x00, 0x00, 0x04, 0x02, 0x00, 0x00, 0x00]);
// Private method, called by parent when it change state
obj.xxStateChange = function (newstate) {
@ -528,6 +531,12 @@ module.exports = function CreateAmtRemoteIder() {
obj.SendDataToHost(dev, true, r, featureRegister & 1);
}
break;
case 0x51: // READ_DISK_INFORMATION
obj.SendDataToHost(dev, true, RD_CD_DiskInfo, featureRegister & 1);
break;
case 0xAC: // GET_PERFORMANCE
obj.SendDataToHost(dev, true, RD_CD_Performance, featureRegister & 1);
break;
default: // UNKNOWN COMMAND
if (obj.debug) console.log("IDER: Unknown SCSI command", cdb[0]);
obj.SendCommandEndResponse(0, 0x05, dev, 0x20, 0x00);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -35,7 +35,7 @@ String.fromCharCode(0,x.length&255,x.length>>8,0,c?180:181,0,2,0,g&255,g>>8,a,88
if(e.acc.length<30+a)break;e.iderinfo={};e.iderinfo.major=e.acc.charCodeAt(8);e.iderinfo.minor=e.acc.charCodeAt(9);e.iderinfo.fwmajor=e.acc.charCodeAt(10);e.iderinfo.fwminor=e.acc.charCodeAt(11);e.iderinfo.readbfr=ReadShortX(e.acc,16);e.iderinfo.writebfr=ReadShortX(e.acc,18);e.iderinfo.proto=e.acc.charCodeAt(21);e.iderinfo.iana=ReadIntX(e.acc,25);b(e.iderinfo);0!=e.iderinfo.proto&&(b("Unknown proto",e.iderinfo.proto),e.Stop());8192<e.iderinfo.readbfr&&(b("Illegal read buffer size",e.iderinfo.readbfr),
e.Stop());8192<e.iderinfo.writebfr&&(b("Illegal write buffer size",e.iderinfo.writebfr),e.Stop());0==e.iderStart?e.SendDisableEnableFeatures(3,IntToStrX(9)):1==e.iderStart?e.SendDisableEnableFeatures(3,IntToStrX(17)):2==e.iderStart&&e.SendDisableEnableFeatures(3,IntToStrX(25));return 30+a;case 67:return b("CLOSE"),e.Stop(),8;case 68:return e.SendCommand(69),8;case 69:return b("PONG"),8;case 70:if(9>e.acc.length)break;a=e.acc.charCodeAt(8);null===q?(e.SendCommand(71),b("RESETOCCURED1",a)):(N=!0,b("RESETOCCURED2",
a));return 9;case 73:if(13>e.acc.length)break;var a=e.acc.charCodeAt(8),x=ReadIntX(e.acc,9);b("STATUS_DATA",a,x);switch(a){case 1:x&1&&(0==e.iderStart?e.SendDisableEnableFeatures(3,IntToStrX(9)):1==e.iderStart?e.SendDisableEnableFeatures(3,IntToStrX(17)):2==e.iderStart&&e.SendDisableEnableFeatures(3,IntToStrX(25)));break;case 2:e.enabled=x&2?!0:!1;b("IDER Status: "+e.enabled);break;case 3:1!=x&&b("Register toggle failure")}return 13;case 74:if(11>e.acc.length)break;b("IDER: ABORT",e.acc.charCodeAt(8));
return 11;case 75:return 8;case 80:if(28>e.acc.length)break;var a=e.acc.charCodeAt(14)&16?176:160,x=e.acc.charCodeAt(14),g=e.acc.substring(16,28),p=e.acc.charCodeAt(9);b("SCSI_CMD",a,rstr2hex(g),p,x);c(a,g,p,x);return 28;case 83:if(14>e.acc.length)break;a=ReadShortX(e.acc,9);if(e.acc.length<14+a)break;b("SCSI_WRITE, len = "+(14+a));e.SendCommand(81,String.fromCharCode(0,0,0,0,0,0,0,0,0,0,0,0,135,112,3,0,0,0,160,81,7,39,0),!0);return 14+a;default:b("Unknown IDER command",e.acc[0]),e.Stop()}return 0};
return 11;case 75:return 8;case 80:if(28>e.acc.length)break;var a=e.acc.charCodeAt(14)&16?176:160,x=e.acc.charCodeAt(14),g=e.acc.substring(16,28),d=e.acc.charCodeAt(9);b("SCSI_CMD",a,rstr2hex(g),d,x);c(a,g,d,x);return 28;case 83:if(14>e.acc.length)break;a=ReadShortX(e.acc,9);if(e.acc.length<14+a)break;b("SCSI_WRITE, len = "+(14+a));e.SendCommand(81,String.fromCharCode(0,0,0,0,0,0,0,0,0,0,0,0,135,112,3,0,0,0,160,81,7,39,0),!0);return 14+a;default:b("Unknown IDER command",e.acc[0]),e.Stop()}return 0};
var H=[],N=!1,q=null,T,P,F;return e},CreateAmtRemoteServerIder=function(){function b(){urlvars&&urlvars.idertrace&&console.log.apply(console,[].concat($jscomp.arrayFromArguments(arguments)))}var c={protocol:4,iderStart:0,floppy:null,cdrom:null,state:0,onStateChanged:null,m:{sectorStats:null,onDialogPrompt:null,dialogPrompt:function(a){c.socket.send(JSON.stringify({action:"dialogResponse",args:a}))},bytesToAmt:0,bytesFromAmt:0,server:!0,Stop:function(){c.Stop()}},xxStateChange:function(a){if(c.state!=
a&&(b("SIDER-StateChange",a),c.state=a,null!=c.onStateChanged))c.onStateChanged(c,c.state)},Start:function(a,d,e,v,n){b("SIDER-Start",a,d,e,v,n);c.host=a;c.port=d;c.user=e;c.pass=v;c.connectstate=0;c.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webider.ashx?host="+a+"&port="+d+"&tls="+n+("*"==e?"&serverauth=1":"")+("undefined"===typeof v?"&serverauth=1&user="+e:"")+"&tls1only="+
c.tlsv1only);c.socket.onopen=c.xxOnSocketConnected;c.socket.onmessage=c.xxOnMessage;c.socket.onclose=c.xxOnSocketClosed;c.xxStateChange(1)},Stop:function(){b("SIDER-Stop");null!=c.socket&&(c.socket.close(),c.socket=null);c.xxStateChange(0)},xxOnSocketConnected:function(){c.xxStateChange(2);c.socket.send(JSON.stringify({action:"start"}))},xxOnMessage:function(a){var b=null;try{b=JSON.parse(a.data)}catch(e){}if(null!=b&&"string"==typeof b.action)switch(b.action){case "dialog":if(null!=c.m.onDialogPrompt)c.m.onDialogPrompt(c,
@ -57,13 +57,13 @@ g.PendingAjax.shift();b[1](null,a,b[2])}null!=g.websocket&&(g.websocket.close(),
function(a,b,n,l,p){d.host=a;d.port=b;d.user=n;d.pass=l;d.connectstate=0;d.inDataCount=0;a=window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webrelay.ashx?p=2&host="+a+"&port="+b+"&tls="+p+("*"==n?"&serverauth=1":"")+("undefined"===typeof l?"&serverauth=1&user="+n:"");null!=c&&""!=c&&(a+="&auth="+c);d.socket=new WebSocket(a);d.socket.binaryType="arraybuffer";d.socket.onopen=d.xxOnSocketConnected;
d.socket.onmessage=d.xxOnMessage;d.socket.onclose=d.xxOnSocketClosed;d.xxStateChange(1)};d.xxOnSocketConnected=function(){d.xxStateChange(2);1==d.protocol&&d.directSend(new Uint8Array([16,0,0,0,83,79,76,32]));2==d.protocol&&d.directSend(new Uint8Array([16,1,0,0,75,86,77,82]));3==d.protocol&&d.directSend(new Uint8Array([16,0,0,0,73,68,69,82]))};d.xxOnMessage=function(b){if(b.data&&-1!=d.connectstate){d.inDataCount++;if(1==d.connectstate&&(2==d.protocol||3==d.protocol))return d.m.ProcessBinaryData?
d.m.ProcessBinaryData(b.data):d.m.ProcessData(a(new Uint8Array(b.data)));if(null==d.acc)d.acc=b.data;else{var c=new Uint8Array(d.acc.byteLength+b.data.byteLength);c.set(new Uint8Array(d.acc),0);c.set(new Uint8Array(b.data),d.acc.byteLength);d.acc=c.buffer}for(;null!=d.acc&&1<=d.acc.byteLength;){b=0;var n=new Uint8Array(d.acc);switch(n[0]){case 17:if(4>n.byteLength)return;switch(n[1]){case 0:if(13>n.byteLength)return;b=n[12];if(n.byteLength<13+b)return;d.directSend(new Uint8Array([19,0,0,0,0,0,0,0,
0]));b=13+b;break;default:d.Stop(1)}break;case 20:if(9>n.byteLength)return;b=(new DataView(d.acc)).getUint32(5,!0);if(n.byteLength<9+b)return;var l=n[1],c=n[4],p=[];for(i=0;i<b;i++)p.push(n[9+i]);n=new Uint8Array(d.acc.slice(9,9+b));b=9+b;if(0==c)console.log("aaa",p),0<=p.indexOf(4)?d.xxSend(String.fromCharCode(19,0,0,0,4)+IntToStrX(d.user.length+d.authuri.length+8)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(0,0)+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(0,
0,0,0)):d.Stop(2);else if(3!=c&&4!=c||1!=l)if(0==l)switch(d.protocol){case 1:d.xxSend(String.fromCharCode(32,0,0,0)+IntToStrX(d.amtsequence++)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+IntToStrX(0));break;case 2:d.directSend(new Uint8Array([64,0,0,0,0,0,0,0]));break;case 3:d.connectstate=1,d.xxStateChange(3)}else d.Stop(3);else{var r=0,p=n[r],l=a(new Uint8Array(n.buffer.slice(r+1,r+1+p))),r=r+(p+1),g=n[r],p=a(new Uint8Array(n.buffer.slice(r+
1,r+1+g))),r=r+(g+1),g=0,g=null,C;C="";for(var w=0;32>w;w++)C+="abcdef0123456789".charAt(Math.floor(16*Math.random()));w="";4==c&&(g=n[r],g=a(new Uint8Array(n.buffer.slice(r+1,r+1+g))),w="00000002:"+C+":"+g+":");n=hex_md5(hex_md5(d.user+":"+l+":"+d.pass)+":"+p+":"+w+hex_md5("POST:"+d.authuri));r=d.user.length+l.length+p.length+d.authuri.length+C.length+8+n.length+7;4==c&&(r+=g.length+1);n=String.fromCharCode(19,0,0,0,c)+IntToStrX(r)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(l.length)+
l+String.fromCharCode(p.length)+p+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(C.length)+C+String.fromCharCode(8)+"00000002"+String.fromCharCode(n.length)+n;4==c&&(n+=String.fromCharCode(g.length)+g);d.xxSend(n)}break;case 33:if(23>n.byteLength)break;b=23;d.xxSend(String.fromCharCode(39,0,0,0)+IntToStrX(d.amtsequence++)+String.fromCharCode(0,0,27,0,0,0));1==d.protocol&&(d.amtkeepalivetimer=setInterval(d.xxSendAmtKeepAlive,2E3));d.connectstate=1;d.xxStateChange(3);break;case 41:if(10>
n.byteLength)break;b=10;break;case 42:if(10>n.byteLength)break;c=10+(n[9]<<8)+n[8];if(n.byteLength<c)break;d.m.ProcessBinaryData?d.m.ProcessBinaryData(new Uint8Array(n.buffer.slice(10,c))):d.m.ProcessData(a(new Uint8Array(n.buffer.slice(10,c))));b=c;break;case 43:if(8>n.byteLength)break;b=8;break;case 65:if(8>n.byteLength)break;d.connectstate=1;d.m.Start();8<n.byteLength&&(d.m.ProcessBinaryData?d.m.ProcessBinaryData(new Uint8Array(n.buffer.slice(8))):d.m.ProcessData(a(new Uint8Array(n.buffer.slice(8)))));
b=n.byteLength;break;case 240:d.serverIsRecording=!0;b=1;break;default:console.log("Unknown Intel AMT command: "+n[0]+" acclen="+n.byteLength);d.Stop(4);return}if(0==b)break;d.acc=b!=d.acc.byteLength?d.acc.slice(b):null}}};d.directSend=function(a){try{d.socket.send(a.buffer)}catch(b){}};d.xxSend=function(a){if(null!=d.socket&&d.socket.readyState==WebSocket.OPEN){for(var b=new Uint8Array(a.length),c=0;c<a.length;++c)b[c]=a.charCodeAt(c);try{d.socket.send(b.buffer)}catch(l){}}};d.Send=d.send=function(a){null!=
d.socket&&1==d.connectstate&&(1==d.protocol?d.xxSend(String.fromCharCode(40,0,0,0)+IntToStrX(d.amtsequence++)+ShortToStrX(a.length)+a):d.xxSend(a))};d.xxSendAmtKeepAlive=function(){null!=d.socket&&d.xxSend(String.fromCharCode(43,0,0,0)+IntToStrX(d.amtsequence++))};d.xxOnSocketClosed=function(){0==d.inDataCount&&0==d.tlsv1only?(d.tlsv1only=1,d.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+
0]));b=13+b;break;default:d.Stop(1)}break;case 20:if(9>n.byteLength)return;b=(new DataView(d.acc)).getUint32(5,!0);if(n.byteLength<9+b)return;var l=n[1],c=n[4],p=[];for(i=0;i<b;i++)p.push(n[9+i]);n=new Uint8Array(d.acc.slice(9,9+b));b=9+b;if(0==c)0<=p.indexOf(4)?d.xxSend(String.fromCharCode(19,0,0,0,4)+IntToStrX(d.user.length+d.authuri.length+8)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(0,0)+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(0,0,0,0)):d.Stop(2);
else if(3!=c&&4!=c||1!=l)if(0==l)switch(d.protocol){case 1:d.xxSend(String.fromCharCode(32,0,0,0)+IntToStrX(d.amtsequence++)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+IntToStrX(0));break;case 2:d.directSend(new Uint8Array([64,0,0,0,0,0,0,0]));break;case 3:d.connectstate=1,d.xxStateChange(3)}else d.Stop(3);else{var r=0,p=n[r],l=a(new Uint8Array(n.buffer.slice(r+1,r+1+p))),r=r+(p+1),g=n[r],p=a(new Uint8Array(n.buffer.slice(r+1,r+1+g))),r=r+(g+
1),g=0,g=null,C;C="";for(var w=0;32>w;w++)C+="abcdef0123456789".charAt(Math.floor(16*Math.random()));w="";4==c&&(g=n[r],g=a(new Uint8Array(n.buffer.slice(r+1,r+1+g))),w="00000002:"+C+":"+g+":");n=hex_md5(hex_md5(d.user+":"+l+":"+d.pass)+":"+p+":"+w+hex_md5("POST:"+d.authuri));r=d.user.length+l.length+p.length+d.authuri.length+C.length+8+n.length+7;4==c&&(r+=g.length+1);n=String.fromCharCode(19,0,0,0,c)+IntToStrX(r)+String.fromCharCode(d.user.length)+d.user+String.fromCharCode(l.length)+l+String.fromCharCode(p.length)+
p+String.fromCharCode(d.authuri.length)+d.authuri+String.fromCharCode(C.length)+C+String.fromCharCode(8)+"00000002"+String.fromCharCode(n.length)+n;4==c&&(n+=String.fromCharCode(g.length)+g);d.xxSend(n)}break;case 33:if(23>n.byteLength)break;b=23;d.xxSend(String.fromCharCode(39,0,0,0)+IntToStrX(d.amtsequence++)+String.fromCharCode(0,0,27,0,0,0));1==d.protocol&&(d.amtkeepalivetimer=setInterval(d.xxSendAmtKeepAlive,2E3));d.connectstate=1;d.xxStateChange(3);break;case 41:if(10>n.byteLength)break;b=10;
break;case 42:if(10>n.byteLength)break;c=10+(n[9]<<8)+n[8];if(n.byteLength<c)break;d.m.ProcessBinaryData?d.m.ProcessBinaryData(new Uint8Array(n.buffer.slice(10,c))):d.m.ProcessData(a(new Uint8Array(n.buffer.slice(10,c))));b=c;break;case 43:if(8>n.byteLength)break;b=8;break;case 65:if(8>n.byteLength)break;d.connectstate=1;d.m.Start();8<n.byteLength&&(d.m.ProcessBinaryData?d.m.ProcessBinaryData(new Uint8Array(n.buffer.slice(8))):d.m.ProcessData(a(new Uint8Array(n.buffer.slice(8)))));b=n.byteLength;
break;case 240:d.serverIsRecording=!0;b=1;break;default:console.log("Unknown Intel AMT command: "+n[0]+" acclen="+n.byteLength);d.Stop(4);return}if(0==b)break;d.acc=b!=d.acc.byteLength?d.acc.slice(b):null}}};d.directSend=function(a){try{d.socket.send(a.buffer)}catch(b){}};d.xxSend=function(a){if(null!=d.socket&&d.socket.readyState==WebSocket.OPEN){for(var b=new Uint8Array(a.length),c=0;c<a.length;++c)b[c]=a.charCodeAt(c);try{d.socket.send(b.buffer)}catch(l){}}};d.Send=d.send=function(a){null!=d.socket&&
1==d.connectstate&&(1==d.protocol?d.xxSend(String.fromCharCode(40,0,0,0)+IntToStrX(d.amtsequence++)+ShortToStrX(a.length)+a):d.xxSend(a))};d.xxSendAmtKeepAlive=function(){null!=d.socket&&d.xxSend(String.fromCharCode(43,0,0,0)+IntToStrX(d.amtsequence++))};d.xxOnSocketClosed=function(){0==d.inDataCount&&0==d.tlsv1only?(d.tlsv1only=1,d.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+
"/webrelay.ashx?p=2&host="+d.host+"&port="+d.port+"&tls="+d.tls+"&tls1only=1"+("*"==d.user?"&serverauth=1":"")+("undefined"===typeof pass?"&serverauth=1&user="+d.user:"")),d.socket.binaryType="arraybuffer",d.socket.onopen=d.xxOnSocketConnected,d.socket.onmessage=d.xxOnMessage,d.socket.onclose=d.xxOnSocketClosed):d.Stop(5)};d.xxStateChange=function(a){if(d.State!=a&&(d.State=a,d.m.xxStateChange(d.State),null!=d.onStateChanged))d.onStateChanged(d,d.State)};d.Stop=function(a){d.xxStateChange(0);d.connectstate=
-1;d.acc=null;null!=d.socket&&(d.socket.close(),d.socket=null);null!=d.amtkeepalivetimer&&(clearInterval(d.amtkeepalivetimer),d.amtkeepalivetimer=null)};return d},WsmanStackCreateService=function(b,c,a,d,e,v){function n(a){for(var b,c={},p=0;p<a.childNodes.length;p++){var d=a.childNodes[p];b=null==d.childElementCount||0==d.childElementCount?d.textContent:n(d);"true"==b&&(b=!0);"false"==b&&(b=!1);parseInt(b)+""===b&&(b=parseInt(b));var k=b;if(null!=d.attributes&&0<d.attributes.length)for(k={Value:b},
b=0;b<d.attributes.length;b++)k["@"+d.attributes[b].name]=d.attributes[b].value;c[d.localName]instanceof Array?c[d.localName].push(k):c[d.localName]=null==c[d.localName]?k:[c[d.localName],k]}return c}function l(a){if(!a)return"";var b="",c;for(c in a)a.hasOwnProperty(c)&&0===c.indexOf("@")&&(b+=" "+c.substring(1)+'="'+a[c]+'"');return b}function p(a){if(!a)return"";if("string"==typeof a)return a;if(a.InstanceID)return'<w:SelectorSet><w:Selector Name="InstanceID">'+a.InstanceID+"</w:Selector></w:SelectorSet>";
@ -398,32 +398,32 @@ c.prototype.fromInt=function(a){this.t=1;this.s=0>a?-1:0;0<a?this.data[0]=a:-1>a
h>>this.DB-p):this.data[this.t-1]|=h<<p,p+=d,p>=this.DB&&(p-=this.DB))}8==d&&0!=(a[0]&128)&&(this.s=-1,0<p&&(this.data[this.t-1]|=(1<<this.DB-p)-1<<p));this.clamp();e&&c.ZERO.subTo(this,this)};c.prototype.clamp=function(){for(var a=this.s&this.DM;0<this.t&&this.data[this.t-1]==a;)--this.t};c.prototype.dlShiftTo=function(a,b){var c;for(c=this.t-1;0<=c;--c)b.data[c+a]=this.data[c];for(c=a-1;0<=c;--c)b.data[c]=0;b.t=this.t+a;b.s=this.s};c.prototype.drShiftTo=function(a,b){for(var c=a;c<this.t;++c)b.data[c-
a]=this.data[c];b.t=Math.max(this.t-a,0);b.s=this.s};c.prototype.lShiftTo=function(a,b){var c=a%this.DB,d=this.DB-c,g=(1<<d)-1,p=Math.floor(a/this.DB),e=this.s<<c&this.DM,h;for(h=this.t-1;0<=h;--h)b.data[h+p+1]=this.data[h]>>d|e,e=(this.data[h]&g)<<c;for(h=p-1;0<=h;--h)b.data[h]=0;b.data[p]=e;b.t=this.t+p+1;b.s=this.s;b.clamp()};c.prototype.rShiftTo=function(a,b){b.s=this.s;var c=Math.floor(a/this.DB);if(c>=this.t)b.t=0;else{var d=a%this.DB,g=this.DB-d,p=(1<<d)-1;b.data[0]=this.data[c]>>d;for(var e=
c+1;e<this.t;++e)b.data[e-c-1]|=(this.data[e]&p)<<g,b.data[e-c]=this.data[e]>>d;0<d&&(b.data[this.t-c-1]|=(this.s&p)<<g);b.t=this.t-c;b.clamp()}};c.prototype.subTo=function(a,b){for(var c=0,d=0,g=Math.min(a.t,this.t);c<g;)d+=this.data[c]-a.data[c],b.data[c++]=d&this.DM,d>>=this.DB;if(a.t<this.t){for(d-=a.s;c<this.t;)d+=this.data[c],b.data[c++]=d&this.DM,d>>=this.DB;d+=this.s}else{for(d+=this.s;c<a.t;)d-=a.data[c],b.data[c++]=d&this.DM,d>>=this.DB;d-=a.s}b.s=0>d?-1:0;-1>d?b.data[c++]=this.DV+d:0<d&&
(b.data[c++]=d);b.t=c;b.clamp()};c.prototype.multiplyTo=function(a,b){var d=this.abs(),g=a.abs(),p=d.t;for(b.t=p+g.t;0<=--p;)b.data[p]=0;for(p=0;p<g.t;++p)b.data[p+d.t]=d.am(0,g.data[p],b,p,0,d.t);b.s=0;b.clamp();this.s!=a.s&&c.ZERO.subTo(b,b)};c.prototype.squareTo=function(a){for(var b=this.abs(),c=a.t=2*b.t;0<=--c;)a.data[c]=0;for(c=0;c<b.t-1;++c){var d=b.am(c,b.data[c],a,2*c,0,1);(a.data[c+b.t]+=b.am(c+1,2*b.data[c],a,2*c+1,d,b.t-c-1))>=b.DV&&(a.data[c+b.t]-=b.DV,a.data[c+b.t+1]=1)}0<a.t&&(a.data[a.t-
1]+=b.am(c,b.data[c],a,2*c,0,1));a.s=0;a.clamp()};c.prototype.divRemTo=function(a,b,p){var e=a.abs();if(!(0>=e.t)){var y=this.abs();if(y.t<e.t)null!=b&&b.fromInt(0),null!=p&&this.copyTo(p);else{null==p&&(p=d());var k=d(),m=this.s;a=a.s;var l=this.DB-h(e.data[e.t-1]);0<l?(e.lShiftTo(l,k),y.lShiftTo(l,p)):(e.copyTo(k),y.copyTo(p));e=k.t;y=k.data[e-1];if(0!=y){var E=y*(1<<this.F1)+(1<e?k.data[e-2]>>this.F2:0),q=this.FV/E,E=(1<<this.F1)/E,A=1<<this.F2,u=p.t,x=u-e,w=null==b?d():b;k.dlShiftTo(x,w);0<=p.compareTo(w)&&
(p.data[p.t++]=1,p.subTo(w,p));c.ONE.dlShiftTo(e,w);for(w.subTo(k,k);k.t<e;)k.data[k.t++]=0;for(;0<=--x;){var O=p.data[--u]==y?this.DM:Math.floor(p.data[u]*q+(p.data[u-1]+A)*E);if((p.data[u]+=k.am(0,O,p,x,0,e))<O)for(k.dlShiftTo(x,w),p.subTo(w,p);p.data[u]<--O;)p.subTo(w,p)}null!=b&&(p.drShiftTo(e,b),m!=a&&c.ZERO.subTo(b,b));p.t=e;p.clamp();0<l&&p.rShiftTo(l,p);0>m&&c.ZERO.subTo(p,p)}}}};c.prototype.invDigit=function(){if(1>this.t)return 0;var a=this.data[0];if(0==(a&1))return 0;var b=a&3,b=b*(2-
(a&15)*b)&15,b=b*(2-(a&255)*b)&255,b=b*(2-((a&65535)*b&65535))&65535,b=b*(2-a*b%this.DV)%this.DV;return 0<b?this.DV-b:-b};c.prototype.isEven=function(){return 0==(0<this.t?this.data[0]&1:this.s)};c.prototype.exp=function(a,b){if(4294967295<a||1>a)return c.ONE;var p=d(),e=d(),y=b.convert(this),k=h(a)-1;for(y.copyTo(p);0<=--k;)if(b.sqrTo(p,e),0<(a&1<<k))b.mulTo(e,y,p);else var l=p,p=e,e=l;return b.revert(p)};c.prototype.toString=function(a){if(0>this.s)return"-"+this.negate().toString(a);if(16==a)a=
4;else if(8==a)a=3;else if(2==a)a=1;else if(32==a)a=5;else if(4==a)a=2;else return this.toRadix(a);var b=(1<<a)-1,c,d=!1,p="",g=this.t,e=this.DB-g*this.DB%a;if(0<g--)for(e<this.DB&&0<(c=this.data[g]>>e)&&(d=!0,p="0123456789abcdefghijklmnopqrstuvwxyz".charAt(c));0<=g;)e<a?(c=(this.data[g]&(1<<e)-1)<<a-e,c|=this.data[--g]>>(e+=this.DB-a)):(c=this.data[g]>>(e-=a)&b,0>=e&&(e+=this.DB,--g)),0<c&&(d=!0),d&&(p+="0123456789abcdefghijklmnopqrstuvwxyz".charAt(c));return d?p:"0"};c.prototype.negate=function(){var a=
(b.data[c++]=d);b.t=c;b.clamp()};c.prototype.multiplyTo=function(a,b){var d=this.abs(),g=a.abs(),e=d.t;for(b.t=e+g.t;0<=--e;)b.data[e]=0;for(e=0;e<g.t;++e)b.data[e+d.t]=d.am(0,g.data[e],b,e,0,d.t);b.s=0;b.clamp();this.s!=a.s&&c.ZERO.subTo(b,b)};c.prototype.squareTo=function(a){for(var b=this.abs(),c=a.t=2*b.t;0<=--c;)a.data[c]=0;for(c=0;c<b.t-1;++c){var d=b.am(c,b.data[c],a,2*c,0,1);(a.data[c+b.t]+=b.am(c+1,2*b.data[c],a,2*c+1,d,b.t-c-1))>=b.DV&&(a.data[c+b.t]-=b.DV,a.data[c+b.t+1]=1)}0<a.t&&(a.data[a.t-
1]+=b.am(c,b.data[c],a,2*c,0,1));a.s=0;a.clamp()};c.prototype.divRemTo=function(a,b,e){var p=a.abs();if(!(0>=p.t)){var y=this.abs();if(y.t<p.t)null!=b&&b.fromInt(0),null!=e&&this.copyTo(e);else{null==e&&(e=d());var k=d(),m=this.s;a=a.s;var l=this.DB-h(p.data[p.t-1]);0<l?(p.lShiftTo(l,k),y.lShiftTo(l,e)):(p.copyTo(k),y.copyTo(e));p=k.t;y=k.data[p-1];if(0!=y){var E=y*(1<<this.F1)+(1<p?k.data[p-2]>>this.F2:0),q=this.FV/E,E=(1<<this.F1)/E,A=1<<this.F2,u=e.t,x=u-p,w=null==b?d():b;k.dlShiftTo(x,w);0<=e.compareTo(w)&&
(e.data[e.t++]=1,e.subTo(w,e));c.ONE.dlShiftTo(p,w);for(w.subTo(k,k);k.t<p;)k.data[k.t++]=0;for(;0<=--x;){var O=e.data[--u]==y?this.DM:Math.floor(e.data[u]*q+(e.data[u-1]+A)*E);if((e.data[u]+=k.am(0,O,e,x,0,p))<O)for(k.dlShiftTo(x,w),e.subTo(w,e);e.data[u]<--O;)e.subTo(w,e)}null!=b&&(e.drShiftTo(p,b),m!=a&&c.ZERO.subTo(b,b));e.t=p;e.clamp();0<l&&e.rShiftTo(l,e);0>m&&c.ZERO.subTo(e,e)}}}};c.prototype.invDigit=function(){if(1>this.t)return 0;var a=this.data[0];if(0==(a&1))return 0;var b=a&3,b=b*(2-
(a&15)*b)&15,b=b*(2-(a&255)*b)&255,b=b*(2-((a&65535)*b&65535))&65535,b=b*(2-a*b%this.DV)%this.DV;return 0<b?this.DV-b:-b};c.prototype.isEven=function(){return 0==(0<this.t?this.data[0]&1:this.s)};c.prototype.exp=function(a,b){if(4294967295<a||1>a)return c.ONE;var e=d(),p=d(),y=b.convert(this),k=h(a)-1;for(y.copyTo(e);0<=--k;)if(b.sqrTo(e,p),0<(a&1<<k))b.mulTo(p,y,e);else var l=e,e=p,p=l;return b.revert(e)};c.prototype.toString=function(a){if(0>this.s)return"-"+this.negate().toString(a);if(16==a)a=
4;else if(8==a)a=3;else if(2==a)a=1;else if(32==a)a=5;else if(4==a)a=2;else return this.toRadix(a);var b=(1<<a)-1,c,d=!1,e="",g=this.t,p=this.DB-g*this.DB%a;if(0<g--)for(p<this.DB&&0<(c=this.data[g]>>p)&&(d=!0,e="0123456789abcdefghijklmnopqrstuvwxyz".charAt(c));0<=g;)p<a?(c=(this.data[g]&(1<<p)-1)<<a-p,c|=this.data[--g]>>(p+=this.DB-a)):(c=this.data[g]>>(p-=a)&b,0>=p&&(p+=this.DB,--g)),0<c&&(d=!0),d&&(e+="0123456789abcdefghijklmnopqrstuvwxyz".charAt(c));return d?e:"0"};c.prototype.negate=function(){var a=
d();c.ZERO.subTo(this,a);return a};c.prototype.abs=function(){return 0>this.s?this.negate():this};c.prototype.compareTo=function(a){var b=this.s-a.s;if(0!=b)return b;var c=this.t,b=c-a.t;if(0!=b)return 0>this.s?-b:b;for(;0<=--c;)if(0!=(b=this.data[c]-a.data[c]))return b;return 0};c.prototype.bitLength=function(){return 0>=this.t?0:this.DB*(this.t-1)+h(this.data[this.t-1]^this.s&this.DM)};c.prototype.mod=function(a){var b=d();this.abs().divRemTo(a,null,b);0>this.s&&0<b.compareTo(c.ZERO)&&a.subTo(b,
b);return b};c.prototype.modPowInt=function(a,b){var c;c=256>a||b.isEven()?new u(b):new v(b);return this.exp(a,c)};c.ZERO=k(0);c.ONE=k(1);R.prototype.convert=y;R.prototype.revert=y;R.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c)};R.prototype.sqrTo=function(a,b){a.squareTo(b)};E.prototype.convert=function(a){if(0>a.s||a.t>2*this.m.t)return a.mod(this.m);if(0>a.compareTo(this.m))return a;var b=d();a.copyTo(b);this.reduce(b);return b};E.prototype.revert=function(a){return a};E.prototype.reduce=function(a){a.drShiftTo(this.m.t-
1,this.r2);a.t>this.m.t+1&&(a.t=this.m.t+1,a.clamp());this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3);for(this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);0>a.compareTo(this.r2);)a.dAddOffset(1,this.m.t+1);for(a.subTo(this.r2,a);0<=a.compareTo(this.m);)a.subTo(this.m,a)};E.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};E.prototype.sqrTo=function(a,b){a.squareTo(b);this.reduce(b)};var T=[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],P=67108864/T[T.length-1];c.prototype.chunkSize=function(a){return Math.floor(Math.LN2*this.DB/Math.log(a))};c.prototype.toRadix=function(a){null==a&&(a=10);if(0==this.signum()||2>a||36<a)return"0";var b=this.chunkSize(a),b=Math.pow(a,
b),c=k(b),p=d(),e=d(),h="";for(this.divRemTo(c,p,e);0<p.signum();)h=(b+e.intValue()).toString(a).substr(1)+h,p.divRemTo(c,p,e);return e.intValue().toString(a)+h};c.prototype.fromRadix=function(a,b){this.fromInt(0);null==b&&(b=10);for(var d=this.chunkSize(b),p=Math.pow(b,d),g=!1,e=0,h=0,y=0;y<a.length;++y){var k=m(a,y);0>k?"-"==a.charAt(y)&&0==this.signum()&&(g=!0):(h=b*h+k,++e>=d&&(this.dMultiply(p),this.dAddOffset(h,0),h=e=0))}0<e&&(this.dMultiply(Math.pow(b,e)),this.dAddOffset(h,0));g&&c.ZERO.subTo(this,
this)};c.prototype.fromNumber=function(a,b,d){if("number"==typeof b)if(2>a)this.fromInt(1);else for(this.fromNumber(a,d),this.testBit(a-1)||this.bitwiseTo(c.ONE.shiftLeft(a-1),x,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(b);)this.dAddOffset(2,0),this.bitLength()>a&&this.subTo(c.ONE.shiftLeft(a-1),this);else{d=[];var p=a&7;d.length=(a>>3)+1;b.nextBytes(d);d[0]=0<p?d[0]&(1<<p)-1:0;this.fromString(d,256)}};c.prototype.bitwiseTo=function(a,b,c){var d,p,g=Math.min(a.t,this.t);for(d=
0;d<g;++d)c.data[d]=b(this.data[d],a.data[d]);if(a.t<this.t){p=a.s&this.DM;for(d=g;d<this.t;++d)c.data[d]=b(this.data[d],p);c.t=this.t}else{p=this.s&this.DM;for(d=g;d<a.t;++d)c.data[d]=b(p,a.data[d]);c.t=a.t}c.s=b(this.s,a.s);c.clamp()};c.prototype.changeBit=function(a,b){var d=c.ONE.shiftLeft(a);this.bitwiseTo(d,b,d);return d};c.prototype.addTo=function(a,b){for(var c=0,d=0,p=Math.min(a.t,this.t);c<p;)d+=this.data[c]+a.data[c],b.data[c++]=d&this.DM,d>>=this.DB;if(a.t<this.t){for(d+=a.s;c<this.t;)d+=
b),c=k(b),e=d(),p=d(),h="";for(this.divRemTo(c,e,p);0<e.signum();)h=(b+p.intValue()).toString(a).substr(1)+h,e.divRemTo(c,e,p);return p.intValue().toString(a)+h};c.prototype.fromRadix=function(a,b){this.fromInt(0);null==b&&(b=10);for(var d=this.chunkSize(b),e=Math.pow(b,d),g=!1,p=0,h=0,y=0;y<a.length;++y){var k=m(a,y);0>k?"-"==a.charAt(y)&&0==this.signum()&&(g=!0):(h=b*h+k,++p>=d&&(this.dMultiply(e),this.dAddOffset(h,0),h=p=0))}0<p&&(this.dMultiply(Math.pow(b,p)),this.dAddOffset(h,0));g&&c.ZERO.subTo(this,
this)};c.prototype.fromNumber=function(a,b,d){if("number"==typeof b)if(2>a)this.fromInt(1);else for(this.fromNumber(a,d),this.testBit(a-1)||this.bitwiseTo(c.ONE.shiftLeft(a-1),x,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(b);)this.dAddOffset(2,0),this.bitLength()>a&&this.subTo(c.ONE.shiftLeft(a-1),this);else{d=[];var e=a&7;d.length=(a>>3)+1;b.nextBytes(d);d[0]=0<e?d[0]&(1<<e)-1:0;this.fromString(d,256)}};c.prototype.bitwiseTo=function(a,b,c){var d,e,g=Math.min(a.t,this.t);for(d=
0;d<g;++d)c.data[d]=b(this.data[d],a.data[d]);if(a.t<this.t){e=a.s&this.DM;for(d=g;d<this.t;++d)c.data[d]=b(this.data[d],e);c.t=this.t}else{e=this.s&this.DM;for(d=g;d<a.t;++d)c.data[d]=b(e,a.data[d]);c.t=a.t}c.s=b(this.s,a.s);c.clamp()};c.prototype.changeBit=function(a,b){var d=c.ONE.shiftLeft(a);this.bitwiseTo(d,b,d);return d};c.prototype.addTo=function(a,b){for(var c=0,d=0,e=Math.min(a.t,this.t);c<e;)d+=this.data[c]+a.data[c],b.data[c++]=d&this.DM,d>>=this.DB;if(a.t<this.t){for(d+=a.s;c<this.t;)d+=
this.data[c],b.data[c++]=d&this.DM,d>>=this.DB;d+=this.s}else{for(d+=this.s;c<a.t;)d+=a.data[c],b.data[c++]=d&this.DM,d>>=this.DB;d+=a.s}b.s=0>d?-1:0;0<d?b.data[c++]=d:-1>d&&(b.data[c++]=this.DV+d);b.t=c;b.clamp()};c.prototype.dMultiply=function(a){this.data[this.t]=this.am(0,a-1,this,0,0,this.t);++this.t;this.clamp()};c.prototype.dAddOffset=function(a,b){if(0!=a){for(;this.t<=b;)this.data[this.t++]=0;for(this.data[b]+=a;this.data[b]>=this.DV;)this.data[b]-=this.DV,++b>=this.t&&(this.data[this.t++]=
0),++this.data[b]}};c.prototype.multiplyLowerTo=function(a,b,c){var d=Math.min(this.t+a.t,b);c.s=0;for(c.t=d;0<d;)c.data[--d]=0;var p;for(p=c.t-this.t;d<p;++d)c.data[d+this.t]=this.am(0,a.data[d],c,d,0,this.t);for(p=Math.min(a.t,b);d<p;++d)this.am(0,a.data[d],c,d,0,b-d);c.clamp()};c.prototype.multiplyUpperTo=function(a,b,c){--b;var d=c.t=this.t+a.t-b;for(c.s=0;0<=--d;)c.data[d]=0;for(d=Math.max(b-this.t,0);d<a.t;++d)c.data[this.t+d-b]=this.am(b-d,a.data[d],c,0,0,this.t+d-b);c.clamp();c.drShiftTo(1,
c)};c.prototype.modInt=function(a){if(0>=a)return 0;var b=this.DV%a,c=0>this.s?a-1:0;if(0<this.t)if(0==b)c=this.data[0]%a;else for(var d=this.t-1;0<=d;--d)c=(b*c+this.data[d])%a;return c};c.prototype.millerRabin=function(a){var b=this.subtract(c.ONE),d=b.getLowestSetBit();if(0>=d)return!1;for(var p=b.shiftRight(d),g=O(),e,h=0;h<a;++h){do e=new c(this.bitLength(),g);while(0>=e.compareTo(c.ONE)||0<=e.compareTo(b));e=e.modPow(p,this);if(0!=e.compareTo(c.ONE)&&0!=e.compareTo(b)){for(var y=1;y++<d&&0!=
e.compareTo(b);)if(e=e.modPowInt(2,this),0==e.compareTo(c.ONE))return!1;if(0!=e.compareTo(b))return!1}}return!0};c.prototype.clone=function(){var a=d();this.copyTo(a);return a};c.prototype.intValue=function(){if(0>this.s){if(1==this.t)return this.data[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this.data[0];if(0==this.t)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]};c.prototype.byteValue=function(){return 0==this.t?this.s:this.data[0]<<24>>24};c.prototype.shortValue=
function(){return 0==this.t?this.s:this.data[0]<<16>>16};c.prototype.signum=function(){return 0>this.s?-1:0>=this.t||1==this.t&&0>=this.data[0]?0:1};c.prototype.toByteArray=function(){var a=this.t,b=[];b[0]=this.s;var c=this.DB-a*this.DB%8,d,p=0;if(0<a--)for(c<this.DB&&(d=this.data[a]>>c)!=(this.s&this.DM)>>c&&(b[p++]=d|this.s<<this.DB-c);0<=a;)if(8>c?(d=(this.data[a]&(1<<c)-1)<<8-c,d|=this.data[--a]>>(c+=this.DB-8)):(d=this.data[a]>>(c-=8)&255,0>=c&&(c+=this.DB,--a)),0!=(d&128)&&(d|=-256),0==p&&
(this.s&128)!=(d&128)&&++p,0<p||d!=this.s)b[p++]=d;return b};c.prototype.equals=function(a){return 0==this.compareTo(a)};c.prototype.min=function(a){return 0>this.compareTo(a)?this:a};c.prototype.max=function(a){return 0<this.compareTo(a)?this:a};c.prototype.and=function(a){var b=d();this.bitwiseTo(a,B,b);return b};c.prototype.or=function(a){var b=d();this.bitwiseTo(a,x,b);return b};c.prototype.xor=function(a){var b=d();this.bitwiseTo(a,z,b);return b};c.prototype.andNot=function(a){var b=d();this.bitwiseTo(a,
0),++this.data[b]}};c.prototype.multiplyLowerTo=function(a,b,c){var d=Math.min(this.t+a.t,b);c.s=0;for(c.t=d;0<d;)c.data[--d]=0;var e;for(e=c.t-this.t;d<e;++d)c.data[d+this.t]=this.am(0,a.data[d],c,d,0,this.t);for(e=Math.min(a.t,b);d<e;++d)this.am(0,a.data[d],c,d,0,b-d);c.clamp()};c.prototype.multiplyUpperTo=function(a,b,c){--b;var d=c.t=this.t+a.t-b;for(c.s=0;0<=--d;)c.data[d]=0;for(d=Math.max(b-this.t,0);d<a.t;++d)c.data[this.t+d-b]=this.am(b-d,a.data[d],c,0,0,this.t+d-b);c.clamp();c.drShiftTo(1,
c)};c.prototype.modInt=function(a){if(0>=a)return 0;var b=this.DV%a,c=0>this.s?a-1:0;if(0<this.t)if(0==b)c=this.data[0]%a;else for(var d=this.t-1;0<=d;--d)c=(b*c+this.data[d])%a;return c};c.prototype.millerRabin=function(a){var b=this.subtract(c.ONE),d=b.getLowestSetBit();if(0>=d)return!1;for(var e=b.shiftRight(d),g=O(),p,h=0;h<a;++h){do p=new c(this.bitLength(),g);while(0>=p.compareTo(c.ONE)||0<=p.compareTo(b));p=p.modPow(e,this);if(0!=p.compareTo(c.ONE)&&0!=p.compareTo(b)){for(var y=1;y++<d&&0!=
p.compareTo(b);)if(p=p.modPowInt(2,this),0==p.compareTo(c.ONE))return!1;if(0!=p.compareTo(b))return!1}}return!0};c.prototype.clone=function(){var a=d();this.copyTo(a);return a};c.prototype.intValue=function(){if(0>this.s){if(1==this.t)return this.data[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this.data[0];if(0==this.t)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]};c.prototype.byteValue=function(){return 0==this.t?this.s:this.data[0]<<24>>24};c.prototype.shortValue=
function(){return 0==this.t?this.s:this.data[0]<<16>>16};c.prototype.signum=function(){return 0>this.s?-1:0>=this.t||1==this.t&&0>=this.data[0]?0:1};c.prototype.toByteArray=function(){var a=this.t,b=[];b[0]=this.s;var c=this.DB-a*this.DB%8,d,e=0;if(0<a--)for(c<this.DB&&(d=this.data[a]>>c)!=(this.s&this.DM)>>c&&(b[e++]=d|this.s<<this.DB-c);0<=a;)if(8>c?(d=(this.data[a]&(1<<c)-1)<<8-c,d|=this.data[--a]>>(c+=this.DB-8)):(d=this.data[a]>>(c-=8)&255,0>=c&&(c+=this.DB,--a)),0!=(d&128)&&(d|=-256),0==e&&
(this.s&128)!=(d&128)&&++e,0<e||d!=this.s)b[e++]=d;return b};c.prototype.equals=function(a){return 0==this.compareTo(a)};c.prototype.min=function(a){return 0>this.compareTo(a)?this:a};c.prototype.max=function(a){return 0<this.compareTo(a)?this:a};c.prototype.and=function(a){var b=d();this.bitwiseTo(a,B,b);return b};c.prototype.or=function(a){var b=d();this.bitwiseTo(a,x,b);return b};c.prototype.xor=function(a){var b=d();this.bitwiseTo(a,z,b);return b};c.prototype.andNot=function(a){var b=d();this.bitwiseTo(a,
A,b);return b};c.prototype.not=function(){for(var a=d(),b=0;b<this.t;++b)a.data[b]=this.DM&~this.data[b];a.t=this.t;a.s=~this.s;return a};c.prototype.shiftLeft=function(a){var b=d();0>a?this.rShiftTo(-a,b):this.lShiftTo(a,b);return b};c.prototype.shiftRight=function(a){var b=d();0>a?this.lShiftTo(-a,b):this.rShiftTo(a,b);return b};c.prototype.getLowestSetBit=function(){for(var a=0;a<this.t;++a)if(0!=this.data[a]){var b=a*this.DB;a=this.data[a];if(0==a)a=-1;else{var c=0;0==(a&65535)&&(a>>=16,c+=16);
0==(a&255)&&(a>>=8,c+=8);0==(a&15)&&(a>>=4,c+=4);0==(a&3)&&(a>>=2,c+=2);0==(a&1)&&++c;a=c}return b+a}return 0>this.s?this.t*this.DB:-1};c.prototype.bitCount=function(){for(var a=0,b=this.s&this.DM,c=0;c<this.t;++c){for(var d=this.data[c]^b,p=0;0!=d;)d&=d-1,++p;a+=p}return a};c.prototype.testBit=function(a){var b=Math.floor(a/this.DB);return b>=this.t?0!=this.s:0!=(this.data[b]&1<<a%this.DB)};c.prototype.setBit=function(a){return this.changeBit(a,x)};c.prototype.clearBit=function(a){return this.changeBit(a,
0==(a&255)&&(a>>=8,c+=8);0==(a&15)&&(a>>=4,c+=4);0==(a&3)&&(a>>=2,c+=2);0==(a&1)&&++c;a=c}return b+a}return 0>this.s?this.t*this.DB:-1};c.prototype.bitCount=function(){for(var a=0,b=this.s&this.DM,c=0;c<this.t;++c){for(var d=this.data[c]^b,e=0;0!=d;)d&=d-1,++e;a+=e}return a};c.prototype.testBit=function(a){var b=Math.floor(a/this.DB);return b>=this.t?0!=this.s:0!=(this.data[b]&1<<a%this.DB)};c.prototype.setBit=function(a){return this.changeBit(a,x)};c.prototype.clearBit=function(a){return this.changeBit(a,
A)};c.prototype.flipBit=function(a){return this.changeBit(a,z)};c.prototype.add=function(a){var b=d();this.addTo(a,b);return b};c.prototype.subtract=function(a){var b=d();this.subTo(a,b);return b};c.prototype.multiply=function(a){var b=d();this.multiplyTo(a,b);return b};c.prototype.divide=function(a){var b=d();this.divRemTo(a,b,null);return b};c.prototype.remainder=function(a){var b=d();this.divRemTo(a,null,b);return b};c.prototype.divideAndRemainder=function(a){var b=d(),c=d();this.divRemTo(a,b,
c);return[b,c]};c.prototype.modPow=function(a,b){var c=a.bitLength(),p,e=k(1),y;if(0>=c)return e;p=18>c?1:48>c?3:144>c?4:768>c?5:6;y=8>c?new u(b):b.isEven()?new E(b):new v(b);var l=[],m=3,r=p-1,q=(1<<p)-1;l[1]=y.convert(this);if(1<p)for(c=d(),y.sqrTo(l[1],c);m<=q;)l[m]=d(),y.mulTo(c,l[m-2],l[m]),m+=2;for(var A=a.t-1,x,w=!0,O=d(),c=h(a.data[A])-1;0<=A;){c>=r?x=a.data[A]>>c-r&q:(x=(a.data[A]&(1<<c+1)-1)<<r-c,0<A&&(x|=a.data[A-1]>>this.DB+c-r));for(m=p;0==(x&1);)x>>=1,--m;0>(c-=m)&&(c+=this.DB,--A);
if(w)l[x].copyTo(e),w=!1;else{for(;1<m;)y.sqrTo(e,O),y.sqrTo(O,e),m-=2;0<m?y.sqrTo(e,O):(m=e,e=O,O=m);y.mulTo(O,l[x],e)}for(;0<=A&&0==(a.data[A]&1<<c);)y.sqrTo(e,O),m=e,e=O,O=m,0>--c&&(c=this.DB-1,--A)}return y.revert(e)};c.prototype.modInverse=function(a){var b=a.isEven();if(this.isEven()&&b||0==a.signum())return c.ZERO;for(var d=a.clone(),p=this.clone(),e=k(1),g=k(0),h=k(0),y=k(1);0!=d.signum();){for(;d.isEven();)d.rShiftTo(1,d),b?(e.isEven()&&g.isEven()||(e.addTo(this,e),g.subTo(a,g)),e.rShiftTo(1,
e)):g.isEven()||g.subTo(a,g),g.rShiftTo(1,g);for(;p.isEven();)p.rShiftTo(1,p),b?(h.isEven()&&y.isEven()||(h.addTo(this,h),y.subTo(a,y)),h.rShiftTo(1,h)):y.isEven()||y.subTo(a,y),y.rShiftTo(1,y);0<=d.compareTo(p)?(d.subTo(p,d),b&&e.subTo(h,e),g.subTo(y,g)):(p.subTo(d,p),b&&h.subTo(e,h),y.subTo(g,y))}if(0!=p.compareTo(c.ONE))return c.ZERO;if(0<=y.compareTo(a))return y.subtract(a);if(0>y.signum())y.addTo(a,y);else return y;return 0>y.signum()?y.add(a):y};c.prototype.pow=function(a){return this.exp(a,
c);return[b,c]};c.prototype.modPow=function(a,b){var c=a.bitLength(),e,p=k(1),y;if(0>=c)return p;e=18>c?1:48>c?3:144>c?4:768>c?5:6;y=8>c?new u(b):b.isEven()?new E(b):new v(b);var l=[],m=3,r=e-1,q=(1<<e)-1;l[1]=y.convert(this);if(1<e)for(c=d(),y.sqrTo(l[1],c);m<=q;)l[m]=d(),y.mulTo(c,l[m-2],l[m]),m+=2;for(var A=a.t-1,x,w=!0,O=d(),c=h(a.data[A])-1;0<=A;){c>=r?x=a.data[A]>>c-r&q:(x=(a.data[A]&(1<<c+1)-1)<<r-c,0<A&&(x|=a.data[A-1]>>this.DB+c-r));for(m=e;0==(x&1);)x>>=1,--m;0>(c-=m)&&(c+=this.DB,--A);
if(w)l[x].copyTo(p),w=!1;else{for(;1<m;)y.sqrTo(p,O),y.sqrTo(O,p),m-=2;0<m?y.sqrTo(p,O):(m=p,p=O,O=m);y.mulTo(O,l[x],p)}for(;0<=A&&0==(a.data[A]&1<<c);)y.sqrTo(p,O),m=p,p=O,O=m,0>--c&&(c=this.DB-1,--A)}return y.revert(p)};c.prototype.modInverse=function(a){var b=a.isEven();if(this.isEven()&&b||0==a.signum())return c.ZERO;for(var d=a.clone(),e=this.clone(),p=k(1),g=k(0),h=k(0),y=k(1);0!=d.signum();){for(;d.isEven();)d.rShiftTo(1,d),b?(p.isEven()&&g.isEven()||(p.addTo(this,p),g.subTo(a,g)),p.rShiftTo(1,
p)):g.isEven()||g.subTo(a,g),g.rShiftTo(1,g);for(;e.isEven();)e.rShiftTo(1,e),b?(h.isEven()&&y.isEven()||(h.addTo(this,h),y.subTo(a,y)),h.rShiftTo(1,h)):y.isEven()||y.subTo(a,y),y.rShiftTo(1,y);0<=d.compareTo(e)?(d.subTo(e,d),b&&p.subTo(h,p),g.subTo(y,g)):(e.subTo(d,e),b&&h.subTo(p,h),y.subTo(g,y))}if(0!=e.compareTo(c.ONE))return c.ZERO;if(0<=y.compareTo(a))return y.subtract(a);if(0>y.signum())y.addTo(a,y);else return y;return 0>y.signum()?y.add(a):y};c.prototype.pow=function(a){return this.exp(a,
new R)};c.prototype.gcd=function(a){var b=0>this.s?this.negate():this.clone();a=0>a.s?a.negate():a.clone();if(0>b.compareTo(a)){var c=b,b=a;a=c}var c=b.getLowestSetBit(),d=a.getLowestSetBit();if(0>d)return b;c<d&&(d=c);0<d&&(b.rShiftTo(d,b),a.rShiftTo(d,a));for(;0<b.signum();)0<(c=b.getLowestSetBit())&&b.rShiftTo(c,b),0<(c=a.getLowestSetBit())&&a.rShiftTo(c,a),0<=b.compareTo(a)?(b.subTo(a,b),b.rShiftTo(1,b)):(a.subTo(b,a),a.rShiftTo(1,a));0<d&&a.lShiftTo(d,a);return a};c.prototype.isProbablePrime=
function(a){var b,c=this.abs();if(1==c.t&&c.data[0]<=T[T.length-1]){for(b=0;b<T.length;++b)if(c.data[0]==T[b])return!0;return!1}if(c.isEven())return!1;for(b=1;b<T.length;){for(var d=T[b],p=b+1;p<T.length&&d<P;)d*=T[p++];for(d=c.modInt(d);b<p;)if(0==d%T[b++])return!1}return c.millerRabin(a)};a.jsbn=a.jsbn||{};a.jsbn.BigInteger=c}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,
function(a){var b,c=this.abs();if(1==c.t&&c.data[0]<=T[T.length-1]){for(b=0;b<T.length;++b)if(c.data[0]==T[b])return!0;return!1}if(c.isEven())return!1;for(b=1;b<T.length;){for(var d=T[b],e=b+1;e<T.length&&d<P;)d*=T[e++];for(d=c.modInt(d);b<e;)if(0==d%T[b++])return!1}return c.millerRabin(a)};a.jsbn=a.jsbn||{};a.jsbn.BigInteger=c}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,
n=function(a,c){c.exports=function(c){var e=v.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.jsbn)return c.jsbn;c.defined.jsbn=!0;for(var l=0;l<e.length;++l)e[l](c);return c.jsbn}},l=a;a=function(b,c){v="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,l.apply(null,Array.prototype.slice.call(arguments,0));a=l;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/jsbn",["require","module"],function(){n.apply(null,Array.prototype.slice.call(arguments,
0))})})();(function(){function b(a){function c(b,d,e){e||(e=a.md.sha1.create());for(var g="",k=Math.ceil(d/e.digestLength),h=0;h<k;++h){var l=String.fromCharCode(h>>24&255,h>>16&255,h>>8&255,h&255);e.start();e.update(b+l);g+=e.digest().getBytes()}return g.substring(0,d)}var d=a.pkcs1=a.pkcs1||{};d.encode_rsa_oaep=function(b,d,e,g,k){var h,l,n,v;"string"===typeof e?(h=e,l=g||void 0,n=k||void 0):e&&(h=e.label||void 0,l=e.seed||void 0,n=e.md||void 0,e.mgf1&&e.mgf1.md&&(v=e.mgf1.md));n?n.start():n=a.md.sha1.create();
v||(v=n);b=Math.ceil(b.n.bitLength()/8);e=b-2*n.digestLength-2;if(d.length>e)throw v=Error("RSAES-OAEP input message length is too long."),v.length=d.length,v.maxLength=e,v;h||(h="");n.update(h,"raw");h=n.digest();g="";e-=d.length;for(k=0;k<e;k++)g+="\x00";d=h.getBytes()+g+"\u0001"+d;if(!l)l=a.random.getBytes(n.digestLength);else if(l.length!==n.digestLength)throw v=Error("Invalid RSAES-OAEP seed. The seed length must match the digest length."),v.seedLength=l.length,v.digestLength=n.digestLength,
@ -431,8 +431,8 @@ v;b=c(l,b-n.digestLength-1,v);d=a.util.xorBytes(d,b,d.length);n=c(d,n.digestLeng
2)throw Error("RSAES-OAEP key is too short for the hash function.");k||(k="");h.update(k,"raw");k=h.digest().getBytes();b=d.charAt(0);g=d.substring(1,h.digestLength+1);d=d.substring(1+h.digestLength);var n=c(d,h.digestLength,l);g=a.util.xorBytes(g,n,g.length);l=c(g,e-h.digestLength-1,l);d=a.util.xorBytes(d,l,d.length);e=d.substring(0,h.digestLength);l="\x00"!==b;for(b=0;b<h.digestLength;++b)l|=k.charAt(b)!==e.charAt(b);k=1;for(h=b=h.digestLength;h<d.length;h++)e=d.charCodeAt(h),g=e&1^1,l|=e&(k?65534:
0),k&=g,b+=k;if(l||1!==d.charCodeAt(b))throw Error("Invalid RSAES-OAEP padding.");return d.substring(b+1)}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var e=v.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.pkcs1)return c.pkcs1;c.defined.pkcs1=!0;for(var l=0;l<e.length;++l)e[l](c);return c.pkcs1}},
l=a;a=function(b,c){v="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,l.apply(null,Array.prototype.slice.call(arguments,0));a=l;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/pkcs1",["require","module","./util","./random","./sha1"],function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(a,b,p,h){return"workers"in p?e(a,b,p,h):d(a,b,p,h)}function d(b,c,e,k){var m=l(b,c),y=0,r=n(m.bitLength());"millerRabinTests"in
e&&(r=e.millerRabinTests);var u=10;"maxBlockTime"in e&&(u=e.maxBlockTime);var v=+new Date;do{m.bitLength()>b&&(m=l(b,c));if(m.isProbablePrime(r))return k(null,m);m.dAddOffset(h[y++%8],0)}while(0>u||+new Date-v<u);a.util.setImmediate(function(){d(b,c,e,k)})}function e(b,c,h,m){function r(){function a(e){if(!g){--p;var h=e.data;if(h.found){for(e=0;e<d.length;++e)d[e].terminate();g=!0;return m(null,new k(h.prime,16))}y.bitLength()>b&&(y=l(b,c));h=y.toString(16);e.target.postMessage({hex:h,workLoad:u});
y.dAddOffset(n,0)}}E=Math.max(1,E);for(var d=[],e=0;e<E;++e)d[e]=new Worker(v);for(var p=E,e=0;e<E;++e)d[e].addEventListener("message",a);var g=!1}if("undefined"===typeof Worker)return d(b,c,h,m);var y=l(b,c),E=h.workers,u=h.workLoad||100,n=30*u/8,v=h.workerScript||"forge/prime.worker.js";if(-1===E)return a.util.estimateCores(function(a,b){a&&(b=2);E=b-1;r()});r()}function l(a,b){var c=new k(a,b),d=a-1;c.testBit(d)||c.bitwiseTo(k.ONE.shiftLeft(d),v,c);c.dAddOffset(31-c.mod(u).byteValue(),0);return c}
e&&(r=e.millerRabinTests);var u=10;"maxBlockTime"in e&&(u=e.maxBlockTime);var v=+new Date;do{m.bitLength()>b&&(m=l(b,c));if(m.isProbablePrime(r))return k(null,m);m.dAddOffset(h[y++%8],0)}while(0>u||+new Date-v<u);a.util.setImmediate(function(){d(b,c,e,k)})}function e(b,c,h,m){function r(){function a(e){if(!p){--g;var h=e.data;if(h.found){for(e=0;e<d.length;++e)d[e].terminate();p=!0;return m(null,new k(h.prime,16))}y.bitLength()>b&&(y=l(b,c));h=y.toString(16);e.target.postMessage({hex:h,workLoad:u});
y.dAddOffset(n,0)}}E=Math.max(1,E);for(var d=[],e=0;e<E;++e)d[e]=new Worker(v);for(var g=E,e=0;e<E;++e)d[e].addEventListener("message",a);var p=!1}if("undefined"===typeof Worker)return d(b,c,h,m);var y=l(b,c),E=h.workers,u=h.workLoad||100,n=30*u/8,v=h.workerScript||"forge/prime.worker.js";if(-1===E)return a.util.estimateCores(function(a,b){a&&(b=2);E=b-1;r()});r()}function l(a,b){var c=new k(a,b),d=a-1;c.testBit(d)||c.bitwiseTo(k.ONE.shiftLeft(d),v,c);c.dAddOffset(31-c.mod(u).byteValue(),0);return c}
function n(a){return 100>=a?27:150>=a?18:200>=a?15:250>=a?12:300>=a?9:350>=a?8:400>=a?7:500>=a?6:600>=a?5:800>=a?4:1250>=a?3:2}if(!a.prime){var m=a.prime=a.prime||{},k=a.jsbn.BigInteger,h=[6,4,2,4,2,4,6,2],u=new k(null);u.fromInt(30);var v=function(a,b){return a|b};m.generateProbablePrime=function(b,d,e){"function"===typeof d&&(e=d,d={});d=d||{};var g=d.algorithm||"PRIMEINC";"string"===typeof g&&(g={name:g});g.options=g.options||{};var h=d.prng||a.random;d={nextBytes:function(a){for(var b=h.getBytesSync(a.length),
c=0;c<a.length;++c)a[c]=b.charCodeAt(c)}};if("PRIMEINC"===g.name)return c(b,d,g.options,e);throw Error("Invalid prime generation algorithm: "+g.name);}}}if("function"!==typeof a)if("object"===typeof module&&module.exports){var e=!0;a=function(a,b){b(c,module)}}else return"undefined"===typeof forge&&(forge={}),b(forge);var v,n=function(a,c){c.exports=function(c){var e=v.map(function(b){return a(b)}).concat(b);c=c||{};c.defined=c.defined||{};if(c.defined.prime)return c.prime;c.defined.prime=!0;for(var l=
0;l<e.length;++l)e[l](c);return c.prime}},l=a;a=function(b,c){v="string"===typeof b?c.slice(2):b.slice(2);if(e)return delete a,l.apply(null,Array.prototype.slice.call(arguments,0));a=l;return a.apply(null,Array.prototype.slice.call(arguments,0))};a("js/prime",["require","module","./util","./jsbn","./random"],function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function b(a){function c(b,d,e){var g=a.util.createBuffer();d=Math.ceil(d.n.bitLength()/8);if(b.length>d-11)throw g=
@ -853,9 +853,9 @@ break;case "<":a+="&lt;";break;case ">":a+="&gt;";break;case " ":a+="&nbsp;";bre
l.Init();return l},ZLIB=ZLIB||{};
"undefined"===typeof ZLIB.common_initialized&&(ZLIB.Z_NO_FLUSH=0,ZLIB.Z_PARTIAL_FLUSH=1,ZLIB.Z_SYNC_FLUSH=2,ZLIB.Z_FULL_FLUSH=3,ZLIB.Z_FINISH=4,ZLIB.Z_BLOCK=5,ZLIB.Z_TREES=6,ZLIB.Z_OK=0,ZLIB.Z_STREAM_END=1,ZLIB.Z_NEED_DICT=2,ZLIB.Z_ERRNO=-1,ZLIB.Z_STREAM_ERROR=-2,ZLIB.Z_DATA_ERROR=-3,ZLIB.Z_MEM_ERROR=-4,ZLIB.Z_BUF_ERROR=-5,ZLIB.Z_VERSION_ERROR=-6,ZLIB.Z_DEFLATED=8,ZLIB.z_stream=function(){this.total_out=this.avail_out=this.next_out=this.total_in=this.avail_in=this.next_in=0;this.state=this.msg=null;
this.adler=this.data_type=0;this.output_data=this.input_data="";this.error=0;this.checksum_function=null},ZLIB.gz_header=function(){this.xflags=this.time=this.text=0;this.os=255;this.extra=null;this.extra_max=this.extra_len=0;this.name=null;this.name_max=0;this.comment=null;this.done=this.hcrc=this.comm_max=0},ZLIB.common_initialized=!0);"undefined"===typeof ZLIB&&alert("ZLIB is not defined. SRC zlib.js before zlib-inflate.js");
(function(){function b(a,b){var c=a.next,d=2==b?a.distbits:a.lenbits,e=a.work,g=a.lens,l=2==b?a.nlen:0,m=a.codes,p;p=1==b?a.nlen:2==b?a.ndist:19;var n,r,v,w,x,z,D,B,C,W,I,G,S,Z,ca,fa,ga,U,M=Array(16);x=Array(16);for(n=0;15>=n;n++)M[n]=0;for(r=0;r<p;r++)M[g[l+r]]++;w=d;for(v=15;1<=v&&0==M[v];v--);w>v&&(w=v);if(0==v)return G={op:64,bits:1,val:0},m[c++]=G,m[c++]=G,2==b?a.distbits=1:a.lenbits=1,a.next=c,0;for(d=1;d<v&&0==M[d];d++);w<d&&(w=d);for(n=z=1;15>=n;n++)if(z<<=1,z-=M[n],0>z)return-1;if(0<z&&(0==
b||1!=v))return a.next=c,-1;x[1]=0;for(n=1;15>n;n++)x[n+1]=x[n]+M[n];for(r=0;r<p;r++)0!=g[l+r]&&(e[x[g[l+r]]++]=r);switch(b){case 0:Z=fa=e;ga=ca=0;U=19;break;case 1:Z=k;ca=-257;fa=h;ga=-257;U=256;break;default:Z=u,fa=K,ga=ca=0,U=-1}r=B=0;n=d;S=c;p=w;x=0;W=-1;D=1<<w;I=D-1;if(1==b&&852<=D||2==b&&592<=D)return a.next=c,1;for(;;){G={op:0,bits:n-x,val:0};e[r]<U?G.val=e[r]:e[r]>U?(G.op=fa[ga+e[r]],G.val=Z[ca+e[r]]):G.op=96;z=1<<n-x;d=C=1<<p;do C-=z,m[S+(B>>>x)+C]=G;while(0!=C);for(z=1<<n-1;B&z;)z>>>=1;
0!=z?(B&=z-1,B+=z):B=0;r++;if(0==--M[n]){if(n==v)break;n=g[l+e[r]]}if(n>w&&(B&I)!=W){0==x&&(x=w);S+=d;p=n-x;for(z=1<<p;p+x<v;){z-=M[p+x];if(0>=z)break;p++;z<<=1}D+=1<<p;if(1==b&&852<=D||2==b&&592<=D)return a.next=c,1;W=B&I;m[c+W]={op:p,bits:w,val:S-c}}}0!=B&&(m[S+B]={op:64,bits:n-x,val:0});a.next=c+D;2==b?a.distbits=w:a.lenbits=w;return 0}function c(a){var b,c=Array(a);for(b=0;b<a;b++)c[b]=0;return c}function a(a,b,c){return a&&b in a?a[b]:c}function d(){return 0}function e(){var a;this.total=this.check=
(function(){function b(a,b){var c=a.next,d=2==b?a.distbits:a.lenbits,e=a.work,g=a.lens,l=2==b?a.nlen:0,m=a.codes,n;n=1==b?a.nlen:2==b?a.ndist:19;var p,r,v,w,x,z,D,B,C,W,I,G,S,Z,ca,fa,ga,U,M=Array(16);x=Array(16);for(p=0;15>=p;p++)M[p]=0;for(r=0;r<n;r++)M[g[l+r]]++;w=d;for(v=15;1<=v&&0==M[v];v--);w>v&&(w=v);if(0==v)return G={op:64,bits:1,val:0},m[c++]=G,m[c++]=G,2==b?a.distbits=1:a.lenbits=1,a.next=c,0;for(d=1;d<v&&0==M[d];d++);w<d&&(w=d);for(p=z=1;15>=p;p++)if(z<<=1,z-=M[p],0>z)return-1;if(0<z&&(0==
b||1!=v))return a.next=c,-1;x[1]=0;for(p=1;15>p;p++)x[p+1]=x[p]+M[p];for(r=0;r<n;r++)0!=g[l+r]&&(e[x[g[l+r]]++]=r);switch(b){case 0:Z=fa=e;ga=ca=0;U=19;break;case 1:Z=k;ca=-257;fa=h;ga=-257;U=256;break;default:Z=u,fa=K,ga=ca=0,U=-1}r=B=0;p=d;S=c;n=w;x=0;W=-1;D=1<<w;I=D-1;if(1==b&&852<=D||2==b&&592<=D)return a.next=c,1;for(;;){G={op:0,bits:p-x,val:0};e[r]<U?G.val=e[r]:e[r]>U?(G.op=fa[ga+e[r]],G.val=Z[ca+e[r]]):G.op=96;z=1<<p-x;d=C=1<<n;do C-=z,m[S+(B>>>x)+C]=G;while(0!=C);for(z=1<<p-1;B&z;)z>>>=1;
0!=z?(B&=z-1,B+=z):B=0;r++;if(0==--M[p]){if(p==v)break;p=g[l+e[r]]}if(p>w&&(B&I)!=W){0==x&&(x=w);S+=d;n=p-x;for(z=1<<n;n+x<v;){z-=M[n+x];if(0>=z)break;n++;z<<=1}D+=1<<n;if(1==b&&852<=D||2==b&&592<=D)return a.next=c,1;W=B&I;m[c+W]={op:n,bits:w,val:S-c}}}0!=B&&(m[S+B]={op:64,bits:p-x,val:0});a.next=c+D;2==b?a.distbits=w:a.lenbits=w;return 0}function c(a){var b,c=Array(a);for(b=0;b<a;b++)c[b]=0;return c}function a(a,b,c){return a&&b in a?a[b]:c}function d(){return 0}function e(){var a;this.total=this.check=
this.dmax=this.flags=this.havedict=this.wrap=this.last=this.mode=0;this.head=null;this.wnext=this.whave=this.wsize=this.wbits=0;this.window=null;this.next=this.have=this.ndist=this.nlen=this.ncode=this.distbits=this.lenbits=this.distcode=this.lencode=this.extra=this.offset=this.length=this.bits=this.hold=0;this.lens=c(320);this.work=c(288);this.codes=Array(1444);var b={op:0,bits:0,val:0};for(a=0;1444>a;a++)this.codes[a]=b;this.was=this.back=this.sane=0}function v(a,b){a.state.check=a.checksum_function(a.state.check,
[b&255,b>>>8&255],0,2)}function n(a,b){b.strm=a;b.left=a.avail_out;b.next=a.next_in;b.have=a.avail_in;b.hold=a.state.hold;b.bits=a.state.bits;return b}function l(a){var b=a.strm;b.next_in=a.next;b.avail_out=a.left;b.avail_in=a.have;b.state.hold=a.hold;b.state.bits=a.bits}function p(a){a.hold=0;a.bits=0}function r(a){if(0==a.have)return!1;a.have--;a.hold+=(a.strm.input_data.charCodeAt(a.next++)&255)<<a.bits;a.bits+=8;return!0}function g(a,b){for(;a.bits<b;)if(!r(a))return!1;return!0}function C(a,b){return a.hold&
(1<<b)-1}function w(a,b){a.hold>>>=b;a.bits-=b}function D(a){a.hold>>>=a.bits&7;a.bits-=a.bits&7}function m(a){return(a>>>24&255)+(a>>>8&65280)+((a&65280)<<8)+((a&255)<<24)}var k=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],h=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,203,69],u=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],K=[16,16,16,