Skip to content

Instantly share code, notes, and snippets.

@hdf
Last active December 16, 2015 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hdf/5445747 to your computer and use it in GitHub Desktop.
Save hdf/5445747 to your computer and use it in GitHub Desktop.
Temporary backup of an in progress experimental project. DOES NOT WORK.
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>SecureChat</title>
<script type="text/javascript">
/*! jQuery v1.9.1 | (c) 2005, 2012 jQuery Foundation, Inc. | jquery.org/license
//@ sourceMappingURL=jquery.min.map
*/(function(e,t){var n,r,i=typeof t,o=e.document,a=e.location,s=e.jQuery,u=e.$,l={},c=[],p="1.9.1",f=c.concat,d=c.push,h=c.slice,g=c.indexOf,m=l.toString,y=l.hasOwnProperty,v=p.trim,b=function(e,t){return new b.fn.init(e,t,r)},x=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,w=/\S+/g,T=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,N=/^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/,C=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,k=/^[\],:{}\s]*$/,E=/(?:^|:|,)(?:\s*\[)+/g,S=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,A=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,j=/^-ms-/,D=/-([\da-z])/gi,L=function(e,t){return t.toUpperCase()},H=function(e){(o.addEventListener||"load"===e.type||"complete"===o.readyState)&&(q(),b.ready())},q=function(){o.addEventListener?(o.removeEventListener("DOMContentLoaded",H,!1),e.removeEventListener("load",H,!1)):(o.detachEvent("onreadystatechange",H),e.detachEvent("onload",H))};b.fn=b.prototype={jquery:p,constructor:b,init:function(e,n,r){var i,a;if(!e)return this;if("string"==typeof e){if(i="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:N.exec(e),!i||!i[1]&&n)return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e);if(i[1]){if(n=n instanceof b?n[0]:n,b.merge(this,b.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:o,!0)),C.test(i[1])&&b.isPlainObject(n))for(i in n)b.isFunction(this[i])?this[i](n[i]):this.attr(i,n[i]);return this}if(a=o.getElementById(i[2]),a&&a.parentNode){if(a.id!==i[2])return r.find(e);this.length=1,this[0]=a}return this.context=o,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):b.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),b.makeArray(e,this))},selector:"",length:0,size:function(){return this.length},toArray:function(){return h.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=b.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return b.each(this,e,t)},ready:function(e){return b.ready.promise().done(e),this},slice:function(){return this.pushStack(h.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(b.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:d,sort:[].sort,splice:[].splice},b.fn.init.prototype=b.fn,b.extend=b.fn.extend=function(){var e,n,r,i,o,a,s=arguments[0]||{},u=1,l=arguments.length,c=!1;for("boolean"==typeof s&&(c=s,s=arguments[1]||{},u=2),"object"==typeof s||b.isFunction(s)||(s={}),l===u&&(s=this,--u);l>u;u++)if(null!=(o=arguments[u]))for(i in o)e=s[i],r=o[i],s!==r&&(c&&r&&(b.isPlainObject(r)||(n=b.isArray(r)))?(n?(n=!1,a=e&&b.isArray(e)?e:[]):a=e&&b.isPlainObject(e)?e:{},s[i]=b.extend(c,a,r)):r!==t&&(s[i]=r));return s},b.extend({noConflict:function(t){return e.$===b&&(e.$=u),t&&e.jQuery===b&&(e.jQuery=s),b},isReady:!1,readyWait:1,holdReady:function(e){e?b.readyWait++:b.ready(!0)},ready:function(e){if(e===!0?!--b.readyWait:!b.isReady){if(!o.body)return setTimeout(b.ready);b.isReady=!0,e!==!0&&--b.readyWait>0||(n.resolveWith(o,[b]),b.fn.trigger&&b(o).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===b.type(e)},isArray:Array.isArray||function(e){return"array"===b.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[m.call(e)]||"object":typeof e},isPlainObject:function(e){if(!e||"object"!==b.type(e)||e.nodeType||b.isWindow(e))return!1;try{if(e.constructor&&!y.call(e,"constructor")&&!y.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||y.call(e,r)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||o;var r=C.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=b.buildFragment([e],t,i),i&&b(i).remove(),b.merge([],r.childNodes))},parseJSON:function(n){return e.JSON&&e.JSON.parse?e.JSON.parse(n):null===n?n:"string"==typeof n&&(n=b.trim(n),n&&k.test(n.replace(S,"@").replace(A,"]").replace(E,"")))?Function("return "+n)():(b.error("Invalid JSON: "+n),t)},parseXML:function(n){var r,i;if(!n||"string"!=typeof n)return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(o){r=t}return r&&r.documentElement&&!r.getElementsByTagName("parsererror").length||b.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&b.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(j,"ms-").replace(D,L)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,a=M(e);if(n){if(a){for(;o>i;i++)if(r=t.apply(e[i],n),r===!1)break}else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if(a){for(;o>i;i++)if(r=t.call(e[i],i,e[i]),r===!1)break}else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return e},trim:v&&!v.call("\ufeff\u00a0")?function(e){return null==e?"":v.call(e)}:function(e){return null==e?"":(e+"").replace(T,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(M(Object(e))?b.merge(n,"string"==typeof e?[e]:e):d.call(n,e)),n},inArray:function(e,t,n){var r;if(t){if(g)return g.call(t,e,n);for(r=t.length,n=n?0>n?Math.max(0,r+n):n:0;r>n;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,o=0;if("number"==typeof r)for(;r>o;o++)e[i++]=n[o];else while(n[o]!==t)e[i++]=n[o++];return e.length=i,e},grep:function(e,t,n){var r,i=[],o=0,a=e.length;for(n=!!n;a>o;o++)r=!!t(e[o],o),n!==r&&i.push(e[o]);return i},map:function(e,t,n){var r,i=0,o=e.length,a=M(e),s=[];if(a)for(;o>i;i++)r=t(e[i],i,n),null!=r&&(s[s.length]=r);else for(i in e)r=t(e[i],i,n),null!=r&&(s[s.length]=r);return f.apply([],s)},guid:1,proxy:function(e,n){var r,i,o;return"string"==typeof n&&(o=e[n],n=e,e=o),b.isFunction(e)?(r=h.call(arguments,2),i=function(){return e.apply(n||this,r.concat(h.call(arguments)))},i.guid=e.guid=e.guid||b.guid++,i):t},access:function(e,n,r,i,o,a,s){var u=0,l=e.length,c=null==r;if("object"===b.type(r)){o=!0;for(u in r)b.access(e,n,u,r[u],!0,a,s)}else if(i!==t&&(o=!0,b.isFunction(i)||(s=!0),c&&(s?(n.call(e,i),n=null):(c=n,n=function(e,t,n){return c.call(b(e),n)})),n))for(;l>u;u++)n(e[u],r,s?i:i.call(e[u],u,n(e[u],r)));return o?e:c?n.call(e):l?n(e[0],r):a},now:function(){return(new Date).getTime()}}),b.ready.promise=function(t){if(!n)if(n=b.Deferred(),"complete"===o.readyState)setTimeout(b.ready);else if(o.addEventListener)o.addEventListener("DOMContentLoaded",H,!1),e.addEventListener("load",H,!1);else{o.attachEvent("onreadystatechange",H),e.attachEvent("onload",H);var r=!1;try{r=null==e.frameElement&&o.documentElement}catch(i){}r&&r.doScroll&&function a(){if(!b.isReady){try{r.doScroll("left")}catch(e){return setTimeout(a,50)}q(),b.ready()}}()}return n.promise(t)},b.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){l["[object "+t+"]"]=t.toLowerCase()});function M(e){var t=e.length,n=b.type(e);return b.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}r=b(o);var _={};function F(e){var t=_[e]={};return b.each(e.match(w)||[],function(e,n){t[n]=!0}),t}b.Callbacks=function(e){e="string"==typeof e?_[e]||F(e):b.extend({},e);var n,r,i,o,a,s,u=[],l=!e.once&&[],c=function(t){for(r=e.memory&&t,i=!0,a=s||0,s=0,o=u.length,n=!0;u&&o>a;a++)if(u[a].apply(t[0],t[1])===!1&&e.stopOnFalse){r=!1;break}n=!1,u&&(l?l.length&&c(l.shift()):r?u=[]:p.disable())},p={add:function(){if(u){var t=u.length;(function i(t){b.each(t,function(t,n){var r=b.type(n);"function"===r?e.unique&&p.has(n)||u.push(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=u.length:r&&(s=t,c(r))}return this},remove:function(){return u&&b.each(arguments,function(e,t){var r;while((r=b.inArray(t,u,r))>-1)u.splice(r,1),n&&(o>=r&&o--,a>=r&&a--)}),this},has:function(e){return e?b.inArray(e,u)>-1:!(!u||!u.length)},empty:function(){return u=[],this},disable:function(){return u=l=r=t,this},disabled:function(){return!u},lock:function(){return l=t,r||p.disable(),this},locked:function(){return!l},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],!u||i&&!l||(n?l.push(t):c(t)),this},fire:function(){return p.fireWith(this,arguments),this},fired:function(){return!!i}};return p},b.extend({Deferred:function(e){var t=[["resolve","done",b.Callbacks("once memory"),"resolved"],["reject","fail",b.Callbacks("once memory"),"rejected"],["notify","progress",b.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return b.Deferred(function(n){b.each(t,function(t,o){var a=o[0],s=b.isFunction(e[t])&&e[t];i[o[1]](function(){var e=s&&s.apply(this,arguments);e&&b.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[a+"With"](this===r?n.promise():this,s?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?b.extend(e,r):r}},i={};return r.pipe=r.then,b.each(t,function(e,o){var a=o[2],s=o[3];r[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=a.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=h.call(arguments),r=n.length,i=1!==r||e&&b.isFunction(e.promise)?r:0,o=1===i?e:b.Deferred(),a=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?h.call(arguments):r,n===s?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},s,u,l;if(r>1)for(s=Array(r),u=Array(r),l=Array(r);r>t;t++)n[t]&&b.isFunction(n[t].promise)?n[t].promise().done(a(t,l,n)).fail(o.reject).progress(a(t,u,s)):--i;return i||o.resolveWith(l,n),o.promise()}}),b.support=function(){var t,n,r,a,s,u,l,c,p,f,d=o.createElement("div");if(d.setAttribute("className","t"),d.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=d.getElementsByTagName("*"),r=d.getElementsByTagName("a")[0],!n||!r||!n.length)return{};s=o.createElement("select"),l=s.appendChild(o.createElement("option")),a=d.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t={getSetAttribute:"t"!==d.className,leadingWhitespace:3===d.firstChild.nodeType,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/top/.test(r.getAttribute("style")),hrefNormalized:"/a"===r.getAttribute("href"),opacity:/^0.5/.test(r.style.opacity),cssFloat:!!r.style.cssFloat,checkOn:!!a.value,optSelected:l.selected,enctype:!!o.createElement("form").enctype,html5Clone:"<:nav></:nav>"!==o.createElement("nav").cloneNode(!0).outerHTML,boxModel:"CSS1Compat"===o.compatMode,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},a.checked=!0,t.noCloneChecked=a.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!l.disabled;try{delete d.test}catch(h){t.deleteExpando=!1}a=o.createElement("input"),a.setAttribute("value",""),t.input=""===a.getAttribute("value"),a.value="t",a.setAttribute("type","radio"),t.radioValue="t"===a.value,a.setAttribute("checked","t"),a.setAttribute("name","t"),u=o.createDocumentFragment(),u.appendChild(a),t.appendChecked=a.checked,t.checkClone=u.cloneNode(!0).cloneNode(!0).lastChild.checked,d.attachEvent&&(d.attachEvent("onclick",function(){t.noCloneEvent=!1}),d.cloneNode(!0).click());for(f in{submit:!0,change:!0,focusin:!0})d.setAttribute(c="on"+f,"t"),t[f+"Bubbles"]=c in e||d.attributes[c].expando===!1;return d.style.backgroundClip="content-box",d.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===d.style.backgroundClip,b(function(){var n,r,a,s="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",u=o.getElementsByTagName("body")[0];u&&(n=o.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",u.appendChild(n).appendChild(d),d.innerHTML="<table><tr><td></td><td>t</td></tr></table>",a=d.getElementsByTagName("td"),a[0].style.cssText="padding:0;margin:0;border:0;display:none",p=0===a[0].offsetHeight,a[0].style.display="",a[1].style.display="none",t.reliableHiddenOffsets=p&&0===a[0].offsetHeight,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",t.boxSizing=4===d.offsetWidth,t.doesNotIncludeMarginInBodyOffset=1!==u.offsetTop,e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(d,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(d,null)||{width:"4px"}).width,r=d.appendChild(o.createElement("div")),r.style.cssText=d.style.cssText=s,r.style.marginRight=r.style.width="0",d.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),typeof d.style.zoom!==i&&(d.innerHTML="",d.style.cssText=s+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=3===d.offsetWidth,d.style.display="block",d.innerHTML="<div></div>",d.firstChild.style.width="5px",t.shrinkWrapBlocks=3!==d.offsetWidth,t.inlineBlockNeedsLayout&&(u.style.zoom=1)),u.removeChild(n),n=d=a=r=null)}),n=s=u=l=r=a=null,t}();var O=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,B=/([A-Z])/g;function P(e,n,r,i){if(b.acceptData(e)){var o,a,s=b.expando,u="string"==typeof n,l=e.nodeType,p=l?b.cache:e,f=l?e[s]:e[s]&&s;if(f&&p[f]&&(i||p[f].data)||!u||r!==t)return f||(l?e[s]=f=c.pop()||b.guid++:f=s),p[f]||(p[f]={},l||(p[f].toJSON=b.noop)),("object"==typeof n||"function"==typeof n)&&(i?p[f]=b.extend(p[f],n):p[f].data=b.extend(p[f].data,n)),o=p[f],i||(o.data||(o.data={}),o=o.data),r!==t&&(o[b.camelCase(n)]=r),u?(a=o[n],null==a&&(a=o[b.camelCase(n)])):a=o,a}}function R(e,t,n){if(b.acceptData(e)){var r,i,o,a=e.nodeType,s=a?b.cache:e,u=a?e[b.expando]:b.expando;if(s[u]){if(t&&(o=n?s[u]:s[u].data)){b.isArray(t)?t=t.concat(b.map(t,b.camelCase)):t in o?t=[t]:(t=b.camelCase(t),t=t in o?[t]:t.split(" "));for(r=0,i=t.length;i>r;r++)delete o[t[r]];if(!(n?$:b.isEmptyObject)(o))return}(n||(delete s[u].data,$(s[u])))&&(a?b.cleanData([e],!0):b.support.deleteExpando||s!=s.window?delete s[u]:s[u]=null)}}}b.extend({cache:{},expando:"jQuery"+(p+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?b.cache[e[b.expando]]:e[b.expando],!!e&&!$(e)},data:function(e,t,n){return P(e,t,n)},removeData:function(e,t){return R(e,t)},_data:function(e,t,n){return P(e,t,n,!0)},_removeData:function(e,t){return R(e,t,!0)},acceptData:function(e){if(e.nodeType&&1!==e.nodeType&&9!==e.nodeType)return!1;var t=e.nodeName&&b.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),b.fn.extend({data:function(e,n){var r,i,o=this[0],a=0,s=null;if(e===t){if(this.length&&(s=b.data(o),1===o.nodeType&&!b._data(o,"parsedAttrs"))){for(r=o.attributes;r.length>a;a++)i=r[a].name,i.indexOf("data-")||(i=b.camelCase(i.slice(5)),W(o,i,s[i]));b._data(o,"parsedAttrs",!0)}return s}return"object"==typeof e?this.each(function(){b.data(this,e)}):b.access(this,function(n){return n===t?o?W(o,e,b.data(o,e)):null:(this.each(function(){b.data(this,e,n)}),t)},null,n,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){b.removeData(this,e)})}});function W(e,n,r){if(r===t&&1===e.nodeType){var i="data-"+n.replace(B,"-$1").toLowerCase();if(r=e.getAttribute(i),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:O.test(r)?b.parseJSON(r):r}catch(o){}b.data(e,n,r)}else r=t}return r}function $(e){var t;for(t in e)if(("data"!==t||!b.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}b.extend({queue:function(e,n,r){var i;return e?(n=(n||"fx")+"queue",i=b._data(e,n),r&&(!i||b.isArray(r)?i=b._data(e,n,b.makeArray(r)):i.push(r)),i||[]):t},dequeue:function(e,t){t=t||"fx";var n=b.queue(e,t),r=n.length,i=n.shift(),o=b._queueHooks(e,t),a=function(){b.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),o.cur=i,i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return b._data(e,n)||b._data(e,n,{empty:b.Callbacks("once memory").add(function(){b._removeData(e,t+"queue"),b._removeData(e,n)})})}}),b.fn.extend({queue:function(e,n){var r=2;return"string"!=typeof e&&(n=e,e="fx",r--),r>arguments.length?b.queue(this[0],e):n===t?this:this.each(function(){var t=b.queue(this,e,n);b._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&b.dequeue(this,e)})},dequeue:function(e){return this.each(function(){b.dequeue(this,e)})},delay:function(e,t){return e=b.fx?b.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,o=b.Deferred(),a=this,s=this.length,u=function(){--i||o.resolveWith(a,[a])};"string"!=typeof e&&(n=e,e=t),e=e||"fx";while(s--)r=b._data(a[s],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(u));return u(),o.promise(n)}});var I,z,X=/[\t\r\n]/g,U=/\r/g,V=/^(?:input|select|textarea|button|object)$/i,Y=/^(?:a|area)$/i,J=/^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i,G=/^(?:checked|selected)$/i,Q=b.support.getSetAttribute,K=b.support.input;b.fn.extend({attr:function(e,t){return b.access(this,b.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){b.removeAttr(this,e)})},prop:function(e,t){return b.access(this,b.prop,e,t,arguments.length>1)},removeProp:function(e){return e=b.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,o,a=0,s=this.length,u="string"==typeof e&&e;if(b.isFunction(e))return this.each(function(t){b(this).addClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(X," "):" ")){o=0;while(i=t[o++])0>r.indexOf(" "+i+" ")&&(r+=i+" ");n.className=b.trim(r)}return this},removeClass:function(e){var t,n,r,i,o,a=0,s=this.length,u=0===arguments.length||"string"==typeof e&&e;if(b.isFunction(e))return this.each(function(t){b(this).removeClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(X," "):"")){o=0;while(i=t[o++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");n.className=e?b.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e,r="boolean"==typeof t;return b.isFunction(e)?this.each(function(n){b(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n){var o,a=0,s=b(this),u=t,l=e.match(w)||[];while(o=l[a++])u=r?u:!s.hasClass(o),s[u?"addClass":"removeClass"](o)}else(n===i||"boolean"===n)&&(this.className&&b._data(this,"__className__",this.className),this.className=this.className||e===!1?"":b._data(this,"__className__")||"")})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(X," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,o=this[0];{if(arguments.length)return i=b.isFunction(e),this.each(function(n){var o,a=b(this);1===this.nodeType&&(o=i?e.call(this,n,a.val()):e,null==o?o="":"number"==typeof o?o+="":b.isArray(o)&&(o=b.map(o,function(e){return null==e?"":e+""})),r=b.valHooks[this.type]||b.valHooks[this.nodeName.toLowerCase()],r&&"set"in r&&r.set(this,o,"value")!==t||(this.value=o))});if(o)return r=b.valHooks[o.type]||b.valHooks[o.nodeName.toLowerCase()],r&&"get"in r&&(n=r.get(o,"value"))!==t?n:(n=o.value,"string"==typeof n?n.replace(U,""):null==n?"":n)}}}),b.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||0>i,a=o?null:[],s=o?i+1:r.length,u=0>i?s:o?i:0;for(;s>u;u++)if(n=r[u],!(!n.selected&&u!==i||(b.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&b.nodeName(n.parentNode,"optgroup"))){if(t=b(n).val(),o)return t;a.push(t)}return a},set:function(e,t){var n=b.makeArray(t);return b(e).find("option").each(function(){this.selected=b.inArray(b(this).val(),n)>=0}),n.length||(e.selectedIndex=-1),n}}},attr:function(e,n,r){var o,a,s,u=e.nodeType;if(e&&3!==u&&8!==u&&2!==u)return typeof e.getAttribute===i?b.prop(e,n,r):(a=1!==u||!b.isXMLDoc(e),a&&(n=n.toLowerCase(),o=b.attrHooks[n]||(J.test(n)?z:I)),r===t?o&&a&&"get"in o&&null!==(s=o.get(e,n))?s:(typeof e.getAttribute!==i&&(s=e.getAttribute(n)),null==s?t:s):null!==r?o&&a&&"set"in o&&(s=o.set(e,r,n))!==t?s:(e.setAttribute(n,r+""),r):(b.removeAttr(e,n),t))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(w);if(o&&1===e.nodeType)while(n=o[i++])r=b.propFix[n]||n,J.test(n)?!Q&&G.test(n)?e[b.camelCase("default-"+n)]=e[r]=!1:e[r]=!1:b.attr(e,n,""),e.removeAttribute(Q?n:r)},attrHooks:{type:{set:function(e,t){if(!b.support.radioValue&&"radio"===t&&b.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(e,n,r){var i,o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return a=1!==s||!b.isXMLDoc(e),a&&(n=b.propFix[n]||n,o=b.propHooks[n]),r!==t?o&&"set"in o&&(i=o.set(e,r,n))!==t?i:e[n]=r:o&&"get"in o&&null!==(i=o.get(e,n))?i:e[n]},propHooks:{tabIndex:{get:function(e){var n=e.getAttributeNode("tabindex");return n&&n.specified?parseInt(n.value,10):V.test(e.nodeName)||Y.test(e.nodeName)&&e.href?0:t}}}}),z={get:function(e,n){var r=b.prop(e,n),i="boolean"==typeof r&&e.getAttribute(n),o="boolean"==typeof r?K&&Q?null!=i:G.test(n)?e[b.camelCase("default-"+n)]:!!i:e.getAttributeNode(n);return o&&o.value!==!1?n.toLowerCase():t},set:function(e,t,n){return t===!1?b.removeAttr(e,n):K&&Q||!G.test(n)?e.setAttribute(!Q&&b.propFix[n]||n,n):e[b.camelCase("default-"+n)]=e[n]=!0,n}},K&&Q||(b.attrHooks.value={get:function(e,n){var r=e.getAttributeNode(n);return b.nodeName(e,"input")?e.defaultValue:r&&r.specified?r.value:t},set:function(e,n,r){return b.nodeName(e,"input")?(e.defaultValue=n,t):I&&I.set(e,n,r)}}),Q||(I=b.valHooks.button={get:function(e,n){var r=e.getAttributeNode(n);return r&&("id"===n||"name"===n||"coords"===n?""!==r.value:r.specified)?r.value:t},set:function(e,n,r){var i=e.getAttributeNode(r);return i||e.setAttributeNode(i=e.ownerDocument.createAttribute(r)),i.value=n+="","value"===r||n===e.getAttribute(r)?n:t}},b.attrHooks.contenteditable={get:I.get,set:function(e,t,n){I.set(e,""===t?!1:t,n)}},b.each(["width","height"],function(e,n){b.attrHooks[n]=b.extend(b.attrHooks[n],{set:function(e,r){return""===r?(e.setAttribute(n,"auto"),r):t}})})),b.support.hrefNormalized||(b.each(["href","src","width","height"],function(e,n){b.attrHooks[n]=b.extend(b.attrHooks[n],{get:function(e){var r=e.getAttribute(n,2);return null==r?t:r}})}),b.each(["href","src"],function(e,t){b.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}})),b.support.style||(b.attrHooks.style={get:function(e){return e.style.cssText||t},set:function(e,t){return e.style.cssText=t+""}}),b.support.optSelected||(b.propHooks.selected=b.extend(b.propHooks.selected,{get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}})),b.support.enctype||(b.propFix.enctype="encoding"),b.support.checkOn||b.each(["radio","checkbox"],function(){b.valHooks[this]={get:function(e){return null===e.getAttribute("value")?"on":e.value}}}),b.each(["radio","checkbox"],function(){b.valHooks[this]=b.extend(b.valHooks[this],{set:function(e,n){return b.isArray(n)?e.checked=b.inArray(b(e).val(),n)>=0:t}})});var Z=/^(?:input|select|textarea)$/i,et=/^key/,tt=/^(?:mouse|contextmenu)|click/,nt=/^(?:focusinfocus|focusoutblur)$/,rt=/^([^.]*)(?:\.(.+)|)$/;function it(){return!0}function ot(){return!1}b.event={global:{},add:function(e,n,r,o,a){var s,u,l,c,p,f,d,h,g,m,y,v=b._data(e);if(v){r.handler&&(c=r,r=c.handler,a=c.selector),r.guid||(r.guid=b.guid++),(u=v.events)||(u=v.events={}),(f=v.handle)||(f=v.handle=function(e){return typeof b===i||e&&b.event.triggered===e.type?t:b.event.dispatch.apply(f.elem,arguments)},f.elem=e),n=(n||"").match(w)||[""],l=n.length;while(l--)s=rt.exec(n[l])||[],g=y=s[1],m=(s[2]||"").split(".").sort(),p=b.event.special[g]||{},g=(a?p.delegateType:p.bindType)||g,p=b.event.special[g]||{},d=b.extend({type:g,origType:y,data:o,handler:r,guid:r.guid,selector:a,needsContext:a&&b.expr.match.needsContext.test(a),namespace:m.join(".")},c),(h=u[g])||(h=u[g]=[],h.delegateCount=0,p.setup&&p.setup.call(e,o,m,f)!==!1||(e.addEventListener?e.addEventListener(g,f,!1):e.attachEvent&&e.attachEvent("on"+g,f))),p.add&&(p.add.call(e,d),d.handler.guid||(d.handler.guid=r.guid)),a?h.splice(h.delegateCount++,0,d):h.push(d),b.event.global[g]=!0;e=null}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,p,f,d,h,g,m=b.hasData(e)&&b._data(e);if(m&&(c=m.events)){t=(t||"").match(w)||[""],l=t.length;while(l--)if(s=rt.exec(t[l])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){p=b.event.special[d]||{},d=(r?p.delegateType:p.bindType)||d,f=c[d]||[],s=s[2]&&RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),u=o=f.length;while(o--)a=f[o],!i&&g!==a.origType||n&&n.guid!==a.guid||s&&!s.test(a.namespace)||r&&r!==a.selector&&("**"!==r||!a.selector)||(f.splice(o,1),a.selector&&f.delegateCount--,p.remove&&p.remove.call(e,a));u&&!f.length&&(p.teardown&&p.teardown.call(e,h,m.handle)!==!1||b.removeEvent(e,d,m.handle),delete c[d])}else for(d in c)b.event.remove(e,d+t[l],n,r,!0);b.isEmptyObject(c)&&(delete m.handle,b._removeData(e,"events"))}},trigger:function(n,r,i,a){var s,u,l,c,p,f,d,h=[i||o],g=y.call(n,"type")?n.type:n,m=y.call(n,"namespace")?n.namespace.split("."):[];if(l=f=i=i||o,3!==i.nodeType&&8!==i.nodeType&&!nt.test(g+b.event.triggered)&&(g.indexOf(".")>=0&&(m=g.split("."),g=m.shift(),m.sort()),u=0>g.indexOf(":")&&"on"+g,n=n[b.expando]?n:new b.Event(g,"object"==typeof n&&n),n.isTrigger=!0,n.namespace=m.join("."),n.namespace_re=n.namespace?RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,n.result=t,n.target||(n.target=i),r=null==r?[n]:b.makeArray(r,[n]),p=b.event.special[g]||{},a||!p.trigger||p.trigger.apply(i,r)!==!1)){if(!a&&!p.noBubble&&!b.isWindow(i)){for(c=p.delegateType||g,nt.test(c+g)||(l=l.parentNode);l;l=l.parentNode)h.push(l),f=l;f===(i.ownerDocument||o)&&h.push(f.defaultView||f.parentWindow||e)}d=0;while((l=h[d++])&&!n.isPropagationStopped())n.type=d>1?c:p.bindType||g,s=(b._data(l,"events")||{})[n.type]&&b._data(l,"handle"),s&&s.apply(l,r),s=u&&l[u],s&&b.acceptData(l)&&s.apply&&s.apply(l,r)===!1&&n.preventDefault();if(n.type=g,!(a||n.isDefaultPrevented()||p._default&&p._default.apply(i.ownerDocument,r)!==!1||"click"===g&&b.nodeName(i,"a")||!b.acceptData(i)||!u||!i[g]||b.isWindow(i))){f=i[u],f&&(i[u]=null),b.event.triggered=g;try{i[g]()}catch(v){}b.event.triggered=t,f&&(i[u]=f)}return n.result}},dispatch:function(e){e=b.event.fix(e);var n,r,i,o,a,s=[],u=h.call(arguments),l=(b._data(this,"events")||{})[e.type]||[],c=b.event.special[e.type]||{};if(u[0]=e,e.delegateTarget=this,!c.preDispatch||c.preDispatch.call(this,e)!==!1){s=b.event.handlers.call(this,e,l),n=0;while((o=s[n++])&&!e.isPropagationStopped()){e.currentTarget=o.elem,a=0;while((i=o.handlers[a++])&&!e.isImmediatePropagationStopped())(!e.namespace_re||e.namespace_re.test(i.namespace))&&(e.handleObj=i,e.data=i.data,r=((b.event.special[i.origType]||{}).handle||i.handler).apply(o.elem,u),r!==t&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,n){var r,i,o,a,s=[],u=n.delegateCount,l=e.target;if(u&&l.nodeType&&(!e.button||"click"!==e.type))for(;l!=this;l=l.parentNode||this)if(1===l.nodeType&&(l.disabled!==!0||"click"!==e.type)){for(o=[],a=0;u>a;a++)i=n[a],r=i.selector+" ",o[r]===t&&(o[r]=i.needsContext?b(r,this).index(l)>=0:b.find(r,this,null,[l]).length),o[r]&&o.push(i);o.length&&s.push({elem:l,handlers:o})}return n.length>u&&s.push({elem:this,handlers:n.slice(u)}),s},fix:function(e){if(e[b.expando])return e;var t,n,r,i=e.type,a=e,s=this.fixHooks[i];s||(this.fixHooks[i]=s=tt.test(i)?this.mouseHooks:et.test(i)?this.keyHooks:{}),r=s.props?this.props.concat(s.props):this.props,e=new b.Event(a),t=r.length;while(t--)n=r[t],e[n]=a[n];return e.target||(e.target=a.srcElement||o),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,a):e},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,i,a,s=n.button,u=n.fromElement;return null==e.pageX&&null!=n.clientX&&(i=e.target.ownerDocument||o,a=i.documentElement,r=i.body,e.pageX=n.clientX+(a&&a.scrollLeft||r&&r.scrollLeft||0)-(a&&a.clientLeft||r&&r.clientLeft||0),e.pageY=n.clientY+(a&&a.scrollTop||r&&r.scrollTop||0)-(a&&a.clientTop||r&&r.clientTop||0)),!e.relatedTarget&&u&&(e.relatedTarget=u===e.target?n.toElement:u),e.which||s===t||(e.which=1&s?1:2&s?3:4&s?2:0),e}},special:{load:{noBubble:!0},click:{trigger:function(){return b.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):t}},focus:{trigger:function(){if(this!==o.activeElement&&this.focus)try{return this.focus(),!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){return this===o.activeElement&&this.blur?(this.blur(),!1):t},delegateType:"focusout"},beforeunload:{postDispatch:function(e){e.result!==t&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=b.extend(new b.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?b.event.trigger(i,null,t):b.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},b.removeEvent=o.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]===i&&(e[r]=null),e.detachEvent(r,n))},b.Event=function(e,n){return this instanceof b.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?it:ot):this.type=e,n&&b.extend(this,n),this.timeStamp=e&&e.timeStamp||b.now(),this[b.expando]=!0,t):new b.Event(e,n)},b.Event.prototype={isDefaultPrevented:ot,isPropagationStopped:ot,isImmediatePropagationStopped:ot,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=it,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=it,e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=it,this.stopPropagation()}},b.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){b.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;
return(!i||i!==r&&!b.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),b.support.submitBubbles||(b.event.special.submit={setup:function(){return b.nodeName(this,"form")?!1:(b.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=b.nodeName(n,"input")||b.nodeName(n,"button")?n.form:t;r&&!b._data(r,"submitBubbles")&&(b.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),b._data(r,"submitBubbles",!0))}),t)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&b.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return b.nodeName(this,"form")?!1:(b.event.remove(this,"._submit"),t)}}),b.support.changeBubbles||(b.event.special.change={setup:function(){return Z.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(b.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),b.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),b.event.simulate("change",this,e,!0)})),!1):(b.event.add(this,"beforeactivate._change",function(e){var t=e.target;Z.test(t.nodeName)&&!b._data(t,"changeBubbles")&&(b.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||b.event.simulate("change",this.parentNode,e,!0)}),b._data(t,"changeBubbles",!0))}),t)},handle:function(e){var n=e.target;return this!==n||e.isSimulated||e.isTrigger||"radio"!==n.type&&"checkbox"!==n.type?e.handleObj.handler.apply(this,arguments):t},teardown:function(){return b.event.remove(this,"._change"),!Z.test(this.nodeName)}}),b.support.focusinBubbles||b.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){b.event.simulate(t,e.target,b.event.fix(e),!0)};b.event.special[t]={setup:function(){0===n++&&o.addEventListener(e,r,!0)},teardown:function(){0===--n&&o.removeEventListener(e,r,!0)}}}),b.fn.extend({on:function(e,n,r,i,o){var a,s;if("object"==typeof e){"string"!=typeof n&&(r=r||n,n=t);for(a in e)this.on(a,n,r,e[a],o);return this}if(null==r&&null==i?(i=n,r=n=t):null==i&&("string"==typeof n?(i=r,r=t):(i=r,r=n,n=t)),i===!1)i=ot;else if(!i)return this;return 1===o&&(s=i,i=function(e){return b().off(e),s.apply(this,arguments)},i.guid=s.guid||(s.guid=b.guid++)),this.each(function(){b.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,o;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,b(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof e){for(o in e)this.off(o,n,e[o]);return this}return(n===!1||"function"==typeof n)&&(r=n,n=t),r===!1&&(r=ot),this.each(function(){b.event.remove(this,e,r,n)})},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},trigger:function(e,t){return this.each(function(){b.event.trigger(e,t,this)})},triggerHandler:function(e,n){var r=this[0];return r?b.event.trigger(e,n,r,!0):t}}),function(e,t){var n,r,i,o,a,s,u,l,c,p,f,d,h,g,m,y,v,x="sizzle"+-new Date,w=e.document,T={},N=0,C=0,k=it(),E=it(),S=it(),A=typeof t,j=1<<31,D=[],L=D.pop,H=D.push,q=D.slice,M=D.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++)if(this[t]===e)return t;return-1},_="[\\x20\\t\\r\\n\\f]",F="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=F.replace("w","w#"),B="([*^$|!~]?=)",P="\\["+_+"*("+F+")"+_+"*(?:"+B+_+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+O+")|)|)"+_+"*\\]",R=":("+F+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+P.replace(3,8)+")*)|.*)\\)|)",W=RegExp("^"+_+"+|((?:^|[^\\\\])(?:\\\\.)*)"+_+"+$","g"),$=RegExp("^"+_+"*,"+_+"*"),I=RegExp("^"+_+"*([\\x20\\t\\r\\n\\f>+~])"+_+"*"),z=RegExp(R),X=RegExp("^"+O+"$"),U={ID:RegExp("^#("+F+")"),CLASS:RegExp("^\\.("+F+")"),NAME:RegExp("^\\[name=['\"]?("+F+")['\"]?\\]"),TAG:RegExp("^("+F.replace("w","w*")+")"),ATTR:RegExp("^"+P),PSEUDO:RegExp("^"+R),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+_+"*(even|odd|(([+-]|)(\\d*)n|)"+_+"*(?:([+-]|)"+_+"*(\\d+)|))"+_+"*\\)|)","i"),needsContext:RegExp("^"+_+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+_+"*((?:-\\d)?\\d*)"+_+"*\\)|)(?=[^-]|$)","i")},V=/[\x20\t\r\n\f]*[+~]/,Y=/^[^{]+\{\s*\[native code/,J=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,G=/^(?:input|select|textarea|button)$/i,Q=/^h\d$/i,K=/'|\\/g,Z=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,et=/\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g,tt=function(e,t){var n="0x"+t-65536;return n!==n?t:0>n?String.fromCharCode(n+65536):String.fromCharCode(55296|n>>10,56320|1023&n)};try{q.call(w.documentElement.childNodes,0)[0].nodeType}catch(nt){q=function(e){var t,n=[];while(t=this[e++])n.push(t);return n}}function rt(e){return Y.test(e+"")}function it(){var e,t=[];return e=function(n,r){return t.push(n+=" ")>i.cacheLength&&delete e[t.shift()],e[n]=r}}function ot(e){return e[x]=!0,e}function at(e){var t=p.createElement("div");try{return e(t)}catch(n){return!1}finally{t=null}}function st(e,t,n,r){var i,o,a,s,u,l,f,g,m,v;if((t?t.ownerDocument||t:w)!==p&&c(t),t=t||p,n=n||[],!e||"string"!=typeof e)return n;if(1!==(s=t.nodeType)&&9!==s)return[];if(!d&&!r){if(i=J.exec(e))if(a=i[1]){if(9===s){if(o=t.getElementById(a),!o||!o.parentNode)return n;if(o.id===a)return n.push(o),n}else if(t.ownerDocument&&(o=t.ownerDocument.getElementById(a))&&y(t,o)&&o.id===a)return n.push(o),n}else{if(i[2])return H.apply(n,q.call(t.getElementsByTagName(e),0)),n;if((a=i[3])&&T.getByClassName&&t.getElementsByClassName)return H.apply(n,q.call(t.getElementsByClassName(a),0)),n}if(T.qsa&&!h.test(e)){if(f=!0,g=x,m=t,v=9===s&&e,1===s&&"object"!==t.nodeName.toLowerCase()){l=ft(e),(f=t.getAttribute("id"))?g=f.replace(K,"\\$&"):t.setAttribute("id",g),g="[id='"+g+"'] ",u=l.length;while(u--)l[u]=g+dt(l[u]);m=V.test(e)&&t.parentNode||t,v=l.join(",")}if(v)try{return H.apply(n,q.call(m.querySelectorAll(v),0)),n}catch(b){}finally{f||t.removeAttribute("id")}}}return wt(e.replace(W,"$1"),t,n,r)}a=st.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},c=st.setDocument=function(e){var n=e?e.ownerDocument||e:w;return n!==p&&9===n.nodeType&&n.documentElement?(p=n,f=n.documentElement,d=a(n),T.tagNameNoComments=at(function(e){return e.appendChild(n.createComment("")),!e.getElementsByTagName("*").length}),T.attributes=at(function(e){e.innerHTML="<select></select>";var t=typeof e.lastChild.getAttribute("multiple");return"boolean"!==t&&"string"!==t}),T.getByClassName=at(function(e){return e.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",e.getElementsByClassName&&e.getElementsByClassName("e").length?(e.lastChild.className="e",2===e.getElementsByClassName("e").length):!1}),T.getByName=at(function(e){e.id=x+0,e.innerHTML="<a name='"+x+"'></a><div name='"+x+"'></div>",f.insertBefore(e,f.firstChild);var t=n.getElementsByName&&n.getElementsByName(x).length===2+n.getElementsByName(x+0).length;return T.getIdNotName=!n.getElementById(x),f.removeChild(e),t}),i.attrHandle=at(function(e){return e.innerHTML="<a href='#'></a>",e.firstChild&&typeof e.firstChild.getAttribute!==A&&"#"===e.firstChild.getAttribute("href")})?{}:{href:function(e){return e.getAttribute("href",2)},type:function(e){return e.getAttribute("type")}},T.getIdNotName?(i.find.ID=function(e,t){if(typeof t.getElementById!==A&&!d){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},i.filter.ID=function(e){var t=e.replace(et,tt);return function(e){return e.getAttribute("id")===t}}):(i.find.ID=function(e,n){if(typeof n.getElementById!==A&&!d){var r=n.getElementById(e);return r?r.id===e||typeof r.getAttributeNode!==A&&r.getAttributeNode("id").value===e?[r]:t:[]}},i.filter.ID=function(e){var t=e.replace(et,tt);return function(e){var n=typeof e.getAttributeNode!==A&&e.getAttributeNode("id");return n&&n.value===t}}),i.find.TAG=T.tagNameNoComments?function(e,n){return typeof n.getElementsByTagName!==A?n.getElementsByTagName(e):t}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},i.find.NAME=T.getByName&&function(e,n){return typeof n.getElementsByName!==A?n.getElementsByName(name):t},i.find.CLASS=T.getByClassName&&function(e,n){return typeof n.getElementsByClassName===A||d?t:n.getElementsByClassName(e)},g=[],h=[":focus"],(T.qsa=rt(n.querySelectorAll))&&(at(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||h.push("\\["+_+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),e.querySelectorAll(":checked").length||h.push(":checked")}),at(function(e){e.innerHTML="<input type='hidden' i=''/>",e.querySelectorAll("[i^='']").length&&h.push("[*^$]="+_+"*(?:\"\"|'')"),e.querySelectorAll(":enabled").length||h.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),h.push(",.*:")})),(T.matchesSelector=rt(m=f.matchesSelector||f.mozMatchesSelector||f.webkitMatchesSelector||f.oMatchesSelector||f.msMatchesSelector))&&at(function(e){T.disconnectedMatch=m.call(e,"div"),m.call(e,"[s!='']:x"),g.push("!=",R)}),h=RegExp(h.join("|")),g=RegExp(g.join("|")),y=rt(f.contains)||f.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},v=f.compareDocumentPosition?function(e,t){var r;return e===t?(u=!0,0):(r=t.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(t))?1&r||e.parentNode&&11===e.parentNode.nodeType?e===n||y(w,e)?-1:t===n||y(w,t)?1:0:4&r?-1:1:e.compareDocumentPosition?-1:1}:function(e,t){var r,i=0,o=e.parentNode,a=t.parentNode,s=[e],l=[t];if(e===t)return u=!0,0;if(!o||!a)return e===n?-1:t===n?1:o?-1:a?1:0;if(o===a)return ut(e,t);r=e;while(r=r.parentNode)s.unshift(r);r=t;while(r=r.parentNode)l.unshift(r);while(s[i]===l[i])i++;return i?ut(s[i],l[i]):s[i]===w?-1:l[i]===w?1:0},u=!1,[0,0].sort(v),T.detectDuplicates=u,p):p},st.matches=function(e,t){return st(e,null,null,t)},st.matchesSelector=function(e,t){if((e.ownerDocument||e)!==p&&c(e),t=t.replace(Z,"='$1']"),!(!T.matchesSelector||d||g&&g.test(t)||h.test(t)))try{var n=m.call(e,t);if(n||T.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(r){}return st(t,p,null,[e]).length>0},st.contains=function(e,t){return(e.ownerDocument||e)!==p&&c(e),y(e,t)},st.attr=function(e,t){var n;return(e.ownerDocument||e)!==p&&c(e),d||(t=t.toLowerCase()),(n=i.attrHandle[t])?n(e):d||T.attributes?e.getAttribute(t):((n=e.getAttributeNode(t))||e.getAttribute(t))&&e[t]===!0?t:n&&n.specified?n.value:null},st.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},st.uniqueSort=function(e){var t,n=[],r=1,i=0;if(u=!T.detectDuplicates,e.sort(v),u){for(;t=e[r];r++)t===e[r-1]&&(i=n.push(r));while(i--)e.splice(n[i],1)}return e};function ut(e,t){var n=t&&e,r=n&&(~t.sourceIndex||j)-(~e.sourceIndex||j);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function lt(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function ct(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function pt(e){return ot(function(t){return t=+t,ot(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}o=st.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=o(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r];r++)n+=o(t);return n},i=st.selectors={cacheLength:50,createPseudo:ot,match:U,find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(et,tt),e[3]=(e[4]||e[5]||"").replace(et,tt),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||st.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&st.error(e[0]),e},PSEUDO:function(e){var t,n=!e[5]&&e[2];return U.CHILD.test(e[0])?null:(e[4]?e[2]=e[4]:n&&z.test(n)&&(t=ft(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){return"*"===e?function(){return!0}:(e=e.replace(et,tt).toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e})},CLASS:function(e){var t=k[e+" "];return t||(t=RegExp("(^|"+_+")"+e+"("+_+"|$)"))&&k(e,function(e){return t.test(e.className||typeof e.getAttribute!==A&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=st.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i+" ").indexOf(n)>-1:"|="===t?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,p,f,d,h,g=o!==a?"nextSibling":"previousSibling",m=t.parentNode,y=s&&t.nodeName.toLowerCase(),v=!u&&!s;if(m){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===y:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?m.firstChild:m.lastChild],a&&v){c=m[x]||(m[x]={}),l=c[e]||[],d=l[0]===N&&l[1],f=l[0]===N&&l[2],p=d&&m.childNodes[d];while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if(1===p.nodeType&&++f&&p===t){c[e]=[N,d,f];break}}else if(v&&(l=(t[x]||(t[x]={}))[e])&&l[0]===N)f=l[1];else while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===y:1===p.nodeType)&&++f&&(v&&((p[x]||(p[x]={}))[e]=[N,f]),p===t))break;return f-=i,f===r||0===f%r&&f/r>=0}}},PSEUDO:function(e,t){var n,r=i.pseudos[e]||i.setFilters[e.toLowerCase()]||st.error("unsupported pseudo: "+e);return r[x]?r(t):r.length>1?(n=[e,e,"",t],i.setFilters.hasOwnProperty(e.toLowerCase())?ot(function(e,n){var i,o=r(e,t),a=o.length;while(a--)i=M.call(e,o[a]),e[i]=!(n[i]=o[a])}):function(e){return r(e,0,n)}):r}},pseudos:{not:ot(function(e){var t=[],n=[],r=s(e.replace(W,"$1"));return r[x]?ot(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}}),has:ot(function(e){return function(t){return st(e,t).length>0}}),contains:ot(function(e){return function(t){return(t.textContent||t.innerText||o(t)).indexOf(e)>-1}}),lang:ot(function(e){return X.test(e||"")||st.error("unsupported lang: "+e),e=e.replace(et,tt).toLowerCase(),function(t){var n;do if(n=d?t.getAttribute("xml:lang")||t.getAttribute("lang"):t.lang)return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===f},focus:function(e){return e===p.activeElement&&(!p.hasFocus||p.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!i.pseudos.empty(e)},header:function(e){return Q.test(e.nodeName)},input:function(e){return G.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:pt(function(){return[0]}),last:pt(function(e,t){return[t-1]}),eq:pt(function(e,t,n){return[0>n?n+t:n]}),even:pt(function(e,t){var n=0;for(;t>n;n+=2)e.push(n);return e}),odd:pt(function(e,t){var n=1;for(;t>n;n+=2)e.push(n);return e}),lt:pt(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:pt(function(e,t,n){var r=0>n?n+t:n;for(;t>++r;)e.push(r);return e})}};for(n in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})i.pseudos[n]=lt(n);for(n in{submit:!0,reset:!0})i.pseudos[n]=ct(n);function ft(e,t){var n,r,o,a,s,u,l,c=E[e+" "];if(c)return t?0:c.slice(0);s=e,u=[],l=i.preFilter;while(s){(!n||(r=$.exec(s)))&&(r&&(s=s.slice(r[0].length)||s),u.push(o=[])),n=!1,(r=I.exec(s))&&(n=r.shift(),o.push({value:n,type:r[0].replace(W," ")}),s=s.slice(n.length));for(a in i.filter)!(r=U[a].exec(s))||l[a]&&!(r=l[a](r))||(n=r.shift(),o.push({value:n,type:a,matches:r}),s=s.slice(n.length));if(!n)break}return t?s.length:s?st.error(e):E(e,u).slice(0)}function dt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}function ht(e,t,n){var i=t.dir,o=n&&"parentNode"===i,a=C++;return t.first?function(t,n,r){while(t=t[i])if(1===t.nodeType||o)return e(t,n,r)}:function(t,n,s){var u,l,c,p=N+" "+a;if(s){while(t=t[i])if((1===t.nodeType||o)&&e(t,n,s))return!0}else while(t=t[i])if(1===t.nodeType||o)if(c=t[x]||(t[x]={}),(l=c[i])&&l[0]===p){if((u=l[1])===!0||u===r)return u===!0}else if(l=c[i]=[p],l[1]=e(t,n,s)||r,l[1]===!0)return!0}}function gt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function mt(e,t,n,r,i){var o,a=[],s=0,u=e.length,l=null!=t;for(;u>s;s++)(o=e[s])&&(!n||n(o,r,i))&&(a.push(o),l&&t.push(s));return a}function yt(e,t,n,r,i,o){return r&&!r[x]&&(r=yt(r)),i&&!i[x]&&(i=yt(i,o)),ot(function(o,a,s,u){var l,c,p,f=[],d=[],h=a.length,g=o||xt(t||"*",s.nodeType?[s]:s,[]),m=!e||!o&&t?g:mt(g,f,e,s,u),y=n?i||(o?e:h||r)?[]:a:m;if(n&&n(m,y,s,u),r){l=mt(y,d),r(l,[],s,u),c=l.length;while(c--)(p=l[c])&&(y[d[c]]=!(m[d[c]]=p))}if(o){if(i||e){if(i){l=[],c=y.length;while(c--)(p=y[c])&&l.push(m[c]=p);i(null,y=[],l,u)}c=y.length;while(c--)(p=y[c])&&(l=i?M.call(o,p):f[c])>-1&&(o[l]=!(a[l]=p))}}else y=mt(y===a?y.splice(h,y.length):y),i?i(null,a,y,u):H.apply(a,y)})}function vt(e){var t,n,r,o=e.length,a=i.relative[e[0].type],s=a||i.relative[" "],u=a?1:0,c=ht(function(e){return e===t},s,!0),p=ht(function(e){return M.call(t,e)>-1},s,!0),f=[function(e,n,r){return!a&&(r||n!==l)||((t=n).nodeType?c(e,n,r):p(e,n,r))}];for(;o>u;u++)if(n=i.relative[e[u].type])f=[ht(gt(f),n)];else{if(n=i.filter[e[u].type].apply(null,e[u].matches),n[x]){for(r=++u;o>r;r++)if(i.relative[e[r].type])break;return yt(u>1&&gt(f),u>1&&dt(e.slice(0,u-1)).replace(W,"$1"),n,r>u&&vt(e.slice(u,r)),o>r&&vt(e=e.slice(r)),o>r&&dt(e))}f.push(n)}return gt(f)}function bt(e,t){var n=0,o=t.length>0,a=e.length>0,s=function(s,u,c,f,d){var h,g,m,y=[],v=0,b="0",x=s&&[],w=null!=d,T=l,C=s||a&&i.find.TAG("*",d&&u.parentNode||u),k=N+=null==T?1:Math.random()||.1;for(w&&(l=u!==p&&u,r=n);null!=(h=C[b]);b++){if(a&&h){g=0;while(m=e[g++])if(m(h,u,c)){f.push(h);break}w&&(N=k,r=++n)}o&&((h=!m&&h)&&v--,s&&x.push(h))}if(v+=b,o&&b!==v){g=0;while(m=t[g++])m(x,y,u,c);if(s){if(v>0)while(b--)x[b]||y[b]||(y[b]=L.call(f));y=mt(y)}H.apply(f,y),w&&!s&&y.length>0&&v+t.length>1&&st.uniqueSort(f)}return w&&(N=k,l=T),x};return o?ot(s):s}s=st.compile=function(e,t){var n,r=[],i=[],o=S[e+" "];if(!o){t||(t=ft(e)),n=t.length;while(n--)o=vt(t[n]),o[x]?r.push(o):i.push(o);o=S(e,bt(i,r))}return o};function xt(e,t,n){var r=0,i=t.length;for(;i>r;r++)st(e,t[r],n);return n}function wt(e,t,n,r){var o,a,u,l,c,p=ft(e);if(!r&&1===p.length){if(a=p[0]=p[0].slice(0),a.length>2&&"ID"===(u=a[0]).type&&9===t.nodeType&&!d&&i.relative[a[1].type]){if(t=i.find.ID(u.matches[0].replace(et,tt),t)[0],!t)return n;e=e.slice(a.shift().value.length)}o=U.needsContext.test(e)?0:a.length;while(o--){if(u=a[o],i.relative[l=u.type])break;if((c=i.find[l])&&(r=c(u.matches[0].replace(et,tt),V.test(a[0].type)&&t.parentNode||t))){if(a.splice(o,1),e=r.length&&dt(a),!e)return H.apply(n,q.call(r,0)),n;break}}}return s(e,p)(r,t,d,n,V.test(e)),n}i.pseudos.nth=i.pseudos.eq;function Tt(){}i.filters=Tt.prototype=i.pseudos,i.setFilters=new Tt,c(),st.attr=b.attr,b.find=st,b.expr=st.selectors,b.expr[":"]=b.expr.pseudos,b.unique=st.uniqueSort,b.text=st.getText,b.isXMLDoc=st.isXML,b.contains=st.contains}(e);var at=/Until$/,st=/^(?:parents|prev(?:Until|All))/,ut=/^.[^:#\[\.,]*$/,lt=b.expr.match.needsContext,ct={children:!0,contents:!0,next:!0,prev:!0};b.fn.extend({find:function(e){var t,n,r,i=this.length;if("string"!=typeof e)return r=this,this.pushStack(b(e).filter(function(){for(t=0;i>t;t++)if(b.contains(r[t],this))return!0}));for(n=[],t=0;i>t;t++)b.find(e,this[t],n);return n=this.pushStack(i>1?b.unique(n):n),n.selector=(this.selector?this.selector+" ":"")+e,n},has:function(e){var t,n=b(e,this),r=n.length;return this.filter(function(){for(t=0;r>t;t++)if(b.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(ft(this,e,!1))},filter:function(e){return this.pushStack(ft(this,e,!0))},is:function(e){return!!e&&("string"==typeof e?lt.test(e)?b(e,this.context).index(this[0])>=0:b.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){var n,r=0,i=this.length,o=[],a=lt.test(e)||"string"!=typeof e?b(e,t||this.context):0;for(;i>r;r++){n=this[r];while(n&&n.ownerDocument&&n!==t&&11!==n.nodeType){if(a?a.index(n)>-1:b.find.matchesSelector(n,e)){o.push(n);break}n=n.parentNode}}return this.pushStack(o.length>1?b.unique(o):o)},index:function(e){return e?"string"==typeof e?b.inArray(this[0],b(e)):b.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?b(e,t):b.makeArray(e&&e.nodeType?[e]:e),r=b.merge(this.get(),n);return this.pushStack(b.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),b.fn.andSelf=b.fn.addBack;function pt(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}b.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return b.dir(e,"parentNode")},parentsUntil:function(e,t,n){return b.dir(e,"parentNode",n)},next:function(e){return pt(e,"nextSibling")},prev:function(e){return pt(e,"previousSibling")},nextAll:function(e){return b.dir(e,"nextSibling")},prevAll:function(e){return b.dir(e,"previousSibling")},nextUntil:function(e,t,n){return b.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return b.dir(e,"previousSibling",n)},siblings:function(e){return b.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return b.sibling(e.firstChild)},contents:function(e){return b.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:b.merge([],e.childNodes)}},function(e,t){b.fn[e]=function(n,r){var i=b.map(this,t,n);return at.test(e)||(r=n),r&&"string"==typeof r&&(i=b.filter(r,i)),i=this.length>1&&!ct[e]?b.unique(i):i,this.length>1&&st.test(e)&&(i=i.reverse()),this.pushStack(i)}}),b.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),1===t.length?b.find.matchesSelector(t[0],e)?[t[0]]:[]:b.find.matches(e,t)},dir:function(e,n,r){var i=[],o=e[n];while(o&&9!==o.nodeType&&(r===t||1!==o.nodeType||!b(o).is(r)))1===o.nodeType&&i.push(o),o=o[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});function ft(e,t,n){if(t=t||0,b.isFunction(t))return b.grep(e,function(e,r){var i=!!t.call(e,r,e);return i===n});if(t.nodeType)return b.grep(e,function(e){return e===t===n});if("string"==typeof t){var r=b.grep(e,function(e){return 1===e.nodeType});if(ut.test(t))return b.filter(t,r,!n);t=b.filter(t,r)}return b.grep(e,function(e){return b.inArray(e,t)>=0===n})}function dt(e){var t=ht.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}var ht="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",gt=/ jQuery\d+="(?:null|\d+)"/g,mt=RegExp("<(?:"+ht+")[\\s/>]","i"),yt=/^\s+/,vt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bt=/<([\w:]+)/,xt=/<tbody/i,wt=/<|&#?\w+;/,Tt=/<(?:script|style|link)/i,Nt=/^(?:checkbox|radio)$/i,Ct=/checked\s*(?:[^=]|=\s*.checked.)/i,kt=/^$|\/(?:java|ecma)script/i,Et=/^true\/(.*)/,St=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,At={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:b.support.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},jt=dt(o),Dt=jt.appendChild(o.createElement("div"));At.optgroup=At.option,At.tbody=At.tfoot=At.colgroup=At.caption=At.thead,At.th=At.td,b.fn.extend({text:function(e){return b.access(this,function(e){return e===t?b.text(this):this.empty().append((this[0]&&this[0].ownerDocument||o).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(b.isFunction(e))return this.each(function(t){b(this).wrapAll(e.call(this,t))});if(this[0]){var t=b(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&1===e.firstChild.nodeType)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return b.isFunction(e)?this.each(function(t){b(this).wrapInner(e.call(this,t))}):this.each(function(){var t=b(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=b.isFunction(e);return this.each(function(n){b(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){b.nodeName(this,"body")||b(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&this.insertBefore(e,this.firstChild)})},before:function(){return this.domManip(arguments,!1,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,!1,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=0;for(;null!=(n=this[r]);r++)(!e||b.filter(e,[n]).length>0)&&(t||1!==n.nodeType||b.cleanData(Ot(n)),n.parentNode&&(t&&b.contains(n.ownerDocument,n)&&Mt(Ot(n,"script")),n.parentNode.removeChild(n)));return this},empty:function(){var e,t=0;for(;null!=(e=this[t]);t++){1===e.nodeType&&b.cleanData(Ot(e,!1));while(e.firstChild)e.removeChild(e.firstChild);e.options&&b.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return b.clone(this,e,t)})},html:function(e){return b.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return 1===n.nodeType?n.innerHTML.replace(gt,""):t;if(!("string"!=typeof e||Tt.test(e)||!b.support.htmlSerialize&&mt.test(e)||!b.support.leadingWhitespace&&yt.test(e)||At[(bt.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(vt,"<$1></$2>");try{for(;i>r;r++)n=this[r]||{},1===n.nodeType&&(b.cleanData(Ot(n,!1)),n.innerHTML=e);n=0}catch(o){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(e){var t=b.isFunction(e);return t||"string"==typeof e||(e=b(e).not(this).detach()),this.domManip([e],!0,function(e){var t=this.nextSibling,n=this.parentNode;n&&(b(this).remove(),n.insertBefore(e,t))})},detach:function(e){return this.remove(e,!0)},domManip:function(e,n,r){e=f.apply([],e);var i,o,a,s,u,l,c=0,p=this.length,d=this,h=p-1,g=e[0],m=b.isFunction(g);if(m||!(1>=p||"string"!=typeof g||b.support.checkClone)&&Ct.test(g))return this.each(function(i){var o=d.eq(i);m&&(e[0]=g.call(this,i,n?o.html():t)),o.domManip(e,n,r)});if(p&&(l=b.buildFragment(e,this[0].ownerDocument,!1,this),i=l.firstChild,1===l.childNodes.length&&(l=i),i)){for(n=n&&b.nodeName(i,"tr"),s=b.map(Ot(l,"script"),Ht),a=s.length;p>c;c++)o=l,c!==h&&(o=b.clone(o,!0,!0),a&&b.merge(s,Ot(o,"script"))),r.call(n&&b.nodeName(this[c],"table")?Lt(this[c],"tbody"):this[c],o,c);if(a)for(u=s[s.length-1].ownerDocument,b.map(s,qt),c=0;a>c;c++)o=s[c],kt.test(o.type||"")&&!b._data(o,"globalEval")&&b.contains(u,o)&&(o.src?b.ajax({url:o.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):b.globalEval((o.text||o.textContent||o.innerHTML||"").replace(St,"")));l=i=null}return this}});function Lt(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function Ht(e){var t=e.getAttributeNode("type");return e.type=(t&&t.specified)+"/"+e.type,e}function qt(e){var t=Et.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function Mt(e,t){var n,r=0;for(;null!=(n=e[r]);r++)b._data(n,"globalEval",!t||b._data(t[r],"globalEval"))}function _t(e,t){if(1===t.nodeType&&b.hasData(e)){var n,r,i,o=b._data(e),a=b._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,i=s[n].length;i>r;r++)b.event.add(t,n,s[n][r])}a.data&&(a.data=b.extend({},a.data))}}function Ft(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!b.support.noCloneEvent&&t[b.expando]){i=b._data(t);for(r in i.events)b.removeEvent(t,r,i.handle);t.removeAttribute(b.expando)}"script"===n&&t.text!==e.text?(Ht(t).text=e.text,qt(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),b.support.html5Clone&&e.innerHTML&&!b.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&Nt.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.defaultSelected=t.selected=e.defaultSelected:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}}b.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){b.fn[e]=function(e){var n,r=0,i=[],o=b(e),a=o.length-1;for(;a>=r;r++)n=r===a?this:this.clone(!0),b(o[r])[t](n),d.apply(i,n.get());return this.pushStack(i)}});function Ot(e,n){var r,o,a=0,s=typeof e.getElementsByTagName!==i?e.getElementsByTagName(n||"*"):typeof e.querySelectorAll!==i?e.querySelectorAll(n||"*"):t;if(!s)for(s=[],r=e.childNodes||e;null!=(o=r[a]);a++)!n||b.nodeName(o,n)?s.push(o):b.merge(s,Ot(o,n));return n===t||n&&b.nodeName(e,n)?b.merge([e],s):s}function Bt(e){Nt.test(e.type)&&(e.defaultChecked=e.checked)}b.extend({clone:function(e,t,n){var r,i,o,a,s,u=b.contains(e.ownerDocument,e);if(b.support.html5Clone||b.isXMLDoc(e)||!mt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(Dt.innerHTML=e.outerHTML,Dt.removeChild(o=Dt.firstChild)),!(b.support.noCloneEvent&&b.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||b.isXMLDoc(e)))for(r=Ot(o),s=Ot(e),a=0;null!=(i=s[a]);++a)r[a]&&Ft(i,r[a]);if(t)if(n)for(s=s||Ot(e),r=r||Ot(o),a=0;null!=(i=s[a]);a++)_t(i,r[a]);else _t(e,o);return r=Ot(o,"script"),r.length>0&&Mt(r,!u&&Ot(e,"script")),r=s=i=null,o},buildFragment:function(e,t,n,r){var i,o,a,s,u,l,c,p=e.length,f=dt(t),d=[],h=0;for(;p>h;h++)if(o=e[h],o||0===o)if("object"===b.type(o))b.merge(d,o.nodeType?[o]:o);else if(wt.test(o)){s=s||f.appendChild(t.createElement("div")),u=(bt.exec(o)||["",""])[1].toLowerCase(),c=At[u]||At._default,s.innerHTML=c[1]+o.replace(vt,"<$1></$2>")+c[2],i=c[0];while(i--)s=s.lastChild;if(!b.support.leadingWhitespace&&yt.test(o)&&d.push(t.createTextNode(yt.exec(o)[0])),!b.support.tbody){o="table"!==u||xt.test(o)?"<table>"!==c[1]||xt.test(o)?0:s:s.firstChild,i=o&&o.childNodes.length;while(i--)b.nodeName(l=o.childNodes[i],"tbody")&&!l.childNodes.length&&o.removeChild(l)
}b.merge(d,s.childNodes),s.textContent="";while(s.firstChild)s.removeChild(s.firstChild);s=f.lastChild}else d.push(t.createTextNode(o));s&&f.removeChild(s),b.support.appendChecked||b.grep(Ot(d,"input"),Bt),h=0;while(o=d[h++])if((!r||-1===b.inArray(o,r))&&(a=b.contains(o.ownerDocument,o),s=Ot(f.appendChild(o),"script"),a&&Mt(s),n)){i=0;while(o=s[i++])kt.test(o.type||"")&&n.push(o)}return s=null,f},cleanData:function(e,t){var n,r,o,a,s=0,u=b.expando,l=b.cache,p=b.support.deleteExpando,f=b.event.special;for(;null!=(n=e[s]);s++)if((t||b.acceptData(n))&&(o=n[u],a=o&&l[o])){if(a.events)for(r in a.events)f[r]?b.event.remove(n,r):b.removeEvent(n,r,a.handle);l[o]&&(delete l[o],p?delete n[u]:typeof n.removeAttribute!==i?n.removeAttribute(u):n[u]=null,c.push(o))}}});var Pt,Rt,Wt,$t=/alpha\([^)]*\)/i,It=/opacity\s*=\s*([^)]*)/,zt=/^(top|right|bottom|left)$/,Xt=/^(none|table(?!-c[ea]).+)/,Ut=/^margin/,Vt=RegExp("^("+x+")(.*)$","i"),Yt=RegExp("^("+x+")(?!px)[a-z%]+$","i"),Jt=RegExp("^([+-])=("+x+")","i"),Gt={BODY:"block"},Qt={position:"absolute",visibility:"hidden",display:"block"},Kt={letterSpacing:0,fontWeight:400},Zt=["Top","Right","Bottom","Left"],en=["Webkit","O","Moz","ms"];function tn(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=en.length;while(i--)if(t=en[i]+n,t in e)return t;return r}function nn(e,t){return e=t||e,"none"===b.css(e,"display")||!b.contains(e.ownerDocument,e)}function rn(e,t){var n,r,i,o=[],a=0,s=e.length;for(;s>a;a++)r=e[a],r.style&&(o[a]=b._data(r,"olddisplay"),n=r.style.display,t?(o[a]||"none"!==n||(r.style.display=""),""===r.style.display&&nn(r)&&(o[a]=b._data(r,"olddisplay",un(r.nodeName)))):o[a]||(i=nn(r),(n&&"none"!==n||!i)&&b._data(r,"olddisplay",i?n:b.css(r,"display"))));for(a=0;s>a;a++)r=e[a],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[a]||"":"none"));return e}b.fn.extend({css:function(e,n){return b.access(this,function(e,n,r){var i,o,a={},s=0;if(b.isArray(n)){for(o=Rt(e),i=n.length;i>s;s++)a[n[s]]=b.css(e,n[s],!1,o);return a}return r!==t?b.style(e,n,r):b.css(e,n)},e,n,arguments.length>1)},show:function(){return rn(this,!0)},hide:function(){return rn(this)},toggle:function(e){var t="boolean"==typeof e;return this.each(function(){(t?e:nn(this))?b(this).show():b(this).hide()})}}),b.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Wt(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":b.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,a,s,u=b.camelCase(n),l=e.style;if(n=b.cssProps[u]||(b.cssProps[u]=tn(l,u)),s=b.cssHooks[n]||b.cssHooks[u],r===t)return s&&"get"in s&&(o=s.get(e,!1,i))!==t?o:l[n];if(a=typeof r,"string"===a&&(o=Jt.exec(r))&&(r=(o[1]+1)*o[2]+parseFloat(b.css(e,n)),a="number"),!(null==r||"number"===a&&isNaN(r)||("number"!==a||b.cssNumber[u]||(r+="px"),b.support.clearCloneStyle||""!==r||0!==n.indexOf("background")||(l[n]="inherit"),s&&"set"in s&&(r=s.set(e,r,i))===t)))try{l[n]=r}catch(c){}}},css:function(e,n,r,i){var o,a,s,u=b.camelCase(n);return n=b.cssProps[u]||(b.cssProps[u]=tn(e.style,u)),s=b.cssHooks[n]||b.cssHooks[u],s&&"get"in s&&(a=s.get(e,!0,r)),a===t&&(a=Wt(e,n,i)),"normal"===a&&n in Kt&&(a=Kt[n]),""===r||r?(o=parseFloat(a),r===!0||b.isNumeric(o)?o||0:a):a},swap:function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i}}),e.getComputedStyle?(Rt=function(t){return e.getComputedStyle(t,null)},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),u=s?s.getPropertyValue(n)||s[n]:t,l=e.style;return s&&(""!==u||b.contains(e.ownerDocument,e)||(u=b.style(e,n)),Yt.test(u)&&Ut.test(n)&&(i=l.width,o=l.minWidth,a=l.maxWidth,l.minWidth=l.maxWidth=l.width=u,u=s.width,l.width=i,l.minWidth=o,l.maxWidth=a)),u}):o.documentElement.currentStyle&&(Rt=function(e){return e.currentStyle},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),u=s?s[n]:t,l=e.style;return null==u&&l&&l[n]&&(u=l[n]),Yt.test(u)&&!zt.test(n)&&(i=l.left,o=e.runtimeStyle,a=o&&o.left,a&&(o.left=e.currentStyle.left),l.left="fontSize"===n?"1em":u,u=l.pixelLeft+"px",l.left=i,a&&(o.left=a)),""===u?"auto":u});function on(e,t,n){var r=Vt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function an(e,t,n,r,i){var o=n===(r?"border":"content")?4:"width"===t?1:0,a=0;for(;4>o;o+=2)"margin"===n&&(a+=b.css(e,n+Zt[o],!0,i)),r?("content"===n&&(a-=b.css(e,"padding"+Zt[o],!0,i)),"margin"!==n&&(a-=b.css(e,"border"+Zt[o]+"Width",!0,i))):(a+=b.css(e,"padding"+Zt[o],!0,i),"padding"!==n&&(a+=b.css(e,"border"+Zt[o]+"Width",!0,i)));return a}function sn(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=Rt(e),a=b.support.boxSizing&&"border-box"===b.css(e,"boxSizing",!1,o);if(0>=i||null==i){if(i=Wt(e,t,o),(0>i||null==i)&&(i=e.style[t]),Yt.test(i))return i;r=a&&(b.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+an(e,t,n||(a?"border":"content"),r,o)+"px"}function un(e){var t=o,n=Gt[e];return n||(n=ln(e,t),"none"!==n&&n||(Pt=(Pt||b("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(t.documentElement),t=(Pt[0].contentWindow||Pt[0].contentDocument).document,t.write("<!doctype html><html><body>"),t.close(),n=ln(e,t),Pt.detach()),Gt[e]=n),n}function ln(e,t){var n=b(t.createElement(e)).appendTo(t.body),r=b.css(n[0],"display");return n.remove(),r}b.each(["height","width"],function(e,n){b.cssHooks[n]={get:function(e,r,i){return r?0===e.offsetWidth&&Xt.test(b.css(e,"display"))?b.swap(e,Qt,function(){return sn(e,n,i)}):sn(e,n,i):t},set:function(e,t,r){var i=r&&Rt(e);return on(e,t,r?an(e,n,r,b.support.boxSizing&&"border-box"===b.css(e,"boxSizing",!1,i),i):0)}}}),b.support.opacity||(b.cssHooks.opacity={get:function(e,t){return It.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=b.isNumeric(t)?"alpha(opacity="+100*t+")":"",o=r&&r.filter||n.filter||"";n.zoom=1,(t>=1||""===t)&&""===b.trim(o.replace($t,""))&&n.removeAttribute&&(n.removeAttribute("filter"),""===t||r&&!r.filter)||(n.filter=$t.test(o)?o.replace($t,i):o+" "+i)}}),b(function(){b.support.reliableMarginRight||(b.cssHooks.marginRight={get:function(e,n){return n?b.swap(e,{display:"inline-block"},Wt,[e,"marginRight"]):t}}),!b.support.pixelPosition&&b.fn.position&&b.each(["top","left"],function(e,n){b.cssHooks[n]={get:function(e,r){return r?(r=Wt(e,n),Yt.test(r)?b(e).position()[n]+"px":r):t}}})}),b.expr&&b.expr.filters&&(b.expr.filters.hidden=function(e){return 0>=e.offsetWidth&&0>=e.offsetHeight||!b.support.reliableHiddenOffsets&&"none"===(e.style&&e.style.display||b.css(e,"display"))},b.expr.filters.visible=function(e){return!b.expr.filters.hidden(e)}),b.each({margin:"",padding:"",border:"Width"},function(e,t){b.cssHooks[e+t]={expand:function(n){var r=0,i={},o="string"==typeof n?n.split(" "):[n];for(;4>r;r++)i[e+Zt[r]+t]=o[r]||o[r-2]||o[0];return i}},Ut.test(e)||(b.cssHooks[e+t].set=on)});var cn=/%20/g,pn=/\[\]$/,fn=/\r?\n/g,dn=/^(?:submit|button|image|reset|file)$/i,hn=/^(?:input|select|textarea|keygen)/i;b.fn.extend({serialize:function(){return b.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=b.prop(this,"elements");return e?b.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!b(this).is(":disabled")&&hn.test(this.nodeName)&&!dn.test(e)&&(this.checked||!Nt.test(e))}).map(function(e,t){var n=b(this).val();return null==n?null:b.isArray(n)?b.map(n,function(e){return{name:t.name,value:e.replace(fn,"\r\n")}}):{name:t.name,value:n.replace(fn,"\r\n")}}).get()}}),b.param=function(e,n){var r,i=[],o=function(e,t){t=b.isFunction(t)?t():null==t?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(n===t&&(n=b.ajaxSettings&&b.ajaxSettings.traditional),b.isArray(e)||e.jquery&&!b.isPlainObject(e))b.each(e,function(){o(this.name,this.value)});else for(r in e)gn(r,e[r],n,o);return i.join("&").replace(cn,"+")};function gn(e,t,n,r){var i;if(b.isArray(t))b.each(t,function(t,i){n||pn.test(e)?r(e,i):gn(e+"["+("object"==typeof i?t:"")+"]",i,n,r)});else if(n||"object"!==b.type(t))r(e,t);else for(i in t)gn(e+"["+i+"]",t[i],n,r)}b.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){b.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),b.fn.hover=function(e,t){return this.mouseenter(e).mouseleave(t||e)};var mn,yn,vn=b.now(),bn=/\?/,xn=/#.*$/,wn=/([?&])_=[^&]*/,Tn=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Nn=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Cn=/^(?:GET|HEAD)$/,kn=/^\/\//,En=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,Sn=b.fn.load,An={},jn={},Dn="*/".concat("*");try{yn=a.href}catch(Ln){yn=o.createElement("a"),yn.href="",yn=yn.href}mn=En.exec(yn.toLowerCase())||[];function Hn(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(w)||[];if(b.isFunction(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function qn(e,n,r,i){var o={},a=e===jn;function s(u){var l;return o[u]=!0,b.each(e[u]||[],function(e,u){var c=u(n,r,i);return"string"!=typeof c||a||o[c]?a?!(l=c):t:(n.dataTypes.unshift(c),s(c),!1)}),l}return s(n.dataTypes[0])||!o["*"]&&s("*")}function Mn(e,n){var r,i,o=b.ajaxSettings.flatOptions||{};for(i in n)n[i]!==t&&((o[i]?e:r||(r={}))[i]=n[i]);return r&&b.extend(!0,e,r),e}b.fn.load=function(e,n,r){if("string"!=typeof e&&Sn)return Sn.apply(this,arguments);var i,o,a,s=this,u=e.indexOf(" ");return u>=0&&(i=e.slice(u,e.length),e=e.slice(0,u)),b.isFunction(n)?(r=n,n=t):n&&"object"==typeof n&&(a="POST"),s.length>0&&b.ajax({url:e,type:a,dataType:"html",data:n}).done(function(e){o=arguments,s.html(i?b("<div>").append(b.parseHTML(e)).find(i):e)}).complete(r&&function(e,t){s.each(r,o||[e.responseText,t,e])}),this},b.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){b.fn[t]=function(e){return this.on(t,e)}}),b.each(["get","post"],function(e,n){b[n]=function(e,r,i,o){return b.isFunction(r)&&(o=o||i,i=r,r=t),b.ajax({url:e,type:n,dataType:o,data:r,success:i})}}),b.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:yn,type:"GET",isLocal:Nn.test(mn[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Dn,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":e.String,"text html":!0,"text json":b.parseJSON,"text xml":b.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?Mn(Mn(e,b.ajaxSettings),t):Mn(b.ajaxSettings,e)},ajaxPrefilter:Hn(An),ajaxTransport:Hn(jn),ajax:function(e,n){"object"==typeof e&&(n=e,e=t),n=n||{};var r,i,o,a,s,u,l,c,p=b.ajaxSetup({},n),f=p.context||p,d=p.context&&(f.nodeType||f.jquery)?b(f):b.event,h=b.Deferred(),g=b.Callbacks("once memory"),m=p.statusCode||{},y={},v={},x=0,T="canceled",N={readyState:0,getResponseHeader:function(e){var t;if(2===x){if(!c){c={};while(t=Tn.exec(a))c[t[1].toLowerCase()]=t[2]}t=c[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===x?a:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return x||(e=v[n]=v[n]||e,y[e]=t),this},overrideMimeType:function(e){return x||(p.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>x)for(t in e)m[t]=[m[t],e[t]];else N.always(e[N.status]);return this},abort:function(e){var t=e||T;return l&&l.abort(t),k(0,t),this}};if(h.promise(N).complete=g.add,N.success=N.done,N.error=N.fail,p.url=((e||p.url||yn)+"").replace(xn,"").replace(kn,mn[1]+"//"),p.type=n.method||n.type||p.method||p.type,p.dataTypes=b.trim(p.dataType||"*").toLowerCase().match(w)||[""],null==p.crossDomain&&(r=En.exec(p.url.toLowerCase()),p.crossDomain=!(!r||r[1]===mn[1]&&r[2]===mn[2]&&(r[3]||("http:"===r[1]?80:443))==(mn[3]||("http:"===mn[1]?80:443)))),p.data&&p.processData&&"string"!=typeof p.data&&(p.data=b.param(p.data,p.traditional)),qn(An,p,n,N),2===x)return N;u=p.global,u&&0===b.active++&&b.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!Cn.test(p.type),o=p.url,p.hasContent||(p.data&&(o=p.url+=(bn.test(o)?"&":"?")+p.data,delete p.data),p.cache===!1&&(p.url=wn.test(o)?o.replace(wn,"$1_="+vn++):o+(bn.test(o)?"&":"?")+"_="+vn++)),p.ifModified&&(b.lastModified[o]&&N.setRequestHeader("If-Modified-Since",b.lastModified[o]),b.etag[o]&&N.setRequestHeader("If-None-Match",b.etag[o])),(p.data&&p.hasContent&&p.contentType!==!1||n.contentType)&&N.setRequestHeader("Content-Type",p.contentType),N.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+Dn+"; q=0.01":""):p.accepts["*"]);for(i in p.headers)N.setRequestHeader(i,p.headers[i]);if(p.beforeSend&&(p.beforeSend.call(f,N,p)===!1||2===x))return N.abort();T="abort";for(i in{success:1,error:1,complete:1})N[i](p[i]);if(l=qn(jn,p,n,N)){N.readyState=1,u&&d.trigger("ajaxSend",[N,p]),p.async&&p.timeout>0&&(s=setTimeout(function(){N.abort("timeout")},p.timeout));try{x=1,l.send(y,k)}catch(C){if(!(2>x))throw C;k(-1,C)}}else k(-1,"No Transport");function k(e,n,r,i){var c,y,v,w,T,C=n;2!==x&&(x=2,s&&clearTimeout(s),l=t,a=i||"",N.readyState=e>0?4:0,r&&(w=_n(p,N,r)),e>=200&&300>e||304===e?(p.ifModified&&(T=N.getResponseHeader("Last-Modified"),T&&(b.lastModified[o]=T),T=N.getResponseHeader("etag"),T&&(b.etag[o]=T)),204===e?(c=!0,C="nocontent"):304===e?(c=!0,C="notmodified"):(c=Fn(p,w),C=c.state,y=c.data,v=c.error,c=!v)):(v=C,(e||!C)&&(C="error",0>e&&(e=0))),N.status=e,N.statusText=(n||C)+"",c?h.resolveWith(f,[y,C,N]):h.rejectWith(f,[N,C,v]),N.statusCode(m),m=t,u&&d.trigger(c?"ajaxSuccess":"ajaxError",[N,p,c?y:v]),g.fireWith(f,[N,C]),u&&(d.trigger("ajaxComplete",[N,p]),--b.active||b.event.trigger("ajaxStop")))}return N},getScript:function(e,n){return b.get(e,t,n,"script")},getJSON:function(e,t,n){return b.get(e,t,n,"json")}});function _n(e,n,r){var i,o,a,s,u=e.contents,l=e.dataTypes,c=e.responseFields;for(s in c)s in r&&(n[c[s]]=r[s]);while("*"===l[0])l.shift(),o===t&&(o=e.mimeType||n.getResponseHeader("Content-Type"));if(o)for(s in u)if(u[s]&&u[s].test(o)){l.unshift(s);break}if(l[0]in r)a=l[0];else{for(s in r){if(!l[0]||e.converters[s+" "+l[0]]){a=s;break}i||(i=s)}a=a||i}return a?(a!==l[0]&&l.unshift(a),r[a]):t}function Fn(e,t){var n,r,i,o,a={},s=0,u=e.dataTypes.slice(),l=u[0];if(e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u[1])for(i in e.converters)a[i.toLowerCase()]=e.converters[i];for(;r=u[++s];)if("*"!==r){if("*"!==l&&l!==r){if(i=a[l+" "+r]||a["* "+r],!i)for(n in a)if(o=n.split(" "),o[1]===r&&(i=a[l+" "+o[0]]||a["* "+o[0]])){i===!0?i=a[n]:a[n]!==!0&&(r=o[0],u.splice(s--,0,r));break}if(i!==!0)if(i&&e["throws"])t=i(t);else try{t=i(t)}catch(c){return{state:"parsererror",error:i?c:"No conversion from "+l+" to "+r}}}l=r}return{state:"success",data:t}}b.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return b.globalEval(e),e}}}),b.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),b.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=o.head||b("head")[0]||o.documentElement;return{send:function(t,i){n=o.createElement("script"),n.async=!0,e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,t){(t||!n.readyState||/loaded|complete/.test(n.readyState))&&(n.onload=n.onreadystatechange=null,n.parentNode&&n.parentNode.removeChild(n),n=null,t||i(200,"success"))},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(t,!0)}}}});var On=[],Bn=/(=)\?(?=&|$)|\?\?/;b.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=On.pop()||b.expando+"_"+vn++;return this[e]=!0,e}}),b.ajaxPrefilter("json jsonp",function(n,r,i){var o,a,s,u=n.jsonp!==!1&&(Bn.test(n.url)?"url":"string"==typeof n.data&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Bn.test(n.data)&&"data");return u||"jsonp"===n.dataTypes[0]?(o=n.jsonpCallback=b.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,u?n[u]=n[u].replace(Bn,"$1"+o):n.jsonp!==!1&&(n.url+=(bn.test(n.url)?"&":"?")+n.jsonp+"="+o),n.converters["script json"]=function(){return s||b.error(o+" was not called"),s[0]},n.dataTypes[0]="json",a=e[o],e[o]=function(){s=arguments},i.always(function(){e[o]=a,n[o]&&(n.jsonpCallback=r.jsonpCallback,On.push(o)),s&&b.isFunction(a)&&a(s[0]),s=a=t}),"script"):t});var Pn,Rn,Wn=0,$n=e.ActiveXObject&&function(){var e;for(e in Pn)Pn[e](t,!0)};function In(){try{return new e.XMLHttpRequest}catch(t){}}function zn(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}b.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&In()||zn()}:In,Rn=b.ajaxSettings.xhr(),b.support.cors=!!Rn&&"withCredentials"in Rn,Rn=b.support.ajax=!!Rn,Rn&&b.ajaxTransport(function(n){if(!n.crossDomain||b.support.cors){var r;return{send:function(i,o){var a,s,u=n.xhr();if(n.username?u.open(n.type,n.url,n.async,n.username,n.password):u.open(n.type,n.url,n.async),n.xhrFields)for(s in n.xhrFields)u[s]=n.xhrFields[s];n.mimeType&&u.overrideMimeType&&u.overrideMimeType(n.mimeType),n.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");try{for(s in i)u.setRequestHeader(s,i[s])}catch(l){}u.send(n.hasContent&&n.data||null),r=function(e,i){var s,l,c,p;try{if(r&&(i||4===u.readyState))if(r=t,a&&(u.onreadystatechange=b.noop,$n&&delete Pn[a]),i)4!==u.readyState&&u.abort();else{p={},s=u.status,l=u.getAllResponseHeaders(),"string"==typeof u.responseText&&(p.text=u.responseText);try{c=u.statusText}catch(f){c=""}s||!n.isLocal||n.crossDomain?1223===s&&(s=204):s=p.text?200:404}}catch(d){i||o(-1,d)}p&&o(s,c,p,l)},n.async?4===u.readyState?setTimeout(r):(a=++Wn,$n&&(Pn||(Pn={},b(e).unload($n)),Pn[a]=r),u.onreadystatechange=r):r()},abort:function(){r&&r(t,!0)}}}});var Xn,Un,Vn=/^(?:toggle|show|hide)$/,Yn=RegExp("^(?:([+-])=|)("+x+")([a-z%]*)$","i"),Jn=/queueHooks$/,Gn=[nr],Qn={"*":[function(e,t){var n,r,i=this.createTween(e,t),o=Yn.exec(t),a=i.cur(),s=+a||0,u=1,l=20;if(o){if(n=+o[2],r=o[3]||(b.cssNumber[e]?"":"px"),"px"!==r&&s){s=b.css(i.elem,e,!0)||n||1;do u=u||".5",s/=u,b.style(i.elem,e,s+r);while(u!==(u=i.cur()/a)&&1!==u&&--l)}i.unit=r,i.start=s,i.end=o[1]?s+(o[1]+1)*n:n}return i}]};function Kn(){return setTimeout(function(){Xn=t}),Xn=b.now()}function Zn(e,t){b.each(t,function(t,n){var r=(Qn[t]||[]).concat(Qn["*"]),i=0,o=r.length;for(;o>i;i++)if(r[i].call(e,t,n))return})}function er(e,t,n){var r,i,o=0,a=Gn.length,s=b.Deferred().always(function(){delete u.elem}),u=function(){if(i)return!1;var t=Xn||Kn(),n=Math.max(0,l.startTime+l.duration-t),r=n/l.duration||0,o=1-r,a=0,u=l.tweens.length;for(;u>a;a++)l.tweens[a].run(o);return s.notifyWith(e,[l,o,n]),1>o&&u?n:(s.resolveWith(e,[l]),!1)},l=s.promise({elem:e,props:b.extend({},t),opts:b.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:Xn||Kn(),duration:n.duration,tweens:[],createTween:function(t,n){var r=b.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(r),r},stop:function(t){var n=0,r=t?l.tweens.length:0;if(i)return this;for(i=!0;r>n;n++)l.tweens[n].run(1);return t?s.resolveWith(e,[l,t]):s.rejectWith(e,[l,t]),this}}),c=l.props;for(tr(c,l.opts.specialEasing);a>o;o++)if(r=Gn[o].call(l,e,c,l.opts))return r;return Zn(l,c),b.isFunction(l.opts.start)&&l.opts.start.call(e,l),b.fx.timer(b.extend(u,{elem:e,anim:l,queue:l.opts.queue})),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always)}function tr(e,t){var n,r,i,o,a;for(i in e)if(r=b.camelCase(i),o=t[r],n=e[i],b.isArray(n)&&(o=n[1],n=e[i]=n[0]),i!==r&&(e[r]=n,delete e[i]),a=b.cssHooks[r],a&&"expand"in a){n=a.expand(n),delete e[r];for(i in n)i in e||(e[i]=n[i],t[i]=o)}else t[r]=o}b.Animation=b.extend(er,{tweener:function(e,t){b.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;i>r;r++)n=e[r],Qn[n]=Qn[n]||[],Qn[n].unshift(t)},prefilter:function(e,t){t?Gn.unshift(e):Gn.push(e)}});function nr(e,t,n){var r,i,o,a,s,u,l,c,p,f=this,d=e.style,h={},g=[],m=e.nodeType&&nn(e);n.queue||(c=b._queueHooks(e,"fx"),null==c.unqueued&&(c.unqueued=0,p=c.empty.fire,c.empty.fire=function(){c.unqueued||p()}),c.unqueued++,f.always(function(){f.always(function(){c.unqueued--,b.queue(e,"fx").length||c.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[d.overflow,d.overflowX,d.overflowY],"inline"===b.css(e,"display")&&"none"===b.css(e,"float")&&(b.support.inlineBlockNeedsLayout&&"inline"!==un(e.nodeName)?d.zoom=1:d.display="inline-block")),n.overflow&&(d.overflow="hidden",b.support.shrinkWrapBlocks||f.always(function(){d.overflow=n.overflow[0],d.overflowX=n.overflow[1],d.overflowY=n.overflow[2]}));for(i in t)if(a=t[i],Vn.exec(a)){if(delete t[i],u=u||"toggle"===a,a===(m?"hide":"show"))continue;g.push(i)}if(o=g.length){s=b._data(e,"fxshow")||b._data(e,"fxshow",{}),"hidden"in s&&(m=s.hidden),u&&(s.hidden=!m),m?b(e).show():f.done(function(){b(e).hide()}),f.done(function(){var t;b._removeData(e,"fxshow");for(t in h)b.style(e,t,h[t])});for(i=0;o>i;i++)r=g[i],l=f.createTween(r,m?s[r]:0),h[r]=s[r]||b.style(e,r),r in s||(s[r]=l.start,m&&(l.end=l.start,l.start="width"===r||"height"===r?1:0))}}function rr(e,t,n,r,i){return new rr.prototype.init(e,t,n,r,i)}b.Tween=rr,rr.prototype={constructor:rr,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(b.cssNumber[n]?"":"px")},cur:function(){var e=rr.propHooks[this.prop];return e&&e.get?e.get(this):rr.propHooks._default.get(this)},run:function(e){var t,n=rr.propHooks[this.prop];return this.pos=t=this.options.duration?b.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):rr.propHooks._default.set(this),this}},rr.prototype.init.prototype=rr.prototype,rr.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=b.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){b.fx.step[e.prop]?b.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[b.cssProps[e.prop]]||b.cssHooks[e.prop])?b.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},rr.propHooks.scrollTop=rr.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},b.each(["toggle","show","hide"],function(e,t){var n=b.fn[t];b.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ir(t,!0),e,r,i)}}),b.fn.extend({fadeTo:function(e,t,n,r){return this.filter(nn).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=b.isEmptyObject(e),o=b.speed(t,n,r),a=function(){var t=er(this,b.extend({},e),o);a.finish=function(){t.stop(!0)},(i||b._data(this,"finish"))&&t.stop(!0)};return a.finish=a,i||o.queue===!1?this.each(a):this.queue(o.queue,a)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return"string"!=typeof e&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=null!=e&&e+"queueHooks",o=b.timers,a=b._data(this);if(n)a[n]&&a[n].stop&&i(a[n]);else for(n in a)a[n]&&a[n].stop&&Jn.test(n)&&i(a[n]);for(n=o.length;n--;)o[n].elem!==this||null!=e&&o[n].queue!==e||(o[n].anim.stop(r),t=!1,o.splice(n,1));(t||!r)&&b.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=b._data(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=b.timers,a=r?r.length:0;for(n.finish=!0,b.queue(this,e,[]),i&&i.cur&&i.cur.finish&&i.cur.finish.call(this),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;a>t;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}});function ir(e,t){var n,r={height:e},i=0;for(t=t?1:0;4>i;i+=2-t)n=Zt[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}b.each({slideDown:ir("show"),slideUp:ir("hide"),slideToggle:ir("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){b.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),b.speed=function(e,t,n){var r=e&&"object"==typeof e?b.extend({},e):{complete:n||!n&&t||b.isFunction(e)&&e,duration:e,easing:n&&t||t&&!b.isFunction(t)&&t};return r.duration=b.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in b.fx.speeds?b.fx.speeds[r.duration]:b.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){b.isFunction(r.old)&&r.old.call(this),r.queue&&b.dequeue(this,r.queue)},r},b.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},b.timers=[],b.fx=rr.prototype.init,b.fx.tick=function(){var e,n=b.timers,r=0;for(Xn=b.now();n.length>r;r++)e=n[r],e()||n[r]!==e||n.splice(r--,1);n.length||b.fx.stop(),Xn=t},b.fx.timer=function(e){e()&&b.timers.push(e)&&b.fx.start()},b.fx.interval=13,b.fx.start=function(){Un||(Un=setInterval(b.fx.tick,b.fx.interval))},b.fx.stop=function(){clearInterval(Un),Un=null},b.fx.speeds={slow:600,fast:200,_default:400},b.fx.step={},b.expr&&b.expr.filters&&(b.expr.filters.animated=function(e){return b.grep(b.timers,function(t){return e===t.elem}).length}),b.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){b.offset.setOffset(this,e,t)});var n,r,o={top:0,left:0},a=this[0],s=a&&a.ownerDocument;if(s)return n=s.documentElement,b.contains(n,a)?(typeof a.getBoundingClientRect!==i&&(o=a.getBoundingClientRect()),r=or(s),{top:o.top+(r.pageYOffset||n.scrollTop)-(n.clientTop||0),left:o.left+(r.pageXOffset||n.scrollLeft)-(n.clientLeft||0)}):o},b.offset={setOffset:function(e,t,n){var r=b.css(e,"position");"static"===r&&(e.style.position="relative");var i=b(e),o=i.offset(),a=b.css(e,"top"),s=b.css(e,"left"),u=("absolute"===r||"fixed"===r)&&b.inArray("auto",[a,s])>-1,l={},c={},p,f;u?(c=i.position(),p=c.top,f=c.left):(p=parseFloat(a)||0,f=parseFloat(s)||0),b.isFunction(t)&&(t=t.call(e,n,o)),null!=t.top&&(l.top=t.top-o.top+p),null!=t.left&&(l.left=t.left-o.left+f),"using"in t?t.using.call(e,l):i.css(l)}},b.fn.extend({position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===b.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),b.nodeName(e[0],"html")||(n=e.offset()),n.top+=b.css(e[0],"borderTopWidth",!0),n.left+=b.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-b.css(r,"marginTop",!0),left:t.left-n.left-b.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||o.documentElement;while(e&&!b.nodeName(e,"html")&&"static"===b.css(e,"position"))e=e.offsetParent;return e||o.documentElement})}}),b.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);b.fn[e]=function(i){return b.access(this,function(e,i,o){var a=or(e);return o===t?a?n in a?a[n]:a.document.documentElement[i]:e[i]:(a?a.scrollTo(r?b(a).scrollLeft():o,r?o:b(a).scrollTop()):e[i]=o,t)},e,i,arguments.length,null)}});function or(e){return b.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}b.each({Height:"height",Width:"width"},function(e,n){b.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){b.fn[i]=function(i,o){var a=arguments.length&&(r||"boolean"!=typeof i),s=r||(i===!0||o===!0?"margin":"border");return b.access(this,function(n,r,i){var o;return b.isWindow(n)?n.document.documentElement["client"+e]:9===n.nodeType?(o=n.documentElement,Math.max(n.body["scroll"+e],o["scroll"+e],n.body["offset"+e],o["offset"+e],o["client"+e])):i===t?b.css(n,r,s):b.style(n,r,i,s)},n,a?i:t,a,null)}})}),e.jQuery=e.$=b,"function"==typeof define&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return b})})(window);
function DSA(){this.select_hash_algorithm=function(b){var a=openpgp.config.config.prefer_hash_algorithm;switch(Math.round(b.bitLength()/8)){case 20:return 2!=a&&11<a&&10!=a&&8>a?2:a;case 28:return 11<a&&8>a?11:a;case 32:return 10<a&&8>a?8:a;default:return util.print_debug("DSA select hash algorithm: returning null for an unknown length of q"),null}};this.sign=function(b,a,c,d,e,f){b=util.getLeftNBits(openpgp_crypto_hashData(b,a),e.bitLength());b=new BigInteger(util.hexstrdump(b),16);a=openpgp_crypto_getRandomBigIntegerInRange(BigInteger.ONE.add(BigInteger.ONE),
e.subtract(BigInteger.ONE));c=c.modPow(a,d).mod(e);e=a.modInverse(e).multiply(b.add(f.multiply(c))).mod(e);f=[];f[0]=c.toMPI();f[1]=e.toMPI();return f};this.verify=function(b,a,c,d,e,f,g,h){b=util.getLeftNBits(openpgp_crypto_hashData(b,d),f.bitLength());b=new BigInteger(util.hexstrdump(b),16);if(0<BigInteger.ZERO.compareTo(a)||0<a.compareTo(f)||0<BigInteger.ZERO.compareTo(c)||0<c.compareTo(f))return util.print_error("invalid DSA Signature"),null;c=c.modInverse(f);b=b.multiply(c).mod(f);a=a.multiply(c).mod(f);
return g.modPow(b,e).multiply(h.modPow(a,e)).mod(e).mod(f)}}
function Elgamal(){this.encrypt=function(b,a,c,d){var e=BigInteger.ONE.add(BigInteger.ONE),f=c.subtract(e),e=openpgp_crypto_getRandomBigIntegerInRange(e,f),e=e.mod(f).add(BigInteger.ONE),f=[];f[0]=a.modPow(e,c);f[1]=d.modPow(e,c).multiply(b).mod(c).toMPI();f[0]=f[0].toMPI();return f};this.decrypt=function(b,a,c,d){util.print_debug("Elgamal Decrypt:\nc1:"+util.hexstrdump(b.toMPI())+"\nc2:"+util.hexstrdump(a.toMPI())+"\np:"+util.hexstrdump(c.toMPI())+"\nx:"+util.hexstrdump(d.toMPI()));return b.modPow(d,
c).modInverse(c).multiply(a).mod(c)}}var dbits,canary=244837814094590,j_lm=15715070==(canary&16777215);function BigInteger(b,a,c){null!=b&&("number"==typeof b?this.fromNumber(b,a,c):null==a&&"string"!=typeof b?this.fromString(b,256):this.fromString(b,a))}function nbi(){return new BigInteger(null)}function am1(b,a,c,d,e,f){for(;0<=--f;){var g=a*this[b++]+c[d]+e,e=Math.floor(g/67108864);c[d++]=g&67108863}return e}
function am2(b,a,c,d,e,f){for(var g=a&32767,a=a>>15;0<=--f;){var h=this[b]&32767,j=this[b++]>>15,k=a*h+j*g,h=g*h+((k&32767)<<15)+c[d]+(e&1073741823),e=(h>>>30)+(k>>>15)+a*j+(e>>>30);c[d++]=h&1073741823}return e}function am3(b,a,c,d,e,f){for(var g=a&16383,a=a>>14;0<=--f;){var h=this[b]&16383,j=this[b++]>>14,k=a*h+j*g,h=g*h+((k&16383)<<14)+c[d]+e,e=(h>>28)+(k>>14)+a*j;c[d++]=h&268435455}return e}
j_lm&&"Microsoft Internet Explorer"==navigator.appName?(BigInteger.prototype.am=am2,dbits=30):j_lm&&"Netscape"!=navigator.appName?(BigInteger.prototype.am=am1,dbits=26):(BigInteger.prototype.am=am3,dbits=28);BigInteger.prototype.DB=dbits;BigInteger.prototype.DM=(1<<dbits)-1;BigInteger.prototype.DV=1<<dbits;var BI_FP=52;BigInteger.prototype.FV=Math.pow(2,BI_FP);BigInteger.prototype.F1=BI_FP-dbits;BigInteger.prototype.F2=2*dbits-BI_FP;var BI_RM="0123456789abcdefghijklmnopqrstuvwxyz",BI_RC=[],rr,vv;
rr=48;for(vv=0;9>=vv;++vv)BI_RC[rr++]=vv;rr=97;for(vv=10;36>vv;++vv)BI_RC[rr++]=vv;rr=65;for(vv=10;36>vv;++vv)BI_RC[rr++]=vv;function int2char(b){return BI_RM.charAt(b)}function intAt(b,a){var c=BI_RC[b.charCodeAt(a)];return null==c?-1:c}function bnpCopyTo(b){for(var a=this.t-1;0<=a;--a)b[a]=this[a];b.t=this.t;b.s=this.s}function bnpFromInt(b){this.t=1;this.s=0>b?-1:0;0<b?this[0]=b:-1>b?this[0]=b+DV:this.t=0}function nbv(b){var a=nbi();a.fromInt(b);return a}
function bnpFromString(b,a){var c;if(16==a)c=4;else if(8==a)c=3;else if(256==a)c=8;else if(2==a)c=1;else if(32==a)c=5;else if(4==a)c=2;else{this.fromRadix(b,a);return}this.s=this.t=0;for(var d=b.length,e=!1,f=0;0<=--d;){var g=8==c?b[d]&255:intAt(b,d);0>g?"-"==b.charAt(d)&&(e=!0):(e=!1,0==f?this[this.t++]=g:f+c>this.DB?(this[this.t-1]|=(g&(1<<this.DB-f)-1)<<f,this[this.t++]=g>>this.DB-f):this[this.t-1]|=g<<f,f+=c,f>=this.DB&&(f-=this.DB))}if(8==c&&0!=(b[0]&128))this.s=-1,0<f&&(this[this.t-1]|=(1<<
this.DB-f)-1<<f);this.clamp();e&&BigInteger.ZERO.subTo(this,this)}function bnpClamp(){for(var b=this.s&this.DM;0<this.t&&this[this.t-1]==b;)--this.t}
function bnToString(b){if(0>this.s)return"-"+this.negate().toString(b);if(16==b)b=4;else if(8==b)b=3;else if(2==b)b=1;else if(32==b)b=5;else if(4==b)b=2;else return this.toRadix(b);var a=(1<<b)-1,c,d=!1,e="",f=this.t,g=this.DB-f*this.DB%b;if(0<f--){if(g<this.DB&&0<(c=this[f]>>g))d=!0,e=int2char(c);for(;0<=f;)g<b?(c=(this[f]&(1<<g)-1)<<b-g,c|=this[--f]>>(g+=this.DB-b)):(c=this[f]>>(g-=b)&a,0>=g&&(g+=this.DB,--f)),0<c&&(d=!0),d&&(e+=int2char(c))}return d?e:"0"}
function bnNegate(){var b=nbi();BigInteger.ZERO.subTo(this,b);return b}function bnAbs(){return 0>this.s?this.negate():this}function bnCompareTo(b){var a=this.s-b.s;if(0!=a)return a;var c=this.t,a=c-b.t;if(0!=a)return a;for(;0<=--c;)if(0!=(a=this[c]-b[c]))return a;return 0}function nbits(b){var a=1,c;if(0!=(c=b>>>16))b=c,a+=16;if(0!=(c=b>>8))b=c,a+=8;if(0!=(c=b>>4))b=c,a+=4;if(0!=(c=b>>2))b=c,a+=2;0!=b>>1&&(a+=1);return a}
function bnBitLength(){return 0>=this.t?0:this.DB*(this.t-1)+nbits(this[this.t-1]^this.s&this.DM)}function bnpDLShiftTo(b,a){var c;for(c=this.t-1;0<=c;--c)a[c+b]=this[c];for(c=b-1;0<=c;--c)a[c]=0;a.t=this.t+b;a.s=this.s}function bnpDRShiftTo(b,a){for(var c=b;c<this.t;++c)a[c-b]=this[c];a.t=Math.max(this.t-b,0);a.s=this.s}
function bnpLShiftTo(b,a){var c=b%this.DB,d=this.DB-c,e=(1<<d)-1,f=Math.floor(b/this.DB),g=this.s<<c&this.DM,h;for(h=this.t-1;0<=h;--h)a[h+f+1]=this[h]>>d|g,g=(this[h]&e)<<c;for(h=f-1;0<=h;--h)a[h]=0;a[f]=g;a.t=this.t+f+1;a.s=this.s;a.clamp()}
function bnpRShiftTo(b,a){a.s=this.s;var c=Math.floor(b/this.DB);if(c>=this.t)a.t=0;else{var d=b%this.DB,e=this.DB-d,f=(1<<d)-1;a[0]=this[c]>>d;for(var g=c+1;g<this.t;++g)a[g-c-1]|=(this[g]&f)<<e,a[g-c]=this[g]>>d;0<d&&(a[this.t-c-1]|=(this.s&f)<<e);a.t=this.t-c;a.clamp()}}
function bnpSubTo(b,a){for(var c=0,d=0,e=Math.min(b.t,this.t);c<e;)d+=this[c]-b[c],a[c++]=d&this.DM,d>>=this.DB;if(b.t<this.t){for(d-=b.s;c<this.t;)d+=this[c],a[c++]=d&this.DM,d>>=this.DB;d+=this.s}else{for(d+=this.s;c<b.t;)d-=b[c],a[c++]=d&this.DM,d>>=this.DB;d-=b.s}a.s=0>d?-1:0;-1>d?a[c++]=this.DV+d:0<d&&(a[c++]=d);a.t=c;a.clamp()}
function bnpMultiplyTo(b,a){var c=this.abs(),d=b.abs(),e=c.t;for(a.t=e+d.t;0<=--e;)a[e]=0;for(e=0;e<d.t;++e)a[e+c.t]=c.am(0,d[e],a,e,0,c.t);a.s=0;a.clamp();this.s!=b.s&&BigInteger.ZERO.subTo(a,a)}function bnpSquareTo(b){for(var a=this.abs(),c=b.t=2*a.t;0<=--c;)b[c]=0;for(c=0;c<a.t-1;++c){var d=a.am(c,a[c],b,2*c,0,1);if((b[c+a.t]+=a.am(c+1,2*a[c],b,2*c+1,d,a.t-c-1))>=a.DV)b[c+a.t]-=a.DV,b[c+a.t+1]=1}0<b.t&&(b[b.t-1]+=a.am(c,a[c],b,2*c,0,1));b.s=0;b.clamp()}
function bnpDivRemTo(b,a,c){var d=b.abs();if(!(0>=d.t)){var e=this.abs();if(e.t<d.t)null!=a&&a.fromInt(0),null!=c&&this.copyTo(c);else{null==c&&(c=nbi());var f=nbi(),g=this.s,b=b.s,h=this.DB-nbits(d[d.t-1]);0<h?(d.lShiftTo(h,f),e.lShiftTo(h,c)):(d.copyTo(f),e.copyTo(c));d=f.t;e=f[d-1];if(0!=e){var j=e*(1<<this.F1)+(1<d?f[d-2]>>this.F2:0),k=this.FV/j,j=(1<<this.F1)/j,l=1<<this.F2,m=c.t,r=m-d,p=null==a?nbi():a;f.dlShiftTo(r,p);0<=c.compareTo(p)&&(c[c.t++]=1,c.subTo(p,c));BigInteger.ONE.dlShiftTo(d,
p);for(p.subTo(f,f);f.t<d;)f[f.t++]=0;for(;0<=--r;){var o=c[--m]==e?this.DM:Math.floor(c[m]*k+(c[m-1]+l)*j);if((c[m]+=f.am(0,o,c,r,0,d))<o){f.dlShiftTo(r,p);for(c.subTo(p,c);c[m]<--o;)c.subTo(p,c)}}null!=a&&(c.drShiftTo(d,a),g!=b&&BigInteger.ZERO.subTo(a,a));c.t=d;c.clamp();0<h&&c.rShiftTo(h,c);0>g&&BigInteger.ZERO.subTo(c,c)}}}}function bnMod(b){var a=nbi();this.abs().divRemTo(b,null,a);0>this.s&&0<a.compareTo(BigInteger.ZERO)&&b.subTo(a,a);return a}function Classic(b){this.m=b}
function cConvert(b){return 0>b.s||0<=b.compareTo(this.m)?b.mod(this.m):b}function cRevert(b){return b}function cReduce(b){b.divRemTo(this.m,null,b)}function cMulTo(b,a,c){b.multiplyTo(a,c);this.reduce(c)}function cSqrTo(b,a){b.squareTo(a);this.reduce(a)}Classic.prototype.convert=cConvert;Classic.prototype.revert=cRevert;Classic.prototype.reduce=cReduce;Classic.prototype.mulTo=cMulTo;Classic.prototype.sqrTo=cSqrTo;
function bnpInvDigit(){if(1>this.t)return 0;var b=this[0];if(0==(b&1))return 0;var a=b&3,a=a*(2-(b&15)*a)&15,a=a*(2-(b&255)*a)&255,a=a*(2-((b&65535)*a&65535))&65535,a=a*(2-b*a%this.DV)%this.DV;return 0<a?this.DV-a:-a}function Montgomery(b){this.m=b;this.mp=b.invDigit();this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<<b.DB-15)-1;this.mt2=2*b.t}
function montConvert(b){var a=nbi();b.abs().dlShiftTo(this.m.t,a);a.divRemTo(this.m,null,a);0>b.s&&0<a.compareTo(BigInteger.ZERO)&&this.m.subTo(a,a);return a}function montRevert(b){var a=nbi();b.copyTo(a);this.reduce(a);return a}
function montReduce(b){for(;b.t<=this.mt2;)b[b.t++]=0;for(var a=0;a<this.m.t;++a){var c=b[a]&32767,d=c*this.mpl+((c*this.mph+(b[a]>>15)*this.mpl&this.um)<<15)&b.DM,c=a+this.m.t;for(b[c]+=this.m.am(0,d,b,a,0,this.m.t);b[c]>=b.DV;)b[c]-=b.DV,b[++c]++}b.clamp();b.drShiftTo(this.m.t,b);0<=b.compareTo(this.m)&&b.subTo(this.m,b)}function montSqrTo(b,a){b.squareTo(a);this.reduce(a)}function montMulTo(b,a,c){b.multiplyTo(a,c);this.reduce(c)}Montgomery.prototype.convert=montConvert;
Montgomery.prototype.revert=montRevert;Montgomery.prototype.reduce=montReduce;Montgomery.prototype.mulTo=montMulTo;Montgomery.prototype.sqrTo=montSqrTo;function bnpIsEven(){return 0==(0<this.t?this[0]&1:this.s)}function bnpExp(b,a){if(4294967295<b||1>b)return BigInteger.ONE;var c=nbi(),d=nbi(),e=a.convert(this),f=nbits(b)-1;for(e.copyTo(c);0<=--f;)if(a.sqrTo(c,d),0<(b&1<<f))a.mulTo(d,e,c);else var g=c,c=d,d=g;return a.revert(c)}
function bnModPowInt(b,a){var c;c=256>b||a.isEven()?new Classic(a):new Montgomery(a);return this.exp(b,c)}BigInteger.prototype.copyTo=bnpCopyTo;BigInteger.prototype.fromInt=bnpFromInt;BigInteger.prototype.fromString=bnpFromString;BigInteger.prototype.clamp=bnpClamp;BigInteger.prototype.dlShiftTo=bnpDLShiftTo;BigInteger.prototype.drShiftTo=bnpDRShiftTo;BigInteger.prototype.lShiftTo=bnpLShiftTo;BigInteger.prototype.rShiftTo=bnpRShiftTo;BigInteger.prototype.subTo=bnpSubTo;
BigInteger.prototype.multiplyTo=bnpMultiplyTo;BigInteger.prototype.squareTo=bnpSquareTo;BigInteger.prototype.divRemTo=bnpDivRemTo;BigInteger.prototype.invDigit=bnpInvDigit;BigInteger.prototype.isEven=bnpIsEven;BigInteger.prototype.exp=bnpExp;BigInteger.prototype.toString=bnToString;BigInteger.prototype.negate=bnNegate;BigInteger.prototype.abs=bnAbs;BigInteger.prototype.compareTo=bnCompareTo;BigInteger.prototype.bitLength=bnBitLength;BigInteger.prototype.mod=bnMod;BigInteger.prototype.modPowInt=bnModPowInt;
BigInteger.ZERO=nbv(0);BigInteger.ONE=nbv(1);function bnClone(){var b=nbi();this.copyTo(b);return b}function bnIntValue(){if(0>this.s){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]}function bnByteValue(){return 0==this.t?this.s:this[0]<<24>>24}function bnShortValue(){return 0==this.t?this.s:this[0]<<16>>16}function bnpChunkSize(b){return Math.floor(Math.LN2*this.DB/Math.log(b))}
function bnSigNum(){return 0>this.s?-1:0>=this.t||1==this.t&&0>=this[0]?0:1}function bnpToRadix(b){null==b&&(b=10);if(0==this.signum()||2>b||36<b)return"0";var a=this.chunkSize(b),a=Math.pow(b,a),c=nbv(a),d=nbi(),e=nbi(),f="";for(this.divRemTo(c,d,e);0<d.signum();)f=(a+e.intValue()).toString(b).substr(1)+f,d.divRemTo(c,d,e);return e.intValue().toString(b)+f}
function bnpFromRadix(b,a){this.fromInt(0);null==a&&(a=10);for(var c=this.chunkSize(a),d=Math.pow(a,c),e=!1,f=0,g=0,h=0;h<b.length;++h){var j=intAt(b,h);0>j?"-"==b.charAt(h)&&0==this.signum()&&(e=!0):(g=a*g+j,++f>=c&&(this.dMultiply(d),this.dAddOffset(g,0),g=f=0))}0<f&&(this.dMultiply(Math.pow(a,f)),this.dAddOffset(g,0));e&&BigInteger.ZERO.subTo(this,this)}
function bnpFromNumber(b,a,c){if("number"==typeof a)if(2>b)this.fromInt(1);else{this.fromNumber(b,c);this.testBit(b-1)||this.bitwiseTo(BigInteger.ONE.shiftLeft(b-1),op_or,this);for(this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(a);)this.dAddOffset(2,0),this.bitLength()>b&&this.subTo(BigInteger.ONE.shiftLeft(b-1),this)}else{var c=[],d=b&7;c.length=(b>>3)+1;a.nextBytes(c);c[0]=0<d?c[0]&(1<<d)-1:0;this.fromString(c,256)}}
function bnToByteArray(){var b=this.t,a=[];a[0]=this.s;var c=this.DB-b*this.DB%8,d,e=0;if(0<b--){if(c<this.DB&&(d=this[b]>>c)!=(this.s&this.DM)>>c)a[e++]=d|this.s<<this.DB-c;for(;0<=b;)if(8>c?(d=(this[b]&(1<<c)-1)<<8-c,d|=this[--b]>>(c+=this.DB-8)):(d=this[b]>>(c-=8)&255,0>=c&&(c+=this.DB,--b)),0<e||d!=this.s)a[e++]=d}return a}function bnEquals(b){return 0==this.compareTo(b)}function bnMin(b){return 0>this.compareTo(b)?this:b}function bnMax(b){return 0<this.compareTo(b)?this:b}
function bnpBitwiseTo(b,a,c){var d,e,f=Math.min(b.t,this.t);for(d=0;d<f;++d)c[d]=a(this[d],b[d]);if(b.t<this.t){e=b.s&this.DM;for(d=f;d<this.t;++d)c[d]=a(this[d],e);c.t=this.t}else{e=this.s&this.DM;for(d=f;d<b.t;++d)c[d]=a(e,b[d]);c.t=b.t}c.s=a(this.s,b.s);c.clamp()}function op_and(b,a){return b&a}function bnAnd(b){var a=nbi();this.bitwiseTo(b,op_and,a);return a}function op_or(b,a){return b|a}function bnOr(b){var a=nbi();this.bitwiseTo(b,op_or,a);return a}function op_xor(b,a){return b^a}
function bnXor(b){var a=nbi();this.bitwiseTo(b,op_xor,a);return a}function op_andnot(b,a){return b&~a}function bnAndNot(b){var a=nbi();this.bitwiseTo(b,op_andnot,a);return a}function bnNot(){for(var b=nbi(),a=0;a<this.t;++a)b[a]=this.DM&~this[a];b.t=this.t;b.s=~this.s;return b}function bnShiftLeft(b){var a=nbi();0>b?this.rShiftTo(-b,a):this.lShiftTo(b,a);return a}function bnShiftRight(b){var a=nbi();0>b?this.lShiftTo(-b,a):this.rShiftTo(b,a);return a}
function lbit(b){if(0==b)return-1;var a=0;0==(b&65535)&&(b>>=16,a+=16);0==(b&255)&&(b>>=8,a+=8);0==(b&15)&&(b>>=4,a+=4);0==(b&3)&&(b>>=2,a+=2);0==(b&1)&&++a;return a}function bnGetLowestSetBit(){for(var b=0;b<this.t;++b)if(0!=this[b])return b*this.DB+lbit(this[b]);return 0>this.s?this.t*this.DB:-1}function cbit(b){for(var a=0;0!=b;)b&=b-1,++a;return a}function bnBitCount(){for(var b=0,a=this.s&this.DM,c=0;c<this.t;++c)b+=cbit(this[c]^a);return b}
function bnTestBit(b){var a=Math.floor(b/this.DB);return a>=this.t?0!=this.s:0!=(this[a]&1<<b%this.DB)}function bnpChangeBit(b,a){var c=BigInteger.ONE.shiftLeft(b);this.bitwiseTo(c,a,c);return c}function bnSetBit(b){return this.changeBit(b,op_or)}function bnClearBit(b){return this.changeBit(b,op_andnot)}function bnFlipBit(b){return this.changeBit(b,op_xor)}
function bnpAddTo(b,a){for(var c=0,d=0,e=Math.min(b.t,this.t);c<e;)d+=this[c]+b[c],a[c++]=d&this.DM,d>>=this.DB;if(b.t<this.t){for(d+=b.s;c<this.t;)d+=this[c],a[c++]=d&this.DM,d>>=this.DB;d+=this.s}else{for(d+=this.s;c<b.t;)d+=b[c],a[c++]=d&this.DM,d>>=this.DB;d+=b.s}a.s=0>d?-1:0;0<d?a[c++]=d:-1>d&&(a[c++]=this.DV+d);a.t=c;a.clamp()}function bnAdd(b){var a=nbi();this.addTo(b,a);return a}function bnSubtract(b){var a=nbi();this.subTo(b,a);return a}
function bnMultiply(b){var a=nbi();this.multiplyTo(b,a);return a}function bnSquare(){var b=nbi();this.squareTo(b);return b}function bnDivide(b){var a=nbi();this.divRemTo(b,a,null);return a}function bnRemainder(b){var a=nbi();this.divRemTo(b,null,a);return a}function bnDivideAndRemainder(b){var a=nbi(),c=nbi();this.divRemTo(b,a,c);return[a,c]}function bnpDMultiply(b){this[this.t]=this.am(0,b-1,this,0,0,this.t);++this.t;this.clamp()}
function bnpDAddOffset(b,a){if(0!=b){for(;this.t<=a;)this[this.t++]=0;for(this[a]+=b;this[a]>=this.DV;)this[a]-=this.DV,++a>=this.t&&(this[this.t++]=0),++this[a]}}function NullExp(){}function nNop(b){return b}function nMulTo(b,a,c){b.multiplyTo(a,c)}function nSqrTo(b,a){b.squareTo(a)}NullExp.prototype.convert=nNop;NullExp.prototype.revert=nNop;NullExp.prototype.mulTo=nMulTo;NullExp.prototype.sqrTo=nSqrTo;function bnPow(b){return this.exp(b,new NullExp)}
function bnpMultiplyLowerTo(b,a,c){var d=Math.min(this.t+b.t,a);c.s=0;for(c.t=d;0<d;)c[--d]=0;var e;for(e=c.t-this.t;d<e;++d)c[d+this.t]=this.am(0,b[d],c,d,0,this.t);for(e=Math.min(b.t,a);d<e;++d)this.am(0,b[d],c,d,0,a-d);c.clamp()}function bnpMultiplyUpperTo(b,a,c){--a;var d=c.t=this.t+b.t-a;for(c.s=0;0<=--d;)c[d]=0;for(d=Math.max(a-this.t,0);d<b.t;++d)c[this.t+d-a]=this.am(a-d,b[d],c,0,0,this.t+d-a);c.clamp();c.drShiftTo(1,c)}
function Barrett(b){this.r2=nbi();this.q3=nbi();BigInteger.ONE.dlShiftTo(2*b.t,this.r2);this.mu=this.r2.divide(b);this.m=b}function barrettConvert(b){if(0>b.s||b.t>2*this.m.t)return b.mod(this.m);if(0>b.compareTo(this.m))return b;var a=nbi();b.copyTo(a);this.reduce(a);return a}function barrettRevert(b){return b}
function barrettReduce(b){b.drShiftTo(this.m.t-1,this.r2);if(b.t>this.m.t+1)b.t=this.m.t+1,b.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>b.compareTo(this.r2);)b.dAddOffset(1,this.m.t+1);for(b.subTo(this.r2,b);0<=b.compareTo(this.m);)b.subTo(this.m,b)}function barrettSqrTo(b,a){b.squareTo(a);this.reduce(a)}function barrettMulTo(b,a,c){b.multiplyTo(a,c);this.reduce(c)}Barrett.prototype.convert=barrettConvert;
Barrett.prototype.revert=barrettRevert;Barrett.prototype.reduce=barrettReduce;Barrett.prototype.mulTo=barrettMulTo;Barrett.prototype.sqrTo=barrettSqrTo;
function bnModPow(b,a){var c=b.bitLength(),d,e=nbv(1),f;if(0>=c)return e;d=18>c?1:48>c?3:144>c?4:768>c?5:6;f=8>c?new Classic(a):a.isEven()?new Barrett(a):new Montgomery(a);var g=[],h=3,j=d-1,k=(1<<d)-1;g[1]=f.convert(this);if(1<d){c=nbi();for(f.sqrTo(g[1],c);h<=k;)g[h]=nbi(),f.mulTo(c,g[h-2],g[h]),h+=2}for(var l=b.t-1,m,r=!0,p=nbi(),c=nbits(b[l])-1;0<=l;){c>=j?m=b[l]>>c-j&k:(m=(b[l]&(1<<c+1)-1)<<j-c,0<l&&(m|=b[l-1]>>this.DB+c-j));for(h=d;0==(m&1);)m>>=1,--h;if(0>(c-=h))c+=this.DB,--l;if(r)g[m].copyTo(e),
r=!1;else{for(;1<h;)f.sqrTo(e,p),f.sqrTo(p,e),h-=2;0<h?f.sqrTo(e,p):(h=e,e=p,p=h);f.mulTo(p,g[m],e)}for(;0<=l&&0==(b[l]&1<<c);)f.sqrTo(e,p),h=e,e=p,p=h,0>--c&&(c=this.DB-1,--l)}return f.revert(e)}
function bnGCD(b){var a=0>this.s?this.negate():this.clone(),b=0>b.s?b.negate():b.clone();if(0>a.compareTo(b))var c=a,a=b,b=c;var c=a.getLowestSetBit(),d=b.getLowestSetBit();if(0>d)return a;c<d&&(d=c);0<d&&(a.rShiftTo(d,a),b.rShiftTo(d,b));for(;0<a.signum();)0<(c=a.getLowestSetBit())&&a.rShiftTo(c,a),0<(c=b.getLowestSetBit())&&b.rShiftTo(c,b),0<=a.compareTo(b)?(a.subTo(b,a),a.rShiftTo(1,a)):(b.subTo(a,b),b.rShiftTo(1,b));0<d&&b.lShiftTo(d,b);return b}
function bnpModInt(b){if(0>=b)return 0;var a=this.DV%b,c=0>this.s?b-1:0;if(0<this.t)if(0==a)c=this[0]%b;else for(var d=this.t-1;0<=d;--d)c=(a*c+this[d])%b;return c}
function bnModInverse(b){var a=b.isEven();if(this.isEven()&&a||0==b.signum())return BigInteger.ZERO;for(var c=b.clone(),d=this.clone(),e=nbv(1),f=nbv(0),g=nbv(0),h=nbv(1);0!=c.signum();){for(;c.isEven();){c.rShiftTo(1,c);if(a){if(!e.isEven()||!f.isEven())e.addTo(this,e),f.subTo(b,f);e.rShiftTo(1,e)}else f.isEven()||f.subTo(b,f);f.rShiftTo(1,f)}for(;d.isEven();){d.rShiftTo(1,d);if(a){if(!g.isEven()||!h.isEven())g.addTo(this,g),h.subTo(b,h);g.rShiftTo(1,g)}else h.isEven()||h.subTo(b,h);h.rShiftTo(1,
h)}0<=c.compareTo(d)?(c.subTo(d,c),a&&e.subTo(g,e),f.subTo(h,f)):(d.subTo(c,d),a&&g.subTo(e,g),h.subTo(f,h))}if(0!=d.compareTo(BigInteger.ONE))return BigInteger.ZERO;if(0<=h.compareTo(b))return h.subtract(b);if(0>h.signum())h.addTo(b,h);else return h;return 0>h.signum()?h.add(b):h}
var lowprimes=[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],lplim=67108864/lowprimes[lowprimes.length-1];
function bnIsProbablePrime(b){var a,c=this.abs();if(1==c.t&&c[0]<=lowprimes[lowprimes.length-1]){for(a=0;a<lowprimes.length;++a)if(c[0]==lowprimes[a])return!0;return!1}if(c.isEven())return!1;for(a=1;a<lowprimes.length;){for(var d=lowprimes[a],e=a+1;e<lowprimes.length&&d<lplim;)d*=lowprimes[e++];for(d=c.modInt(d);a<e;)if(0==d%lowprimes[a++])return!1}return c.millerRabin(b)}
function nbits(b){var a=1,c;if(0!=(c=b>>>16))b=c,a+=16;if(0!=(c=b>>8))b=c,a+=8;if(0!=(c=b>>4))b=c,a+=4;if(0!=(c=b>>2))b=c,a+=2;0!=b>>1&&(a+=1);return a}function bnToMPI(){var b=this.toByteArray(),a=8*(b.length-1)+nbits(b[0]),c;c=""+String.fromCharCode((a&65280)>>8);c+=String.fromCharCode(a&255);return c+=util.bin2str(b)}
function bnpMillerRabin(b){var a=this.subtract(BigInteger.ONE),c=a.getLowestSetBit();if(0>=c)return!1;var d=a.shiftRight(c),b=b+1>>1;if(b>lowprimes.length)b=lowprimes.length;for(var e=nbi(),f=0;f<b;++f){e.fromInt(lowprimes[Math.floor(Math.random()*lowprimes.length)]);var g=e.modPow(d,this);if(0!=g.compareTo(BigInteger.ONE)&&0!=g.compareTo(a)){for(var h=1;h++<c&&0!=g.compareTo(a);)if(g=g.modPowInt(2,this),0==g.compareTo(BigInteger.ONE))return!1;if(0!=g.compareTo(a))return!1}}return!0}
BigInteger.prototype.chunkSize=bnpChunkSize;BigInteger.prototype.toRadix=bnpToRadix;BigInteger.prototype.fromRadix=bnpFromRadix;BigInteger.prototype.fromNumber=bnpFromNumber;BigInteger.prototype.bitwiseTo=bnpBitwiseTo;BigInteger.prototype.changeBit=bnpChangeBit;BigInteger.prototype.addTo=bnpAddTo;BigInteger.prototype.dMultiply=bnpDMultiply;BigInteger.prototype.dAddOffset=bnpDAddOffset;BigInteger.prototype.multiplyLowerTo=bnpMultiplyLowerTo;BigInteger.prototype.multiplyUpperTo=bnpMultiplyUpperTo;
BigInteger.prototype.modInt=bnpModInt;BigInteger.prototype.millerRabin=bnpMillerRabin;BigInteger.prototype.clone=bnClone;BigInteger.prototype.intValue=bnIntValue;BigInteger.prototype.byteValue=bnByteValue;BigInteger.prototype.shortValue=bnShortValue;BigInteger.prototype.signum=bnSigNum;BigInteger.prototype.toByteArray=bnToByteArray;BigInteger.prototype.equals=bnEquals;BigInteger.prototype.min=bnMin;BigInteger.prototype.max=bnMax;BigInteger.prototype.and=bnAnd;BigInteger.prototype.or=bnOr;
BigInteger.prototype.xor=bnXor;BigInteger.prototype.andNot=bnAndNot;BigInteger.prototype.not=bnNot;BigInteger.prototype.shiftLeft=bnShiftLeft;BigInteger.prototype.shiftRight=bnShiftRight;BigInteger.prototype.getLowestSetBit=bnGetLowestSetBit;BigInteger.prototype.bitCount=bnBitCount;BigInteger.prototype.testBit=bnTestBit;BigInteger.prototype.setBit=bnSetBit;BigInteger.prototype.clearBit=bnClearBit;BigInteger.prototype.flipBit=bnFlipBit;BigInteger.prototype.add=bnAdd;BigInteger.prototype.subtract=bnSubtract;
BigInteger.prototype.multiply=bnMultiply;BigInteger.prototype.divide=bnDivide;BigInteger.prototype.remainder=bnRemainder;BigInteger.prototype.divideAndRemainder=bnDivideAndRemainder;BigInteger.prototype.modPow=bnModPow;BigInteger.prototype.modInverse=bnModInverse;BigInteger.prototype.pow=bnPow;BigInteger.prototype.gcd=bnGCD;BigInteger.prototype.isProbablePrime=bnIsProbablePrime;BigInteger.prototype.toMPI=bnToMPI;BigInteger.prototype.square=bnSquare;
function SecureRandom(){this.nextBytes=function(b){for(var a=0;a<b.length;a++)b[a]=openpgp_crypto_getSecureRandomOctet()}}
function RSA(){function b(){this.n=null;this.e=0;this.u=this.dmq1=this.dmp1=this.q=this.p=this.d=this.ee=null}this.encrypt=function(a,b,d){return a.modPowInt(b,d)};this.decrypt=function(a,b,d,e,f){var g=a.mod(d).modPow(b.mod(d.subtract(BigInteger.ONE)),d),a=a.mod(e).modPow(b.mod(e.subtract(BigInteger.ONE)),e);util.print_debug("rsa.js decrypt\nxpn:"+util.hexstrdump(g.toMPI())+"\nxqn:"+util.hexstrdump(a.toMPI()));b=a.subtract(g);0==b[0]?(b=g.subtract(a),b=b.multiply(f).mod(e),b=e.subtract(b)):b=b.multiply(f).mod(e);
return b.multiply(d).add(g)};this.verify=function(a,b,d){return a.modPowInt(b,d)};this.sign=function(a,b,d){return a.modPow(b,d)};this.generate=function(a,c){var d=new b,e=new SecureRandom,f=a>>1;d.e=parseInt(c,16);for(d.ee=new BigInteger(c,16);;){for(;!(d.p=new BigInteger(a-f,1,e),0==d.p.subtract(BigInteger.ONE).gcd(d.ee).compareTo(BigInteger.ONE)&&d.p.isProbablePrime(10)););for(;!(d.q=new BigInteger(f,1,e),0==d.q.subtract(BigInteger.ONE).gcd(d.ee).compareTo(BigInteger.ONE)&&d.q.isProbablePrime(10)););
if(0>=d.p.compareTo(d.q)){var g=d.p;d.p=d.q;d.q=g}var g=d.p.subtract(BigInteger.ONE),h=d.q.subtract(BigInteger.ONE),j=g.multiply(h);if(0==j.gcd(d.ee).compareTo(BigInteger.ONE)){d.n=d.p.multiply(d.q);d.d=d.ee.modInverse(j);d.dmp1=d.d.mod(g);d.dmq1=d.d.mod(h);d.u=d.p.modInverse(d.q);break}}return d};this.keyObject=b}function MD5(b){b=md5(b);return util.hex2bin(b)}
function md5cycle(b,a){var c=b[0],d=b[1],e=b[2],f=b[3],c=ff(c,d,e,f,a[0],7,-680876936),f=ff(f,c,d,e,a[1],12,-389564586),e=ff(e,f,c,d,a[2],17,606105819),d=ff(d,e,f,c,a[3],22,-1044525330),c=ff(c,d,e,f,a[4],7,-176418897),f=ff(f,c,d,e,a[5],12,1200080426),e=ff(e,f,c,d,a[6],17,-1473231341),d=ff(d,e,f,c,a[7],22,-45705983),c=ff(c,d,e,f,a[8],7,1770035416),f=ff(f,c,d,e,a[9],12,-1958414417),e=ff(e,f,c,d,a[10],17,-42063),d=ff(d,e,f,c,a[11],22,-1990404162),c=ff(c,d,e,f,a[12],7,1804603682),f=ff(f,c,d,e,a[13],12,
-40341101),e=ff(e,f,c,d,a[14],17,-1502002290),d=ff(d,e,f,c,a[15],22,1236535329),c=gg(c,d,e,f,a[1],5,-165796510),f=gg(f,c,d,e,a[6],9,-1069501632),e=gg(e,f,c,d,a[11],14,643717713),d=gg(d,e,f,c,a[0],20,-373897302),c=gg(c,d,e,f,a[5],5,-701558691),f=gg(f,c,d,e,a[10],9,38016083),e=gg(e,f,c,d,a[15],14,-660478335),d=gg(d,e,f,c,a[4],20,-405537848),c=gg(c,d,e,f,a[9],5,568446438),f=gg(f,c,d,e,a[14],9,-1019803690),e=gg(e,f,c,d,a[3],14,-187363961),d=gg(d,e,f,c,a[8],20,1163531501),c=gg(c,d,e,f,a[13],5,-1444681467),
f=gg(f,c,d,e,a[2],9,-51403784),e=gg(e,f,c,d,a[7],14,1735328473),d=gg(d,e,f,c,a[12],20,-1926607734),c=hh(c,d,e,f,a[5],4,-378558),f=hh(f,c,d,e,a[8],11,-2022574463),e=hh(e,f,c,d,a[11],16,1839030562),d=hh(d,e,f,c,a[14],23,-35309556),c=hh(c,d,e,f,a[1],4,-1530992060),f=hh(f,c,d,e,a[4],11,1272893353),e=hh(e,f,c,d,a[7],16,-155497632),d=hh(d,e,f,c,a[10],23,-1094730640),c=hh(c,d,e,f,a[13],4,681279174),f=hh(f,c,d,e,a[0],11,-358537222),e=hh(e,f,c,d,a[3],16,-722521979),d=hh(d,e,f,c,a[6],23,76029189),c=hh(c,d,
e,f,a[9],4,-640364487),f=hh(f,c,d,e,a[12],11,-421815835),e=hh(e,f,c,d,a[15],16,530742520),d=hh(d,e,f,c,a[2],23,-995338651),c=ii(c,d,e,f,a[0],6,-198630844),f=ii(f,c,d,e,a[7],10,1126891415),e=ii(e,f,c,d,a[14],15,-1416354905),d=ii(d,e,f,c,a[5],21,-57434055),c=ii(c,d,e,f,a[12],6,1700485571),f=ii(f,c,d,e,a[3],10,-1894986606),e=ii(e,f,c,d,a[10],15,-1051523),d=ii(d,e,f,c,a[1],21,-2054922799),c=ii(c,d,e,f,a[8],6,1873313359),f=ii(f,c,d,e,a[15],10,-30611744),e=ii(e,f,c,d,a[6],15,-1560198380),d=ii(d,e,f,c,a[13],
21,1309151649),c=ii(c,d,e,f,a[4],6,-145523070),f=ii(f,c,d,e,a[11],10,-1120210379),e=ii(e,f,c,d,a[2],15,718787259),d=ii(d,e,f,c,a[9],21,-343485551);b[0]=add32(c,b[0]);b[1]=add32(d,b[1]);b[2]=add32(e,b[2]);b[3]=add32(f,b[3])}function cmn(b,a,c,d,e,f){a=add32(add32(a,b),add32(d,f));return add32(a<<e|a>>>32-e,c)}function ff(b,a,c,d,e,f,g){return cmn(a&c|~a&d,b,a,e,f,g)}function gg(b,a,c,d,e,f,g){return cmn(a&d|c&~d,b,a,e,f,g)}function hh(b,a,c,d,e,f,g){return cmn(a^c^d,b,a,e,f,g)}
function ii(b,a,c,d,e,f,g){return cmn(c^(a|~d),b,a,e,f,g)}function md51(b){txt="";var a=b.length,c=[1732584193,-271733879,-1732584194,271733878],d;for(d=64;d<=b.length;d+=64)md5cycle(c,md5blk(b.substring(d-64,d)));var b=b.substring(d-64),e=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(d=0;d<b.length;d++)e[d>>2]|=b.charCodeAt(d)<<(d%4<<3);e[d>>2]|=128<<(d%4<<3);if(55<d){md5cycle(c,e);for(d=0;16>d;d++)e[d]=0}e[14]=8*a;md5cycle(c,e);return c}
function md5blk(b){var a=[],c;for(c=0;64>c;c+=4)a[c>>2]=b.charCodeAt(c)+(b.charCodeAt(c+1)<<8)+(b.charCodeAt(c+2)<<16)+(b.charCodeAt(c+3)<<24);return a}var hex_chr="0123456789abcdef".split("");function rhex(b){for(var a="",c=0;4>c;c++)a+=hex_chr[b>>8*c+4&15]+hex_chr[b>>8*c&15];return a}function hex(b){for(var a=0;a<b.length;a++)b[a]=rhex(b[a]);return b.join("")}function md5(b){return hex(md51(b))}function add32(b,a){return b+a&4294967295}
"5d41402abc4b2a76b9719d911017c592"!=md5("hello")&&(add32=function(b,a){var c=(b&65535)+(a&65535);return(b>>16)+(a>>16)+(c>>16)<<16|c&65535});var RMDsize=160,X=[];function ROL(b,a){return new Number(b<<a|b>>>32-a)}function F(b,a,c){return new Number(b^a^c)}function G(b,a,c){return new Number(b&a|~b&c)}function H(b,a,c){return new Number((b|~a)^c)}function I(b,a,c){return new Number(b&c|a&~c)}function J(b,a,c){return new Number(b^(a|~c))}
function mixOneRound(b,a,c,d,e,f,g,h){switch(h){case 0:b+=F(a,c,d)+f+0;break;case 1:b+=G(a,c,d)+f+1518500249;break;case 2:b+=H(a,c,d)+f+1859775393;break;case 3:b+=I(a,c,d)+f+2400959708;break;case 4:b+=J(a,c,d)+f+2840853838;break;case 5:b+=J(a,c,d)+f+1352829926;break;case 6:b+=I(a,c,d)+f+1548603684;break;case 7:b+=H(a,c,d)+f+1836072691;break;case 8:b+=G(a,c,d)+f+2053994217;break;case 9:b+=F(a,c,d)+f+0;break;default:document.write("Bogus round number")}b=ROL(b,g)+e;c=ROL(c,10);h=[];h[0]=b&4294967295;
h[1]=a&4294967295;h[2]=c&4294967295;h[3]=d&4294967295;h[4]=e&4294967295;h[5]=f;h[6]=g;return h}function MDinit(b){b[0]=1732584193;b[1]=4023233417;b[2]=2562383102;b[3]=271733878;b[4]=3285377520}
var ROLs=[[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],[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]],indexes=[[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],[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]];
function compress(b,a){blockA=[];blockB=[];for(var c,d=0;5>d;d++)blockA[d]=new Number(b[d]),blockB[d]=new Number(b[d]);for(var e=0,f=0;5>f;f++)for(d=0;16>d;d++)c=mixOneRound(blockA[(e+0)%5],blockA[(e+1)%5],blockA[(e+2)%5],blockA[(e+3)%5],blockA[(e+4)%5],a[indexes[f][d]],ROLs[f][d],f),blockA[(e+0)%5]=c[0],blockA[(e+1)%5]=c[1],blockA[(e+2)%5]=c[2],blockA[(e+3)%5]=c[3],blockA[(e+4)%5]=c[4],e+=4;e=0;for(f=5;10>f;f++)for(d=0;16>d;d++)c=mixOneRound(blockB[(e+0)%5],blockB[(e+1)%5],blockB[(e+2)%5],blockB[(e+
3)%5],blockB[(e+4)%5],a[indexes[f][d]],ROLs[f][d],f),blockB[(e+0)%5]=c[0],blockB[(e+1)%5]=c[1],blockB[(e+2)%5]=c[2],blockB[(e+3)%5]=c[3],blockB[(e+4)%5]=c[4],e+=4;blockB[3]+=blockA[2]+b[1];b[1]=b[2]+blockA[3]+blockB[4];b[2]=b[3]+blockA[4]+blockB[0];b[3]=b[4]+blockA[0]+blockB[1];b[4]=b[0]+blockA[1]+blockB[2];b[0]=blockB[3]}function zeroX(b){for(var a=0;16>a;a++)b[a]=0}
function MDfinish(b,a,c,d){var e=Array(16);zeroX(e);for(var f=0,g=0;g<(c&63);g++)e[g>>>2]^=(a.charCodeAt(f++)&255)<<8*(g&3);e[c>>>2&15]^=1<<8*(c&3)+7;55<(c&63)&&(compress(b,e),e=Array(16),zeroX(e));e[14]=c<<3;e[15]=c>>>29|d<<3;compress(b,e)}function BYTES_TO_DWORD(b){var a=(b.charCodeAt(3)&255)<<24,a=a|(b.charCodeAt(2)&255)<<16,a=a|(b.charCodeAt(1)&255)<<8;return a|=b.charCodeAt(0)&255}
function RMD(b){var a=Array(RMDsize/32),c=Array(RMDsize/8),d,e;MDinit(a);d=b.length;var f=Array(16);zeroX(f);var g=0;for(e=d;63<e;e-=64){for(var h=0;16>h;h++)f[h]=BYTES_TO_DWORD(b.substr(g,4)),g+=4;compress(a,f)}MDfinish(a,b.substr(g),d,0);for(h=0;h<RMDsize/8;h+=4)c[h]=a[h>>>2]&255,c[h+1]=a[h>>>2]>>>8&255,c[h+2]=a[h>>>2]>>>16&255,c[h+3]=a[h>>>2]>>>24&255;return c}function RMDstring(b){for(var b=RMD(b),a="",c=0;c<RMDsize/8;c++)a+=String.fromCharCode(b[c]);return a}
var jsSHA=function(){var b=function(a,b){this.highOrder=a;this.lowOrder=b},a=function(a){var b=[],c=8*a.length,d;for(d=0;d<c;d+=8)b[d>>5]|=(a.charCodeAt(d/8)&255)<<24-d%32;return b},c=function(a){var b=[],c=a.length,d,e;for(d=0;d<c;d+=2){e=parseInt(a.substr(d,2),16);if(isNaN(e))return"INVALID HEX STRING";b[d>>3]|=e<<24-4*(d%8)}return b},d=function(a){var b="",c=4*a.length,d,e;for(d=0;d<c;d+=1)e=a[d>>2]>>8*(3-d%4),b+="0123456789abcdef".charAt(e>>4&15)+"0123456789abcdef".charAt(e&15);return b},e=function(a){var b=
"",c=4*a.length,d,e,f;for(d=0;d<c;d+=3){f=(a[d>>2]>>8*(3-d%4)&255)<<16|(a[d+1>>2]>>8*(3-(d+1)%4)&255)<<8|a[d+2>>2]>>8*(3-(d+2)%4)&255;for(e=0;4>e;e+=1)b=8*d+6*e<=32*a.length?b+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(f>>6*(3-e)&63):b+""}return b},f=function(a){for(var b="",c=0;c<32*a.length;c+=8)b+=String.fromCharCode(a[c>>5]>>>24-c%32&255);return b},g=function(a,b){return a<<b|a>>>32-b},h=function(a,b){return a>>>b|a<<32-b},j=function(a,c){return 32>=c?new b(a.highOrder>>>
c|a.lowOrder<<32-c,a.lowOrder>>>c|a.highOrder<<32-c):new b(a.lowOrder>>>c|a.highOrder<<32-c,a.highOrder>>>c|a.lowOrder<<32-c)},k=function(a,c){return 32>=c?new b(a.highOrder>>>c,a.lowOrder>>>c|a.highOrder<<32-c):new b(0,a.highOrder<<32-c)},l=function(a,b,c){return a&b^~a&c},m=function(a,c,d){return new b(a.highOrder&c.highOrder^~a.highOrder&d.highOrder,a.lowOrder&c.lowOrder^~a.lowOrder&d.lowOrder)},r=function(a,b,c){return a&b^a&c^b&c},p=function(a,c,d){return new b(a.highOrder&c.highOrder^a.highOrder&
d.highOrder^c.highOrder&d.highOrder,a.lowOrder&c.lowOrder^a.lowOrder&d.lowOrder^c.lowOrder&d.lowOrder)},o=function(a){return h(a,2)^h(a,13)^h(a,22)},y=function(a){var c=j(a,28),d=j(a,34),a=j(a,39);return new b(c.highOrder^d.highOrder^a.highOrder,c.lowOrder^d.lowOrder^a.lowOrder)},x=function(a){return h(a,6)^h(a,11)^h(a,25)},v=function(a){var c=j(a,14),d=j(a,18),a=j(a,41);return new b(c.highOrder^d.highOrder^a.highOrder,c.lowOrder^d.lowOrder^a.lowOrder)},u=function(a){return h(a,7)^h(a,18)^a>>>3},
t=function(a){var c=j(a,1),d=j(a,8),a=k(a,7);return new b(c.highOrder^d.highOrder^a.highOrder,c.lowOrder^d.lowOrder^a.lowOrder)},E=function(a){return h(a,17)^h(a,19)^a>>>10},Q=function(a){var c=j(a,19),d=j(a,61),a=k(a,6);return new b(c.highOrder^d.highOrder^a.highOrder,c.lowOrder^d.lowOrder^a.lowOrder)},D=function(a,b){var c=(a&65535)+(b&65535);return((a>>>16)+(b>>>16)+(c>>>16)&65535)<<16|c&65535},M=function(a,b,c,d){var e=(a&65535)+(b&65535)+(c&65535)+(d&65535);return((a>>>16)+(b>>>16)+(c>>>16)+
(d>>>16)+(e>>>16)&65535)<<16|e&65535},K=function(a,b,c,d,e){var f=(a&65535)+(b&65535)+(c&65535)+(d&65535)+(e&65535);return((a>>>16)+(b>>>16)+(c>>>16)+(d>>>16)+(e>>>16)+(f>>>16)&65535)<<16|f&65535},w=function(a,c){var d,e,f;d=(a.lowOrder&65535)+(c.lowOrder&65535);e=(a.lowOrder>>>16)+(c.lowOrder>>>16)+(d>>>16);f=(e&65535)<<16|d&65535;d=(a.highOrder&65535)+(c.highOrder&65535)+(e>>>16);e=(a.highOrder>>>16)+(c.highOrder>>>16)+(d>>>16);return new b((e&65535)<<16|d&65535,f)},z=function(a,c,d,e){var f,g,
h;f=(a.lowOrder&65535)+(c.lowOrder&65535)+(d.lowOrder&65535)+(e.lowOrder&65535);g=(a.lowOrder>>>16)+(c.lowOrder>>>16)+(d.lowOrder>>>16)+(e.lowOrder>>>16)+(f>>>16);h=(g&65535)<<16|f&65535;f=(a.highOrder&65535)+(c.highOrder&65535)+(d.highOrder&65535)+(e.highOrder&65535)+(g>>>16);g=(a.highOrder>>>16)+(c.highOrder>>>16)+(d.highOrder>>>16)+(e.highOrder>>>16)+(f>>>16);return new b((g&65535)<<16|f&65535,h)},T=function(a,c,d,e,f){var g,h,j;g=(a.lowOrder&65535)+(c.lowOrder&65535)+(d.lowOrder&65535)+(e.lowOrder&
65535)+(f.lowOrder&65535);h=(a.lowOrder>>>16)+(c.lowOrder>>>16)+(d.lowOrder>>>16)+(e.lowOrder>>>16)+(f.lowOrder>>>16)+(g>>>16);j=(h&65535)<<16|g&65535;g=(a.highOrder&65535)+(c.highOrder&65535)+(d.highOrder&65535)+(e.highOrder&65535)+(f.highOrder&65535)+(h>>>16);h=(a.highOrder>>>16)+(c.highOrder>>>16)+(d.highOrder>>>16)+(e.highOrder>>>16)+(f.highOrder>>>16)+(g>>>16);return new b((h&65535)<<16|g&65535,j)},A=function(a,b){var c=[],d,e,f,h,j,k,l,m,o,s=[1732584193,4023233417,2562383102,271733878,3285377520],
p=[1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1518500249,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,1859775393,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,
2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,2400959708,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782,3395469782];a[b>>5]|=128<<24-b%32;a[(b+65>>9<<4)+15]=b;o=a.length;for(l=0;l<o;l+=16){d=s[0];e=s[1];f=s[2];h=s[3];j=s[4];for(m=0;80>m;m+=1)c[m]=
16>m?a[m+l]:g(c[m-3]^c[m-8]^c[m-14]^c[m-16],1),k=20>m?K(g(d,5),e&f^~e&h,j,p[m],c[m]):40>m?K(g(d,5),e^f^h,j,p[m],c[m]):60>m?K(g(d,5),r(e,f,h),j,p[m],c[m]):K(g(d,5),e^f^h,j,p[m],c[m]),j=h,h=f,f=g(e,30),e=d,d=k;s[0]=D(d,s[0]);s[1]=D(e,s[1]);s[2]=D(f,s[2]);s[3]=D(h,s[3]);s[4]=D(j,s[4])}return s},B=function(a,c,d){var e,f,g,h,j,k,A,B,C,s,da,Y,L,ea,ca,O,fa,ga,ha,ia,ja,ka,la,ma,q,na,Z=[],sa;if("SHA-224"===d||"SHA-256"===d)da=64,e=(c+65>>9<<4)+15,ea=16,ca=1,q=Number,O=D,fa=M,ga=K,ha=u,ia=E,ja=o,ka=x,ma=r,
la=l,na=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,
4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],s="SHA-224"===d?[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]:[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];else if("SHA-384"===d||"SHA-512"===d)da=80,e=(c+128>>10<<5)+31,ea=32,ca=2,q=b,O=w,fa=z,ga=T,ha=t,ia=Q,ja=y,ka=v,ma=
p,la=m,na=[new q(1116352408,3609767458),new q(1899447441,602891725),new q(3049323471,3964484399),new q(3921009573,2173295548),new q(961987163,4081628472),new q(1508970993,3053834265),new q(2453635748,2937671579),new q(2870763221,3664609560),new q(3624381080,2734883394),new q(310598401,1164996542),new q(607225278,1323610764),new q(1426881987,3590304994),new q(1925078388,4068182383),new q(2162078206,991336113),new q(2614888103,633803317),new q(3248222580,3479774868),new q(3835390401,2666613458),new q(4022224774,
944711139),new q(264347078,2341262773),new q(604807628,2007800933),new q(770255983,1495990901),new q(1249150122,1856431235),new q(1555081692,3175218132),new q(1996064986,2198950837),new q(2554220882,3999719339),new q(2821834349,766784016),new q(2952996808,2566594879),new q(3210313671,3203337956),new q(3336571891,1034457026),new q(3584528711,2466948901),new q(113926993,3758326383),new q(338241895,168717936),new q(666307205,1188179964),new q(773529912,1546045734),new q(1294757372,1522805485),new q(1396182291,
2643833823),new q(1695183700,2343527390),new q(1986661051,1014477480),new q(2177026350,1206759142),new q(2456956037,344077627),new q(2730485921,1290863460),new q(2820302411,3158454273),new q(3259730800,3505952657),new q(3345764771,106217008),new q(3516065817,3606008344),new q(3600352804,1432725776),new q(4094571909,1467031594),new q(275423344,851169720),new q(430227734,3100823752),new q(506948616,1363258195),new q(659060556,3750685593),new q(883997877,3785050280),new q(958139571,3318307427),new q(1322822218,
3812723403),new q(1537002063,2003034995),new q(1747873779,3602036899),new q(1955562222,1575990012),new q(2024104815,1125592928),new q(2227730452,2716904306),new q(2361852424,442776044),new q(2428436474,593698344),new q(2756734187,3733110249),new q(3204031479,2999351573),new q(3329325298,3815920427),new q(3391569614,3928383900),new q(3515267271,566280711),new q(3940187606,3454069534),new q(4118630271,4000239992),new q(116418474,1914138554),new q(174292421,2731055270),new q(289380356,3203993006),new q(460393269,
320620315),new q(685471733,587496836),new q(852142971,1086792851),new q(1017036298,365543100),new q(1126000580,2618297676),new q(1288033470,3409855158),new q(1501505948,4234509866),new q(1607167915,987167468),new q(1816402316,1246189591)],s="SHA-384"===d?[new q(3418070365,3238371032),new q(1654270250,914150663),new q(2438529370,812702999),new q(355462360,4144912697),new q(1731405415,4290775857),new q(41048885895,1750603025),new q(3675008525,1694076839),new q(1203062813,3204075428)]:[new q(1779033703,
4089235720),new q(3144134277,2227873595),new q(1013904242,4271175723),new q(2773480762,1595750129),new q(1359893119,2917565137),new q(2600822924,725511199),new q(528734635,4215389547),new q(1541459225,327033209)];a[c>>5]|=128<<24-c%32;a[e]=c;sa=a.length;for(Y=0;Y<sa;Y+=ea){c=s[0];e=s[1];f=s[2];g=s[3];h=s[4];j=s[5];k=s[6];A=s[7];for(L=0;L<da;L+=1)Z[L]=16>L?new q(a[L*ca+Y],a[L*ca+Y+1]):fa(ia(Z[L-2]),Z[L-7],ha(Z[L-15]),Z[L-16]),B=ga(A,ka(h),la(h,j,k),na[L],Z[L]),C=O(ja(c),ma(c,e,f)),A=k,k=j,j=h,h=O(g,
B),g=f,f=e,e=c,c=O(B,C);s[0]=O(c,s[0]);s[1]=O(e,s[1]);s[2]=O(f,s[2]);s[3]=O(g,s[3]);s[4]=O(h,s[4]);s[5]=O(j,s[5]);s[6]=O(k,s[6]);s[7]=O(A,s[7])}switch(d){case "SHA-224":return[s[0],s[1],s[2],s[3],s[4],s[5],s[6]];case "SHA-256":return s;case "SHA-384":return[s[0].highOrder,s[0].lowOrder,s[1].highOrder,s[1].lowOrder,s[2].highOrder,s[2].lowOrder,s[3].highOrder,s[3].lowOrder,s[4].highOrder,s[4].lowOrder,s[5].highOrder,s[5].lowOrder];case "SHA-512":return[s[0].highOrder,s[0].lowOrder,s[1].highOrder,s[1].lowOrder,
s[2].highOrder,s[2].lowOrder,s[3].highOrder,s[3].lowOrder,s[4].highOrder,s[4].lowOrder,s[5].highOrder,s[5].lowOrder,s[6].highOrder,s[6].lowOrder,s[7].highOrder,s[7].lowOrder];default:return[]}},C=function(b,d){this.strToHash=this.strBinLen=this.sha512=this.sha384=this.sha256=this.sha224=this.sha1=null;if("HEX"===d){if(0!==b.length%2)return"TEXT MUST BE IN BYTE INCREMENTS";this.strBinLen=4*b.length;this.strToHash=c(b)}else if("ASCII"===d||"undefined"===typeof d)this.strBinLen=8*b.length,this.strToHash=
a(b);else return"UNKNOWN TEXT INPUT TYPE"};C.prototype={getHash:function(a,b){var c=null,g=this.strToHash.slice();switch(b){case "HEX":c=d;break;case "B64":c=e;break;case "ASCII":c=f;break;default:return"FORMAT NOT RECOGNIZED"}switch(a){case "SHA-1":if(null===this.sha1)this.sha1=A(g,this.strBinLen);return c(this.sha1);case "SHA-224":if(null===this.sha224)this.sha224=B(g,this.strBinLen,a);return c(this.sha224);case "SHA-256":if(null===this.sha256)this.sha256=B(g,this.strBinLen,a);return c(this.sha256);
case "SHA-384":if(null===this.sha384)this.sha384=B(g,this.strBinLen,a);return c(this.sha384);case "SHA-512":if(null===this.sha512)this.sha512=B(g,this.strBinLen,a);return c(this.sha512);default:return"HASH NOT RECOGNIZED"}},getHMAC:function(b,g,h,j){var k,l,m,o,p;l=[];var t=[];switch(j){case "HEX":j=d;break;case "B64":j=e;break;case "ASCII":j=f;break;default:return"FORMAT NOT RECOGNIZED"}switch(h){case "SHA-1":k=64;p=160;break;case "SHA-224":k=64;p=224;break;case "SHA-256":k=64;p=256;break;case "SHA-384":k=
128;p=384;break;case "SHA-512":k=128;p=512;break;default:return"HASH NOT RECOGNIZED"}if("HEX"===g){if(0!==b.length%2)return"KEY MUST BE IN BYTE INCREMENTS";g=c(b);o=4*b.length}else if("ASCII"===g)g=a(b),o=8*b.length;else return"UNKNOWN KEY INPUT TYPE";b=8*k;m=k/4-1;k<o/8?(g="SHA-1"===h?A(g,o):B(g,o,h),g[m]&=4294967040):k>o/8&&(g[m]&=4294967040);for(k=0;k<=m;k+=1)l[k]=g[k]^909522486,t[k]=g[k]^1549556828;"SHA-1"===h?(l=A(l.concat(this.strToHash),b+this.strBinLen),l=A(t.concat(l),b+p)):(l=B(l.concat(this.strToHash),
b+this.strBinLen,h),l=B(t.concat(l),b+p,h));return j(l)}};return C}();function str_sha1(b){return(new jsSHA(b,"ASCII")).getHash("SHA-1","ASCII")}function str_sha224(b){return(new jsSHA(b,"ASCII")).getHash("SHA-224","ASCII")}function str_sha256(b){return(new jsSHA(b,"ASCII")).getHash("SHA-256","ASCII")}function str_sha384(b){return(new jsSHA(b,"ASCII")).getHash("SHA-384","ASCII")}function str_sha512(b){return(new jsSHA(b,"ASCII")).getHash("SHA-512","ASCII")}
function openpgp_cfb_encrypt(b,a,c,d,e,f){var g=Array(d),h=Array(d),b=b+b.charAt(d-2)+b.charAt(d-1);util.print_debug("prefixrandom:"+util.hexstrdump(b));for(var j="",k=0;k<d;k++)g[k]=0;h=a(g,e);for(k=0;k<d;k++)j+=String.fromCharCode(h[k]^b.charCodeAt(k));for(k=0;k<d;k++)g[k]=j.charCodeAt(k);h=a(g,e);j+=String.fromCharCode(h[0]^b.charCodeAt(d));j+=String.fromCharCode(h[1]^b.charCodeAt(d+1));if(f)for(k=0;k<d;k++)g[k]=j.charCodeAt(k+2);else for(k=0;k<d;k++)g[k]=j.charCodeAt(k);h=a(g,e);if(f){for(k=0;k<
d;k++)j+=String.fromCharCode(h[k]^c.charCodeAt(k));for(n=d+2;n<c.length;n+=d){for(k=0;k<d;k++)g[k]=j.charCodeAt(n+k);h=a(g,e);for(k=0;k<d;k++)j+=String.fromCharCode(h[k]^c.charCodeAt(n-2+k))}}else{c=" "+c;for(k=2;k<d;k++)j+=String.fromCharCode(h[k]^c.charCodeAt(k));b=j.substring(0,2*d).split("");j=j.substring(d);for(n=d;n<c.length;n+=d){for(k=0;k<d;k++)g[k]=j.charCodeAt(k);j="";h=a(g,e);for(k=0;k<d;k++)b.push(String.fromCharCode(h[k]^c.charCodeAt(n+k))),j+=String.fromCharCode(h[k]^c.charCodeAt(n+
k))}j=b.join("")}return j}function openpgp_cfb_mdc(b,a,c,d){var e=Array(a),f=Array(a),g;for(g=0;g<a;g++)e[g]=0;e=b(e,c);for(g=0;g<a;g++)f[g]=d.charCodeAt(g),e[g]^=f[g];f=b(f,c);return util.bin2str(e)+String.fromCharCode(f[0]^d.charCodeAt(a))+String.fromCharCode(f[1]^d.charCodeAt(a+1))}
function openpgp_cfb_decrypt(b,a,c,d,e){util.print_debug("resync:"+e);var f=Array(a),g=Array(a),h,j="",k=[];for(h=0;h<a;h++)f[h]=0;f=b(f,c);for(h=0;h<a;h++)g[h]=d.charCodeAt(h),f[h]^=g[h];g=b(g,c);util.print_debug("openpgp_cfb_decrypt:\niblock:"+util.hexidump(f)+"\nablock:"+util.hexidump(g)+"\n");util.print_debug((g[0]^d.charCodeAt(a)).toString(16)+(g[1]^d.charCodeAt(a+1)).toString(16));if(f[a-2]!=(g[0]^d.charCodeAt(a))||f[a-1]!=(g[1]^d.charCodeAt(a+1)))return util.print_eror("error duding decryption. Symmectric encrypted data not valid."),
k.join("");if(e){for(h=0;h<a;h++)f[h]=d.charCodeAt(h+2);j=a+2}else{for(h=0;h<a;h++)f[h]=d.charCodeAt(h);j=a}for(;j<d.length;j+=a){g=b(f,c);for(h=0;h<a&&h+j<d.length;h++)f[h]=d.charCodeAt(j+h),k.push(String.fromCharCode(g[h]^f[h]))}return k.join("")}
function normal_cfb_encrypt(b,a,c,d,e){for(var f="",f="",g=0,h=[],j=[],f=e.substring(0,a);d.length>a*g;){for(var e=b(f,c),f=d.substring(g*a,g*a+a),k=0;k<f.length;k++)j.push(String.fromCharCode(f.charCodeAt(k)^e[k]));f=j.join("");j=[];h.push(f);g++}return h.join("")}
function normal_cfb_decrypt(b,a,c,d,e){var f="",g=0,h=[];if(null==e)for(e=0;e<a;e++)f+=String.fromCharCode(0);else f=e.substring(0,a);for(;d.length>a*g;){for(var j=b(f,c),f=d.substring(g*a+0,g*a+a+0),e=0;e<f.length;e++)h.push(String.fromCharCode(f.charCodeAt(e)^j[e]));g++}return h.join("")}
function openpgp_crypto_asymetricEncrypt(b,a,c){switch(b){case 1:case 2:case 3:var b=new RSA,d=a[0].toBigInteger(),a=a[1].toBigInteger(),c=c.toBigInteger();return b.encrypt(c,a,d).toMPI();case 16:var b=new Elgamal,d=a[0].toBigInteger(),e=a[1].toBigInteger(),a=a[2].toBigInteger(),c=c.toBigInteger();return b.encrypt(c,e,d,a);default:return null}}
function openpgp_crypto_asymetricDecrypt(b,a,c,d){switch(b){case 1:case 2:case 3:var b=new RSA,e=c[0].toBigInteger(),a=c[1].toBigInteger(),f=c[2].toBigInteger(),c=c[3].toBigInteger(),d=d[0].toBigInteger();return b.decrypt(d,e,a,f,c);case 16:return b=new Elgamal,c=c[0].toBigInteger(),e=d[0].toBigInteger(),d=d[1].toBigInteger(),a=a[0].toBigInteger(),b.decrypt(e,d,a,c);default:return null}}
function openpgp_crypto_getPrefixRandom(b){switch(b){case 2:case 3:case 4:return openpgp_crypto_getRandomBytes(8);case 7:case 8:case 9:case 10:return openpgp_crypto_getRandomBytes(16);default:return null}}
function openpgp_crypto_MDCSystemBytes(b,a,c){util.print_debug_hexstr_dump("openpgp_crypto_symmetricDecrypt:\nencrypteddata:",c);switch(b){case 0:return c;case 2:return openpgp_cfb_mdc(desede,8,a,c,openpgp_cfb);case 3:return openpgp_cfb_mdc(cast5_encrypt,8,a,c);case 4:return openpgp_cfb_mdc(BFencrypt,8,a,c);case 7:case 8:case 9:return openpgp_cfb_mdc(AESencrypt,16,keyExpansion(a),c);case 10:return openpgp_cfb_mdc(TFencrypt,16,a,c);case 1:util.print_error(""+(1==b?"IDEA Algorithm not implemented":
"Twofish Algorithm not implemented"))}return null}function openpgp_crypto_generateSessionKey(b){switch(b){case 2:case 8:return openpgp_crypto_getRandomBytes(24);case 3:case 4:case 7:return util.print_debug("length = 16:\n"+util.hexstrdump(openpgp_crypto_getRandomBytes(16))),openpgp_crypto_getRandomBytes(16);case 9:case 10:return openpgp_crypto_getRandomBytes(32)}return null}
function openpgp_crypto_verifySignature(b,a,c,d,e){var f=openpgp_crypto_hashData(a,e);switch(b){case 1:case 2:case 3:e=new RSA;b=d[0].toBigInteger();d=d[1].toBigInteger();c=c[0].toBigInteger();d=e.verify(c,d,b);a=openpgp_encoding_emsa_pkcs1_decode(a,d.toMPI().substring(2));return-1==a?(util.print_error("PKCS1 padding in message or key incorrect. Aborting..."),!1):a==f;case 16:return util.print_error("signing with Elgamal is not defined in the OpenPGP standard."),null;case 17:var b=new DSA,f=c[0].toBigInteger(),
c=c[1].toBigInteger(),g=d[0].toBigInteger(),h=d[1].toBigInteger(),j=d[2].toBigInteger(),d=d[3].toBigInteger(),d=b.verify(a,f,c,e,g,h,j,d);return 0==d.compareTo(f);default:return null}}
function openpgp_crypto_signData(b,a,c,d,e){switch(a){case 1:case 2:case 3:var a=new RSA,d=d[0].toBigInteger(),f=c[0].toBigInteger(),b=openpgp_encoding_emsa_pkcs1_encode(b,e,c[0].mpiByteLength);util.print_debug("signing using RSA");return a.sign(b,d,f).toMPI();case 17:a=new DSA;util.print_debug("DSA Sign: q size in Bytes:"+c[1].getByteLength());var f=c[0].toBigInteger(),g=c[1].toBigInteger(),h=c[2].toBigInteger();c[3].toBigInteger();c=d[0].toBigInteger();b=a.sign(b,e,h,f,g,c);util.print_debug("signing using DSA\n result:"+
util.hexstrdump(b[0])+"|"+util.hexstrdump(b[1]));return b[0]+b[1];case 16:return util.print_debug("signing with Elgamal is not defined in the OpenPGP standard."),null;default:return null}}function openpgp_crypto_hashData(b,a){var c=null;switch(b){case 1:c=MD5(a);break;case 2:c=str_sha1(a);break;case 3:c=RMDstring(a);break;case 8:c=str_sha256(a);break;case 9:c=str_sha384(a);break;case 10:c=str_sha512(a);break;case 11:c=str_sha224(a)}return c}
function openpgp_crypto_getHashByteLength(b){switch(b){case 1:return 16;case 2:case 3:return 20;case 8:return 32;case 9:return 48;case 10:return 64;case 11:return 28}return null}function openpgp_crypto_getRandomBytes(b){for(var a="",c=0;c<b;c++)a+=String.fromCharCode(openpgp_crypto_getSecureRandomOctet());return a}function openpgp_crypto_getPseudoRandom(b,a){return Math.round(Math.random()*(a-b))+b}
function openpgp_crypto_getSecureRandom(b,a){var c=new Uint32Array(1);window.crypto.getRandomValues(c);for(var d=(a-b).toString(2).length;(c[0]&Math.pow(2,d)-1)>a-b;)window.crypto.getRandomValues(c);return b+Math.abs(c[0]&Math.pow(2,d)-1)}function openpgp_crypto_getSecureRandomOctet(){var b=new Uint32Array(1);window.crypto.getRandomValues(b);return b[0]&255}
function openpgp_crypto_getRandomBigInteger(b){if(0>b)return null;var a=openpgp_crypto_getRandomBytes(Math.floor((b+7)/8));0<b%8&&(a=String.fromCharCode(Math.pow(2,b%8)-1&a.charCodeAt(0))+a.substring(1));return(new openpgp_type_mpi).create(a).toBigInteger()}function openpgp_crypto_getRandomBigIntegerInRange(b,a){if(!(0>=a.compareTo(b))){for(var c=a.subtract(b),d=openpgp_crypto_getRandomBigInteger(c.bitLength());d>c;)d=openpgp_crypto_getRandomBigInteger(c.bitLength());return b.add(d)}}
function openpgp_crypto_testRSA(b){debugger;var a=new RSA,c=new openpgp_type_mpi;c.create(openpgp_encoding_eme_pkcs1_encode("ABABABAB",128));c=a.encrypt(c.toBigInteger(),b.ee,b.n);a.decrypt(c,b.d,b.p,b.q,b.u)}
function openpgp_crypto_generateKeyPair(b,a,c,d,e){var f,g,h=new Date,h=h.getTime()/1E3,h=String.fromCharCode(Math.floor(h/16777216%256))+String.fromCharCode(Math.floor(h/65536%256))+String.fromCharCode(Math.floor(h/256%256))+String.fromCharCode(Math.floor(h%256));switch(b){case 1:a=(new RSA).generate(a,"10001");f=(new openpgp_packet_keymaterial).write_private_key(b,a,c,d,e,h);g=(new openpgp_packet_keymaterial).write_public_key(b,a,h);break;default:util.print_error("Unknown keytype "+b)}return{privateKey:f,
publicKey:g}}
function openpgp_crypto_symmetricEncrypt(b,a,c,d,e){switch(a){case 0:return d;case 2:return openpgp_cfb_encrypt(b,desede,d,8,c,e).substring(0,d.length+10);case 3:return openpgp_cfb_encrypt(b,cast5_encrypt,d,8,c,e).substring(0,d.length+10);case 4:return openpgp_cfb_encrypt(b,BFencrypt,d,8,c,e).substring(0,d.length+10);case 7:case 8:case 9:return openpgp_cfb_encrypt(b,AESencrypt,d,16,keyExpansion(c),e).substring(0,d.length+18);case 10:return openpgp_cfb_encrypt(b,TFencrypt,d,16,c,e).substring(0,d.length+
18);case 1:return util.print_error("IDEA Algorithm not implemented"),null;default:return null}}
function openpgp_crypto_symmetricDecrypt(b,a,c,d){util.print_debug_hexstr_dump("openpgp_crypto_symmetricDecrypt:\nalgo:"+b+"\nencrypteddata:",c);var e=0;d||(e=2);switch(b){case 0:return c;case 2:return openpgp_cfb_decrypt(desede,8,a,c,d).substring(e,c.length+e-10);case 3:return openpgp_cfb_decrypt(cast5_encrypt,8,a,c,d).substring(e,c.length+e-10);case 4:return openpgp_cfb_decrypt(BFencrypt,8,a,c,d).substring(e,c.length+e-10);case 7:case 8:case 9:return openpgp_cfb_decrypt(AESencrypt,16,keyExpansion(a),
c,d).substring(e,c.length+e-18);case 10:return openpgp_cfb_decrypt(TFencrypt,16,a,c,d).substring(e,c.length+e-18);case 1:util.print_error(""+(1==b?"IDEA Algorithm not implemented":"Twofish Algorithm not implemented"))}return null}
var Rcon=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],S=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,
60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,
153,45,15,176,84,187,22],T1=[2774754246,2222750968,2574743534,2373680118,234025727,3177933782,2976870366,1422247313,1345335392,50397442,2842126286,2099981142,436141799,1658312629,3870010189,2591454956,1170918031,2642575903,1086966153,2273148410,368769775,3948501426,3376891790,200339707,3970805057,1742001331,4255294047,3937382213,3214711843,4154762323,2524082916,1539358875,3266819957,486407649,2928907069,1780885068,1513502316,1094664062,49805301,1338821763,1546925160,4104496465,887481809,150073849,
2473685474,1943591083,1395732834,1058346282,201589768,1388824469,1696801606,1589887901,672667696,2711000631,251987210,3046808111,151455502,907153956,2608889883,1038279391,652995533,1764173646,3451040383,2675275242,453576978,2659418909,1949051992,773462580,756751158,2993581788,3998898868,4221608027,4132590244,1295727478,1641469623,3467883389,2066295122,1055122397,1898917726,2542044179,4115878822,1758581177,0,753790401,1612718144,536673507,3367088505,3982187446,3194645204,1187761037,3653156455,1262041458,
3729410708,3561770136,3898103984,1255133061,1808847035,720367557,3853167183,385612781,3309519750,3612167578,1429418854,2491778321,3477423498,284817897,100794884,2172616702,4031795360,1144798328,3131023141,3819481163,4082192802,4272137053,3225436288,2324664069,2912064063,3164445985,1211644016,83228145,3753688163,3249976951,1977277103,1663115586,806359072,452984805,250868733,1842533055,1288555905,336333848,890442534,804056259,3781124030,2727843637,3427026056,957814574,1472513171,4071073621,2189328124,
1195195770,2892260552,3881655738,723065138,2507371494,2690670784,2558624025,3511635870,2145180835,1713513028,2116692564,2878378043,2206763019,3393603212,703524551,3552098411,1007948840,2044649127,3797835452,487262998,1994120109,1004593371,1446130276,1312438900,503974420,3679013266,168166924,1814307912,3831258296,1573044895,1859376061,4021070915,2791465668,2828112185,2761266481,937747667,2339994098,854058965,1137232011,1496790894,3077402074,2358086913,1691735473,3528347292,3769215305,3027004632,4199962284,
133494003,636152527,2942657994,2390391540,3920539207,403179536,3585784431,2289596656,1864705354,1915629148,605822008,4054230615,3350508659,1371981463,602466507,2094914977,2624877800,555687742,3712699286,3703422305,2257292045,2240449039,2423288032,1111375484,3300242801,2858837708,3628615824,84083462,32962295,302911004,2741068226,1597322602,4183250862,3501832553,2441512471,1489093017,656219450,3114180135,954327513,335083755,3013122091,856756514,3144247762,1893325225,2307821063,2811532339,3063651117,
572399164,2458355477,552200649,1238290055,4283782570,2015897680,2061492133,2408352771,4171342169,2156497161,386731290,3669999461,837215959,3326231172,3093850320,3275833730,2962856233,1999449434,286199582,3417354363,4233385128,3602627437,974525996],T2=[1667483301,2088564868,2004348569,2071721613,4076011277,1802229437,1869602481,3318059348,808476752,16843267,1734856361,724260477,4278118169,3621238114,2880130534,1987505306,3402272581,2189565853,3385428288,2105408135,4210749205,1499050731,1195871945,
4042324747,2913812972,3570709351,2728550397,2947499498,2627478463,2762232823,1920132246,3233848155,3082253762,4261273884,2475900334,640044138,909536346,1061125697,4160222466,3435955023,875849820,2779075060,3857043764,4059166984,1903288979,3638078323,825320019,353708607,67373068,3351745874,589514341,3284376926,404238376,2526427041,84216335,2593796021,117902857,303178806,2155879323,3806519101,3958099238,656887401,2998042573,1970662047,151589403,2206408094,741103732,437924910,454768173,1852759218,1515893998,
2694863867,1381147894,993752653,3604395873,3014884814,690573947,3823361342,791633521,2223248279,1397991157,3520182632,0,3991781676,538984544,4244431647,2981198280,1532737261,1785386174,3419114822,3200149465,960066123,1246401758,1280088276,1482207464,3486483786,3503340395,4025468202,2863288293,4227591446,1128498885,1296931543,859006549,2240090516,1162185423,4193904912,33686534,2139094657,1347461360,1010595908,2678007226,2829601763,1364304627,2745392638,1077969088,2408514954,2459058093,2644320700,943222856,
4126535940,3166462943,3065411521,3671764853,555827811,269492272,4294960410,4092853518,3537026925,3452797260,202119188,320022069,3974939439,1600110305,2543269282,1145342156,387395129,3301217111,2812761586,2122251394,1027439175,1684326572,1566423783,421081643,1936975509,1616953504,2172721560,1330618065,3705447295,572671078,707417214,2425371563,2290617219,1179028682,4008625961,3099093971,336865340,3739133817,1583267042,185275933,3688607094,3772832571,842163286,976909390,168432670,1229558491,101059594,
606357612,1549580516,3267534685,3553869166,2896970735,1650640038,2442213800,2509582756,3840201527,2038035083,3890730290,3368586051,926379609,1835915959,2374828428,3587551588,1313774802,2846444E3,1819072692,1448520954,4109693703,3941256997,1701169839,2054878350,2930657257,134746136,3132780501,2021191816,623200879,774790258,471611428,2795919345,3031724999,3334903633,3907570467,3722289532,1953818780,522141217,1263245021,3183305180,2341145990,2324303749,1886445712,1044282434,3048567236,1718013098,1212715224,
50529797,4143380225,235805714,1633796771,892693087,1465364217,3115936208,2256934801,3250690392,488454695,2661164985,3789674808,4177062675,2560109491,286335539,1768542907,3654920560,2391672713,2492740519,2610638262,505297954,2273777042,3924412704,3469641545,1431677695,673730680,3755976058,2357986191,2711706104,2307459456,218962455,3216991706,3873888049,1111655622,1751699640,1094812355,2576951728,757946999,252648977,2964356043,1414834428,3149622742,370551866],T3=[1673962851,2096661628,2012125559,2079755643,
4076801522,1809235307,1876865391,3314635973,811618352,16909057,1741597031,727088427,4276558334,3618988759,2874009259,1995217526,3398387146,2183110018,3381215433,2113570685,4209972730,1504897881,1200539975,4042984432,2906778797,3568527316,2724199842,2940594863,2619588508,2756966308,1927583346,3231407040,3077948087,4259388669,2470293139,642542118,913070646,1065238847,4160029431,3431157708,879254580,2773611685,3855693029,4059629809,1910674289,3635114968,828527409,355090197,67636228,3348452039,591815971,
3281870531,405809176,2520228246,84545285,2586817946,118360327,304363026,2149292928,3806281186,3956090603,659450151,2994720178,1978310517,152181513,2199756419,743994412,439627290,456535323,1859957358,1521806938,2690382752,1386542674,997608763,3602342358,3011366579,693271337,3822927587,794718511,2215876484,1403450707,3518589137,0,3988860141,541089824,4242743292,2977548465,1538714971,1792327274,3415033547,3194476990,963791673,1251270218,1285084236,1487988824,3481619151,3501943760,4022676207,2857362858,
4226619131,1132905795,1301993293,862344499,2232521861,1166724933,4192801017,33818114,2147385727,1352724560,1014514748,2670049951,2823545768,1369633617,2740846243,1082179648,2399505039,2453646738,2636233885,946882616,4126213365,3160661948,3061301686,3668932058,557998881,270544912,4293204735,4093447923,3535760850,3447803085,202904588,321271059,3972214764,1606345055,2536874647,1149815876,388905239,3297990596,2807427751,2130477694,1031423805,1690872932,1572530013,422718233,1944491379,1623236704,2165938305,
1335808335,3701702620,574907938,710180394,2419829648,2282455944,1183631942,4006029806,3094074296,338181140,3735517662,1589437022,185998603,3685578459,3772464096,845436466,980700730,169090570,1234361161,101452294,608726052,1555620956,3265224130,3552407251,2890133420,1657054818,2436475025,2503058581,3839047652,2045938553,3889509095,3364570056,929978679,1843050349,2365688973,3585172693,1318900302,2840191145,1826141292,1454176854,4109567988,3939444202,1707781989,2062847610,2923948462,135272456,3127891386,
2029029496,625635109,777810478,473441308,2790781350,3027486644,3331805638,3905627112,3718347997,1961401460,524165407,1268178251,3177307325,2332919435,2316273034,1893765232,1048330814,3044132021,1724688998,1217452104,50726147,4143383030,236720654,1640145761,896163637,1471084887,3110719673,2249691526,3248052417,490350365,2653403550,3789109473,4176155640,2553000856,287453969,1775418217,3651760345,2382858638,2486413204,2603464347,507257374,2266337927,3922272489,3464972750,1437269845,676362280,3752164063,
2349043596,2707028129,2299101321,219813645,3211123391,3872862694,1115997762,1758509160,1099088705,2569646233,760903469,253628687,2960903088,1420360788,3144537787,371997206],T4=[3332727651,4169432188,4003034999,4136467323,4279104242,3602738027,3736170351,2438251973,1615867952,33751297,3467208551,1451043627,3877240574,3043153879,1306962859,3969545846,2403715786,530416258,2302724553,4203183485,4011195130,3001768281,2395555655,4211863792,1106029997,3009926356,1610457762,1173008303,599760028,1408738468,
3835064946,2606481600,1975695287,3776773629,1034851219,1282024998,1817851446,2118205247,4110612471,2203045068,1750873140,1374987685,3509904869,4178113009,3801313649,2876496088,1649619249,708777237,135005188,2505230279,1181033251,2640233411,807933976,933336726,168756485,800430746,235472647,607523346,463175808,3745374946,3441880043,1315514151,2144187058,3936318837,303761673,496927619,1484008492,875436570,908925723,3702681198,3035519578,1543217312,2767606354,1984772923,3076642518,2110698419,1383803177,
3711886307,1584475951,328696964,2801095507,3110654417,0,3240947181,1080041504,3810524412,2043195825,3069008731,3569248874,2370227147,1742323390,1917532473,2497595978,2564049996,2968016984,2236272591,3144405200,3307925487,1340451498,3977706491,2261074755,2597801293,1716859699,294946181,2328839493,3910203897,67502594,4269899647,2700103760,2017737788,632987551,1273211048,2733855057,1576969123,2160083008,92966799,1068339858,566009245,1883781176,4043634165,1675607228,2009183926,2943736538,1113792801,540020752,
3843751935,4245615603,3211645650,2169294285,403966988,641012499,3274697964,3202441055,899848087,2295088196,775493399,2472002756,1441965991,4236410494,2051489085,3366741092,3135724893,841685273,3868554099,3231735904,429425025,2664517455,2743065820,1147544098,1417554474,1001099408,193169544,2362066502,3341414126,1809037496,675025940,2809781982,3168951902,371002123,2910247899,3678134496,1683370546,1951283770,337512970,2463844681,201983494,1215046692,3101973596,2673722050,3178157011,1139780780,3299238498,
967348625,832869781,3543655652,4069226873,3576883175,2336475336,1851340599,3669454189,25988493,2976175573,2631028302,1239460265,3635702892,2902087254,4077384948,3475368682,3400492389,4102978170,1206496942,270010376,1876277946,4035475576,1248797989,1550986798,941890588,1475454630,1942467764,2538718918,3408128232,2709315037,3902567540,1042358047,2531085131,1641856445,226921355,260409994,3767562352,2084716094,1908716981,3433719398,2430093384,100991747,4144101110,470945294,3265487201,1784624437,2935576407,
1775286713,395413126,2572730817,975641885,666476190,3644383713,3943954680,733190296,573772049,3535497577,2842745305,126455438,866620564,766942107,1008868894,361924487,3374377449,2269761230,2868860245,1350051880,2776293343,59739276,1509466529,159418761,437718285,1708834751,3610371814,2227585602,3501746280,2193834305,699439513,1517759789,504434447,2076946608,2835108948,1842789307,742004246];function B0(b){return b&255}function B1(b){return b>>8&255}function B2(b){return b>>16&255}
function B3(b){return b>>24&255}function F1(b,a,c,d){return B1(T1[b&255])|B1(T1[a>>8&255])<<8|B1(T1[c>>16&255])<<16|B1(T1[d>>>24])<<24}function packBytes(b){var a,c,d=b.length,e=Array(d/4);if(b&&!(d%4)){for(a=0,c=0;c<d;c+=4)e[a++]=b[c]|b[c+1]<<8|b[c+2]<<16|b[c+3]<<24;return e}}function unpackBytes(b){var a,c=0,d=b.length,e=Array(4*d);for(a=0;a<d;a++)e[c++]=B0(b[a]),e[c++]=B1(b[a]),e[c++]=B2(b[a]),e[c++]=B3(b[a]);return e}var maxkc=8,maxrk=14;
function keyExpansion(b){var a,c,d,e,f=Array(maxrk+1),g=b.length,h=Array(maxkc),j=Array(maxkc),k=0;if(16==g)e=10,a=4;else if(24==g)e=12,a=6;else if(32==g)e=14,a=8;else{util.print_error("aes.js: Invalid key-length for AES key:"+g);return}for(c=0;c<maxrk+1;c++)f[c]=Array(4);for(c=0,d=0;d<g;d++,c+=4)h[d]=b.charCodeAt(c)|b.charCodeAt(c+1)<<8|b.charCodeAt(c+2)<<16|b.charCodeAt(c+3)<<24;for(d=a-1;0<=d;d--)j[d]=h[d];for(d=c=b=0;d<a&&b<e+1;){for(;d<a&&4>c;d++,c++)f[b][c]=j[d];4==c&&(b++,c=0)}for(;b<e+1;){d=
j[a-1];j[0]^=S[B1(d)]|S[B2(d)]<<8|S[B3(d)]<<16|S[B0(d)]<<24;j[0]^=Rcon[k++];if(8!=a)d=1;else{for(d=1;d<a/2;d++)j[d]^=j[d-1];d=j[a/2-1];j[a/2]^=S[B0(d)]|S[B1(d)]<<8|S[B2(d)]<<16|S[B3(d)]<<24;d=a/2+1}for(;d<a;d++)j[d]^=j[d-1];for(d=0;d<a&&b<e+1;){for(;d<a&&4>c;d++,c++)f[b][c]=j[d];4==c&&(b++,c=0)}}this.rounds=e;this.rk=f;return this}
function AESencrypt(b,a){var c,d,e,f,g,h=packBytes(b),j=a.rounds,k=h[0],l=h[1],m=h[2];g=h[3];for(c=0;c<j-1;c++)d=k^a.rk[c][0],e=l^a.rk[c][1],f=m^a.rk[c][2],g^=a.rk[c][3],k=T1[d&255]^T2[e>>8&255]^T3[f>>16&255]^T4[g>>>24],l=T1[e&255]^T2[f>>8&255]^T3[g>>16&255]^T4[d>>>24],m=T1[f&255]^T2[g>>8&255]^T3[d>>16&255]^T4[e>>>24],g=T1[g&255]^T2[d>>8&255]^T3[e>>16&255]^T4[f>>>24];c=j-1;d=k^a.rk[c][0];e=l^a.rk[c][1];f=m^a.rk[c][2];g^=a.rk[c][3];h[0]=F1(d,e,f,g)^a.rk[j][0];h[1]=F1(e,f,g,d)^a.rk[j][1];h[2]=F1(f,
g,d,e)^a.rk[j][2];h[3]=F1(g,d,e,f)^a.rk[j][3];return unpackBytes(h)}function Blowfish(){}Blowfish.prototype.BLOCKSIZE=8;
Blowfish.prototype.SBOXES=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,
2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,
2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,
3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,
2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,
2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971E4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,
4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,
1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,
1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,
1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,
3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,
4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,
1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,
1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,
2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,
548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,
2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,
2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,
3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,
3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409E3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,
3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,
1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];
Blowfish.prototype.PARRAY=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731];Blowfish.prototype.NN=16;Blowfish.prototype._clean=function(b){0>b&&(b=(b&2147483647)+2147483648);return b};Blowfish.prototype._F=function(b){var a,c,d;d=b&255;b>>>=8;c=b&255;b>>>=8;a=b&255;b=this.sboxes[0][b>>>8&255]+this.sboxes[1][a];b^=this.sboxes[2][c];return b+=this.sboxes[3][d]};
Blowfish.prototype._encrypt_block=function(b){var a=b[0],c=b[1],d;for(d=0;d<this.NN;++d)var a=a^this.parray[d],c=this._F(a)^c,e=a,a=c,c=e;a^=this.parray[this.NN+0];c^=this.parray[this.NN+1];b[0]=this._clean(c);b[1]=this._clean(a)};Blowfish.prototype.encrypt_block=function(b){var a,c=[0,0],d=this.BLOCKSIZE/2;for(a=0;a<this.BLOCKSIZE/2;++a)c[0]=c[0]<<8|b[a+0]&255,c[1]=c[1]<<8|b[a+d]&255;this._encrypt_block(c);b=[];for(a=0;a<this.BLOCKSIZE/2;++a)b[a+0]=c[0]>>>24-8*a&255,b[a+d]=c[1]>>>24-8*a&255;return b};
Blowfish.prototype._decrypt_block=function(b){var a=b[0],c=b[1],d;for(d=this.NN+1;1<d;--d)var a=a^this.parray[d],c=this._F(a)^c,e=a,a=c,c=e;a^=this.parray[1];c^=this.parray[0];b[0]=this._clean(c);b[1]=this._clean(a)};
Blowfish.prototype.init=function(b){var a,c=0;this.parray=[];for(a=0;a<this.NN+2;++a){var d=0,e;for(e=0;4>e;++e)d=d<<8|b[c]&255,++c>=b.length&&(c=0);this.parray[a]=this.PARRAY[a]^d}this.sboxes=[];for(a=0;4>a;++a){this.sboxes[a]=[];for(c=0;256>c;++c)this.sboxes[a][c]=this.SBOXES[a][c]}b=[0,0];for(a=0;a<this.NN+2;a+=2)this._encrypt_block(b),this.parray[a+0]=b[0],this.parray[a+1]=b[1];for(a=0;4>a;++a)for(c=0;256>c;c+=2)this._encrypt_block(b),this.sboxes[a][c+0]=b[0],this.sboxes[a][c+1]=b[1]};
function BFencrypt(b,a){var c=new Blowfish;c.init(util.str2bin(a));return c.encrypt_block(b)}function cast5_encrypt(b,a){var c=new openpgp_symenc_cast5;c.setKey(util.str2bin(a));return c.encrypt(b)}
function openpgp_symenc_cast5(){function b(a,b,c){a=b+a;c=a<<c|a>>>32-c;return(f[0][c>>>24]^f[1][c>>>16&255])-f[2][c>>>8&255]+f[3][c&255]}function a(a,b,c){a^=b;c=a<<c|a>>>32-c;return f[0][c>>>24]-f[1][c>>>16&255]+f[2][c>>>8&255]^f[3][c&255]}function c(a,b,c){a=b-a;c=a<<c|a>>>32-c;return(f[0][c>>>24]+f[1][c>>>16&255]^f[2][c>>>8&255])-f[3][c&255]}this.BlockSize=8;this.KeySize=16;this.setKey=function(a){this.masking=Array(16);this.rotate=Array(16);this.reset();if(a.length==this.KeySize)this.keySchedule(a);
else return util.print_error("cast5.js: CAST-128: keys must be 16 bytes"),!1;return!0};this.reset=function(){for(var a=0;16>a;a++)this.masking[a]=0,this.rotate[a]=0};this.getBlockSize=function(){return BlockSize};this.encrypt=function(d){for(var e=Array(d.length),f=0;f<d.length;f+=8){var k=d[f]<<24|d[f+1]<<16|d[f+2]<<8|d[f+3],l=d[f+4]<<24|d[f+5]<<16|d[f+6]<<8|d[f+7],m;m=l;l=k^b(l,this.masking[0],this.rotate[0]);k=m;m=l;l=k^a(l,this.masking[1],this.rotate[1]);k=m;m=l;l=k^c(l,this.masking[2],this.rotate[2]);
k=m;m=l;l=k^b(l,this.masking[3],this.rotate[3]);k=m;m=l;l=k^a(l,this.masking[4],this.rotate[4]);k=m;m=l;l=k^c(l,this.masking[5],this.rotate[5]);k=m;m=l;l=k^b(l,this.masking[6],this.rotate[6]);k=m;m=l;l=k^a(l,this.masking[7],this.rotate[7]);k=m;m=l;l=k^c(l,this.masking[8],this.rotate[8]);k=m;m=l;l=k^b(l,this.masking[9],this.rotate[9]);k=m;m=l;l=k^a(l,this.masking[10],this.rotate[10]);k=m;m=l;l=k^c(l,this.masking[11],this.rotate[11]);k=m;m=l;l=k^b(l,this.masking[12],this.rotate[12]);k=m;m=l;l=k^a(l,
this.masking[13],this.rotate[13]);k=m;m=l;l=k^c(l,this.masking[14],this.rotate[14]);k=m;m=l;l=k^b(l,this.masking[15],this.rotate[15]);k=m;e[f]=l>>>24&255;e[f+1]=l>>>16&255;e[f+2]=l>>>8&255;e[f+3]=l&255;e[f+4]=k>>>24&255;e[f+5]=k>>>16&255;e[f+6]=k>>>8&255;e[f+7]=k&255}return e};this.decrypt=function(d){for(var e=Array(d.length),f=0;f<d.length;f+=8){var k=d[f]<<24|d[f+1]<<16|d[f+2]<<8|d[f+3],l=d[f+4]<<24|d[f+5]<<16|d[f+6]<<8|d[f+7],m;m=l;l=k^b(l,this.masking[15],this.rotate[15]);k=m;m=l;l=k^c(l,this.masking[14],
this.rotate[14]);k=m;m=l;l=k^a(l,this.masking[13],this.rotate[13]);k=m;m=l;l=k^b(l,this.masking[12],this.rotate[12]);k=m;m=l;l=k^c(l,this.masking[11],this.rotate[11]);k=m;m=l;l=k^a(l,this.masking[10],this.rotate[10]);k=m;m=l;l=k^b(l,this.masking[9],this.rotate[9]);k=m;m=l;l=k^c(l,this.masking[8],this.rotate[8]);k=m;m=l;l=k^a(l,this.masking[7],this.rotate[7]);k=m;m=l;l=k^b(l,this.masking[6],this.rotate[6]);k=m;m=l;l=k^c(l,this.masking[5],this.rotate[5]);k=m;m=l;l=k^a(l,this.masking[4],this.rotate[4]);
k=m;m=l;l=k^b(l,this.masking[3],this.rotate[3]);k=m;m=l;l=k^c(l,this.masking[2],this.rotate[2]);k=m;m=l;l=k^a(l,this.masking[1],this.rotate[1]);k=m;m=l;l=k^b(l,this.masking[0],this.rotate[0]);k=m;e[f]=l>>>24&255;e[f+1]=l>>>16&255;e[f+2]=l>>>8&255;e[f+3]=l&255;e[f+4]=k>>>24&255;e[f+5]=k>>16&255;e[f+6]=k>>8&255;e[f+7]=k&255}return e};var d=Array(4);d[0]=Array(4);d[0][0]=[4,0,13,15,12,14,8];d[0][1]=[5,2,16,18,17,19,10];d[0][2]=[6,3,23,22,21,20,9];d[0][3]=[7,1,26,25,27,24,11];d[1]=Array(4);d[1][0]=[0,
6,21,23,20,22,16];d[1][1]=[1,4,0,2,1,3,18];d[1][2]=[2,5,7,6,5,4,17];d[1][3]=[3,7,10,9,11,8,19];d[2]=Array(4);d[2][0]=[4,0,13,15,12,14,8];d[2][1]=[5,2,16,18,17,19,10];d[2][2]=[6,3,23,22,21,20,9];d[2][3]=[7,1,26,25,27,24,11];d[3]=Array(4);d[3][0]=[0,6,21,23,20,22,16];d[3][1]=[1,4,0,2,1,3,18];d[3][2]=[2,5,7,6,5,4,17];d[3][3]=[3,7,10,9,11,8,19];var e=Array(4);e[0]=Array(4);e[0][0]=[24,25,23,22,18];e[0][1]=[26,27,21,20,22];e[0][2]=[28,29,19,18,25];e[0][3]=[30,31,17,16,28];e[1]=Array(4);e[1][0]=[3,2,12,
13,8];e[1][1]=[1,0,14,15,13];e[1][2]=[7,6,8,9,3];e[1][3]=[5,4,10,11,7];e[2]=Array(4);e[2][0]=[19,18,28,29,25];e[2][1]=[17,16,30,31,28];e[2][2]=[23,22,24,25,18];e[2][3]=[21,20,26,27,22];e[3]=Array(4);e[3][0]=[8,9,7,6,3];e[3][1]=[10,11,5,4,7];e[3][2]=[12,13,3,2,8];e[3][3]=[14,15,1,0,13];this.keySchedule=function(a){for(var b=Array(8),c=Array(32),k=0;4>k;k++){var l=4*k;b[k]=a[l]<<24|a[l+1]<<16|a[l+2]<<8|a[l+3]}for(var a=[6,7,4,5],m=k=0;2>m;m++)for(var r=0;4>r;r++){for(l=0;4>l;l++){var p=d[r][l],o=b[p[1]],
o=o^f[4][b[p[2]>>>2]>>>24-8*(p[2]&3)&255],o=o^f[5][b[p[3]>>>2]>>>24-8*(p[3]&3)&255],o=o^f[6][b[p[4]>>>2]>>>24-8*(p[4]&3)&255],o=o^f[7][b[p[5]>>>2]>>>24-8*(p[5]&3)&255],o=o^f[a[l]][b[p[6]>>>2]>>>24-8*(p[6]&3)&255];b[p[0]]=o}for(l=0;4>l;l++)p=e[r][l],o=f[4][b[p[0]>>>2]>>>24-8*(p[0]&3)&255],o^=f[5][b[p[1]>>>2]>>>24-8*(p[1]&3)&255],o^=f[6][b[p[2]>>>2]>>>24-8*(p[2]&3)&255],o^=f[7][b[p[3]>>>2]>>>24-8*(p[3]&3)&255],o^=f[4+l][b[p[4]>>>2]>>>24-8*(p[4]&3)&255],c[k]=o,k++}for(k=0;16>k;k++)this.masking[k]=c[k],
this.rotate[k]=c[16+k]&31};var f=Array(8);f[0]=[821772500,2678128395,1810681135,1059425402,505495343,2617265619,1610868032,3483355465,3218386727,2294005173,3791863952,2563806837,1852023008,365126098,3269944861,584384398,677919599,3229601881,4280515016,2002735330,1136869587,3744433750,2289869850,2731719981,2714362070,879511577,1639411079,575934255,717107937,2857637483,576097850,2731753936,1725645E3,2810460463,5111599,767152862,2543075244,1251459544,1383482551,3052681127,3089939183,3612463449,1878520045,
1510570527,2189125840,2431448366,582008916,3163445557,1265446783,1354458274,3529918736,3202711853,3073581712,3912963487,3029263377,1275016285,4249207360,2905708351,3304509486,1442611557,3585198765,2712415662,2731849581,3248163920,2283946226,208555832,2766454743,1331405426,1447828783,3315356441,3108627284,2957404670,2981538698,3339933917,1669711173,286233437,1465092821,1782121619,3862771680,710211251,980974943,1651941557,430374111,2051154026,704238805,4128970897,3144820574,2857402727,948965521,3333752299,
2227686284,718756367,2269778983,2731643755,718440111,2857816721,3616097120,1113355533,2478022182,410092745,1811985197,1944238868,2696854588,1415722873,1682284203,1060277122,1998114690,1503841958,82706478,2315155686,1068173648,845149890,2167947013,1768146376,1993038550,3566826697,3390574031,940016341,3355073782,2328040721,904371731,1205506512,4094660742,2816623006,825647681,85914773,2857843460,1249926541,1417871568,3287612,3211054559,3126306446,1975924523,1353700161,2814456437,2438597621,1800716203,
722146342,2873936343,1151126914,4160483941,2877670899,458611604,2866078500,3483680063,770352098,2652916994,3367839148,3940505011,3585973912,3809620402,718646636,2504206814,2914927912,3631288169,2857486607,2860018678,575749918,2857478043,718488780,2069512688,3548183469,453416197,1106044049,3032691430,52586708,3378514636,3459808877,3211506028,1785789304,218356169,3571399134,3759170522,1194783844,1523787992,3007827094,1975193539,2555452411,1341901877,3045838698,3776907964,3217423946,2802510864,2889438986,
1057244207,1636348243,3761863214,1462225785,2632663439,481089165,718503062,24497053,3332243209,3344655856,3655024856,3960371065,1195698900,2971415156,3710176158,2115785917,4027663609,3525578417,2524296189,2745972565,3564906415,1372086093,1452307862,2780501478,1476592880,3389271281,18495466,2378148571,901398090,891748256,3279637769,3157290713,2560960102,1447622437,4284372637,216884176,2086908623,1879786977,3588903153,2242455666,2938092967,3559082096,2810645491,758861177,1121993112,215018983,642190776,
4169236812,1196255959,2081185372,3508738393,941322904,4124243163,2877523539,1848581667,2205260958,3180453958,2589345134,3694731276,550028657,2519456284,3789985535,2973870856,2093648313,443148163,46942275,2734146937,1117713533,1115362972,1523183689,3717140224,1551984063];f[1]=[522195092,4010518363,1776537470,960447360,4267822970,4005896314,1435016340,1929119313,2913464185,1310552629,3579470798,3724818106,2579771631,1594623892,417127293,2715217907,2696228731,1508390405,3994398868,3925858569,3695444102,
4019471449,3129199795,3770928635,3520741761,990456497,4187484609,2783367035,21106139,3840405339,631373633,3783325702,532942976,396095098,3548038825,4267192484,2564721535,2011709262,2039648873,620404603,3776170075,2898526339,3612357925,4159332703,1645490516,223693667,1567101217,3362177881,1029951347,3470931136,3570957959,1550265121,119497089,972513919,907948164,3840628539,1613718692,3594177948,465323573,2659255085,654439692,2575596212,2699288441,3127702412,277098644,624404830,4100943870,2717858591,
546110314,2403699828,3655377447,1321679412,4236791657,1045293279,4010672264,895050893,2319792268,494945126,1914543101,2777056443,3894764339,2219737618,311263384,4275257268,3458730721,669096869,3584475730,3835122877,3319158237,3949359204,2005142349,2713102337,2228954793,3769984788,569394103,3855636576,1425027204,108000370,2736431443,3671869269,3043122623,1750473702,2211081108,762237499,3972989403,2798899386,3061857628,2943854345,867476300,964413654,1591880597,1594774276,2179821409,552026980,3026064248,
3726140315,2283577634,3110545105,2152310760,582474363,1582640421,1383256631,2043843868,3322775884,1217180674,463797851,2763038571,480777679,2718707717,2289164131,3118346187,214354409,200212307,3810608407,3025414197,2674075964,3997296425,1847405948,1342460550,510035443,4080271814,815934613,833030224,1620250387,1945732119,2703661145,3966000196,1388869545,3456054182,2687178561,2092620194,562037615,1356438536,3409922145,3261847397,1688467115,2150901366,631725691,3840332284,549916902,3455104640,394546491,
837744717,2114462948,751520235,2221554606,2415360136,3999097078,2063029875,803036379,2702586305,821456707,3019566164,360699898,4018502092,3511869016,3677355358,2402471449,812317050,49299192,2570164949,3259169295,2816732080,3331213574,3101303564,2156015656,3705598920,3546263921,143268808,3200304480,1638124008,3165189453,3341807610,578956953,2193977524,3638120073,2333881532,807278310,658237817,2969561766,1641658566,11683945,3086995007,148645947,1138423386,4158756760,1981396783,2401016740,3699783584,
380097457,2680394679,2803068651,3334260286,441530178,4016580796,1375954390,761952171,891809099,2183123478,157052462,3683840763,1592404427,341349109,2438483839,1417898363,644327628,2233032776,2353769706,2201510100,220455161,1815641738,182899273,2995019788,3627381533,3702638151,2890684138,1052606899,588164016,1681439879,4038439418,2405343923,4229449282,167996282,1336969661,1688053129,2739224926,1543734051,1046297529,1138201970,2121126012,115334942,1819067631,1902159161,1941945968,2206692869,1159982321];
f[2]=[2381300288,637164959,3952098751,3893414151,1197506559,916448331,2350892612,2932787856,3199334847,4009478890,3905886544,1373570990,2450425862,4037870920,3778841987,2456817877,286293407,124026297,3001279700,1028597854,3115296800,4208886496,2691114635,2188540206,1430237888,1218109995,3572471700,308166588,570424558,2187009021,2455094765,307733056,1310360322,3135275007,1384269543,2388071438,863238079,2359263624,2801553128,3380786597,2831162807,1470087780,1728663345,4072488799,1090516929,532123132,
2389430977,1132193179,2578464191,3051079243,1670234342,1434557849,2711078940,1241591150,3314043432,3435360113,3091448339,1812415473,2198440252,267246943,796911696,3619716990,38830015,1526438404,2806502096,374413614,2943401790,1489179520,1603809326,1920779204,168801282,260042626,2358705581,1563175598,2397674057,1356499128,2217211040,514611088,2037363785,2186468373,4022173083,2792511869,2913485016,1173701892,4200428547,3896427269,1334932762,2455136706,602925377,2835607854,1613172210,41346230,2499634548,
2457437618,2188827595,41386358,4172255629,1313404830,2405527007,3801973774,2217704835,873260488,2528884354,2478092616,4012915883,2555359016,2006953883,2463913485,575479328,2218240648,2099895446,660001756,2341502190,3038761536,3888151779,3848713377,3286851934,1022894237,1620365795,3449594689,1551255054,15374395,3570825345,4249311020,4151111129,3181912732,310226346,1133119310,530038928,136043402,2476768958,3107506709,2544909567,1036173560,2367337196,1681395281,1758231547,3641649032,306774401,1575354324,
3716085866,1990386196,3114533736,2455606671,1262092282,3124342505,2768229131,4210529083,1833535011,423410938,660763973,2187129978,1639812E3,3508421329,3467445492,310289298,272797111,2188552562,2456863912,310240523,677093832,1013118031,901835429,3892695601,1116285435,3036471170,1337354835,243122523,520626091,277223598,4244441197,4194248841,1766575121,594173102,316590669,742362309,3536858622,4176435350,3838792410,2501204839,1229605004,3115755532,1552908988,2312334149,979407927,3959474601,1148277331,
176638793,3614686272,2083809052,40992502,1340822838,2731552767,3535757508,3560899520,1354035053,122129617,7215240,2732932949,3118912700,2718203926,2539075635,3609230695,3725561661,1928887091,2882293555,1988674909,2063640240,2491088897,1459647954,4189817080,2302804382,1113892351,2237858528,1927010603,4002880361,1856122846,1594404395,2944033133,3855189863,3474975698,1643104450,4054590833,3431086530,1730235576,2984608721,3084664418,2131803598,4178205752,267404349,1617849798,1616132681,1462223176,736725533,
2327058232,551665188,2945899023,1749386277,2575514597,1611482493,674206544,2201269090,3642560800,728599968,1680547377,2620414464,1388111496,453204106,4156223445,1094905244,2754698257,2201108165,3757000246,2704524545,3922940700,3996465027];f[3]=[2645754912,532081118,2814278639,3530793624,1246723035,1689095255,2236679235,4194438865,2116582143,3859789411,157234593,2045505824,4245003587,1687664561,4083425123,605965023,672431967,1336064205,3376611392,214114848,4258466608,3232053071,489488601,605322005,
3998028058,264917351,1912574028,756637694,436560991,202637054,135989450,85393697,2152923392,3896401662,2895836408,2145855233,3535335007,115294817,3147733898,1922296357,3464822751,4117858305,1037454084,2725193275,2127856640,1417604070,1148013728,1827919605,642362335,2929772533,909348033,1346338451,3547799649,297154785,1917849091,4161712827,2883604526,3968694238,1469521537,3780077382,3375584256,1763717519,136166297,4290970789,1295325189,2134727907,2798151366,1566297257,3672928234,2677174161,2672173615,
965822077,2780786062,289653839,1133871874,3491843819,35685304,1068898316,418943774,672553190,642281022,2346158704,1954014401,3037126780,4079815205,2030668546,3840588673,672283427,1776201016,359975446,3750173538,555499703,2769985273,1324923,69110472,152125443,3176785106,3822147285,1340634837,798073664,1434183902,15393959,216384236,1303690150,3881221631,3711134124,3960975413,106373927,2578434224,1455997841,1801814300,1578393881,1854262133,3188178946,3258078583,2302670060,1539295533,3505142565,3078625975,
2372746020,549938159,3278284284,2620926080,181285381,2865321098,3970029511,68876850,488006234,1728155692,2608167508,836007927,2435231793,919367643,3339422534,3655756360,1457871481,40520939,1380155135,797931188,234455205,2255801827,3990488299,397000196,739833055,3077865373,2871719860,4022553888,772369276,390177364,3853951029,557662966,740064294,1640166671,1699928825,3535942136,622006121,3625353122,68743880,1742502,219489963,1664179233,1577743084,1236991741,410585305,2366487942,823226535,1050371084,
3426619607,3586839478,212779912,4147118561,1819446015,1911218849,530248558,3486241071,3252585495,2886188651,3410272728,2342195030,20547779,2982490058,3032363469,3631753222,312714466,1870521650,1493008054,3491686656,615382978,4103671749,2534517445,1932181,2196105170,278426614,6369430,3274544417,2913018367,697336853,2143000447,2946413531,701099306,1558357093,2805003052,3500818408,2321334417,3567135975,216290473,3591032198,23009561,1996984579,3735042806,2024298078,3739440863,569400510,2339758983,3016033873,
3097871343,3639523026,3844324983,3256173865,795471839,2951117563,4101031090,4091603803,3603732598,971261452,534414648,428311343,3389027175,2844869880,694888862,1227866773,2456207019,3043454569,2614353370,3749578031,3676663836,459166190,4132644070,1794958188,51825668,2252611902,3084671440,2036672799,3436641603,1099053433,2469121526,3059204941,1323291266,2061838604,1018778475,2233344254,2553501054,334295216,3556750194,1065731521,183467730];f[4]=[2127105028,745436345,2601412319,2788391185,3093987327,
500390133,1155374404,389092991,150729210,3891597772,3523549952,1935325696,716645080,946045387,2901812282,1774124410,3869435775,4039581901,3293136918,3438657920,948246080,363898952,3867875531,1286266623,1598556673,68334250,630723836,1104211938,1312863373,613332731,2377784574,1101634306,441780740,3129959883,1917973735,2510624549,3238456535,2544211978,3308894634,1299840618,4076074851,1756332096,3977027158,297047435,3790297736,2265573040,3621810518,1311375015,1667687725,47300608,3299642885,2474112369,
201668394,1468347890,576830978,3594690761,3742605952,1958042578,1747032512,3558991340,1408974056,3366841779,682131401,1033214337,1545599232,4265137049,206503691,103024618,2855227313,1337551222,2428998917,2963842932,4015366655,3852247746,2796956967,3865723491,3747938335,247794022,3755824572,702416469,2434691994,397379957,851939612,2314769512,218229120,1380406772,62274761,214451378,3170103466,2276210409,3845813286,28563499,446592073,1693330814,3453727194,29968656,3093872512,220656637,2470637031,77972100,
1667708854,1358280214,4064765667,2395616961,325977563,4277240721,4220025399,3605526484,3355147721,811859167,3069544926,3962126810,652502677,3075892249,4132761541,3498924215,1217549313,3250244479,3858715919,3053989961,1538642152,2279026266,2875879137,574252750,3324769229,2651358713,1758150215,141295887,2719868960,3515574750,4093007735,4194485238,1082055363,3417560400,395511885,2966884026,179534037,3646028556,3738688086,1092926436,2496269142,257381841,3772900718,1636087230,1477059743,2499234752,3811018894,
2675660129,3285975680,90732309,1684827095,1150307763,1723134115,3237045386,1769919919,1240018934,815675215,750138730,2239792499,1234303040,1995484674,138143821,675421338,1145607174,1936608440,3238603024,2345230278,2105974004,323969391,779555213,3004902369,2861610098,1017501463,2098600890,2628620304,2940611490,2682542546,1171473753,3656571411,3687208071,4091869518,393037935,159126506,1662887367,1147106178,391545844,3452332695,1891500680,3016609650,1851642611,546529401,1167818917,3194020571,2848076033,
3953471836,575554290,475796850,4134673196,450035699,2351251534,844027695,1080539133,86184846,1554234488,3692025454,1972511363,2018339607,1491841390,1141460869,1061690759,4244549243,2008416118,2351104703,2868147542,1598468138,722020353,1027143159,212344630,1387219594,1725294528,3745187956,2500153616,458938280,4129215917,1828119673,544571780,3503225445,2297937496,1241802790,267843827,2694610800,1397140384,1558801448,3782667683,1806446719,929573330,2234912681,400817706,616011623,4121520928,3603768725,
1761550015,1968522284,4053731006,4192232858,4005120285,872482584,3140537016,3894607381,2287405443,1963876937,3663887957,1584857E3,2975024454,1833426440,4025083860];f[5]=[4143615901,749497569,1285769319,3795025788,2514159847,23610292,3974978748,844452780,3214870880,3751928557,2213566365,1676510905,448177848,3730751033,4086298418,2307502392,871450977,3222878141,4110862042,3831651966,2735270553,1310974780,2043402188,1218528103,2736035353,4274605013,2702448458,3936360550,2693061421,162023535,2827510090,
687910808,23484817,3784910947,3371371616,779677500,3503626546,3473927188,4157212626,3500679282,4248902014,2466621104,3899384794,1958663117,925738300,1283408968,3669349440,1840910019,137959847,2679828185,1239142320,1315376211,1547541505,1690155329,739140458,3128809933,3933172616,3876308834,905091803,1548541325,4040461708,3095483362,144808038,451078856,676114313,2861728291,2469707347,993665471,373509091,2599041286,4025009006,4170239449,2149739950,3275793571,3749616649,2794760199,1534877388,572371878,
2590613551,1753320020,3467782511,1405125690,4270405205,633333386,3026356924,3475123903,632057672,2846462855,1404951397,3882875879,3915906424,195638627,2385783745,3902872553,1233155085,3355999740,2380578713,2702246304,2144565621,3663341248,3894384975,2502479241,4248018925,3094885567,1594115437,572884632,3385116731,767645374,1331858858,1475698373,3793881790,3532746431,1321687957,619889600,1121017241,3440213920,2070816767,2833025776,1933951238,4095615791,890643334,3874130214,859025556,360630002,925594799,
1764062180,3920222280,4078305929,979562269,2810700344,4087740022,1949714515,546639971,1165388173,3069891591,1495988560,922170659,1291546247,2107952832,1813327274,3406010024,3306028637,4241950635,153207855,2313154747,1608695416,1150242611,1967526857,721801357,1220138373,3691287617,3356069787,2112743302,3281662835,1111556101,1778980689,250857638,2298507990,673216130,2846488510,3207751581,3562756981,3008625920,3417367384,2198807050,529510932,3547516680,3426503187,2364944742,102533054,2294910856,1617093527,
1204784762,3066581635,1019391227,1069574518,1317995090,1691889997,3661132003,510022745,3238594800,1362108837,1817929911,2184153760,805817662,1953603311,3699844737,120799444,2118332377,207536705,2282301548,4120041617,145305846,2508124933,3086745533,3261524335,1877257368,2977164480,3160454186,2503252186,4221677074,759945014,254147243,2767453419,3801518371,629083197,2471014217,907280572,3900796746,940896768,2751021123,2625262786,3161476951,3661752313,3260732218,1425318020,2977912069,1496677566,3988592072,
2140652971,3126511541,3069632175,977771578,1392695845,1698528874,1411812681,1369733098,1343739227,3620887944,1142123638,67414216,3102056737,3088749194,1626167401,2546293654,3941374235,697522451,33404913,143560186,2595682037,994885535,1247667115,3859094837,2699155541,3547024625,4114935275,2968073508,3199963069,2732024527,1237921620,951448369,1898488916,1211705605,2790989240,2233243581,3598044975];f[6]=[2246066201,858518887,1714274303,3485882003,713916271,2879113490,3730835617,539548191,36158695,1298409750,
419087104,1358007170,749914897,2989680476,1261868530,2995193822,2690628854,3443622377,3780124940,3796824509,2976433025,4259637129,1551479E3,512490819,1296650241,951993153,2436689437,2460458047,144139966,3136204276,310820559,3068840729,643875328,1969602020,1680088954,2185813161,3283332454,672358534,198762408,896343282,276269502,3014846926,84060815,197145886,376173866,3943890818,3813173521,3545068822,1316698879,1598252827,2633424951,1233235075,859989710,2358460855,3503838400,3409603720,1203513385,1193654839,
2792018475,2060853022,207403770,1144516871,3068631394,1121114134,177607304,3785736302,326409831,1929119770,2983279095,4183308101,3474579288,3200513878,3228482096,119610148,1170376745,3378393471,3163473169,951863017,3337026068,3135789130,2907618374,1183797387,2015970143,4045674555,2182986399,2952138740,3928772205,384012900,2454997643,10178499,2879818989,2596892536,111523738,2995089006,451689641,3196290696,235406569,1441906262,3890558523,3013735005,4158569349,1644036924,376726067,1006849064,3664579700,
2041234796,1021632941,1374734338,2566452058,371631263,4007144233,490221539,206551450,3140638584,1053219195,1853335209,3412429660,3562156231,735133835,1623211703,3104214392,2738312436,4096837757,3366392578,3110964274,3956598718,3196820781,2038037254,3877786376,2339753847,300912036,3766732888,2372630639,1516443558,4200396704,1574567987,4069441456,4122592016,2699739776,146372218,2748961456,2043888151,35287437,2596680554,655490400,1132482787,110692520,1031794116,2188192751,1324057718,1217253157,919197030,
686247489,3261139658,1028237775,3135486431,3059715558,2460921700,986174950,2661811465,4062904701,2752986992,3709736643,367056889,1353824391,731860949,1650113154,1778481506,784341916,357075625,3608602432,1074092588,2480052770,3811426202,92751289,877911070,3600361838,1231880047,480201094,3756190983,3094495953,434011822,87971354,363687820,1717726236,1901380172,3926403882,2481662265,400339184,1490350766,2661455099,1389319756,2558787174,784598401,1983468483,30828846,3550527752,2716276238,3841122214,1765724805,
1955612312,1277890269,1333098070,1564029816,2704417615,1026694237,3287671188,1260819201,3349086767,1016692350,1582273796,1073413053,1995943182,694588404,1025494639,3323872702,3551898420,4146854327,453260480,1316140391,1435673405,3038941953,3486689407,1622062951,403978347,817677117,950059133,4246079218,3278066075,1486738320,1417279718,481875527,2549965225,3933690356,760697757,1452955855,3897451437,1177426808,1702951038,4085348628,2447005172,1084371187,3516436277,3068336338,1073369276,1027665953,3284188590,
1230553676,1368340146,2226246512,267243139,2274220762,4070734279,2497715176,2423353163,2504755875];f[7]=[3793104909,3151888380,2817252029,895778965,2005530807,3871412763,237245952,86829237,296341424,3851759377,3974600970,2475086196,709006108,1994621201,2972577594,937287164,3734691505,168608556,3189338153,2225080640,3139713551,3033610191,3025041904,77524477,185966941,1208824168,2344345178,1721625922,3354191921,1066374631,1927223579,1971335949,2483503697,1551748602,2881383779,2856329572,3003241482,
48746954,1398218158,2050065058,313056748,4255789917,393167848,1912293076,940740642,3465845460,3091687853,2522601570,2197016661,1727764327,364383054,492521376,1291706479,3264136376,1474851438,1685747964,2575719748,1619776915,1814040067,970743798,1561002147,2925768690,2123093554,1880132620,3151188041,697884420,2550985770,2607674513,2659114323,110200136,1489731079,997519150,1378877361,3527870668,478029773,2766872923,1022481122,431258168,1112503832,897933369,2635587303,669726182,3383752315,918222264,
163866573,3246985393,3776823163,114105080,1903216136,761148244,3571337562,1690750982,3166750252,1037045171,1888456500,2010454850,642736655,616092351,365016990,1185228132,4174898510,1043824992,2023083429,2241598885,3863320456,3279669087,3674716684,108438443,2132974366,830746235,606445527,4173263986,2204105912,1844756978,2532684181,4245352700,2969441100,3796921661,1335562986,4061524517,2720232303,2679424040,634407289,885462008,3294724487,3933892248,2094100220,339117932,4048830727,3202280980,1458155303,
2689246273,1022871705,2464987878,3714515309,353796843,2822958815,4256850100,4052777845,551748367,618185374,3778635579,4020649912,1904685140,3069366075,2670879810,3407193292,2954511620,4058283405,2219449317,3135758300,1120655984,3447565834,1474845562,3577699062,550456716,3466908712,2043752612,881257467,869518812,2005220179,938474677,3305539448,3850417126,1315485940,3318264702,226533026,965733244,321539988,1136104718,804158748,573969341,3708209826,937399083,3290727049,2901666755,1461057207,4013193437,
4066861423,3242773476,2421326174,1581322155,3028952165,786071460,3900391652,3918438532,1485433313,4023619836,3708277595,3678951060,953673138,1467089153,1930354364,1533292819,2492563023,1346121658,1685000834,1965281866,3765933717,4190206607,2052792609,3515332758,690371149,3125873887,2180283551,2903598061,3933952357,436236910,289419410,14314871,1242357089,2904507907,1616633776,2666382180,585885352,3471299210,2699507360,1432659641,277164553,3354103607,770115018,2303809295,3741942315,3177781868,2853364978,
2269453327,3774259834,987383833,1290892879,225909803,1741533526,890078084,1496906255,1111072499,916028167,243534141,1252605537,2204162171,531204876,290011180,3916834213,102027703,237315147,209093447,1486785922,220223953,2758195998,4175039106,82940208,3127791296,2569425252,518464269,1353887104,3941492737,2377294467,3935040926]}
function desede(b,a){var c=a.substring(0,8),d=a.substring(8,16),e=a.substring(16,24);return util.str2bin(des(des_createKeys(e),des(des_createKeys(d),des(des_createKeys(c),util.bin2str(b),!0,0,null,null),!1,0,null,null),!0,0,null,null))}
function des(b,a,c,d,e,f){var g=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],h=[-2146402272,-2147450880,
32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,
32800,-2147483648,-2146435040,-2146402272,1081344],j=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,
131592,8,134348808,131584],k=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],l=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,
1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],m=[536870928,541065216,
16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],r=[2097152,
69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],p=[268439616,4096,262144,268701760,268435456,
268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696],o=0,y,x,v,u,t,E,Q,D,M,K,w,z,T=a.length,A=0,B=32==b.length?
3:9;E=3==B?c?[0,32,2]:[30,-2,-2]:c?[0,32,2,62,30,-2,64,96,2]:[94,62,-2,32,64,2,30,-2,-2];2==f?a+=" ":1==f?(f=8-T%8,a+=String.fromCharCode(f,f,f,f,f,f,f,f),8==f&&(T+=8)):f||(a+="\x00\x00\x00\x00\x00\x00\x00\x00");tempresult=result="";1==d&&(Q=e.charCodeAt(o++)<<24|e.charCodeAt(o++)<<16|e.charCodeAt(o++)<<8|e.charCodeAt(o++),M=e.charCodeAt(o++)<<24|e.charCodeAt(o++)<<16|e.charCodeAt(o++)<<8|e.charCodeAt(o++),o=0);for(;o<T;){u=a.charCodeAt(o++)<<24|a.charCodeAt(o++)<<16|a.charCodeAt(o++)<<8|a.charCodeAt(o++);
t=a.charCodeAt(o++)<<24|a.charCodeAt(o++)<<16|a.charCodeAt(o++)<<8|a.charCodeAt(o++);1==d&&(c?(u^=Q,t^=M):(D=Q,K=M,Q=u,M=t));f=(u>>>4^t)&252645135;t^=f;u^=f<<4;f=(u>>>16^t)&65535;t^=f;u^=f<<16;f=(t>>>2^u)&858993459;u^=f;t^=f<<2;f=(t>>>8^u)&16711935;u^=f;t^=f<<8;f=(u>>>1^t)&1431655765;t^=f;u^=f<<1;u=u<<1|u>>>31;t=t<<1|t>>>31;for(y=0;y<B;y+=3){w=E[y+1];z=E[y+2];for(e=E[y];e!=w;e+=z)x=t^b[e],v=(t>>>4|t<<28)^b[e+1],f=u,u=t,t=f^(h[x>>>24&63]|k[x>>>16&63]|m[x>>>8&63]|p[x&63]|g[v>>>24&63]|j[v>>>16&63]|l[v>>>
8&63]|r[v&63]);f=u;u=t;t=f}u=u>>>1|u<<31;t=t>>>1|t<<31;f=(u>>>1^t)&1431655765;t^=f;u^=f<<1;f=(t>>>8^u)&16711935;u^=f;t^=f<<8;f=(t>>>2^u)&858993459;u^=f;t^=f<<2;f=(u>>>16^t)&65535;t^=f;u^=f<<16;f=(u>>>4^t)&252645135;t^=f;u^=f<<4;1==d&&(c?(Q=u,M=t):(u^=D,t^=K));tempresult+=String.fromCharCode(u>>>24,u>>>16&255,u>>>8&255,u&255,t>>>24,t>>>16&255,t>>>8&255,t&255);A+=8;512==A&&(result+=tempresult,tempresult="",A=0)}result+=tempresult;return result=result.replace(/\0*$/g,"")}
function des_createKeys(b){pc2bytes0=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964];pc2bytes1=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697];pc2bytes2=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272];pc2bytes3=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,
139264,2236416,134356992,136454144];pc2bytes4=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256];pc2bytes5=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488];pc2bytes6=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746];pc2bytes7=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,
537069568];pc2bytes8=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578];pc2bytes9=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488];pc2bytes10=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800];pc2bytes11=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744];
pc2bytes12=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128];pc2bytes13=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261];for(var a=8<b.length?3:1,c=Array(32*a),d=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],e,f,g=0,h=0,j,k=0;k<a;k++){left=b.charCodeAt(g++)<<24|b.charCodeAt(g++)<<16|b.charCodeAt(g++)<<8|b.charCodeAt(g++);right=b.charCodeAt(g++)<<24|b.charCodeAt(g++)<<16|b.charCodeAt(g++)<<8|b.charCodeAt(g++);j=(left>>>4^right)&252645135;
right^=j;left^=j<<4;j=(right>>>-16^left)&65535;left^=j;right^=j<<-16;j=(left>>>2^right)&858993459;right^=j;left^=j<<2;j=(right>>>-16^left)&65535;left^=j;right^=j<<-16;j=(left>>>1^right)&1431655765;right^=j;left^=j<<1;j=(right>>>8^left)&16711935;left^=j;right^=j<<8;j=(left>>>1^right)&1431655765;right^=j;left^=j<<1;j=left<<8|right>>>20&240;left=right<<24|right<<8&16711680|right>>>8&65280|right>>>24&240;right=j;for(i=0;i<d.length;i++)d[i]?(left=left<<2|left>>>26,right=right<<2|right>>>26):(left=left<<
1|left>>>27,right=right<<1|right>>>27),left&=-15,right&=-15,e=pc2bytes0[left>>>28]|pc2bytes1[left>>>24&15]|pc2bytes2[left>>>20&15]|pc2bytes3[left>>>16&15]|pc2bytes4[left>>>12&15]|pc2bytes5[left>>>8&15]|pc2bytes6[left>>>4&15],f=pc2bytes7[right>>>28]|pc2bytes8[right>>>24&15]|pc2bytes9[right>>>20&15]|pc2bytes10[right>>>16&15]|pc2bytes11[right>>>12&15]|pc2bytes12[right>>>8&15]|pc2bytes13[right>>>4&15],j=(f>>>16^e)&65535,c[h++]=e^j,c[h++]=f^j<<16}return c}
function TFencrypt(b,a){var c=[].concat(b),d=createTwofish();d.open(util.str2bin(a),0);c=d.encrypt(c,0);d.close();return c}var MAXINT=4294967295;function rotb(b,a){return(b<<a|b>>>8-a)&255}function rotw(b,a){return(b<<a|b>>>32-a)&MAXINT}function getW(b,a){return b[a]|b[a+1]<<8|b[a+2]<<16|b[a+3]<<24}function setW(b,a,c){b.splice(a,4,c&255,c>>>8&255,c>>>16&255,c>>>24&255)}function setWInv(b,a,c){b.splice(a,4,c>>>24&255,c>>>16&255,c>>>8&255,c&255)}function getB(b,a){return b>>>8*a&255}
function getNrBits(b){for(var a=0;0<b;)a++,b>>>=1;return a}function getMask(b){return(1<<b)-1}function randByte(){return Math.floor(256*Math.random())}
function createTwofish(){function b(a){return g[0][getB(a,0)]^g[1][getB(a,1)]^g[2][getB(a,2)]^g[3][getB(a,3)]}function a(a){return g[0][getB(a,3)]^g[1][getB(a,0)]^g[2][getB(a,1)]^g[3][getB(a,2)]}var c=null,d=null,e=-1,f=[],g=[[],[],[],[]];return{name:"twofish",blocksize:16,open:function(a){function b(a,c){var d,e,f;for(d=0;8>d;d++)e=c>>>24,c=c<<8&MAXINT|a>>>24,a=a<<8&MAXINT,f=e<<1,e&128&&(f^=333),c^=e^f<<16,f^=e>>>1,e&1&&(f^=166),c^=f<<24|f<<8;return c}function d(a,b){var c,e,f;c=b>>4;e=b&15;f=t[a][c^
e];c=E[a][M[e]^K[c]];return D[a][M[c]^K[f]]<<4|Q[a][f^c]}function e(a,b){var c=getB(a,0),d=getB(a,1),f=getB(a,2),g=getB(a,3);switch(x){case 4:c=w[1][c]^getB(b[3],0),d=w[0][d]^getB(b[3],1),f=w[0][f]^getB(b[3],2),g=w[1][g]^getB(b[3],3);case 3:c=w[1][c]^getB(b[2],0),d=w[1][d]^getB(b[2],1),f=w[0][f]^getB(b[2],2),g=w[0][g]^getB(b[2],3);case 2:c=w[0][w[0][c]^getB(b[1],0)]^getB(b[0],0),d=w[0][w[1][d]^getB(b[1],1)]^getB(b[0],1),f=w[1][w[0][f]^getB(b[1],2)]^getB(b[0],2),g=w[1][w[1][g]^getB(b[1],3)]^getB(b[0],
3)}return z[0][c]^z[1][d]^z[2][f]^z[3][g]}c=a;var m,r,p,o;p=[];o=[];var y=[],x,v=[],u,t=[[8,1,7,13,6,15,3,2,0,11,5,9,14,12,10,4],[2,8,11,13,15,7,6,14,3,1,9,4,0,10,12,5]],E=[[14,12,11,8,1,2,3,5,15,4,10,6,7,0,9,13],[1,14,2,11,4,12,3,7,6,13,10,5,15,9,0,8]],Q=[[11,10,5,14,6,13,9,0,12,8,15,3,2,4,7,1],[4,12,7,5,1,6,9,10,0,14,13,8,2,11,3,15]],D=[[13,7,15,4,1,2,6,14,9,11,3,0,8,5,12,10],[11,9,5,1,12,3,13,14,6,4,7,15,2,0,8,10]],M=[0,8,1,9,2,10,3,11,4,12,5,13,6,14,7,15],K=[0,9,2,11,4,13,6,15,8,1,10,3,12,5,14,
7],w=[[],[]],z=[[],[],[],[]];c=c.slice(0,32);for(a=c.length;16!=a&&24!=a&&32!=a;)c[a++]=0;for(a=0;a<c.length;a+=4)y[a>>2]=getW(c,a);for(a=0;256>a;a++)w[0][a]=d(0,a),w[1][a]=d(1,a);for(a=0;256>a;a++)m=w[1][a],r=m^m>>2^[0,90,180,238][m&3],u=m^m>>1^m>>2^[0,238,180,90][m&3],z[0][a]=m+(r<<8)+(u<<16)+(u<<24),z[2][a]=r+(u<<8)+(m<<16)+(u<<24),m=w[0][a],r=m^m>>2^[0,90,180,238][m&3],u=m^m>>1^m>>2^[0,238,180,90][m&3],z[1][a]=u+(u<<8)+(r<<16)+(m<<24),z[3][a]=r+(m<<8)+(u<<16)+(r<<24);x=y.length/2;for(a=0;a<x;a++)m=
y[a+a],p[a]=m,r=y[a+a+1],o[a]=r,v[x-a-1]=b(m,r);for(a=0;40>a;a+=2)m=16843009*a,r=m+16843009,m=e(m,p),r=rotw(e(r,o),8),f[a]=m+r&MAXINT,f[a+1]=rotw(m+2*r,9);for(a=0;256>a;a++)switch(m=r=p=o=a,x){case 4:m=w[1][m]^getB(v[3],0),r=w[0][r]^getB(v[3],1),p=w[0][p]^getB(v[3],2),o=w[1][o]^getB(v[3],3);case 3:m=w[1][m]^getB(v[2],0),r=w[1][r]^getB(v[2],1),p=w[0][p]^getB(v[2],2),o=w[0][o]^getB(v[2],3);case 2:g[0][a]=z[0][w[0][w[0][m]^getB(v[1],0)]^getB(v[0],0)],g[1][a]=z[1][w[0][w[1][r]^getB(v[1],1)]^getB(v[0],
1)],g[2][a]=z[2][w[1][w[0][p]^getB(v[1],2)]^getB(v[0],2)],g[3][a]=z[3][w[1][w[1][o]^getB(v[1],3)]^getB(v[0],3)]}},close:function(){f=[];g=[[],[],[],[]]},encrypt:function(c,g){d=c;e=g;for(var k=[getW(d,e)^f[0],getW(d,e+4)^f[1],getW(d,e+8)^f[2],getW(d,e+12)^f[3]],l=0;8>l;l++){var m=l,r=k,p=b(r[0]),o=a(r[1]);r[2]=rotw(r[2]^p+o+f[4*m+8]&MAXINT,31);r[3]=rotw(r[3],1)^p+2*o+f[4*m+9]&MAXINT;p=b(r[2]);o=a(r[3]);r[0]=rotw(r[0]^p+o+f[4*m+10]&MAXINT,31);r[1]=rotw(r[1],1)^p+2*o+f[4*m+11]&MAXINT}setW(d,e,k[2]^
f[4]);setW(d,e+4,k[3]^f[5]);setW(d,e+8,k[0]^f[6]);setW(d,e+12,k[1]^f[7]);e+=16;return d},decrypt:function(c,g){d=c;e=g;for(var k=[getW(d,e)^f[4],getW(d,e+4)^f[5],getW(d,e+8)^f[6],getW(d,e+12)^f[7]],l=7;0<=l;l--){var m=l,r=k,p=b(r[0]),o=a(r[1]);r[2]=rotw(r[2],1)^p+o+f[4*m+10]&MAXINT;r[3]=rotw(r[3]^p+2*o+f[4*m+11]&MAXINT,31);p=b(r[2]);o=a(r[3]);r[0]=rotw(r[0],1)^p+o+f[4*m+8]&MAXINT;r[1]=rotw(r[1]^p+2*o+f[4*m+9]&MAXINT,31)}setW(d,e,k[2]^f[0]);setW(d,e+4,k[3]^f[1]);setW(d,e+8,k[0]^f[2]);setW(d,e+12,k[1]^
f[3]);e+=16},finalize:function(){return d}}}JXG={exists:function(b){return function(a){return!(a===b||null===a)}}()};JXG.decompress=function(b){return unescape((new JXG.Util.Unzip(JXG.Util.Base64.decodeAsArray(b))).unzip()[0][0])};JXG.Util={};
JXG.Util.Unzip=function(b){function a(){aa+=8;return B<A.length?A[B++]:-1}function c(){var b;aa++;b=C&1;C>>=1;0==C&&(C=a(),b=C&1,C=C>>1|128);return b}function d(a){for(var b=0,d=a;d--;)b=b<<1|c();a&&(b=D[b]>>8-a);return b}function e(a){Q++;u[t++]=a;p.push(String.fromCharCode(a));32768==t&&(t=0)}function f(){this.b1=this.b0=0;this.jump=null;this.jumppos=-1}function g(){for(;;){if(W[N]>=ra)return-1;if(qa[W[N]]==N)return W[N]++;W[N]++}}function h(){var a=V[U],b;o&&document.write("<br>len:"+N+" treepos:"+
U);if(17==N)return-1;U++;N++;b=g();o&&document.write("<br>IsPat "+b);if(0<=b)a.b0=b,o&&document.write("<br>b0 "+a.b0);else if(a.b0=32768,o&&document.write("<br>b0 "+a.b0),h())return-1;b=g();if(0<=b)a.b1=b,o&&document.write("<br>b1 "+a.b1),a.jump=null;else if(a.b1=32768,o&&document.write("<br>b1 "+a.b1),a.jump=V[U],a.jumppos=U,h())return-1;N--;return 0}function j(a,b,c,d){o&&document.write("currentTree "+a+" numval "+b+" lengths "+c+" show "+d);V=a;U=0;qa=c;ra=b;for(a=0;17>a;a++)W[a]=0;N=0;if(h())return o&&
alert("invalid huffman tree\n"),-1;if(o){document.write("<br>Tree: "+V.length);for(a=0;32>a;a++)document.write("Places["+a+"].b0="+V[a].b0+"<br>"),document.write("Places["+a+"].b1="+V[a].b1+"<br>")}return 0}function k(a){for(var b,d,e=0,f=a[e];;)if(b=c(),o&&document.write("b="+b),b){if(!(f.b1&32768))return o&&document.write("ret1"),f.b1;f=f.jump;b=a.length;for(d=0;d<b;d++)if(a[d]===f){e=d;break}}else{if(!(f.b0&32768))return o&&document.write("ret2"),f.b0;e++;f=a[e]}o&&document.write("ret3");return-1}
function l(){var b,g,h,l,m;do{b=c();h=d(2);switch(h){case 0:o&&alert("Stored\n");break;case 1:o&&alert("Fixed Huffman codes\n");break;case 2:o&&alert("Dynamic Huffman codes\n");break;case 3:o&&alert("Reserved block type!!\n");break;default:o&&alert("Unexpected value %d!\n",h)}if(0==h){C=1;h=a();h|=a()<<8;g=a();g|=a()<<8;for((h^~g)&65535&&document.write("BlockLen checksum mismatch\n");h--;)g=a(),e(g)}else if(1==h)for(;;)if(h=D[d(7)]>>1,23<h?(h=h<<1|c(),199<h?(h-=128,h=h<<1|c()):(h-=48,143<h&&(h+=136))):
h+=256,256>h)e(h);else if(256==h)break;else{var p;h-=257;m=d(K[h])+M[h];h=D[d(5)]>>3;8<z[h]?(p=d(8),p|=d(z[h]-8)<<8):p=d(z[h]);p+=w[h];for(h=0;h<m;h++)g=u[t-p&32767],e(g)}else if(2==h){var r=Array(320);g=257+d(5);p=1+d(5);l=4+d(4);for(h=0;19>h;h++)r[h]=0;for(h=0;h<l;h++)r[T[h]]=d(3);m=P.length;for(l=0;l<m;l++)P[l]=new f;if(j(P,19,r,0))return t=0,1;if(o){document.write("<br>distanceTree");for(h=0;h<P.length;h++)document.write("<br>"+P[h].b0+" "+P[h].b1+" "+P[h].jump+" "+P[h].jumppos)}m=g+p;l=0;var v=
-1;for(o&&document.write("<br>n="+m+" bits: "+aa+"<br>");l<m;)if(v++,h=k(P),o&&document.write("<br>"+v+" i:"+l+" decode: "+h+" bits "+aa+"<br>"),16>h)r[l++]=h;else if(16==h){var x;h=3+d(2);if(l+h>m)return t=0,1;for(x=l?r[l-1]:0;h--;)r[l++]=x}else{h=17==h?3+d(3):11+d(7);if(l+h>m)return t=0,1;for(;h--;)r[l++]=0}m=ba.length;for(l=0;l<m;l++)ba[l]=new f;if(j(ba,g,r,0))return t=0,1;m=ba.length;for(l=0;l<m;l++)P[l]=new f;h=[];for(l=g;l<r.length;l++)h[l-g]=r[l];if(j(P,p,h,0))return t=0,1;o&&document.write("<br>literalTree");
a:for(;;)if(h=k(ba),256<=h){h-=256;if(0==h)break;h--;m=d(K[h])+M[h];h=k(P);8<z[h]?(p=d(8),p|=d(z[h]-8)<<8):p=d(z[h]);for(p+=w[h];m--;){if(0>t-p)break a;g=u[t-p&32767];e(g)}}else e(h)}}while(!b);t=0;C=1;return 0}function m(){o&&alert("NEXTFILE");p=[];var b=[];E=!1;b[0]=a();b[1]=a();o&&alert("type: "+b[0]+" "+b[1]);120==b[0]&&218==b[1]&&(o&&alert("GEONExT-GZIP"),l(),o&&alert(p.join("")),v[x]=Array(2),v[x][0]=p.join(""),v[x][1]="geonext.gxt",x++);120==b[0]&&156==b[1]&&(o&&alert("ZLIB"),l(),o&&alert(p.join("")),
v[x]=Array(2),v[x][0]=p.join(""),v[x][1]="ZLIB",x++);31==b[0]&&139==b[1]&&(o&&alert("GZIP"),r(),o&&alert(p.join("")),v[x]=Array(2),v[x][0]=p.join(""),v[x][1]="file",x++);if(80==b[0]&&75==b[1]&&(E=!0,b[2]=a(),b[3]=a(),3==b[2]&&4==b[3])){b[0]=a();b[1]=a();o&&alert("ZIP-Version: "+b[1]+" "+b[0]/10+"."+b[0]%10);y=a();y|=a()<<8;o&&alert("gpflags: "+y);b=a();b|=a()<<8;o&&alert("method: "+b);a();a();a();a();var c=a(),c=c|a()<<8,c=c|a()<<16,c=c|a()<<24,d=a(),d=d|a()<<8,d=d|a()<<16,d=d|a()<<24,e=a(),e=e|a()<<
8,e=e|a()<<16,e=e|a()<<24;o&&alert("local CRC: "+c+"\nlocal Size: "+e+"\nlocal CompSize: "+d);c=a();c|=a()<<8;d=a();d|=a()<<8;o&&alert("filelen "+c);f=0;for(R=[];c--;)e=a(),"/"==e|":"==e?f=0:f<oa-1&&(R[f++]=String.fromCharCode(e));o&&alert("nameBuf: "+R);pa||(pa=R);for(var f=0;f<d;)a(),f++;Q=0;8==b&&(l(),o&&alert(p.join("")),v[x]=Array(2),v[x][0]=p.join(""),v[x][1]=R.join(""),x++);r()}}function r(){var b=[],c;y&8&&(b[0]=a(),b[1]=a(),b[2]=a(),b[3]=a(),80==b[0]&&75==b[1]&&7==b[2]&&8==b[3]&&(a(),a(),
a(),a()),a(),a(),a(),a(),a(),a(),a(),a(),o&&alert("CRC:"));E&&m();b[0]=a();if(8!=b[0])return o&&alert("Unknown compression method!"),0;y=a();o&&y&-32&&alert("Unknown flags set!");a();a();a();a();a();a();if(y&4){b[0]=a();b[2]=a();N=b[0]+256*b[1];o&&alert("Extra field size: "+N);for(b=0;b<N;b++)a()}if(y&8){b=0;for(R=[];c=a();){if("7"==c||":"==c)b=0;b<oa-1&&(R[b++]=c)}o&&alert("original file name: "+R)}if(y&16)for(;a(););y&2&&(a(),a());l();a();a();a();a();a();a();a();a();E&&m()}var p=[],o=!1,y,x=0,v=
[],u=Array(32768),t=0,E=!1,Q,D=[0,128,64,192,32,160,96,224,16,144,80,208,48,176,112,240,8,136,72,200,40,168,104,232,24,152,88,216,56,184,120,248,4,132,68,196,36,164,100,228,20,148,84,212,52,180,116,244,12,140,76,204,44,172,108,236,28,156,92,220,60,188,124,252,2,130,66,194,34,162,98,226,18,146,82,210,50,178,114,242,10,138,74,202,42,170,106,234,26,154,90,218,58,186,122,250,6,134,70,198,38,166,102,230,22,150,86,214,54,182,118,246,14,142,78,206,46,174,110,238,30,158,94,222,62,190,126,254,1,129,65,193,
33,161,97,225,17,145,81,209,49,177,113,241,9,137,73,201,41,169,105,233,25,153,89,217,57,185,121,249,5,133,69,197,37,165,101,229,21,149,85,213,53,181,117,245,13,141,77,205,45,173,109,237,29,157,93,221,61,189,125,253,3,131,67,195,35,163,99,227,19,147,83,211,51,179,115,243,11,139,75,203,43,171,107,235,27,155,91,219,59,187,123,251,7,135,71,199,39,167,103,231,23,151,87,215,55,183,119,247,15,143,79,207,47,175,111,239,31,159,95,223,63,191,127,255],M=[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],K=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,99,99],w=[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],z=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],T=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],A=b,B=0,C=1,aa=0,oa=256,R=[],pa,ba=Array(288),P=Array(32),U=0,V=null,N=0,W=Array(17);W[0]=0;var qa,ra;JXG.Util.Unzip.prototype.unzipFile=function(a){var b;this.unzip();
for(b=0;b<v.length;b++)if(v[b][1]==a)return v[b][0]};JXG.Util.Unzip.prototype.deflate=function(){p=[];E=!1;l();o&&alert(p.join(""));v[x]=Array(2);v[x][0]=p.join("");v[x][1]="DEFLATE";x++;return v};JXG.Util.Unzip.prototype.unzip=function(){o&&alert(A);m();return v}};
JXG.Util.Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(b){for(var a=[],c,d,e,f,g,h,j=0,b=JXG.Util.Base64._utf8_encode(b);j<b.length;)c=b.charCodeAt(j++),d=b.charCodeAt(j++),e=b.charCodeAt(j++),f=c>>2,c=(c&3)<<4|d>>4,g=(d&15)<<2|e>>6,h=e&63,isNaN(d)?g=h=64:isNaN(e)&&(h=64),a.push([this._keyStr.charAt(f),this._keyStr.charAt(c),this._keyStr.charAt(g),this._keyStr.charAt(h)].join(""));return a.join("")},decode:function(b,a){for(var c=[],d,e,f,g,h,
j=0,b=b.replace(/[^A-Za-z0-9\+\/\=]/g,"");j<b.length;)d=this._keyStr.indexOf(b.charAt(j++)),e=this._keyStr.indexOf(b.charAt(j++)),g=this._keyStr.indexOf(b.charAt(j++)),h=this._keyStr.indexOf(b.charAt(j++)),d=d<<2|e>>4,e=(e&15)<<4|g>>2,f=(g&3)<<6|h,c.push(String.fromCharCode(d)),64!=g&&c.push(String.fromCharCode(e)),64!=h&&c.push(String.fromCharCode(f));c=c.join("");a&&(c=JXG.Util.Base64._utf8_decode(c));return c},_utf8_encode:function(b){for(var b=b.replace(/\r\n/g,"\n"),a="",c=0;c<b.length;c++){var d=
b.charCodeAt(c);128>d?a+=String.fromCharCode(d):(127<d&&2048>d?a+=String.fromCharCode(d>>6|192):(a+=String.fromCharCode(d>>12|224),a+=String.fromCharCode(d>>6&63|128)),a+=String.fromCharCode(d&63|128))}return a},_utf8_decode:function(b){for(var a=[],c=0,d=0,e=0,f=0;c<b.length;)d=b.charCodeAt(c),128>d?(a.push(String.fromCharCode(d)),c++):191<d&&224>d?(e=b.charCodeAt(c+1),a.push(String.fromCharCode((d&31)<<6|e&63)),c+=2):(e=b.charCodeAt(c+1),f=b.charCodeAt(c+2),a.push(String.fromCharCode((d&15)<<12|
(e&63)<<6|f&63)),c+=3);return a.join("")},_destrip:function(b,a){var c=[],d,e,f=[];null==a&&(a=76);b.replace(/ /g,"");d=b.length/a;for(e=0;e<d;e++)c[e]=b.substr(e*a,a);d!=b.length/a&&(c[c.length]=b.substr(d*a,b.length-d*a));for(e=0;e<c.length;e++)f.push(c[e]);return f.join("\n")},decodeAsArray:function(b){var b=this.decode(b),a=[],c;for(c=0;c<b.length;c++)a[c]=b.charCodeAt(c);return a},decodeGEONExT:function(b){return decodeAsArray(destrip(b),!1)}};
JXG.Util.asciiCharCodeAt=function(b,a){var c=b.charCodeAt(a);if(255<c)switch(c){case 8364:c=128;break;case 8218:c=130;break;case 402:c=131;break;case 8222:c=132;break;case 8230:c=133;break;case 8224:c=134;break;case 8225:c=135;break;case 710:c=136;break;case 8240:c=137;break;case 352:c=138;break;case 8249:c=139;break;case 338:c=140;break;case 381:c=142;break;case 8216:c=145;break;case 8217:c=146;break;case 8220:c=147;break;case 8221:c=148;break;case 8226:c=149;break;case 8211:c=150;break;case 8212:c=
151;break;case 732:c=152;break;case 8482:c=153;break;case 353:c=154;break;case 8250:c=155;break;case 339:c=156;break;case 382:c=158;break;case 376:c=159}return c};
JXG.Util.utf8Decode=function(b){var a=[],c=0,d=0,e=0,f;if(!JXG.exists(b))return"";for(;c<b.length;)d=b.charCodeAt(c),128>d?(a.push(String.fromCharCode(d)),c++):191<d&&224>d?(e=b.charCodeAt(c+1),a.push(String.fromCharCode((d&31)<<6|e&63)),c+=2):(e=b.charCodeAt(c+1),f=b.charCodeAt(c+2),a.push(String.fromCharCode((d&15)<<12|(e&63)<<6|f&63)),c+=3);return a.join("")};
JXG.Util.genUUID=function(){for(var b="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),a=Array(36),c=0,d,e=0;36>e;e++)8==e||13==e||18==e||23==e?a[e]="-":14==e?a[e]="4":(2>=c&&(c=33554432+16777216*Math.random()|0),d=c&15,c>>=4,a[e]=b[19==e?d&3|8:d]);return a.join("")};
function openpgp_config(){this.config=null;this.default_config={prefer_hash_algorithm:8,encryption_cipher:9,compression:1,show_version:!0,show_comment:!0,integrity_protect:!0,composition_behavior:0,keyserver:"keyserver.linux.it"};this.versionstring="OpenPGP.js v.1.20130420";this.commentstring="http://openpgpjs.org";this.debug=!1;this.read=function(){var b=JSON.parse(window.localStorage.getItem("config"));null==b?(this.config=this.default_config,this.write()):this.config=b};this.write=function(){window.localStorage.setItem("config",
JSON.stringify(this.config))}}var b64s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function s2r(b){var a,c,d,e="",f=0,g=0,h=b.length;for(d=0;d<h;d++)c=b.charCodeAt(d),0==g?(e+=b64s.charAt(c>>2&63),a=(c&3)<<4):1==g?(e+=b64s.charAt(a|c>>4&15),a=(c&15)<<2):2==g&&(e+=b64s.charAt(a|c>>6&3),f+=1,0==f%60&&(e+="\n"),e+=b64s.charAt(c&63)),f+=1,0==f%60&&(e+="\n"),g+=1,3==g&&(g=0);0<g&&(e+=b64s.charAt(a),f+=1,0==f%60&&(e+="\n"),e+="=",f+=1);1==g&&(0==f%60&&(e+="\n"),e+="=");return e}
function r2s(b){var a,c,d="",e=0,f=0,g=b.length;for(c=0;c<g;c++)a=b64s.indexOf(b.charAt(c)),0<=a&&(e&&(d+=String.fromCharCode(f|a>>6-e&255)),e=e+2&7,f=a<<e&255);return d}
function openpgp_encoding_deArmor(b){var b=b.replace(/\r/g,""),a=openpgp_encoding_get_type(b);if(2!=a){b=b.split("-----");a={openpgp:openpgp_encoding_base64_decode(b[2].split("\n\n")[1].split("\n=")[0].replace(/\n- /g,"\n")),type:a};if(verifyCheckSum(a.openpgp,b[2].split("\n\n")[1].split("\n=")[1].split("\n")[0]))return a;util.print_error("Ascii armor integrity check on message failed: '"+b[2].split("\n\n")[1].split("\n=")[1].split("\n")[0]+"' should be '"+getCheckSum(a));return!1}b=b.split("-----");
a={text:b[2].replace(/\n- /g,"\n").split("\n\n")[1],openpgp:openpgp_encoding_base64_decode(b[4].split("\n\n")[1].split("\n=")[0]),type:a};if(verifyCheckSum(a.openpgp,b[4].split("\n\n")[1].split("\n=")[1]))return a;util.print_error("Ascii armor integrity check on message failed");return!1}
function openpgp_encoding_get_type(b){b=b.split("-----");if(b[1].match(/BEGIN PGP MESSAGE, PART \d+\/\d+/))return 0;if(b[1].match(/BEGIN PGP MESSAGE, PART \d+/))return 1;if(b[1].match(/BEGIN PGP SIGNED MESSAGE/))return 2;if(b[1].match(/BEGIN PGP MESSAGE/))return 3;if(b[1].match(/BEGIN PGP PUBLIC KEY BLOCK/))return 4;if(b[1].match(/BEGIN PGP PRIVATE KEY BLOCK/))return 5}
function openpgp_encoding_armor_addheader(){var b="";openpgp.config.config.show_version&&(b+="Version: "+openpgp.config.versionstring+"\r\n");openpgp.config.config.show_comment&&(b+="Comment: "+openpgp.config.commentstring+"\r\n");return b+"\r\n"}
function openpgp_encoding_armor(b,a,c,d){var e="";switch(b){case 0:e=e+("-----BEGIN PGP MESSAGE, PART "+c+"/"+d+"-----\r\n")+openpgp_encoding_armor_addheader();e+=openpgp_encoding_base64_encode(a);e+="\r\n="+getCheckSum(a)+"\r\n";e+="-----END PGP MESSAGE, PART "+c+"/"+d+"-----\r\n";break;case 1:e=e+("-----BEGIN PGP MESSAGE, PART "+c+"-----\r\n")+openpgp_encoding_armor_addheader();e+=openpgp_encoding_base64_encode(a);e+="\r\n="+getCheckSum(a)+"\r\n";e+="-----END PGP MESSAGE, PART "+c+"-----\r\n";break;
case 2:e+="\r\n-----BEGIN PGP SIGNED MESSAGE-----\r\nHash: "+a.hash+"\r\n\r\n";e+=a.text.replace(/\n-/g,"\n- -");e=e+"\r\n-----BEGIN PGP SIGNATURE-----\r\n"+openpgp_encoding_armor_addheader();e+=openpgp_encoding_base64_encode(a.openpgp);e+="\r\n="+getCheckSum(a.openpgp)+"\r\n";e+="-----END PGP SIGNATURE-----\r\n";break;case 3:e=e+"-----BEGIN PGP MESSAGE-----\r\n"+openpgp_encoding_armor_addheader();e+=openpgp_encoding_base64_encode(a);e+="\r\n="+getCheckSum(a)+"\r\n";e+="-----END PGP MESSAGE-----\r\n";
break;case 4:e=e+"-----BEGIN PGP PUBLIC KEY BLOCK-----\r\n"+openpgp_encoding_armor_addheader();e+=openpgp_encoding_base64_encode(a);e+="\r\n="+getCheckSum(a)+"\r\n";e+="-----END PGP PUBLIC KEY BLOCK-----\r\n\r\n";break;case 5:e=e+"-----BEGIN PGP PRIVATE KEY BLOCK-----\r\n"+openpgp_encoding_armor_addheader(),e+=openpgp_encoding_base64_encode(a),e+="\r\n="+getCheckSum(a)+"\r\n",e+="-----END PGP PRIVATE KEY BLOCK-----\r\n"}return e}
function getCheckSum(b){b=createcrc24(b);b=""+String.fromCharCode(b>>16)+String.fromCharCode(b>>8&255)+String.fromCharCode(b&255);return openpgp_encoding_base64_encode(b)}function verifyCheckSum(b,a){var c=getCheckSum(b);return c[0]==a[0]&&c[1]==a[1]&&c[2]==a[2]}
var crc_table=[0,8801531,25875725,17603062,60024545,51751450,35206124,44007191,128024889,120049090,103502900,112007375,70412248,78916387,95990485,88014382,264588937,256049778,240098180,248108927,207005800,215016595,232553829,224014750,140824496,149062475,166599357,157832774,200747345,191980970,176028764,184266919,520933865,529177874,512099556,503334943,480196360,471432179,487973381,496217854,414011600,405478443,422020573,430033190,457094705,465107658,448029500,439496647,281648992,273666971,289622637,
298124950,324696449,333198714,315665548,307683447,392699481,401494690,383961940,375687087,352057528,343782467,359738805,368533838,1041867730,1050668841,1066628831,1058355748,1032471859,1024199112,1006669886,1015471301,968368875,960392720,942864358,951368477,975946762,984451313,1000411399,992435708,836562267,828023200,810956886,818967725,844041146,852051777,868605623,860066380,914189410,922427545,938981743,930215316,904825475,896059E3,878993294,887231349,555053627,563297984,547333942,538569677,579245274,
570480673,588005847,596249900,649392898,640860153,658384399,666397428,623318499,631331096,615366894,606833685,785398962,777416777,794487231,802989380,759421523,767923880,751374174,743392165,695319947,704115056,687564934,679289981,719477610,711202705,728272487,737067676,2083735460,2092239711,2109313705,2101337682,2141233477,2133257662,2116711496,2125215923,2073216669,2064943718,2048398224,2057199467,2013339772,2022141063,2039215473,2030942602,1945504045,1936737750,1920785440,1929023707,1885728716,
1893966647,1911503553,1902736954,1951893524,1959904495,1977441561,1968902626,2009362165,2000822798,1984871416,1992881923,1665111629,1673124534,1656046400,1647513531,1621913772,1613380695,1629922721,1637935450,1688082292,1679317903,1695859321,1704103554,1728967061,1737211246,1720132760,1711368291,1828378820,1820103743,1836060105,1844855090,1869168165,1877963486,1860430632,1852155859,1801148925,1809650950,1792118E3,1784135691,1757986588,1750004711,1765960209,1774462698,1110107254,1118611597,1134571899,
1126595968,1102643863,1094667884,1077139354,1085643617,1166763343,1158490548,1140961346,1149762745,1176011694,1184812885,1200772771,1192499800,1307552511,1298785796,1281720306,1289958153,1316768798,1325007077,1341561107,1332794856,1246636998,1254647613,1271201483,1262662192,1239272743,1230733788,1213667370,1221678289,1562785183,1570797924,1554833554,1546300521,1588974462,1580441477,1597965939,1605978760,1518843046,1510078557,1527603627,1535847760,1494504007,1502748348,1486784330,1478020017,1390639894,
1382365165,1399434779,1408230112,1366334967,1375129868,1358579962,1350304769,1430452783,1438955220,1422405410,1414423513,1456544974,1448562741,1465633219,1474135352];
function createcrc24(b){for(var a=11994318,c=0;16<b.length-c;)a=a<<8^crc_table[(a>>16^b.charCodeAt(c))&255],a=a<<8^crc_table[(a>>16^b.charCodeAt(c+1))&255],a=a<<8^crc_table[(a>>16^b.charCodeAt(c+2))&255],a=a<<8^crc_table[(a>>16^b.charCodeAt(c+3))&255],a=a<<8^crc_table[(a>>16^b.charCodeAt(c+4))&255],a=a<<8^crc_table[(a>>16^b.charCodeAt(c+5))&255],a=a<<8^crc_table[(a>>16^b.charCodeAt(c+6))&255],a=a<<8^crc_table[(a>>16^b.charCodeAt(c+7))&255],a=a<<8^crc_table[(a>>16^b.charCodeAt(c+8))&255],a=a<<8^crc_table[(a>>
16^b.charCodeAt(c+9))&255],a=a<<8^crc_table[(a>>16^b.charCodeAt(c+10))&255],a=a<<8^crc_table[(a>>16^b.charCodeAt(c+11))&255],a=a<<8^crc_table[(a>>16^b.charCodeAt(c+12))&255],a=a<<8^crc_table[(a>>16^b.charCodeAt(c+13))&255],a=a<<8^crc_table[(a>>16^b.charCodeAt(c+14))&255],a=a<<8^crc_table[(a>>16^b.charCodeAt(c+15))&255],c+=16;for(var d=c;d<b.length;d++)a=a<<8^crc_table[(a>>16^b.charCodeAt(c++))&255];return a&16777215}function openpgp_encoding_base64_encode(b){return s2r(b)}
function openpgp_encoding_base64_decode(b){return r2s(b)}function openpgp_encoding_html_encode(b){return null==b?"":$("<div/>").text(b).html()}function openpgp_encoding_eme_pkcs1_encode(b,a){if(b.length>a-11)return-1;var c;c=""+String.fromCharCode(0);c+=String.fromCharCode(2);for(var d=0;d<a-b.length-3;d++)c+=String.fromCharCode(openpgp_crypto_getPseudoRandom(1,255));c+=String.fromCharCode(0);return c+b}
function openpgp_encoding_eme_pkcs1_decode(b,a){b.length<a&&(b=String.fromCharCode(0)+b);if(12>b.length||0!=b.charCodeAt(0)||2!=b.charCodeAt(1))return-1;for(var c=2;0!=b.charCodeAt(c)&&b.length>c;)c++;return b.substring(c+1,b.length)}hash_headers=[,[48,32,48,12,6,8,42,134,72,134,247,13,2,5,5,0,4,16],[48,33,48,9,6,5,43,14,3,2,26,5,0,4,20],[48,33,48,9,6,5,43,36,3,2,1,5,0,4,20]];hash_headers[8]=[48,49,48,13,6,9,96,134,72,1,101,3,4,2,1,5,0,4,32];
hash_headers[9]=[48,65,48,13,6,9,96,134,72,1,101,3,4,2,2,5,0,4,48];hash_headers[10]=[48,81,48,13,6,9,96,134,72,1,101,3,4,2,3,5,0,4,64];hash_headers[11]=[48,49,48,13,6,9,96,134,72,1,101,3,4,2,4,5,0,4,28];
function openpgp_encoding_emsa_pkcs1_encode(b,a,c){var d;d=""+String.fromCharCode(0);d+=String.fromCharCode(1);for(var e=0;e<c-hash_headers[b].length-3-openpgp_crypto_getHashByteLength(b);e++)d+=String.fromCharCode(255);d+=String.fromCharCode(0);for(e=0;e<hash_headers[b].length;e++)d+=String.fromCharCode(hash_headers[b][e]);d+=openpgp_crypto_hashData(b,a);return new BigInteger(util.hexstrdump(d),16)}
function openpgp_encoding_emsa_pkcs1_decode(b,a){var c=0;if(0!=a.charCodeAt(0)&&1!=a.charCodeAt(0))return-1;for(c++;255==a.charCodeAt(c);)c++;if(0!=a.charCodeAt(c++))return-1;for(var d=0,d=0;d<hash_headers[b].length&&d+c<a.length;d++)if(a.charCodeAt(d+c)!=hash_headers[b][d])return-1;c+=d;return a.substring(c).length<openpgp_crypto_getHashByteLength(b)?-1:a.substring(c)}
function _openpgp(){function b(a){for(var b=a.openpgp,d=a.text,e=[],f=0,g=0,h=b.length;g<b.length;){var j=openpgp_packet.read_packet(b,g,h);if(!j)break;if(1==j.tagType||2==j.tagType&&16>j.signatureType||3==j.tagType||4==j.tagType||8==j.tagType||9==j.tagType||10==j.tagType||11==j.tagType||18==j.tagType||19==j.tagType)if(e[e.length]=new openpgp_msg_message,e[f].messagePacket=j,e[f].type=a.type,9==j.tagType||1==j.tagType||3==j.tagType||18==j.tagType)if(9==j.tagType){util.print_error("unexpected openpgp packet");
break}else if(1==j.tagType){util.print_debug("session key found:\n "+j.toString());var k=!0;e[f].sessionKeys=[];for(var l=0;k;)e[f].sessionKeys[l]=j,g+=j.packetLength+j.headerLength,h-=j.packetLength+j.headerLength,j=openpgp_packet.read_packet(b,g,h),1!=j.tagType&&3!=j.tagType&&(k=!1),l++;18==j.tagType||9==j.tagType?(util.print_debug("encrypted data found:\n "+j.toString()),e[f].encryptedData=j,g+=j.packetLength+j.headerLength,h-=j.packetLength+j.headerLength,f++):util.print_debug("something is wrong: "+
j.tagType)}else{if(18==j.tagType){util.print_debug("symmetric encrypted data");break}}else 2==j.tagType&&3>j.signatureType?(g+=j.packetLength+j.headerLength,h-=j.packetLength+j.headerLength,e[f].text=d,e[f].signature=j,f++):4==j.tagType?(g+=j.packetLength+j.headerLength,h-=j.packetLength+j.headerLength):8==j.tagType?(g+=j.packetLength+j.headerLength,h-=j.packetLength+j.headerLength,j=j.decompress(),e=e.concat(openpgp.read_messages_dearmored({text:j,openpgp:j}))):10==j.tagType?(e.length=0,g+=j.packetLength+
j.headerLength,h-=j.packetLength+j.headerLength):11==j.tagType?(g+=j.packetLength+j.headerLength,h-=j.packetLength+j.headerLength,d=j.data,e[f].data=j.data,f++):19==j.tagType&&(g+=j.packetLength+j.headerLength,h-=j.packetLength+j.headerLength);else return util.print_error("no message found!"),null}return e}this.tostring="";this.generate_key_pair=function(a,b,d,e){var f=(new openpgp_packet_userid).write_packet(d),b=openpgp_crypto_generateKeyPair(a,b,e,openpgp.config.config.prefer_hash_algorithm,3),
a=b.privateKey,g=(new openpgp_packet_keymaterial).read_priv_key(a.string,3,a.string.length);g.decryptSecretMPIs(e)||util.print_error("Issue creating key. Unable to read resulting private key");e=new openpgp_msg_privatekey;e.privateKeyPacket=g;e.getPreferredSignatureHashAlgorithm=function(){return openpgp.config.config.prefer_hash_algorithm};g=e.privateKeyPacket.publicKey.data;g=String.fromCharCode(153)+String.fromCharCode(g.length>>8&255)+String.fromCharCode(g.length&255)+g+String.fromCharCode(180)+
String.fromCharCode(d.length>>24)+String.fromCharCode(d.length>>16&255)+String.fromCharCode(d.length>>8&255)+String.fromCharCode(d.length&255)+d;d=new openpgp_packet_signature;d=d.write_message_signature(16,g,e);b=openpgp_encoding_armor(4,b.publicKey.string+f+d.openpgp);f=openpgp_encoding_armor(5,a.string+f+d.openpgp);return{privateKey:e,privateKeyArmored:f,publicKeyArmored:b}};this.write_signed_message=function(a,b){var d=(new openpgp_packet_signature).write_message_signature(1,b.replace(/\r\n/g,
"\n").replace(/\n/,"\r\n"),a),d={text:b.replace(/\r\n/g,"\n").replace(/\n/,"\r\n"),openpgp:d.openpgp,hash:d.hash};return openpgp_encoding_armor(2,d,null,null)};this.write_signed_and_encrypted_message=function(a,b,d){var e="",f=(new openpgp_packet_literaldata).write_packet(d.replace(/\r\n/g,"\n").replace(/\n/g,"\r\n"));util.print_debug_hexstr_dump("literal_packet: |"+f+"|\n",f);for(var g=0;g<b.length;g++){var h="",h=(new openpgp_packet_onepasssignature).write_packet(1,openpgp.config.config.prefer_hash_algorithm,
a,!1);util.print_debug_hexstr_dump("onepasssigstr: |"+h+"|\n",h);var j=(new openpgp_packet_signature).write_message_signature(1,d.replace(/\r\n/g,"\n").replace(/\n/g,"\r\n"),a);util.print_debug_hexstr_dump("datasignature: |"+j.openpgp+"|\n",j.openpgp);e=0==g?h+f+j.openpgp:h+e+j.openpgp}util.print_debug_hexstr_dump("signed packet: |"+e+"|\n",e);a=openpgp_crypto_generateSessionKey(openpgp.config.config.encryption_cipher);d="";for(g=0;g<b.length;g++){f=b[g].getEncryptionKey();if(null==f)return util.print_error("no encryption key found! Key is for signing only."),
null;d+=(new openpgp_packet_encryptedsessionkey).write_pub_key_packet(f.getKeyId(),f.MPIs,f.publicKeyAlgorithm,openpgp.config.config.encryption_cipher,a)}d=openpgp.config.config.integrity_protect?d+(new openpgp_packet_encryptedintegrityprotecteddata).write_packet(openpgp.config.config.encryption_cipher,a,e):d+(new openpgp_packet_encrypteddata).write_packet(openpgp.config.config.encryption_cipher,a,e);return openpgp_encoding_armor(3,d,null,null)};this.write_encrypted_message=function(a,b){var d="",
d=(new openpgp_packet_literaldata).write_packet(b.replace(/\r\n/g,"\n").replace(/\n/g,"\r\n"));util.print_debug_hexstr_dump("literal_packet: |"+d+"|\n",d);for(var e=openpgp_crypto_generateSessionKey(openpgp.config.config.encryption_cipher),f="",g=0;g<a.length;g++){var h=a[g].getEncryptionKey();if(null==h)return util.print_error("no encryption key found! Key is for signing only."),null;f+=(new openpgp_packet_encryptedsessionkey).write_pub_key_packet(h.getKeyId(),h.MPIs,h.publicKeyAlgorithm,openpgp.config.config.encryption_cipher,
e)}f=openpgp.config.config.integrity_protect?f+(new openpgp_packet_encryptedintegrityprotecteddata).write_packet(openpgp.config.config.encryption_cipher,e,d):f+(new openpgp_packet_encrypteddata).write_packet(openpgp.config.config.encryption_cipher,e,d);return openpgp_encoding_armor(3,f,null,null)};this.read_message=function(a){var c;try{c=openpgp_encoding_deArmor(a.replace(/\r/g,""))}catch(d){return util.print_error("no message found!"),null}return b(c)};this.read_messages_dearmored=b;this.read_publicKey=
function(a){for(var b=0,d=[],e=0,a=openpgp_encoding_deArmor(a.replace(/\r/g,"")).openpgp,f=a.length;b!=a.length;){var g=openpgp_packet.read_packet(a,b,f);if(153==a[b].charCodeAt()||6==g.tagType)d[e]=new openpgp_msg_publickey,d[e].header=a.substring(b,b+3),153==a[b].charCodeAt()?(b++,f=a[b++].charCodeAt()<<8|a[b++].charCodeAt(),d[e].publicKeyPacket=new openpgp_packet_keymaterial,d[e].publicKeyPacket.header=d[e].header,d[e].publicKeyPacket.read_tag6(a,b,f),b+=d[e].publicKeyPacket.packetLength,b+=d[e].read_nodes(d[e].publicKeyPacket,
a,b,a.length-b)):(d[e]=new openpgp_msg_publickey,d[e].publicKeyPacket=g,b+=g.headerLength+g.packetLength,b+=d[e].read_nodes(g,a,b,a.length-b));else return util.print_error("no public key found!"),null;d[e].data=a.substring(0,b);e++}return d};this.read_privateKey=function(a){for(var b=[],d=0,e=0,a=openpgp_encoding_deArmor(a.replace(/\r/g,"")).openpgp,f=a.length;e!=a.length;){var g=openpgp_packet.read_packet(a,e,f);if(5==g.tagType)b[b.length]=new openpgp_msg_privatekey,e+=g.headerLength+g.packetLength,
e+=b[d].read_nodes(g,a,e,f);else return util.print_error("no block packet found!"),null;b[d].data=a.substring(0,e);d++}return b};this.init=function(){this.config=new openpgp_config;this.config.read();this.keyring=new openpgp_keyring;this.keyring.init()}}var openpgp=new _openpgp;
function openpgp_keyring(){this.init=function(){var b=JSON.parse(window.localStorage.getItem("privatekeys")),a=JSON.parse(window.localStorage.getItem("publickeys"));if(null==b||0==b.length)b=[];if(null==a||0==a.length)a=[];this.publicKeys=[];this.privateKeys=[];for(var c=0,d=0;d<b.length;d++){var e=openpgp.read_privateKey(b[d]);this.privateKeys[c]={armored:b[d],obj:e[0],keyId:e[0].getKeyId()};c++}for(d=c=0;d<a.length;d++)e=openpgp.read_publicKey(a[d]),null!=e[0]&&(this.publicKeys[c]={armored:a[d],
obj:e[0],keyId:e[0].getKeyId()},c++)};this.hasPrivateKey=function(){return 0<this.privateKeys.length};this.store=function(){for(var b=[],a=0;a<this.privateKeys.length;a++)b[a]=this.privateKeys[a].armored;for(var c=[],a=0;a<this.publicKeys.length;a++)c[a]=this.publicKeys[a].armored;window.localStorage.setItem("privatekeys",JSON.stringify(b));window.localStorage.setItem("publickeys",JSON.stringify(c))};this.getPublicKeyForAddress=function(b){var a=[],c=b.split("<"),d="",d=1<c.length?c[1].split(">")[0]:
b.trim(),d=d.toLowerCase();if(!util.emailRegEx.test(d))return a;for(b=0;b<this.publicKeys.length;b++)for(c=0;c<this.publicKeys[b].obj.userIds.length;c++)0<=this.publicKeys[b].obj.userIds[c].text.toLowerCase().indexOf(d)&&(a[a.length]=this.publicKeys[b]);return a};this.getPrivateKeyForAddress=function(b){var a=[],c=b.split("<"),d="",d=1<c.length?c[1].split(">")[0]:b.trim(),d=d.toLowerCase();if(!util.emailRegEx.test(d))return a;for(b=0;b<this.privateKeys.length;b++)for(c=0;c<this.privateKeys[b].obj.userIds.length;c++)0<=
this.privateKeys[b].obj.userIds[c].text.toLowerCase().indexOf(d)&&(a[a.length]=this.privateKeys[b]);return a};this.getPublicKeysForKeyId=function(b){for(var a=[],c=0;c<this.publicKeys.length;c++){var d=this.publicKeys[c];if(b==d.obj.getKeyId())a[a.length]=d;else if(null!=d.obj.subKeys)for(var e=0;e<d.obj.subKeys.length;e++){var f=d.obj.subKeys[e];b==f.getKeyId()&&(a[a.length]={obj:d.obj.getSubKeyAsKey(e),keyId:f.getKeyId()})}}return a};this.getPrivateKeyForKeyId=function(b){for(var a=[],c=0;c<this.privateKeys.length;c++)if(b==
this.privateKeys[c].obj.getKeyId()&&(a[a.length]={key:this.privateKeys[c],keymaterial:this.privateKeys[c].obj.privateKeyPacket}),null!=this.privateKeys[c].obj.subKeys)for(var d=this.privateKeys[c].obj.getSubKeyIds(),e=0;e<d.length;e++)b==util.hexstrdump(d[e])&&(a[a.length]={key:this.privateKeys[c],keymaterial:this.privateKeys[c].obj.subKeys[e]});return a};this.importPublicKey=function(b){for(var a=openpgp.read_publicKey(b),c=0;c<a.length;c++)this.publicKeys[this.publicKeys.length]={armored:b,obj:a[c],
keyId:a[c].getKeyId()};return!0};this.importPrivateKey=function(b,a){var c=openpgp.read_privateKey(b);if(!c[0].decryptSecretMPIs(a))return!1;for(var d=0;d<c.length;d++)this.privateKeys[this.privateKeys.length]={armored:b,obj:c[d],keyId:c[d].getKeyId()};return!0};this.exportPublicKey=function(b){return this.publicKey[b]};this.removePublicKey=function(b){b=this.publicKeys.splice(b,1);this.store();return b};this.exportPrivateKey=function(b){return this.privateKeys[b]};this.removePrivateKey=function(b){b=
this.privateKeys.splice(b,1);this.store();return b}}
function openpgp_msg_message(){this.text="";this.type=this.messagePacket=null;this.decrypt=function(b,a){return this.decryptAndVerifySignature(b,a).text};this.decryptAndVerifySignature=function(b,a,c){if(null==b||null==a||""==a)return null;a=a.decrypt(this,b.keymaterial);if(null==a)return null;b=[];util.print_debug_hexstr_dump("openpgp.msg.messge decrypt:\n",a);var a=openpgp.read_messages_dearmored({text:a,openpgp:a}),d;for(d in a){if(a[d].data)this.text=a[d].data;a[d].signature&&b.push(a[d].verifySignature(c))}return{text:this.text,
validSignatures:b}};this.verifySignature=function(b){var a=!1;if(2==this.signature.tagType){if(!b||0==b.length)if(4==this.signature.version)b=openpgp.keyring.getPublicKeysForKeyId(this.signature.issuerKeyId);else if(3==this.signature.version)b=openpgp.keyring.getPublicKeysForKeyId(this.signature.keyId);else return util.print_error("unknown signature type on message!"),!1;if(0==b.length)util.print_warning("Unable to verify signature of issuer: "+util.hexstrdump(this.signature.issuerKeyId)+". Public key not found in keyring.");
else for(var c=0;c<b.length;c++)this.signature.verify(this.text.replace(/\r\n/g,"\n").replace(/\n/g,"\r\n"),b[c])?(util.print_info("Found Good Signature from "+b[c].obj.userIds[0].text+" (0x"+util.hexstrdump(b[c].obj.getKeyId()).substring(8)+")"),a=!0):util.print_error("Signature verification failed: Bad Signature from "+b[c].obj.userIds[0].text+" (0x"+util.hexstrdump(b[0].obj.getKeyId()).substring(8)+")")}return a};this.toString=function(){var b="Session Keys:\n";if(null!=this.sessionKeys)for(var a=
0;a<this.sessionKeys.length;a++)b+=this.sessionKeys[a].toString();b+="\n\n EncryptedData:\n";null!=this.encryptedData&&(b+=this.encryptedData.toString());b+="\n\n Signature:\n";null!=this.signature&&(b+=this.signature.toString());b+="\n\n Text:\n";null!=this.signature&&(b+=this.text);return b}}
function openpgp_msg_privatekey(){this.subKeys=[];this.privateKeyPacket=null;this.userIds=[];this.userAttributes=[];this.revocationSignatures=[];this.subKeys=[];this.extractPublicKey=function(){for(var b=this.privateKeyPacket.publicKey.header+this.privateKeyPacket.publicKey.data,a=0;a<this.userIds.length;a++){if(0===this.userIds[a].certificationSignatures.length)return util.print_error("extractPublicKey - missing certification signatures"),null;for(var c=new openpgp_packet_userid,b=b+c.write_packet(this.userIds[a].text),
c=0;c<this.userIds[a].certificationSignatures.length;c++)var d=this.userIds[a].certificationSignatures[c],b=b+(openpgp_packet.write_packet_header(2,d.data.length)+d.data)}for(a=0;a<this.subKeys.length;a++)if(c=this.subKeys[a].publicKey,b+=openpgp_packet.write_old_packet_header(14,c.data.length)+c.data,c=this.subKeys[a].subKeySignature,null!==c)b+=openpgp_packet.write_packet_header(2,c.data.length)+c.data;else return util.print_error("extractPublicKey - missing subkey signature"),null;return openpgp_encoding_armor(4,
b)};this.getSigningKey=function(){if((17==this.privateKeyPacket.publicKey.publicKeyAlgorithm||2!=this.privateKeyPacket.publicKey.publicKeyAlgorithm)&&3==this.privateKeyPacket.publicKey.verifyKey())return this.privateKeyPacket;if(4==this.privateKeyPacket.publicKey.version)for(var b=0;b<this.privateKeyPacket.subKeys.length;b++)if((17==this.privateKeyPacket.subKeys[b].publicKey.publicKeyAlgorithm||2!=this.privateKeyPacket.subKeys[b].publicKey.publicKeyAlgorithm)&&3==this.privateKeyPacket.subKeys[b].publicKey.verifyKey())return this.privateKeyPacket.subKeys[b];
return null};this.getFingerprint=function(){return this.privateKeyPacket.publicKey.getFingerprint()};this.getPreferredSignatureHashAlgorithm=function(){var b=this.getSigningKey();return null==b?(util.print_error("private key is for encryption only! Cannot create a signature."),null):17==b.publicKey.publicKeyAlgorithm?(new DSA).select_hash_algorithm(b.publicKey.MPIs[1].toBigInteger()):openpgp.config.config.prefer_hash_algorithm};this.read_nodes=function(b,a,c,d){this.privateKeyPacket=b;for(b=c;a.length>
b;){var e=openpgp_packet.read_packet(a,b,a.length-b);if(null==e){util.print_error("openpgp.msg.messge decrypt:\n[pub/priv_key]parsing ends here @:"+b+" l:"+d);break}else switch(e.tagType){case 2:if(32==e.signatureType)this.revocationSignatures[this.revocationSignatures.length]=e;else if(15<e.signatureType&&20>e.signatureType){if(null==this.certificationsignatures)this.certificationSignatures=[];this.certificationSignatures[this.certificationSignatures.length]=e}else util.print_error("openpgp.msg.messge decrypt:\nunknown signature type directly on key "+
e.signatureType+" @"+b);b+=e.packetLength+e.headerLength;break;case 7:this.subKeys[this.subKeys.length]=e;b+=e.packetLength+e.headerLength;b+=e.read_nodes(this.privateKeyPacket,a,b,a.length-b);break;case 17:this.userAttributes[this.userAttributes.length]=e;b+=e.packetLength+e.headerLength;b+=e.read_nodes(this.privateKeyPacket,a,b,a.length-b);break;case 13:this.userIds[this.userIds.length]=e;b+=e.packetLength+e.headerLength;b+=e.read_nodes(this.privateKeyPacket,a,b,a.length-b);break;default:return this.position=
c-this.privateKeyPacket.packetLength-this.privateKeyPacket.headerLength,this.len=b-c}}this.position=c-this.privateKeyPacket.packetLength-this.privateKeyPacket.headerLength;return this.len=b-c};this.decryptSecretMPIs=function(b){return this.privateKeyPacket.decryptSecretMPIs(b)};this.getSubKeyIds=function(){if(4==this.privateKeyPacket.publicKey.version)var b=[];for(var a=0;a<this.subKeys.length;a++)b[a]=str_sha1(this.subKeys[a].publicKey.header+this.subKeys[a].publicKey.data).substring(12,20);return b};
this.getKeyId=function(){return this.privateKeyPacket.publicKey.getKeyId()}}
function openpgp_msg_publickey(){this.tostring="OPENPGP PUBLIC KEY\n";this.publicKeyPacket=this.bindingSignature=null;this.userIds=[];this.userAttributes=[];this.revocationSignatures=[];this.subKeys=[];this.arbitraryPacket=[];this.directSignatures=[];this.verifyCertificationSignatures=function(){for(var b=[],a=0;a<this.userIds.length;a++)b[a]=this.userIds[a].verifyCertificationSignatures(this.publicKeyPacket);return b};this.getEncryptionKey=function(){for(var b=0;b<this.subKeys.length;b++)if(17!=
this.subKeys[b].publicKeyAlgorithm&&3!=this.subKeys[b].publicKeyAlgorithm&&this.subKeys[b].verifyKey())return this.subKeys[b];return 17!=this.publicKeyPacket.publicKeyAlgorithm&&3!=this.publicKeyPacket.publicKeyAlgorithm&&this.publicKeyPacket.verifyKey()?this.publicKeyPacket:null};this.getSigningKey=function(){if(17==this.publicKeyPacket.publicKeyAlgorithm||2!=this.publicKeyPacket.publicKeyAlgorithm)return this.publicKeyPacket;if(4==this.publicKeyPacket.version)for(var b=0;b<this.subKeys.length;b++)if((17==
this.subKeys[b].publicKeyAlgorithm||2!=this.subKeys[b].publicKeyAlgorithm)&&this.subKeys[b].verifyKey())return this.subKeys[b];return null};this.read_nodes=function(b,a,c,d){this.publicKeyPacket=b;for(b=c;a.length!=b;){var e=openpgp_packet.read_packet(a,b,a.length-b);if(null==e){util.print_error("openpgp.msg.publickey read_nodes:\n[pub_key]parsing ends here @:"+b+" l:"+d);break}else switch(e.tagType){case 2:32==e.signatureType?this.revocationSignatures[this.revocationSignatures.length]=e:16==e.signatureType||
17==e.signatureType||18==e.signatureType||19==e.signatureType?this.certificationSignature=e:25==e.signatureType?this.bindingSignature=e:31==e.signatureType?this.directSignatures[this.directSignatures.length]=e:util.print_error("openpgp.msg.publickey read_nodes:\nunknown signature type directly on key "+e.signatureType);b+=e.packetLength+e.headerLength;break;case 14:this.subKeys[this.subKeys.length]=e;b+=e.packetLength+e.headerLength;b+=e.read_nodes(this.publicKeyPacket,a,b,a.length-b);break;case 17:this.userAttributes[this.userAttributes.length]=
e;b+=e.packetLength+e.headerLength;b+=e.read_nodes(this.publicKeyPacket,a,b,a.length-b);break;case 13:this.userIds[this.userIds.length]=e;b+=e.packetLength+e.headerLength;b+=e.read_nodes(this.publicKeyPacket,a,b,a.length-b);break;default:return this.data=a,this.position=c-this.publicKeyPacket.packetLength-this.publicKeyPacket.headerLength,this.len=b-c}}this.data=a;this.position=c-(this.publicKeyPacket.packetLength-this.publicKeyPacket.headerLength);return this.len=b-c};this.write=function(){};this.toString=
function(){for(var b=" OPENPGP Public Key\n length: "+this.len+"\n",b=b+" Revocation Signatures:\n",a=0;a<this.revocationSignatures.length;a++)b+=" "+this.revocationSignatures[a].toString();b+=" User Ids:\n";for(a=0;a<this.userIds.length;a++)b+=" "+this.userIds[a].toString();b+=" User Attributes:\n";for(a=0;a<this.userAttributes.length;a++)b+=" "+this.userAttributes[a].toString();b+=" Public Key SubKeys:\n";for(a=0;a<this.subKeys.length;a++)b+=" "+this.subKeys[a].toString();
return b};this.validate=function(){for(var b=0;b<this.revocationSignatures.length;b++)if(this.revocationSignatures[b].verify(this.publicKeyPacket.header+this.publicKeyPacket.data,this.publicKeyPacket))return!1;if(0!=this.subKeys.length){for(var a=!1,b=0;b<this.subKeys.length;b++)if(3==this.subKeys[b].verifyKey()){a=!0;break}if(!a)return!1}a=!1;for(b=0;b<this.userIds.length;b++)if(0==this.userIds[b].verify(this.publicKeyPacket)){a=!0;break}return!a?!1:!0};this.getFingerprint=function(){return this.publicKeyPacket.getFingerprint()};
this.getKeyId=function(){return this.publicKeyPacket.getKeyId()};this.verifyBasicSignatures=function(){for(var b=0;b<this.revocationSignatures.length;b++)if(this.revocationSignatures[b].verify(this.publicKeyPacket.header+this.publicKeyPacket.data,this.publicKeyPacket))return!1;if(0!=this.subKeys.length){for(var a=!1,b=0;b<this.subKeys.length;b++)if(null!=this.subKeys[b]&&3==this.subKeys[b].verifyKey()){a=!0;break}if(!a)return!1}a=this.getKeyId();for(b=0;b<this.userIds.length;b++)for(var c=0;c<this.userIds[b].certificationRevocationSignatures.length;c++)if(this.userIds[b].certificationSignatures[c].getIssuer==
a&&4!=this.userIds[b].certificationSignatures[c].verifyBasic(this.publicKeyPacket))return!1;return!0};this.getSubKeyAsKey=function(b){var a=new openpgp_msg_publickey;a.userIds=this.userIds;a.userAttributes=this.userAttributes;a.publicKeyPacket=this.subKeys[b];return a}}
function openpgp_packet_compressed(){this.tagType=8;this.decompressedData=null;this.read_packet=function(b,a,c){this.packetLength=c;var d=a;this.type=b.charCodeAt(d++);this.compressedData=b.substring(a+1,a+c);return this};this.toString=function(){return"5.6. Compressed Data Packet (Tag 8)\n length: "+this.packetLength+"\n Compression Algorithm = "+this.type+"\n Compressed Data: Byte ["+util.hexstrdump(this.compressedData)+"]\n"};this.compress=function(b,a){this.type=b;this.decompressedData=
a;switch(this.type){case 0:this.compressedData=this.decompressedData;break;case 1:util.print_error("Compression algorithm ZIP [RFC1951] is not implemented.");break;case 2:util.print_error("Compression algorithm ZLIB [RFC1950] is not implemented.");break;case 3:util.print_error("Compression algorithm BZip2 [BZ2] is not implemented.");break;default:util.print_error("Compression algorithm unknown :"+this.type)}this.packetLength=this.compressedData.length+1;return this.compressedData};this.decompress=
function(){if(null!=this.decompressedData)return this.decompressedData;if(null==this.type)return null;switch(this.type){case 0:this.decompressedData=this.compressedData;break;case 1:util.print_info("Decompressed packet [Type 1-ZIP]: "+this.toString());var b=this.compressedData,b=s2r(b).replace(/\n/g,""),b=new JXG.Util.Unzip(JXG.Util.Base64.decodeAsArray(b));this.decompressedData=unescape(b.deflate()[0][0]);break;case 2:util.print_info("Decompressed packet [Type 2-ZLIB]: "+this.toString());if(8==this.compressedData.charCodeAt(0)%
16){b=this.compressedData.substring(0,this.compressedData.length-4);b=s2r(b).replace(/\n/g,"");this.decompressedData=JXG.decompress(b);break}else util.print_error("Compression algorithm ZLIB only supports DEFLATE compression method.");break;case 3:util.print_error("Compression algorithm BZip2 [BZ2] is not implemented.");break;default:util.print_error("Compression algorithm unknown :"+this.type)}util.print_debug("decompressed:"+util.hexstrdump(this.decompressedData));return this.decompressedData};
this.write_packet=function(b,a){this.decompressedData=a;if(null==b)this.type=1;var c=String.fromCharCode(this.type)+this.compress(this.type);return openpgp_packet.write_packet_header(8,c.length)+c}}
function openpgp_packet_encrypteddata(){this.tagType=9;this.decryptedData=this.encryptedData=this.packetLength=null;this.decrypt_sym=function(b,a){this.decryptedData=openpgp_crypto_symmetricDecrypt(b,a,this.encryptedData,!0);util.print_debug("openpgp.packet.encryptedintegrityprotecteddata.js\ndata: "+util.hexstrdump(this.decryptedData));return this.decryptedData};this.toString=function(){return"5.7. Symmetrically Encrypted Data Packet (Tag 9)\n length: "+this.packetLength+"\n Used symmetric algorithm: "+
this.algorithmType+"\n encrypted data: Bytes ["+util.hexstrdump(this.encryptedData)+"]\n"};this.read_packet=function(b,a,c){this.packetLength=c;this.encryptedData=b.substring(a,a+c);return this};this.write_packet=function(b,a,c){b=""+openpgp_crypto_symmetricEncrypt(openpgp_crypto_getPrefixRandom(b),b,a,c,!0);return b=openpgp_packet.write_packet_header(9,b.length)+b}}
function openpgp_packet_encryptedintegrityprotecteddata(){this.tagType=18;this.hash=this.decrytpedData=this.encryptedData=this.packetLength=this.version=null;this.write_packet=function(b,a,c){var d=openpgp_crypto_getPrefixRandom(b),e=d+d.charAt(d.length-2)+d.charAt(d.length-1),c=c+String.fromCharCode(211),c=c+String.fromCharCode(20);util.print_debug_hexstr_dump("data to be hashed:",e+c);c+=str_sha1(e+c);util.print_debug_hexstr_dump("hash:",c.substring(c.length-20,c.length));b=openpgp_crypto_symmetricEncrypt(d,
b,a,c,!1).substring(0,e.length+c.length);a=openpgp_packet.write_packet_header(18,b.length+1)+String.fromCharCode(1);this.encryptedData=b;return a+b};this.read_packet=function(b,a,c){this.packetLength=c;this.version=b[a].charCodeAt();if(1!=this.version)return util.print_error("openpgp.packet.encryptedintegrityprotecteddata.js\nunknown encrypted integrity protected data packet version: "+this.version+" , @ "+a+"hex:"+util.hexstrdump(b)),null;this.encryptedData=b.substring(a+1,a+1+c);util.print_debug("openpgp.packet.encryptedintegrityprotecteddata.js\n"+
this.toString());return this};this.toString=function(){var b="";openpgp.config.debug&&(b=" data: Bytes ["+util.hexstrdump(this.encryptedData)+"]");return"5.13. Sym. Encrypted Integrity Protected Data Packet (Tag 18)\n length: "+this.packetLength+"\n version: "+this.version+"\n"+b};this.decrypt=function(b,a){this.decryptedData=openpgp_crypto_symmetricDecrypt(b,a,this.encryptedData,!1);this.hash=str_sha1(openpgp_crypto_MDCSystemBytes(b,a,this.encryptedData)+this.decryptedData.substring(0,
this.decryptedData.length-20));util.print_debug_hexstr_dump("calc hash = ",this.hash);if(this.hash==this.decryptedData.substring(this.decryptedData.length-20,this.decryptedData.length))return this.decryptedData;util.print_error("Decryption stopped: discovered a modification of encrypted data.");return null}}
function openpgp_packet_encryptedsessionkey(){this.read_pub_key_packet=function(b,a,c){this.tagType=1;this.packetLength=c;var d=a;if(10>c)return util.print_error("openpgp.packet.encryptedsessionkey.js\ninvalid length"),null;this.version=b[d++].charCodeAt();this.keyId=new openpgp_type_keyid;this.keyId.read_packet(b,d);d+=8;this.publicKeyAlgorithmUsed=b[d++].charCodeAt();switch(this.publicKeyAlgorithmUsed){case 1:case 2:this.MPIs=[];this.MPIs[0]=new openpgp_type_mpi;this.MPIs[0].read(b,d,d-a);break;
case 16:this.MPIs=[];this.MPIs[0]=new openpgp_type_mpi;this.MPIs[0].read(b,d,d-a);d+=this.MPIs[0].packetLength;this.MPIs[1]=new openpgp_type_mpi;this.MPIs[1].read(b,d,d-a);break;default:util.print_error("openpgp.packet.encryptedsessionkey.js\nunknown public key packet algorithm type "+this.publicKeyAlgorithmType)}return this};this.read_symmetric_key_packet=function(b,a,c){this.tagType=3;var d=a;this.version=b[d++];this.symmetricKeyAlgorithmUsed=b[d++];this.s2k=new openpgp_type_s2k;this.s2k.read(b,
d);if(s2k.s2kLength+d<c){this.encryptedSessionKey=[];for(a=d-a;a<c;a++)this.encryptedSessionKey[a]=b[d++]}return this};this.write_pub_key_packet=function(b,a,c,d,e){for(var f=String.fromCharCode(3),d=String.fromCharCode(d),d=d+e,e=util.calc_checksum(e),d=d+String.fromCharCode(e>>8&255),d=d+String.fromCharCode(e&255),f=f+b+String.fromCharCode(c),b=new openpgp_type_mpi,a=openpgp_crypto_asymetricEncrypt(c,a,b.create(openpgp_encoding_eme_pkcs1_encode(d,a[0].mpiByteLength))),c=0;c<a.length;c++)f+=a[c];
return f=openpgp_packet.write_packet_header(1,f.length)+f};this.toString=function(){if(1==this.tagType){for(var b="5.1. Public-Key Encrypted Session Key Packets (Tag 1)\n KeyId: "+this.keyId.toString()+"\n length: "+this.packetLength+"\n version:"+this.version+"\n pubAlgUs:"+this.publicKeyAlgorithmUsed+"\n",a=0;a<this.MPIs.length;a++)b+=this.MPIs[a].toString();return b}return"5.3 Symmetric-Key Encrypted Session Key Packets (Tag 3)\n KeyId: "+this.keyId.toString()+"\n length: "+
this.packetLength+"\n version:"+this.version+"\n symKeyA:"+this.symmetricKeyAlgorithmUsed+"\n s2k: "+this.s2k+"\n"};this.decrypt=function(b,a){if(1==this.tagType){var c=openpgp_crypto_asymetricDecrypt(this.publicKeyAlgorithmUsed,a.publicKey.MPIs,a.secMPIs,this.MPIs).toMPI();c.charCodeAt(c.length-2);c.charCodeAt(c.length-1);var d=openpgp_encoding_eme_pkcs1_decode(c.substring(2,c.length-2),a.publicKey.MPIs[0].getByteLength()),c=d.substring(1),d=d.charCodeAt(0);return 18==b.encryptedData.tagType?
b.encryptedData.decrypt(d,c):b.encryptedData.decrypt_sym(d,c)}if(3==this.tagType)return util.print_error("Symmetric encrypted sessionkey is not supported!"),null}}
function _openpgp_packet(){function b(a){result="";192>a?result+=String.fromCharCode(a):191<a&&8384>a?(result+=String.fromCharCode((a-192>>8)+192),result+=String.fromCharCode(a-192&255)):(result+=String.fromCharCode(255),result+=String.fromCharCode(a>>24&255),result+=String.fromCharCode(a>>16&255),result+=String.fromCharCode(a>>8&255),result+=String.fromCharCode(a&255));return result}this.encode_length=b;this.write_old_packet_header=function(a,b){var d="";256>b?(d+=String.fromCharCode(128|a<<2),d+=
String.fromCharCode(b)):(65536>b?(d+=String.fromCharCode(a<<2|129),d+=String.fromCharCode(b>>8)):(d+=String.fromCharCode(a<<2|130),d+=String.fromCharCode(b>>24&255),d+=String.fromCharCode(b>>16&255),d+=String.fromCharCode(b>>8&255)),d+=String.fromCharCode(b&255));return d};this.write_packet_header=function(a,c){var d;d=""+String.fromCharCode(192|a);return d+=b(c)};this.read_packet=function(a,b,d){if(null==a||a.length<=b||2>a.substring(b).length||0==(a[b].charCodeAt()&128))return util.print_error("Error during parsing. This message / key is probably not containing a valid OpenPGP format."),
null;var e=b,f=-1,g=-1,g=0;0!=(a[e].charCodeAt()&64)&&(g=1);var h;g?f=a[e].charCodeAt()&63:(f=(a[e].charCodeAt()&63)>>2,h=a[e].charCodeAt()&3);e++;var j=null,k=-1;if(g)if(192>a[e].charCodeAt())packet_length=a[e++].charCodeAt(),util.print_debug("1 byte length:"+packet_length);else if(192<=a[e].charCodeAt()&&224>a[e].charCodeAt())packet_length=(a[e++].charCodeAt()-192<<8)+a[e++].charCodeAt()+192,util.print_debug("2 byte length:"+packet_length);else if(223<a[e].charCodeAt()&&255>a[e].charCodeAt()){packet_length=
1<<(a[e++].charCodeAt()&31);util.print_debug("4 byte length:"+packet_length);k=e+packet_length;for(j=a.substring(e,e+packet_length);;)if(192>a[k].charCodeAt()){d=a[k++].charCodeAt();packet_length+=d;j+=a.substring(k,k+d);k+=d;break}else if(192<=a[k].charCodeAt()&&224>a[k].charCodeAt()){d=(a[k++].charCodeAt()-192<<8)+a[k++].charCodeAt()+192;packet_length+=d;j+=a.substring(k,k+d);k+=d;break}else if(223<a[k].charCodeAt()&&255>a[k].charCodeAt())d=1<<(a[k++].charCodeAt()&31),packet_length+=d,j+=a.substring(k,
k+d),k+=d;else{k++;d=a[k++].charCodeAt()<<24|a[k++].charCodeAt()<<16|a[k++].charCodeAt()<<8|a[k++].charCodeAt();j+=a.substring(k,k+d);packet_length+=d;k+=d;break}}else e++,packet_length=a[e++].charCodeAt()<<24|a[e++].charCodeAt()<<16|a[e++].charCodeAt()<<8|a[e++].charCodeAt();else switch(h){case 0:packet_length=a[e++].charCodeAt();break;case 1:packet_length=a[e++].charCodeAt()<<8|a[e++].charCodeAt();break;case 2:packet_length=a[e++].charCodeAt()<<24|a[e++].charCodeAt()<<16|a[e++].charCodeAt()<<8|
a[e++].charCodeAt();break;default:packet_length=d}-1==k&&(k=packet_length);null==j&&(j=a.substring(e,e+k));switch(f){case 0:break;case 1:f=new openpgp_packet_encryptedsessionkey;if(null!=f.read_pub_key_packet(j,0,packet_length))return f.headerLength=e-b,f.packetLength=k,f;break;case 2:f=new openpgp_packet_signature;if(null!=f.read_packet(j,0,packet_length))return f.headerLength=e-b,f.packetLength=k,f;break;case 3:f=new openpgp_packet_encryptedsessionkey;if(null!=f.read_symmetric_key_packet(j,0,packet_length))return f.headerLength=
e-b,f.packetLength=k,f;break;case 4:f=new openpgp_packet_onepasssignature;if(f.read_packet(j,0,packet_length))return f.headerLength=e-b,f.packetLength=k,f;break;case 5:f=new openpgp_packet_keymaterial;f.header=a.substring(b,e);if(null!=f.read_tag5(j,0,packet_length))return f.headerLength=e-b,f.packetLength=k,f;break;case 6:f=new openpgp_packet_keymaterial;f.header=a.substring(b,e);if(null!=f.read_tag6(j,0,packet_length))return f.headerLength=e-b,f.packetLength=k,f;break;case 7:f=new openpgp_packet_keymaterial;
if(null!=f.read_tag7(j,0,packet_length))return f.headerLength=e-b,f.packetLength=k,f;break;case 8:f=new openpgp_packet_compressed;if(null!=f.read_packet(j,0,packet_length))return f.headerLength=e-b,f.packetLength=k,f;break;case 9:f=new openpgp_packet_encrypteddata;if(null!=f.read_packet(j,0,packet_length))return f.headerLength=e-b,f.packetLength=k,f;break;case 10:f=new openpgp_packet_marker;if(null!=f.read_packet(j,0,packet_length))return f.headerLength=e-b,f.packetLength=k,f;break;case 11:f=new openpgp_packet_literaldata;
if(null!=f.read_packet(j,0,packet_length))return f.headerLength=e-b,f.header=a.substring(b,e),f.packetLength=k,f;break;case 12:break;case 13:f=new openpgp_packet_userid;if(null!=f.read_packet(j,0,packet_length))return f.headerLength=e-b,f.packetLength=k,f;break;case 14:f=new openpgp_packet_keymaterial;f.header=a.substring(b,e);if(null!=f.read_tag14(j,0,packet_length))return f.headerLength=e-b,f.packetLength=k,f;break;case 17:f=new openpgp_packet_userattribute;if(null!=f.read_packet(j,0,packet_length))return f.headerLength=
e-b,f.packetLength=k,f;break;case 18:f=new openpgp_packet_encryptedintegrityprotecteddata;if(null!=f.read_packet(j,0,packet_length))return f.headerLength=e-b,f.packetLength=k,f;break;case 19:f=new openpgp_packet_modificationdetectioncode;if(null!=f.read_packet(j,0,packet_length))return f.headerLength=e-b,f.packetLength=k,f;break;default:return util.print_error("openpgp.packet.js\n[ERROR] openpgp_packet: failed to parse packet @:"+e+"\nchar:'"+util.hexstrdump(a.substring(e))+"'\ninput:"+util.hexstrdump(a)),
null}}}var openpgp_packet=new _openpgp_packet;
function openpgp_packet_keymaterial(){this.subKeyRevocationSignature=this.subKeySignature=this.parentNode=this.checksum=this.hasUnencryptedSecretKeyData=this.encryptedMPIData=this.IVLength=this.s2kUsageConventions=this.symmetricEncryptionAlgorithm=this.publicKey=this.secMPIs=this.MPIs=this.expiration=this.version=this.creationTime=this.tagType=this.publicKeyAlgorithm=null;this.read_tag5=function(b,a,c){this.tagType=5;this.read_priv_key(b,a,c);return this};this.read_tag6=function(b,a,c){this.tagType=
6;this.packetLength=c;this.read_pub_key(b,a,c);return this};this.read_tag7=function(b,a,c){this.tagType=7;this.packetLength=c;return this.read_priv_key(b,a,c)};this.read_tag14=function(b,a,c){this.subKeySignature=null;this.subKeyRevocationSignature=[];this.tagType=14;this.packetLength=c;this.read_pub_key(b,a,c);return this};this.toString=function(){var b="";switch(this.tagType){case 6:b+="5.5.1.1. Public-Key Packet (Tag 6)\n length: "+this.packetLength+"\n version: "+
this.version+"\n creation time: "+this.creationTime+"\n expiration time: "+this.expiration+"\n publicKeyAlgorithm: "+this.publicKeyAlgorithm+"\n";break;case 14:b+="5.5.1.2. Public-Subkey Packet (Tag 14)\n length: "+this.packetLength+"\n version: "+this.version+"\n creation time: "+this.creationTime+"\n expiration time: "+this.expiration+"\n publicKeyAlgorithm: "+this.publicKeyAlgorithm+"\n";break;case 5:b+="5.5.1.3. Secret-Key Packet (Tag 5)\n length: "+
this.packetLength+"\n version: "+this.publicKey.version+"\n creation time: "+this.publicKey.creationTime+"\n expiration time: "+this.publicKey.expiration+"\n publicKeyAlgorithm: "+this.publicKey.publicKeyAlgorithm+"\n";break;case 7:b+="5.5.1.4. Secret-Subkey Packet (Tag 7)\n length: "+this.packetLength+"\n version[1]: "+(4==this.version)+"\n creationtime[4]: "+this.creationTime+"\n expiration[2]: "+this.expiration+"\n publicKeyAlgorithm: "+
this.publicKeyAlgorithm+"\n";break;default:b+="unknown key material packet\n"}if(null!=this.MPIs)for(var b=b+"Public Key MPIs:\n",a=0;a<this.MPIs.length;a++)b+=this.MPIs[a].toString();if(null!=this.publicKey&&null!=this.publicKey.MPIs){b+="Public Key MPIs:\n";for(a=0;a<this.publicKey.MPIs.length;a++)b+=this.publicKey.MPIs[a].toString()}if(null!=this.secMPIs){b+="Secret Key MPIs:\n";for(a=0;a<this.secMPIs.length;a++)b+=this.secMPIs[a].toString()}null!=this.subKeySignature&&(b+="subKey Signature:\n"+
this.subKeySignature.toString());null!=this.subKeyRevocationSignature&&(b+="subKey Revocation Signature:\n"+this.subKeyRevocationSignature.toString());return b};this.read_pub_key=function(b,a){var c=a;this.version=b[c++].charCodeAt();if(3==this.version){this.creationTime=new Date(1E3*(b[c++].charCodeAt()<<24|b[c++].charCodeAt()<<16|b[c++].charCodeAt()<<8|b[c++].charCodeAt()));this.expiration=b[c++].charCodeAt()<<8&b[c++].charCodeAt();this.publicKeyAlgorithm=b[c++].charCodeAt();var d=0;0<this.publicKeyAlgorithm&&
4>this.publicKeyAlgorithm?d=2:16==this.publicKeyAlgorithm?d=3:17==this.publicKeyAlgorithm&&(d=4);this.MPIs=[];for(var e=0;e<d;e++)this.MPIs[e]=new openpgp_type_mpi,null!=this.MPIs[e].read(b,c,c-a)&&!this.packetLength<c-a?c+=this.MPIs[e].packetLength:util.print_error("openpgp.packet.keymaterial.js\nerror reading MPI @:"+c);this.packetLength=c-a}else if(4==this.version){this.creationTime=new Date(1E3*(b[c++].charCodeAt()<<24|b[c++].charCodeAt()<<16|b[c++].charCodeAt()<<8|b[c++].charCodeAt()));this.publicKeyAlgorithm=
b[c++].charCodeAt();d=0;0<this.publicKeyAlgorithm&&4>this.publicKeyAlgorithm?d=2:16==this.publicKeyAlgorithm?d=3:17==this.publicKeyAlgorithm&&(d=4);this.MPIs=[];for(e=0;e<d;e++)this.MPIs[e]=new openpgp_type_mpi,null!=this.MPIs[e].read(b,c,c-a)&&!this.packetLength<c-a?c+=this.MPIs[e].packetLength:util.print_error("openpgp.packet.keymaterial.js\nerror reading MPI @:"+c);this.packetLength=c-a}else return null;this.data=b.substring(a,c);this.packetdata=b.substring(a,c);return this};this.read_priv_key=
function(b,a,c){this.publicKey=new openpgp_packet_keymaterial;if(null==this.publicKey.read_pub_key(b,a,c))return util.print_error("openpgp.packet.keymaterial.js\nFailed reading public key portion of a private key: "+b[a].charCodeAt()+" "+a+" "+c+"\n Aborting here..."),null;this.publicKey.header=openpgp_packet.write_old_packet_header(6,this.publicKey.packetLength);var d=a+this.publicKey.data.length;this.packetLength=c;this.s2kUsageConventions=b[d++].charCodeAt();if(0==this.s2kUsageConventions)this.hasUnencryptedSecretKeyData=
!0;if(255==this.s2kUsageConventions||254==this.s2kUsageConventions)this.symmetricEncryptionAlgorithm=b[d++].charCodeAt();if(255==this.s2kUsageConventions||254==this.s2kUsageConventions)this.s2k=new openpgp_type_s2k,this.s2k.read(b,d),d+=this.s2k.s2kLength;this.symkeylength=0;if(0!=this.s2kUsageConventions&&255!=this.s2kUsageConventions&&254!=this.s2kUsageConventions)this.symmetricEncryptionAlgorithm=this.s2kUsageConventions;if(0!=this.s2kUsageConventions&&1001!=this.s2k.type){this.hasIV=!0;switch(this.symmetricEncryptionAlgorithm){case 1:return util.print_error("openpgp.packet.keymaterial.js\nsymmetric encrytryption algorithim: IDEA is not implemented"),
null;case 2:case 3:this.IVLength=8;break;case 4:case 7:case 8:case 9:this.IVLength=16;break;case 10:this.IVLength=32;break;default:return util.print_error("openpgp.packet.keymaterial.js\nunknown encryption algorithm for secret key :"+this.symmetricEncryptionAlgorithm),null}d++;this.IV=b.substring(d,d+this.IVLength);d+=this.IVLength}if(0!=this.s2kUsageConventions&&1001==this.s2k.type)this.encryptedMPIData=this.secMPIs=null;else if(this.hasUnencryptedSecretKeyData){if(0<this.publicKey.publicKeyAlgorithm&&
4>this.publicKey.publicKeyAlgorithm)this.secMPIs=[],this.secMPIs[0]=new openpgp_type_mpi,this.secMPIs[0].read(b,d,c-2-(d-a)),d+=this.secMPIs[0].packetLength,this.secMPIs[1]=new openpgp_type_mpi,this.secMPIs[1].read(b,d,c-2-(d-a)),d+=this.secMPIs[1].packetLength,this.secMPIs[2]=new openpgp_type_mpi,this.secMPIs[2].read(b,d,c-2-(d-a)),d+=this.secMPIs[2].packetLength,this.secMPIs[3]=new openpgp_type_mpi,this.secMPIs[3].read(b,d,c-2-(d-a)),d+=this.secMPIs[3].packetLength;else if(16==this.publicKey.publicKeyAlgorithm)this.secMPIs=
[],this.secMPIs[0]=new openpgp_type_mpi,this.secMPIs[0].read(b,d,c-2-(d-a)),d+=this.secMPIs[0].packetLength;else if(17==this.publicKey.publicKeyAlgorithm)this.secMPIs=[],this.secMPIs[0]=new openpgp_type_mpi,this.secMPIs[0].read(b,d,c-2-(d-a)),d+=this.secMPIs[0].packetLength;this.checksum=[];this.checksum[0]=b[d++].charCodeAt();this.checksum[1]=b[d++].charCodeAt()}else this.encryptedMPIData=b.substring(d,c);return this};this.decryptSecretMPIs=function(b){if(this.hasUnencryptedSecretKeyData)return this.secMPIs;
var a=this.s2k.produce_key(b),c="";switch(this.symmetricEncryptionAlgorithm){case 1:return util.print_error("openpgp.packet.keymaterial.js\nsymmetric encryption algorithim: IDEA is not implemented"),!1;case 2:c=normal_cfb_decrypt(function(a,b){return des(b,a,1,null,0)},this.IVLength,a,this.encryptedMPIData,this.IV);break;case 3:c=normal_cfb_decrypt(function(a,b){var c=new openpgp_symenc_cast5;c.setKey(b);return c.encrypt(util.str2bin(a))},this.IVLength,util.str2bin(a.substring(0,16)),this.encryptedMPIData,
this.IV);break;case 4:c=normal_cfb_decrypt(function(a,b){return(new Blowfish(b)).encrypt(a)},this.IVLength,a,this.encryptedMPIData,this.IV);break;case 7:case 8:case 9:c=16;8==this.symmetricEncryptionAlgorithm&&(c=24,a=this.s2k.produce_key(b,c));9==this.symmetricEncryptionAlgorithm&&(c=32,a=this.s2k.produce_key(b,c));c=normal_cfb_decrypt(function(a,b){return AESencrypt(util.str2bin(a),b)},this.IVLength,keyExpansion(a.substring(0,c)),this.encryptedMPIData,this.IV);break;case 10:return util.print_error("openpgp.packet.keymaterial.js\nKey material is encrypted with twofish: not implemented"),
!1;default:return util.print_error("openpgp.packet.keymaterial.js\nunknown encryption algorithm for secret key :"+this.symmetricEncryptionAlgorithm),!1}if(null==c)return util.print_error("openpgp.packet.keymaterial.js\ncleartextMPIs was null"),!1;b=c.length;if(254==this.s2kUsageConventions&&str_sha1(c.substring(0,c.length-20))==c.substring(c.length-20))b-=20;else if(254!=this.s2kUsageConventions&&util.calc_checksum(c.substring(0,c.length-2))==(c.charCodeAt(c.length-2)<<8|c.charCodeAt(c.length-1)))b-=
2;else return!1;if(0<this.publicKey.publicKeyAlgorithm&&4>this.publicKey.publicKeyAlgorithm)a=0,this.secMPIs=[],this.secMPIs[0]=new openpgp_type_mpi,this.secMPIs[0].read(c,0,b),a+=this.secMPIs[0].packetLength,this.secMPIs[1]=new openpgp_type_mpi,this.secMPIs[1].read(c,a,b-a),a+=this.secMPIs[1].packetLength,this.secMPIs[2]=new openpgp_type_mpi,this.secMPIs[2].read(c,a,b-a),a+=this.secMPIs[2].packetLength,this.secMPIs[3]=new openpgp_type_mpi,this.secMPIs[3].read(c,a,b-a),a+=this.secMPIs[3].packetLength;
else if(16==this.publicKey.publicKeyAlgorithm)this.secMPIs=[],this.secMPIs[0]=new openpgp_type_mpi,this.secMPIs[0].read(c,0,c);else if(17==this.publicKey.publicKeyAlgorithm)this.secMPIs=[],this.secMPIs[0]=new openpgp_type_mpi,this.secMPIs[0].read(c,0,b);return!0};this.read_nodes=function(b,a,c,d){this.parentNode=b;if(14==this.tagType){for(var b=c,e=null;a.length!=b;)if(d=a.length-b,e=openpgp_packet.read_packet(a,b,d),null==e){util.print_error("openpgp.packet.keymaterial.js\n[user_keymat_pub]parsing ends here @:"+
b+" l:"+d);break}else switch(e.tagType){case 2:if(24==e.signatureType){this.subKeySignature=e;b+=e.packetLength+e.headerLength;break}else if(40==e.signatureType){this.subKeyRevocationSignature[this.subKeyRevocationSignature.length]=e;b+=e.packetLength+e.headerLength;break}else util.print_error("openpgp.packet.keymaterial.js\nunknown signature:"+e.toString());default:return this.data=a,this.position=c-this.parentNode.packetLength,this.len=b-c}this.data=a;this.position=c-this.parentNode.packetLength;
return this.len=b-c}if(7==this.tagType){for(b=c;a.length!=b;)if(e=openpgp_packet.read_packet(a,b,d-(b-c)),null==e){util.print_error("openpgp.packet.keymaterial.js\n[user_keymat_priv] parsing ends here @:"+b);break}else switch(e.tagType){case 2:24==e.signatureType?this.subKeySignature=e:40==e.signatureType&&(this.subKeyRevocationSignature[this.subKeyRevocationSignature.length]=e);b+=e.packetLength+e.headerLength;break;default:return this.data=a,this.position=c-this.parentNode.packetLength,this.len=
b-c}this.data=a;this.position=c-this.parentNode.packetLength;return this.len=b-c}util.print_error("openpgp.packet.keymaterial.js\nunknown parent node for a key material packet "+b.tagType)};this.verifyKey=function(){if(14==this.tagType){if(null==this.subKeySignature)return 0;if(4==this.subKeySignature.version&&null!=this.subKeySignature.keyNeverExpires&&!this.subKeySignature.keyNeverExpires&&new Date(1E3*this.subKeySignature.keyExpirationTime+this.creationTime.getTime())<new Date)return 1;if(!this.subKeySignature.verify(String.fromCharCode(153)+
this.parentNode.header.substring(1)+this.parentNode.data+String.fromCharCode(153)+this.header.substring(1)+this.packetdata,this.parentNode))return 0;for(var b=0;b<this.subKeyRevocationSignature.length;b++)if(this.getKeyId()==this.subKeyRevocationSignature[b].keyId)return 2}return 3};this.getKeyId=function(){if(4==this.version)return this.getFingerprint().substring(12,20);if(3==this.version&&0<this.publicKeyAlgorithm&&4>this.publicKeyAlgorithm){var b=this.MPIs[0].substring(this.MPIs[0].mpiByteLength-
8);util.print_debug("openpgp.msg.publickey read_nodes:\nV3 key ID: "+b);return b}};this.getFingerprint=function(){if(4==this.version)return tohash=String.fromCharCode(153)+String.fromCharCode(this.packetdata.length>>8&255)+String.fromCharCode(this.packetdata.length&255)+this.packetdata,util.print_debug("openpgp.msg.publickey creating subkey fingerprint by hashing:"+util.hexstrdump(tohash)+"\npublickeyalgorithm: "+this.publicKeyAlgorithm),str_sha1(tohash,tohash.length);if(3==this.version&&0<this.publicKeyAlgorithm&&
4>this.publicKeyAlgorithm)return MD5(this.MPIs[0].MPI)};this.write_private_key=function(b,a,c,d,e,f){this.symmetricEncryptionAlgorithm=e;e=String.fromCharCode(4);e+=f;switch(b){case 1:e+=String.fromCharCode(b);e+=a.n.toMPI();e+=a.ee.toMPI();if(c)switch(e+=String.fromCharCode(254),e+=String.fromCharCode(this.symmetricEncryptionAlgorithm),e+=String.fromCharCode(3),e+=String.fromCharCode(d),b=a.d.toMPI()+a.p.toMPI()+a.q.toMPI()+a.u.toMPI(),a=str_sha1(b),util.print_debug_hexstr_dump("write_private_key sha1: ",
a),f=openpgp_crypto_getRandomBytes(8),util.print_debug_hexstr_dump("write_private_key Salt: ",f),e=e+f+String.fromCharCode(96),util.print_debug("write_private_key c: 96"),c=(new openpgp_type_s2k).write(3,d,c,f,96),this.symmetricEncryptionAlgorithm){case 3:this.IVLength=8;this.IV=openpgp_crypto_getRandomBytes(this.IVLength);ciphertextMPIs=normal_cfb_encrypt(function(a,b){var c=new openpgp_symenc_cast5;c.setKey(b);return c.encrypt(util.str2bin(a))},this.IVLength,util.str2bin(c.substring(0,16)),b+a,
this.IV);e+=this.IV+ciphertextMPIs;break;case 7:case 8:case 9:this.IVLength=16,this.IV=openpgp_crypto_getRandomBytes(this.IVLength),ciphertextMPIs=normal_cfb_encrypt(AESencrypt,this.IVLength,c,b+a,this.IV),e+=this.IV+ciphertextMPIs}else e+=String.fromCharCode(0),e+=a.d.toMPI()+a.p.toMPI()+a.q.toMPI()+a.u.toMPI(),c=util.calc_checksum(a.d.toMPI()+a.p.toMPI()+a.q.toMPI()+a.u.toMPI()),e+=String.fromCharCode(c/256)+String.fromCharCode(c%256),util.print_debug_hexstr_dump("write_private_key basic checksum: "+
c);break;default:e="",util.print_error("openpgp.packet.keymaterial.js\nerror writing private key, unknown type :"+b)}c=openpgp_packet.write_packet_header(5,e.length);return{string:c+e,header:c,body:e}};this.write_public_key=function(b,a,c){var d=String.fromCharCode(4),d=d+c;switch(b){case 1:d+=String.fromCharCode(1);d+=a.n.toMPI();d+=a.ee.toMPI();break;default:util.print_error("openpgp.packet.keymaterial.js\nerror writing private key, unknown type :"+b)}b=openpgp_packet.write_packet_header(6,d.length);
return{string:b+d,header:b,body:d}}}
function openpgp_packet_literaldata(){this.tagType=11;this.set_data=function(b,a){this.format=a;this.data=b};this.set_data_bytes=function(b,a){this.format=a;a==openpgp_packet_literaldata.formats.utf8&&(b=util.decode_utf8(b));this.data=b};this.get_data_bytes=function(){return this.format==openpgp_packet_literaldata.formats.utf8?util.encode_utf8(this.data):this.data};this.read_packet=function(b,a,c){this.packetLength=c;c=b[a];this.filename=util.decode_utf8(b.substr(a+2,b.charCodeAt(a+1)));this.date=
new Date(1E3*parseInt(b.substr(a+2+b.charCodeAt(a+1),4)));this.set_data_bytes(b.substring(a+6+b.charCodeAt(a+1)),c);return this};this.write_packet=function(b){this.set_data(b,openpgp_packet_literaldata.formats.utf8);this.filename=util.encode_utf8("msg.txt");this.date=new Date;var b=this.get_data_bytes(),a=openpgp_packet.write_packet_header(11,b.length+6+this.filename.length),a=a+this.format,a=a+String.fromCharCode(this.filename.length),a=a+this.filename,a=a+String.fromCharCode(Math.round(this.date.getTime()/
1E3)>>24&255),a=a+String.fromCharCode(Math.round(this.date.getTime()/1E3)>>16&255),a=a+String.fromCharCode(Math.round(this.date.getTime()/1E3)>>8&255),a=a+String.fromCharCode(Math.round(this.date.getTime()/1E3)&255);return a+b};this.toString=function(){return"5.9. Literal Data Packet (Tag 11)\n length: "+this.packetLength+"\n format: "+this.format+"\n filename:"+this.filename+"\n date: "+this.date+"\n data: |"+this.data+"|\n rdata: |"+this.real_data+"|\n"}}
openpgp_packet_literaldata.formats={binary:"b",text:"t",utf8:"u"};function openpgp_packet_marker(){this.tagType=10;this.read_packet=function(b,a){this.packetLength=3;return 80==b[a].charCodeAt()&&71==b[a+1].charCodeAt()&&80==b[a+2].charCodeAt()?this:null};this.toString=function(){return'5.8. Marker Packet (Obsolete Literal Packet) (Tag 10)\n packet reads: "PGP"\n'}}
function openpgp_packet_modificationdetectioncode(){this.tagType=19;this.hash=null;this.read_packet=function(b,a,c){this.packetLength=c;if(20!=c)return util.print_error("openpgp.packet.modificationdetectioncode.js\ninvalid length for a modification detection code packet!"+c),null;this.hash=b.substring(a,a+20);return this};this.toString=function(){return"5.14 Modification detection code packet\n bytes ("+this.hash.length+"): ["+util.hexstrdump(this.hash)+"]"}}
function openpgp_packet_onepasssignature(){this.tagType=4;this.flags=this.signingKeyId=this.publicKeyAlgorithm=this.hashAlgorithm=this.type=this.version=null;this.read_packet=function(b,a,c){this.packetLength=c;this.version=b.charCodeAt(a++);this.type=b.charCodeAt(a++);this.hashAlgorithm=b.charCodeAt(a++);this.publicKeyAlgorithm=b.charCodeAt(a++);this.signingKeyId=new openpgp_type_keyid;this.signingKeyId.read_packet(b,a);a+=8;this.flags=b.charCodeAt(a++);return this};this.toString=function(){return"5.4. One-Pass Signature Packets (Tag 4)\n length: "+
this.packetLength+"\n type: "+this.type+"\n keyID: "+this.signingKeyId.toString()+"\n hashA: "+this.hashAlgorithm+"\n pubKeyA:"+this.publicKeyAlgorithm+"\n flags: "+this.flags+"\n version:"+this.version+"\n"};this.write_packet=function(b,a,c,d,e){d=""+openpgp_packet.write_packet_header(4,13);d+=String.fromCharCode(3);d+=String.fromCharCode(b);d+=String.fromCharCode(a);d+=String.fromCharCode(c.privateKeyPacket.publicKey.publicKeyAlgorithm);d+=c.getKeyId();return d=e?d+String.fromCharCode(0):
d+String.fromCharCode(1)}}
function openpgp_packet_signature(){function b(a,b){var d;d=""+openpgp_packet.encode_length(b.length+1);d+=String.fromCharCode(a);return d+b}this.tagType=2;this.embeddedSignature=this.signatureTargetHash=this.signatureTargetHashAlgorithm=this.signatureTargetPublicKeyAlgorithm=this.reasonForRevocationString=this.reasonForRevocationFlag=this.signersUserId=this.keyFlags=this.policyURI=this.isPrimaryUserID=this.preferredKeyServer=this.keyServerPreferences=this.preferredCompressionAlgorithms=this.preferredHashAlgorithms=
this.notationValue=this.notationName=this.notationFlags=this.issuerKeyId=this.revocationKeyFingerprint=this.revocationKeyAlgorithm=this.revocationKeyClass=this.preferredSymmetricAlgorithms=this.keyNeverExpires=this.keyExpirationTime=this.revocable=this.regular_expression=this.trustAmount=this.trustLevel=this.exportable=this.hashAlgorithm=this.publicKeyAlgorithm=this.MPIs=this.signedHashValue=this.signatureNeverExpires=this.signatureExpirationTime=this.signatureData=this.keyId=this.creationTime=this.signatureType=
null;this.verified=!1;this._raw_read_signature_sub_packet=function(a,b,d){0>d&&util.print_debug("openpgp.packet.signature.js\n_raw_read_signature_sub_packet length < 0 @:"+b);var e=b,f=0;192>a[e].charCodeAt()?f=a[e++].charCodeAt():192<=a[e].charCodeAt()&&224>a[e].charCodeAt()?f=(a[e++].charCodeAt()-192<<8)+a[e++].charCodeAt()+192:223<a[e].charCodeAt()&&255>a[e].charCodeAt()?f=1<<(a[e++].charCodeAt()&31):255>a[e].charCodeAt()&&(e++,f=a[e++].charCodeAt()<<24|a[e++].charCodeAt()<<16|a[e++].charCodeAt()<<
8|a[e++].charCodeAt());var g=a[e++].charCodeAt()&127;switch(g){case 2:this.creationTime=new Date(1E3*(a[e++].charCodeAt()<<24|a[e++].charCodeAt()<<16|a[e++].charCodeAt()<<8|a[e++].charCodeAt()));break;case 3:this.signatureExpirationTime=a[e++].charCodeAt()<<24|a[e++].charCodeAt()<<16|a[e++].charCodeAt()<<8|a[e++].charCodeAt();this.signatureNeverExpires=0==this.signature_expiration_time;break;case 4:this.exportable=1==a[e++].charCodeAt();break;case 5:this.trustLevel=a[e++].charCodeAt();this.trustAmount=
a[e++].charCodeAt();break;case 6:this.regular_expression=new String;for(g=0;g<f-1;g++)this.regular_expression+=a[e++];break;case 7:this.revocable=1==a[e++].charCodeAt();break;case 9:this.keyExpirationTime=a[e++].charCodeAt()<<24|a[e++].charCodeAt()<<16|a[e++].charCodeAt()<<8|a[e++].charCodeAt();this.keyNeverExpires=0==this.keyExpirationTime;break;case 11:this.preferredSymmetricAlgorithms=[];for(g=0;g<f-1;g++)this.preferredSymmetricAlgorithms=a[e++].charCodeAt();break;case 12:this.revocationKeyClass=
a[e++].charCodeAt();this.revocationKeyAlgorithm=a[e++].charCodeAt();this.revocationKeyFingerprint=[];for(g=0;20>g;g++)this.revocationKeyFingerprint=a[e++].charCodeAt();break;case 16:this.issuerKeyId=a.substring(e,e+8);e+=8;break;case 20:this.notationFlags=a[e++].charCodeAt()<<24|a[e++].charCodeAt()<<16|a[e++].charCodeAt()<<8|a[e++].charCodeAt();d=a[e++].charCodeAt()<<8|a[e++].charCodeAt();f=a[e++].charCodeAt()<<8|a[e++].charCodeAt();this.notationName="";for(g=0;g<d;g++)this.notationName+=a[e++];this.notationValue=
"";for(g=0;g<f;g++)this.notationValue+=a[e++];break;case 21:this.preferredHashAlgorithms=[];for(g=0;g<f-1;g++)this.preferredHashAlgorithms=a[e++].charCodeAt();break;case 22:this.preferredCompressionAlgorithms=[];for(g=0;g<f-1;g++)this.preferredCompressionAlgorithms=a[e++].charCodeAt();break;case 23:this.keyServerPreferences=[];for(g=0;g<f-1;g++)this.keyServerPreferences=a[e++].charCodeAt();break;case 24:this.preferredKeyServer=new String;for(g=0;g<f-1;g++)this.preferredKeyServer+=a[e++];break;case 25:this.isPrimaryUserID=
0!=a[e++];break;case 26:this.policyURI=new String;for(g=0;g<f-1;g++)this.policyURI+=a[e++];break;case 27:this.keyFlags=[];for(g=0;g<f-1;g++)this.keyFlags=a[e++].charCodeAt();break;case 28:this.signersUserId=new String;for(g=0;g<f-1;g++)this.signersUserId+=a[e++];break;case 29:this.reasonForRevocationFlag=a[e++].charCodeAt();this.reasonForRevocationString=new String;for(g=0;g<f-2;g++)this.reasonForRevocationString+=a[e++];break;case 30:return f+1;case 31:this.signatureTargetPublicKeyAlgorithm=a[e++].charCodeAt();
this.signatureTargetHashAlgorithm=a[e++].charCodeAt();f=0;switch(this.signatureTargetHashAlgorithm){case 1:case 2:f=20;break;case 3:case 8:case 9:case 10:case 11:break;default:return util.print_error("openpgp.packet.signature.js\nunknown signature target hash algorithm:"+this.signatureTargetHashAlgorithm),null}this.signatureTargetHash=[];for(g=0;g<f;g++)this.signatureTargetHash[g]=a[e++];case 32:return this.embeddedSignature=new openpgp_packet_signature,this.embeddedSignature.read_packet(a,e,d-(e-
b)),e+this.embeddedSignature.packetLength-b;case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:return util.print_error("openpgp.packet.signature.js\nprivate or experimental signature subpacket type "+g+" @:"+e+" subplen:"+f+" len:"+d),f+1;default:return util.print_error("openpgp.packet.signature.js\nunknown signature subpacket type "+g+" @:"+e+" subplen:"+f+" len:"+d),f+1}return e-b};this.getIssuerKey=function(){var a=null;if(4==this.version)a=openpgp.keyring.getPublicKeysForKeyId(this.issuerKeyId);
else if(3==this.version)a=openpgp.keyring.getPublicKeysForKeyId(this.keyId);else return null;return 0==a.length?null:a[0]};this.getIssuer=function(){return 4==this.version?this.issuerKeyId:4==this.verions?this.keyId:null};this.write_message_signature=function(a,c,d){var e=d.privateKeyPacket.publicKey,f=d.getPreferredSignatureHashAlgorithm(),g=String.fromCharCode(4),g=g+String.fromCharCode(a),g=g+String.fromCharCode(e.publicKeyAlgorithm),g=g+String.fromCharCode(f),a=Math.round((new Date).getTime()/
1E3),a=b(2,""+String.fromCharCode(a>>24&255)+String.fromCharCode(a>>16&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(a&255)),h=b(16,d.getKeyId()),g=g+String.fromCharCode(a.length+h.length>>8&255),g=g+String.fromCharCode(a.length+h.length&255),g=g+a+h,a=""+String.fromCharCode(4),a=a+String.fromCharCode(255),a=a+String.fromCharCode(g.length>>24),a=a+String.fromCharCode(g.length>>16&255),a=a+String.fromCharCode(g.length>>8&255),a=a+String.fromCharCode(g.length&255),h=String.fromCharCode(0),
h=h+String.fromCharCode(0),j=openpgp_crypto_hashData(f,c+g+a);util.print_debug("DSA Signature is calculated with:|"+c+g+a+"|\n"+util.hexstrdump(c+g+a)+"\n hash:"+util.hexstrdump(j));h+=j.charAt(0);h+=j.charAt(1);h+=openpgp_crypto_signData(f,d.privateKeyPacket.publicKey.publicKeyAlgorithm,e.MPIs,d.privateKeyPacket.secMPIs,c+g+a);return{openpgp:openpgp_packet.write_packet_header(2,(g+h).length)+g+h,hash:util.get_hashAlgorithmString(f)}};this.verify=function(a,b){var d;d=""+String.fromCharCode(this.version);
d+=String.fromCharCode(255);d+=String.fromCharCode(this.signatureData.length>>24);d+=String.fromCharCode(this.signatureData.length>>16&255);d+=String.fromCharCode(this.signatureData.length>>8&255);d+=String.fromCharCode(this.signatureData.length&255);switch(this.signatureType){case 0:if(4==this.version)this.verified=openpgp_crypto_verifySignature(this.publicKeyAlgorithm,this.hashAlgorithm,this.MPIs,b.obj.publicKeyPacket.MPIs,a+this.signatureData+d);break;case 1:if(4==this.version){this.verified=openpgp_crypto_verifySignature(this.publicKeyAlgorithm,
this.hashAlgorithm,this.MPIs,b.obj.publicKeyPacket.MPIs,a+this.signatureData+d);break}break;case 2:if(3==this.version){this.verified=!1;break}this.verified=openpgp_crypto_verifySignature(this.publicKeyAlgorithm,this.hashAlgorithm,this.MPIs,b.obj.publicKeyPacket.MPIs,this.signatureData+d);break;case 16:case 17:case 18:case 19:case 48:this.verified=openpgp_crypto_verifySignature(this.publicKeyAlgorithm,this.hashAlgorithm,this.MPIs,b.MPIs,a+this.signatureData+d);break;case 24:if(3==this.version){this.verified=
!1;break}this.verified=openpgp_crypto_verifySignature(this.publicKeyAlgorithm,this.hashAlgorithm,this.MPIs,b.MPIs,a+this.signatureData+d);break;case 25:case 31:case 32:case 40:this.verified=openpgp_crypto_verifySignature(this.publicKeyAlgorithm,this.hashAlgorithm,this.MPIs,b.MPIs,a+this.signatureData+d);break;default:util.print_error("openpgp.packet.signature.js\nsignature verification for type"+this.signatureType+" not implemented")}return this.verified};this.read_packet=function(a,b,d){this.data=
a.substring(b,b+d);if(0>d)return util.print_debug("openpgp.packet.signature.js\nopenpgp_packet_signature read_packet length < 0 @:"+b),null;var e=b;this.packetLength=d;this.version=a[e++].charCodeAt();switch(this.version){case 3:5!=a[e++].charCodeAt()&&util.print_debug("openpgp.packet.signature.js\ninvalid One-octet length of following hashed material. MUST be 5. @:"+(e-1));this.signatureType=a[e++].charCodeAt();this.creationTime=new Date(1E3*(a[e++].charCodeAt()<<24|a[e++].charCodeAt()<<16|a[e++].charCodeAt()<<
8|a[e++].charCodeAt()));this.signatureData=a.substring(b,e);this.keyId=a.substring(e,e+8);e+=8;this.publicKeyAlgorithm=a[e++].charCodeAt();this.hashAlgorithm=a[e++].charCodeAt();this.signedHashValue=a[e++].charCodeAt()<<8|a[e++].charCodeAt();d=0;0<this.publicKeyAlgorithm&&4>this.publicKeyAlgorithm?d=1:17==this.publicKeyAlgorithm&&(d=2);this.MPIs=[];for(var f=0;f<d;f++)this.MPIs[f]=new openpgp_type_mpi,null!=this.MPIs[f].read(a,e,e-b)&&!this.packetLength<e-b?e+=this.MPIs[f].packetLength:util.print_error("signature contains invalid MPI @:"+
e);break;case 4:this.signatureType=a[e++].charCodeAt();this.publicKeyAlgorithm=a[e++].charCodeAt();this.hashAlgorithm=a[e++].charCodeAt();f=(a[e++].charCodeAt()<<8)+a[e++].charCodeAt();for(d=0;f!=d;)f<d&&util.print_debug("openpgp.packet.signature.js\nhashed missed something: "+e+" c:"+f+" l:"+d),d+=this._raw_read_signature_sub_packet(a,e+d,f-d);e+=f;this.signatureData=a.substring(b,e);f=(a[e++].charCodeAt()<<8)+a[e++].charCodeAt();for(d=0;f!=d;)f<d&&util.print_debug("openpgp.packet.signature.js\nmissed something: "+
d+" c:"+f+" l:"+d),d+=this._raw_read_signature_sub_packet(a,e+d,f-d);e+=f;this.signedHashValue=a[e++].charCodeAt()<<8|a[e++].charCodeAt();d=0;0<this.publicKeyAlgorithm&&4>this.publicKeyAlgorithm?d=1:17==this.publicKeyAlgorithm&&(d=2);this.MPIs=[];for(f=0;f<d;f++)this.MPIs[f]=new openpgp_type_mpi,null!=this.MPIs[f].read(a,e,e-b)&&!this.packetLength<e-b?e+=this.MPIs[f].packetLength:util.print_error("signature contains invalid MPI @:"+e);break;default:util.print_error("openpgp.packet.signature.js\nunknown signature packet version"+
this.version)}return this};this.toString=function(){for(var a=3==this.version?"5.2. Signature Packet (Tag 2)\nPacket Length: :"+this.packetLength+"\nPacket version: :"+this.version+"\nOne-octet signature type :"+this.signatureType+"\nFour-octet creation time. :"+this.creationTime+"\nEight-octet Key ID of signer. :"+util.hexidump(this.keyId)+"\nOne-octet public-key algorithm. :"+this.publicKeyAlgorithm+"\nOne-octet hash algorithm. :"+
this.hashAlgorithm+"\nTwo-octet field holding left\n 16 bits of signed hash value. :"+this.signedHashValue+"\n":"5.2. Signature Packet (Tag 2)\nPacket Length: :"+this.packetLength+"\nPacket version: :"+this.version+"\nOne-octet signature type :"+this.signatureType+"\nOne-octet public-key algorithm. :"+this.publicKeyAlgorithm+"\nOne-octet hash algorithm. :"+this.hashAlgorithm+"\nTwo-octet field holding left\n 16 bits of signed hash value. :"+
this.signedHashValue+"\nSignature Creation Time :"+this.creationTime+"\nSignature Expiration Time :"+this.signatureExpirationTime+"\nSignature Never Expires :"+this.signatureNeverExpires+"\nExportable Certification :"+this.exportable+"\nTrust Signature level: :"+this.trustLevel+" amount"+this.trustAmount+"\nRegular Expression :"+this.regular_expression+"\nRevocable :"+this.revocable+"\nKey Expiration Time :"+
this.keyExpirationTime+" "+this.keyNeverExpires+"\nPreferred Symmetric Algorithms :"+this.preferredSymmetricAlgorithms+"\nRevocation Key\n ( 1 octet of class, :"+this.revocationKeyClass+"\n 1 octet of public-key ID, :"+this.revocationKeyAlgorithm+"\n 20 octets of fingerprint) :"+this.revocationKeyFingerprint+"\nIssuer :"+util.hexstrdump(this.issuerKeyId)+"\nPreferred Hash Algorithms :"+this.preferredHashAlgorithms+"\nPreferred Compression Alg. :"+
this.preferredCompressionAlgorithms+"\nKey Server Preferences :"+this.keyServerPreferences+"\nPreferred Key Server :"+this.preferredKeyServer+"\nPrimary User ID :"+this.isPrimaryUserID+"\nPolicy URI :"+this.policyURI+"\nKey Flags :"+this.keyFlags+"\nSigner's User ID :"+this.signersUserId+"\nNotation :"+this.notationName+" = "+this.notationValue+"\nReason for Revocation\n Flag :"+
this.reasonForRevocationFlag+"\n Reason :"+this.reasonForRevocationString+"\nMPI:\n",b=0;b<this.MPIs.length;b++)a+=this.MPIs[b].toString();return a}}
function openpgp_packet_userattribute(){this.tagType=17;this.certificationSignatures=[];this.certificationRevocationSignatures=[];this.revocationSignatures=[];this.parentNode=null;this.read_packet=function(b,a,c){var d=0;this.packetLength=c;this.userattributes=[];for(var e=a;c!=d;){var f=0;192>b[e].charCodeAt()?(packet_length=b[e++].charCodeAt(),f=1):192<=b[e].charCodeAt()&&224>b[e].charCodeAt()?(packet_length=(b[e++].charCodeAt()-192<<8)+b[e++].charCodeAt()+192,f=2):223<b[e].charCodeAt()&&255>b[e].charCodeAt()?
(packet_length=1<<(b[e++].charCodeAt()&31),f=1):(f=5,e++,packet_length=b[e++].charCodeAt()<<24|b[e++].charCodeAt()<<16|b[e++].charCodeAt()<<8|b[e++].charCodeAt());b[e++].charCodeAt();packet_length--;f++;this.userattributes[0]=[];this.userattributes[0]=b.substring(e,e+packet_length);e+=packet_length;d+=f+packet_length}this.packetLength=e-a;return this};this.read_nodes=function(b,a,c,d){this.parentNode=b;for(var e=c,f=d;a.length!=e;){var g=openpgp_packet.read_packet(a,e,f);if(null==g){util.print_error("openpgp.packet.userattribute.js\n[user_attr] parsing ends here @:"+
e+" l:"+f);break}else switch(g.tagType){case 2:15<g.signatureType&&20>g.signatureType?this.certificationSignatures[this.certificationSignatures.length]=g:32==g.signatureType&&(this.certificationRevocationSignatures[this.certificationRevocationSignatures.length]=g);e+=g.packetLength+g.headerLength;f=d-(e-c);break;default:return this.data=a,this.position=c-b.packetLength,this.len=e-c}}this.data=a;this.position=c-b.packetLength;return this.len=e-c};this.toString=function(){for(var b="5.12. User Attribute Packet (Tag 17)\n AttributePackets: (count = "+
this.userattributes.length+")\n",a=0;a<this.userattributes.length;a++)b+=" ("+this.userattributes[a].length+") bytes: ["+util.hexidump(this.userattributes[a])+"]\n";return b}}
function openpgp_packet_userid(){this.text="";this.tagType=13;this.certificationSignatures=[];this.certificationRevocationSignatures=[];this.revocationSignatures=[];this.parentNode=null;this.set_text=function(b){this.text=b};this.set_text_bytes=function(b){this.text=util.decode_utf8(b)};this.get_text_bytes=function(){return util.encode_utf8(this.text)};this.read_packet=function(b,a,c){this.packetLength=c;for(var d="",e=0;e<c;e++)d+=b[a+e];this.set_text_bytes(d);return this};this.write_packet=function(b){this.set_text(b);
var b=this.get_text_bytes(),a=openpgp_packet.write_packet_header(13,b.length);return a+b};this.read_nodes=function(b,a,c,d){if(6==b.tagType){this.parentNode=b;for(var e=c,f=d;a.length!=e;){var g=openpgp_packet.read_packet(a,e,f-(e-c));if(null==g){util.print_error("[user_id] parsing ends here @:"+e+" l:"+f);break}else switch(e+=g.packetLength+g.headerLength,f=a.length-e,g.tagType){case 2:if(15<g.signatureType&&20>g.signatureType){this.certificationSignatures[this.certificationSignatures.length]=g;
break}else if(48==g.signatureType){this.certificationRevocationSignatures[this.certificationRevocationSignatures.length]=g;break}else if(24==g.signatureType){this.certificationSignatures[this.certificationSignatures.length]=g;break}else util.print_debug("unknown sig t: "+g.signatureType+"@"+(e-(g.packetLength+g.headerLength)));default:return this.data=a,this.position=c-b.packetLength,this.len=e-c-(g.headerLength+g.packetLength)}}this.data=a;this.position=c-b.packetLength;return this.len=e-c-(g.headerLength+
g.packetLength)}if(5==b.tagType){this.parentNode=b;for(e=c;a.length!=e;)if(g=openpgp_packet.read_packet(a,e,f-(e-c)),null==g){util.print_error("parsing ends here @:"+e+" l:"+f);break}else switch(e+=g.packetLength+g.headerLength,g.tagType){case 2:15<g.signatureType&&20>g.signatureType?this.certificationSignatures[this.certificationSignatures.length]=g:48==g.signatureType&&(this.certificationRevocationSignatures[this.certificationRevocationSignatures.length]=g);default:return this.data=a,this.position=
c-b.packetLength,this.len=e-c-(g.headerLength+g.packetLength)}}else util.print_error("unknown parent node for a userId packet "+b.tagType)};this.toString=function(){for(var b=" 5.11. User ID Packet (Tag 13)\n text ("+this.text.length+'): "'+this.text.replace("<","&lt;")+'"\n',b=b+"certification signatures:\n",a=0;a<this.certificationSignatures.length;a++)b+=" "+this.certificationSignatures[a].toString();b+="certification revocation signatures:\n";for(a=0;a<this.certificationRevocationSignatures.length;a++)b+=
" "+this.certificationRevocationSignatures[a].toString();return b};this.hasCertificationRevocationSignature=function(b){for(var a=0;a<this.certificationRevocationSignatures.length;a++)if(3==this.certificationRevocationSignatures[a].version&&this.certificationRevocationSignatures[a].keyId==b||4==this.certificationRevocationSignatures[a].version&&this.certificationRevocationSignatures[a].issuerKeyId==b)return this.certificationRevocationSignatures[a];return null};this.verifyCertificationSignatures=
function(b){var a=this.get_text_bytes();result=[];for(var c=0;c<this.certificationSignatures.length;c++)if(4==this.certificationSignatures[c].version)if(null!=this.certificationSignatures[c].signatureExpirationTime&&null!=this.certificationSignatures[c].signatureExpirationTime&&0!=this.certificationSignatures[c].signatureExpirationTime&&!this.certificationSignatures[c].signatureNeverExpires&&new Date(this.certificationSignatures[c].creationTime.getTime()+1E3*this.certificationSignatures[c].signatureExpirationTime)<
new Date)result[c]=this.certificationSignatures[c].issuerKeyId==b.getKeyId()?5:1;else if(null==this.certificationSignatures[c].issuerKeyId)result[c]=0;else{var d=openpgp.keyring.getPublicKeysForKeyId(this.certificationSignatures[c].issuerKeyId);if(null==d||0==d.length)result[c]=2;else if(d=d[0],d=d.obj.getSigningKey(),null==d)result[c]=0;else{var e=this.hasCertificationRevocationSignature(this.certificationSignatures[c].issuerKeyId);if(null!=e&&e.creationTime>this.certificationSignatures[c].creationTime){var f=
String.fromCharCode(153)+b.header.substring(1)+b.data+String.fromCharCode(180)+String.fromCharCode(a.length>>24&255)+String.fromCharCode(a.length>>16&255)+String.fromCharCode(a.length>>8&255)+String.fromCharCode(a.length&255)+a;if(e.verify(f,d)){result[c]=this.certificationSignatures[c].issuerKeyId==b.getKeyId()?6:3;continue}}f=String.fromCharCode(153)+b.header.substring(1)+b.data+String.fromCharCode(180)+String.fromCharCode(a.length>>24&255)+String.fromCharCode(a.length>>16&255)+String.fromCharCode(a.length>>
8&255)+String.fromCharCode(a.length&255)+a;result[c]=this.certificationSignatures[c].verify(f,d)?4:0}}else if(3==this.certificationSignatures[c].version)if(null==this.certificationSignatures[c].keyId)result[c]=0;else if(d=openpgp.keyring.getPublicKeysForKeyId(this.certificationSignatures[c].keyId),null==d||0==d.length)result[c]=2;else if(d=publicKey.obj.getSigningKey(),null==d)result[c]=0;else{e=this.hasCertificationRevocationSignature(this.certificationSignatures[c].keyId);if(null!=e&&e.creationTime>
this.certificationSignatures[c].creationTime&&(f=String.fromCharCode(153)+this.publicKeyPacket.header.substring(1)+this.publicKeyPacket.data+a,e.verify(f,d))){result[c]=e.keyId==b.getKeyId()?6:3;continue}f=String.fromCharCode(153)+b.header.substring(1)+b.data+a;result[c]=this.certificationSignatures[c].verify(f,d)?4:0}else result[c]=0;return result};this.verify=function(b){b=this.verifyCertificationSignatures(b);return-1!=b.indexOf(6)?2:-1!=b.indexOf(5)?1:0};this.addCertification=function(){};this.revokeCertification=
function(){}}function openpgp_type_keyid(){this.read_packet=function(b,a){this.bytes=b.substring(a,a+8);return this};this.toString=function(){return util.hexstrdump(this.bytes)}}
function openpgp_type_mpi(){this.data=this.mpiByteLength=this.mpiBitLength=this.MPI=null;this.read=function(b,a){var c=a;this.mpiBitLength=b[c++].charCodeAt()<<8|b[c++].charCodeAt();this.mpiByteLength=(this.mpiBitLength-this.mpiBitLength%8)/8;0!=this.mpiBitLength%8&&this.mpiByteLength++;this.MPI=b.substring(c,c+this.mpiByteLength);this.data=b.substring(a,a+2+this.mpiByteLength);this.packetLength=this.mpiByteLength+2;return this};this.toBigInteger=function(){return new BigInteger(util.hexstrdump(this.MPI),
16)};this.toString=function(){var b=" MPI("+this.mpiBitLength+"b/"+this.mpiByteLength+"B) : 0x",b=b+util.hexstrdump(this.MPI);return b+"\n"};this.create=function(b){this.MPI=b;var a=8*(b.length-1),c;a:for(var d=b.charCodeAt(0),e=0;9>e;e++)if(0==d>>e){c=e;break a}this.mpiBitLength=a+c;this.mpiByteLength=b.length;return this};this.toBin=function(){var b=String.fromCharCode(this.mpiBitLength>>8&255),b=b+String.fromCharCode(this.mpiBitLength&255);return b+=this.MPI};this.getByteLength=function(){return this.mpiByteLength}}
function openpgp_type_s2k(){this.read=function(b,a){var c=a;this.type=b[c++].charCodeAt();switch(this.type){case 0:this.hashAlgorithm=b[c++].charCodeAt();this.s2kLength=1;break;case 1:this.hashAlgorithm=b[c++].charCodeAt();this.saltValue=b.substring(c,c+8);this.s2kLength=9;break;case 3:this.hashAlgorithm=b[c++].charCodeAt();this.saltValue=b.substring(c,c+8);c+=8;this.EXPBIAS=6;c=b[c++].charCodeAt();this.count=16+(c&15)<<(c>>4)+this.EXPBIAS;this.s2kLength=10;break;case 101:"GNU"==b.substring(c+1,c+
4)?(this.hashAlgorithm=b[c++].charCodeAt(),c+=3,c=1E3+b[c++].charCodeAt(),1001==c?(this.type=c,this.s2kLength=5):util.print_error("unknown s2k gnu protection mode! "+this.type)):util.print_error("unknown s2k type! "+this.type);break;default:util.print_error("unknown s2k type! "+this.type)}return this};this.write=function(b,a,c,d,e){this.type=b;if(3==this.type)this.saltValue=d,this.hashAlgorithm=a,this.count=16+(e&15)<<(e>>4)+6,this.s2kLength=10;return this.produce_key(c)};this.produce_key=function(b,
a){b=util.encode_utf8(b);if(0==this.type)return openpgp_crypto_hashData(this.hashAlgorithm,b);if(1==this.type)return openpgp_crypto_hashData(this.hashAlgorithm,this.saltValue+b);if(3==this.type){var c=[];for(c[0]=this.saltValue+b;c.length*(this.saltValue+b).length<this.count;)c.push(this.saltValue+b);c=c.join("");c.length>this.count&&(c=c.substr(0,this.count));return a&&(24==a||32==a)?openpgp_crypto_hashData(this.hashAlgorithm,c)+openpgp_crypto_hashData(this.hashAlgorithm,String.fromCharCode(0)+c):
openpgp_crypto_hashData(this.hashAlgorithm,c)}return null}}
var Util=function(){this.emailRegEx=/[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/;this.hexdump=function(a){for(var b=[],e=a.length,f=0,g,h=0;f<e;){for(g=a.charCodeAt(f++).toString(16);2>g.length;)g="0"+g;b.push(" "+g);h++;0==h%32&&b.push("\n ")}return b.join("")};this.hexstrdump=function(a){if(null==a)return"";for(var b=[],e=a.length,f=0,g;f<e;){for(g=a[f++].charCodeAt().toString(16);2>g.length;)g=
"0"+g;b.push(""+g)}return b.join("")};this.hex2bin=function(a){for(var b="",e=0;e<a.length;e+=2)b+=String.fromCharCode(parseInt(a.substr(e,2),16));return b};this.hexidump=function(a){for(var b=[],e=a.length,f=0,g;f<e;){for(g=a[f++].toString(16);2>g.length;)g="0"+g;b.push(""+g)}return b.join("")};this.encode_utf8=function(a){return unescape(encodeURIComponent(a))};this.decode_utf8=function(a){return decodeURIComponent(escape(a))};var b=function(a,b){for(var e=0;e<a.length;e++)b[e]=a.charCodeAt(e);
return b},a=function(a){for(var b=[],e=0;e<a.length;e++)b.push(String.fromCharCode(a[e]));return b.join("")};this.str2bin=function(a){return b(a,Array(a.length))};this.bin2str=a;this.str2Uint8Array=function(a){return b(a,new Uint8Array(new ArrayBuffer(a.length)))};this.Uint8Array2str=a;this.calc_checksum=function(a){for(var b={s:0,add:function(a){this.s=(this.s+a)%65536}},e=0;e<a.length;e++)b.add(a.charCodeAt(e));return b.s};this.print_debug=function(a){openpgp.config.debug&&(a=openpgp_encoding_html_encode(a),
showMessages('<tt><p style="background-color: #ffffff; width: 652px; word-break: break-word; padding: 5px; border-bottom: 1px solid black;">'+a.replace(/\n/g,"<br>")+"</p></tt>"))};this.print_debug_hexstr_dump=function(a,b){openpgp.config.debug&&(a+=this.hexstrdump(b),a=openpgp_encoding_html_encode(a),showMessages('<tt><p style="background-color: #ffffff; width: 652px; word-break: break-word; padding: 5px; border-bottom: 1px solid black;">'+a.replace(/\n/g,"<br>")+"</p></tt>"))};this.print_error=
function(a){a=openpgp_encoding_html_encode(a);showMessages('<p style="font-size: 80%; background-color: #FF8888; margin:0; width: 652px; word-break: break-word; padding: 5px; border-bottom: 1px solid black;"><span style="color: #888;"><b>ERROR:</b></span>\t'+a.replace(/\n/g,"<br>")+"</p>")};this.print_info=function(a){a=openpgp_encoding_html_encode(a);showMessages('<p style="font-size: 80%; background-color: #88FF88; margin:0; width: 652px; word-break: break-word; padding: 5px; border-bottom: 1px solid black;"><span style="color: #888;"><b>INFO:</b></span>\t'+
a.replace(/\n/g,"<br>")+"</p>")};this.print_warning=function(a){a=openpgp_encoding_html_encode(a);showMessages('<p style="font-size: 80%; background-color: #FFAA88; margin:0; width: 652px; word-break: break-word; padding: 5px; border-bottom: 1px solid black;"><span style="color: #888;"><b>WARNING:</b></span>\t'+a.replace(/\n/g,"<br>")+"</p>")};this.getLeftNBits=function(a,b){var e=b%8;return 0==e?a.substring(0,b/8):this.shiftRight(a.substring(0,(b-e)/8+1),8-e)};this.shiftRight=function(a,b){var e=
util.str2bin(a);if(0!=b%8)for(var f=e.length-1;0<=f;f--)e[f]>>=b%8,0<f&&(e[f]|=e[f-1]<<8-b%8&255);else return a;return util.bin2str(e)};this.get_hashAlgorithmString=function(a){switch(a){case 1:return"MD5";case 2:return"SHA1";case 3:return"RIPEMD160";case 8:return"SHA256";case 9:return"SHA384";case 10:return"SHA512";case 11:return"SHA224"}return"unknown"}},util=new Util;
(function() {function g(a){throw a;}var j=void 0,k=!0,l=null,o=!1;function aa(a){return function(){return this[a]}}function q(a){return function(){return a}}var r,ba=this;function ca(){}
function da(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==c||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null";
else if("function"==b&&"undefined"==typeof a.call)return"object";return b}function t(a){return a!==j}function ea(a){var b=da(a);return"array"==b||"object"==b&&"number"==typeof a.length}function u(a){return"string"==typeof a}function fa(a){return"number"==typeof a}function ga(a){var b=typeof a;return"object"==b&&a!=l||"function"==b}Math.floor(2147483648*Math.random()).toString(36);function ha(a,b,c){return a.call.apply(a.bind,arguments)}
function ia(a,b,c){a||g(Error());if(2<arguments.length){var d=Array.prototype.slice.call(arguments,2);return function(){var c=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(c,d);return a.apply(b,c)}}return function(){return a.apply(b,arguments)}}function v(a,b,c){v=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?ha:ia;return v.apply(l,arguments)}function ja(a,b){function c(){}c.prototype=b.prototype;a.Md=b.prototype;a.prototype=new c};function ka(a){a=String(a);if(/^\s*$/.test(a)?0:/^[\],:{}\s\u2028\u2029]*$/.test(a.replace(/\\["\\\/bfnrtu]/g,"@").replace(/"[^"\\\n\r\u2028\u2029\x00-\x08\x10-\x1f\x80-\x9f]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:[\s\u2028\u2029]*\[)+/g,"")))try{return eval("("+a+")")}catch(b){}g(Error("Invalid JSON string: "+a))}function la(){this.Xb=j}
function ma(a,b,c){switch(typeof b){case "string":na(b,c);break;case "number":c.push(isFinite(b)&&!isNaN(b)?b:"null");break;case "boolean":c.push(b);break;case "undefined":c.push("null");break;case "object":if(b==l){c.push("null");break}if("array"==da(b)){var d=b.length;c.push("[");for(var e="",f=0;f<d;f++)c.push(e),e=b[f],ma(a,a.Xb?a.Xb.call(b,String(f),e):e,c),e=",";c.push("]");break}c.push("{");d="";for(f in b)Object.prototype.hasOwnProperty.call(b,f)&&(e=b[f],"function"!=typeof e&&(c.push(d),
na(f,c),c.push(":"),ma(a,a.Xb?a.Xb.call(b,f,e):e,c),d=","));c.push("}");break;case "function":break;default:g(Error("Unknown type: "+typeof b))}}var oa={'"':'\\"',"\\":"\\\\","/":"\\/","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\x0B":"\\u000b"},pa=/\uffff/.test("\uffff")?/[\\\"\x00-\x1f\x7f-\uffff]/g:/[\\\"\x00-\x1f\x7f-\xff]/g;
function na(a,b){b.push('"',a.replace(pa,function(a){if(a in oa)return oa[a];var b=a.charCodeAt(0),e="\\u";16>b?e+="000":256>b?e+="00":4096>b&&(e+="0");return oa[a]=e+b.toString(16)}),'"')};function y(a){if("undefined"!==typeof JSON&&t(JSON.stringify))a=JSON.stringify(a);else{var b=[];ma(new la,a,b);a=b.join("")}return a};function qa(a){for(var b=[],c=0,d=0;d<a.length;d++){var e=a.charCodeAt(d);55296<=e&&56319>=e&&(e-=55296,d++,z(d<a.length,"Surrogate pair missing trail surrogate."),e=65536+(e<<10)+(a.charCodeAt(d)-56320));128>e?b[c++]=e:(2048>e?b[c++]=e>>6|192:(65536>e?b[c++]=e>>12|224:(b[c++]=e>>18|240,b[c++]=e>>12&63|128),b[c++]=e>>6&63|128),b[c++]=e&63|128)}return b};function A(a,b,c,d){var e;d<b?e="at least "+b:d>c&&(e=0===c?"none":"no more than "+c);e&&g(Error(a+" failed: Was called with "+d+(1===d?" argument.":" arguments.")+" Expects "+e+"."))}function B(a,b,c){var d="";switch(b){case 1:d=c?"first":"First";break;case 2:d=c?"second":"Second";break;case 3:d=c?"third":"Third";break;case 4:d=c?"fourth":"Fourth";break;default:ra.assert(o,"errorPrefix_ called with argumentNumber > 4. Need to update it?")}return a+" failed: "+(d+" argument ")}
function C(a,b,c,d){(!d||t(c))&&"function"!=da(c)&&g(Error(B(a,b,d)+"must be a valid function."))}function sa(a,b,c){t(c)&&(!ga(c)||c===l)&&g(Error(B(a,b,k)+"must be a valid context object."))};function D(a,b){return Object.prototype.hasOwnProperty.call(a,b)}function ta(a,b){if(Object.prototype.hasOwnProperty.call(a,b))return a[b]};var ua={},ra={},va=/[\[\].#$\/]/,wa=/[\[\].#$]/;function xa(a){return u(a)&&0!==a.length&&!va.test(a)}function ya(a,b,c){(!c||t(b))&&za(B(a,1,c),b)}
function za(a,b,c,d){c||(c=0);d||(d=[]);t(b)||g(Error(a+"contains undefined"+Aa(d)));"function"==da(b)&&g(Error(a+"contains a function"+Aa(d)+" with contents: "+b.toString()));Ba(b)&&g(Error(a+"contains "+b.toString()+Aa(d)));1E3<c&&g(new TypeError(a+"contains a cyclic object value ("+d.slice(0,100).join(".")+"...)"));u(b)&&(b.length>10485760/3&&10485760<ua.Nd.Ld(b).length)&&g(Error(a+"contains a string greater than 10485760 utf8 bytes"+Aa(d)+" ('"+b.substring(0,50)+"...')"));if(ga(b))for(var e in b)D(b,
e)&&(".priority"!==e&&(".value"!==e&&!xa(e))&&g(Error(a+"contains an invalid key ("+e+")"+Aa(d)+'. Keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]"')),d.push(e),za(a,b[e],c+1,d),d.pop())}function Aa(a){return 0==a.length?"":" in property '"+a.join(".")+"'"}function Ca(a,b){ga(b)||g(Error(B(a,1,o)+" must be an object containing the children to replace."));ya(a,b,o)}
function Da(a,b,c,d){(!d||t(c))&&(c!==l&&!fa(c)&&!u(c))&&g(Error(B(a,b,d)+"must be a valid firebase priority (null or a string.)"))}function Ea(a,b,c){if(!c||t(b))switch(b){case "value":case "child_added":case "child_removed":case "child_changed":case "child_moved":break;default:g(Error(B(a,1,c)+'must be a valid event type: "value", "child_added", "child_removed", "child_changed", or "child_moved".'))}}
function Fa(a,b){t(b)&&!xa(b)&&g(Error(B(a,2,k)+'must be a valid firebase key (non-empty string, not containing ".", "#", "$", "/", "[", or "]").'))}function Ga(a,b){(!u(b)||0===b.length||wa.test(b))&&g(Error(B(a,1,o)+'must be a non-empty string and can\'t contain ".", "#", "$", "[", or "]".'))}function E(a,b){".info"===F(b)&&g(Error(a+" failed: Can't modify data under /.info/"))};function H(a,b,c,d,e,f,h){this.u=a;this.path=b;this.ua=c;this.ca=d;this.ma=e;this.sa=f;this.Na=h;t(this.ca)&&(t(this.sa)&&t(this.ua))&&g("Query: Can't combine startAt(), endAt(), and limit().")}H.prototype.qc=function(a,b){A("Query.on",2,4,arguments.length);Ea("Query.on",a,o);C("Query.on",2,b,o);var c=Ha("Query.on",arguments[2],arguments[3]);this.u.Eb(this,a,b,c.cancel,c.Z);return b};H.prototype.on=H.prototype.qc;
H.prototype.Kb=function(a,b,c){A("Query.off",0,3,arguments.length);Ea("Query.off",a,k);C("Query.off",2,b,k);sa("Query.off",3,c);this.u.Wb(this,a,b,c)};H.prototype.off=H.prototype.Kb;H.prototype.xd=function(a,b){function c(h){f&&(f=o,e.Kb(a,c),b.call(d.Z,h))}A("Query.once",2,4,arguments.length);Ea("Query.once",a,o);C("Query.once",2,b,o);var d=Ha("Query.once",arguments[2],arguments[3]),e=this,f=k;this.qc(a,c,function(){e.Kb(a,c);d.cancel&&d.cancel.call(d.Z)})};H.prototype.once=H.prototype.xd;
H.prototype.sd=function(a){A("Query.limit",1,1,arguments.length);(!fa(a)||Math.floor(a)!==a||0>=a)&&g("Query.limit: First argument must be a positive integer.");return new H(this.u,this.path,a,this.ca,this.ma,this.sa,this.Na)};H.prototype.limit=H.prototype.sd;H.prototype.Hd=function(a,b){A("Query.startAt",0,2,arguments.length);Da("Query.startAt",1,a,k);Fa("Query.startAt",b);t(a)||(b=a=l);return new H(this.u,this.path,this.ua,a,b,this.sa,this.Na)};H.prototype.startAt=H.prototype.Hd;
H.prototype.md=function(a,b){A("Query.endAt",0,2,arguments.length);Da("Query.endAt",1,a,k);Fa("Query.endAt",b);return new H(this.u,this.path,this.ua,this.ca,this.ma,a,b)};H.prototype.endAt=H.prototype.md;function Ia(a){var b={};t(a.ca)&&(b.sp=a.ca);t(a.ma)&&(b.sn=a.ma);t(a.sa)&&(b.ep=a.sa);t(a.Na)&&(b.en=a.Na);t(a.ua)&&(b.l=a.ua);t(a.ca)&&(t(a.ma)&&a.ca===l&&a.ma===l)&&(b.vf="l");return b}H.prototype.Fa=function(){var a=Ja(Ia(this));return"{}"===a?"default":a};
function Ha(a,b,c){var d={};b&&c?(d.cancel=b,C(a,3,d.cancel,k),d.Z=c,sa(a,4,d.Z)):b&&("object"===typeof b&&b!==l?d.Z=b:"function"===typeof b?d.cancel=b:g(Error(B(a,3,k)+"must either be a cancel callback or a context object.")));return d};function I(a){if(a instanceof I)return a;if(1==arguments.length){this.m=a.split("/");for(var b=0,c=0;c<this.m.length;c++)0<this.m[c].length&&(this.m[b]=this.m[c],b++);this.m.length=b;this.aa=0}else this.m=arguments[0],this.aa=arguments[1]}function F(a){return a.aa>=a.m.length?l:a.m[a.aa]}function J(a){var b=a.aa;b<a.m.length&&b++;return new I(a.m,b)}function Ka(a){return a.aa<a.m.length?a.m[a.m.length-1]:l}r=I.prototype;
r.toString=function(){for(var a="",b=this.aa;b<this.m.length;b++)""!==this.m[b]&&(a+="/"+this.m[b]);return a||"/"};r.parent=function(){if(this.aa>=this.m.length)return l;for(var a=[],b=this.aa;b<this.m.length-1;b++)a.push(this.m[b]);return new I(a,0)};r.F=function(a){for(var b=[],c=this.aa;c<this.m.length;c++)b.push(this.m[c]);if(a instanceof I)for(c=a.aa;c<a.m.length;c++)b.push(a.m[c]);else{a=a.split("/");for(c=0;c<a.length;c++)0<a[c].length&&b.push(a[c])}return new I(b,0)};
r.f=function(){return this.aa>=this.m.length};function La(a,b){var c=F(a);if(c===l)return b;if(c===F(b))return La(J(a),J(b));g("INTERNAL ERROR: innerPath ("+b+") is not within outerPath ("+a+")")}r.contains=function(a){var b=0;if(this.m.length>a.m.length)return o;for(;b<this.m.length;){if(this.m[b]!==a.m[b])return o;++b}return k};function Ma(){this.children={};this.ic=0;this.value=l}function Na(a,b,c){this.va=a?a:"";this.ob=b?b:l;this.z=c?c:new Ma}function L(a,b){for(var c=b instanceof I?b:new I(b),d=a,e;(e=F(c))!==l;)d=new Na(e,d,ta(d.z.children,e)||new Ma),c=J(c);return d}r=Na.prototype;r.j=function(){return this.z.value};function N(a,b){z("undefined"!==typeof b);a.z.value=b;Oa(a)}r.bb=function(){return 0<this.z.ic};r.f=function(){return this.j()===l&&!this.bb()};
r.w=function(a){for(var b in this.z.children)a(new Na(b,this,this.z.children[b]))};function Pa(a,b,c,d){c&&!d&&b(a);a.w(function(a){Pa(a,b,k,d)});c&&d&&b(a)}function Qa(a,b,c){for(a=c?a:a.parent();a!==l;){if(b(a))return k;a=a.parent()}return o}r.path=function(){return new I(this.ob===l?this.va:this.ob.path()+"/"+this.va)};r.name=aa("va");r.parent=aa("ob");
function Oa(a){if(a.ob!==l){var b=a.ob,c=a.va,d=a.f(),e=D(b.z.children,c);d&&e?(delete b.z.children[c],b.z.ic--,Oa(b)):!d&&!e&&(b.z.children[c]=a.z,b.z.ic++,Oa(b))}};function Ra(a,b){this.Ka=a?a:Sa;this.ba=b?b:Va}function Sa(a,b){return a<b?-1:a>b?1:0}r=Ra.prototype;r.ja=function(a,b){return new Ra(this.Ka,this.ba.ja(a,b,this.Ka).copy(l,l,o,l,l))};r.remove=function(a){return new Ra(this.Ka,this.ba.remove(a,this.Ka).copy(l,l,o,l,l))};r.get=function(a){for(var b,c=this.ba;!c.f();){b=this.Ka(a,c.key);if(0===b)return c.value;0>b?c=c.left:0<b&&(c=c.right)}return l};
function Wa(a,b){for(var c,d=a.ba,e=l;!d.f();){c=a.Ka(b,d.key);if(0===c){if(d.left.f())return e?e.key:l;for(d=d.left;!d.right.f();)d=d.right;return d.key}0>c?d=d.left:0<c&&(e=d,d=d.right)}g(Error("Attempted to find predecessor key for a nonexistent key. What gives?"))}r.f=function(){return this.ba.f()};r.count=function(){return this.ba.count()};r.ib=function(){return this.ba.ib()};r.Qa=function(){return this.ba.Qa()};r.ta=function(a){return this.ba.ta(a)};r.Ga=function(a){return this.ba.Ga(a)};
r.Oa=function(a){return new Xa(this.ba,a)};function Xa(a,b){this.Zc=b;for(this.Ib=[];!a.f();)this.Ib.push(a),a=a.left}function Ya(a){if(0===a.Ib.length)return l;var b=a.Ib.pop(),c;c=a.Zc?a.Zc(b.key,b.value):{key:b.key,value:b.value};for(b=b.right;!b.f();)a.Ib.push(b),b=b.left;return c}function Za(a,b,c,d,e){this.key=a;this.value=b;this.color=c!=l?c:k;this.left=d!=l?d:Va;this.right=e!=l?e:Va}r=Za.prototype;
r.copy=function(a,b,c,d,e){return new Za(a!=l?a:this.key,b!=l?b:this.value,c!=l?c:this.color,d!=l?d:this.left,e!=l?e:this.right)};r.count=function(){return this.left.count()+1+this.right.count()};r.f=q(o);r.ta=function(a){return this.left.ta(a)||a(this.key,this.value)||this.right.ta(a)};r.Ga=function(a){return this.right.Ga(a)||a(this.key,this.value)||this.left.Ga(a)};function $a(a){return a.left.f()?a:$a(a.left)}r.ib=function(){return $a(this).key};
r.Qa=function(){return this.right.f()?this.key:this.right.Qa()};r.ja=function(a,b,c){var d,e;e=this;d=c(a,e.key);e=0>d?e.copy(l,l,l,e.left.ja(a,b,c),l):0===d?e.copy(l,b,l,l,l):e.copy(l,l,l,l,e.right.ja(a,b,c));return ab(e)};function bb(a){if(a.left.f())return Va;!a.left.K()&&!a.left.left.K()&&(a=cb(a));a=a.copy(l,l,l,bb(a.left),l);return ab(a)}
r.remove=function(a,b){var c,d;c=this;if(0>b(a,c.key))!c.left.f()&&(!c.left.K()&&!c.left.left.K())&&(c=cb(c)),c=c.copy(l,l,l,c.left.remove(a,b),l);else{c.left.K()&&(c=db(c));!c.right.f()&&(!c.right.K()&&!c.right.left.K())&&(c=eb(c),c.left.left.K()&&(c=db(c),c=eb(c)));if(0===b(a,c.key)){if(c.right.f())return Va;d=$a(c.right);c=c.copy(d.key,d.value,l,l,bb(c.right))}c=c.copy(l,l,l,l,c.right.remove(a,b))}return ab(c)};r.K=aa("color");
function ab(a){a.right.K()&&!a.left.K()&&(a=fb(a));a.left.K()&&a.left.left.K()&&(a=db(a));a.left.K()&&a.right.K()&&(a=eb(a));return a}function cb(a){a=eb(a);a.right.left.K()&&(a=a.copy(l,l,l,l,db(a.right)),a=fb(a),a=eb(a));return a}function fb(a){var b;b=a.copy(l,l,k,l,a.right.left);return a.right.copy(l,l,a.color,b,l)}function db(a){var b;b=a.copy(l,l,k,a.left.right,l);return a.left.copy(l,l,a.color,l,b)}
function eb(a){var b,c;b=a.left.copy(l,l,!a.left.color,l,l);c=a.right.copy(l,l,!a.right.color,l,l);return a.copy(l,l,!a.color,b,c)}function gb(){}r=gb.prototype;r.copy=function(){return this};r.ja=function(a,b){return new Za(a,b,j,j,j)};r.remove=function(){return this};r.get=q(l);r.count=q(0);r.f=q(k);r.ta=q(o);r.Ga=q(o);r.ib=q(l);r.Qa=q(l);r.K=q(o);var Va=new gb;var hb=Array.prototype,ib=hb.forEach?function(a,b,c){hb.forEach.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=u(a)?a.split(""):a,f=0;f<d;f++)f in e&&b.call(c,e[f],f,a)},jb=hb.map?function(a,b,c){return hb.map.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=Array(d),f=u(a)?a.split(""):a,h=0;h<d;h++)h in f&&(e[h]=b.call(c,f[h],h,a));return e};function kb(){};function lb(){this.B=[];this.hc=[];this.jd=[];this.Ob=[];this.Ob[0]=128;for(var a=1;64>a;++a)this.Ob[a]=0;this.reset()}ja(lb,kb);lb.prototype.reset=function(){this.B[0]=1732584193;this.B[1]=4023233417;this.B[2]=2562383102;this.B[3]=271733878;this.B[4]=3285377520;this.Fc=this.eb=0};
function mb(a,b){var c;c||(c=0);for(var d=a.jd,e=c;e<c+64;e+=4)d[e/4]=b[e]<<24|b[e+1]<<16|b[e+2]<<8|b[e+3];for(e=16;80>e;e++){var f=d[e-3]^d[e-8]^d[e-14]^d[e-16];d[e]=(f<<1|f>>>31)&4294967295}c=a.B[0];for(var h=a.B[1],i=a.B[2],m=a.B[3],n=a.B[4],p,e=0;80>e;e++)40>e?20>e?(f=m^h&(i^m),p=1518500249):(f=h^i^m,p=1859775393):60>e?(f=h&i|m&(h|i),p=2400959708):(f=h^i^m,p=3395469782),f=(c<<5|c>>>27)+f+n+p+d[e]&4294967295,n=m,m=i,i=(h<<30|h>>>2)&4294967295,h=c,c=f;a.B[0]=a.B[0]+c&4294967295;a.B[1]=a.B[1]+h&
4294967295;a.B[2]=a.B[2]+i&4294967295;a.B[3]=a.B[3]+m&4294967295;a.B[4]=a.B[4]+n&4294967295}lb.prototype.update=function(a,b){t(b)||(b=a.length);var c=this.hc,d=this.eb,e=0;if(u(a))for(;e<b;)c[d++]=a.charCodeAt(e++),64==d&&(mb(this,c),d=0);else for(;e<b;)c[d++]=a[e++],64==d&&(mb(this,c),d=0);this.eb=d;this.Fc+=b};function nb(){this.Ja={};this.length=0}nb.prototype.setItem=function(a,b){D(this.Ja,a)||(this.length+=1);this.Ja[a]=b};nb.prototype.getItem=function(a){return D(this.Ja,a)?this.Ja[a]:l};nb.prototype.removeItem=function(a){D(this.Ja,a)&&(this.length-=1,delete this.Ja[a])};var ob=l;if("undefined"!==typeof sessionStorage)try{sessionStorage.setItem("firebase-sentinel","cache"),sessionStorage.removeItem("firebase-sentinel"),ob=sessionStorage}catch(pb){ob=new nb}else ob=new nb;function qb(a,b,c,d){this.host=a.toLowerCase();this.Yb=b;this.jb=c;this.da=d||ob.getItem(a)||this.host}function rb(a,b){b!==a.da&&(a.da=b,"s-"===a.da.substr(0,2)&&ob.setItem(a.host,a.da))}qb.prototype.toString=function(){return(this.Yb?"https://":"http://")+this.host};var sb,tb,ub,vb;function wb(){return ba.navigator?ba.navigator.userAgent:l}vb=ub=tb=sb=o;var xb;if(xb=wb()){var yb=ba.navigator;sb=0==xb.indexOf("Opera");tb=!sb&&-1!=xb.indexOf("MSIE");ub=!sb&&-1!=xb.indexOf("WebKit");vb=!sb&&!ub&&"Gecko"==yb.product}var zb=tb,Ab=vb,Bb=ub;var Cb;if(sb&&ba.opera){var Db=ba.opera.version;"function"==typeof Db&&Db()}else Ab?Cb=/rv\:([^\);]+)(\)|;)/:zb?Cb=/MSIE\s+([^\);]+)(\)|;)/:Bb&&(Cb=/WebKit\/(\S+)/),Cb&&Cb.exec(wb());var Eb=l,Fb=l;
function Gb(a,b){ea(a)||g(Error("encodeByteArray takes an array as a parameter"));if(!Eb){Eb={};Fb={};for(var c=0;65>c;c++)Eb[c]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(c),Fb[c]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.".charAt(c)}for(var c=b?Fb:Eb,d=[],e=0;e<a.length;e+=3){var f=a[e],h=e+1<a.length,i=h?a[e+1]:0,m=e+2<a.length,n=m?a[e+2]:0,p=f>>2,f=(f&3)<<4|i>>4,i=(i&15)<<2|n>>6,n=n&63;m||(n=64,h||(i=64));d.push(c[p],c[f],c[i],c[n])}return d.join("")}
;var Hb,Ib=1;Hb=function(){return Ib++};function z(a,b){a||g(Error("Firebase INTERNAL ASSERT FAILED:"+b))}function Jb(a){var b=qa(a),a=new lb;a.update(b);var b=[],c=8*a.Fc;56>a.eb?a.update(a.Ob,56-a.eb):a.update(a.Ob,64-(a.eb-56));for(var d=63;56<=d;d--)a.hc[d]=c&255,c/=256;mb(a,a.hc);for(d=c=0;5>d;d++)for(var e=24;0<=e;e-=8)b[c++]=a.B[d]>>e&255;return Gb(b)}
function Kb(){for(var a="",b=0;b<arguments.length;b++)a=ea(arguments[b])?a+Kb.apply(l,arguments[b]):"object"===typeof arguments[b]?a+y(arguments[b]):a+arguments[b],a+=" ";return a}var Lb=l,Mb=k;function O(){Mb===k&&(Mb=o,Lb===l&&"true"===ob.getItem("logging_enabled")&&Nb(k));if(Lb){var a=Kb.apply(l,arguments);Lb(a)}}function Ob(a){return function(){O(a,arguments)}}
function Pb(){if("undefined"!==typeof console){var a="FIREBASE INTERNAL ERROR: "+Kb.apply(l,arguments);"undefined"!==typeof console.error?console.error(a):console.log(a)}}function Qb(){var a=Kb.apply(l,arguments);g(Error("FIREBASE FATAL ERROR: "+a))}function Rb(){if("undefined"!==typeof console){var a="FIREBASE WARNING: "+Kb.apply(l,arguments);"undefined"!==typeof console.warn?console.warn(a):console.log(a)}}
function Ba(a){return fa(a)&&(a!=a||a==Number.POSITIVE_INFINITY||a==Number.NEGATIVE_INFINITY)}function Sb(a,b){return a!==b?a===l?-1:b===l?1:typeof a!==typeof b?"number"===typeof a?-1:1:a>b?1:-1:0}function Tb(a,b){if(b&&a in b)return b[a];g(Error("Missing required key ("+a+") in object: "+y(b)))}function Ja(a){if("object"!==typeof a||a===l)return y(a);var b=[],c;for(c in a)b.push(c);b.sort();c="{";for(var d=0;d<b.length;d++)0!==d&&(c+=","),c+=y(b[d]),c+=":",c+=Ja(a[b[d]]);return c+"}"}
function Ub(a,b){if(a.length<=b)return[a];for(var c=[],d=0;d<a.length;d+=b)d+b>a?c.push(a.substring(d,a.length)):c.push(a.substring(d,d+b));return c}function Vb(a,b){if("array"==da(a))for(var c=0;c<a.length;++c)b(c,a[c]);else Wb(a,b)}
function Yb(a){z(!Ba(a));var b,c,d,e;0===a?(d=c=0,b=-Infinity===1/a?1:0):(b=0>a,a=Math.abs(a),a>=Math.pow(2,-1022)?(d=Math.min(Math.floor(Math.log(a)/Math.LN2),1023),c=d+1023,d=Math.round(a*Math.pow(2,52-d)-Math.pow(2,52))):(c=0,d=Math.round(a/Math.pow(2,-1074))));e=[];for(a=52;a;a-=1)e.push(d%2?1:0),d=Math.floor(d/2);for(a=11;a;a-=1)e.push(c%2?1:0),c=Math.floor(c/2);e.push(b?1:0);e.reverse();b=e.join("");c="";for(a=0;64>a;a+=8)d=parseInt(b.substr(a,8),2).toString(16),1===d.length&&(d="0"+d),c+=d;
return c.toLowerCase()};function Zb(a,b){this.D=a;z(this.D!==l,"LeafNode shouldn't be created with null value.");this.Sa="undefined"!==typeof b?b:l}r=Zb.prototype;r.J=q(k);r.k=aa("Sa");r.Cb=function(a){return new Zb(this.D,a)};r.R=function(){return P};r.G=function(a){return F(a)===l?this:P};r.V=q(l);r.H=function(a,b){return(new Q(new Ra,this.Sa)).H(a,b)};r.pa=function(a,b){var c=F(a);return c===l?b:this.H(c,P.pa(J(a),b))};r.f=q(o);r.Jb=q(0);
r.T=function(a){return a&&this.k()!==l?{".value":this.j(),".priority":this.k()}:this.j()};r.hash=function(){var a="";this.k()!==l&&(a+="priority:"+$b(this.k())+":");var b=typeof this.D,a=a+(b+":"),a="number"===b?a+Yb(this.D):a+this.D;return Jb(a)};r.j=aa("D");r.toString=function(){return"string"===typeof this.D?'"'+this.D+'"':this.D};function Q(a,b){this.n=a||new Ra;this.Sa="undefined"!==typeof b?b:l}r=Q.prototype;r.J=q(o);r.k=aa("Sa");r.Cb=function(a){return new Q(this.n,a)};r.H=function(a,b){var c=this.n.remove(a);b&&b.f()&&(b=l);b!==l&&(c=c.ja(a,b));return b&&b.k()!==l?new ac(c,l,this.Sa):new Q(c,this.Sa)};r.pa=function(a,b){var c=F(a);if(c===l)return b;var d=this.R(c).pa(J(a),b);return this.H(c,d)};r.f=function(){return this.n.f()};r.Jb=function(){return this.n.count()};var bc=/^\d+$/;r=Q.prototype;
r.T=function(a){if(this.f())return l;var b={},c=0,d=0,e=k;this.w(function(f,h){b[f]=h.T(a);c++;e&&bc.test(f)?d=Math.max(d,Number(f)):e=o});if(!a&&e&&d<2*c){var f=[],h;for(h in b)f[h]=b[h];return f}a&&this.k()!==l&&(b[".priority"]=this.k());return b};r.hash=function(){var a="";this.k()!==l&&(a+="priority:"+$b(this.k())+":");this.w(function(b,c){var d=c.hash();""!==d&&(a+=":"+b+":"+d)});return""===a?"":Jb(a)};r.R=function(a){a=this.n.get(a);return a===l?P:a};
r.G=function(a){var b=F(a);return b===l?this:this.R(b).G(J(a))};r.V=function(a){return Wa(this.n,a)};r.Oc=function(){return this.n.ib()};r.Pc=function(){return this.n.Qa()};r.w=function(a){return this.n.ta(a)};r.mc=function(a){return this.n.Ga(a)};r.Oa=function(){return this.n.Oa()};r.toString=function(){var a="{",b=k;this.w(function(c,d){b?b=o:a+=", ";a+='"'+c+'" : '+d.toString()});return a+="}"};var P=new Q(new Ra);function ac(a,b,c){Q.call(this,a,c);b===l&&(b=new Ra(cc),a.ta(function(a,c){b=b.ja({name:a,wa:c.k()},c)}));this.la=b}ja(ac,Q);r=ac.prototype;r.H=function(a,b){var c=this.R(a),d=this.n,e=this.la;c!==l&&(d=d.remove(a),e=e.remove({name:a,wa:c.k()}));b&&b.f()&&(b=l);b!==l&&(d=d.ja(a,b),e=e.ja({name:a,wa:b.k()},b));return new ac(d,e,this.k())};r.V=function(a,b){var c=Wa(this.la,{name:a,wa:b.k()});return c?c.name:l};r.w=function(a){return this.la.ta(function(b,c){return a(b.name,c)})};
r.mc=function(a){return this.la.Ga(function(b,c){return a(b.name,c)})};r.Oa=function(){return this.la.Oa(function(a,b){return{key:a.name,value:b}})};r.Oc=function(){return this.la.f()?l:this.la.ib().name};r.Pc=function(){return this.la.f()?l:this.la.Qa().name};function R(a,b){if("object"!==typeof a)return new Zb(a,b);if(a===l)return P;var c=l;".priority"in a?c=a[".priority"]:"undefined"!==typeof b&&(c=b);z(c===l||"string"===typeof c||"number"===typeof c);if(".value"in a&&a[".value"]!==l)return new Zb(a[".value"],c);var c=new Q(new Ra,c),d;for(d in a)if(D(a,d)&&"."!==d.substring(0,1)){var e=R(a[d]);if(e.J()||!e.f())c=c.H(d,e)}return c}function cc(a,b){return Sb(a.wa,b.wa)||(a.name!==b.name?a.name<b.name?-1:1:0)}
function $b(a){return"number"===typeof a?"number:"+Yb(a):"string:"+a};function S(a,b){this.z=a;this.Vb=b}S.prototype.T=function(){A("Firebase.DataSnapshot.val",0,0,arguments.length);return this.z.T()};S.prototype.val=S.prototype.T;S.prototype.nd=function(){A("Firebase.DataSnapshot.exportVal",0,0,arguments.length);return this.z.T(k)};S.prototype.exportVal=S.prototype.nd;S.prototype.F=function(a){A("Firebase.DataSnapshot.child",0,1,arguments.length);fa(a)&&(a=String(a));Ga("Firebase.DataSnapshot.child",a);var b=new I(a),c=this.Vb.F(b);return new S(this.z.G(b),c)};
S.prototype.child=S.prototype.F;S.prototype.nc=function(a){A("Firebase.DataSnapshot.hasChild",1,1,arguments.length);Ga("Firebase.DataSnapshot.hasChild",a);var b=new I(a);return!this.z.G(b).f()};S.prototype.hasChild=S.prototype.nc;S.prototype.k=function(){A("Firebase.DataSnapshot.getPriority",0,0,arguments.length);return this.z.k()};S.prototype.getPriority=S.prototype.k;
S.prototype.forEach=function(a){A("Firebase.DataSnapshot.forEach",1,1,arguments.length);C("Firebase.DataSnapshot.forEach",1,a,o);if(this.z.J())return o;var b=this;return this.z.w(function(c,d){return a(new S(d,b.Vb.F(c)))})};S.prototype.forEach=S.prototype.forEach;S.prototype.bb=function(){A("Firebase.DataSnapshot.hasChildren",0,0,arguments.length);return this.z.J()?o:!this.z.f()};S.prototype.hasChildren=S.prototype.bb;
S.prototype.name=function(){A("Firebase.DataSnapshot.name",0,0,arguments.length);return this.Vb.name()};S.prototype.name=S.prototype.name;S.prototype.Jb=function(){A("Firebase.DataSnapshot.numChildren",0,0,arguments.length);return this.z.Jb()};S.prototype.numChildren=S.prototype.Jb;S.prototype.zd=function(){A("Firebase.DataSnapshot.ref",0,0,arguments.length);return this.Vb};S.prototype.ref=S.prototype.zd;function dc(a){this.uc=a;this.Qb=[];this.Ma=0;this.jc=-1;this.Da=l};function Wb(a,b){for(var c in a)b.call(j,a[c],c,a)}function ec(a){var b={},c;for(c in a)b[c]=a[c];return b};function fc(){this.Za={}}function gc(a,b,c){t(c)||(c=1);D(a.Za,b)||(a.Za[b]=0);a.Za[b]+=c}fc.prototype.get=function(){return ec(this.Za)};function hc(a){this.kd=a;this.Hb=l}hc.prototype.get=function(){var a=this.kd.get(),b=ec(a);if(this.Hb)for(var c in this.Hb)b[c]-=this.Hb[c];this.Hb=a;return b};function ic(a,b){this.Dc={};this.ac=new hc(a);this.o=b;setTimeout(v(this.Xc,this),10+6E4*Math.random())}ic.prototype.Xc=function(){var a=this.ac.get(),b={},c=o,d;for(d in a)0<a[d]&&D(this.Dc,d)&&(b[d]=a[d],c=k);c&&(a=this.o,a.U&&(b={c:b},a.e("reportStats",b),a.xa("s",b)));setTimeout(v(this.Xc,this),6E5*Math.random())};var jc={},kc={};function lc(a){a=a.toString();jc[a]||(jc[a]=new fc);return jc[a]};var mc=l;"undefined"!==typeof MozWebSocket?mc=MozWebSocket:"undefined"!==typeof WebSocket&&(mc=WebSocket);function nc(a,b,c){this.kc=a;this.e=Ob(this.kc);this.frames=this.gb=l;this.Ec=0;this.X=lc(b);this.La=(b.Yb?"wss://":"ws://")+b.da+"/.ws?v=5";b.host!==b.da&&(this.La=this.La+"&ns="+b.jb);c&&(this.La=this.La+"&s="+c)}var oc;
nc.prototype.open=function(a,b){this.fa=b;this.wd=a;this.e("websocket connecting to "+this.La);this.W=new mc(this.La);this.$a=o;var c=this;this.W.onopen=function(){c.e("Websocket connected.");c.$a=k};this.W.onclose=function(){c.e("Websocket connection was disconnected.");c.W=l;c.Ea()};this.W.onmessage=function(a){if(c.W!==l)if(a=a.data,gc(c.X,"bytes_received",a.length),pc(c),c.frames!==l)qc(c,a);else{a:{z(c.frames===l,"We already have a frame buffer");if(4>=a.length){var b=Number(a);if(!isNaN(b)){c.Ec=
b;c.frames=[];a=l;break a}}c.Ec=1;c.frames=[]}a!==l&&qc(c,a)}};this.W.onerror=function(a){c.e("WebSocket error. Closing connection.");a.data&&c.e(a.data);c.Ea()}};nc.prototype.start=function(){};nc.isAvailable=function(){return!("undefined"!==typeof navigator&&"Opera"===navigator.appName)&&mc!==l&&!oc};function qc(a,b){a.frames.push(b);if(a.frames.length==a.Ec){var c=a.frames.join("");a.frames=l;c="undefined"!==typeof JSON&&t(JSON.parse)?JSON.parse(c):ka(c);a.wd(c)}}
nc.prototype.send=function(a){pc(this);a=y(a);gc(this.X,"bytes_sent",a.length);a=Ub(a,16384);1<a.length&&this.W.send(String(a.length));for(var b=0;b<a.length;b++)this.W.send(a[b])};nc.prototype.zb=function(){this.Ba=k;this.gb&&(clearTimeout(this.gb),this.gb=l);this.W&&(this.W.close(),this.W=l)};nc.prototype.Ea=function(){this.Ba||(this.e("WebSocket is closing itself"),this.zb(),this.fa&&(this.fa(this.$a),this.fa=l))};nc.prototype.close=function(){this.Ba||(this.e("WebSocket is being closed"),this.zb())};
function pc(a){clearTimeout(a.gb);a.gb=setInterval(function(){a.W.send("0");pc(a)},45E3)};function rc(){this.set={}}r=rc.prototype;r.add=function(a,b){this.set[a]=b!==l?b:k};r.contains=function(a){return D(this.set,a)};r.get=function(a){return this.contains(a)?this.set[a]:j};r.remove=function(a){delete this.set[a]};r.f=function(){var a;a:{for(a in this.set){a=o;break a}a=k}return a};r.count=function(){var a=0,b;for(b in this.set)a++;return a};function sc(a,b){for(var c in a.set)D(a.set,c)&&b(c,a.set[c])}r.keys=function(){var a=[],b;for(b in this.set)D(this.set,b)&&a.push(b);return a};var tc="pLPCommand",uc="pRTLPCB";function vc(a,b,c){this.kc=a;this.e=Ob(a);this.Jd=b;this.X=lc(b);this.$b=c;this.$a=o;this.Db=function(a){b.host!==b.da&&(a.ns=b.jb);var c=[],f;for(f in a)a.hasOwnProperty(f)&&c.push(f+"="+a[f]);return(b.Yb?"https://":"http://")+b.da+"/.lp?"+c.join("&")}}var wc,xc;
vc.prototype.open=function(a,b){function c(){if(!d.Ba){d.ga=new yc(function(a,b,c,e,f){gc(d.X,"bytes_received",y(arguments).length);if(d.ga)if(d.ya&&(clearTimeout(d.ya),d.ya=l),d.$a=k,"start"==a)d.id=b,d.Wc=c;else if("close"===a)if(b){d.ga.Zb=o;var h=d.Sc;h.jc=b;h.Da=function(){d.Ea()};h.jc<h.Ma&&(h.Da(),h.Da=l)}else d.Ea();else g(Error("Unrecognized command received: "+a))},function(a,b){gc(d.X,"bytes_received",y(arguments).length);var c=d.Sc;for(c.Qb[a]=b;c.Qb[c.Ma];){var e=c.Qb[c.Ma];delete c.Qb[c.Ma];
for(var f=0;f<e.length;++f)e[f]&&c.uc(e[f]);if(c.Ma===c.jc){c.Da&&(clearTimeout(c.Da),c.Da(),c.Da=l);break}c.Ma++}},function(){d.Ea()},d.Db);var a={start:"t"};a.ser=Math.floor(1E8*Math.random());d.ga.cc&&(a.cb=d.ga.cc);a.v="5";d.$b&&(a.s=d.$b);a=d.Db(a);d.e("Connecting via long-poll to "+a);zc(d.ga,a,function(){})}}this.Ic=0;this.N=b;this.Sc=new dc(a);this.Ba=o;var d=this;this.ya=setTimeout(function(){d.e("Timed out trying to connect.");d.Ea();d.ya=l},3E4);if("complete"===document.readyState)c();
else{var e=o,f=function(){document.body?e||(e=k,c()):setTimeout(f,10)};document.addEventListener?(document.addEventListener("DOMContentLoaded",f,o),window.addEventListener("load",f,o)):document.attachEvent&&(document.attachEvent("onreadystatechange",function(){"complete"===document.readyState&&f()},o),window.attachEvent("onload",f,o))}};
vc.prototype.start=function(){var a=this.ga,b=this.Wc;a.ud=this.id;a.vd=b;for(a.fc=k;Ac(a););a=this.id;b=this.Wc;this.Ra=document.createElement("iframe");var c={dframe:"t"};c.id=a;c.pw=b;a=this.Db(c);this.Ra.src=a;this.Ra.style.display="none";document.body.appendChild(this.Ra)};vc.isAvailable=function(){return!xc&&!("object"===typeof window&&window.chrome&&window.chrome.extension&&!/^chrome/.test(window.location.href))&&(wc||k)};
vc.prototype.zb=function(){this.Ba=k;this.ga&&(this.ga.close(),this.ga=l);this.Ra&&(document.body.removeChild(this.Ra),this.Ra=l);this.ya&&(clearTimeout(this.ya),this.ya=l)};vc.prototype.Ea=function(){this.Ba||(this.e("Longpoll is closing itself"),this.zb(),this.N&&(this.N(this.$a),this.N=l))};vc.prototype.close=function(){this.Ba||(this.e("Longpoll is being closed."),this.zb())};
vc.prototype.send=function(a){a=y(a);gc(this.X,"bytes_sent",a.length);for(var a=qa(a),a=Gb(a,k),a=Ub(a,1840),b=0;b<a.length;b++){var c=this.ga;c.qb.push({Dd:this.Ic,Id:a.length,Jc:a[b]});c.fc&&Ac(c);this.Ic++}};
function yc(a,b,c,d){this.Db=d;this.fa=c;this.wc=new rc;this.qb=[];this.lc=Math.floor(1E8*Math.random());this.Zb=k;this.cc=Hb();window[tc+this.cc]=a;window[uc+this.cc]=b;a=document.createElement("iframe");a.style.display="none";if(document.body){document.body.appendChild(a);try{a.contentWindow.document||O("No IE domain setting required")}catch(e){a.src="javascript:void((function(){document.open();document.domain='"+document.domain+"';document.close();})())"}}else g("Document body has not initialized. Wait to initialize Firebase until after the document is ready.");
a.contentDocument?a.ra=a.contentDocument:a.contentWindow?a.ra=a.contentWindow.document:a.document&&(a.ra=a.document);this.$=a;a="";"javascript:"===this.$.src.substr(0,11)&&(a='<script>document.domain="'+document.domain+'";<\/script>');a="<html><body>"+a+"</body></html>";try{this.$.ra.open(),this.$.ra.write(a),this.$.ra.close()}catch(f){O("frame writing exception"),f.stack&&O(f.stack),O(f)}}
yc.prototype.close=function(){this.fc=o;if(this.$){this.$.ra.body.innerHTML="";var a=this;setTimeout(function(){a.$!==l&&(document.body.removeChild(a.$),a.$=l)},0)}var b=this.fa;b&&(this.fa=l,b())};
function Ac(a){if(a.fc&&a.Zb&&a.wc.count()<(0<a.qb.length?2:1)){a.lc++;var b={};b.id=a.ud;b.pw=a.vd;b.ser=a.lc;for(var b=a.Db(b),c="",d=0;0<a.qb.length;)if(1870>=a.qb[0].Jc.length+30+c.length){var e=a.qb.shift(),c=c+"&seg"+d+"="+e.Dd+"&ts"+d+"="+e.Id+"&d"+d+"="+e.Jc;d++}else break;var b=b+c,f=a.lc;a.wc.add(f);var h=function(){a.wc.remove(f);Ac(a)},i=setTimeout(h,25E3);zc(a,b,function(){clearTimeout(i);h()});return k}return o}
function zc(a,b,c){setTimeout(function(){try{if(a.Zb){var d=a.$.ra.createElement("script");d.type="text/javascript";d.async=k;d.src=b;d.onload=d.onreadystatechange=function(){var a=d.readyState;if(!a||"loaded"===a||"complete"===a)d.onload=d.onreadystatechange=l,d.parentNode&&d.parentNode.removeChild(d),c()};d.onerror=function(){O("Long-poll script failed to load: "+b);a.Zb=o;a.close()};a.$.ra.body.appendChild(d)}}catch(e){}},1)};function Bc(){var a=[];Vb(Cc,function(b,c){c&&c.isAvailable()&&a.push(c)});this.bc=a}var Cc=[vc,{isAvailable:q(o)},nc];function Dc(a,b,c,d,e,f){this.id=a;this.e=Ob("c:"+this.id+":");this.uc=c;this.mb=d;this.N=e;this.tc=f;this.P=b;this.Pb=[];this.Hc=0;this.Gc=new Bc;this.na=0;this.e("Connection created");Ec(this)}function Ec(a){var b;var c=a.Gc;0<c.bc.length?b=c.bc[0]:g(Error("No transports available"));a.I=new b("c:"+a.id+":"+a.Hc++,a.P);var d=Fc(a,a.I),e=Gc(a,a.I);a.Ab=a.I;a.wb=a.I;a.A=l;setTimeout(function(){a.I&&a.I.open(d,e)},0)}
function Gc(a,b){return function(c){b===a.I?(a.I=l,!c&&0===a.na?(a.e("Realtime connection failed."),"s-"===a.P.da.substr(0,2)&&(ob.removeItem(a.P.jb),a.P.da=a.P.host)):1===a.na&&a.e("Realtime connection lost."),a.close()):b===a.A?(c=a.A,a.A=l,(a.Ab===c||a.wb===c)&&a.close()):a.e("closing an old connection")}}
function Fc(a,b){return function(c){if(2!=a.na)if(b===a.wb){var d=Tb("t",c),c=Tb("d",c);if("c"==d){if(d=Tb("t",c),"d"in c)if(c=c.d,"h"===d){var d=c.ts,e=c.v,f=c.h;a.$b=c.s;rb(a.P,f);if(0==a.na&&(a.I.start(),c=a.I,a.e("Realtime connection established."),a.I=c,a.na=1,a.mb&&(a.mb(d),a.mb=l),"5"!==e&&Rb("Protocol version mismatch detected"),c=1<a.Gc.bc.length?a.Gc.bc[1]:l))a.A=new c("c:"+a.id+":"+a.Hc++,a.P,a.$b),a.A.open(Fc(a,a.A),Gc(a,a.A))}else if("n"===d){a.e("recvd end transmission on primary");
a.wb=a.A;for(c=0;c<a.Pb.length;++c)a.Mb(a.Pb[c]);a.Pb=[];Hc(a)}else"s"===d?(a.e("Connection shutdown command received. Shutting down..."),a.tc&&(a.tc(c),a.tc=l),a.N=l,a.close()):"r"===d?(a.e("Reset packet received. New host: "+c),rb(a.P,c),1===a.na?a.close():(Ic(a),Ec(a))):Pb("Unknown control packet command: "+d)}else"d"==d&&a.Mb(c)}else b===a.A?(d=Tb("t",c),c=Tb("d",c),"c"==d?"t"in c&&(c=c.t,"a"===c?(a.A.start(),a.e("sending client ack on secondary"),a.A.send({t:"c",d:{t:"a",d:{}}}),a.e("Ending transmission on primary"),
a.I.send({t:"c",d:{t:"n",d:{}}}),a.Ab=a.A,Hc(a)):"r"===c&&(a.e("Got a reset on secondary, closing it"),a.A.close(),(a.Ab===a.A||a.wb===a.A)&&a.close())):"d"==d?a.Pb.push(c):g(Error("Unknown protocol layer: "+d))):a.e("message on old connection")}}Dc.prototype.zc=function(a){a={t:"d",d:a};1!==this.na&&g("Connection is not connected");this.Ab.send(a)};function Hc(a){a.Ab===a.A&&a.wb===a.A&&(a.e("cleaning up and promoting a connection: "+a.A.kc),a.I=a.A,a.A=l)}Dc.prototype.Mb=function(a){this.uc(a)};
Dc.prototype.close=function(){2!==this.na&&(this.e("Closing realtime connection."),this.na=2,Ic(this),this.N&&(this.N(),this.N=l))};function Ic(a){a.e("Shutting down all connections");a.I&&(a.I.close(),a.I=l);a.A&&(a.A.close(),a.A=l)};function Jc(a,b,c,d,e){this.id=Kc++;this.e=Ob("p:"+this.id+":");this.yb=k;this.ea={};this.S=[];this.nb=0;this.lb=[];this.U=o;this.Ub=1E3;this.Nb=b||ca;this.Lb=c||ca;this.kb=d||ca;this.vc=e||ca;this.P=a;this.yc=l;this.Rb=[];this.ub={};this.Cd=0;this.hb=this.Rc=l;setTimeout(v(this.Kc,this),0)}var Kc=0,Lc=0;r=Jc.prototype;r.xa=function(a,b,c){var d=++this.Cd,a={r:d,a:a,b:b};this.e(y(a));this.U?this.sb.zc(a):this.Rb.push(a);c&&(this.ub[d]=c)};
function Mc(a,b,c,d,e){a.e("Listen on "+b+" for "+c);var f={p:b},d=jb(d,function(a){return Ia(a)});"{}"!==c&&(f.q=d);a.xa("l",f,function(d){a.e("listen response",d);d=d.s;"ok"!==d&&Nc(a,b,c);e&&e(d)})}r.Ya=function(a,b,c){this.za={ld:a,Mc:o,ha:b,Fb:c};this.e("Authenticating using credential: "+this.za);Oc(this)};r.Bb=function(){delete this.za;this.kb(o);this.U&&this.xa("unauth",{})};
function Oc(a){var b=a.za;a.U&&b&&a.xa("auth",{cred:b.ld},function(c){var d=c.s,c=c.d||"error";"ok"!==d&&a.za===b&&delete a.za;b.Mc?"ok"!==d&&b.Fb&&b.Fb(d,c):(b.Mc=k,b.ha&&b.ha(d,c));a.kb("ok"===d)})}r.ed=function(a,b,c){a=a.toString();Nc(this,a,b)&&this.U&&(this.e("Unlisten on "+a+" for "+b),a={p:a},c=jb(c,function(a){return Ia(a)}),"{}"!==b&&(a.q=c),this.xa("u",a))};function Pc(a,b,c,d){a.U?Qc(a,"o",b,c,d):a.lb.push({xc:b,action:"o",data:c,C:d})}
r.sc=function(a,b){this.U?Qc(this,"oc",a,l,b):this.lb.push({xc:a,action:"oc",data:l,C:b})};function Qc(a,b,c,d,e){c={p:c,d:d};a.e("onDisconnect "+b,c);a.xa(b,c,function(a){e&&setTimeout(function(){e(a.s)},0)})}r.put=function(a,b,c,d){Rc(this,"p",a,b,c,d)};function Rc(a,b,c,d,e,f){c={p:c,d:d};t(f)&&(c.h=f);a.S.push({action:b,Yc:c,C:e});a.nb++;b=a.S.length-1;a.U&&Sc(a,b)}
function Sc(a,b){var c=a.S[b].action,d=a.S[b].Yc,e=a.S[b].C;a.S[b].yd=a.U;a.xa(c,d,function(d){a.e(c+" response",d);delete a.S[b];a.nb--;0===a.nb&&(a.S=[]);e&&e(d.s)})}
r.Mb=function(a){if("r"in a){this.e("from server: "+y(a));var b=a.r,c=this.ub[b];c&&(delete this.ub[b],c(a.b))}else"error"in a&&g("A server-side error has occurred: "+a.error),"a"in a&&(b=a.a,a=a.b,this.e("handleServerMessage",b,a),"d"===b?this.Nb(a.p,a.d):"m"===b?this.Nb(a.p,a.d,k):"c"===b?(b=a.p,a=(a=a.q)?jb(a,function(a){return Ja(a)}).join("$"):"{}",(a=Nc(this,b,a))&&a.C&&a.C("permission_denied")):"ac"===b?(b=a.s,a=a.d,c=this.za,delete this.za,c&&c.Fb&&c.Fb(b,a),this.kb(o)):"sd"===b?this.yc?this.yc(a):
"msg"in a&&"undefined"!==typeof console&&console.log("FIREBASE: "+a.msg.replace("\n","\nFIREBASE: ")):Pb("Unrecognized action received from server: "+y(b)+"\nAre you using the latest client?"))};
r.mb=function(a){this.e("connection ready");this.U=k;this.hb=(new Date).getTime();this.vc({Kd:a-(new Date).getTime()});for(a=0;a<this.Rb.length;a++)this.sb.zc(this.Rb[a]);this.Rb=[];Oc(this);for(a=0;a<this.S.length;a++)this.S[a]&&Sc(this,a);for(var b in this.ea)for(var c in this.ea[b])a=this.ea[b][c],Mc(this,b,c,a.Ta,a.C);for(;this.lb.length;)b=this.lb.shift(),Qc(this,b.action,b.xc,b.data,b.C);this.Lb(k)};
r.Uc=function(){this.U=o;this.e("data client disconnected");for(var a=v(function(){this.Kc()},this),b=0;b<this.S.length;b++){var c=this.S[b];c&&("h"in c.Yc&&c.yd)&&(c.C&&c.C("disconnect"),delete this.S[b],this.nb--)}0===this.nb&&(this.S=[]);if(this.yb)this.hb&&(3E4<(new Date).getTime()-this.hb&&(this.Ub=1E3),this.hb=l),b=Math.max(0,this.Ub-((new Date).getTime()-this.Rc)),b*=Math.random(),this.e("Trying to reconnect in "+b+"ms"),setTimeout(a,b),this.Ub=Math.min(3E5,1.3*this.Ub);else{for(var d in this.ub)delete this.ub[d];
this.$c=function(){setTimeout(a,0)}}this.Lb(o)};r.Kc=function(){if(this.yb){this.e("Making a connection attempt");this.Rc=(new Date).getTime();this.hb=l;var a=v(this.Mb,this),b=v(this.mb,this),c=v(this.Uc,this),d=this.id+":"+Lc++,e=this;this.sb=new Dc(d,this.P,a,b,c,function(a){e.yb=o;g(Error(a))})}};r.Pa=function(){this.yb=o;this.sb?this.sb.close():this.Uc()};r.vb=function(){this.yb=k;this.$c();this.$c=j};
function Nc(a,b,c){b=(new I(b)).toString();c||(c="{}");var d=a.ea[b][c];delete a.ea[b][c];return d};function Tc(){this.n=this.D=l}function Uc(a,b,c){if(b.f())a.D=c,a.n=l;else if(a.D!==l)a.D=a.D.pa(b,c);else{a.n==l&&(a.n=new rc);var d=F(b);a.n.contains(d)||a.n.add(d,new Tc);a=a.n.get(d);b=J(b);Uc(a,b,c)}}function Vc(a,b){if(b.f())return a.D=l,a.n=l,k;if(a.D!==l){if(a.D.J())return o;var c=a.D;a.D=l;c.w(function(b,c){Uc(a,new I(b),c)});return Vc(a,b)}return a.n!==l?(c=F(b),b=J(b),a.n.contains(c)&&Vc(a.n.get(c),b)&&a.n.remove(c),a.n.f()?(a.n=l,k):o):k}
function Wc(a,b,c){a.D!==l?c(b,a.D):a.w(function(a,e){var f=new I(b.toString()+"/"+a);Wc(e,f,c)})}Tc.prototype.w=function(a){this.n!==l&&sc(this.n,function(b,c){a(b,c)})};function Xc(){this.Ha=P}function T(a,b){return a.Ha.G(b)}function U(a,b,c){a.Ha=a.Ha.pa(b,c)}Xc.prototype.toString=function(){return this.Ha.toString()};function Yc(){this.xb=new Xc;this.L=new Xc;this.Ia=new Xc;this.pb=new Na}function Zc(a,b){for(var c=T(a.xb,b),d=T(a.L,b),e=L(a.pb,b),f=o,h=e;h!==l;){if(h.j()!==l){f=k;break}h=h.parent()}if(f)return o;c=$c(c,d,e);return c!==d?(U(a.L,b,c),k):o}function $c(a,b,c){if(c.f())return a;if(c.j()!==l)return b;a=a||P;c.w(function(d){var d=d.name(),e=a.R(d),f=b.R(d),h=L(c,d),e=$c(e,f,h);a=a.H(d,e)});return a}
Yc.prototype.set=function(a,b){var c=this,d=[];ib(b,function(a){var b=a.path,a=a.Ca,h=Hb();N(L(c.pb,b),h);U(c.L,b,a);d.push({path:b,Ed:h})});return d};function ad(a,b){ib(b,function(b){var d=b.Ed,b=L(a.pb,b.path),e=b.j();z(e!==l,"pendingPut should not be null.");e===d&&N(b,l)})};function bd(){this.Aa=[]}function cd(a,b){if(0!==b.length){a.Aa.push.apply(a.Aa,b);for(var c=0;c<a.Aa.length;c++)if(a.Aa[c]){var d=a.Aa[c];a.Aa[c]=l;var e=d.ha;e(d.bd,d.rb)}a.Aa=[]}};function V(a,b,c,d){this.type=a;this.ka=b;this.Y=c;this.rb=d};function dd(a){this.M=a;this.ia=[];this.Lc=new bd}function ed(a,b,c,d,e){a.ia.push({type:b,ha:c,cancel:d,Z:e});var d=[],f=fd(a.g);a.fb&&f.push(new V("value",a.g));for(var h=0;h<f.length;h++)if(f[h].type===b){var i=new W(a.M.u,a.M.path);f[h].Y&&(i=i.F(f[h].Y));d.push({ha:e?v(c,e):c,bd:new S(f[h].ka,i),rb:f[h].rb})}cd(a.Lc,d)}dd.prototype.Sb=function(a,b){b=this.Tb(a,b);b!=l&&gd(this,b)};
function gd(a,b){for(var c=[],d=0;d<b.length;d++){var e=b[d],f=e.type,h=new W(a.M.u,a.M.path);b[d].Y&&(h=h.F(b[d].Y));h=new S(b[d].ka,h);"value"===e.type&&!h.bb()?f+="("+h.T()+")":"value"!==e.type&&(f+=" "+h.name());O(a.M.u.o.id+": event:"+a.M.path+":"+a.M.Fa()+":"+f);for(f=0;f<a.ia.length;f++){var i=a.ia[f];b[d].type===i.type&&c.push({ha:i.Z?v(i.ha,i.Z):i.ha,bd:h,rb:e.rb})}}cd(a.Lc,c)}function fd(a){var b=[];if(!a.J()){var c=l;a.w(function(a,e){b.push(new V("child_added",e,a,c));c=a})}return b}
function hd(a){a.fb||(a.fb=k,gd(a,[new V("value",a.g)]))};function kd(a,b){dd.call(this,a);this.g=b}ja(kd,dd);kd.prototype.Tb=function(a,b){this.g=a;this.fb&&b!=l&&b.push(new V("value",this.g));return b};kd.prototype.ab=function(){return{}};function ld(a,b){this.Gb=a;this.rc=b}
function md(a,b,c,d,e){var f=a.G(c),h=b.G(c),d=new ld(d,e),e=nd(d,c,f,h),i=o;if(!f.f()&&!h.f()&&f.k()!==h.k())var i=a.G(c.parent()),m=b.G(c.parent()),n=Ka(c),i=i.V(n,f)!=m.V(n,h);if(e||i){f=c;c=e;for(h=i;f.parent()!==l;){var p=a.G(f),e=b.G(f),i=f.parent();if(!d.Gb||L(d.Gb,i).j())m=b.G(i),n=[],f=Ka(f),p.f()?(p=m.V(f,e),n.push(new V("child_added",e,f,p))):e.f()?n.push(new V("child_removed",p,f)):(p=m.V(f,e),h&&n.push(new V("child_moved",e,f,p)),c&&n.push(new V("child_changed",e,f,p))),d.rc(i,m,n);h&&
(h=o,c=k);f=i}}}function nd(a,b,c,d){var e,f=[];c===d?e=o:c.J()&&d.J()?e=c.j()!==d.j():c.J()?(od(a,b,P,d,f),e=k):d.J()?(od(a,b,c,P,f),e=k):e=od(a,b,c,d,f);e?a.rc(b,d,f):c.k()!==d.k()&&a.rc(b,d,l);return e}
function od(a,b,c,d,e){var f=o,h=!a.Gb||!L(a.Gb,b).f(),i=[],m=[],n=[],p=[],s={},w={},x,M,K,G;x=c.Oa();K=Ya(x);M=d.Oa();for(G=Ya(M);K!==l||G!==l;){c=K===l?1:G===l?-1:K.key===G.key?0:cc({name:K.key,wa:K.value.k()},{name:G.key,wa:G.value.k()});if(0>c)f=ta(s,K.key),t(f)?(n.push({Nc:K,dd:i[f]}),i[f]=l):(w[K.key]=m.length,m.push(K)),f=k,K=Ya(x);else{if(0<c)f=ta(w,G.key),t(f)?(n.push({Nc:m[f],dd:G}),m[f]=l):(s[G.key]=i.length,i.push(G)),f=k;else{c=b.F(G.key);if(c=nd(a,c,K.value,G.value))p.push(G),f=k;K=
Ya(x)}G=Ya(M)}if(!h&&f)return k}for(h=0;h<m.length;h++)if(s=m[h])c=b.F(s.key),nd(a,c,s.value,P),e.push(new V("child_removed",s.value,s.key));for(h=0;h<i.length;h++)if(s=i[h])c=b.F(s.key),m=d.V(s.key,s.value),nd(a,c,P,s.value),e.push(new V("child_added",s.value,s.key,m));for(h=0;h<n.length;h++)s=n[h].Nc,i=n[h].dd,c=b.F(i.key),m=d.V(i.key,i.value),e.push(new V("child_moved",i.value,i.key,m)),(c=nd(a,c,s.value,i.value))&&p.push(i);for(h=0;h<p.length;h++)a=p[h],m=d.V(a.key,a.value),e.push(new V("child_changed",
a.value,a.key,m));return f};function pd(){this.O=this.oa=l;this.set={}}ja(pd,rc);r=pd.prototype;r.setActive=function(a){this.oa=a};function qd(a){return a.contains("default")}function rd(a){return a.oa!=l&&qd(a)}r.defaultView=function(){return qd(this)?this.get("default"):l};r.path=aa("O");r.toString=function(){return jb(this.keys(),function(a){return"default"===a?"{}":a}).join("$")};r.Ta=function(){var a=[];sc(this,function(b,c){a.push(c.M)});return a};function sd(a,b){dd.call(this,a);this.g=P;this.Tb(b,fd(b))}ja(sd,dd);
sd.prototype.Tb=function(a,b){if(b===l)return b;var c=[],d=this.M;t(d.ca)&&(t(d.ma)&&d.ma!=l?c.push(function(a,b){var c=Sb(b,d.ca);return 0<c||0===c&&a>=d.ma}):c.push(function(a,b){return 0<=Sb(b,d.ca)}));t(d.sa)&&(t(d.Na)?c.push(function(a,b){var c=Sb(b,d.sa);return 0>c||0===c&&a<=d.Na}):c.push(function(a,b){return 0>=Sb(b,d.sa)}));var e=l,f=l;if(t(this.M.ua))if(t(this.M.ca)){if(e=td(a,c,this.M.ua,o)){var h=a.R(e).k();c.push(function(a,b){var c=Sb(b,h);return 0>c||0===c&&a<=e})}}else if(f=td(a,c,
this.M.ua,k)){var i=a.R(f).k();c.push(function(a,b){var c=Sb(b,i);return 0<c||0===c&&a>=f})}for(var m=[],n=[],p=[],s=[],w=0;w<b.length;w++){var x=b[w].Y,M=b[w].ka;switch(b[w].type){case "child_added":ud(c,x,M)&&(this.g=this.g.H(x,M),n.push(b[w]));break;case "child_removed":this.g.R(x).f()||(this.g=this.g.H(x,l),m.push(b[w]));break;case "child_changed":!this.g.R(x).f()&&ud(c,x,M)&&(this.g=this.g.H(x,M),s.push(b[w]));break;case "child_moved":var K=!this.g.R(x).f(),G=ud(c,x,M);K?G?(this.g=this.g.H(x,
M),p.push(b[w])):(m.push(new V("child_removed",this.g.R(x),x)),this.g=this.g.H(x,l)):G&&(this.g=this.g.H(x,M),n.push(b[w]))}}var id=e||f;if(id){var jd=(w=f!==l)?this.g.Oc():this.g.Pc(),Xb=o,Ta=o,Ua=this;(w?a.mc:a.w).call(a,function(a,b){!Ta&&jd===l&&(Ta=k);if(Ta&&Xb)return k;Xb?(m.push(new V("child_removed",Ua.g.R(a),a)),Ua.g=Ua.g.H(a,l)):Ta&&(n.push(new V("child_added",b,a)),Ua.g=Ua.g.H(a,b));jd===a&&(Ta=k);a===id&&(Xb=k)})}for(w=0;w<n.length;w++)c=n[w],x=this.g.V(c.Y,c.ka),m.push(new V("child_added",
c.ka,c.Y,x));for(w=0;w<p.length;w++)c=p[w],x=this.g.V(c.Y,c.ka),m.push(new V("child_moved",c.ka,c.Y,x));for(w=0;w<s.length;w++)c=s[w],x=this.g.V(c.Y,c.ka),m.push(new V("child_changed",c.ka,c.Y,x));this.fb&&0<m.length&&m.push(new V("value",this.g));return m};function td(a,b,c,d){if(a.J())return l;var e=l;(d?a.mc:a.w).call(a,function(a,d){if(ud(b,a,d)&&(e=a,c--,0===c))return k});return e}function ud(a,b,c){for(var d=0;d<a.length;d++)if(!a[d](b,c.k()))return o;return k}
sd.prototype.nc=function(a){return this.g.R(a)!==P};sd.prototype.ab=function(a,b,c){var d={};this.g.J()||this.g.w(function(a){d[a]=k});var e=this.g,c=T(c,new I("")),f=new Na;N(L(f,this.M.path),k);var h=P.pa(a,b),i=[];md(c,h,a,f,function(a,b,c){c!==l&&(i=i.concat(c))});this.Tb(b,i);this.g.J()||this.g.w(function(a){d[a]=k});this.g=e;return d};function vd(a,b){this.o=a;this.i=b;this.Tc=b.Ha;this.qa=new Na}
vd.prototype.Eb=function(a,b,c,d,e){var f=a.path,h=L(this.qa,f),i=h.j();i===l?(i=new pd,N(h,i)):z(!i.f(),"We shouldn't be storing empty QueryMaps");var m=a.Fa();if(i.contains(m))ed(i.get(m),b,c,d,e);else{var n=this.i.Ha.G(f),a="default"===a.Fa()?new kd(a,n):new sd(a,n);if(rd(i)||wd(h))i.add(m,a),i.O||(i.O=a.M.path);else{var p,s;i.f()||(p=i.toString(),s=i.Ta());i.add(m,a);i.O||(i.O=a.M.path);i.setActive(xd(this,i));p&&s&&this.o.ed(i.path(),p,s)}rd(i)&&Pa(h,function(a){if(a=a.j()){a.oa&&a.oa();a.oa=
l}});ed(a,b,c,d,e);(b=(b=Qa(L(this.qa,f),function(a){var b;if(b=a.j())if(b=a.j().defaultView())b=a.j().defaultView().fb;if(b)return k},k))||this.o===l)&&hd(a)}};function yd(a,b,c,d,e){for(var f=a.get(b),h=o,i=f.ia.length-1;0<=i;i--){var m=f.ia[i];if((!c||m.type===c)&&(!d||m.ha===d)&&(!e||m.Z===e))if(f.ia.splice(i,1),h=k,c&&d)break}(c=h&&!(0<f.ia.length))&&a.remove(b);return c}vd.prototype.Wb=function(a,b,c,d){var e=L(this.qa,a.path).j();return e===l?l:zd(this,e,a,b,c,d)};
function zd(a,b,c,d,e,f){var h=b.path(),h=L(a.qa,h),c=c?c.Fa():l,i=[];c&&"default"!==c?yd(b,c,d,e,f)&&i.push(c):ib(b.keys(),function(a){yd(b,a,d,e,f)&&i.push(a)});b.f()&&N(h,l);c=wd(h);if(0<i.length&&!c){for(var m=h,n=h.parent(),c=o;!c&&n;){var p=n.j();if(p){z(!rd(p));var s=m.name(),w=o;sc(p,function(a,b){w=b.nc(s)||w});w&&(c=k)}m=n;n=n.parent()}m=l;if(!rd(b)){n=b.oa;b.oa=l;var x=[],M=function(b){var c=b.j();if(c&&qd(c))x.push(c.path()),c.oa==l&&c.setActive(xd(a,c));else{if(c){c.oa!=l||c.setActive(xd(a,
c));var d={};sc(c,function(a,b){b.g.w(function(a){D(d,a)||(d[a]=k,a=c.path().F(a),x.push(a))})})}b.w(M)}};M(h);m=x;n&&n()}return c?l:m}return l}function Ad(a,b,c){Pa(L(a.qa,b),function(a){(a=a.j())&&sc(a,function(a,b){hd(b)})},c,k)}function Bd(a,b,c){function d(a){for(var b=0;b<c.length;++b)if(c[b].contains(a))return k;return o}var e=a.Tc,f=a.i.Ha;a.Tc=f;md(e,f,b,a.qa,function(c,e,f){if(b.contains(c)){var n=d(c);n&&Ad(a,c,o);a.Sb(c,e,f);n&&Ad(a,c,k)}else a.Sb(c,e,f)});d(b)&&Ad(a,b,k)}
vd.prototype.Sb=function(a,b,c){a=L(this.qa,a).j();a!==l&&sc(a,function(a,e){e.Sb(b,c)})};function wd(a){return Qa(a,function(a){return a.j()&&rd(a.j())})}
function xd(a,b){if(a.o){var c=b.keys(),d=a.o,e=function(d){"ok"!==d?(Rb("on() or once() for "+b.path().toString()+" failed: "+d),b&&sc(b,function(a,b){for(var c=0;c<b.ia.length;c++){var d=b.ia[c];d.cancel&&(d.Z?v(d.cancel,d.Z):d.cancel)()}}),zd(a,b)):ib(c,function(a){(a=b.get(a))&&hd(a)})},f=b.toString(),h=b.path().toString();d.ea[h]=d.ea[h]||{};z(!d.ea[h][f],"listen() called twice for same path/queryId.");d.ea[h][f]={Ta:b.Ta(),C:e};d.U&&Mc(d,h,f,b.Ta(),e);return v(a.o.ed,a.o,b.path(),b.toString(),
b.Ta())}return ca}vd.prototype.ab=function(a,b,c,d){var e={};sc(b,function(b,h){var i=h.ab(a,c,d);Wb(i,function(a,b){e[b]=a?k:ta(e,b)||o})});c.J()||c.w(function(a){D(e,a)||(e[a]=o)});return e};
function Cd(a,b,c,d,e,f){var h=b.path();if(f!==l){var i=[];d.J()||d.w(function(a,b){i.push({path:h.F(a),Ca:b});delete f[a]});Wb(f,function(a,b){i.push({path:h.F(b),Ca:P})});return i}var b=a.ab(h,b,d,e),m=P,n=[];Wb(b,function(b,f){var h=new I(f);b?m=m.H(f,d.G(h)):n=n.concat(Dd(a,d.G(h),L(c,h),e))});return[{path:h,Ca:m}].concat(n)}
function Ed(a,b,c,d,e){for(var f=L(a.qa,b),h=f.parent(),i=o;!i&&h!==l;){var m=h.j();m!==l&&(qd(m)?i=k:(m=a.ab(b,m,c,d),f=f.name(),ta(m,f)&&(i=k)));f=h;h=h.parent()}if(i)return[{path:b,Ca:c}];h=L(a.qa,b);i=h.j();return i!==l?qd(i)?[{path:b,Ca:c}]:Cd(a,i,h,c,d,e):Dd(a,c,h,d)}function Dd(a,b,c,d){var e=c.j();if(e!==l)return qd(e)?[{path:c.path(),Ca:b}]:Cd(a,e,c,b,d,l);if(b.J())return[];var f=[];b.w(function(b,e){var m=new I(b);f=f.concat(Dd(a,e,L(c,m),d))});return f};function Fd(a){this.P=a;this.X=lc(a);this.o=new Jc(this.P,v(this.Nb,this),v(this.Lb,this),v(this.kb,this),v(this.vc,this));var b=v(function(){return new ic(this.X,this.o)},this),a=a.toString();kc[a]||(kc[a]=b());this.cd=kc[a];this.Wa=new Na;this.Xa=new Xc;this.i=new Yc;this.Q=new vd(this.o,this.i.Ia);this.oc=new Xc;this.pc=new vd(l,this.oc);Gd(this,"connected",o);Gd(this,"authenticated",o);Gd(this,"serverTimeOffset",l);this.N=new Tc}r=Fd.prototype;
r.toString=function(){return(this.P.Yb?"https://":"http://")+this.P.host};r.name=function(){return this.P.jb};
r.Nb=function(a,b,c){var d=[];if(9<=a.length&&a.lastIndexOf(".priority")===a.length-9)a=new I(a.substring(0,a.length-9)),c=T(this.i.xb,a).Cb(b),d.push(a);else if(c){var a=new I(a),c=T(this.i.xb,a),e;for(e in b){var f=new I(e),c=c.pa(f,R(b[e]));d.push(a.F(e))}}else a=new I(a),c=R(b),d.push(a);b=Ed(this.Q,a,c,this.i.L,l);e=o;for(c=0;c<b.length;++c){var f=b[c],h=this.i,i=f.path;U(h.xb,i,f.Ca);e=Zc(h,i)||e}e&&(a=Hd(this,a));Bd(this.Q,a,d)};
r.Lb=function(a){Gd(this,"connected",a);if(a===o){this.e("onDisconnectEvents");var b=this,c=[];Wc(this.N,new I(""),function(a,e){var f=Ed(b.Q,a,e,b.i.L,l);c.push.apply(c,b.i.set(a,f));f=Id(b,a);Hd(b,f);Bd(b.Q,f,[a])});ad(this.i,c);this.N=new Tc}};r.vc=function(a){var b=this;Vb(a,function(a,d){Gd(b,d,a)})};r.kb=function(a){Gd(this,"authenticated",a)};function Gd(a,b,c){b=new I("/.info/"+b);U(a.oc,b,R(c));Bd(a.pc,b,[b])}
r.Ya=function(a,b,c){this.o.Ya(a,function(a,c){X(b,a,c)},function(a,b){Rb("auth() was canceled: "+b);if(c){var f=Error(b);f.code=a.toUpperCase();c(f)}})};r.Bb=function(){this.o.Bb()};r.Va=function(a,b,c,d){this.e("set",{path:a.toString(),value:b});var b=R(b,c),c=Ed(this.Q,a,b,this.i.L,l),e=this.i.set(a,c),f=this;this.o.put(a.toString(),b.T(k),function(b){var c="ok"===b;ad(f.i,e);c||(Rb("set at "+a+" failed: "+b),Zc(f.i,a),c=Hd(f,a),Bd(f.Q,c,[]));X(d,b)});b=Id(this,a);Hd(this,b);Bd(this.Q,b,[a])};
r.update=function(a,b,c){this.e("update",{path:a.toString(),value:b});var d=T(this.i.Ia,a),e=k,f=[],h;for(h in b){var e=o,i=R(b[h]),d=d.H(h,i);f.push(a.F(h))}if(e)O("update() called with empty data. Don't do anything."),X(c,"ok");else{var d=Ed(this.Q,a,d,this.i.L,b),m=this.i.set(a,d),n=this;Rc(this.o,"m",a.toString(),b,function(b){z("ok"===b||"permission_denied"===b,"merge at "+a+" failed.");ad(n.i,m);X(c,b)},j);b=Id(this,a);Hd(this,b);Bd(n.Q,b,f)}};
r.Ac=function(a,b,c){this.e("setPriority",{path:a.toString(),wa:b});var d=T(this.i.L,a).Cb(b),d=Ed(this.Q,a,d,this.i.L,l),e=this.i.set(a,d),f=this;this.o.put(a.toString()+"/.priority",b,function(a){ad(f.i,e);X(c,a)});a=Hd(this,a);Bd(f.Q,a,[])};r.sc=function(a,b){var c=this;this.o.sc(a.toString(),function(d){"ok"===d&&Vc(c.N,a);X(b,d)})};function Jd(a,b,c,d){var e=R(c);Pc(a.o,b.toString(),e.T(k),function(c){"ok"===c&&Uc(a.N,b,e);X(d,c)})}
function Kd(a){gc(a.X,"deprecated_on_disconnect");a.cd.Dc.deprecated_on_disconnect=k}r.Eb=function(a,b,c,d,e){".info"===F(a.path)?this.pc.Eb(a,b,c,d,e):this.Q.Eb(a,b,c,d,e)};r.Wb=function(a,b,c,d){".info"===F(a.path)?this.pc.Wb(a,b,c,d):this.Q.Wb(a,b,c,d)};r.Pa=function(){this.o.Pa()};r.vb=function(){this.o.vb()};
r.Bc=function(a){if("undefined"!==typeof console){a?(this.ac||(this.ac=new hc(this.X)),a=this.ac.get()):a=this.X.get();var b=a,c=[],d=0,e;for(e in b)c[d++]=e;var f=function(a,b){return Math.max(b.length,a)};if(c.reduce)e=c.reduce(f,0);else{var h=0;ib(c,function(a){h=f.call(j,h,a)});e=h}for(var i in a){b=a[i];for(c=i.length;c<e+2;c++)i+=" ";console.log(i+b)}}};r.Cc=function(a){gc(this.X,a);this.cd.Dc[a]=k};r.e=function(){O("r:"+this.o.id+":",arguments)};
function X(a,b,c){if(a)if("ok"==b)a(l,c);else{var d=b=(b||"error").toUpperCase();c&&(d+=": "+c);c=Error(d);c.code=b;a(c)}};function Ld(a,b){var c=b||a.Wa;b||Md(a,c);if(c.j()!==l){var d=Nd(a,c);z(0<d.length);if(2!==d[0].status&&4!==d[0].status){for(var e=c.path(),f=0;f<d.length;f++)z(1===d[f].status,"tryToSendTransactionQueue_: items in queue should all be run."),d[f].status=2,d[f].ad++;c=T(a.i.L,e).hash();U(a.i.L,e,T(a.i.Ia,e));for(var h=T(a.Xa,e).T(k),i=Hb(),m={},n=0;n<d.length;n++)d[n].gc&&(m[d[n].path.toString()]=d[n].path);var p=[],s;for(s in m)p.push(m[s]);for(f=0;f<p.length;f++)N(L(a.i.pb,p[f]),i);a.o.put(e.toString(),
h,function(b){a.e("transaction put response",{path:e.toString(),status:b});for(f=0;f<p.length;f++){var c=L(a.i.pb,p[f]),h=c.j();z(h!==l,"sendTransactionQueue_: pendingPut should not be null.");h===i&&(N(c,l),U(a.i.L,p[f],T(a.i.xb,p[f])))}if("ok"===b){b=[];for(f=0;f<d.length;f++)d[f].status=3,d[f].C&&(c=Od(a,d[f].path),b.push(v(d[f].C,l,l,k,c))),d[f].dc();Md(a,L(a.Wa,e));Ld(a);for(f=0;f<b.length;f++)b[f]()}else{if("datastale"===b)for(f=0;f<d.length;f++)d[f].status=4===d[f].status?5:1;else{Rb("transaction at "+
e+" failed: "+b);for(f=0;f<d.length;f++)d[f].status=5,d[f].ec=b}b=Hd(a,e);Bd(a.Q,b,[e])}},c)}}else c.bb()&&c.w(function(b){Ld(a,b)})}
function Hd(a,b){var c=Pd(a,b),d=c.path(),e=Nd(a,c);U(a.i.Ia,d,T(a.i.L,d));U(a.Xa,d,T(a.i.L,d));if(0!==e.length){for(var f=c=T(a.i.Ia,d),h=[],i=0;i<e.length;i++){var m=La(d,e[i].path),n=o,p;z(m!==l,"rerunTransactionsUnderNode_: relativePath should not be null.");if(5===e[i].status)n=k,p=e[i].ec;else if(1===e[i].status)if(25<=e[i].ad)n=k,p="maxretry";else{var s=e[i].update(c.G(m).T());t(s)?(za("transaction failed: Data returned ",s),s=R(s),c=c.pa(m,s),e[i].gc&&(f=f.pa(m,s))):(n=k,p="nodata")}n&&(e[i].dc(),
e[i].status=3,e[i].C&&(n=new W(a,e[i].path),m=new S(c.G(m),n),"nodata"===p?h.push(v(e[i].C,l,l,o,m)):h.push(v(e[i].C,l,Error(p),o,m))))}p=T(a.i.L,d).k();c=c.Cb(p);f=f.Cb(p);U(a.Xa,d,c);U(a.i.Ia,d,f);Md(a,a.Wa);for(i=0;i<h.length;i++)h[i]();Ld(a)}return d}function Pd(a,b){for(var c,d=a.Wa;(c=F(b))!==l&&d.j()===l;)d=L(d,c),b=J(b);return d}function Nd(a,b){var c=[];Qd(a,b,c);c.sort(function(a,b){return a.Vc-b.Vc});return c}
function Qd(a,b,c){var d=b.j();if(d!==l)for(var e=0;e<d.length;e++)c.push(d[e]);b.w(function(b){Qd(a,b,c)})}function Md(a,b){var c=b.j();if(c){for(var d=0,e=0;e<c.length;e++)3!==c[e].status&&(c[d]=c[e],d++);c.length=d;N(b,0<c.length?c:l)}b.w(function(b){Md(a,b)})}function Id(a,b){var c=Pd(a,b).path(),d=L(a.Wa,b);Qa(d,function(a){Rd(a)});Rd(d);Pa(d,function(a){Rd(a)});return c}
function Rd(a){var b=a.j();if(b!==l){for(var c=[],d=-1,e=0;e<b.length;e++)4!==b[e].status&&(2===b[e].status?(z(d===e-1,"All SENT items should be at beginning of queue."),d=e,b[e].status=4,b[e].ec="set"):(z(1===b[e].status),b[e].dc(),b[e].C&&c.push(v(b[e].C,l,Error("set"),o,l))));-1===d?N(a,l):b.length=d+1;for(e=0;e<c.length;e++)c[e]()}}function Od(a,b){var c=new W(a,b);return new S(T(a.Xa,b),c)};function Y(){this.Ua={}}Y.qd=function(){return Y.Qc?Y.Qc:Y.Qc=new Y};Y.prototype.Pa=function(){for(var a in this.Ua)this.Ua[a].Pa()};Y.prototype.interrupt=Y.prototype.Pa;Y.prototype.vb=function(){for(var a in this.Ua)this.Ua[a].vb()};Y.prototype.resume=Y.prototype.vb;var Z={rd:function(a){var b=Q.prototype.hash;Q.prototype.hash=a;var c=Zb.prototype.hash;Zb.prototype.hash=a;return function(){Q.prototype.hash=b;Zb.prototype.hash=c}}};Z.hijackHash=Z.rd;Z.Fa=function(a){return a.Fa()};Z.queryIdentifier=Z.Fa;Z.td=function(a){return a.u.o.ea};Z.listens=Z.td;Z.Ad=function(a){return a.u.o.sb};Z.refConnection=Z.Ad;Z.gd=Jc;Z.DataConnection=Z.gd;Jc.prototype.sendRequest=Jc.prototype.xa;Jc.prototype.interrupt=Jc.prototype.Pa;Z.hd=Dc;Z.RealTimeConnection=Z.hd;
Dc.prototype.sendRequest=Dc.prototype.zc;Dc.prototype.close=Dc.prototype.close;Z.fd=qb;Z.ConnectionTarget=Z.fd;Z.od=function(){wc=oc=k};Z.forceLongPolling=Z.od;Z.pd=function(){xc=k};Z.forceWebSockets=Z.pd;Z.Gd=function(a,b){a.u.o.yc=b};Z.setSecurityDebugCallback=Z.Gd;Z.Bc=function(a,b){a.u.Bc(b)};Z.stats=Z.Bc;Z.Cc=function(a,b){a.u.Cc(b)};Z.statsIncrementCounter=Z.Cc;function $(a,b,c){this.tb=a;this.O=b;this.va=c}$.prototype.cancel=function(a){A("Firebase.onDisconnect().cancel",0,1,arguments.length);C("Firebase.onDisconnect().cancel",1,a,k);this.tb.sc(this.O,a)};$.prototype.cancel=$.prototype.cancel;$.prototype.remove=function(a){A("Firebase.onDisconnect().remove",0,1,arguments.length);E("Firebase.onDisconnect().remove",this.O);C("Firebase.onDisconnect().remove",1,a,k);Jd(this.tb,this.O,l,a)};$.prototype.remove=$.prototype.remove;
$.prototype.set=function(a,b){A("Firebase.onDisconnect().set",1,2,arguments.length);E("Firebase.onDisconnect().set",this.O);ya("Firebase.onDisconnect().set",a,o);C("Firebase.onDisconnect().set",2,b,k);Jd(this.tb,this.O,a,b)};$.prototype.set=$.prototype.set;
$.prototype.Va=function(a,b,c){A("Firebase.onDisconnect().setWithPriority",2,3,arguments.length);E("Firebase.onDisconnect().setWithPriority",this.O);ya("Firebase.onDisconnect().setWithPriority",a,o);Da("Firebase.onDisconnect().setWithPriority",2,b,o);C("Firebase.onDisconnect().setWithPriority",3,c,k);(".length"===this.va||".keys"===this.va)&&g("Firebase.onDisconnect().setWithPriority failed: "+this.va+" is a read-only object.");var d=this.tb,e=this.O,f=R(a,b);Pc(d.o,e.toString(),f.T(k),function(a){"ok"===
a&&Uc(d.N,e,f);X(c,a)})};$.prototype.setWithPriority=$.prototype.Va;
$.prototype.update=function(a,b){A("Firebase.onDisconnect().update",1,2,arguments.length);E("Firebase.onDisconnect().update",this.O);Ca("Firebase.onDisconnect().update",a);C("Firebase.onDisconnect().update",2,b,k);var c=this.tb,d=this.O,e=k,f;for(f in a)e=o;if(e)O("onDisconnect().update() called with empty data. Don't do anything."),X(b,k);else{e=c.o;f=d.toString();var h=function(e){if("ok"===e)for(var f in a){var h=R(a[f]);Uc(c.N,d.F(f),h)}X(b,e)};e.U?Qc(e,"om",f,a,h):e.lb.push({xc:f,action:"om",
data:a,C:h})}};$.prototype.update=$.prototype.update;var Sd,Td=0,Ud=[];Sd=function(a){var b=a===Td;Td=a;for(var c=Array(8),d=7;0<=d;d--)c[d]="-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz".charAt(a%64),a=Math.floor(a/64);z(0===a);a=c.join("");if(b){for(d=11;0<=d&&63===Ud[d];d--)Ud[d]=0;Ud[d]++}else for(d=0;12>d;d++)Ud[d]=Math.floor(64*Math.random());for(d=0;12>d;d++)a+="-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz".charAt(Ud[d]);z(20===a.length,"NextPushId: Length should be 20.");return a};function W(){var a,b,c;if(arguments[0]instanceof Fd)c=arguments[0],a=arguments[1];else{A("new Firebase",1,2,arguments.length);var d=arguments[0];b=a="";var e=k,f="";if(u(d)){var h=d.indexOf("//");if(0<=h)var i=d.substring(0,h-1),d=d.substring(h+2);h=d.indexOf("/");-1===h&&(h=d.length);a=d.substring(0,h);var d=d.substring(h+1),m=a.split(".");if(3==m.length){h=m[2].indexOf(":");e=0<=h?"https"===i:k;if("firebase"===m[1])Qb(a+" is no longer supported. Please use <YOUR FIREBASE>.firebaseio.com instead");
else{b=m[0];f="";d=("/"+d).split("/");for(i=0;i<d.length;i++)if(0<d[i].length){h=d[i];try{h=decodeURIComponent(h.replace(/\+/g," "))}catch(n){}f+="/"+h}}b=b.toLowerCase()}else b=l}e||"undefined"!==typeof window&&(window.location&&window.location.protocol&&-1!==window.location.protocol.indexOf("https:"))&&Rb("Insecure Firebase access from a secure page. Please use https in calls to new Firebase().");a=new qb(a,e,b);b=new I(f);e=b.toString();if(!(d=!u(a.host)))if(!(d=0===a.host.length))if(!(d=!xa(a.jb)))if(d=
0!==e.length)e&&(e=e.replace(/^\/*\.info(\/|$)/,"/")),d=!(u(e)&&0!==e.length&&!wa.test(e));d&&g(Error(B("new Firebase",1,o)+'must be a valid firebase URL and the path can\'t contain ".", "#", "$", "[", or "]".'));arguments[1]?arguments[1]instanceof Y?c=arguments[1]:g(Error("Expected a valid Firebase.Context for second argument to new Firebase()")):c=Y.qd();e=a.toString();d=ta(c.Ua,e);d||(d=new Fd(a),c.Ua[e]=d);c=d;a=b}H.call(this,c,a)}ja(W,H);var Vd=W,Wd=["Firebase"],Xd=ba;
!(Wd[0]in Xd)&&Xd.execScript&&Xd.execScript("var "+Wd[0]);for(var Yd;Wd.length&&(Yd=Wd.shift());)!Wd.length&&t(Vd)?Xd[Yd]=Vd:Xd=Xd[Yd]?Xd[Yd]:Xd[Yd]={};W.prototype.name=function(){A("Firebase.name",0,0,arguments.length);return this.path.f()?l:Ka(this.path)};W.prototype.name=W.prototype.name;
W.prototype.F=function(a){A("Firebase.child",1,1,arguments.length);if(fa(a))a=String(a);else if(!(a instanceof I))if(F(this.path)===l){var b=a;b&&(b=b.replace(/^\/*\.info(\/|$)/,"/"));Ga("Firebase.child",b)}else Ga("Firebase.child",a);return new W(this.u,this.path.F(a))};W.prototype.child=W.prototype.F;W.prototype.parent=function(){A("Firebase.parent",0,0,arguments.length);var a=this.path.parent();return a===l?l:new W(this.u,a)};W.prototype.parent=W.prototype.parent;
W.prototype.root=function(){A("Firebase.ref",0,0,arguments.length);for(var a=this;a.parent()!==l;)a=a.parent();return a};W.prototype.root=W.prototype.root;W.prototype.toString=function(){A("Firebase.toString",0,0,arguments.length);var a;if(this.parent()===l)a=this.u.toString();else{a=this.parent().toString()+"/";var b=this.name();a+=encodeURIComponent(String(b))}return a};W.prototype.toString=W.prototype.toString;
W.prototype.set=function(a,b){A("Firebase.set",1,2,arguments.length);E("Firebase.set",this.path);ya("Firebase.set",a,o);C("Firebase.set",2,b,k);return this.u.Va(this.path,a,l,b)};W.prototype.set=W.prototype.set;W.prototype.update=function(a,b){A("Firebase.update",1,2,arguments.length);E("Firebase.update",this.path);Ca("Firebase.update",a);C("Firebase.update",2,b,k);return this.u.update(this.path,a,b)};W.prototype.update=W.prototype.update;
W.prototype.Va=function(a,b,c){A("Firebase.setWithPriority",2,3,arguments.length);E("Firebase.setWithPriority",this.path);ya("Firebase.setWithPriority",a,o);Da("Firebase.setWithPriority",2,b,o);C("Firebase.setWithPriority",3,c,k);(".length"===this.name()||".keys"===this.name())&&g("Firebase.setWithPriority failed: "+this.name()+" is a read-only object.");return this.u.Va(this.path,a,b,c)};W.prototype.setWithPriority=W.prototype.Va;
W.prototype.remove=function(a){A("Firebase.remove",0,1,arguments.length);E("Firebase.remove",this.path);C("Firebase.remove",1,a,k);this.set(l,a)};W.prototype.remove=W.prototype.remove;
W.prototype.transaction=function(a,b,c){function d(){}A("Firebase.transaction",1,3,arguments.length);E("Firebase.transaction",this.path);C("Firebase.transaction",1,a,o);C("Firebase.transaction",2,b,k);t(c)&&"boolean"!=typeof c&&g(Error(B("Firebase.transaction",3,k)+"must be a boolean."));(".length"===this.name()||".keys"===this.name())&&g("Firebase.transaction failed: "+this.name()+" is a read-only object.");"undefined"===typeof c&&(c=k);var e=this.u,f=this.path,h=c;e.e("transaction on "+f);var i=
new W(e,f);i.qc("value",d);var h={path:f,update:a,C:b,status:l,Vc:Hb(),gc:h,ad:0,dc:function(){i.Kb("value",d)},ec:l},m=h.update(T(e.Xa,f).T());if(t(m)){za("transaction failed: Data returned ",m);h.status=1;var n=L(e.Wa,f),p=n.j()||[];p.push(h);N(n,p);n=T(e.i.L,f).k();U(e.Xa,f,R(m,n));h.gc&&(U(e.i.Ia,f,R(m,n)),Bd(e.Q,f,[f]));Ld(e)}else h.dc(),h.C&&(e=Od(e,f),h.C(l,o,e))};W.prototype.transaction=W.prototype.transaction;
W.prototype.Ac=function(a,b){A("Firebase.setPriority",1,2,arguments.length);E("Firebase.setPriority",this.path);Da("Firebase.setPriority",1,a,o);C("Firebase.setPriority",2,b,k);this.u.Ac(this.path,a,b)};W.prototype.setPriority=W.prototype.Ac;
W.prototype.push=function(a,b){A("Firebase.push",0,2,arguments.length);E("Firebase.push",this.path);ya("Firebase.push",a,k);C("Firebase.push",2,b,k);var c=T(this.u.oc,new I(".info/serverTimeOffset")).T()||0,c=Sd((new Date).getTime()+c),c=this.F(c);"undefined"!==typeof a&&a!==l&&c.set(a,b);return c};W.prototype.push=W.prototype.push;W.prototype.fa=function(){return new $(this.u,this.path,this.name())};W.prototype.onDisconnect=W.prototype.fa;
W.prototype.Bd=function(){Rb("FirebaseRef.removeOnDisconnect() being deprecated. Please use FirebaseRef.onDisconnect().remove() instead.");this.fa().remove();Kd(this.u)};W.prototype.removeOnDisconnect=W.prototype.Bd;W.prototype.Fd=function(a){Rb("FirebaseRef.setOnDisconnect(value) being deprecated. Please use FirebaseRef.onDisconnect().set(value) instead.");this.fa().set(a);Kd(this.u)};W.prototype.setOnDisconnect=W.prototype.Fd;
W.prototype.Ya=function(a,b,c){A("Firebase.auth",1,3,arguments.length);u(a)||g(Error(B("Firebase.auth",1,o)+"must be a valid credential (a string)."));C("Firebase.auth",2,b,k);C("Firebase.auth",3,b,k);this.u.Ya(a,b,c)};W.prototype.auth=W.prototype.Ya;W.prototype.Bb=function(){this.u.Bb()};W.prototype.unauth=W.prototype.Bb;
function Nb(a,b){z(!b||a===k||a===o,"Can't turn on custom loggers persistently.");a===k?("undefined"!==typeof console&&("function"===typeof console.log?Lb=v(console.log,console):"object"===typeof console.log&&(Lb=function(a){console.log(a)})),b&&ob.setItem("logging_enabled","true")):a?Lb=a:(Lb=l,ob.removeItem("logging_enabled"))}W.enableLogging=Nb;W.INTERNAL=Z;W.Context=Y;})();
(function(){window.DataChannel=function(n,k){if(n){this.automatic=true}this.channel=n;k=k||{};var r=this,i,p,m;this.onmessage=function(t,s){console.debug(s,"sent message:",t)};this.channels={};this.onopen=function(s){r.send(s,"is connected with you.")};this.onclose=function(s){console.error("data channel closed:",s)};this.onerror=function(s){console.error("data channel error:",s)};this.onFileReceived=function(s){console.debug("File <",s,"> received successfully.")};this.onFileSent=function(s){console.debug("File <",s.name,"> sent successfully.")};this.onFileProgress=function(s){console.debug("<",s.remaining,"> items remaining.")};function j(t){if(k.openSignalingChannel){r.openSignalingChannel=k.openSignalingChannel}if(!r.openSignalingChannel){if(typeof k.transmitRoomOnce=="undefined"){k.transmitRoomOnce=true}r.openSignalingChannel=function(v){v=v||{};n=v.channel||r.channel||"default-channel";var u=new window.Firebase("https://"+(k.firebase||r.firebase||"chat")+".firebaseIO.com/"+n);u.channel=n;u.on("child_added",function(x){var w=x.val();if(w=="joking"){v.onopen&&v.onopen()}else{v.onmessage(w)}});u.send=function(w){this.push(w)};u.push("joking");r.socket=u;return u};if(!window.Firebase){var s=document.createElement("script");s.src="https://cdn.firebase.com/v0/firebase.js";s.onload=function(){l(t)};document.documentElement.appendChild(s)}else{l(t)}}else{t()}}function l(t){if(!window.Firebase){return t()}var s=new Firebase("https://"+(k.firebase||r.firebase||"chat")+".firebaseIO.com/.info/connected");s.on("value",function(u){if(u.val()===true){if(r.onDefaultSocketOpened){r.onDefaultSocketOpened()}t();console.log("firebase socket is connected")}})}function q(){if(r.config){return}r.config={openSocket:function(s){return r.openSignalingChannel(s)},onRoomFound:function(s){if(r.joinedARoom){return}r.joinedARoom=true;i.joinRoom({roomToken:s.roomToken,joinUser:s.broadcaster})},onChannelOpened:function(s,t){r.onopen(s,t);r.channels[s]={channel:t,send:function(u){r.send(u,this.channel)}}},onChannelMessage:function(t,s){if(IsDataChannelSupported&&!t.size){t=JSON.parse(t)}if(!IsDataChannelSupported){if(t.userid===window.userid){return}t=t.message}if(t.type==="text"){m.receive(t,r.onmessage,s)}else{if(t.size||t.type==="file"){p.receive(t,r.config)}else{r.onmessage(t,s)}}},direction:k.direction||r.direction||"many-to-many",onChannelClosed:function(s){r.onclose(s)},onChannelError:function(s){r.onerror(s)},onFileReceived:function(s){r.onFileReceived(s)},onFileProgress:function(s){r.onFileProgress(s)},channel:r.channel,onleave:function(s){r.onleave(s)},transmitRoomOnce:!!k.transmitRoomOnce};i=IsDataChannelSupported?new c(r.config):new a(r.config);p=new f();m=new e()}this.open=function(s){r.joinedARoom=true;if(s){r.channel=s}o(true);j(function(){q();if(IsDataChannelSupported){i.createRoom()}});if(r.socket){r.socket.onDisconnect().remove()}};this.connect=function(s){if(s){r.channel=s}o(false);j(q)};if(this.automatic){this.connect();this.onDefaultSocketOpened=function(){if(r.isDefaultSocketOpened){return}r.isDefaultSocketOpened=true;if(!r.joinedARoom){setTimeout(function(){if(!r.joinedARoom){r.open()}},1500)}}}this.send=function(t,s){if(!t){throw"No file, data or text message to share."}if(t.size){b.send({file:t,channel:i,onFileSent:function(u){r.onFileSent(u)},onFileProgress:function(u){r.onFileProgress(u)},_channel:s})}else{h.send({text:t,channel:i,_channel:s})}};this.onleave=function(s){console.debug(s,"left!")};this.leave=function(s){if(typeof s==="function"){var u=s;s=null}if(!s){i.leaving=true;(function t(){if(i.left){u&&u()}else{setTimeout(t,100)}})()}i.leave(s)};function o(s){r.defaults={isInitiator:s};r.reconnect=function(){if(r.joinedARoom){r.leave()}r.joinedARoom=false;if(r.defaults.isInitiator){r.open()}else{r.connect()}}}};window.moz=!!navigator.mozGetUserMedia;window.IsDataChannelSupported=!((moz&&!navigator.mozGetUserMedia)||(!moz&&!navigator.webkitGetUserMedia));function d(j){var p=window,t=p.mozRTCPeerConnection||p.webkitRTCPeerConnection,u=p.mozRTCSessionDescription||p.RTCSessionDescription,s=p.mozRTCIceCandidate||p.RTCIceCandidate;var v={iceServers:[{url:!moz?"stun:stun.l.google.com:19302":"stun:23.21.150.121"}]};var z={optional:[]};if(!moz){z.optional=[{RtpDataChannels:true}]}var k=new t(v,z);i();k.onicecandidate=q;function q(w){if(!w.candidate||!k){return}if(j.onICE){j.onICE(w.candidate)}}var y=j.constraints||{optional:[],mandatory:{OfferToReceiveAudio:!!moz,OfferToReceiveVideo:!!moz}};function o(){if(!j.onOfferSDP){return}k.createOffer(function(w){k.setLocalDescription(w);j.onOfferSDP(w)},null,y)}function m(){if(!j.onAnswerSDP){return}j.offerSDP=new u(j.offerSDP);k.setRemoteDescription(j.offerSDP);k.createAnswer(function(w){k.setLocalDescription(w);j.onAnswerSDP(w)},null,y)}if((j.onChannelMessage&&!moz)||!j.onChannelMessage){o();m()}var A;function i(){if(!j.onChannelMessage||(moz&&!j.onOfferSDP)){return}l();if(moz&&!j.attachStream){navigator.mozGetUserMedia({audio:true,fake:true},function(w){k.addStream(w);o()},r)}}function l(){A=k.createDataChannel(j.channel||"RTCDataChannel",moz?{}:{reliable:false});if(moz){A.binaryType="blob"}x()}function x(){A.onmessage=function(w){if(j.onChannelMessage){j.onChannelMessage(w)}};A.onopen=function(){if(j.onChannelOpened){j.onChannelOpened(A)}};A.onclose=function(w){if(j.onChannelClosed){j.onChannelClosed(w)}};A.onerror=function(w){console.error(w);if(j.onChannelError){j.onChannelError(w)}}}if(j.onAnswerSDP&&moz){n()}function n(){k.ondatachannel=function(w){A=w.channel;A.binaryType="blob";x()};if(moz&&!j.attachStream){navigator.mozGetUserMedia({audio:true,fake:true},function(w){k.addStream(w);m()},r)}}function r(){}return{addAnswerSDP:function(w){w=new u(w);k.setRemoteDescription(w)},addICE:function(w){k.addIceCandidate(new s({sdpMLineIndex:w.sdpMLineIndex,candidate:w.candidate}))},peer:k,channel:A,sendData:function(w){A&&A.send(w)}}}function c(n){var v={userToken:p(),sockets:[],socketObjects:{}},t="--",s,o=true,i={},l=[];function r(){i=n.openSocket({onmessage:k})}function k(w){if(w.userToken==v.userToken){return}if(o&&w.roomToken&&w.broadcaster){n.onRoomFound(w)}if(w.newParticipant){m(w.newParticipant)}if(w.userToken&&w.joinUser==v.userToken&&w.participant&&t.indexOf(w.userToken)==-1){t+=w.userToken+"--";console.debug("A person whose id is",w.userToken||w.channel,"particiated with me!");j({isofferer:true,channel:w.channel||w.userToken,closeSocket:true})}}function j(E){if(!E.channel){return}var F={channel:E.channel,onmessage:B,onopen:function(){if(G&&!C){w()}v.socketObjects[F.channel]=H;v.sockets[v.sockets.length]=H}};var H=n.openSocket(F),G=E.isofferer,z,J={},C;var D={onICE:function(K){H&&H.send({userToken:v.userToken,candidate:{sdpMLineIndex:K.sdpMLineIndex,candidate:JSON.stringify(K.candidate)}})},onChannelOpened:y,onChannelMessage:function(K){if(n.onChannelMessage){n.onChannelMessage(K.data,E.userid)}},onChannelClosed:n.onChannelClosed,onChannelError:n.onChannelError};function w(K){if(n.direction==="one-to-one"&&window.isFirstConnectionOpened){return}if(!K){D.onOfferSDP=I}else{D.offerSDP=K;D.onAnswerSDP=I}C=d(D)}function y(K){l[l.length]=K;if(n.onChannelOpened){n.onChannelOpened(E.userid,K)}if(n.direction==="many-to-many"&&s&&t.split("--").length>3){console.debug("It is time to transmit participant's details: ",H.channel);i.send({newParticipant:H.channel,userToken:v.userToken})}window.isFirstConnectionOpened=z=true}function I(K){K=JSON.stringify(K);var M=parseInt(K.length/3);var N=K.slice(0,M),L=K.slice(M,K.length-1),O="";if(K.length>M+M){L=K.slice(M,M+M);O=K.slice(M+M,K.length)}H.send({userToken:v.userToken,firstPart:N});H.send({userToken:v.userToken,secondPart:L});H.send({userToken:v.userToken,thirdPart:O})}function B(K){if(K.userToken==v.userToken){return}console.log(K);if(K.firstPart||K.secondPart||K.thirdPart){if(K.firstPart){E.userid=K.userToken;J.firstPart=K.firstPart;if(J.secondPart&&J.thirdPart){x()}}if(K.secondPart){J.secondPart=K.secondPart;if(J.firstPart&&J.thirdPart){x()}}if(K.thirdPart){J.thirdPart=K.thirdPart;if(J.firstPart&&J.secondPart){x()}}}if(K.candidate&&!z){C&&C.addICE({sdpMLineIndex:K.candidate.sdpMLineIndex,candidate:JSON.parse(K.candidate.candidate)})}if(K.left){if(C&&C.peer){C.peer.close();C.peer=null}if(K.closeEntireSession){q()}else{if(H){H.send({left:true,userToken:v.userToken});H=null}}if(n.onleave){n.onleave(K.userToken)}}}var A=false;function x(){if(A){return}A=true;J.sdp=JSON.parse(J.firstPart+J.secondPart+J.thirdPart);if(G){C.addAnswerSDP(J.sdp)}else{w(J.sdp)}}}function m(x){if(!x||t.indexOf(x)!=-1||x==v.userToken){return}t+=x+"--";var w=p();j({channel:w,closeSocket:true});i.send({participant:true,userToken:v.userToken,joinUser:x,channel:w})}function p(){return Math.round(Math.random()*60535)+500000}function q(B){var C={left:true,userToken:v.userToken};if(s){C.closeEntireSession=true}if(!B){var z=v.sockets,A=z.length;for(var y=0;y<A;y++){if(z[y]){z[y].send(C);delete z[y]}}A=l.length;for(y=0;y<A;y++){var x=l[y];if(x){x.close();delete l[y]}}u.left=true}if(B){var w=v.socketObjects[B];if(w){w.send(C);delete v.socketObjects[B]}}}var u=this;window.onunload=function(){q()};r();return{createRoom:function(){v.roomToken=p();s=true;o=false;(function w(){i.send({roomToken:v.roomToken,broadcaster:v.userToken});if(!n.transmitRoomOnce&&!u.leaving){if(n.direction==="one-to-one"){if(!window.isFirstConnectionOpened){setTimeout(w,3000)}}else{setTimeout(w,3000)}}})()},joinRoom:function(w){v.roomToken=w.roomToken;o=false;j({channel:v.userToken});i.send({participant:true,userToken:v.userToken,joinUser:w.joinUser})},send:function(A,x){var w=l,B,z=w.length;if(!z){return}if(moz&&A.file){B=A.file}else{B=JSON.stringify(A)}if(x){x.send(B)}else{for(var y=0;y<z;y++){w[y].send(B)}}},leave:function(w){q(w);if(!w){v.joinedARoom=s=false;o=true}}}}function a(i){var j=i.openSocket({channel:i.channel,onopen:i.onChannelOpened,onmessage:i.onChannelMessage});return{send:function(k){j.send({userid:userid,message:k})}}}window.userid=Math.round(Math.random()*60535)+5000;var b={send:function(j){var p=j.channel,l=j._channel,k=j.file;if(moz&&IsDataChannelSupported){p.send({fileName:k.name,type:"file"},l);p.send({file:k},l);if(j.onFileSent){j.onFileSent(k)}}if(!IsDataChannelSupported||!moz){var m=new window.FileReader();m.readAsDataURL(k);m.onload=q}var o=1000,r="",i=0,n=0;function q(s,u){var t={type:"file"};if(s){u=s.target.result;i=n=t.packets=parseInt(u.length/o)}if(j.onFileProgress){j.onFileProgress({remaining:n--,length:i,sent:i-n})}if(u.length>o){t.message=u.slice(0,o)}else{t.message=u;t.last=true;t.name=k.name;if(j.onFileSent){j.onFileSent(k)}}p.send(t,l);r=u.slice(t.message.length);if(r.length){setTimeout(function(){q(null,r)},500)}}}};function f(){var j=[],m="",l=0,i=0;function k(p,o){if(moz){if(p.fileName){m=p.fileName}if(p.size){var n=new window.FileReader();n.readAsDataURL(p);n.onload=function(q){g.SaveToDisk(q.target.result,m);if(o.onFileReceived){o.onFileReceived(m)}}}}if(!moz){if(p.packets){i=l=parseInt(p.packets)}if(o.onFileProgress){o.onFileProgress({remaining:l--,length:i,received:i-l})}j.push(p.message);if(p.last){g.SaveToDisk(j.join(""),p.name);if(o.onFileReceived){o.onFileReceived(p.name)}j=[]}}}return{receive:k}}var g={SaveToDisk:function(j,l){var k=document.createElement("a");k.href=j;k.target="_blank";k.download=l||j;var i=document.createEvent("MouseEvents");i.initMouseEvent("click",true,true,window,1,0,0,0,0,false,false,false,false,0,null);k.dispatchEvent(i);(window.URL||window.webkitURL).revokeObjectURL(k.href)}};var h={send:function(m){var o=m.channel,l=m._channel,i=m.text,p=1000,n="",k=false;if(typeof i!=="string"){k=true;i=JSON.stringify(i)}if(IsDataChannelSupported&&(moz||i.length<=p)){o.send(m.text,l)}else{j(i)}function j(q,s){var r={type:"text"};if(q){s=q;r.packets=parseInt(s.length/p)}if(s.length>p){r.message=s.slice(0,p)}else{r.message=s;r.last=true;r.isobject=k}o.send(r,l);n=s.slice(r.message.length);if(n.length){setTimeout(function(){j(null,n)},500)}}}};function e(){var i=[];function j(l,m,k){i.push(l.message);if(l.last){i=i.join("");if(l.isobject){i=JSON.parse(i)}if(m){m(i,k)}i=[]}}return{receive:j}}})();
</script>
<!-- <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> -->
<!-- <script type="text/javascript">!window.jQuery && document.write('<script type="text/javascript" src="jquery.min.js"><\/script>');</script>
<!--<script type="text/javascript" src="https://raw.github.com/openpgpjs/openpgpjs/master/resources/openpgp.min.js"></script>-->
<!-- <script type="text/javascript" src="https://raw.github.com/dreamingofelectricsheep/openpgpjs/utf8/resources/openpgp.min.js"></script> -->
<!-- <script type="text/javascript">!window.openpgp && document.write('<script type="text/javascript" src="openpgp.min.js"><\/script>');</script>
<!-- <script type="text/javascript" src="https://cdn.firebase.com/v0/firebase.js"></script> -->
<!-- <script type="text/javascript">!window.Firebase && document.write('<script type="text/javascript" src="firebase.js"><\/script>');</script>
<!-- <script type="text/javascript" src="https://webrtc-experiment.appspot.com/DataChannel.js"></script> -->
<!--<script type="text/javascript" src="https://raw.github.com/muaz-khan/WebRTC-Experiment/master/DataChannel/DataChannel.js"></script>-->
<!-- <script type="text/javascript">!window.DataChannel && document.write('<script type="text/javascript" src="DataChannel.js"><\/script>');</script> -->
<style>
html, body {
margin: 0;
padding: 0;
}
label { font-weight: bold; }
[class^="lang-"], .collapse { display: none; }
.lang-en { display: inline; }
.langselect {
position: fixed;
top: 0px;
right: 2px;
}
.langselect a {
color: #666;
text-decoration: none;
}
div[role="main"] {
width: 520px;
margin: 0 auto;
padding: 0px 6px 0px 6px;
}
#received {
width: 100%;
height: 300px;
}
textarea { width: 100%; }
.box {
border: solid #222 1px;
border-radius: 9px;
padding: 0px 6px 0px 6px;
background-color: #eee;
}
h3 {
font-weight: lighter;
}
.sign {
display: inline-block;
width: 8px;
margin: 4px -4px 4px -3px;
padding: 0px 5px 0px 5px;
text-align: center;
}
.collapse-title { cursor: pointer; }
.collapse { margin: 0px 8px 6px 0px; }
hr {
border: none;
border-bottom: 1px dashed #888;
height: 1px;
}
</style>
<script type="text/javascript">
var urlvars = {};
location.hash.substr(1).split(';').map(function(v){v=v.split('=');urlvars[v[0]]=v[1]});
function updurlhash() {
var h = '#';
for (var k in urlvars) {
if (typeof urlvars[k] == 'undefined')
delete urlvars[k];
else
h += k + '=' + urlvars[k] + ';';
}
location.hash = h.slice(0, -1);
}
function setlang(lang) {
$('[class^=\'lang-\']').hide();
$('.lang-' + lang).css('display', 'inline');
urlvars.lang = lang;
updurlhash();
}
function savekeys() {
localStorage.scPublicKey = $('#mypublickey').val();
localStorage.scPrivateKey = $('#myprivatekey').val();
localStorage.scPrivateKeypass = $('#myprivatekeypass').val();
localStorage.scUserName = $('#username').val();
}
function showMessages(str) {
$('footer').html($('footer').html() + str);
};
openpgp_encoding_armor_addheader = function(){return '\r\n'};
function genkeys() {
if (parseInt($('#mykeystrength').val()) < 1024) $('#mykeystrength').val('1024');
openpgp.init();
if ($('#myprivatekeypass').val())
window.keypair = openpgp.generate_key_pair(1, $('#mykeystrength').val(), $('#username').val(), $('#myprivatekeypass').val());
else
window.keypair = openpgp.generate_key_pair(1, $('#mykeystrength').val(), $('#username').val());
$('#mypublickey').val($.trim(keypair.publicKeyArmored));
$('#myprivatekey').val($.trim(keypair.privateKeyArmored));
}
function pgpcrypt() {
openpgp.init();
var pub_key = openpgp.read_publicKey($('#mypublickey').val());
var priv_key = openpgp.read_privateKey($('#myprivatekey').val());
if (!priv_key[0].decryptSecretMPIs($('#myprivatekeypass').val())) {
util.print_error("Password for secrect key was incorrect!");
return;
}
if ($('#tosend').val()) $('#encmessage').val($.trim(openpgp.write_signed_and_encrypted_message(priv_key[0], pub_key, $('#tosend').val())));
if (!$('#encmessage').val()) return;
openpgp.keyring.importPublicKey($('#mypublickey').val());
try {
var msg = openpgp.read_message($('#encmessage').val());
} catch(err) {
if (err instanceof TypeError) return;
throw err;
}
var keymat = null;
var sesskey = null;
for (var i = 0; i < msg[0].sessionKeys.length; i++) {
if (priv_key[0].privateKeyPacket.publicKey.getKeyId() == msg[0].sessionKeys[i].keyId.bytes) {
keymat = { key: priv_key[0], keymaterial: priv_key[0].privateKeyPacket};
sesskey = msg[0].sessionKeys[i];
break;
}
for (var j = 0; j < priv_key[0].subKeys.length; j++) {
if (priv_key[0].subKeys[j].publicKey.getKeyId() == msg[0].sessionKeys[i].keyId.bytes) {
keymat = { key: priv_key[0], keymaterial: priv_key[0].subKeys[j]};
sesskey = msg[0].sessionKeys[i];
break;
}
}
}
if (keymat != null) {
if (!keymat.keymaterial.decryptSecretMPIs($('#myprivatekeypass').val())) {
alert("Password for secrect key was incorrect!");
return;
}
$('#tosend').val(msg[0].decrypt(keymat, sesskey));
} else {
alert("No private key found!");
}
}
function genroompass() {
prompt('Random 256-bit key', util.hexstrdump(openpgp_crypto_getRandomBytes(32)));
}
$(function() {
setlang(urlvars.lang || 'en');
$('#channel').val(urlvars.room || 'sc-default');
$('#mypublickey').val(localStorage.scPublicKey);
$('#myprivatekey').val(localStorage.scPrivateKey);
$('#myprivatekeypass').val(localStorage.scPrivateKeypass);
$('#username').val(localStorage.scUserName);
$('.collapse-title').click(function() {
var sign = $(this).children('.sign');
if (sign.html() == '+')
sign.html('-');
else
sign.html('+');
$(this).next().slideToggle();
});
$('#tosend').keypress(function (e) {
if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13) || (e.which && e.which == 10) || (e.keyCode && e.keyCode == 10)) {
if (e.ctrlKey) {
$('#tosend').val($('#tosend').val() + '\n');
} else {
sendmsgtoroom();
e.preventDefault();
}
}
});
});
var channel = {};
function sendmsgtoroom() {
var tosend = $('#tosend');
channel.send(tosend.val());
tosend.val('');
tosend.focus();
}
function joinroom() {
channel = new DataChannel($('#channel').val(), {username: $('#username').val()});
urlvars.room = channel.channel;
updurlhash();
channel.onmessage = function(data, userid) {
console.log(arguments);
};
channel.onopen = function(userid) {
console.log(userid);
$('button[name="joinroom"]').attr('disabled', 'disabled');
};
channel.onclose = function() {
$('button[name="joinroom"]').removeAttr('disabled');
};
}
</script>
</head>
<body>
<header>
<div class="langselect">
<a href="javascript:void(0);" onclick="javascript:setlang('en')">EN</a>
<a href="javascript:void(0);" onclick="javascript:setlang('hu')">HU</a>
</div>
</header>
<div role="main">
<div id="received"><textarea rows="14" cols="60" id="encmessage"></textarea></div><br>
<div class="box">
<div class="collapse-title">
<span class="sign">+</span>
<h3 class="lang-en">Room</h3>
<h3 class="lang-hu">Szoba</h3>
<br>
</div>
<div class="collapse">
<hr>
<label class="lang-en">Room: </label>
<label class="lang-hu">Szoba: </label>
<input type="text" id="channel">
&nbsp;<br>
<label class="lang-en">Room key: </label>
<label class="lang-hu">Szoba kulcsa: </label>
<input type="text" size="48" id="channelpass"><br>
<button class="lang-en" onclick="javascript:genroompass()">Generate random key</button>
<button class="lang-hu" onclick="javascript:genroompass()">Véletlen kulcs generálása</button><br>
<label class="lang-en">Display name: </label>
<label class="lang-hu">Megjelenített nevem: </label>
<input type="text" id="username"><br>
<button class="lang-en" onclick="javascript:joinroom()" name="joinroom">Join room</button>
<button class="lang-hu" onclick="javascript:joinroom()" name="joinroom">Csatlakozás a szobához</button><br>
</div>
</div><br>
<label class="lang-en">Your message: </label>
<label class="lang-hu">Üzeneted: </label>
<textarea rows="4" cols="60" id="tosend"></textarea><br>
<input type="submit" onclick="javascript:sendmsgtoroom()">
<button class="lang-en" onclick="javascript:pgpcrypt()">Encrypt with target's public key</button>
<button class="lang-hu" onclick="javascript:pgpcrypt()">Titkosítás célszemély publikus kulcsával</button>
<input type="checkbox" id="channelcrypt">
<div class="lang-en" style="font-size: 12px;">Send with room encryption</div>
<div class="lang-hu" style="font-size: 12px;">Szoba kulcsával titkosítva küld</div><br><br>
<div class="box">
<div class="collapse-title">
<span class="sign">+</span>
<h3 class="lang-en">Target Public Key</h3>
<h3 class="lang-hu">Célszemély publikus kulcsa</h3>
<br>
</div>
<div class="collapse">
<hr>
<label class="lang-en">Target Public Key: </label>
<label class="lang-hu">Célszemély publikus kulcsa: </label>
<br><textarea rows="14" cols="60" id="targetpublickey"></textarea><br>
</div>
</div><br>
<div class="box">
<div class="collapse-title">
<span class="sign">+</span>
<h3 class="lang-en">My GPG keys</h3>
<h3 class="lang-hu">Én GPG kulcsaim</h3>
<br>
</div>
<div class="collapse">
<hr>
<label class="lang-en">Key strength: </label>
<label class="lang-hu">Kulcs erőssége: </label>
<input type="text" size="4" style="width: 32px;" value="2048" id="mykeystrength">
<button class="lang-en" onclick="javascript:genkeys()">Generate Key Pair</button>
<button class="lang-hu" onclick="javascript:genkeys()">Kulcspár létrehozása</button>
<button class="lang-en" onclick="javascript:sendmypub()">Send Public Key to chat room</button>
<button class="lang-hu" onclick="javascript:sendmypub()">Nyilvános kulcs elküldése chat szobába</button>
<button class="lang-en" onclick="javascript:savekeys()">Store My Keys (localStorage)</button>
<button class="lang-hu" onclick="javascript:savekeys()">Kulcsaim tárolása (localStorage)</button><br>
<label class="lang-en">My Public Key: </label>
<label class="lang-hu">Publikus kulcsom: </label>
<br><textarea rows="14" cols="60" id="mypublickey"></textarea><br>
<label class="lang-en">My Private Key: </label>
<label class="lang-hu">Privát kulcsom: </label>
<br><textarea rows="14" cols="60" id="myprivatekey"></textarea><br>
<label class="lang-en">My Private Key's password: </label>
<label class="lang-hu">Privát kulcsom jelszava: </label>
<input type="text" id="myprivatekeypass"><br>
</div>
</div><br>
</div>
<footer></footer>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment