@pageproof/sdk-pr 615.0.1758757111124 → 616.0.1758772063779

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/pageproof.js +1 -1
  2. package/package.json +1 -1
package/lib/pageproof.js CHANGED
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.PageProof=t():e.PageProof=t()}(this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=83)}([function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=function e(t){n(this,e),this.client=t};t.default=o},function(e,t){e.exports={options:{usePureJavaScript:!1}}},function(e,t,r){function n(e){if(8!==e&&16!==e&&24!==e&&32!==e)throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}function o(e){if(this.data="",this.read=0,"string"==typeof e)this.data=e;else if(s.isArrayBuffer(e)||s.isArrayBufferView(e)){var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch(e){for(var r=0;r<t.length;++r)this.putByte(t[r])}}else(e instanceof o||"object"==typeof e&&"string"==typeof e.data&&"number"==typeof e.read)&&(this.data=e.data,this.read=e.read);this._constructedStringLength=0}function i(e,t){t=t||{},this.read=t.readOffset||0,this.growSize=t.growSize||1024;var r=s.isArrayBuffer(e),n=s.isArrayBufferView(e);if(r||n)return this.data=r?new DataView(e):new DataView(e.buffer,e.byteOffset,e.byteLength),void(this.write="writeOffset"in t?t.writeOffset:this.data.byteLength);this.data=new DataView(new ArrayBuffer(0)),this.write=0,null!==e&&void 0!==e&&this.putBytes(e),"writeOffset"in t&&(this.write=t.writeOffset)}var a=r(1),s=e.exports=a.util=a.util||{};!function(){function e(e){if(e.source===window&&e.data===t){e.stopPropagation();var n=r.slice();r.length=0,n.forEach(function(e){e()})}}if("undefined"!=typeof process&&process.nextTick)return s.nextTick=process.nextTick,void("function"==typeof setImmediate?s.setImmediate=setImmediate:s.setImmediate=s.nextTick);if("function"==typeof setImmediate)return s.setImmediate=function(){return setImmediate.apply(void 0,arguments)},void(s.nextTick=function(e){return setImmediate(e)});if(s.setImmediate=function(e){setTimeout(e,0)},"undefined"!=typeof window&&"function"==typeof window.postMessage){var t="forge.setImmediate",r=[];s.setImmediate=function(e){r.push(e),1===r.length&&window.postMessage(t,"*")},window.addEventListener("message",e,!0)}if("undefined"!=typeof MutationObserver){var n=Date.now(),o=!0,i=document.createElement("div"),r=[];new MutationObserver(function(){var e=r.slice();r.length=0,e.forEach(function(e){e()})}).observe(i,{attributes:!0});var a=s.setImmediate;s.setImmediate=function(e){Date.now()-n>15?(n=Date.now(),a(e)):(r.push(e),1===r.length&&i.setAttribute("a",o=!o))}}s.nextTick=s.setImmediate}(),s.isNodejs="undefined"!=typeof process&&process.versions&&process.versions.node,s.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},s.isArrayBuffer=function(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer},s.isArrayBufferView=function(e){return e&&s.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},s.ByteBuffer=o,s.ByteStringBuffer=o;s.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},s.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},s.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},s.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},s.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var r=this.data;t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return this.data=r,this._optimizeConstructedString(t),this},s.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},s.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(s.encodeUtf8(e))},s.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},s.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},s.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},s.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},s.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},s.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))},s.ByteStringBuffer.prototype.putInt=function(e,t){n(t);var r="";do{t-=8,r+=String.fromCharCode(e>>t&255)}while(t>0);return this.putBytes(r)},s.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<<t-1),this.putInt(e,t)},s.ByteStringBuffer.prototype.putBuffer=function(e){return this.putBytes(e.getBytes())},s.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)},s.ByteStringBuffer.prototype.getInt16=function(){var e=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,e},s.ByteStringBuffer.prototype.getInt24=function(){var e=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,e},s.ByteStringBuffer.prototype.getInt32=function(){var e=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+3);return this.read+=4,e},s.ByteStringBuffer.prototype.getInt16Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,e},s.ByteStringBuffer.prototype.getInt24Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,e},s.ByteStringBuffer.prototype.getInt32Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16^this.data.charCodeAt(this.read+3)<<24;return this.read+=4,e},s.ByteStringBuffer.prototype.getInt=function(e){n(e);var t=0;do{t=(t<<8)+this.data.charCodeAt(this.read++),e-=8}while(e>0);return t},s.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<<e-2;return t>=r&&(t-=r<<1),t},s.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},s.ByteStringBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},s.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},s.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this},s.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},s.ByteStringBuffer.prototype.copy=function(){var e=s.createBuffer(this.data);return e.read=this.read,e},s.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},s.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},s.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this},s.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.length;++t){var r=this.data.charCodeAt(t);r<16&&(e+="0"),e+=r.toString(16)}return e},s.ByteStringBuffer.prototype.toString=function(){return s.decodeUtf8(this.bytes())},s.DataBuffer=i,s.DataBuffer.prototype.length=function(){return this.write-this.read},s.DataBuffer.prototype.isEmpty=function(){return this.length()<=0},s.DataBuffer.prototype.accommodate=function(e,t){if(this.length()>=e)return this;t=Math.max(t||this.growSize,e);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),n=new Uint8Array(this.length()+t);return n.set(r),this.data=new DataView(n.buffer),this},s.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},s.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var r=0;r<t;++r)this.data.setUint8(e);return this},s.DataBuffer.prototype.putBytes=function(e,t){if(s.isArrayBufferView(e)){var r=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),n=r.byteLength-r.byteOffset;this.accommodate(n);var o=new Uint8Array(this.data.buffer,this.write);return o.set(r),this.write+=n,this}if(s.isArrayBuffer(e)){var r=new Uint8Array(e);this.accommodate(r.byteLength);var o=new Uint8Array(this.data.buffer);return o.set(r,this.write),this.write+=r.byteLength,this}if(e instanceof s.DataBuffer||"object"==typeof e&&"number"==typeof e.read&&"number"==typeof e.write&&s.isArrayBufferView(e.data)){var r=new Uint8Array(e.data.byteLength,e.read,e.length());this.accommodate(r.byteLength);var o=new Uint8Array(e.data.byteLength,this.write);return o.set(r),this.write+=r.byteLength,this}if(e instanceof s.ByteStringBuffer&&(e=e.data,t="binary"),t=t||"binary","string"==typeof e){var i;if("hex"===t)return this.accommodate(Math.ceil(e.length/2)),i=new Uint8Array(this.data.buffer,this.write),this.write+=s.binary.hex.decode(e,i,this.write),this;if("base64"===t)return this.accommodate(3*Math.ceil(e.length/4)),i=new Uint8Array(this.data.buffer,this.write),this.write+=s.binary.base64.decode(e,i,this.write),this;if("utf8"===t&&(e=s.encodeUtf8(e),t="binary"),"binary"===t||"raw"===t)return this.accommodate(e.length),i=new Uint8Array(this.data.buffer,this.write),this.write+=s.binary.raw.decode(i),this;if("utf16"===t)return this.accommodate(2*e.length),i=new Uint16Array(this.data.buffer,this.write),this.write+=s.text.utf16.encode(i),this;throw new Error("Invalid encoding: "+t)}throw Error("Invalid parameter: "+e)},s.DataBuffer.prototype.putBuffer=function(e){return this.putBytes(e),e.clear(),this},s.DataBuffer.prototype.putString=function(e){return this.putBytes(e,"utf16")},s.DataBuffer.prototype.putInt16=function(e){return this.accommodate(2),this.data.setInt16(this.write,e),this.write+=2,this},s.DataBuffer.prototype.putInt24=function(e){return this.accommodate(3),this.data.setInt16(this.write,e>>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},s.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},s.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},s.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this},s.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},s.DataBuffer.prototype.putInt=function(e,t){n(t),this.accommodate(t/8);do{t-=8,this.data.setInt8(this.write++,e>>t&255)}while(t>0);return this},s.DataBuffer.prototype.putSignedInt=function(e,t){return n(t),this.accommodate(t/8),e<0&&(e+=2<<t-1),this.putInt(e,t)},s.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)},s.DataBuffer.prototype.getInt16=function(){var e=this.data.getInt16(this.read);return this.read+=2,e},s.DataBuffer.prototype.getInt24=function(){var e=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,e},s.DataBuffer.prototype.getInt32=function(){var e=this.data.getInt32(this.read);return this.read+=4,e},s.DataBuffer.prototype.getInt16Le=function(){var e=this.data.getInt16(this.read,!0);return this.read+=2,e},s.DataBuffer.prototype.getInt24Le=function(){var e=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,e},s.DataBuffer.prototype.getInt32Le=function(){var e=this.data.getInt32(this.read,!0);return this.read+=4,e},s.DataBuffer.prototype.getInt=function(e){n(e);var t=0;do{t=(t<<8)+this.data.getInt8(this.read++),e-=8}while(e>0);return t},s.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<<e-2;return t>=r&&(t-=r<<1),t},s.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},s.DataBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},s.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},s.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},s.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},s.DataBuffer.prototype.copy=function(){return new s.DataBuffer(this)},s.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this},s.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},s.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},s.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.byteLength;++t){var r=this.data.getUint8(t);r<16&&(e+="0"),e+=r.toString(16)}return e},s.DataBuffer.prototype.toString=function(e){var t=new Uint8Array(this.data,this.read,this.length());if("binary"===(e=e||"utf8")||"raw"===e)return s.binary.raw.encode(t);if("hex"===e)return s.binary.hex.encode(t);if("base64"===e)return s.binary.base64.encode(t);if("utf8"===e)return s.text.utf8.decode(t);if("utf16"===e)return s.text.utf16.decode(t);throw new Error("Invalid encoding: "+e)},s.createBuffer=function(e,t){return t=t||"raw",void 0!==e&&"utf8"===t&&(e=s.encodeUtf8(e)),new s.ByteBuffer(e)},s.fillString=function(e,t){for(var r="";t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return r},s.xorBytes=function(e,t,r){for(var n="",o="",i="",a=0,s=0;r>0;--r,++a)o=e.charCodeAt(a)^t.charCodeAt(a),s>=10&&(n+=i,i="",s=0),i+=String.fromCharCode(o),++s;return n+=i},s.hexToBytes=function(e){var t="",r=0;for(!0&e.length&&(r=1,t+=String.fromCharCode(parseInt(e[0],16)));r<e.length;r+=2)t+=String.fromCharCode(parseInt(e.substr(r,2),16));return t},s.bytesToHex=function(e){return s.createBuffer(e).toHex()},s.int32ToBytes=function(e){return String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)};var u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",c=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51];s.encode64=function(e,t){for(var r,n,o,i="",a="",s=0;s<e.length;)r=e.charCodeAt(s++),n=e.charCodeAt(s++),o=e.charCodeAt(s++),i+=u.charAt(r>>2),i+=u.charAt((3&r)<<4|n>>4),isNaN(n)?i+="==":(i+=u.charAt((15&n)<<2|o>>6),i+=isNaN(o)?"=":u.charAt(63&o)),t&&i.length>t&&(a+=i.substr(0,t)+"\r\n",i=i.substr(t));return a+=i},s.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t,r,n,o,i="",a=0;a<e.length;)t=c[e.charCodeAt(a++)-43],r=c[e.charCodeAt(a++)-43],n=c[e.charCodeAt(a++)-43],o=c[e.charCodeAt(a++)-43],i+=String.fromCharCode(t<<2|r>>4),64!==n&&(i+=String.fromCharCode((15&r)<<4|n>>2),64!==o&&(i+=String.fromCharCode((3&n)<<6|o)));return i},s.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},s.decodeUtf8=function(e){return decodeURIComponent(escape(e))},s.binary={raw:{},hex:{},base64:{}},s.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},s.binary.raw.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(e.length)),r=r||0;for(var o=r,i=0;i<e.length;++i)n[o++]=e.charCodeAt(i);return t?o-r:n},s.binary.hex.encode=s.bytesToHex,s.binary.hex.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(Math.ceil(e.length/2))),r=r||0;var o=0,i=r;for(1&e.length&&(o=1,n[i++]=parseInt(e[0],16));o<e.length;o+=2)n[i++]=parseInt(e.substr(o,2),16);return t?i-r:n},s.binary.base64.encode=function(e,t){for(var r,n,o,i="",a="",s=0;s<e.byteLength;)r=e[s++],n=e[s++],o=e[s++],i+=u.charAt(r>>2),i+=u.charAt((3&r)<<4|n>>4),isNaN(n)?i+="==":(i+=u.charAt((15&n)<<2|o>>6),i+=isNaN(o)?"=":u.charAt(63&o)),t&&i.length>t&&(a+=i.substr(0,t)+"\r\n",i=i.substr(t));return a+=i},s.binary.base64.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,""),r=r||0;for(var o,i,a,s,u=0,l=r;u<e.length;)o=c[e.charCodeAt(u++)-43],i=c[e.charCodeAt(u++)-43],a=c[e.charCodeAt(u++)-43],s=c[e.charCodeAt(u++)-43],n[l++]=o<<2|i>>4,64!==a&&(n[l++]=(15&i)<<4|a>>2,64!==s&&(n[l++]=(3&a)<<6|s));return t?l-r:n.subarray(0,l)},s.text={utf8:{},utf16:{}},s.text.utf8.encode=function(e,t,r){e=s.encodeUtf8(e);var n=t;n||(n=new Uint8Array(e.length)),r=r||0;for(var o=r,i=0;i<e.length;++i)n[o++]=e.charCodeAt(i);return t?o-r:n},s.text.utf8.decode=function(e){return s.decodeUtf8(String.fromCharCode.apply(null,e))},s.text.utf16.encode=function(e,t,r){var n=t;n||(n=new Uint8Array(2*e.length));var o=new Uint16Array(n.buffer);r=r||0;for(var i=r,a=r,s=0;s<e.length;++s)o[a++]=e.charCodeAt(s),i+=2;return t?i-r:n},s.text.utf16.decode=function(e){return String.fromCharCode.apply(null,new Uint16Array(e.buffer))},s.deflate=function(e,t,r){if(t=s.decode64(e.deflate(s.encode64(t)).rval),r){var n=2;32&t.charCodeAt(1)&&(n=6),t=t.substring(n,t.length-4)}return t},s.inflate=function(e,t,r){var n=e.inflate(s.encode64(t)).rval;return null===n?null:s.decode64(n)};var l=function(e,t,r){if(!e)throw new Error("WebStorage not available.");var n;if(null===r?n=e.removeItem(t):(r=s.encode64(JSON.stringify(r)),n=e.setItem(t,r)),void 0!==n&&!0!==n.rval){var o=new Error(n.error.message);throw o.id=n.error.id,o.name=n.error.name,o}},f=function(e,t){if(!e)throw new Error("WebStorage not available.");var r=e.getItem(t);if(e.init)if(null===r.rval){if(r.error){var n=new Error(r.error.message);throw n.id=r.error.id,n.name=r.error.name,n}r=null}else r=r.rval;return null!==r&&(r=JSON.parse(s.decode64(r))),r},p=function(e,t,r,n){var o=f(e,t);null===o&&(o={}),o[r]=n,l(e,t,o)},d=function(e,t,r){var n=f(e,t);return null!==n&&(n=r in n?n[r]:null),n},h=function(e,t,r){var n=f(e,t);if(null!==n&&r in n){delete n[r];var o=!0;for(var i in n){o=!1;break}o&&(n=null),l(e,t,n)}},y=function(e,t){l(e,t,null)},m=function(e,t,r){var n=null;void 0===r&&(r=["web","flash"]);var o,i=!1,a=null;for(var s in r){o=r[s];try{if("flash"===o||"both"===o){if(null===t[0])throw new Error("Flash local storage not available.");n=e.apply(this,t),i="flash"===o}"web"!==o&&"both"!==o||(t[0]=localStorage,n=e.apply(this,t),i=!0)}catch(e){a=e}if(i)break}if(!i)throw a;return n};s.setItem=function(e,t,r,n,o){m(p,arguments,o)},s.getItem=function(e,t,r,n){return m(d,arguments,n)},s.removeItem=function(e,t,r,n){m(h,arguments,n)},s.clearItems=function(e,t,r){m(y,arguments,r)},s.parseUrl=function(e){var t=/^(https?):\/\/([^:&^\/]*):?(\d*)(.*)$/g;t.lastIndex=0;var r=t.exec(e),n=null===r?null:{full:e,scheme:r[1],host:r[2],port:r[3],path:r[4]};return n&&(n.fullHost=n.host,n.port?80!==n.port&&"http"===n.scheme?n.fullHost+=":"+n.port:443!==n.port&&"https"===n.scheme&&(n.fullHost+=":"+n.port):"http"===n.scheme?n.port=80:"https"===n.scheme&&(n.port=443),n.full=n.scheme+"://"+n.fullHost),n};var g=null;s.getQueryVariables=function(e){var t,r=function(e){for(var t={},r=e.split("&"),n=0;n<r.length;n++){var o,i,a=r[n].indexOf("=");a>0?(o=r[n].substring(0,a),i=r[n].substring(a+1)):(o=r[n],i=null),o in t||(t[o]=[]),o in Object.prototype||null===i||t[o].push(unescape(i))}return t};return void 0===e?(null===g&&(g="undefined"!=typeof window&&window.location&&window.location.search?r(window.location.search.substring(1)):{}),t=g):t=r(e),t},s.parseFragment=function(e){var t=e,r="",n=e.indexOf("?");n>0&&(t=e.substring(0,n),r=e.substring(n+1));var o=t.split("/");return o.length>0&&""===o[0]&&o.shift(),{pathString:t,queryString:r,path:o,query:""===r?{}:s.getQueryVariables(r)}},s.makeRequest=function(e){var t=s.parseFragment(e),r={path:t.pathString,query:t.queryString,getPath:function(e){return void 0===e?t.path:t.path[e]},getQuery:function(e,r){var n;return void 0===e?n=t.query:(n=t.query[e])&&void 0!==r&&(n=n[r]),n},getQueryLast:function(e,t){var n=r.getQuery(e);return n?n[n.length-1]:t}};return r},s.makeLink=function(e,t,r){e=jQuery.isArray(e)?e.join("/"):e;var n=jQuery.param(t||{});return r=r||"",e+(n.length>0?"?"+n:"")+(r.length>0?"#"+r:"")},s.setPath=function(e,t,r){if("object"==typeof e&&null!==e)for(var n=0,o=t.length;n<o;){var i=t[n++];if(n==o)e[i]=r;else{var a=i in e;(!a||a&&"object"!=typeof e[i]||a&&null===e[i])&&(e[i]={}),e=e[i]}}},s.getPath=function(e,t,r){for(var n=0,o=t.length,i=!0;i&&n<o&&"object"==typeof e&&null!==e;){var a=t[n++];i=a in e,i&&(e=e[a])}return i?e:r},s.deletePath=function(e,t){if("object"==typeof e&&null!==e)for(var r=0,n=t.length;r<n;){var o=t[r++];if(r==n)delete e[o];else{if(!(o in e)||"object"!=typeof e[o]||null===e[o])break;e=e[o]}}},s.isEmpty=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},s.format=function(e){for(var t,r,n=/%./g,o=0,i=[],a=0;t=n.exec(e);){r=e.substring(a,n.lastIndex-2),r.length>0&&i.push(r),a=n.lastIndex;var s=t[0][1];switch(s){case"s":case"o":o<arguments.length?i.push(arguments[1+o++]):i.push("<?>");break;case"%":i.push("%");break;default:i.push("<%"+s+"?>")}}return i.push(e.substring(a)),i.join("")},s.formatNumber=function(e,t,r,n){var o=e,i=isNaN(t=Math.abs(t))?2:t,a=void 0===r?",":r,s=void 0===n?".":n,u=o<0?"-":"",c=parseInt(o=Math.abs(+o||0).toFixed(i),10)+"",l=c.length>3?c.length%3:0;return u+(l?c.substr(0,l)+s:"")+c.substr(l).replace(/(\d{3})(?=\d)/g,"$1"+s)+(i?a+Math.abs(o-c).toFixed(i).slice(2):"")},s.formatSize=function(e){return e=e>=1073741824?s.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?s.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?s.formatNumber(e/1024,0)+" KiB":s.formatNumber(e,0)+" bytes"},s.bytesFromIP=function(e){return-1!==e.indexOf(".")?s.bytesFromIPv4(e):-1!==e.indexOf(":")?s.bytesFromIPv6(e):null},s.bytesFromIPv4=function(e){if(e=e.split("."),4!==e.length)return null;for(var t=s.createBuffer(),r=0;r<e.length;++r){var n=parseInt(e[r],10);if(isNaN(n))return null;t.putByte(n)}return t.getBytes()},s.bytesFromIPv6=function(e){var t=0;e=e.split(":").filter(function(e){return 0===e.length&&++t,!0});for(var r=2*(8-e.length+t),n=s.createBuffer(),o=0;o<8;++o)if(e[o]&&0!==e[o].length){var i=s.hexToBytes(e[o]);i.length<2&&n.putByte(0),n.putBytes(i)}else n.fillWithByte(0,r),r=0;return n.getBytes()},s.bytesToIP=function(e){return 4===e.length?s.bytesToIPv4(e):16===e.length?s.bytesToIPv6(e):null},s.bytesToIPv4=function(e){if(4!==e.length)return null;for(var t=[],r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t.join(".")},s.bytesToIPv6=function(e){if(16!==e.length)return null;for(var t=[],r=[],n=0,o=0;o<e.length;o+=2){for(var i=s.bytesToHex(e[o]+e[o+1]);"0"===i[0]&&"0"!==i;)i=i.substr(1);if("0"===i){var a=r[r.length-1],u=t.length;a&&u===a.end+1?(a.end=u,a.end-a.start>r[n].end-r[n].start&&(n=r.length-1)):r.push({start:u,end:u})}t.push(i)}if(r.length>0){var c=r[n];c.end-c.start>0&&(t.splice(c.start,c.end-c.start+1,""),0===c.start&&t.unshift(""),7===c.end&&t.push(""))}return t.join(":")},s.estimateCores=function(e,t){function r(e,a,u){if(0===a){var c=Math.floor(e.reduce(function(e,t){return e+t},0)/e.length);return s.cores=Math.max(1,c),URL.revokeObjectURL(i),t(null,s.cores)}n(u,function(t,n){e.push(o(u,n)),r(e,a-1,u)})}function n(e,t){for(var r=[],n=[],o=0;o<e;++o){var a=new Worker(i);a.addEventListener("message",function(o){if(n.push(o.data),n.length===e){for(var i=0;i<e;++i)r[i].terminate();t(null,n)}}),r.push(a)}for(var o=0;o<e;++o)r[o].postMessage(o)}function o(e,t){for(var r=[],n=0;n<e;++n)for(var o=t[n],i=r[n]=[],a=0;a<e;++a)if(n!==a){var s=t[a];(o.st>s.st&&o.st<s.et||s.st>o.st&&s.st<o.et)&&i.push(a)}return r.reduce(function(e,t){return Math.max(e,t.length)},0)}if("function"==typeof e&&(t=e,e={}),e=e||{},"cores"in s&&!e.update)return t(null,s.cores);if("undefined"!=typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return s.cores=navigator.hardwareConcurrency,t(null,s.cores);if("undefined"==typeof Worker)return s.cores=1,t(null,s.cores);if("undefined"==typeof Blob)return s.cores=2,t(null,s.cores);var i=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(e){for(var t=Date.now(),r=t+4;Date.now()<r;);self.postMessage({st:t,et:r})})}.toString(),")()"],{type:"application/javascript"}));r([],5,16)}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t,r){var n=[],o={};return Array.isArray(t)?(n=t,t.forEach(function(e){o[e]=e})):(0,y.default)(t)&&(n=Object.keys(t),o=t),n.forEach(function(t){var n=o[t],i=void 0;if("string"==typeof n)i=-1!==n.indexOf(".")?function(){for(var e=n.split("."),t=r,o=0;o<e.length;o++){var i=e[o];if(!(0,g.default)(t,i)){t=void 0;break}t=t[i]}return t}:function(){return r[n]};else{if("function"!=typeof n){if(null===n)return;throw new Error("Unknown transformer.")}i=n}var a=i.call(e,r);void 0!==a&&(e[t]=a)}),e}function i(e){return function(t){return Number(t[e])}}function a(e,t){return function(r){return t[r[e]]}}function s(e){return function(t){var r=t[e];if(r&&"0001-01-01T00:00:00"!==r)return"number"==typeof r?new Date(1e3*r):r.endsWith("Z")?new Date(r):new Date(r+"Z")}}function u(e){return function(t){var r=String(t[e]);return"1"===r||"true"===r}}function c(e){return function(t){return g.default.call(t,e)}}function l(e,t){return function(r){return r[e]?r[e].map(t):[]}}function f(e,t){return function(r){return r[e]?JSON.parse(r[e]):Array.isArray(t)?[].concat(t):d({},t)}}function p(e){return function(t){return t[e]?t[e]:void 0}}t.__esModule=!0;var d=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e};t.number=i,t.enumeration=a,t.date=s,t.truthy=u,t.exists=c,t.each=l,t.json=f,t.optional=p;var h=r(26),y=n(h),m=r(17),g=n(m);t.default=o},function(e,t,r){"use strict";function n(){if("function"==typeof n.driver){return new(0,n.driver)}if("string"==typeof n.driver){var e=void 0;switch(n.driver){case"Blob":e=r(126).default;break;case"Buffer":e=r(127).default;break;case"String":e=r(128).default;break;case"Uint8Array":e=r(130).default;break;default:throw new Error('Unknown Bluffer driver "'+n.driver+'".')}if(e)return new e;throw new Error('Bluffer driver "'+n.driver+'" not found.')}throw new Error('Bluffer.driver must be either "Blob", "Bluffer", "Uint8Array" (experimental), or "String" or a custom constructor.')}t.__esModule=!0;var o=r(34)("bluffer");n.driver="String","undefined"!=typeof Blob?n.driver="Blob":(o("The current JavaScript environment does not support native Bluffer, falling back to using StringBluffer."),n.driver="String"),t.default=n},function(e,t,r){"use strict";t.__esModule=!0;t.TOKEN_HEADER="x-authorization-token",t.HMAC_HEADER="x-authorization-hmac",t.TIMESTAMP_HEADER="x-timestamp",t.DEVICE_ID_HEADER="x-device-id",t.SUBSCRIPTION_KEY_HEADER="ocp-apim-subscription-key",t.LOCAL_ENCODED_METADATA_HEADER="x-p-lem",t.SDK_VERSION_HEADER="x-pageproof-javascript-sdk",t.RETRY_AFTER_HEADER="retry-after",t.BYTES_PER_BLOCK=2097152,t.MENTION_REGEX=/@{(U[a-zA-Z0-9]{15}|~everyone)}{(.*?)}/,t.COMMENT_LABEL_REGEX=/^(approved|highlight):/i,t.ISO_REGEX=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/,t.DEFAULT_ISO_DATE="0001-01-01T00:00:00",t.DAY_IN_MS=864e5,t.COMMENT_CACHE_PREFIX="comment",t.THUMBNAIL_CACHE_PREFIX="thumbnail",t.PREVIEW_CACHE_PREFIX="preview",t.BRIAN_USER_ID="__brian__",t.BRIAN_TOKEN_HEADER="x-authorization-apitoken",t.BRIAN_HMAC_HEADER="x-authorization-api_hmac",t.VIDEO_CREDENTIALS_CACHE_PREFIX="video-credentials-json-"},function(e,t,r){var n=r(1);r(10),r(49),r(50),r(2),function(){if(n.random&&n.random.getBytes)return void(e.exports=n.random);!function(t){function r(){var e=n.prng.create(o);return e.getBytes=function(t,r){return e.generate(t,r)},e.getBytesSync=function(t){return e.generate(t)},e}var o={},i=new Array(4),a=n.util.createBuffer();o.formatKey=function(e){var t=n.util.createBuffer(e);return e=new Array(4),e[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),n.aes._expandKey(e,!1)},o.formatSeed=function(e){var t=n.util.createBuffer(e);return e=new Array(4),e[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),e},o.cipher=function(e,t){return n.aes._updateBlock(e,t,i,!1),a.putInt32(i[0]),a.putInt32(i[1]),a.putInt32(i[2]),a.putInt32(i[3]),a.getBytes()},o.increment=function(e){return++e[3],e},o.md=n.md.sha256;var s=r(),u=null;if("undefined"!=typeof window){var c=window.crypto||window.msCrypto;c&&c.getRandomValues&&(u=function(e){return c.getRandomValues(e)})}if(n.options.usePureJavaScript||!n.util.isNodejs&&!u){if("undefined"==typeof window||window.document,s.collectInt(+new Date,32),"undefined"!=typeof navigator){var l="";for(var f in navigator)try{"string"==typeof navigator[f]&&(l+=navigator[f])}catch(e){}s.collect(l),l=null}t&&(t().mousemove(function(e){s.collectInt(e.clientX,16),s.collectInt(e.clientY,16)}),t().keypress(function(e){s.collectInt(e.charCode,8)}))}if(n.random)for(var f in s)n.random[f]=s[f];else n.random=s;n.random.createInstance=r,e.exports=n.random}("undefined"!=typeof jQuery?jQuery:null)}()},function(e,t,r){function n(e,t,r){if(r>t){var n=new Error("Too few bytes to parse DER.");throw n.available=e.length(),n.remaining=t,n.requested=r,n}}function o(e,t,r,i){var u;n(e,t,2);var c=e.getByte();t--;var l=192&c,f=31&c;u=e.length();var p=s(e,t);if(t-=u-e.length(),void 0!==p&&p>t){if(i.strict){var d=new Error("Too few bytes to read ASN.1 value.");throw d.available=e.length(),d.remaining=t,d.requested=p,d}p=t}var h,y,m=32==(32&c);if(m)if(h=[],void 0===p)for(;;){if(n(e,t,2),e.bytes(2)===String.fromCharCode(0,0)){e.getBytes(2),t-=2;break}u=e.length(),h.push(o(e,t,r+1,i)),t-=u-e.length()}else for(;p>0;)u=e.length(),h.push(o(e,p,r+1,i)),t-=u-e.length(),p-=u-e.length();if(void 0===h&&l===a.Class.UNIVERSAL&&f===a.Type.BITSTRING&&(y=e.bytes(p)),void 0===h&&i.decodeBitStrings&&l===a.Class.UNIVERSAL&&f===a.Type.BITSTRING&&p>1){var g=e.read,v=t,b=0;if(f===a.Type.BITSTRING&&(n(e,t,1),b=e.getByte(),t--),0===b)try{u=e.length();var E={verbose:i.verbose,strict:!0,decodeBitStrings:!0},C=o(e,t,r+1,E),_=u-e.length();t-=_,f==a.Type.BITSTRING&&_++;var w=C.tagClass;_!==p||w!==a.Class.UNIVERSAL&&w!==a.Class.CONTEXT_SPECIFIC||(h=[C])}catch(e){}void 0===h&&(e.read=g,t=v)}if(void 0===h){if(void 0===p){if(i.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");p=t}if(f===a.Type.BMPSTRING)for(h="";p>0;p-=2)n(e,t,2),h+=String.fromCharCode(e.getInt16()),t-=2;else h=e.getBytes(p)}var T=void 0===y?null:{bitStringContents:y};return a.create(l,f,m,h,T)}var i=r(1);r(2),r(11);var a=e.exports=i.asn1=i.asn1||{};a.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},a.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},a.create=function(e,t,r,n,o){if(i.util.isArray(n)){for(var s=[],u=0;u<n.length;++u)void 0!==n[u]&&s.push(n[u]);n=s}var c={tagClass:e,type:t,constructed:r,composed:r||i.util.isArray(n),value:n};return o&&"bitStringContents"in o&&(c.bitStringContents=o.bitStringContents,c.original=a.copy(c)),c},a.copy=function(e,t){var r;if(i.util.isArray(e)){r=[];for(var n=0;n<e.length;++n)r.push(a.copy(e[n],t));return r}return"string"==typeof e?e:(r={tagClass:e.tagClass,type:e.type,constructed:e.constructed,composed:e.composed,value:a.copy(e.value,t)},t&&!t.excludeBitStringContents&&(r.bitStringContents=e.bitStringContents),r)},a.equals=function(e,t,r){if(i.util.isArray(e)){if(!i.util.isArray(t))return!1;if(e.length!==t.length)return!1;for(var n=0;n<e.length;++n)return!!a.equals(e[n],t[n])}if(typeof e!=typeof t)return!1;if("string"==typeof e)return e===t;var o=e.tagClass===t.tagClass&&e.type===t.type&&e.constructed===t.constructed&&e.composed===t.composed&&a.equals(e.value,t.value);return r&&r.includeBitStringContents&&(o=o&&e.bitStringContents===t.bitStringContents),o},a.getBerValueLength=function(e){var t=e.getByte();if(128!==t){return 128&t?e.getInt((127&t)<<3):t}};var s=function(e,t){var r=e.getByte();if(t--,128!==r){var o;if(128&r){var i=127&r;n(e,t,i),o=e.getInt(i<<3)}else o=r;if(o<0)throw new Error("Negative length: "+o);return o}};a.fromDer=function(e,t){return void 0===t&&(t={strict:!0,decodeBitStrings:!0}),"boolean"==typeof t&&(t={strict:t,decodeBitStrings:!0}),"strict"in t||(t.strict=!0),"decodeBitStrings"in t||(t.decodeBitStrings=!0),"string"==typeof e&&(e=i.util.createBuffer(e)),o(e,e.length(),0,t)},a.toDer=function(e){var t=i.util.createBuffer(),r=e.tagClass|e.type,n=i.util.createBuffer(),o=!1;if("bitStringContents"in e&&(o=!0,e.original&&(o=a.equals(e,e.original))),o)n.putBytes(e.bitStringContents);else if(e.composed){e.constructed?r|=32:n.putByte(0);for(var s=0;s<e.value.length;++s)void 0!==e.value[s]&&n.putBuffer(a.toDer(e.value[s]))}else if(e.type===a.Type.BMPSTRING)for(var s=0;s<e.value.length;++s)n.putInt16(e.value.charCodeAt(s));else e.type===a.Type.INTEGER&&e.value.length>1&&(0===e.value.charCodeAt(0)&&0==(128&e.value.charCodeAt(1))||255===e.value.charCodeAt(0)&&128==(128&e.value.charCodeAt(1)))?n.putBytes(e.value.substr(1)):n.putBytes(e.value);if(t.putByte(r),n.length()<=127)t.putByte(127&n.length());else{var u=n.length(),c="";do{c+=String.fromCharCode(255&u),u>>>=8}while(u>0);t.putByte(128|c.length);for(var s=c.length-1;s>=0;--s)t.putByte(c.charCodeAt(s))}return t.putBuffer(n),t},a.oidToDer=function(e){var t=e.split("."),r=i.util.createBuffer();r.putByte(40*parseInt(t[0],10)+parseInt(t[1],10));for(var n,o,a,s,u=2;u<t.length;++u){n=!0,o=[],a=parseInt(t[u],10);do{s=127&a,a>>>=7,n||(s|=128),o.push(s),n=!1}while(a>0);for(var c=o.length-1;c>=0;--c)r.putByte(o[c])}return r},a.derToOid=function(e){var t;"string"==typeof e&&(e=i.util.createBuffer(e));var r=e.getByte();t=Math.floor(r/40)+"."+r%40;for(var n=0;e.length()>0;)r=e.getByte(),n<<=7,128&r?n+=127&r:(t+="."+(n+r),n=0);return t},a.utcTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,2),10);r=r>=50?1900+r:2e3+r;var n=parseInt(e.substr(2,2),10)-1,o=parseInt(e.substr(4,2),10),i=parseInt(e.substr(6,2),10),a=parseInt(e.substr(8,2),10),s=0;if(e.length>11){var u=e.charAt(10),c=10;"+"!==u&&"-"!==u&&(s=parseInt(e.substr(10,2),10),c+=2)}if(t.setUTCFullYear(r,n,o),t.setUTCHours(i,a,s,0),c&&("+"===(u=e.charAt(c))||"-"===u)){var l=parseInt(e.substr(c+1,2),10),f=parseInt(e.substr(c+4,2),10),p=60*l+f;p*=6e4,"+"===u?t.setTime(+t-p):t.setTime(+t+p)}return t},a.generalizedTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,4),10),n=parseInt(e.substr(4,2),10)-1,o=parseInt(e.substr(6,2),10),i=parseInt(e.substr(8,2),10),a=parseInt(e.substr(10,2),10),s=parseInt(e.substr(12,2),10),u=0,c=0,l=!1;"Z"===e.charAt(e.length-1)&&(l=!0);var f=e.length-5,p=e.charAt(f);if("+"===p||"-"===p){c=60*parseInt(e.substr(f+1,2),10)+parseInt(e.substr(f+4,2),10),c*=6e4,"+"===p&&(c*=-1),l=!0}return"."===e.charAt(14)&&(u=1e3*parseFloat(e.substr(14),10)),l?(t.setUTCFullYear(r,n,o),t.setUTCHours(i,a,s,u),t.setTime(+t+c)):(t.setFullYear(r,n,o),t.setHours(i,a,s,u)),t},a.dateToUtcTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push((""+e.getUTCFullYear()).substr(2)),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n<r.length;++n)r[n].length<2&&(t+="0"),t+=r[n];return t+="Z"},a.dateToGeneralizedTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push(""+e.getUTCFullYear()),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n<r.length;++n)r[n].length<2&&(t+="0"),t+=r[n];return t+="Z"},a.integerToDer=function(e){var t=i.util.createBuffer();if(e>=-128&&e<128)return t.putSignedInt(e,8);if(e>=-32768&&e<32768)return t.putSignedInt(e,16);if(e>=-8388608&&e<8388608)return t.putSignedInt(e,24);if(e>=-2147483648&&e<2147483648)return t.putSignedInt(e,32);var r=new Error("Integer too large; max is 32-bits.");throw r.integer=e,r},a.derToInteger=function(e){"string"==typeof e&&(e=i.util.createBuffer(e));var t=8*e.length();if(t>32)throw new Error("Integer too large; max is 32-bits.");return e.getSignedInt(t)},a.validate=function(e,t,r,n){var o=!1;if(e.tagClass!==t.tagClass&&void 0!==t.tagClass||e.type!==t.type&&void 0!==t.type)n&&(e.tagClass!==t.tagClass&&n.push("["+t.name+'] Expected tag class "'+t.tagClass+'", got "'+e.tagClass+'"'),e.type!==t.type&&n.push("["+t.name+'] Expected type "'+t.type+'", got "'+e.type+'"'));else if(e.constructed===t.constructed||void 0===t.constructed){if(o=!0,t.value&&i.util.isArray(t.value))for(var s=0,u=0;o&&u<t.value.length;++u)o=t.value[u].optional||!1,e.value[s]&&(o=a.validate(e.value[s],t.value[u],r,n),o?++s:t.value[u].optional&&(o=!0)),!o&&n&&n.push("["+t.name+'] Tag class "'+t.tagClass+'", type "'+t.type+'" expected value length "'+t.value.length+'", got "'+e.value.length+'"');if(o&&r&&(t.capture&&(r[t.capture]=e.value),t.captureAsn1&&(r[t.captureAsn1]=e),t.captureBitStringContents&&"bitStringContents"in e&&(r[t.captureBitStringContents]=e.bitStringContents),t.captureBitStringValue&&"bitStringContents"in e)){if(e.bitStringContents.length<2)r[t.captureBitStringValue]="";else{var c=e.bitStringContents.charCodeAt(0);if(0!==c)throw new Error("captureBitStringValue only supported for zero unused bits");r[t.captureBitStringValue]=e.bitStringContents.slice(1)}}}else n&&n.push("["+t.name+'] Expected constructed "'+t.constructed+'", got "'+e.constructed+'"');return o};var u=/[^\\u0000-\\u00ff]/;a.prettyPrint=function(e,t,r){var n="";t=t||0,r=r||2,t>0&&(n+="\n");for(var o="",s=0;s<t*r;++s)o+=" ";switch(n+=o+"Tag: ",e.tagClass){case a.Class.UNIVERSAL:n+="Universal:";break;case a.Class.APPLICATION:n+="Application:";break;case a.Class.CONTEXT_SPECIFIC:n+="Context-Specific:";break;case a.Class.PRIVATE:n+="Private:"}if(e.tagClass===a.Class.UNIVERSAL)switch(n+=e.type,e.type){case a.Type.NONE:n+=" (None)";break;case a.Type.BOOLEAN:n+=" (Boolean)";break;case a.Type.INTEGER:n+=" (Integer)";break;case a.Type.BITSTRING:n+=" (Bit string)";break;case a.Type.OCTETSTRING:n+=" (Octet string)";break;case a.Type.NULL:n+=" (Null)";break;case a.Type.OID:n+=" (Object Identifier)";break;case a.Type.ODESC:n+=" (Object Descriptor)";break;case a.Type.EXTERNAL:n+=" (External or Instance of)";break;case a.Type.REAL:n+=" (Real)";break;case a.Type.ENUMERATED:n+=" (Enumerated)";break;case a.Type.EMBEDDED:n+=" (Embedded PDV)";break;case a.Type.UTF8:n+=" (UTF8)";break;case a.Type.ROID:n+=" (Relative Object Identifier)";break;case a.Type.SEQUENCE:n+=" (Sequence)";break;case a.Type.SET:n+=" (Set)";break;case a.Type.PRINTABLESTRING:n+=" (Printable String)";break;case a.Type.IA5String:n+=" (IA5String (ASCII))";break;case a.Type.UTCTIME:n+=" (UTC time)";break;case a.Type.GENERALIZEDTIME:n+=" (Generalized time)";break;case a.Type.BMPSTRING:n+=" (BMP String)"}else n+=e.type;if(n+="\n",n+=o+"Constructed: "+e.constructed+"\n",e.composed){for(var c=0,l="",s=0;s<e.value.length;++s)void 0!==e.value[s]&&(c+=1,l+=a.prettyPrint(e.value[s],t+1,r),s+1<e.value.length&&(l+=","));n+=o+"Sub values: "+c+l}else{if(n+=o+"Value: ",e.type===a.Type.OID){var f=a.derToOid(e.value);n+=f,i.pki&&i.pki.oids&&f in i.pki.oids&&(n+=" ("+i.pki.oids[f]+") ")}if(e.type===a.Type.INTEGER)try{n+=a.derToInteger(e.value)}catch(t){n+="0x"+i.util.bytesToHex(e.value)}else if(e.type===a.Type.BITSTRING){if(e.value.length>1?n+="0x"+i.util.bytesToHex(e.value.slice(1)):n+="(none)",e.value.length>0){var p=e.value.charCodeAt(0);1==p?n+=" (1 unused bit shown)":p>1&&(n+=" ("+p+" unused bits shown)")}}else e.type===a.Type.OCTETSTRING?(u.test(e.value)||(n+="("+e.value+") "),n+="0x"+i.util.bytesToHex(e.value)):e.type===a.Type.UTF8?n+=i.util.decodeUtf8(e.value):e.type===a.Type.PRINTABLESTRING||e.type===a.Type.IA5String?n+=e.value:u.test(e.value)?n+="0x"+i.util.bytesToHex(e.value):0===e.value.length?n+="[null]":n+=e.value}return n}},function(e,t,r){var n=r(1);e.exports=n.md=n.md||{},n.md.algorithms=n.md.algorithms||{}},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=r(3),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a={id:"UserId",name:"Name",email:"Email",hasActivated:"Activated",hasRegistered:"IsRegistered",hasAvatar:"HasAvatar",accountType:"AccountType",teamType:"TeamType",teamLogo:"Branding.LogoURL",registeredDate:(0,o.date)("Registered"),lastLoginDate:(0,o.date)("LastLogin"),lastUploadDate:(0,o.date)("LastUpload"),isAdmin:"IsDomainAdmin",features:"Features",teamId:"DomainId",hasTOTP:"TotpEnabled"},s=function(){function e(){n(this,e)}return e.prototype.fromJSON=function(e){return(0,i.default)(this,Object.keys(a),e),this},e.prototype.fromUser=function(e){return(0,i.default)(this,a,e),this},e}();t.default=s},function(e,t,r){function n(e,t){var r=function(){return new u.aes.Algorithm(e,t)};u.cipher.registerAlgorithm(e,r)}function o(){h=!0,f=[0,1,2,4,8,16,32,64,128,27,54];for(var e=new Array(256),t=0;t<128;++t)e[t]=t<<1,e[t+128]=t+128<<1^283;c=new Array(256),l=new Array(256),p=new Array(4),d=new Array(4);for(var t=0;t<4;++t)p[t]=new Array(256),d[t]=new Array(256);for(var r,n,o,i,a,s,u,y=0,m=0,t=0;t<256;++t){i=m^m<<1^m<<2^m<<3^m<<4,i=i>>8^255&i^99,c[y]=i,l[i]=y,a=e[i],r=e[y],n=e[r],o=e[n],s=a<<24^i<<16^i<<8^i^a,u=(r^n^o)<<24^(y^o)<<16^(y^n^o)<<8^y^r^o;for(var g=0;g<4;++g)p[g][y]=s,d[g][i]=u,s=s<<24|s>>>8,u=u<<24|u>>>8;0===y?y=m=1:(y=r^e[e[e[r^o]]],m^=e[e[m]])}}function i(e,t){for(var r,n=e.slice(0),o=1,i=n.length,a=i+6+1,s=y*a,u=i;u<s;++u)r=n[u-1],u%i==0?(r=c[r>>>16&255]<<24^c[r>>>8&255]<<16^c[255&r]<<8^c[r>>>24]^f[o]<<24,o++):i>6&&u%i==4&&(r=c[r>>>24]<<24^c[r>>>16&255]<<16^c[r>>>8&255]<<8^c[255&r]),n[u]=n[u-i]^r;if(t){var l,p=d[0],h=d[1],m=d[2],g=d[3],v=n.slice(0);s=n.length;for(var u=0,b=s-y;u<s;u+=y,b-=y)if(0===u||u===s-y)v[u]=n[b],v[u+1]=n[b+3],v[u+2]=n[b+2],v[u+3]=n[b+1];else for(var E=0;E<y;++E)l=n[b+E],v[u+(3&-E)]=p[c[l>>>24]]^h[c[l>>>16&255]]^m[c[l>>>8&255]]^g[c[255&l]];n=v}return n}function a(e,t,r,n){var o,i,a,s,u,f=e.length/4-1;n?(o=d[0],i=d[1],a=d[2],s=d[3],u=l):(o=p[0],i=p[1],a=p[2],s=p[3],u=c);var h,y,m,g,v,b,E;h=t[0]^e[0],y=t[n?3:1]^e[1],m=t[2]^e[2],g=t[n?1:3]^e[3];for(var C=3,_=1;_<f;++_)v=o[h>>>24]^i[y>>>16&255]^a[m>>>8&255]^s[255&g]^e[++C],b=o[y>>>24]^i[m>>>16&255]^a[g>>>8&255]^s[255&h]^e[++C],E=o[m>>>24]^i[g>>>16&255]^a[h>>>8&255]^s[255&y]^e[++C],g=o[g>>>24]^i[h>>>16&255]^a[y>>>8&255]^s[255&m]^e[++C],h=v,y=b,m=E;r[0]=u[h>>>24]<<24^u[y>>>16&255]<<16^u[m>>>8&255]<<8^u[255&g]^e[++C],r[n?3:1]=u[y>>>24]<<24^u[m>>>16&255]<<16^u[g>>>8&255]<<8^u[255&h]^e[++C],r[2]=u[m>>>24]<<24^u[g>>>16&255]<<16^u[h>>>8&255]<<8^u[255&y]^e[++C],r[n?1:3]=u[g>>>24]<<24^u[h>>>16&255]<<16^u[y>>>8&255]<<8^u[255&m]^e[++C]}function s(e){e=e||{};var t,r=(e.mode||"CBC").toUpperCase(),n="AES-"+r;t=e.decrypt?u.cipher.createDecipher(n,e.key):u.cipher.createCipher(n,e.key);var o=t.start;return t.start=function(e,r){var n=null;r instanceof u.util.ByteBuffer&&(n=r,r={}),r=r||{},r.output=n,r.iv=e,o.call(t,r)},t}var u=r(1);r(28),r(44),r(2),e.exports=u.aes=u.aes||{},u.aes.startEncrypting=function(e,t,r,n){var o=s({key:e,output:r,decrypt:!1,mode:n});return o.start(t),o},u.aes.createEncryptionCipher=function(e,t){return s({key:e,output:null,decrypt:!1,mode:t})},u.aes.startDecrypting=function(e,t,r,n){var o=s({key:e,output:r,decrypt:!0,mode:n});return o.start(t),o},u.aes.createDecryptionCipher=function(e,t){return s({key:e,output:null,decrypt:!0,mode:t})},u.aes.Algorithm=function(e,t){h||o();var r=this;r.name=e,r.mode=new t({blockSize:16,cipher:{encrypt:function(e,t){return a(r._w,e,t,!1)},decrypt:function(e,t){return a(r._w,e,t,!0)}}}),r._init=!1},u.aes.Algorithm.prototype.initialize=function(e){if(!this._init){var t,r=e.key;if("string"!=typeof r||16!==r.length&&24!==r.length&&32!==r.length){if(u.util.isArray(r)&&(16===r.length||24===r.length||32===r.length)){t=r,r=u.util.createBuffer();for(var n=0;n<t.length;++n)r.putByte(t[n])}}else r=u.util.createBuffer(r);if(!u.util.isArray(r)){t=r,r=[];var o=t.length();if(16===o||24===o||32===o){o>>>=2;for(var n=0;n<o;++n)r.push(t.getInt32())}}if(!u.util.isArray(r)||4!==r.length&&6!==r.length&&8!==r.length)throw new Error("Invalid key parameter.");var a=this.mode.name,s=-1!==["CFB","OFB","CTR","GCM"].indexOf(a);this._w=i(r,e.decrypt&&!s),this._init=!0}},u.aes._expandKey=function(e,t){return h||o(),i(e,t)},u.aes._updateBlock=a,n("AES-ECB",u.cipher.modes.ecb),n("AES-CBC",u.cipher.modes.cbc),n("AES-CFB",u.cipher.modes.cfb),n("AES-OFB",u.cipher.modes.ofb),n("AES-CTR",u.cipher.modes.ctr),n("AES-GCM",u.cipher.modes.gcm);var c,l,f,p,d,h=!1,y=4},function(e,t,r){function n(e,t){a[e]=t,a[t]=e}function o(e,t){a[e]=t}var i=r(1);i.pki=i.pki||{};var a=e.exports=i.pki.oids=i.oids=i.oids||{};n("1.2.840.113549.1.1.1","rsaEncryption"),n("1.2.840.113549.1.1.4","md5WithRSAEncryption"),n("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),n("1.2.840.113549.1.1.7","RSAES-OAEP"),n("1.2.840.113549.1.1.8","mgf1"),n("1.2.840.113549.1.1.9","pSpecified"),n("1.2.840.113549.1.1.10","RSASSA-PSS"),n("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),n("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),n("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),n("1.3.14.3.2.7","desCBC"),n("1.3.14.3.2.26","sha1"),n("2.16.840.1.101.3.4.2.1","sha256"),n("2.16.840.1.101.3.4.2.2","sha384"),n("2.16.840.1.101.3.4.2.3","sha512"),n("1.2.840.113549.2.5","md5"),n("1.2.840.113549.1.7.1","data"),n("1.2.840.113549.1.7.2","signedData"),n("1.2.840.113549.1.7.3","envelopedData"),n("1.2.840.113549.1.7.4","signedAndEnvelopedData"),n("1.2.840.113549.1.7.5","digestedData"),n("1.2.840.113549.1.7.6","encryptedData"),n("1.2.840.113549.1.9.1","emailAddress"),n("1.2.840.113549.1.9.2","unstructuredName"),n("1.2.840.113549.1.9.3","contentType"),n("1.2.840.113549.1.9.4","messageDigest"),n("1.2.840.113549.1.9.5","signingTime"),n("1.2.840.113549.1.9.6","counterSignature"),n("1.2.840.113549.1.9.7","challengePassword"),n("1.2.840.113549.1.9.8","unstructuredAddress"),n("1.2.840.113549.1.9.14","extensionRequest"),n("1.2.840.113549.1.9.20","friendlyName"),n("1.2.840.113549.1.9.21","localKeyId"),n("1.2.840.113549.1.9.22.1","x509Certificate"),n("1.2.840.113549.1.12.10.1.1","keyBag"),n("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),n("1.2.840.113549.1.12.10.1.3","certBag"),n("1.2.840.113549.1.12.10.1.4","crlBag"),n("1.2.840.113549.1.12.10.1.5","secretBag"),n("1.2.840.113549.1.12.10.1.6","safeContentsBag"),n("1.2.840.113549.1.5.13","pkcs5PBES2"),n("1.2.840.113549.1.5.12","pkcs5PBKDF2"),n("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),n("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),n("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),n("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),n("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),n("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),n("1.2.840.113549.2.7","hmacWithSHA1"),n("1.2.840.113549.2.8","hmacWithSHA224"),n("1.2.840.113549.2.9","hmacWithSHA256"),n("1.2.840.113549.2.10","hmacWithSHA384"),n("1.2.840.113549.2.11","hmacWithSHA512"),n("1.2.840.113549.3.7","des-EDE3-CBC"),n("2.16.840.1.101.3.4.1.2","aes128-CBC"),n("2.16.840.1.101.3.4.1.22","aes192-CBC"),n("2.16.840.1.101.3.4.1.42","aes256-CBC"),n("2.5.4.3","commonName"),n("2.5.4.5","serialName"),n("2.5.4.6","countryName"),n("2.5.4.7","localityName"),n("2.5.4.8","stateOrProvinceName"),n("2.5.4.10","organizationName"),n("2.5.4.11","organizationalUnitName"),n("2.16.840.1.113730.1.1","nsCertType"),o("2.5.29.1","authorityKeyIdentifier"),o("2.5.29.2","keyAttributes"),o("2.5.29.3","certificatePolicies"),o("2.5.29.4","keyUsageRestriction"),o("2.5.29.5","policyMapping"),o("2.5.29.6","subtreesConstraint"),o("2.5.29.7","subjectAltName"),o("2.5.29.8","issuerAltName"),o("2.5.29.9","subjectDirectoryAttributes"),o("2.5.29.10","basicConstraints"),o("2.5.29.11","nameConstraints"),o("2.5.29.12","policyConstraints"),o("2.5.29.13","basicConstraints"),n("2.5.29.14","subjectKeyIdentifier"),n("2.5.29.15","keyUsage"),o("2.5.29.16","privateKeyUsagePeriod"),n("2.5.29.17","subjectAltName"),n("2.5.29.18","issuerAltName"),n("2.5.29.19","basicConstraints"),o("2.5.29.20","cRLNumber"),o("2.5.29.21","cRLReason"),o("2.5.29.22","expirationDate"),o("2.5.29.23","instructionCode"),o("2.5.29.24","invalidityDate"),o("2.5.29.25","cRLDistributionPoints"),o("2.5.29.26","issuingDistributionPoint"),o("2.5.29.27","deltaCRLIndicator"),o("2.5.29.28","issuingDistributionPoint"),o("2.5.29.29","certificateIssuer"),o("2.5.29.30","nameConstraints"),n("2.5.29.31","cRLDistributionPoints"),n("2.5.29.32","certificatePolicies"),o("2.5.29.33","policyMappings"),o("2.5.29.34","policyConstraints"),n("2.5.29.35","authorityKeyIdentifier"),o("2.5.29.36","policyConstraints"),n("2.5.29.37","extKeyUsage"),o("2.5.29.46","freshestCRL"),o("2.5.29.54","inhibitAnyPolicy"),n("1.3.6.1.4.1.11129.2.4.2","timestampList"),n("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),n("1.3.6.1.5.5.7.3.1","serverAuth"),n("1.3.6.1.5.5.7.3.2","clientAuth"),n("1.3.6.1.5.5.7.3.3","codeSigning"),n("1.3.6.1.5.5.7.3.4","emailProtection"),n("1.3.6.1.5.5.7.3.8","timeStamping")},function(e,t,r){function n(e){for(var t=e.name+": ",r=[],n=function(e,t){return" "+t},o=0;o<e.values.length;++o)r.push(e.values[o].replace(/^(\S+\r\n)/,n));t+=r.join(",")+"\r\n";for(var i=0,a=-1,o=0;o<t.length;++o,++i)if(i>65&&-1!==a){var s=t[a];","===s?(++a,t=t.substr(0,a)+"\r\n "+t.substr(a)):t=t.substr(0,a)+"\r\n"+s+t.substr(a+1),i=o-a-1,a=-1,++o}else" "!==t[o]&&"\t"!==t[o]&&","!==t[o]||(a=o);return t}function o(e){return e.replace(/^\s+/,"")}var i=r(1);r(2);var a=e.exports=i.pem=i.pem||{};a.encode=function(e,t){t=t||{};var r,o="-----BEGIN "+e.type+"-----\r\n";if(e.procType&&(r={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]},o+=n(r)),e.contentDomain&&(r={name:"Content-Domain",values:[e.contentDomain]},o+=n(r)),e.dekInfo&&(r={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&r.values.push(e.dekInfo.parameters),o+=n(r)),e.headers)for(var a=0;a<e.headers.length;++a)o+=n(e.headers[a]);return e.procType&&(o+="\r\n"),o+=i.util.encode64(e.body,t.maxline||64)+"\r\n",o+="-----END "+e.type+"-----\r\n"},a.decode=function(e){for(var t,r=[],n=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,a=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,s=/\r?\n/;;){if(!(t=n.exec(e)))break;var u={type:t[1],procType:null,contentDomain:null,dekInfo:null,headers:[],body:i.util.decode64(t[3])};if(r.push(u),t[2]){for(var c=t[2].split(s),l=0;t&&l<c.length;){for(var f=c[l].replace(/\s+$/,""),p=l+1;p<c.length;++p){var d=c[p];if(!/\s/.test(d[0]))break;f+=d,l=p}if(t=f.match(a)){for(var h={name:t[1],values:[]},y=t[2].split(","),m=0;m<y.length;++m)h.values.push(o(y[m]));if(u.procType)if(u.contentDomain||"Content-Domain"!==h.name)if(u.dekInfo||"DEK-Info"!==h.name)u.headers.push(h);else{if(0===h.values.length)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');u.dekInfo={algorithm:y[0],parameters:y[1]||null}}else u.contentDomain=y[0]||"";else{if("Proc-Type"!==h.name)throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(2!==h.values.length)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');u.procType={version:y[0],type:y[1]}}}++l}if("ENCRYPTED"===u.procType&&!u.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(0===r.length)throw new Error("Invalid PEM formatted message.");return r}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(){return this.dueDate&&this.dueDate.getTime()<Date.now()}t.__esModule=!0;var a=r(3),s=n(a),u=r(59),c=n(u),l=r(21),f=n(l),p=r(60),d=n(p),h=r(22),y=n(h),m=r(61),g=r(109),v=n(g),b=r(9),E=n(b),C=r(110),_=n(C),w=r(111),T=n(w),S=r(112),I=n(S),A={id:"ProofId",name:"Title",status:"Status",workflowId:"WorkflowId",proofTemplateId:"ProofTemplateId",version:"Version",dueDate:(0,a.date)("DueDate"),createdDate:(0,a.date)("CreateDate"),approvedDate:(0,a.date)("ApprovedDate"),isLocked:"Locked",isArchived:"Closed",isOverdue:i,uploaderUserId:"UserId",ownerUserIds:"OwnerIds",editorUserId:"EditorId",editorUserIds:"EditorIds",lockerUserId:"ProofLockerId",messageToReviewers:"Description",messageToOwners:"OwnerMessage",messageToEditor:"EditorMessage",fileId:"FileId",fileExtension:"Extension",fileStatus:"FileStatus",fileMessage:"FileStatusMessage",fileSize:"FileSize",pageCount:(0,a.number)("Pages"),commentCount:(0,a.number)("ParentComments"),canDownload:(0,a.truthy)("DownloadOriginal"),type:"Type",processStatus:"ProcessStatus",recipient:"Recipient",recipientEmail:"RecipientEmail",todoCommentCount:(0,a.number)("CountTodoComments"),doneCommentCount:(0,a.number)("CountDoneComments"),fileCategory:"FileCategory",isAdminOnProof:"IsAdminOnProof",groupId:"GroupId",canReupload:"CanReupload",hasEditors:"HasEditors",groupName:"GroupName",role:"Role",canOthersEditComments:"FeatureEditComments",canAddCommentReplies:"FeatureCanAddCommentReplies",canHaveGeneralComments:"FeatureGeneralComments",canHavePrivateComments:"FeaturePrivateComments",canAddChecklist:"FeatureCanAddChecklist",hasDecisionsEnabled:"FeatureDecisions",hasColorSeparations:"HasColorSeparations",reference:"Reference",integrationReferences:(0,a.each)("IntegrationReferences",function(e){return(new T.default).fromProofIntegrationReference(e)}),checklist:function(e){return e.Checklist&&(new I.default).fromProofChecklist(e.Checklist)},isReferenceEnabled:"FeatureProofReference",source:"Source",owners:(0,a.each)("Owners",function(e){return(new E.default).fromUser(e)}),decisionSummary:(0,a.each)("Decisions",function(e){return(new _.default).fromDecisionSummary(e)}),tags:(0,a.each)("Tags",function(e){return e.Value}),teamId:"TeamId",isPublic:"IsPublic",canBePublic:"FeaturePublicProofs",availableWorkflowRoles:"FeatureAvailableWorkflowRoles",usePreviousVersionDueDate:"FeatureUsePreviousVersionDueDate",canSendShareLink:"FeatureSendShareLink",publicProofKeyPair:function(e){return e.PublicProofKeyPair&&{publicKeyPEM:e.PublicProofKeyPair.PublicKey,privateKeyPEM:e.PublicProofKeyPair.PrivateKey}},canSendMessageToOwners:"FeatureMessageToOwners",workflowMetrics:"WorkflowMetrics",commentVisibility:"CommentVisibility",canHaveCommentVisibility:"FeatureCommentVisibility",importUrl:"ImportURL",priority:"Priority",scheduledDate:"ScheduledDate"},k=function(){function e(){o(this,e)}return e.prototype.isUserAdminOfProofTeam=function(e){return e.isAdmin&&this.teamId===e.teamId},e.prototype.getState=function(){var e=c.default.ACTIVE;if(this.fileStatus===y.default.UPLOADING)e=c.default.UPLOADING;else if(this.hasFileError())e=c.default.FILE_ERROR;else if(this.isProcessing())e=c.default.PROCESSING;else if(this.type===d.default.BRIEF)switch(this.status){case f.default.NEW:e=c.default.SETUP_NEEDED;break;case f.default.PROOFING:e=c.default.BRIEFING;break;case f.default.AWAITING_NEW_VERSION:e=c.default.AWAITING_PROOF;break;case f.default.HAS_NEW_VERSION:e=c.default.HAS_NEW_VERSION;break;case f.default.ARCHIVED:e=c.default.ARCHIVED}else this.status===f.default.ARCHIVED?e=c.default.ARCHIVED:this.status===f.default.TODOS_REQUESTED?e=c.default.TODOS_REQUESTED:this.status===f.default.AWAITING_NEW_VERSION?e=c.default.AWAITING_NEW_VERSION:this.status===f.default.HAS_NEW_VERSION?e=c.default.HAS_NEW_VERSION:this.status===f.default.APPROVED?e=c.default.APPROVED:this.hasWorkflow()?this.hasWorkflowStarted()?this.isOverdue&&(e=c.default.OVERDUE):e=c.default.NOT_STARTED:e=c.default.PROOFERS_NEEDED;return e},e.prototype.getVideoProcessingProgress=function(){var e=0,t=String(this.fileMessage);if(t){var r=/^Thumb-\w+\-([-+]?[0-9]*\.?[0-9]*)/g.exec(t),n=/^Video-\w+\-([-+]?[0-9]*\.?[0-9]*)/g.exec(t);t.startsWith("Video-Scheduled-")?e=0:n?e=(0,v.default)(parseFloat(n[1])/100,0,.2):r&&(e=(0,v.default)(parseFloat(r[1])/100,.8,0))}return e},e.prototype.hasWorkflowStarted=function(){return this.hasWorkflow()&&this.status!==f.default.NEW},e.prototype.isProcessing=function(){return this.fileStatus===y.default.UPLOADING||this.fileStatus===y.default.QUEUED||this.fileStatus===y.default.RIPPING},e.prototype.isAwaitingFile=function(){return this.source&&this.fileStatus===y.default.CREATED},e.prototype.getProcessingProgress=function(){switch(this.fileStatus){case y.default.UPLOADING:return.1;case y.default.QUEUED:return.2;case y.default.RIPPING:return"video"===this.fileCategory?(0,v.default)(this.getVideoProcessingProgress(),.2,.1).toFixed(2):.6;default:return-1}},e.prototype.hasWorkflow=function(){return(0,m.isWorkflowId)(this.workflowId)},e.prototype.hasFile=function(){return(0,m.isFileId)(this.fileId)},e.prototype.hasFileError=function(){return this.fileStatus===y.default.ERROR||!this.fileStatus||!this.hasFile()},e.prototype.hasEditor=function(){return(0,m.isUserId)(this.editorUserId)},e.prototype.hasThumbnail=function(){return this.fileStatus===y.default.OK},e.prototype.canUserUploadNewVersion=function(e){return this.getState()===c.default.AWAITING_NEW_VERSION&&(this.isEditor(e)||this.isOwner(e))||this.getState()===c.default.AWAITING_PROOF&&(this.isEditor(e)||this.isRecipient(e))},e.prototype.isOwner=function(e){return-1!==this.ownerUserIds.indexOf(e)},e.prototype.isEditor=function(e){return-1!==this.editorUserIds.indexOf(e)},e.prototype.isRecipient=function(e){return this.recipient===e},e.prototype.calculateState=function(){this.state=this.getState()},e.prototype.fromProof=function(e){return(0,s.default)(this,A,e),this.calculateState(),this},e}();t.default=k},function(e,t,r){var n=r(1);r(8),r(2),(e.exports=n.hmac=n.hmac||{}).create=function(){var e=null,t=null,r=null,o=null,i={};return i.start=function(i,a){if(null!==i)if("string"==typeof i){if(!((i=i.toLowerCase())in n.md.algorithms))throw new Error('Unknown hash algorithm "'+i+'"');t=n.md.algorithms[i].create()}else t=i;if(null===a)a=e;else{if("string"==typeof a)a=n.util.createBuffer(a);else if(n.util.isArray(a)){var s=a;a=n.util.createBuffer();for(var u=0;u<s.length;++u)a.putByte(s[u])}var c=a.length();c>t.blockLength&&(t.start(),t.update(a.bytes()),a=t.digest()),r=n.util.createBuffer(),o=n.util.createBuffer(),c=a.length();for(var u=0;u<c;++u){var s=a.at(u);r.putByte(54^s),o.putByte(92^s)}if(c<t.blockLength)for(var s=t.blockLength-c,u=0;u<s;++u)r.putByte(54),o.putByte(92);e=a,r=r.bytes(),o=o.bytes()}t.start(),t.update(r)},i.update=function(e){t.update(e)},i.getMac=function(){var e=t.digest().bytes();return t.start(),t.update(o),t.update(e),t.digest()},i.digest=i.getMac,i}},function(e,t,r){function n(){s=String.fromCharCode(128),s+=i.util.fillString(String.fromCharCode(0),64),u=!0}function o(e,t,r){for(var n,o,i,a,s,u,c,l,f=r.length();f>=64;){for(o=e.h0,i=e.h1,a=e.h2,s=e.h3,u=e.h4,l=0;l<16;++l)n=r.getInt32(),t[l]=n,c=s^i&(a^s),n=(o<<5|o>>>27)+c+u+1518500249+n,u=s,s=a,a=(i<<30|i>>>2)>>>0,i=o,o=n;for(;l<20;++l)n=t[l-3]^t[l-8]^t[l-14]^t[l-16],n=n<<1|n>>>31,t[l]=n,c=s^i&(a^s),n=(o<<5|o>>>27)+c+u+1518500249+n,u=s,s=a,a=(i<<30|i>>>2)>>>0,i=o,o=n;for(;l<32;++l)n=t[l-3]^t[l-8]^t[l-14]^t[l-16],n=n<<1|n>>>31,t[l]=n,c=i^a^s,n=(o<<5|o>>>27)+c+u+1859775393+n,u=s,s=a,a=(i<<30|i>>>2)>>>0,i=o,o=n;for(;l<40;++l)n=t[l-6]^t[l-16]^t[l-28]^t[l-32],n=n<<2|n>>>30,t[l]=n,c=i^a^s,n=(o<<5|o>>>27)+c+u+1859775393+n,u=s,s=a,a=(i<<30|i>>>2)>>>0,i=o,o=n;for(;l<60;++l)n=t[l-6]^t[l-16]^t[l-28]^t[l-32],n=n<<2|n>>>30,t[l]=n,c=i&a|s&(i^a),n=(o<<5|o>>>27)+c+u+2400959708+n,u=s,s=a,a=(i<<30|i>>>2)>>>0,i=o,o=n;for(;l<80;++l)n=t[l-6]^t[l-16]^t[l-28]^t[l-32],n=n<<2|n>>>30,t[l]=n,c=i^a^s,n=(o<<5|o>>>27)+c+u+3395469782+n,u=s,s=a,a=(i<<30|i>>>2)>>>0,i=o,o=n;e.h0=e.h0+o|0,e.h1=e.h1+i|0,e.h2=e.h2+a|0,e.h3=e.h3+s|0,e.h4=e.h4+u|0,f-=64}}var i=r(1);r(8),r(2);var a=e.exports=i.sha1=i.sha1||{};i.md.sha1=i.md.algorithms.sha1=a,a.create=function(){u||n();var e=null,t=i.util.createBuffer(),r=new Array(80),a={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8};return a.start=function(){a.messageLength=0,a.fullMessageLength=a.messageLength64=[];for(var r=a.messageLengthSize/4,n=0;n<r;++n)a.fullMessageLength.push(0);return t=i.util.createBuffer(),e={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},a},a.start(),a.update=function(n,s){"utf8"===s&&(n=i.util.encodeUtf8(n));var u=n.length;a.messageLength+=u,u=[u/4294967296>>>0,u>>>0];for(var c=a.fullMessageLength.length-1;c>=0;--c)a.fullMessageLength[c]+=u[1],u[1]=u[0]+(a.fullMessageLength[c]/4294967296>>>0),a.fullMessageLength[c]=a.fullMessageLength[c]>>>0,u[0]=u[1]/4294967296>>>0;return t.putBytes(n),o(e,r,t),(t.read>2048||0===t.length())&&t.compact(),a},a.digest=function(){var n=i.util.createBuffer();n.putBytes(t.bytes());var u=a.fullMessageLength[a.fullMessageLength.length-1]+a.messageLengthSize,c=u&a.blockLength-1;n.putBytes(s.substr(0,a.blockLength-c));for(var l,f,p=8*a.fullMessageLength[0],d=0;d<a.fullMessageLength.length-1;++d)l=8*a.fullMessageLength[d+1],f=l/4294967296>>>0,p+=f,n.putInt32(p>>>0),p=l>>>0;n.putInt32(p);var h={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4};o(h,r,n);var y=i.util.createBuffer();return y.putInt32(h.h0),y.putInt32(h.h1),y.putInt32(h.h2),y.putInt32(h.h3),y.putInt32(h.h4),y},a};var s=null,u=!1},function(e,t,r){"use strict";t.__esModule=!0;var n={ERROR_CRITICAL:3,OK:200,ERROR_INVALID:201,ERROR_NO_ACCESS:100,ERROR_NO_ACCESS_WRITE:101,ERROR_RESTRICTED:102,ERROR_SQL_ERROR:105,ERROR_OUT_SYNC:106,ERROR_STORAGE_ERROR:110,ERROR_QUEUE_ERROR:111,ERROR_SQL_DEADLOCK_ERROR:121,ERROR_BAD_REQUEST:400,ERROR_UNAUTHORISED:401,ERROR_MEDIA_PERMISSION_NO_ACCESS:402,ERROR_NOT_FOUND:1e3,ERROR_CREATE:1001,ERROR_UPDATE:1002,ERROR_DELETE:1003,ERROR_EXISTS:1004,ERROR_USER_INVALID_LOGIN:1010,ERROR_USER_INVALID_PASSWORD:1011,ERROR_USER_IS_REGISTERED:1012,ERROR_USER_INVALID_EMAIL:1013,ERROR_USER_INVALID_LOGIN_COUNT:1014,ERROR_USER_DISABLED:1015,ERROR_BAD_REQUEST_DATE:201,ERROR_THROTTLED:429,ERROR_REUSED_CREATION_TOKEN:2011,ERROR_UPGRADE_REQUIRED:3e3,ERROR_VISIBLE_WORKFLOW_USERS_EXIST:3001,ERROR_GROUP_EXISTS:3002,ERROR_GROUP_PROOFS_EXIST:3003,ERROR_FILE_UPLOAD_INVALID_FILE:4001,ERROR_FILE_UPLOAD_INVALID_FILENAME:4005,ERROR_FILE_UPLOAD_MISSING_EXTENSION:4007};t.default=n},function(e,t,r){"use strict";t.__esModule=!0,t.default=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=r(3),a=n(i),s=r(9),u=n(s),c=r(5),l={userId:"UserId",token:"Token",sharedKey:"SharedKey",privateKeyPEM$:"PrivateKey",privateKeyPEM:null,publicKeyPEM:"PublicKey",serverPublicKeyPEM:"PublicServerKey",redirectUrl:"RedirectURL"},f=function(){function e(){o(this,e)}return e.prototype.fromJSON=function(e){return(0,a.default)(this,Object.keys(l),e),this.user=(new u.default).fromJSON(e.user),this},e.prototype.fromSession=function(e){return(0,a.default)(this,l,e),this.user=(new u.default).fromUser(e),this},e.prototype.fromBrian=function(e){return this.userId=c.BRIAN_USER_ID,this.token=e.token,this.sharedKey=e.sharedKey,this.origin=e.origin,this},e}();t.default=f},function(e,t,r){function n(e,t){var r=function(){return new s.des.Algorithm(e,t)};s.cipher.registerAlgorithm(e,r)}function o(e){for(var t,r=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],n=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],o=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],i=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],a=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],s=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],u=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],c=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],l=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],f=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],p=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],d=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],h=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],y=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],m=e.length()>8?3:1,g=[],v=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=0,E=0;E<m;E++){var C=e.getInt32(),_=e.getInt32();t=252645135&(C>>>4^_),_^=t,C^=t<<4,t=65535&(_>>>-16^C),C^=t,_^=t<<-16,t=858993459&(C>>>2^_),_^=t,C^=t<<2,t=65535&(_>>>-16^C),C^=t,_^=t<<-16,t=1431655765&(C>>>1^_),_^=t,C^=t<<1,t=16711935&(_>>>8^C),C^=t,_^=t<<8,t=1431655765&(C>>>1^_),_^=t,C^=t<<1,t=C<<8|_>>>20&240,C=_<<24|_<<8&16711680|_>>>8&65280|_>>>24&240,_=t;for(var w=0;w<v.length;++w){v[w]?(C=C<<2|C>>>26,_=_<<2|_>>>26):(C=C<<1|C>>>27,_=_<<1|_>>>27),C&=-15,_&=-15;var T=r[C>>>28]|n[C>>>24&15]|o[C>>>20&15]|i[C>>>16&15]|a[C>>>12&15]|s[C>>>8&15]|u[C>>>4&15],S=c[_>>>28]|l[_>>>24&15]|f[_>>>20&15]|p[_>>>16&15]|d[_>>>12&15]|h[_>>>8&15]|y[_>>>4&15];t=65535&(S>>>16^T),g[b++]=T^t,g[b++]=S^t<<16}}return g}function i(e,t,r,n){var o,i=32===e.length?3:9;o=3===i?n?[30,-2,-2]:[0,32,2]:n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var a,s=t[0],m=t[1];a=252645135&(s>>>4^m),m^=a,s^=a<<4,a=65535&(s>>>16^m),m^=a,s^=a<<16,a=858993459&(m>>>2^s),s^=a,m^=a<<2,a=16711935&(m>>>8^s),s^=a,m^=a<<8,a=1431655765&(s>>>1^m),m^=a,s^=a<<1,s=s<<1|s>>>31,m=m<<1|m>>>31;for(var g=0;g<i;g+=3){for(var v=o[g+1],b=o[g+2],E=o[g];E!=v;E+=b){var C=m^e[E],_=(m>>>4|m<<28)^e[E+1];a=s,s=m,m=a^(c[C>>>24&63]|f[C>>>16&63]|d[C>>>8&63]|y[63&C]|u[_>>>24&63]|l[_>>>16&63]|p[_>>>8&63]|h[63&_])}a=s,s=m,m=a}s=s>>>1|s<<31,m=m>>>1|m<<31,a=1431655765&(s>>>1^m),m^=a,s^=a<<1,a=16711935&(m>>>8^s),s^=a,m^=a<<8,a=858993459&(m>>>2^s),s^=a,m^=a<<2,a=65535&(s>>>16^m),m^=a,s^=a<<16,a=252645135&(s>>>4^m),m^=a,s^=a<<4,r[0]=s,r[1]=m}function a(e){e=e||{};var t,r=(e.mode||"CBC").toUpperCase(),n="DES-"+r;t=e.decrypt?s.cipher.createDecipher(n,e.key):s.cipher.createCipher(n,e.key);var o=t.start;return t.start=function(e,r){var n=null;r instanceof s.util.ByteBuffer&&(n=r,r={}),r=r||{},r.output=n,r.iv=e,o.call(t,r)},t}var s=r(1);r(28),r(44),r(2),e.exports=s.des=s.des||{},s.des.startEncrypting=function(e,t,r,n){var o=a({key:e,output:r,decrypt:!1,mode:n||(null===t?"ECB":"CBC")});return o.start(t),o},s.des.createEncryptionCipher=function(e,t){return a({key:e,output:null,decrypt:!1,mode:t})},s.des.startDecrypting=function(e,t,r,n){var o=a({key:e,output:r,decrypt:!0,mode:n||(null===t?"ECB":"CBC")});return o.start(t),o},s.des.createDecryptionCipher=function(e,t){return a({key:e,output:null,decrypt:!0,mode:t})},s.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return i(r._keys,e,t,!1)},decrypt:function(e,t){return i(r._keys,e,t,!0)}}}),r._init=!1},s.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=s.util.createBuffer(e.key);if(0===this.name.indexOf("3DES")&&24!==t.length())throw new Error("Invalid Triple-DES key size: "+8*t.length());this._keys=o(t),this._init=!0}},n("DES-ECB",s.cipher.modes.ecb),n("DES-CBC",s.cipher.modes.cbc),n("DES-CFB",s.cipher.modes.cfb),n("DES-OFB",s.cipher.modes.ofb),n("DES-CTR",s.cipher.modes.ctr),n("3DES-ECB",s.cipher.modes.ecb),n("3DES-CBC",s.cipher.modes.cbc),n("3DES-CFB",s.cipher.modes.cfb),n("3DES-OFB",s.cipher.modes.ofb),n("3DES-CTR",s.cipher.modes.ctr);var u=[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],c=[-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],l=[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],f=[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],p=[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],d=[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],h=[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],y=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696]},function(e,t,r){function n(e,t,r){var n=f.util.createBuffer(),o=Math.ceil(t.n.bitLength()/8);if(e.length>o-11){var i=new Error("Message is too long for PKCS#1 v1.5 padding.");throw i.length=e.length,i.max=o-11,i}n.putByte(0),n.putByte(r);var a,s=o-3-e.length;if(0===r||1===r){a=0===r?0:255;for(var u=0;u<s;++u)n.putByte(a)}else for(;s>0;){for(var c=0,l=f.random.getBytes(s),u=0;u<s;++u)a=l.charCodeAt(u),0===a?++c:n.putByte(a);s=c}return n.putByte(0),n.putBytes(e),n}function o(e,t,r,n){var o=Math.ceil(t.n.bitLength()/8),i=f.util.createBuffer(e),a=i.getByte(),s=i.getByte();if(0!==a||r&&0!==s&&1!==s||!r&&2!=s||r&&0===s&&void 0===n)throw new Error("Encryption block is invalid.");var u=0;if(0===s){u=o-3-n;for(var c=0;c<u;++c)if(0!==i.getByte())throw new Error("Encryption block is invalid.")}else if(1===s)for(u=0;i.length()>1;){if(255!==i.getByte()){--i.read;break}++u}else if(2===s)for(u=0;i.length()>1;){if(0===i.getByte()){--i.read;break}++u}if(0!==i.getByte()||u!==o-3-i.length())throw new Error("Encryption block is invalid.");return i.getBytes()}function i(e,t,r){function n(){o(e.pBits,function(t,n){return t?r(t):(e.p=n,null!==e.q?i(t,e.q):void o(e.qBits,i))})}function o(e,t){f.prime.generateProbablePrime(e,a,t)}function i(t,a){if(t)return r(t);if(e.q=a,e.p.compareTo(e.q)<0){var s=e.p;e.p=e.q,e.q=s}if(0!==e.p.subtract(p.ONE).gcd(e.e).compareTo(p.ONE))return e.p=null,void n();if(0!==e.q.subtract(p.ONE).gcd(e.e).compareTo(p.ONE))return e.q=null,void o(e.qBits,i);if(e.p1=e.p.subtract(p.ONE),e.q1=e.q.subtract(p.ONE),e.phi=e.p1.multiply(e.q1),0!==e.phi.gcd(e.e).compareTo(p.ONE))return e.p=e.q=null,void n();if(e.n=e.p.multiply(e.q),e.n.bitLength()!==e.bits)return e.q=null,void o(e.qBits,i);var u=e.e.modInverse(e.phi);e.keys={privateKey:h.rsa.setPrivateKey(e.n,e.e,u,e.p,e.q,u.mod(e.p1),u.mod(e.q1),e.q.modInverse(e.p)),publicKey:h.rsa.setPublicKey(e.n,e.e)},r(null,e.keys)}"function"==typeof t&&(r=t,t={}),t=t||{};var a={algorithm:{name:t.algorithm||"PRIMEINC",options:{workers:t.workers||2,workLoad:t.workLoad||100,workerScript:t.workerScript}}};"prng"in t&&(a.prng=t.prng),n()}function a(e){var t=e.toString(16);t[0]>="8"&&(t="00"+t);var r=f.util.hexToBytes(t);return r.length>1&&(0===r.charCodeAt(0)&&0==(128&r.charCodeAt(1))||255===r.charCodeAt(0)&&128==(128&r.charCodeAt(1)))?r.substr(1):r}function s(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}function u(e){return"undefined"!=typeof window&&"object"==typeof window.crypto&&"object"==typeof window.crypto.subtle&&"function"==typeof window.crypto.subtle[e]}function c(e){return"undefined"!=typeof window&&"object"==typeof window.msCrypto&&"object"==typeof window.msCrypto.subtle&&"function"==typeof window.msCrypto.subtle[e]}function l(e){for(var t=f.util.hexToBytes(e.toString(16)),r=new Uint8Array(t.length),n=0;n<t.length;++n)r[n]=t.charCodeAt(n);return r}var f=r(1);if(r(7),r(31),r(11),r(52),r(53),r(6),r(2),void 0===p)var p=f.jsbn.BigInteger;var d=f.asn1;f.pki=f.pki||{},e.exports=f.pki.rsa=f.rsa=f.rsa||{};var h=f.pki,y=[6,4,2,4,2,4,6,2],m={name:"PrivateKeyInfo",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:d.Class.UNIVERSAL,type:d.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:d.Class.UNIVERSAL,type:d.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},g={name:"RSAPrivateKey",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},v={name:"RSAPublicKey",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},b=f.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:d.Class.UNIVERSAL,type:d.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:d.Class.UNIVERSAL,type:d.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},E=function(e){var t;if(!(e.algorithm in h.oids)){var r=new Error("Unknown message digest algorithm.");throw r.algorithm=e.algorithm,r}t=h.oids[e.algorithm];var n=d.oidToDer(t).getBytes(),o=d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[]),i=d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[]);i.value.push(d.create(d.Class.UNIVERSAL,d.Type.OID,!1,n)),i.value.push(d.create(d.Class.UNIVERSAL,d.Type.NULL,!1,""));var a=d.create(d.Class.UNIVERSAL,d.Type.OCTETSTRING,!1,e.digest().getBytes());return o.value.push(i),o.value.push(a),d.toDer(o).getBytes()},C=function(e,t,r){if(r)return e.modPow(t.e,t.n);if(!t.p||!t.q)return e.modPow(t.d,t.n);t.dP||(t.dP=t.d.mod(t.p.subtract(p.ONE))),t.dQ||(t.dQ=t.d.mod(t.q.subtract(p.ONE))),t.qInv||(t.qInv=t.q.modInverse(t.p));var n;do{n=new p(f.util.bytesToHex(f.random.getBytes(t.n.bitLength()/8)),16)}while(n.compareTo(t.n)>=0||!n.gcd(t.n).equals(p.ONE));e=e.multiply(n.modPow(t.e,t.n)).mod(t.n);for(var o=e.mod(t.p).modPow(t.dP,t.p),i=e.mod(t.q).modPow(t.dQ,t.q);o.compareTo(i)<0;)o=o.add(t.p);var a=o.subtract(i).multiply(t.qInv).mod(t.p).multiply(t.q).add(i);return a=a.multiply(n.modInverse(t.n)).mod(t.n)};h.rsa.encrypt=function(e,t,r){var o,i=r,a=Math.ceil(t.n.bitLength()/8);!1!==r&&!0!==r?(i=2===r,o=n(e,t,r)):(o=f.util.createBuffer(),o.putBytes(e));for(var s=new p(o.toHex(),16),u=C(s,t,i),c=u.toString(16),l=f.util.createBuffer(),d=a-Math.ceil(c.length/2);d>0;)l.putByte(0),--d;return l.putBytes(f.util.hexToBytes(c)),l.getBytes()},h.rsa.decrypt=function(e,t,r,n){var i=Math.ceil(t.n.bitLength()/8);if(e.length!==i){var a=new Error("Encrypted message length is invalid.");throw a.length=e.length,a.expected=i,a}var s=new p(f.util.createBuffer(e).toHex(),16);if(s.compareTo(t.n)>=0)throw new Error("Encrypted message is invalid.");for(var u=C(s,t,r),c=u.toString(16),l=f.util.createBuffer(),d=i-Math.ceil(c.length/2);d>0;)l.putByte(0),--d;return l.putBytes(f.util.hexToBytes(c)),!1!==n?o(l.getBytes(),t,r):l.getBytes()},h.rsa.createKeyPairGenerationState=function(e,t,r){"string"==typeof e&&(e=parseInt(e,10)),e=e||2048,r=r||{};var n,o=r.prng||f.random,i={nextBytes:function(e){for(var t=o.getBytesSync(e.length),r=0;r<e.length;++r)e[r]=t.charCodeAt(r)}},a=r.algorithm||"PRIMEINC";if("PRIMEINC"!==a)throw new Error("Invalid key generation algorithm: "+a);return n={algorithm:a,state:0,bits:e,rng:i,eInt:t||65537,e:new p(null),p:null,q:null,qBits:e>>1,pBits:e-(e>>1),pqState:0,num:null,keys:null},n.e.fromInt(n.eInt),n},h.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var r=new p(null);r.fromInt(30);for(var n,o=0,i=function(e,t){return e|t},a=+new Date,u=0;null===e.keys&&(t<=0||u<t);){if(0===e.state){var c=null===e.p?e.pBits:e.qBits,l=c-1;0===e.pqState?(e.num=new p(c,e.rng),e.num.testBit(l)||e.num.bitwiseTo(p.ONE.shiftLeft(l),i,e.num),e.num.dAddOffset(31-e.num.mod(r).byteValue(),0),o=0,++e.pqState):1===e.pqState?e.num.bitLength()>c?e.pqState=0:e.num.isProbablePrime(s(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(y[o++%8],0):2===e.pqState?e.pqState=0===e.num.subtract(p.ONE).gcd(e.e).compareTo(p.ONE)?3:0:3===e.pqState&&(e.pqState=0,null===e.p?e.p=e.num:e.q=e.num,null!==e.p&&null!==e.q&&++e.state,e.num=null)}else if(1===e.state)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(2===e.state)e.p1=e.p.subtract(p.ONE),e.q1=e.q.subtract(p.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(3===e.state)0===e.phi.gcd(e.e).compareTo(p.ONE)?++e.state:(e.p=null,e.q=null,e.state=0);else if(4===e.state)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(5===e.state){var f=e.e.modInverse(e.phi);e.keys={privateKey:h.rsa.setPrivateKey(e.n,e.e,f,e.p,e.q,f.mod(e.p1),f.mod(e.q1),e.q.modInverse(e.p)),publicKey:h.rsa.setPublicKey(e.n,e.e)}}n=+new Date,u+=n-a,a=n}return null!==e.keys},h.rsa.generateKeyPair=function(e,t,r,n){if(1===arguments.length?"object"==typeof e?(r=e,e=void 0):"function"==typeof e&&(n=e,e=void 0):2===arguments.length?"number"==typeof e?"function"==typeof t?(n=t,t=void 0):"number"!=typeof t&&(r=t,t=void 0):(r=e,n=t,e=void 0,t=void 0):3===arguments.length&&("number"==typeof t?"function"==typeof r&&(n=r,r=void 0):(n=r,r=t,t=void 0)),r=r||{},void 0===e&&(e=r.bits||2048),void 0===t&&(t=r.e||65537),!f.options.usePureJavaScript&&n&&e>=256&&e<=16384&&(65537===t||3===t)){if(u("generateKey")&&u("exportKey"))return window.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:l(t),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(e){return window.crypto.subtle.exportKey("pkcs8",e.privateKey)}).then(void 0,function(e){n(e)}).then(function(e){if(e){var t=h.privateKeyFromAsn1(d.fromDer(f.util.createBuffer(e)));n(null,{privateKey:t,publicKey:h.setRsaPublicKey(t.n,t.e)})}});if(c("generateKey")&&c("exportKey")){var o=window.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:l(t),hash:{name:"SHA-256"}},!0,["sign","verify"]);return o.oncomplete=function(e){var t=e.target.result,r=window.msCrypto.subtle.exportKey("pkcs8",t.privateKey);r.oncomplete=function(e){var t=e.target.result,r=h.privateKeyFromAsn1(d.fromDer(f.util.createBuffer(t)));n(null,{privateKey:r,publicKey:h.setRsaPublicKey(r.n,r.e)})},r.onerror=function(e){n(e)}},void(o.onerror=function(e){n(e)})}}var a=h.rsa.createKeyPairGenerationState(e,t,r);if(!n)return h.rsa.stepKeyPairGenerationState(a,0),a.keys;i(a,r,n)},h.setRsaPublicKey=h.rsa.setPublicKey=function(e,t){var r={n:e,e:t};return r.encrypt=function(e,t,o){if("string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5"),"RSAES-PKCS1-V1_5"===t)t={encode:function(e,t,r){return n(e,t,2).getBytes()}};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={encode:function(e,t){return f.pkcs1.encode_rsa_oaep(t,e,o)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(t))t={encode:function(e){return e}};else if("string"==typeof t)throw new Error('Unsupported encryption scheme: "'+t+'".');var i=t.encode(e,r,!0);return h.rsa.encrypt(i,r,!0)},r.verify=function(e,t,n){"string"==typeof n?n=n.toUpperCase():void 0===n&&(n="RSASSA-PKCS1-V1_5"),"RSASSA-PKCS1-V1_5"===n?n={verify:function(e,t){return t=o(t,r,!0),e===d.fromDer(t).value[1].value}}:"NONE"!==n&&"NULL"!==n&&null!==n||(n={verify:function(e,t){return t=o(t,r,!0),e===t}});var i=h.rsa.decrypt(t,r,!0,!1);return n.verify(e,i,r.n.bitLength())},r},h.setRsaPrivateKey=h.rsa.setPrivateKey=function(e,t,r,n,i,a,s,u){var c={n:e,e:t,d:r,p:n,q:i,dP:a,dQ:s,qInv:u};return c.decrypt=function(e,t,r){"string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5");var n=h.rsa.decrypt(e,c,!1,!1);if("RSAES-PKCS1-V1_5"===t)t={decode:o};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={decode:function(e,t){return f.pkcs1.decode_rsa_oaep(t,e,r)}};else{if(-1===["RAW","NONE","NULL",null].indexOf(t))throw new Error('Unsupported encryption scheme: "'+t+'".');t={decode:function(e){return e}}}return t.decode(n,c,!1)},c.sign=function(e,t){var r=!1;"string"==typeof t&&(t=t.toUpperCase()),void 0===t||"RSASSA-PKCS1-V1_5"===t?(t={encode:E},r=1):"NONE"!==t&&"NULL"!==t&&null!==t||(t={encode:function(){return e}},r=1);var n=t.encode(e,c.n.bitLength());return h.rsa.encrypt(n,c,r)},c},h.wrapRsaPrivateKey=function(e){return d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,d.integerToDer(0).getBytes()),d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.OID,!1,d.oidToDer(h.oids.rsaEncryption).getBytes()),d.create(d.Class.UNIVERSAL,d.Type.NULL,!1,"")]),d.create(d.Class.UNIVERSAL,d.Type.OCTETSTRING,!1,d.toDer(e).getBytes())])},h.privateKeyFromAsn1=function(e){var t={},r=[];if(d.validate(e,m,t,r)&&(e=d.fromDer(f.util.createBuffer(t.privateKey))),t={},r=[],!d.validate(e,g,t,r)){var n=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw n.errors=r,n}var o,i,a,s,u,c,l,y;return o=f.util.createBuffer(t.privateKeyModulus).toHex(),i=f.util.createBuffer(t.privateKeyPublicExponent).toHex(),a=f.util.createBuffer(t.privateKeyPrivateExponent).toHex(),s=f.util.createBuffer(t.privateKeyPrime1).toHex(),u=f.util.createBuffer(t.privateKeyPrime2).toHex(),c=f.util.createBuffer(t.privateKeyExponent1).toHex(),l=f.util.createBuffer(t.privateKeyExponent2).toHex(),y=f.util.createBuffer(t.privateKeyCoefficient).toHex(),h.setRsaPrivateKey(new p(o,16),new p(i,16),new p(a,16),new p(s,16),new p(u,16),new p(c,16),new p(l,16),new p(y,16))},h.privateKeyToAsn1=h.privateKeyToRSAPrivateKey=function(e){return d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,d.integerToDer(0).getBytes()),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,a(e.n)),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,a(e.e)),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,a(e.d)),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,a(e.p)),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,a(e.q)),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,a(e.dP)),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,a(e.dQ)),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,a(e.qInv))])},h.publicKeyFromAsn1=function(e){var t={},r=[];if(d.validate(e,b,t,r)){var n=d.derToOid(t.publicKeyOid);if(n!==h.oids.rsaEncryption){var o=new Error("Cannot read public key. Unknown OID.");throw o.oid=n,o}e=t.rsaPublicKey}if(r=[],!d.validate(e,v,t,r)){var o=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw o.errors=r,o}var i=f.util.createBuffer(t.publicKeyModulus).toHex(),a=f.util.createBuffer(t.publicKeyExponent).toHex();return h.setRsaPublicKey(new p(i,16),new p(a,16))},h.publicKeyToAsn1=h.publicKeyToSubjectPublicKeyInfo=function(e){return d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.OID,!1,d.oidToDer(h.oids.rsaEncryption).getBytes()),d.create(d.Class.UNIVERSAL,d.Type.NULL,!1,"")]),d.create(d.Class.UNIVERSAL,d.Type.BITSTRING,!1,[h.publicKeyToRSAPublicKey(e)])])},h.publicKeyToRSAPublicKey=function(e){return d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,a(e.n)),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,a(e.e))])}},function(e,t,r){"use strict";t.__esModule=!0;var n={NEW:0,PROOFING:10,FINAL_APPROVING:30,TODOS_REQUESTED:50,AWAITING_NEW_VERSION:60,HAS_NEW_VERSION:66,APPROVED:70,ARCHIVED:100};t.default=n},function(e,t,r){"use strict";t.__esModule=!0;var n={CREATED:"Created",OK:"OK",UPLOADING:"Uploading",QUEUED:"Queued",RIPPING:"Ripping",ERROR:"Error"};t.default=n},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=r(3),a=n(i),s=r(13),u=n(s),c={canAddProofs:"CanAddProofs",id:"GroupId",name:"Name",description:"Description",isEmpty:"IsEmpty",isArchived:"Archived",teamId:"TeamId",createdBy:"CreatedBy",isOwnedByTeam:"OwnedByTeam",folder:function(e){return null!==e.FolderName?{name:e.FolderName}:null},proofs:(0,i.each)("ProofInfo",function(e){return(new u.default).fromProof(e)})},l=function(){function e(){o(this,e)}return e.prototype.isUserAdminOfGroupTeam=function(e){return e.isAdmin&&this.teamId===e.teamId},e.prototype.fromProofGroup=function(e){return(0,a.default)(this,c,e),this},e}();t.default=l},function(e,t,r){"use strict";t.__esModule=!0;var n="undefined"!=typeof window?window.URL:global.URL||global.require("url").URL;t.default=n},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=r(3),a=n(i),s=r(38),u=n(s),c=r(69),l=n(c),f={id:"StepId",name:"Title",position:(0,i.number)("Position"),dueDate:(0,i.date)("DueDate"),visibleDate:(0,i.date)("VisibleDate"),completeDate:(0,i.date)("CompleteDate"),mandatoryDecisionThreshold:"MandatoryDecisionThreshold",state:function(e){return e.Complete?l.default.COMPLETE:e.Visible?l.default.VISIBLE:l.default.NOT_VISIBLE},users:(0,i.each)("Users",function(e,t){var r=(new u.default).fromWorkflowUser(e);return r._calculateState(e,t),r})},p=function(){function e(){o(this,e)}return e.prototype.fromWorkflowStep=function(e){return(0,a.default)(this,f,e),this},e}();t.default=p},function(e,t,r){"use strict";t.__esModule=!0;var n=r(93),o=function(e){return e&&e.__esModule?e:{default:e}}(n);t.default=function(e){return"[object Object]"===(0,o.default)(e)}},function(e,t,r){"use strict";t.__esModule=!0;var n=void 0;n="615.0.1758757111124",t.default=n},function(e,t,r){var n=r(1);r(2),e.exports=n.cipher=n.cipher||{},n.cipher.algorithms=n.cipher.algorithms||{},n.cipher.createCipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!1})},n.cipher.createDecipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!0})},n.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),n.cipher.algorithms[e]=t},n.cipher.getAlgorithm=function(e){return e=e.toUpperCase(),e in n.cipher.algorithms?n.cipher.algorithms[e]:null};var o=n.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};o.prototype.start=function(e){e=e||{};var t={};for(var r in e)t[r]=e[r];t.decrypt=this._decrypt,this._finish=!1,this._input=n.util.createBuffer(),this.output=e.output||n.util.createBuffer(),this.mode.start(t)},o.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},o.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t))&&(this._finish=!0,this.update(),!(this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))&&!(this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))}},function(e,t,r){function n(){s=String.fromCharCode(128),s+=i.util.fillString(String.fromCharCode(0),64),u=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],c=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],l=new Array(64);for(var e=0;e<64;++e)l[e]=Math.floor(4294967296*Math.abs(Math.sin(e+1)));f=!0}function o(e,t,r){for(var n,o,i,a,s,f,p,d,h=r.length();h>=64;){for(o=e.h0,i=e.h1,a=e.h2,s=e.h3,d=0;d<16;++d)t[d]=r.getInt32Le(),f=s^i&(a^s),n=o+f+l[d]+t[d],p=c[d],o=s,s=a,a=i,i+=n<<p|n>>>32-p;for(;d<32;++d)f=a^s&(i^a),n=o+f+l[d]+t[u[d]],p=c[d],o=s,s=a,a=i,i+=n<<p|n>>>32-p;for(;d<48;++d)f=i^a^s,n=o+f+l[d]+t[u[d]],p=c[d],o=s,s=a,a=i,i+=n<<p|n>>>32-p;for(;d<64;++d)f=a^(i|~s),n=o+f+l[d]+t[u[d]],p=c[d],o=s,s=a,a=i,i+=n<<p|n>>>32-p;e.h0=e.h0+o|0,e.h1=e.h1+i|0,e.h2=e.h2+a|0,e.h3=e.h3+s|0,h-=64}}var i=r(1);r(8),r(2);var a=e.exports=i.md5=i.md5||{};i.md.md5=i.md.algorithms.md5=a,a.create=function(){f||n();var e=null,t=i.util.createBuffer(),r=new Array(16),a={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8};return a.start=function(){a.messageLength=0,a.fullMessageLength=a.messageLength64=[];for(var r=a.messageLengthSize/4,n=0;n<r;++n)a.fullMessageLength.push(0);return t=i.util.createBuffer(),e={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878},a},a.start(),a.update=function(n,s){"utf8"===s&&(n=i.util.encodeUtf8(n));var u=n.length;a.messageLength+=u,u=[u/4294967296>>>0,u>>>0];for(var c=a.fullMessageLength.length-1;c>=0;--c)a.fullMessageLength[c]+=u[1],u[1]=u[0]+(a.fullMessageLength[c]/4294967296>>>0),a.fullMessageLength[c]=a.fullMessageLength[c]>>>0,u[0]=u[1]/4294967296>>>0;return t.putBytes(n),o(e,r,t),(t.read>2048||0===t.length())&&t.compact(),a},a.digest=function(){var n=i.util.createBuffer();n.putBytes(t.bytes());var u=a.fullMessageLength[a.fullMessageLength.length-1]+a.messageLengthSize,c=u&a.blockLength-1;n.putBytes(s.substr(0,a.blockLength-c));for(var l,f=0,p=a.fullMessageLength.length-1;p>=0;--p)l=8*a.fullMessageLength[p]+f,f=l/4294967296>>>0,n.putInt32Le(l>>>0);var d={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};o(d,r,n);var h=i.util.createBuffer();return h.putInt32Le(d.h0),h.putInt32Le(d.h1),h.putInt32Le(d.h2),h.putInt32Le(d.h3),h},a};var s=null,u=null,c=null,l=null,f=!1},function(e,t,r){var n=r(1);r(14),r(8),r(2);var o,i=n.pkcs5=n.pkcs5||{};n.util.isNodejs&&!n.options.usePureJavaScript&&(o=r(48)),e.exports=n.pbkdf2=i.pbkdf2=function(e,t,r,i,a,s){function u(){if(b>p)return s(null,v);h.start(null,null),h.update(t),h.update(n.util.int32ToBytes(b)),y=g=h.digest().getBytes(),E=2,c()}function c(){if(E<=r)return h.start(null,null),h.update(g),m=h.digest().getBytes(),y=n.util.xorBytes(y,m,l),g=m,++E,n.util.setImmediate(c);v+=b<p?y:y.substr(0,d),++b,u()}if("function"==typeof a&&(s=a,a=null),n.util.isNodejs&&!n.options.usePureJavaScript&&o.pbkdf2&&(null===a||"object"!=typeof a)&&(o.pbkdf2Sync.length>4||!a||"sha1"===a))return"string"!=typeof a&&(a="sha1"),e=new Buffer(e,"binary"),t=new Buffer(t,"binary"),s?4===o.pbkdf2Sync.length?o.pbkdf2(e,t,r,i,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):o.pbkdf2(e,t,r,i,a,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):4===o.pbkdf2Sync.length?o.pbkdf2Sync(e,t,r,i).toString("binary"):o.pbkdf2Sync(e,t,r,i,a).toString("binary");if(void 0!==a&&null!==a||(a="sha1"),"string"==typeof a){if(!(a in n.md.algorithms))throw new Error("Unknown hash algorithm: "+a);a=n.md[a].create()}var l=a.digestLength;if(i>4294967295*l){var f=new Error("Derived key is too long.");if(s)return s(f);throw f}var p=Math.ceil(i/l),d=i-(p-1)*l,h=n.hmac.create();h.start(a,e);var y,m,g,v="";if(!s){for(var b=1;b<=p;++b){h.start(null,null),h.update(t),h.update(n.util.int32ToBytes(b)),y=g=h.digest().getBytes();for(var E=2;E<=r;++E)h.start(null,null),h.update(g),m=h.digest().getBytes(),y=n.util.xorBytes(y,m,l),g=m;v+=b<p?y:y.substr(0,d)}return v}var E,b=1;u()}},function(e,t,r){function n(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function o(){return new n(null)}function i(e,t,r,n,o,i){for(;--i>=0;){var a=t*this.data[e++]+r.data[n]+o;o=Math.floor(a/67108864),r.data[n++]=67108863&a}return o}function a(e,t,r,n,o,i){for(var a=32767&t,s=t>>15;--i>=0;){var u=32767&this.data[e],c=this.data[e++]>>15,l=s*u+c*a;u=a*u+((32767&l)<<15)+r.data[n]+(1073741823&o),o=(u>>>30)+(l>>>15)+s*c+(o>>>30),r.data[n++]=1073741823&u}return o}function s(e,t,r,n,o,i){for(var a=16383&t,s=t>>14;--i>=0;){var u=16383&this.data[e],c=this.data[e++]>>14,l=s*u+c*a;u=a*u+((16383&l)<<14)+r.data[n]+o,o=(u>>28)+(l>>14)+s*c,r.data[n++]=268435455&u}return o}function u(e){return it.charAt(e)}function c(e,t){var r=at[e.charCodeAt(t)];return null==r?-1:r}function l(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s}function f(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0}function p(e){var t=o();return t.fromInt(e),t}function d(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var o=e.length,i=!1,a=0;--o>=0;){var s=8==r?255&e[o]:c(e,o);s<0?"-"==e.charAt(o)&&(i=!0):(i=!1,0==a?this.data[this.t++]=s:a+r>this.DB?(this.data[this.t-1]|=(s&(1<<this.DB-a)-1)<<a,this.data[this.t++]=s>>this.DB-a):this.data[this.t-1]|=s<<a,(a+=r)>=this.DB&&(a-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,a>0&&(this.data[this.t-1]|=(1<<this.DB-a)-1<<a)),this.clamp(),i&&n.ZERO.subTo(this,this)}function h(){for(var e=this.s&this.DM;this.t>0&&this.data[this.t-1]==e;)--this.t}function y(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<<t)-1,o=!1,i="",a=this.t,s=this.DB-a*this.DB%t;if(a-- >0)for(s<this.DB&&(r=this.data[a]>>s)>0&&(o=!0,i=u(r));a>=0;)s<t?(r=(this.data[a]&(1<<s)-1)<<t-s,r|=this.data[--a]>>(s+=this.DB-t)):(r=this.data[a]>>(s-=t)&n,s<=0&&(s+=this.DB,--a)),r>0&&(o=!0),o&&(i+=u(r));return o?i:"0"}function m(){var e=o();return n.ZERO.subTo(this,e),e}function g(){return this.s<0?this.negate():this}function v(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0}function b(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function E(){return this.t<=0?0:this.DB*(this.t-1)+b(this.data[this.t-1]^this.s&this.DM)}function C(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s}function _(e,t){for(var r=e;r<this.t;++r)t.data[r-e]=this.data[r];t.t=Math.max(this.t-e,0),t.s=this.s}function w(e,t){var r,n=e%this.DB,o=this.DB-n,i=(1<<o)-1,a=Math.floor(e/this.DB),s=this.s<<n&this.DM;for(r=this.t-1;r>=0;--r)t.data[r+a+1]=this.data[r]>>o|s,s=(this.data[r]&i)<<n;for(r=a-1;r>=0;--r)t.data[r]=0;t.data[a]=s,t.t=this.t+a+1,t.s=this.s,t.clamp()}function T(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)return void(t.t=0);var n=e%this.DB,o=this.DB-n,i=(1<<n)-1;t.data[0]=this.data[r]>>n;for(var a=r+1;a<this.t;++a)t.data[a-r-1]|=(this.data[a]&i)<<o,t.data[a-r]=this.data[a]>>n;n>0&&(t.data[this.t-r-1]|=(this.s&i)<<o),t.t=this.t-r,t.clamp()}function S(e,t){for(var r=0,n=0,o=Math.min(e.t,this.t);r<o;)n+=this.data[r]-e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n-=e.s;r<this.t;)n+=this.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n-=e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t.data[r++]=this.DV+n:n>0&&(t.data[r++]=n),t.t=r,t.clamp()}function I(e,t){var r=this.abs(),o=e.abs(),i=r.t;for(t.t=i+o.t;--i>=0;)t.data[i]=0;for(i=0;i<o.t;++i)t.data[i+r.t]=r.am(0,o.data[i],t,i,0,r.t);t.s=0,t.clamp(),this.s!=e.s&&n.ZERO.subTo(t,t)}function A(e){for(var t=this.abs(),r=e.t=2*t.t;--r>=0;)e.data[r]=0;for(r=0;r<t.t-1;++r){var n=t.am(r,t.data[r],e,2*r,0,1);(e.data[r+t.t]+=t.am(r+1,2*t.data[r],e,2*r+1,n,t.t-r-1))>=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()}function k(e,t,r){var i=e.abs();if(!(i.t<=0)){var a=this.abs();if(a.t<i.t)return null!=t&&t.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=o());var s=o(),u=this.s,c=e.s,l=this.DB-b(i.data[i.t-1]);l>0?(i.lShiftTo(l,s),a.lShiftTo(l,r)):(i.copyTo(s),a.copyTo(r));var f=s.t,p=s.data[f-1];if(0!=p){var d=p*(1<<this.F1)+(f>1?s.data[f-2]>>this.F2:0),h=this.FV/d,y=(1<<this.F1)/d,m=1<<this.F2,g=r.t,v=g-f,E=null==t?o():t;for(s.dlShiftTo(v,E),r.compareTo(E)>=0&&(r.data[r.t++]=1,r.subTo(E,r)),n.ONE.dlShiftTo(f,E),E.subTo(s,s);s.t<f;)s.data[s.t++]=0;for(;--v>=0;){var C=r.data[--g]==p?this.DM:Math.floor(r.data[g]*h+(r.data[g-1]+m)*y);if((r.data[g]+=s.am(0,C,r,v,0,f))<C)for(s.dlShiftTo(v,E),r.subTo(E,r);r.data[g]<--C;)r.subTo(E,r)}null!=t&&(r.drShiftTo(f,t),u!=c&&n.ZERO.subTo(t,t)),r.t=f,r.clamp(),l>0&&r.rShiftTo(l,r),u<0&&n.ZERO.subTo(r,r)}}}function B(e){var t=o();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(n.ZERO)>0&&e.subTo(t,t),t}function R(e){this.m=e}function P(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function O(e){return e}function D(e){e.divRemTo(this.m,null,e)}function N(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function L(e,t){e.squareTo(t),this.reduce(t)}function U(){if(this.t<1)return 0;var e=this.data[0];if(0==(1&e))return 0;var t=3&e;return t=t*(2-(15&e)*t)&15,t=t*(2-(255&e)*t)&255,t=t*(2-((65535&e)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t}function x(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function M(e){var t=o();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(n.ZERO)>0&&this.m.subTo(t,t),t}function V(e){var t=o();return e.copyTo(t),this.reduce(t),t}function j(e){for(;e.t<=this.mt2;)e.data[e.t++]=0;for(var t=0;t<this.m.t;++t){var r=32767&e.data[t],n=r*this.mpl+((r*this.mph+(e.data[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e.data[r]+=this.m.am(0,n,e,t,0,this.m.t);e.data[r]>=e.DV;)e.data[r]-=e.DV,e.data[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}function F(e,t){e.squareTo(t),this.reduce(t)}function q(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function K(){return 0==(this.t>0?1&this.data[0]:this.s)}function G(e,t){if(e>4294967295||e<1)return n.ONE;var r=o(),i=o(),a=t.convert(this),s=b(e)-1;for(a.copyTo(r);--s>=0;)if(t.sqrTo(r,i),(e&1<<s)>0)t.mulTo(i,a,r);else{var u=r;r=i,i=u}return t.revert(r)}function z(e,t){var r;return r=e<256||t.isEven()?new R(t):new x(t),this.exp(e,r)}function H(){var e=o();return this.copyTo(e),e}function W(){if(this.s<0){if(1==this.t)return this.data[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this.data[0];if(0==this.t)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]}function Q(){return 0==this.t?this.s:this.data[0]<<24>>24}function X(){return 0==this.t?this.s:this.data[0]<<16>>16}function Y(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function Z(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1}function $(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),n=p(r),i=o(),a=o(),s="";for(this.divRemTo(n,i,a);i.signum()>0;)s=(r+a.intValue()).toString(e).substr(1)+s,i.divRemTo(n,i,a);return a.intValue().toString(e)+s}function J(e,t){this.fromInt(0),null==t&&(t=10);for(var r=this.chunkSize(t),o=Math.pow(t,r),i=!1,a=0,s=0,u=0;u<e.length;++u){var l=c(e,u);l<0?"-"==e.charAt(u)&&0==this.signum()&&(i=!0):(s=t*s+l,++a>=r&&(this.dMultiply(o),this.dAddOffset(s,0),a=0,s=0))}a>0&&(this.dMultiply(Math.pow(t,a)),this.dAddOffset(s,0)),i&&n.ZERO.subTo(this,this)}function ee(e,t,r){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(n.ONE.shiftLeft(e-1),ue,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(n.ONE.shiftLeft(e-1),this);else{var o=new Array,i=7&e;o.length=1+(e>>3),t.nextBytes(o),i>0?o[0]&=(1<<i)-1:o[0]=0,this.fromString(o,256)}}function te(){var e=this.t,t=new Array;t[0]=this.s;var r,n=this.DB-e*this.DB%8,o=0;if(e-- >0)for(n<this.DB&&(r=this.data[e]>>n)!=(this.s&this.DM)>>n&&(t[o++]=r|this.s<<this.DB-n);e>=0;)n<8?(r=(this.data[e]&(1<<n)-1)<<8-n,r|=this.data[--e]>>(n+=this.DB-8)):(r=this.data[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),0!=(128&r)&&(r|=-256),0==o&&(128&this.s)!=(128&r)&&++o,(o>0||r!=this.s)&&(t[o++]=r);return t}function re(e){return 0==this.compareTo(e)}function ne(e){return this.compareTo(e)<0?this:e}function oe(e){return this.compareTo(e)>0?this:e}function ie(e,t,r){var n,o,i=Math.min(e.t,this.t);for(n=0;n<i;++n)r.data[n]=t(this.data[n],e.data[n]);if(e.t<this.t){for(o=e.s&this.DM,n=i;n<this.t;++n)r.data[n]=t(this.data[n],o);r.t=this.t}else{for(o=this.s&this.DM,n=i;n<e.t;++n)r.data[n]=t(o,e.data[n]);r.t=e.t}r.s=t(this.s,e.s),r.clamp()}function ae(e,t){return e&t}function se(e){var t=o();return this.bitwiseTo(e,ae,t),t}function ue(e,t){return e|t}function ce(e){var t=o();return this.bitwiseTo(e,ue,t),t}function le(e,t){return e^t}function fe(e){var t=o();return this.bitwiseTo(e,le,t),t}function pe(e,t){return e&~t}function de(e){var t=o();return this.bitwiseTo(e,pe,t),t}function he(){for(var e=o(),t=0;t<this.t;++t)e.data[t]=this.DM&~this.data[t];return e.t=this.t,e.s=~this.s,e}function ye(e){var t=o();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t}function me(e){var t=o();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t}function ge(e){if(0==e)return-1;var t=0;return 0==(65535&e)&&(e>>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function ve(){for(var e=0;e<this.t;++e)if(0!=this.data[e])return e*this.DB+ge(this.data[e]);return this.s<0?this.t*this.DB:-1}function be(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function Ee(){for(var e=0,t=this.s&this.DM,r=0;r<this.t;++r)e+=be(this.data[r]^t);return e}function Ce(e){var t=Math.floor(e/this.DB);return t>=this.t?0!=this.s:0!=(this.data[t]&1<<e%this.DB)}function _e(e,t){var r=n.ONE.shiftLeft(e);return this.bitwiseTo(r,t,r),r}function we(e){return this.changeBit(e,ue)}function Te(e){return this.changeBit(e,pe)}function Se(e){return this.changeBit(e,le)}function Ie(e,t){for(var r=0,n=0,o=Math.min(e.t,this.t);r<o;)n+=this.data[r]+e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n+=e.s;r<this.t;)n+=this.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n+=e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=e.s}t.s=n<0?-1:0,n>0?t.data[r++]=n:n<-1&&(t.data[r++]=this.DV+n),t.t=r,t.clamp()}function Ae(e){var t=o();return this.addTo(e,t),t}function ke(e){var t=o();return this.subTo(e,t),t}function Be(e){var t=o();return this.multiplyTo(e,t),t}function Re(e){var t=o();return this.divRemTo(e,t,null),t}function Pe(e){var t=o();return this.divRemTo(e,null,t),t}function Oe(e){var t=o(),r=o();return this.divRemTo(e,t,r),new Array(t,r)}function De(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function Ne(e,t){if(0!=e){for(;this.t<=t;)this.data[this.t++]=0;for(this.data[t]+=e;this.data[t]>=this.DV;)this.data[t]-=this.DV,++t>=this.t&&(this.data[this.t++]=0),++this.data[t]}}function Le(){}function Ue(e){return e}function xe(e,t,r){e.multiplyTo(t,r)}function Me(e,t){e.squareTo(t)}function Ve(e){return this.exp(e,new Le)}function je(e,t,r){var n=Math.min(this.t+e.t,t);for(r.s=0,r.t=n;n>0;)r.data[--n]=0;var o;for(o=r.t-this.t;n<o;++n)r.data[n+this.t]=this.am(0,e.data[n],r,n,0,this.t);for(o=Math.min(e.t,t);n<o;++n)this.am(0,e.data[n],r,n,0,t-n);r.clamp()}function Fe(e,t,r){--t;var n=r.t=this.t+e.t-t;for(r.s=0;--n>=0;)r.data[n]=0;for(n=Math.max(t-this.t,0);n<e.t;++n)r.data[this.t+n-t]=this.am(t-n,e.data[n],r,0,0,this.t+n-t);r.clamp(),r.drShiftTo(1,r)}function qe(e){this.r2=o(),this.q3=o(),n.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}function Ke(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=o();return e.copyTo(t),this.reduce(t),t}function Ge(e){return e}function ze(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)}function He(e,t){e.squareTo(t),this.reduce(t)}function We(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function Qe(e,t){var r,n,i=e.bitLength(),a=p(1);if(i<=0)return a;r=i<18?1:i<48?3:i<144?4:i<768?5:6,n=i<8?new R(t):t.isEven()?new qe(t):new x(t);var s=new Array,u=3,c=r-1,l=(1<<r)-1;if(s[1]=n.convert(this),r>1){var f=o();for(n.sqrTo(s[1],f);u<=l;)s[u]=o(),n.mulTo(f,s[u-2],s[u]),u+=2}var d,h,y=e.t-1,m=!0,g=o();for(i=b(e.data[y])-1;y>=0;){for(i>=c?d=e.data[y]>>i-c&l:(d=(e.data[y]&(1<<i+1)-1)<<c-i,y>0&&(d|=e.data[y-1]>>this.DB+i-c)),u=r;0==(1&d);)d>>=1,--u;if((i-=u)<0&&(i+=this.DB,--y),m)s[d].copyTo(a),m=!1;else{for(;u>1;)n.sqrTo(a,g),n.sqrTo(g,a),u-=2;u>0?n.sqrTo(a,g):(h=a,a=g,g=h),n.mulTo(g,s[d],a)}for(;y>=0&&0==(e.data[y]&1<<i);)n.sqrTo(a,g),h=a,a=g,g=h,--i<0&&(i=this.DB-1,--y)}return n.revert(a)}function Xe(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var n=t;t=r,r=n}var o=t.getLowestSetBit(),i=r.getLowestSetBit();if(i<0)return t;for(o<i&&(i=o),i>0&&(t.rShiftTo(i,t),r.rShiftTo(i,r));t.signum()>0;)(o=t.getLowestSetBit())>0&&t.rShiftTo(o,t),(o=r.getLowestSetBit())>0&&r.rShiftTo(o,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return i>0&&r.lShiftTo(i,r),r}function Ye(e){if(e<=0)return 0;var t=this.DV%e,r=this.s<0?e-1:0;if(this.t>0)if(0==t)r=this.data[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this.data[n])%e;return r}function Ze(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return n.ZERO;for(var r=e.clone(),o=this.clone(),i=p(1),a=p(0),s=p(0),u=p(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),t?(i.isEven()&&a.isEven()||(i.addTo(this,i),a.subTo(e,a)),i.rShiftTo(1,i)):a.isEven()||a.subTo(e,a),a.rShiftTo(1,a);for(;o.isEven();)o.rShiftTo(1,o),t?(s.isEven()&&u.isEven()||(s.addTo(this,s),u.subTo(e,u)),s.rShiftTo(1,s)):u.isEven()||u.subTo(e,u),u.rShiftTo(1,u);r.compareTo(o)>=0?(r.subTo(o,r),t&&i.subTo(s,i),a.subTo(u,a)):(o.subTo(r,o),t&&s.subTo(i,s),u.subTo(a,u))}return 0!=o.compareTo(n.ONE)?n.ZERO:u.compareTo(e)>=0?u.subtract(e):u.signum()<0?(u.addTo(e,u),u.signum()<0?u.add(e):u):u}function $e(e){var t,r=this.abs();if(1==r.t&&r.data[0]<=st[st.length-1]){for(t=0;t<st.length;++t)if(r.data[0]==st[t])return!0;return!1}if(r.isEven())return!1;for(t=1;t<st.length;){for(var n=st[t],o=t+1;o<st.length&&n<ut;)n*=st[o++];for(n=r.modInt(n);t<o;)if(n%st[t++]==0)return!1}return r.millerRabin(e)}function Je(e){var t=this.subtract(n.ONE),r=t.getLowestSetBit();if(r<=0)return!1;for(var o,i=t.shiftRight(r),a=et(),s=0;s<e;++s){do{o=new n(this.bitLength(),a)}while(o.compareTo(n.ONE)<=0||o.compareTo(t)>=0);var u=o.modPow(i,this);if(0!=u.compareTo(n.ONE)&&0!=u.compareTo(t)){for(var c=1;c++<r&&0!=u.compareTo(t);)if(u=u.modPowInt(2,this),0==u.compareTo(n.ONE))return!1;if(0!=u.compareTo(t))return!1}}return!0}function et(){return{nextBytes:function(e){for(var t=0;t<e.length;++t)e[t]=Math.floor(256*Math.random())}}}var tt=r(1);e.exports=tt.jsbn=tt.jsbn||{};var rt;tt.jsbn.BigInteger=n,"undefined"==typeof navigator?(n.prototype.am=s,rt=28):"Microsoft Internet Explorer"==navigator.appName?(n.prototype.am=a,rt=30):"Netscape"!=navigator.appName?(n.prototype.am=i,rt=26):(n.prototype.am=s,rt=28),n.prototype.DB=rt,n.prototype.DM=(1<<rt)-1,n.prototype.DV=1<<rt;n.prototype.FV=Math.pow(2,52),n.prototype.F1=52-rt,n.prototype.F2=2*rt-52;var nt,ot,it="0123456789abcdefghijklmnopqrstuvwxyz",at=new Array;for(nt="0".charCodeAt(0),ot=0;ot<=9;++ot)at[nt++]=ot;for(nt="a".charCodeAt(0),ot=10;ot<36;++ot)at[nt++]=ot;for(nt="A".charCodeAt(0),ot=10;ot<36;++ot)at[nt++]=ot;R.prototype.convert=P,R.prototype.revert=O,R.prototype.reduce=D,R.prototype.mulTo=N,R.prototype.sqrTo=L,x.prototype.convert=M,x.prototype.revert=V,x.prototype.reduce=j,x.prototype.mulTo=q,x.prototype.sqrTo=F,n.prototype.copyTo=l,n.prototype.fromInt=f,n.prototype.fromString=d,n.prototype.clamp=h,n.prototype.dlShiftTo=C,n.prototype.drShiftTo=_,n.prototype.lShiftTo=w,n.prototype.rShiftTo=T,n.prototype.subTo=S,n.prototype.multiplyTo=I,n.prototype.squareTo=A,n.prototype.divRemTo=k,n.prototype.invDigit=U,n.prototype.isEven=K,n.prototype.exp=G,n.prototype.toString=y,n.prototype.negate=m,n.prototype.abs=g,n.prototype.compareTo=v,n.prototype.bitLength=E,n.prototype.mod=B,n.prototype.modPowInt=z,n.ZERO=p(0),n.ONE=p(1),Le.prototype.convert=Ue,Le.prototype.revert=Ue,Le.prototype.mulTo=xe,Le.prototype.sqrTo=Me,qe.prototype.convert=Ke,qe.prototype.revert=Ge,qe.prototype.reduce=ze,qe.prototype.mulTo=We,qe.prototype.sqrTo=He;var st=[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],ut=(1<<26)/st[st.length-1];n.prototype.chunkSize=Y,n.prototype.toRadix=$,n.prototype.fromRadix=J,n.prototype.fromNumber=ee,n.prototype.bitwiseTo=ie,n.prototype.changeBit=_e,n.prototype.addTo=Ie,n.prototype.dMultiply=De,n.prototype.dAddOffset=Ne,n.prototype.multiplyLowerTo=je,n.prototype.multiplyUpperTo=Fe,n.prototype.modInt=Ye,n.prototype.millerRabin=Je,n.prototype.clone=H,n.prototype.intValue=W,n.prototype.byteValue=Q,n.prototype.shortValue=X,n.prototype.signum=Z,n.prototype.toByteArray=te,n.prototype.equals=re,n.prototype.min=ne,n.prototype.max=oe,n.prototype.and=se,n.prototype.or=ce,n.prototype.xor=fe,n.prototype.andNot=de,n.prototype.not=he,n.prototype.shiftLeft=ye,n.prototype.shiftRight=me,n.prototype.getLowestSetBit=ve,n.prototype.bitCount=Ee,n.prototype.testBit=Ce,n.prototype.setBit=we,n.prototype.clearBit=Te,n.prototype.flipBit=Se,n.prototype.add=Ae,n.prototype.subtract=ke,n.prototype.multiply=Be,n.prototype.divide=Re,n.prototype.remainder=Pe,n.prototype.divideAndRemainder=Oe,n.prototype.modPow=Qe,n.prototype.modInverse=Ze,n.prototype.pow=Ve,n.prototype.gcd=Xe,n.prototype.isProbablePrime=$e},function(e,t,r){function n(e,t){"string"==typeof t&&(t={shortName:t});for(var r,n=null,o=0;null===n&&o<e.attributes.length;++o)r=e.attributes[o],t.type&&t.type===r.type?n=r:t.name&&t.name===r.name?n=r:t.shortName&&t.shortName===r.shortName&&(n=r);return n}function o(e){for(var t,r,n=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]),o=e.attributes,i=0;i<o.length;++i){t=o[i];var a=t.value,s=l.Type.PRINTABLESTRING;"valueTagClass"in t&&(s=t.valueTagClass)===l.Type.UTF8&&(a=c.util.encodeUtf8(a)),r=l.create(l.Class.UNIVERSAL,l.Type.SET,!0,[l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(t.type).getBytes()),l.create(l.Class.UNIVERSAL,s,!1,a)])]),n.value.push(r)}return n}function i(e){for(var t,r=0;r<e.length;++r){if(t=e[r],void 0===t.name&&(t.type&&t.type in f.oids?t.name=f.oids[t.type]:t.shortName&&t.shortName in d&&(t.name=f.oids[d[t.shortName]])),void 0===t.type){if(!(t.name&&t.name in f.oids)){var n=new Error("Attribute type not specified.");throw n.attribute=t,n}t.type=f.oids[t.name]}if(void 0===t.shortName&&t.name&&t.name in d&&(t.shortName=d[t.name]),t.type===p.extensionRequest&&(t.valueConstructed=!0,t.valueTagClass=l.Type.SEQUENCE,!t.value&&t.extensions)){t.value=[];for(var o=0;o<t.extensions.length;++o)t.value.push(f.certificateExtensionToAsn1(a(t.extensions[o])))}if(void 0===t.value){var n=new Error("Attribute value not specified.");throw n.attribute=t,n}}}function a(e,t){if(t=t||{},void 0===e.name&&e.id&&e.id in f.oids&&(e.name=f.oids[e.id]),void 0===e.id){if(!(e.name&&e.name in f.oids)){var r=new Error("Extension ID not specified.");throw r.extension=e,r}e.id=f.oids[e.name]}if(void 0!==e.value)return e;if("keyUsage"===e.name){var n=0,i=0,a=0;e.digitalSignature&&(i|=128,n=7),e.nonRepudiation&&(i|=64,n=6),e.keyEncipherment&&(i|=32,n=5),e.dataEncipherment&&(i|=16,n=4),e.keyAgreement&&(i|=8,n=3),e.keyCertSign&&(i|=4,n=2),e.cRLSign&&(i|=2,n=1),e.encipherOnly&&(i|=1,n=0),e.decipherOnly&&(a|=128,n=7);var s=String.fromCharCode(n);0!==a?s+=String.fromCharCode(i)+String.fromCharCode(a):0!==i&&(s+=String.fromCharCode(i)),e.value=l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,s)}else if("basicConstraints"===e.name)e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]),e.cA&&e.value.value.push(l.create(l.Class.UNIVERSAL,l.Type.BOOLEAN,!1,String.fromCharCode(255))),"pathLenConstraint"in e&&e.value.value.push(l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(e.pathLenConstraint).getBytes()));else if("extKeyUsage"===e.name){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);var u=e.value.value;for(var d in e)!0===e[d]&&(d in p?u.push(l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(p[d]).getBytes())):-1!==d.indexOf(".")&&u.push(l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(d).getBytes())))}else if("nsCertType"===e.name){var n=0,i=0;e.client&&(i|=128,n=7),e.server&&(i|=64,n=6),e.email&&(i|=32,n=5),e.objsign&&(i|=16,n=4),e.reserved&&(i|=8,n=3),e.sslCA&&(i|=4,n=2),e.emailCA&&(i|=2,n=1),e.objCA&&(i|=1,n=0);var s=String.fromCharCode(n);0!==i&&(s+=String.fromCharCode(i)),e.value=l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,s)}else if("subjectAltName"===e.name||"issuerAltName"===e.name){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);for(var h,y=0;y<e.altNames.length;++y){h=e.altNames[y];var s=h.value;if(7===h.type&&h.ip){if(null===(s=c.util.bytesFromIP(h.ip))){var r=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw r.extension=e,r}}else 8===h.type&&(s=h.oid?l.oidToDer(l.oidToDer(h.oid)):l.oidToDer(s));e.value.value.push(l.create(l.Class.CONTEXT_SPECIFIC,h.type,!1,s))}}else if("subjectKeyIdentifier"===e.name&&t.cert){var m=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=m.toHex(),e.value=l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,m.getBytes())}else if("authorityKeyIdentifier"===e.name&&t.cert){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);var u=e.value.value;if(e.keyIdentifier){var g=!0===e.keyIdentifier?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;u.push(l.create(l.Class.CONTEXT_SPECIFIC,0,!1,g))}if(e.authorityCertIssuer){var v=[l.create(l.Class.CONTEXT_SPECIFIC,4,!0,[o(!0===e.authorityCertIssuer?t.cert.issuer:e.authorityCertIssuer)])];u.push(l.create(l.Class.CONTEXT_SPECIFIC,1,!0,v))}if(e.serialNumber){var b=c.util.hexToBytes(!0===e.serialNumber?t.cert.serialNumber:e.serialNumber);u.push(l.create(l.Class.CONTEXT_SPECIFIC,2,!1,b))}}else if("cRLDistributionPoints"===e.name){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);for(var h,u=e.value.value,E=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]),C=l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[]),y=0;y<e.altNames.length;++y){h=e.altNames[y];var s=h.value;if(7===h.type&&h.ip){if(null===(s=c.util.bytesFromIP(h.ip))){var r=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw r.extension=e,r}}else 8===h.type&&(s=h.oid?l.oidToDer(l.oidToDer(h.oid)):l.oidToDer(s));C.value.push(l.create(l.Class.CONTEXT_SPECIFIC,h.type,!1,s))}E.value.push(l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[C])),u.push(E)}if(void 0===e.value){var r=new Error("Extension value not specified.");throw r.extension=e,r}return e}function s(e,t){switch(e){case p["RSASSA-PSS"]:var r=[];return void 0!==t.hash.algorithmOid&&r.push(l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(t.hash.algorithmOid).getBytes()),l.create(l.Class.UNIVERSAL,l.Type.NULL,!1,"")])])),void 0!==t.mgf.algorithmOid&&r.push(l.create(l.Class.CONTEXT_SPECIFIC,1,!0,[l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(t.mgf.algorithmOid).getBytes()),l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(t.mgf.hash.algorithmOid).getBytes()),l.create(l.Class.UNIVERSAL,l.Type.NULL,!1,"")])])])),void 0!==t.saltLength&&r.push(l.create(l.Class.CONTEXT_SPECIFIC,2,!0,[l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(t.saltLength).getBytes())])),l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,r);default:return l.create(l.Class.UNIVERSAL,l.Type.NULL,!1,"")}}function u(e){var t=l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[]);if(0===e.attributes.length)return t;for(var r=e.attributes,n=0;n<r.length;++n){var o=r[n],i=o.value,a=l.Type.UTF8;"valueTagClass"in o&&(a=o.valueTagClass),a===l.Type.UTF8&&(i=c.util.encodeUtf8(i));var s=!1;"valueConstructed"in o&&(s=o.valueConstructed);var u=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(o.type).getBytes()),l.create(l.Class.UNIVERSAL,l.Type.SET,!0,[l.create(l.Class.UNIVERSAL,a,s,i)])]);t.value.push(u)}return t}var c=r(1);r(10),r(7),r(19),r(8),r(99),r(11),r(12),r(33),r(20),r(2);var l=c.asn1,f=e.exports=c.pki=c.pki||{},p=f.oids,d={};d.CN=p.commonName,d.commonName="CN",d.C=p.countryName,d.countryName="C",d.L=p.localityName,d.localityName="L",d.ST=p.stateOrProvinceName,d.stateOrProvinceName="ST",d.O=p.organizationName,d.organizationName="O",d.OU=p.organizationalUnitName,d.organizationalUnitName="OU",d.E=p.emailAddress,d.emailAddress="E";var h=c.pki.rsa.publicKeyValidator,y={name:"Certificate",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:l.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:l.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:l.Class.UNIVERSAL,type:l.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:l.Class.UNIVERSAL,type:l.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:l.Class.UNIVERSAL,type:l.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:l.Class.UNIVERSAL,type:l.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},h,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:l.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:l.Class.UNIVERSAL,type:l.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:l.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:l.Class.UNIVERSAL,type:l.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:l.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:l.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:l.Class.UNIVERSAL,type:l.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},m={name:"rsapss",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:l.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:l.Class.UNIVERSAL,type:l.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:l.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:l.Class.UNIVERSAL,type:l.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:l.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:l.Class.UNIVERSAL,type:l.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:l.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:l.Class.UNIVERSAL,type:l.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},g={name:"CertificationRequestInfo",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},h,{name:"CertificationRequestInfo.attributes",tagClass:l.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:l.Class.UNIVERSAL,type:l.Type.SET,constructed:!0}]}]}]},v={name:"CertificationRequest",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[g,{name:"CertificationRequest.signatureAlgorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:l.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:l.Class.UNIVERSAL,type:l.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};f.RDNAttributesAsArray=function(e,t){for(var r,n,o,i=[],a=0;a<e.value.length;++a){r=e.value[a];for(var s=0;s<r.value.length;++s)o={},n=r.value[s],o.type=l.derToOid(n.value[0].value),o.value=n.value[1].value,o.valueTagClass=n.value[1].type,o.type in p&&(o.name=p[o.type],o.name in d&&(o.shortName=d[o.name])),t&&(t.update(o.type),t.update(o.value)),i.push(o)}return i},f.CRIAttributesAsArray=function(e){for(var t=[],r=0;r<e.length;++r)for(var n=e[r],o=l.derToOid(n.value[0].value),i=n.value[1].value,a=0;a<i.length;++a){var s={};if(s.type=o,s.value=i[a].value,s.valueTagClass=i[a].type,s.type in p&&(s.name=p[s.type],s.name in d&&(s.shortName=d[s.name])),s.type===p.extensionRequest){s.extensions=[];for(var u=0;u<s.value.length;++u)s.extensions.push(f.certificateExtensionFromAsn1(s.value[u]))}t.push(s)}return t};var b=function(e,t,r){var n={};if(e!==p["RSASSA-PSS"])return n;r&&(n={hash:{algorithmOid:p.sha1},mgf:{algorithmOid:p.mgf1,hash:{algorithmOid:p.sha1}},saltLength:20});var o={},i=[];if(!l.validate(t,m,o,i)){var a=new Error("Cannot read RSASSA-PSS parameter block.");throw a.errors=i,a}return void 0!==o.hashOid&&(n.hash=n.hash||{},n.hash.algorithmOid=l.derToOid(o.hashOid)),void 0!==o.maskGenOid&&(n.mgf=n.mgf||{},n.mgf.algorithmOid=l.derToOid(o.maskGenOid),n.mgf.hash=n.mgf.hash||{},n.mgf.hash.algorithmOid=l.derToOid(o.maskGenHashOid)),void 0!==o.saltLength&&(n.saltLength=o.saltLength.charCodeAt(0)),n};f.certificateFromPem=function(e,t,r){var n=c.pem.decode(e)[0];if("CERTIFICATE"!==n.type&&"X509 CERTIFICATE"!==n.type&&"TRUSTED CERTIFICATE"!==n.type){var o=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw o.headerType=n.type,o}if(n.procType&&"ENCRYPTED"===n.procType.type)throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var i=l.fromDer(n.body,r);return f.certificateFromAsn1(i,t)},f.certificateToPem=function(e,t){var r={type:"CERTIFICATE",body:l.toDer(f.certificateToAsn1(e)).getBytes()};return c.pem.encode(r,{maxline:t})},f.publicKeyFromPem=function(e){var t=c.pem.decode(e)[0];if("PUBLIC KEY"!==t.type&&"RSA PUBLIC KEY"!==t.type){var r=new Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');throw r.headerType=t.type,r}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert public key from PEM; PEM is encrypted.");var n=l.fromDer(t.body);return f.publicKeyFromAsn1(n)},f.publicKeyToPem=function(e,t){var r={type:"PUBLIC KEY",body:l.toDer(f.publicKeyToAsn1(e)).getBytes()};return c.pem.encode(r,{maxline:t})},f.publicKeyToRSAPublicKeyPem=function(e,t){var r={type:"RSA PUBLIC KEY",body:l.toDer(f.publicKeyToRSAPublicKey(e)).getBytes()};return c.pem.encode(r,{maxline:t})},f.getPublicKeyFingerprint=function(e,t){t=t||{};var r,n=t.md||c.md.sha1.create(),o=t.type||"RSAPublicKey";switch(o){case"RSAPublicKey":r=l.toDer(f.publicKeyToRSAPublicKey(e)).getBytes();break;case"SubjectPublicKeyInfo":r=l.toDer(f.publicKeyToAsn1(e)).getBytes();break;default:throw new Error('Unknown fingerprint type "'+t.type+'".')}n.start(),n.update(r);var i=n.digest();if("hex"===t.encoding){var a=i.toHex();return t.delimiter?a.match(/.{2}/g).join(t.delimiter):a}if("binary"===t.encoding)return i.getBytes();if(t.encoding)throw new Error('Unknown encoding "'+t.encoding+'".');return i},f.certificationRequestFromPem=function(e,t,r){var n=c.pem.decode(e)[0];if("CERTIFICATE REQUEST"!==n.type){var o=new Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".');throw o.headerType=n.type,o}if(n.procType&&"ENCRYPTED"===n.procType.type)throw new Error("Could not convert certification request from PEM; PEM is encrypted.");var i=l.fromDer(n.body,r);return f.certificationRequestFromAsn1(i,t)},f.certificationRequestToPem=function(e,t){var r={type:"CERTIFICATE REQUEST",body:l.toDer(f.certificationRequestToAsn1(e)).getBytes()};return c.pem.encode(r,{maxline:t})},f.createCertificate=function(){var e={};return e.version=2,e.serialNumber="00",e.signatureOid=null,e.signature=null,e.siginfo={},e.siginfo.algorithmOid=null,e.validity={},e.validity.notBefore=new Date,e.validity.notAfter=new Date,e.issuer={},e.issuer.getField=function(t){return n(e.issuer,t)},e.issuer.addField=function(t){i([t]),e.issuer.attributes.push(t)},e.issuer.attributes=[],e.issuer.hash=null,e.subject={},e.subject.getField=function(t){return n(e.subject,t)},e.subject.addField=function(t){i([t]),e.subject.attributes.push(t)},e.subject.attributes=[],e.subject.hash=null,e.extensions=[],e.publicKey=null,e.md=null,e.setSubject=function(t,r){i(t),e.subject.attributes=t,delete e.subject.uniqueId,r&&(e.subject.uniqueId=r),e.subject.hash=null},e.setIssuer=function(t,r){i(t),e.issuer.attributes=t,delete e.issuer.uniqueId,r&&(e.issuer.uniqueId=r),e.issuer.hash=null},e.setExtensions=function(t){for(var r=0;r<t.length;++r)a(t[r],{cert:e});e.extensions=t},e.getExtension=function(t){"string"==typeof t&&(t={name:t});for(var r,n=null,o=0;null===n&&o<e.extensions.length;++o)r=e.extensions[o],t.id&&r.id===t.id?n=r:t.name&&r.name===t.name&&(n=r);return n},e.sign=function(t,r){e.md=r||c.md.sha1.create();var n=p[e.md.algorithm+"WithRSAEncryption"];if(!n){var o=new Error("Could not compute certificate digest. Unknown message digest algorithm OID.");throw o.algorithm=e.md.algorithm,o}e.signatureOid=e.siginfo.algorithmOid=n,e.tbsCertificate=f.getTBSCertificate(e);var i=l.toDer(e.tbsCertificate);e.md.update(i.getBytes()),e.signature=t.sign(e.md)},e.verify=function(t){var r=!1;if(!e.issued(t)){var n=t.issuer,o=e.subject,i=new Error("The parent certificate did not issue the given child certificate; the child certificate's issuer does not match the parent's subject.");throw i.expectedIssuer=n.attributes,i.actualIssuer=o.attributes,i}var a=t.md;if(null===a){if(t.signatureOid in p){switch(p[t.signatureOid]){case"sha1WithRSAEncryption":a=c.md.sha1.create();break;case"md5WithRSAEncryption":a=c.md.md5.create();break;case"sha256WithRSAEncryption":a=c.md.sha256.create();break;case"sha512WithRSAEncryption":a=c.md.sha512.create();break;case"RSASSA-PSS":a=c.md.sha256.create()}}if(null===a){var i=new Error("Could not compute certificate digest. Unknown signature OID.");throw i.signatureOid=t.signatureOid,i}var s=t.tbsCertificate||f.getTBSCertificate(t),u=l.toDer(s);a.update(u.getBytes())}if(null!==a){var d;switch(t.signatureOid){case p.sha1WithRSAEncryption:d=void 0;break;case p["RSASSA-PSS"]:var h,y;if(void 0===(h=p[t.signatureParameters.mgf.hash.algorithmOid])||void 0===c.md[h]){var i=new Error("Unsupported MGF hash function.");throw i.oid=t.signatureParameters.mgf.hash.algorithmOid,i.name=h,i}if(void 0===(y=p[t.signatureParameters.mgf.algorithmOid])||void 0===c.mgf[y]){var i=new Error("Unsupported MGF function.");throw i.oid=t.signatureParameters.mgf.algorithmOid,i.name=y,i}if(y=c.mgf[y].create(c.md[h].create()),void 0===(h=p[t.signatureParameters.hash.algorithmOid])||void 0===c.md[h])throw{message:"Unsupported RSASSA-PSS hash function.",oid:t.signatureParameters.hash.algorithmOid,name:h};d=c.pss.create(c.md[h].create(),y,t.signatureParameters.saltLength)}r=e.publicKey.verify(a.digest().getBytes(),t.signature,d)}return r},e.isIssuer=function(t){var r=!1,n=e.issuer,o=t.subject;if(n.hash&&o.hash)r=n.hash===o.hash;else if(n.attributes.length===o.attributes.length){r=!0;for(var i,a,s=0;r&&s<n.attributes.length;++s)i=n.attributes[s],a=o.attributes[s],i.type===a.type&&i.value===a.value||(r=!1)}return r},e.issued=function(t){return t.isIssuer(e)},e.generateSubjectKeyIdentifier=function(){return f.getPublicKeyFingerprint(e.publicKey,{type:"RSAPublicKey"})},e.verifySubjectKeyIdentifier=function(){for(var t=p.subjectKeyIdentifier,r=0;r<e.extensions.length;++r){var n=e.extensions[r];if(n.id===t){var o=e.generateSubjectKeyIdentifier().getBytes();return c.util.hexToBytes(n.subjectKeyIdentifier)===o}}return!1},e},f.certificateFromAsn1=function(e,t){var r={},o=[];if(!l.validate(e,y,r,o)){var a=new Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.");throw a.errors=o,a}var s=l.derToOid(r.publicKeyOid);if(s!==f.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var u=f.createCertificate();u.version=r.certVersion?r.certVersion.charCodeAt(0):0;var d=c.util.createBuffer(r.certSerialNumber);u.serialNumber=d.toHex(),u.signatureOid=c.asn1.derToOid(r.certSignatureOid),u.signatureParameters=b(u.signatureOid,r.certSignatureParams,!0),u.siginfo.algorithmOid=c.asn1.derToOid(r.certinfoSignatureOid),u.siginfo.parameters=b(u.siginfo.algorithmOid,r.certinfoSignatureParams,!1),u.signature=r.certSignature;var h=[];if(void 0!==r.certValidity1UTCTime&&h.push(l.utcTimeToDate(r.certValidity1UTCTime)),void 0!==r.certValidity2GeneralizedTime&&h.push(l.generalizedTimeToDate(r.certValidity2GeneralizedTime)),void 0!==r.certValidity3UTCTime&&h.push(l.utcTimeToDate(r.certValidity3UTCTime)),void 0!==r.certValidity4GeneralizedTime&&h.push(l.generalizedTimeToDate(r.certValidity4GeneralizedTime)),h.length>2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(h.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(u.validity.notBefore=h[0],u.validity.notAfter=h[1],u.tbsCertificate=r.tbsCertificate,t){if(u.md=null,u.signatureOid in p){var s=p[u.signatureOid];switch(s){case"sha1WithRSAEncryption":u.md=c.md.sha1.create();break;case"md5WithRSAEncryption":u.md=c.md.md5.create();break;case"sha256WithRSAEncryption":u.md=c.md.sha256.create();break;case"sha512WithRSAEncryption":u.md=c.md.sha512.create();break;case"RSASSA-PSS":u.md=c.md.sha256.create()}}if(null===u.md){var a=new Error("Could not compute certificate digest. Unknown signature OID.");throw a.signatureOid=u.signatureOid,a}var m=l.toDer(u.tbsCertificate);u.md.update(m.getBytes())}var g=c.md.sha1.create();u.issuer.getField=function(e){return n(u.issuer,e)},u.issuer.addField=function(e){i([e]),u.issuer.attributes.push(e)},u.issuer.attributes=f.RDNAttributesAsArray(r.certIssuer,g),r.certIssuerUniqueId&&(u.issuer.uniqueId=r.certIssuerUniqueId),u.issuer.hash=g.digest().toHex();var v=c.md.sha1.create();return u.subject.getField=function(e){return n(u.subject,e)},u.subject.addField=function(e){i([e]),u.subject.attributes.push(e)},u.subject.attributes=f.RDNAttributesAsArray(r.certSubject,v),r.certSubjectUniqueId&&(u.subject.uniqueId=r.certSubjectUniqueId),u.subject.hash=v.digest().toHex(),r.certExtensions?u.extensions=f.certificateExtensionsFromAsn1(r.certExtensions):u.extensions=[],u.publicKey=f.publicKeyFromAsn1(r.subjectPublicKeyInfo),u},f.certificateExtensionsFromAsn1=function(e){for(var t=[],r=0;r<e.value.length;++r)for(var n=e.value[r],o=0;o<n.value.length;++o)t.push(f.certificateExtensionFromAsn1(n.value[o]));return t},f.certificateExtensionFromAsn1=function(e){var t={};if(t.id=l.derToOid(e.value[0].value),t.critical=!1,e.value[1].type===l.Type.BOOLEAN?(t.critical=0!==e.value[1].value.charCodeAt(0),t.value=e.value[2].value):t.value=e.value[1].value,t.id in p)if(t.name=p[t.id],"keyUsage"===t.name){var r=l.fromDer(t.value),n=0,o=0;r.value.length>1&&(n=r.value.charCodeAt(1),o=r.value.length>2?r.value.charCodeAt(2):0),t.digitalSignature=128==(128&n),t.nonRepudiation=64==(64&n),t.keyEncipherment=32==(32&n),t.dataEncipherment=16==(16&n),t.keyAgreement=8==(8&n),t.keyCertSign=4==(4&n),t.cRLSign=2==(2&n),t.encipherOnly=1==(1&n),t.decipherOnly=128==(128&o)}else if("basicConstraints"===t.name){var r=l.fromDer(t.value);r.value.length>0&&r.value[0].type===l.Type.BOOLEAN?t.cA=0!==r.value[0].value.charCodeAt(0):t.cA=!1;var i=null;r.value.length>0&&r.value[0].type===l.Type.INTEGER?i=r.value[0].value:r.value.length>1&&(i=r.value[1].value),null!==i&&(t.pathLenConstraint=l.derToInteger(i))}else if("extKeyUsage"===t.name)for(var r=l.fromDer(t.value),a=0;a<r.value.length;++a){var s=l.derToOid(r.value[a].value);s in p?t[p[s]]=!0:t[s]=!0}else if("nsCertType"===t.name){var r=l.fromDer(t.value),n=0;r.value.length>1&&(n=r.value.charCodeAt(1)),t.client=128==(128&n),t.server=64==(64&n),t.email=32==(32&n),t.objsign=16==(16&n),t.reserved=8==(8&n),t.sslCA=4==(4&n),t.emailCA=2==(2&n),t.objCA=1==(1&n)}else if("subjectAltName"===t.name||"issuerAltName"===t.name){t.altNames=[];for(var u,r=l.fromDer(t.value),f=0;f<r.value.length;++f){u=r.value[f];var d={type:u.type,value:u.value};switch(t.altNames.push(d),u.type){case 1:case 2:case 6:break;case 7:d.ip=c.util.bytesToIP(u.value);break;case 8:d.oid=l.derToOid(u.value)}}}else if("subjectKeyIdentifier"===t.name){var r=l.fromDer(t.value);t.subjectKeyIdentifier=c.util.bytesToHex(r.value)}return t},f.certificationRequestFromAsn1=function(e,t){var r={},o=[];if(!l.validate(e,v,r,o)){var a=new Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.");throw a.errors=o,a}var s=l.derToOid(r.publicKeyOid);if(s!==f.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var u=f.createCertificationRequest();if(u.version=r.csrVersion?r.csrVersion.charCodeAt(0):0,u.signatureOid=c.asn1.derToOid(r.csrSignatureOid),u.signatureParameters=b(u.signatureOid,r.csrSignatureParams,!0),u.siginfo.algorithmOid=c.asn1.derToOid(r.csrSignatureOid),u.siginfo.parameters=b(u.siginfo.algorithmOid,r.csrSignatureParams,!1),u.signature=r.csrSignature,u.certificationRequestInfo=r.certificationRequestInfo,t){if(u.md=null,u.signatureOid in p){var s=p[u.signatureOid];switch(s){case"sha1WithRSAEncryption":u.md=c.md.sha1.create();break;case"md5WithRSAEncryption":u.md=c.md.md5.create();break;case"sha256WithRSAEncryption":u.md=c.md.sha256.create();break;case"sha512WithRSAEncryption":u.md=c.md.sha512.create();break;case"RSASSA-PSS":u.md=c.md.sha256.create()}}if(null===u.md){var a=new Error("Could not compute certification request digest. Unknown signature OID.");throw a.signatureOid=u.signatureOid,a}var d=l.toDer(u.certificationRequestInfo);u.md.update(d.getBytes())}var h=c.md.sha1.create();return u.subject.getField=function(e){return n(u.subject,e)},u.subject.addField=function(e){i([e]),u.subject.attributes.push(e)},u.subject.attributes=f.RDNAttributesAsArray(r.certificationRequestInfoSubject,h),u.subject.hash=h.digest().toHex(),u.publicKey=f.publicKeyFromAsn1(r.subjectPublicKeyInfo),u.getAttribute=function(e){return n(u,e)},u.addAttribute=function(e){i([e]),u.attributes.push(e)},u.attributes=f.CRIAttributesAsArray(r.certificationRequestInfoAttributes||[]),u},f.createCertificationRequest=function(){var e={};return e.version=0,e.signatureOid=null,e.signature=null,e.siginfo={},e.siginfo.algorithmOid=null,e.subject={},e.subject.getField=function(t){return n(e.subject,t)},e.subject.addField=function(t){i([t]),e.subject.attributes.push(t)},e.subject.attributes=[],e.subject.hash=null,e.publicKey=null,e.attributes=[],e.getAttribute=function(t){return n(e,t)},e.addAttribute=function(t){i([t]),e.attributes.push(t)},e.md=null,e.setSubject=function(t){i(t),e.subject.attributes=t,e.subject.hash=null},e.setAttributes=function(t){i(t),e.attributes=t},e.sign=function(t,r){e.md=r||c.md.sha1.create();var n=p[e.md.algorithm+"WithRSAEncryption"];if(!n){var o=new Error("Could not compute certification request digest. Unknown message digest algorithm OID.");throw o.algorithm=e.md.algorithm,o}e.signatureOid=e.siginfo.algorithmOid=n,e.certificationRequestInfo=f.getCertificationRequestInfo(e);var i=l.toDer(e.certificationRequestInfo);e.md.update(i.getBytes()),e.signature=t.sign(e.md)},e.verify=function(){var t=!1,r=e.md;if(null===r){if(e.signatureOid in p){switch(p[e.signatureOid]){case"sha1WithRSAEncryption":r=c.md.sha1.create();break;case"md5WithRSAEncryption":r=c.md.md5.create();break;case"sha256WithRSAEncryption":r=c.md.sha256.create();break;case"sha512WithRSAEncryption":r=c.md.sha512.create();break;case"RSASSA-PSS":r=c.md.sha256.create()}}if(null===r){var n=new Error("Could not compute certification request digest. Unknown signature OID.");throw n.signatureOid=e.signatureOid,n}var o=e.certificationRequestInfo||f.getCertificationRequestInfo(e),i=l.toDer(o);r.update(i.getBytes())}if(null!==r){var a;switch(e.signatureOid){case p.sha1WithRSAEncryption:break;case p["RSASSA-PSS"]:var s,u;if(void 0===(s=p[e.signatureParameters.mgf.hash.algorithmOid])||void 0===c.md[s]){var n=new Error("Unsupported MGF hash function.");throw n.oid=e.signatureParameters.mgf.hash.algorithmOid,n.name=s,n}if(void 0===(u=p[e.signatureParameters.mgf.algorithmOid])||void 0===c.mgf[u]){var n=new Error("Unsupported MGF function.");throw n.oid=e.signatureParameters.mgf.algorithmOid,n.name=u,n}if(u=c.mgf[u].create(c.md[s].create()),void 0===(s=p[e.signatureParameters.hash.algorithmOid])||void 0===c.md[s]){var n=new Error("Unsupported RSASSA-PSS hash function.");throw n.oid=e.signatureParameters.hash.algorithmOid,n.name=s,n}a=c.pss.create(c.md[s].create(),u,e.signatureParameters.saltLength)}t=e.publicKey.verify(r.digest().getBytes(),e.signature,a)}return t},e},f.getTBSCertificate=function(e){var t=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(e.version).getBytes())]),l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,c.util.hexToBytes(e.serialNumber)),l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(e.siginfo.algorithmOid).getBytes()),s(e.siginfo.algorithmOid,e.siginfo.parameters)]),o(e.issuer),l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.UTCTIME,!1,l.dateToUtcTime(e.validity.notBefore)),l.create(l.Class.UNIVERSAL,l.Type.UTCTIME,!1,l.dateToUtcTime(e.validity.notAfter))]),o(e.subject),f.publicKeyToAsn1(e.publicKey)]);return e.issuer.uniqueId&&t.value.push(l.create(l.Class.CONTEXT_SPECIFIC,1,!0,[l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,String.fromCharCode(0)+e.issuer.uniqueId)])),e.subject.uniqueId&&t.value.push(l.create(l.Class.CONTEXT_SPECIFIC,2,!0,[l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,String.fromCharCode(0)+e.subject.uniqueId)])),e.extensions.length>0&&t.value.push(f.certificateExtensionsToAsn1(e.extensions)),t},f.getCertificationRequestInfo=function(e){return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(e.version).getBytes()),o(e.subject),f.publicKeyToAsn1(e.publicKey),u(e)])},f.distinguishedNameToAsn1=function(e){return o(e)},f.certificateToAsn1=function(e){var t=e.tbsCertificate||f.getTBSCertificate(e);return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[t,l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(e.signatureOid).getBytes()),s(e.signatureOid,e.signatureParameters)]),l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},f.certificateExtensionsToAsn1=function(e){var t=l.create(l.Class.CONTEXT_SPECIFIC,3,!0,[]),r=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);t.value.push(r);for(var n=0;n<e.length;++n)r.value.push(f.certificateExtensionToAsn1(e[n]));return t},f.certificateExtensionToAsn1=function(e){var t=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);t.value.push(l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(e.id).getBytes())),e.critical&&t.value.push(l.create(l.Class.UNIVERSAL,l.Type.BOOLEAN,!1,String.fromCharCode(255)));var r=e.value;return"string"!=typeof e.value&&(r=l.toDer(r).getBytes()),t.value.push(l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,r)),t},f.certificationRequestToAsn1=function(e){var t=e.certificationRequestInfo||f.getCertificationRequestInfo(e);return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[t,l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(e.signatureOid).getBytes()),s(e.signatureOid,e.signatureParameters)]),l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},f.createCaStore=function(e){function t(e){return r(e),n.certs[e.hash]||null}function r(e){if(!e.hash){var t=c.md.sha1.create();e.attributes=f.RDNAttributesAsArray(o(e),t),e.hash=t.digest().toHex()}}var n={certs:{}};if(n.getIssuer=function(e){return t(e.issuer)},n.addCertificate=function(e){if("string"==typeof e&&(e=c.pki.certificateFromPem(e)),r(e.subject),!n.hasCertificate(e))if(e.subject.hash in n.certs){var t=n.certs[e.subject.hash];c.util.isArray(t)||(t=[t]),t.push(e),n.certs[e.subject.hash]=t}else n.certs[e.subject.hash]=e},n.hasCertificate=function(e){"string"==typeof e&&(e=c.pki.certificateFromPem(e));var r=t(e.subject);if(!r)return!1;c.util.isArray(r)||(r=[r]);for(var n=l.toDer(f.certificateToAsn1(e)).getBytes(),o=0;o<r.length;++o){if(n===l.toDer(f.certificateToAsn1(r[o])).getBytes())return!0}return!1},n.listAllCertificates=function(){var e=[];for(var t in n.certs)if(n.certs.hasOwnProperty(t)){var r=n.certs[t];if(c.util.isArray(r))for(var o=0;o<r.length;++o)e.push(r[o]);else e.push(r)}return e},n.removeCertificate=function(e){var o;if("string"==typeof e&&(e=c.pki.certificateFromPem(e)),r(e.subject),!n.hasCertificate(e))return null;var i=t(e.subject);if(!c.util.isArray(i))return o=n.certs[e.subject.hash],delete n.certs[e.subject.hash],o;for(var a=l.toDer(f.certificateToAsn1(e)).getBytes(),s=0;s<i.length;++s){a===l.toDer(f.certificateToAsn1(i[s])).getBytes()&&(o=i[s],i.splice(s,1))}return 0===i.length&&delete n.certs[e.subject.hash],o},e)for(var i=0;i<e.length;++i){var a=e[i];n.addCertificate(a)}return n},f.certificateError={bad_certificate:"forge.pki.BadCertificate",unsupported_certificate:"forge.pki.UnsupportedCertificate",certificate_revoked:"forge.pki.CertificateRevoked",certificate_expired:"forge.pki.CertificateExpired",certificate_unknown:"forge.pki.CertificateUnknown",unknown_ca:"forge.pki.UnknownCertificateAuthority"},f.verifyCertificateChain=function(e,t,r){t=t.slice(0);var n=t.slice(0),o=new Date,i=!0,a=null,s=0;do{var u=t.shift(),l=null,p=!1;if((o<u.validity.notBefore||o>u.validity.notAfter)&&(a={message:"Certificate is not valid yet or has expired.",error:f.certificateError.certificate_expired,notBefore:u.validity.notBefore,notAfter:u.validity.notAfter,now:o}),null===a){if(l=t[0]||e.getIssuer(u),null===l&&u.isIssuer(u)&&(p=!0,l=u),l){var d=l;c.util.isArray(d)||(d=[d]);for(var h=!1;!h&&d.length>0;){l=d.shift();try{h=l.verify(u)}catch(e){}}h||(a={message:"Certificate signature is invalid.",error:f.certificateError.bad_certificate})}null!==a||l&&!p||e.hasCertificate(u)||(a={message:"Certificate is not trusted.",error:f.certificateError.unknown_ca})}if(null===a&&l&&!u.isIssuer(l)&&(a={message:"Certificate issuer is invalid.",error:f.certificateError.bad_certificate}),null===a)for(var y={keyUsage:!0,basicConstraints:!0},m=0;null===a&&m<u.extensions.length;++m){var g=u.extensions[m];!g.critical||g.name in y||(a={message:"Certificate has an unsupported critical extension.",error:f.certificateError.unsupported_certificate})}if(null===a&&(!i||0===t.length&&(!l||p))){var v=u.getExtension("basicConstraints"),b=u.getExtension("keyUsage");if(null!==b&&(b.keyCertSign&&null!==v||(a={message:"Certificate keyUsage or basicConstraints conflict or indicate that the certificate is not a CA. If the certificate is the only one in the chain or isn't the first then the certificate must be a valid CA.",error:f.certificateError.bad_certificate})),null!==a||null===v||v.cA||(a={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:f.certificateError.bad_certificate}),null===a&&null!==b&&"pathLenConstraint"in v){s-1>v.pathLenConstraint&&(a={message:"Certificate basicConstraints pathLenConstraint violated.",error:f.certificateError.bad_certificate})}}var E=null===a||a.error,C=r?r(E,s,n):E;if(!0!==C)throw!0===E&&(a={message:"The application rejected the certificate.",error:f.certificateError.bad_certificate}),(C||0===C)&&("object"!=typeof C||c.util.isArray(C)?"string"==typeof C&&(a.error=C):(C.message&&(a.message=C.message),C.error&&(a.error=C.error))),a;a=null,i=!1,++s}while(t.length>0);return!0}},function(e,t,r){var n=r(1);r(6),r(2),(e.exports=n.pss=n.pss||{}).create=function(e){3===arguments.length&&(e={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var t=e.md,r=e.mgf,o=t.digestLength,i=e.salt||null;"string"==typeof i&&(i=n.util.createBuffer(i));var a;if("saltLength"in e)a=e.saltLength;else{if(null===i)throw new Error("Salt length not specified or specific salt not given.");a=i.length()}if(null!==i&&i.length()!==a)throw new Error("Given salt length does not match length of given salt.");var s=e.prng||n.random,u={};return u.encode=function(e,u){var c,l=u-1,f=Math.ceil(l/8),p=e.digest().getBytes();if(f<o+a+2)throw new Error("Message is too long to encrypt.");var d;d=null===i?s.getBytesSync(a):i.bytes();var h=new n.util.ByteBuffer;h.fillWithByte(0,8),h.putBytes(p),h.putBytes(d),t.start(),t.update(h.getBytes());var y=t.digest().getBytes(),m=new n.util.ByteBuffer;m.fillWithByte(0,f-a-o-2),m.putByte(1),m.putBytes(d);var g=m.getBytes(),v=f-o-1,b=r.generate(y,v),E="";for(c=0;c<v;c++)E+=String.fromCharCode(g.charCodeAt(c)^b.charCodeAt(c));var C=65280>>8*f-l&255;return(E=String.fromCharCode(E.charCodeAt(0)&~C)+E.substr(1))+y+String.fromCharCode(188)},u.verify=function(e,i,s){var u,c=s-1,l=Math.ceil(c/8);if(i=i.substr(-l),l<o+a+2)throw new Error("Inconsistent parameters to PSS signature verification.");if(188!==i.charCodeAt(l-1))throw new Error("Encoded message does not end in 0xBC.");var f=l-o-1,p=i.substr(0,f),d=i.substr(f,o),h=65280>>8*l-c&255;if(0!=(p.charCodeAt(0)&h))throw new Error("Bits beyond keysize not zero as expected.");var y=r.generate(d,f),m="";for(u=0;u<f;u++)m+=String.fromCharCode(p.charCodeAt(u)^y.charCodeAt(u));m=String.fromCharCode(m.charCodeAt(0)&~h)+m.substr(1);var g=l-o-a-2;for(u=0;u<g;u++)if(0!==m.charCodeAt(u))throw new Error("Leftmost octets not zero as expected");if(1!==m.charCodeAt(g))throw new Error("Inconsistent PSS signature, 0x01 marker not found");var v=m.substr(-a),b=new n.util.ByteBuffer;return b.fillWithByte(0,8),b.putBytes(e),b.putBytes(v),t.start(),t.update(b.getBytes()),d===t.digest().getBytes()},u}},function(e,t,r){"use strict";e.exports=function e(){return e}},function(e,t,r){"use strict";function n(e){for(var t=new ArrayBuffer(e.length),r=new Uint8Array(t),n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return t}t.__esModule=!0,t.default=n},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=r(3),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a={id:"FileId",name:"Name",blocks:"Chunks",size:"Size",downloadable:"Downloadable",assignedTo:"AssignedTo",assignedType:"AssignedType",status:"Status",message:"Message",adobeExportData:function(e){var t=e.AdobeExportData;if(t&&t.length)try{return JSON.parse(t)}catch(e){}return null},sourceMetadata:function(e){var t=e.SourceMetadata;if(t&&t.length)try{return JSON.parse(t)}catch(e){}return null},importUrl:"ImportURL"},s={id:"FileId",name:"Name",blocks:"Chunks",assignedTo:"CommentId",assignedType:function(){return"attachment"},status:"Status",message:function(){return""}},u=function(){function e(){n(this,e)}return e.prototype.fromFile=function(e){return(0,i.default)(this,a,e),this},e.prototype.fromCommentAttachment=function(e){return(0,i.default)(this,s,e),this},e}();t.default=u},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=r(3),a=n(i),s=r(25),u=n(s),c={id:"WorkflowId",name:"Title",isOwnedByTeam:"OwnedByTeam",teamId:"TeamId",ownerId:"UserId",startFrom:"StartFrom",isFavorite:"IsFavorite",availableRoles:"AvailableRoles",steps:(0,i.each)("WorkflowSteps",function(e){return(new u.default).fromWorkflowStep(e)})},l=function(){function e(){o(this,e)}return e.prototype.getStepByPosition=function(e){for(var t=this.steps.length,r=0;r<t;r+=1){var n=this.steps[r];if(n.position===e)return n}return null},e.prototype.getOrderedSteps=function(){return this.steps.sort(function(e,t){return e.position<t.position?-1:e.position>t.position?1:0})},e.prototype.getApproverStep=function(){return this.getStepByPosition(1e3)},e.prototype.fromWorkflow=function(e){return(0,a.default)(this,c,e),this},e}();t.default=l},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=r(3),u=n(s),c=r(9),l=n(c),f=r(68),p=n(f),d={id:"UserId",name:"Name",email:"Email",hasAvatar:"HasAvatar",hasRegistered:"IsRegistered",role:"Role",permissions:function(e){return{inviter:e.IsInviter}},firstViewedDate:(0,s.date)("FirstViewedDate"),nudgedDate:(0,s.date)("NudgedInStep"),decisionDate:(0,s.date)("DecisionDate"),decisionId:"Decision"},h=function(e){function t(){return o(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype._calculateState=function(e,t){e.SkippedInStep?this.state=p.default.SKIPPED:e.CompleteInStep?this.state=p.default.FINISHED:e.ViewedInStep?this.state=p.default.SEEN:t.Visible?this.state=p.default.VISIBLE:this.state=p.default.NOT_VISIBLE},t.prototype.fromWorkflowUser=function(e){return this._calculateState({},{}),(0,u.default)(this,d,e),this},t}(l.default);t.default=h},function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function o(e){if(0===e.indexOf(d)){var t=e.substring(d.length,e.indexOf(h));return parseInt(t,10)}if(e.match(f))try{return JSON.parse(e)[p]}catch(e){}return 1}function i(e){var t=o(e),r=l[t];if(r)return r(e);throw new Error("Unsupported comment schema version. Please update to a newer version of the SDK.")}t.__esModule=!0,t.getVersionNumber=void 0;var a=r(171),s=n(a),u=r(40),c=n(u),l={2:c.parse,1:s.parse},f=/^\s*{/,p="_",d='{"_":',h=",";t.default=i,t.getVersionNumber=o},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(Array.isArray(e))return e.map(function(e){return o(e,t)});if((0,f.default)(e)){var r={};for(var n in e)(0,c.default)(e,n)&&t[n]&&(r[t[n]]=o(e[n],t));return r}return e}function i(e){return o(JSON.parse(e),p)}function a(e){var t=o(s({version:2},e),d);return JSON.stringify(t)}t.__esModule=!0,t.serialize=t.parse=void 0;var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u=r(17),c=n(u),l=r(26),f=n(l),p={_:"version",bs:"blocks",t:"type",v:"value",i:"index",l:"length",st:"styles",en:"entities",md:"metadata",i_:"id",lb:"label",ur:"url"},d={};for(var h in p)(0,c.default)(p,h)&&(d[p[h]]=h);t.parse=i,t.serialize=a},function(e,t,r){"use strict";t.__esModule=!0;var n={TODO:"todo",DONE:"done",UNMARKED:"unmarked"};t.default=n},function(e,t,r){"use strict";function n(e,t){return o[e]||t||"Unknown error occurred (Code: "+e+"). Please contact support."}t.__esModule=!0,t.getErrorMessage=n;var o={400:"Bad request: The request contains invalid data.",401:"Unauthorized: Please log in to access this resource.",404:"Not found: The requested resource does not exist.",406:"Authentication failed.",407:"Authentication failed.",1010:"Authentication failed.",1011:"Authentication failed.",1012:"Operation failed. Please contact support.",1013:"Invalid format.",1014:"Too many requests. Please try again later.",1015:"Access unavailable. Please contact support.",1016:"System error. Please contact support.",1017:"Authentication failed.",1018:"Invalid or expired code.",1019:"Invalid or expired code.",1020:"System error. Please contact support.",1021:"Access denied. Please contact support.",1022:"Invalid or expired code.",1023:"Invalid or expired code.",1024:"System error. Please contact support.",4001:"File upload failed: Unable to queue file for processing.",4002:"File upload failed: Queueing process failed.",4005:"File upload failed: Invalid filename. Please use only letters, numbers, and standard characters.",4006:"File upload failed: This file is already attached to another proof.",4007:"File upload failed: File is missing a file extension. Please ensure your file has a proper extension (e.g., .pdf, .jpg).",4008:"File upload failed: Unsupported file type. Please check the supported file formats.",100:"Access denied. Please contact support if you believe this is an error.",101:"Access denied. Please contact support if you believe this is an error.",102:"Resource temporarily unavailable. Please try again later.",124:"Access denied. Please contact support if you believe this is an error.",125:"Access denied. Please contact support if you believe this is an error.",126:"Access denied. Please contact support if you believe this is an error.",402:"Access denied. Please contact support if you believe this is an error.",403:"Operation not supported.",1e3:"Resource not found.",1001:"Failed to create resource.",1002:"Failed to update resource.",1003:"Failed to delete resource.",1004:"Resource already exists.",1005:"System configuration error. Please contact support.",2010:"Invalid format.",2011:"Invalid request.",3e3:"Account upgrade required. Please contact support.",6005:"Feature not available. Please contact support.",3001:"Group workflow has already been started.",3002:"A group with this name already exists.",3003:"Cannot delete group: active proofs exist.",3004:"No proofs found for this group.",5e3:"Resource already exists.",6e3:"Invalid format. Please check your input.",6001:"Verification failed. Please contact support.",6002:"Invalid format. Please check your input.",6003:"Required information missing. Please contact support.",6004:"Resource unavailable. Please try a different option.",6500:"Prerequisites not met. Please contact support.",106:"System error. Please try again later.",110:"System error. Please try again later.",120:"System error. Please try again later.",121:"System error. Please try again later.",122:"Operation failed. Please try again.",123:"Operation failed. Please try again.",7e3:"Internal server error. Please try again later."};t.default=o},function(e,t,r){e.exports=r(1),r(10),r(98),r(7),r(28),r(57),r(19),r(14),r(100),r(58),r(101),r(56),r(30),r(12),r(52),r(54),r(103),r(46),r(53),r(50),r(33),r(6),r(51),r(104),r(105),r(45),r(2)},function(e,t,r){function n(e){if("string"==typeof e&&(e=a.util.createBuffer(e)),a.util.isArray(e)&&e.length>4){var t=e;e=a.util.createBuffer();for(var r=0;r<t.length;++r)e.putByte(t[r])}return a.util.isArray(e)||(e=[e.getInt32(),e.getInt32(),e.getInt32(),e.getInt32()]),e}function o(e){e[e.length-1]=e[e.length-1]+1&4294967295}function i(e){return[e/4294967296|0,4294967295&e]}var a=r(1);r(2),a.cipher=a.cipher||{};var s=e.exports=a.cipher.modes=a.cipher.modes||{};s.ecb=function(e){e=e||{},this.name="ECB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},s.ecb.prototype.start=function(e){},s.ecb.prototype.encrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var n=0;n<this._ints;++n)t.putInt32(this._outBlock[n])},s.ecb.prototype.decrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var n=0;n<this._ints;++n)t.putInt32(this._outBlock[n])},s.ecb.prototype.pad=function(e,t){var r=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(r,r),!0},s.ecb.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},s.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},s.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._prev=this._iv.slice(0)}},s.cbc.prototype.encrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=this._prev[n]^e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var n=0;n<this._ints;++n)t.putInt32(this._outBlock[n]);this._prev=this._outBlock},s.cbc.prototype.decrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var n=0;n<this._ints;++n)t.putInt32(this._prev[n]^this._outBlock[n]);this._prev=this._inBlock.slice(0)},s.cbc.prototype.pad=function(e,t){var r=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(r,r),!0},s.cbc.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},s.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=a.util.createBuffer(),this._partialBytes=0},s.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},s.cfb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var o=0;o<this._ints;++o)this._inBlock[o]=e.getInt32()^this._outBlock[o],t.putInt32(this._inBlock[o]);else{var i=(this.blockSize-n)%this.blockSize;i>0&&(i=this.blockSize-i),this._partialOutput.clear();for(var o=0;o<this._ints;++o)this._partialBlock[o]=e.getInt32()^this._outBlock[o],this._partialOutput.putInt32(this._partialBlock[o]);if(i>0)e.read-=this.blockSize;else for(var o=0;o<this._ints;++o)this._inBlock[o]=this._partialBlock[o];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},s.cfb.prototype.decrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var o=0;o<this._ints;++o)this._inBlock[o]=e.getInt32(),t.putInt32(this._inBlock[o]^this._outBlock[o]);else{var i=(this.blockSize-n)%this.blockSize;i>0&&(i=this.blockSize-i),this._partialOutput.clear();for(var o=0;o<this._ints;++o)this._partialBlock[o]=e.getInt32(),this._partialOutput.putInt32(this._partialBlock[o]^this._outBlock[o]);if(i>0)e.read-=this.blockSize;else for(var o=0;o<this._ints;++o)this._inBlock[o]=this._partialBlock[o];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},s.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=a.util.createBuffer(),this._partialBytes=0},s.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},s.ofb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var o=0;o<this._ints;++o)t.putInt32(e.getInt32()^this._outBlock[o]),this._inBlock[o]=this._outBlock[o];else{var i=(this.blockSize-n)%this.blockSize;i>0&&(i=this.blockSize-i),this._partialOutput.clear();for(var o=0;o<this._ints;++o)this._partialOutput.putInt32(e.getInt32()^this._outBlock[o]);if(i>0)e.read-=this.blockSize;else for(var o=0;o<this._ints;++o)this._inBlock[o]=this._outBlock[o];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},s.ofb.prototype.decrypt=s.ofb.prototype.encrypt,s.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=a.util.createBuffer(),this._partialBytes=0},s.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},s.ctr.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i<this._ints;++i)t.putInt32(e.getInt32()^this._outBlock[i]);else{var a=(this.blockSize-n)%this.blockSize;a>0&&(a=this.blockSize-a),this._partialOutput.clear();for(var i=0;i<this._ints;++i)this._partialOutput.putInt32(e.getInt32()^this._outBlock[i]);if(a>0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}o(this._inBlock)},s.ctr.prototype.decrypt=s.ctr.prototype.encrypt,s.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=a.util.createBuffer(),this._partialBytes=0,this._R=3774873600},s.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t=a.util.createBuffer(e.iv);this._cipherLength=0;var r;if(r="additionalData"in e?a.util.createBuffer(e.additionalData):a.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=a.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var n=t.length();if(12===n)this._j0=[t.getInt32(),t.getInt32(),t.getInt32(),1];else{for(this._j0=[0,0,0,0];t.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(i(8*n)))}this._inBlock=this._j0.slice(0),o(this._inBlock),this._partialBytes=0,r=a.util.createBuffer(r),this._aDataLength=i(8*r.length());var s=r.length()%this.blockSize;for(s&&r.fillWithByte(0,this.blockSize-s),this._s=[0,0,0,0];r.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()])},s.gcm.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var i=0;i<this._ints;++i)t.putInt32(this._outBlock[i]^=e.getInt32());this._cipherLength+=this.blockSize}else{var a=(this.blockSize-n)%this.blockSize;a>0&&(a=this.blockSize-a),this._partialOutput.clear();for(var i=0;i<this._ints;++i)this._partialOutput.putInt32(e.getInt32()^this._outBlock[i]);if(0===a||r){if(r){var s=n%this.blockSize;this._cipherLength+=s,this._partialOutput.truncate(this.blockSize-s)}else this._cipherLength+=this.blockSize;for(var i=0;i<this._ints;++i)this._outBlock[i]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),o(this._inBlock)},s.gcm.prototype.decrypt=function(e,t,r){var n=e.length();if(n<this.blockSize&&!(r&&n>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),o(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i<this._ints;++i)t.putInt32(this._outBlock[i]^this._hashBlock[i]);n<this.blockSize?this._cipherLength+=n%this.blockSize:this._cipherLength+=this.blockSize},s.gcm.prototype.afterFinish=function(e,t){var r=!0;t.decrypt&&t.overflow&&e.truncate(this.blockSize-t.overflow),this.tag=a.util.createBuffer();var n=this._aDataLength.concat(i(8*this._cipherLength));this._s=this.ghash(this._hashSubkey,this._s,n);var o=[];this.cipher.encrypt(this._j0,o);for(var s=0;s<this._ints;++s)this.tag.putInt32(this._s[s]^o[s]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),t.decrypt&&this.tag.bytes()!==this._tag&&(r=!1),r},s.gcm.prototype.multiply=function(e,t){for(var r=[0,0,0,0],n=t.slice(0),o=0;o<128;++o){e[o/32|0]&1<<31-o%32&&(r[0]^=n[0],r[1]^=n[1],r[2]^=n[2],r[3]^=n[3]),this.pow(n,n)}return r},s.gcm.prototype.pow=function(e,t){for(var r=1&e[3],n=3;n>0;--n)t[n]=e[n]>>>1|(1&e[n-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},s.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var n=r/8|0,o=e[n]>>>4*(7-r%8)&15,i=this._m[r][o];t[0]^=i[0],t[1]^=i[1],t[2]^=i[2],t[3]^=i[3]}return t},s.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},s.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,n=4*r,o=16*r,i=new Array(o),a=0;a<o;++a){var s=[0,0,0,0],u=a/n|0,c=(n-1-a%n)*t;s[u]=1<<t-1<<c,i[a]=this.generateSubHashTable(this.multiply(s,e),t)}return i},s.gcm.prototype.generateSubHashTable=function(e,t){var r=1<<t,n=r>>>1,o=new Array(r);o[n]=e.slice(0);for(var i=n>>>1;i>0;)this.pow(o[2*i],o[i]=[]),i>>=1;for(i=2;i<n;){for(var a=1;a<i;++a){var s=o[i],u=o[a];o[i+a]=[s[0]^u[0],s[1]^u[1],s[2]^u[2],s[3]^u[3]]}i*=2}for(o[0]=[0,0,0,0],i=n+1;i<r;++i){var c=o[i^n];o[i]=[e[0]^c[0],e[1]^c[1],e[2]^c[2],e[3]^c[3]]}return o}},function(e,t,r){var n=r(1);r(7),r(14),r(29),r(12),r(46),r(6),r(15),r(2);var o=function(e,t,r,o){var i=n.util.createBuffer(),a=e.length>>1,s=a+(1&e.length),u=e.substr(0,s),c=e.substr(a,s),l=n.util.createBuffer(),f=n.hmac.create();r=t+r;var p=Math.ceil(o/16),d=Math.ceil(o/20);f.start("MD5",u);var h=n.util.createBuffer();l.putBytes(r);for(var y=0;y<p;++y)f.start(null,null),f.update(l.getBytes()),l.putBuffer(f.digest()),f.start(null,null),f.update(l.bytes()+r),h.putBuffer(f.digest());f.start("SHA1",c);var m=n.util.createBuffer();l.clear(),l.putBytes(r);for(var y=0;y<d;++y)f.start(null,null),f.update(l.getBytes()),l.putBuffer(f.digest()),f.start(null,null),f.update(l.bytes()+r),m.putBuffer(f.digest());return i.putBytes(n.util.xorBytes(h.getBytes(),m.getBytes(),o)),i},i=function(e,t,r){var o=n.hmac.create();o.start("SHA1",e);var i=n.util.createBuffer();return i.putInt32(t[0]),i.putInt32(t[1]),i.putByte(r.type),i.putByte(r.version.major),i.putByte(r.version.minor),i.putInt16(r.length),i.putBytes(r.fragment.bytes()),o.update(i.getBytes()),o.digest().getBytes()},a=function(e,t,r){var o=!1;try{var i=e.deflate(t.fragment.getBytes());t.fragment=n.util.createBuffer(i),t.length=i.length,o=!0}catch(e){}return o},s=function(e,t,r){var o=!1;try{var i=e.inflate(t.fragment.getBytes());t.fragment=n.util.createBuffer(i),t.length=i.length,o=!0}catch(e){}return o},u=function(e,t){var r=0;switch(t){case 1:r=e.getByte();break;case 2:r=e.getInt16();break;case 3:r=e.getInt24();break;case 4:r=e.getInt32()}return n.util.createBuffer(e.getBytes(r))},c=function(e,t,r){e.putInt(r.length(),t<<3),e.putBuffer(r)},l={};l.Versions={TLS_1_0:{major:3,minor:1},TLS_1_1:{major:3,minor:2},TLS_1_2:{major:3,minor:3}},l.SupportedVersions=[l.Versions.TLS_1_1,l.Versions.TLS_1_0],l.Version=l.SupportedVersions[0],l.MaxFragment=15360,l.ConnectionEnd={server:0,client:1},l.PRFAlgorithm={tls_prf_sha256:0},l.BulkCipherAlgorithm={none:null,rc4:0,des3:1,aes:2},l.CipherType={stream:0,block:1,aead:2},l.MACAlgorithm={none:null,hmac_md5:0,hmac_sha1:1,hmac_sha256:2,hmac_sha384:3,hmac_sha512:4},l.CompressionMethod={none:0,deflate:1},l.ContentType={change_cipher_spec:20,alert:21,handshake:22,application_data:23,heartbeat:24},l.HandshakeType={hello_request:0,client_hello:1,server_hello:2,certificate:11,server_key_exchange:12,certificate_request:13,server_hello_done:14,certificate_verify:15,client_key_exchange:16,finished:20},l.Alert={},l.Alert.Level={warning:1,fatal:2},l.Alert.Description={close_notify:0,unexpected_message:10,bad_record_mac:20,decryption_failed:21,record_overflow:22,decompression_failure:30,handshake_failure:40,bad_certificate:42,unsupported_certificate:43,certificate_revoked:44,certificate_expired:45,certificate_unknown:46,illegal_parameter:47,unknown_ca:48,access_denied:49,decode_error:50,decrypt_error:51,export_restriction:60,protocol_version:70,insufficient_security:71,internal_error:80,user_canceled:90,no_renegotiation:100},l.HeartbeatMessageType={heartbeat_request:1,heartbeat_response:2},l.CipherSuites={},l.getCipherSuite=function(e){var t=null;for(var r in l.CipherSuites){var n=l.CipherSuites[r];if(n.id[0]===e.charCodeAt(0)&&n.id[1]===e.charCodeAt(1)){t=n;break}}return t},l.handleUnexpected=function(e,t){!e.open&&e.entity===l.ConnectionEnd.client||e.error(e,{message:"Unexpected message. Received TLS record out of order.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.unexpected_message}})},l.handleHelloRequest=function(e,t,r){!e.handshaking&&e.handshakes>0&&(l.queue(e,l.createAlert(e,{level:l.Alert.Level.warning,description:l.Alert.Description.no_renegotiation})),l.flush(e)),e.process()},l.parseHelloMessage=function(e,t,r){var o=null,i=e.entity===l.ConnectionEnd.client;if(r<38)e.error(e,{message:i?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.illegal_parameter}});else{var a=t.fragment,s=a.length();if(o={version:{major:a.getByte(),minor:a.getByte()},random:n.util.createBuffer(a.getBytes(32)),session_id:u(a,1),extensions:[]},i?(o.cipher_suite=a.getBytes(2),o.compression_method=a.getByte()):(o.cipher_suites=u(a,2),o.compression_methods=u(a,1)),(s=r-(s-a.length()))>0){for(var c=u(a,2);c.length()>0;)o.extensions.push({type:[c.getByte(),c.getByte()],data:u(c,2)});if(!i)for(var f=0;f<o.extensions.length;++f){var p=o.extensions[f];if(0===p.type[0]&&0===p.type[1])for(var d=u(p.data,2);d.length()>0;){var h=d.getByte();if(0!==h)break;e.session.extensions.server_name.serverNameList.push(u(d,2).getBytes())}}}if(e.session.version&&(o.version.major!==e.session.version.major||o.version.minor!==e.session.version.minor))return e.error(e,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.protocol_version}});if(i)e.session.cipherSuite=l.getCipherSuite(o.cipher_suite);else for(var y=n.util.createBuffer(o.cipher_suites.bytes());y.length()>0&&(e.session.cipherSuite=l.getCipherSuite(y.getBytes(2)),null===e.session.cipherSuite););if(null===e.session.cipherSuite)return e.error(e,{message:"No cipher suites in common.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.handshake_failure},cipherSuite:n.util.bytesToHex(o.cipher_suite)});e.session.compressionMethod=i?o.compression_method:l.CompressionMethod.none}return o},l.createSecurityParameters=function(e,t){var r=e.entity===l.ConnectionEnd.client,n=t.random.bytes(),o=r?e.session.sp.client_random:n,i=r?n:l.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:l.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:e.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:o,server_random:i}},l.handleServerHello=function(e,t,r){var n=l.parseHelloMessage(e,t,r);if(!e.fail){if(!(n.version.minor<=e.version.minor))return e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.protocol_version}});e.version.minor=n.version.minor,e.session.version=e.version;var o=n.session_id.bytes();o.length>0&&o===e.session.id?(e.expect=y,e.session.resuming=!0,e.session.sp.server_random=n.random.bytes()):(e.expect=f,e.session.resuming=!1,l.createSecurityParameters(e,n)),e.session.id=o,e.process()}},l.handleClientHello=function(e,t,r){var o=l.parseHelloMessage(e,t,r);if(!e.fail){var i=o.session_id.bytes(),a=null;if(e.sessionCache&&(a=e.sessionCache.getSession(i),null===a?i="":(a.version.major!==o.version.major||a.version.minor>o.version.minor)&&(a=null,i="")),0===i.length&&(i=n.random.getBytes(32)),e.session.id=i,e.session.clientHelloVersion=o.version,e.session.sp={},a)e.version=e.session.version=a.version,e.session.sp=a.sp;else{for(var s,u=1;u<l.SupportedVersions.length&&(s=l.SupportedVersions[u],!(s.minor<=o.version.minor));++u);e.version={major:s.major,minor:s.minor},e.session.version=e.version}null!==a?(e.expect=_,e.session.resuming=!0,e.session.sp.client_random=o.random.bytes()):(e.expect=!1!==e.verifyClient?b:E,e.session.resuming=!1,l.createSecurityParameters(e,o)),e.open=!0,l.queue(e,l.createRecord(e,{type:l.ContentType.handshake,data:l.createServerHello(e)})),e.session.resuming?(l.queue(e,l.createRecord(e,{type:l.ContentType.change_cipher_spec,data:l.createChangeCipherSpec()})),e.state.pending=l.createConnectionState(e),e.state.current.write=e.state.pending.write,l.queue(e,l.createRecord(e,{type:l.ContentType.handshake,data:l.createFinished(e)}))):(l.queue(e,l.createRecord(e,{type:l.ContentType.handshake,data:l.createCertificate(e)})),e.fail||(l.queue(e,l.createRecord(e,{type:l.ContentType.handshake,data:l.createServerKeyExchange(e)})),!1!==e.verifyClient&&l.queue(e,l.createRecord(e,{type:l.ContentType.handshake,data:l.createCertificateRequest(e)})),l.queue(e,l.createRecord(e,{type:l.ContentType.handshake,data:l.createServerHelloDone(e)})))),l.flush(e),e.process()}},l.handleCertificate=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.illegal_parameter}});var o,i,a=t.fragment,s={certificate_list:u(a,3)},c=[];try{for(;s.certificate_list.length()>0;)o=u(s.certificate_list,3),i=n.asn1.fromDer(o),o=n.pki.certificateFromAsn1(i,!0),c.push(o)}catch(t){return e.error(e,{message:"Could not parse certificate list.",cause:t,send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.bad_certificate}})}var f=e.entity===l.ConnectionEnd.client;!f&&!0!==e.verifyClient||0!==c.length?0===c.length?e.expect=f?p:E:(f?e.session.serverCertificate=c[0]:e.session.clientCertificate=c[0],l.verifyCertificateChain(e,c)&&(e.expect=f?p:E)):e.error(e,{message:f?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.illegal_parameter}}),e.process()},l.handleServerKeyExchange=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.unsupported_certificate}});e.expect=d,e.process()},l.handleClientKeyExchange=function(e,t,r){if(r<48)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.unsupported_certificate}});var o=t.fragment,i={enc_pre_master_secret:u(o,2).getBytes()},a=null;if(e.getPrivateKey)try{a=e.getPrivateKey(e,e.session.serverCertificate),a=n.pki.privateKeyFromPem(a)}catch(t){e.error(e,{message:"Could not get private key.",cause:t,send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.internal_error}})}if(null===a)return e.error(e,{message:"No private key set.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.internal_error}});try{var s=e.session.sp;s.pre_master_secret=a.decrypt(i.enc_pre_master_secret);var c=e.session.clientHelloVersion;if(c.major!==s.pre_master_secret.charCodeAt(0)||c.minor!==s.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch(e){s.pre_master_secret=n.random.getBytes(48)}e.expect=_,null!==e.session.clientCertificate&&(e.expect=C),e.process()},l.handleCertificateRequest=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.illegal_parameter}});var n=t.fragment,o={certificate_types:u(n,1),certificate_authorities:u(n,2)};e.session.certificateRequest=o,e.expect=h,e.process()},l.handleCertificateVerify=function(e,t,r){if(r<2)return e.error(e,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.illegal_parameter}});var o=t.fragment;o.read-=4;var i=o.bytes();o.read+=4;var a={signature:u(o,2).getBytes()},s=n.util.createBuffer();s.putBuffer(e.session.md5.digest()),s.putBuffer(e.session.sha1.digest()),s=s.getBytes();try{if(!e.session.clientCertificate.publicKey.verify(s,a.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");e.session.md5.update(i),e.session.sha1.update(i)}catch(t){return e.error(e,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.handshake_failure}})}e.expect=_,e.process()},l.handleServerHelloDone=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.record_overflow}});if(null===e.serverCertificate){var o={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.insufficient_security}},i=e.verify(e,o.alert.description,0,[]);if(!0!==i)return(i||0===i)&&("object"!=typeof i||n.util.isArray(i)?"number"==typeof i&&(o.alert.description=i):(i.message&&(o.message=i.message),i.alert&&(o.alert.description=i.alert))),e.error(e,o)}null!==e.session.certificateRequest&&(t=l.createRecord(e,{type:l.ContentType.handshake,data:l.createCertificate(e)}),l.queue(e,t)),t=l.createRecord(e,{type:l.ContentType.handshake,data:l.createClientKeyExchange(e)}),l.queue(e,t),e.expect=v;var a=function(e,t){null!==e.session.certificateRequest&&null!==e.session.clientCertificate&&l.queue(e,l.createRecord(e,{type:l.ContentType.handshake,data:l.createCertificateVerify(e,t)})),l.queue(e,l.createRecord(e,{type:l.ContentType.change_cipher_spec,data:l.createChangeCipherSpec()})),e.state.pending=l.createConnectionState(e),e.state.current.write=e.state.pending.write,l.queue(e,l.createRecord(e,{type:l.ContentType.handshake,data:l.createFinished(e)})),e.expect=y,l.flush(e),e.process()};if(null===e.session.certificateRequest||null===e.session.clientCertificate)return a(e,null);l.getClientSignature(e,a)},l.handleChangeCipherSpec=function(e,t){if(1!==t.fragment.getByte())return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.illegal_parameter}});var r=e.entity===l.ConnectionEnd.client;(e.session.resuming&&r||!e.session.resuming&&!r)&&(e.state.pending=l.createConnectionState(e)),e.state.current.read=e.state.pending.read,(!e.session.resuming&&r||e.session.resuming&&!r)&&(e.state.pending=null),e.expect=r?m:w,e.process()},l.handleFinished=function(e,t,r){var i=t.fragment;i.read-=4;var a=i.bytes();i.read+=4;var s=t.fragment.getBytes();i=n.util.createBuffer(),i.putBuffer(e.session.md5.digest()),i.putBuffer(e.session.sha1.digest());var u=e.entity===l.ConnectionEnd.client,c=u?"server finished":"client finished",f=e.session.sp;if(i=o(f.master_secret,c,i.getBytes(),12),i.getBytes()!==s)return e.error(e,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.decrypt_error}});e.session.md5.update(a),e.session.sha1.update(a),(e.session.resuming&&u||!e.session.resuming&&!u)&&(l.queue(e,l.createRecord(e,{type:l.ContentType.change_cipher_spec,data:l.createChangeCipherSpec()})),e.state.current.write=e.state.pending.write,e.state.pending=null,l.queue(e,l.createRecord(e,{type:l.ContentType.handshake,data:l.createFinished(e)}))),e.expect=u?g:T,e.handshaking=!1,++e.handshakes,e.peerCertificate=u?e.session.serverCertificate:e.session.clientCertificate,l.flush(e),e.isConnected=!0,e.connected(e),e.process()},l.handleAlert=function(e,t){var r,n=t.fragment,o={level:n.getByte(),description:n.getByte()};switch(o.description){case l.Alert.Description.close_notify:r="Connection closed.";break;case l.Alert.Description.unexpected_message:r="Unexpected message.";break;case l.Alert.Description.bad_record_mac:r="Bad record MAC.";break;case l.Alert.Description.decryption_failed:r="Decryption failed.";break;case l.Alert.Description.record_overflow:r="Record overflow.";break;case l.Alert.Description.decompression_failure:r="Decompression failed.";break;case l.Alert.Description.handshake_failure:r="Handshake failure.";break;case l.Alert.Description.bad_certificate:r="Bad certificate.";break;case l.Alert.Description.unsupported_certificate:r="Unsupported certificate.";break;case l.Alert.Description.certificate_revoked:r="Certificate revoked.";break;case l.Alert.Description.certificate_expired:r="Certificate expired.";break;case l.Alert.Description.certificate_unknown:r="Certificate unknown.";break;case l.Alert.Description.illegal_parameter:r="Illegal parameter.";break;case l.Alert.Description.unknown_ca:r="Unknown certificate authority.";break;case l.Alert.Description.access_denied:r="Access denied.";break;case l.Alert.Description.decode_error:r="Decode error.";break;case l.Alert.Description.decrypt_error:r="Decrypt error.";break;case l.Alert.Description.export_restriction:r="Export restriction.";break;case l.Alert.Description.protocol_version:r="Unsupported protocol version.";break;case l.Alert.Description.insufficient_security:r="Insufficient security.";break;case l.Alert.Description.internal_error:r="Internal error.";break;case l.Alert.Description.user_canceled:r="User canceled.";break;case l.Alert.Description.no_renegotiation:r="Renegotiation not supported.";break;default:r="Unknown error."}if(o.description===l.Alert.Description.close_notify)return e.close();e.error(e,{message:r,send:!1,origin:e.entity===l.ConnectionEnd.client?"server":"client",alert:o}),e.process()},l.handleHandshake=function(e,t){var r=t.fragment,o=r.getByte(),i=r.getInt24();if(i>r.length())return e.fragmented=t,t.fragment=n.util.createBuffer(),r.read-=4,e.process();e.fragmented=null,r.read-=4;var a=r.bytes(i+4);r.read+=4,o in V[e.entity][e.expect]?(e.entity!==l.ConnectionEnd.server||e.open||e.fail||(e.handshaking=!0,e.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:n.md.md5.create(),sha1:n.md.sha1.create()}),o!==l.HandshakeType.hello_request&&o!==l.HandshakeType.certificate_verify&&o!==l.HandshakeType.finished&&(e.session.md5.update(a),e.session.sha1.update(a)),V[e.entity][e.expect][o](e,t,i)):l.handleUnexpected(e,t)},l.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process()},l.handleHeartbeat=function(e,t){var r=t.fragment,o=r.getByte(),i=r.getInt16(),a=r.getBytes(i);if(o===l.HeartbeatMessageType.heartbeat_request){if(e.handshaking||i>a.length)return e.process();l.queue(e,l.createRecord(e,{type:l.ContentType.heartbeat,data:l.createHeartbeat(l.HeartbeatMessageType.heartbeat_response,a)})),l.flush(e)}else if(o===l.HeartbeatMessageType.heartbeat_response){if(a!==e.expectedHeartbeatPayload)return e.process();e.heartbeatReceived&&e.heartbeatReceived(e,n.util.createBuffer(a))}e.process()};var f=1,p=2,d=3,h=4,y=5,m=6,g=7,v=8,b=1,E=2,C=3,_=4,w=5,T=6,S=l.handleUnexpected,I=l.handleChangeCipherSpec,A=l.handleAlert,k=l.handleHandshake,B=l.handleApplicationData,R=l.handleHeartbeat,P=[];P[l.ConnectionEnd.client]=[[S,A,k,S,R],[S,A,k,S,R],[S,A,k,S,R],[S,A,k,S,R],[S,A,k,S,R],[I,A,S,S,R],[S,A,k,S,R],[S,A,k,B,R],[S,A,k,S,R]],P[l.ConnectionEnd.server]=[[S,A,k,S,R],[S,A,k,S,R],[S,A,k,S,R],[S,A,k,S,R],[I,A,S,S,R],[S,A,k,S,R],[S,A,k,B,R],[S,A,k,S,R]];var O=l.handleHelloRequest,D=l.handleServerHello,N=l.handleCertificate,L=l.handleServerKeyExchange,U=l.handleCertificateRequest,x=l.handleServerHelloDone,M=l.handleFinished,V=[];V[l.ConnectionEnd.client]=[[S,S,D,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S],[O,S,S,S,S,S,S,S,S,S,S,N,L,U,x,S,S,S,S,S,S],[O,S,S,S,S,S,S,S,S,S,S,S,L,U,x,S,S,S,S,S,S],[O,S,S,S,S,S,S,S,S,S,S,S,S,U,x,S,S,S,S,S,S],[O,S,S,S,S,S,S,S,S,S,S,S,S,S,x,S,S,S,S,S,S],[O,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S],[O,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,M],[O,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S],[O,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S]];var j=l.handleClientHello,F=l.handleClientKeyExchange,q=l.handleCertificateVerify;V[l.ConnectionEnd.server]=[[S,j,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S],[S,S,S,S,S,S,S,S,S,S,S,N,S,S,S,S,S,S,S,S,S],[S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,F,S,S,S,S],[S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,q,S,S,S,S,S],[S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S],[S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,M],[S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S],[S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S]],l.generateKeys=function(e,t){var r=o,n=t.client_random+t.server_random;e.session.resuming||(t.master_secret=r(t.pre_master_secret,"master secret",n,48).bytes(),t.pre_master_secret=null),n=t.server_random+t.client_random;var i=2*t.mac_key_length+2*t.enc_key_length,a=e.version.major===l.Versions.TLS_1_0.major&&e.version.minor===l.Versions.TLS_1_0.minor;a&&(i+=2*t.fixed_iv_length);var s=r(t.master_secret,"key expansion",n,i),u={client_write_MAC_key:s.getBytes(t.mac_key_length),server_write_MAC_key:s.getBytes(t.mac_key_length),client_write_key:s.getBytes(t.enc_key_length),server_write_key:s.getBytes(t.enc_key_length)};return a&&(u.client_write_IV=s.getBytes(t.fixed_iv_length),u.server_write_IV=s.getBytes(t.fixed_iv_length)),u},l.createConnectionState=function(e){var t=e.entity===l.ConnectionEnd.client,r=function(){var e={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,cipherState:null,cipherFunction:function(e){return!0},compressionState:null,compressFunction:function(e){return!0},updateSequenceNumber:function(){4294967295===e.sequenceNumber[1]?(e.sequenceNumber[1]=0,++e.sequenceNumber[0]):++e.sequenceNumber[1]}};return e},n={read:r(),write:r()};if(n.read.update=function(e,t){return n.read.cipherFunction(t,n.read)?n.read.compressFunction(e,t,n.read)||e.error(e,{message:"Could not decompress record.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.decompression_failure}}):e.error(e,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.bad_record_mac}}),!e.fail},n.write.update=function(e,t){return n.write.compressFunction(e,t,n.write)?n.write.cipherFunction(t,n.write)||e.error(e,{message:"Could not encrypt record.",send:!1,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.internal_error}}):e.error(e,{message:"Could not compress record.",send:!1,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.internal_error}}),!e.fail},e.session){var o=e.session.sp;switch(e.session.cipherSuite.initSecurityParameters(o),o.keys=l.generateKeys(e,o),n.read.macKey=t?o.keys.server_write_MAC_key:o.keys.client_write_MAC_key,n.write.macKey=t?o.keys.client_write_MAC_key:o.keys.server_write_MAC_key,e.session.cipherSuite.initConnectionState(n,e,o),o.compression_algorithm){case l.CompressionMethod.none:break;case l.CompressionMethod.deflate:n.read.compressFunction=s,n.write.compressFunction=a;break;default:throw new Error("Unsupported compression algorithm.")}}return n},l.createRandom=function(){var e=new Date,t=+e+6e4*e.getTimezoneOffset(),r=n.util.createBuffer();return r.putInt32(t),r.putBytes(n.random.getBytes(28)),r},l.createRecord=function(e,t){return t.data?{type:t.type,version:{major:e.version.major,minor:e.version.minor},length:t.data.length(),fragment:t.data}:null},l.createAlert=function(e,t){var r=n.util.createBuffer();return r.putByte(t.level),r.putByte(t.description),l.createRecord(e,{type:l.ContentType.alert,data:r})},l.createClientHello=function(e){e.session.clientHelloVersion={major:e.version.major,minor:e.version.minor};for(var t=n.util.createBuffer(),r=0;r<e.cipherSuites.length;++r){var o=e.cipherSuites[r];t.putByte(o.id[0]),t.putByte(o.id[1])}var i=t.length(),a=n.util.createBuffer();a.putByte(l.CompressionMethod.none);var s=a.length(),u=n.util.createBuffer();if(e.virtualHost){var f=n.util.createBuffer();f.putByte(0),f.putByte(0);var p=n.util.createBuffer();p.putByte(0),c(p,2,n.util.createBuffer(e.virtualHost));var d=n.util.createBuffer();c(d,2,p),c(f,2,d),u.putBuffer(f)}var h=u.length();h>0&&(h+=2);var y=e.session.id,m=y.length+1+2+4+28+2+i+1+s+h,g=n.util.createBuffer();return g.putByte(l.HandshakeType.client_hello),g.putInt24(m),g.putByte(e.version.major),g.putByte(e.version.minor),g.putBytes(e.session.sp.client_random),c(g,1,n.util.createBuffer(y)),c(g,2,t),c(g,1,a),h>0&&c(g,2,u),g},l.createServerHello=function(e){var t=e.session.id,r=t.length+1+2+4+28+2+1,o=n.util.createBuffer();return o.putByte(l.HandshakeType.server_hello),o.putInt24(r),o.putByte(e.version.major),o.putByte(e.version.minor),o.putBytes(e.session.sp.server_random),c(o,1,n.util.createBuffer(t)),o.putByte(e.session.cipherSuite.id[0]),o.putByte(e.session.cipherSuite.id[1]),o.putByte(e.session.compressionMethod),o},l.createCertificate=function(e){var t=e.entity===l.ConnectionEnd.client,r=null;if(e.getCertificate){var o;o=t?e.session.certificateRequest:e.session.extensions.server_name.serverNameList,r=e.getCertificate(e,o)}var i=n.util.createBuffer();if(null!==r)try{n.util.isArray(r)||(r=[r]);for(var a=null,s=0;s<r.length;++s){var u=n.pem.decode(r[s])[0];if("CERTIFICATE"!==u.type&&"X509 CERTIFICATE"!==u.type&&"TRUSTED CERTIFICATE"!==u.type){var f=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw f.headerType=u.type,f}if(u.procType&&"ENCRYPTED"===u.procType.type)throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var p=n.util.createBuffer(u.body);null===a&&(a=n.asn1.fromDer(p.bytes(),!1));var d=n.util.createBuffer();c(d,3,p),i.putBuffer(d)}r=n.pki.certificateFromAsn1(a),t?e.session.clientCertificate=r:e.session.serverCertificate=r}catch(t){return e.error(e,{message:"Could not send certificate list.",cause:t,send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.bad_certificate}})}var h=3+i.length(),y=n.util.createBuffer();return y.putByte(l.HandshakeType.certificate),y.putInt24(h),c(y,3,i),y},l.createClientKeyExchange=function(e){var t=n.util.createBuffer();t.putByte(e.session.clientHelloVersion.major),t.putByte(e.session.clientHelloVersion.minor),t.putBytes(n.random.getBytes(46));var r=e.session.sp;r.pre_master_secret=t.getBytes(),t=e.session.serverCertificate.publicKey.encrypt(r.pre_master_secret);var o=t.length+2,i=n.util.createBuffer();return i.putByte(l.HandshakeType.client_key_exchange),i.putInt24(o),i.putInt16(t.length),i.putBytes(t),i},l.createServerKeyExchange=function(e){var t=n.util.createBuffer();return t},l.getClientSignature=function(e,t){var r=n.util.createBuffer();r.putBuffer(e.session.md5.digest()),r.putBuffer(e.session.sha1.digest()),r=r.getBytes(),e.getSignature=e.getSignature||function(e,t,r){var o=null;if(e.getPrivateKey)try{o=e.getPrivateKey(e,e.session.clientCertificate),o=n.pki.privateKeyFromPem(o)}catch(t){e.error(e,{message:"Could not get private key.",cause:t,send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.internal_error}})}null===o?e.error(e,{message:"No private key set.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.internal_error}}):t=o.sign(t,null),r(e,t)},e.getSignature(e,r,t)},l.createCertificateVerify=function(e,t){var r=t.length+2,o=n.util.createBuffer();return o.putByte(l.HandshakeType.certificate_verify),o.putInt24(r),o.putInt16(t.length),o.putBytes(t),o},l.createCertificateRequest=function(e){var t=n.util.createBuffer();t.putByte(1);var r=n.util.createBuffer();for(var o in e.caStore.certs){var i=e.caStore.certs[o],a=n.pki.distinguishedNameToAsn1(i.subject),s=n.asn1.toDer(a);r.putInt16(s.length()),r.putBuffer(s)}var u=1+t.length()+2+r.length(),f=n.util.createBuffer();return f.putByte(l.HandshakeType.certificate_request),f.putInt24(u),c(f,1,t),c(f,2,r),f},l.createServerHelloDone=function(e){var t=n.util.createBuffer();return t.putByte(l.HandshakeType.server_hello_done),t.putInt24(0),t},l.createChangeCipherSpec=function(){var e=n.util.createBuffer();return e.putByte(1),e},l.createFinished=function(e){var t=n.util.createBuffer();t.putBuffer(e.session.md5.digest()),t.putBuffer(e.session.sha1.digest());var r=e.entity===l.ConnectionEnd.client,i=e.session.sp,a=o,s=r?"client finished":"server finished";t=a(i.master_secret,s,t.getBytes(),12);var u=n.util.createBuffer();return u.putByte(l.HandshakeType.finished),u.putInt24(t.length()),u.putBuffer(t),u},l.createHeartbeat=function(e,t,r){void 0===r&&(r=t.length);var o=n.util.createBuffer();o.putByte(e),o.putInt16(r),o.putBytes(t);var i=o.length(),a=Math.max(16,i-r-3);return o.putBytes(n.random.getBytes(a)),o},l.queue=function(e,t){if(t&&(0!==t.fragment.length()||t.type!==l.ContentType.handshake&&t.type!==l.ContentType.alert&&t.type!==l.ContentType.change_cipher_spec)){if(t.type===l.ContentType.handshake){var r=t.fragment.bytes();e.session.md5.update(r),e.session.sha1.update(r),r=null}var o;if(t.fragment.length()<=l.MaxFragment)o=[t];else{o=[];for(var i=t.fragment.bytes();i.length>l.MaxFragment;)o.push(l.createRecord(e,{type:t.type,data:n.util.createBuffer(i.slice(0,l.MaxFragment))})),i=i.slice(l.MaxFragment);i.length>0&&o.push(l.createRecord(e,{type:t.type,data:n.util.createBuffer(i)}))}for(var a=0;a<o.length&&!e.fail;++a){var s=o[a];e.state.current.write.update(e,s)&&e.records.push(s)}}},l.flush=function(e){for(var t=0;t<e.records.length;++t){var r=e.records[t];e.tlsData.putByte(r.type),e.tlsData.putByte(r.version.major),e.tlsData.putByte(r.version.minor),e.tlsData.putInt16(r.fragment.length()),e.tlsData.putBuffer(e.records[t].fragment)}return e.records=[],e.tlsDataReady(e)};var K=function(e){switch(e){case!0:return!0;case n.pki.certificateError.bad_certificate:return l.Alert.Description.bad_certificate;case n.pki.certificateError.unsupported_certificate:return l.Alert.Description.unsupported_certificate;case n.pki.certificateError.certificate_revoked:return l.Alert.Description.certificate_revoked;case n.pki.certificateError.certificate_expired:return l.Alert.Description.certificate_expired;case n.pki.certificateError.certificate_unknown:return l.Alert.Description.certificate_unknown;case n.pki.certificateError.unknown_ca:return l.Alert.Description.unknown_ca;default:return l.Alert.Description.bad_certificate}},G=function(e){switch(e){case!0:return!0;case l.Alert.Description.bad_certificate:return n.pki.certificateError.bad_certificate;case l.Alert.Description.unsupported_certificate:return n.pki.certificateError.unsupported_certificate;case l.Alert.Description.certificate_revoked:return n.pki.certificateError.certificate_revoked;case l.Alert.Description.certificate_expired:return n.pki.certificateError.certificate_expired;case l.Alert.Description.certificate_unknown:return n.pki.certificateError.certificate_unknown;case l.Alert.Description.unknown_ca:return n.pki.certificateError.unknown_ca;default:return n.pki.certificateError.bad_certificate}};l.verifyCertificateChain=function(e,t){try{n.pki.verifyCertificateChain(e.caStore,t,function(t,r,o){var i=(K(t),e.verify(e,t,r,o));if(!0!==i){if("object"==typeof i&&!n.util.isArray(i)){var a=new Error("The application rejected the certificate.");throw a.send=!0,a.alert={level:l.Alert.Level.fatal,description:l.Alert.Description.bad_certificate},i.message&&(a.message=i.message),i.alert&&(a.alert.description=i.alert),a}i!==t&&(i=G(i))}return i})}catch(t){var r=t;("object"!=typeof r||n.util.isArray(r))&&(r={send:!0,alert:{level:l.Alert.Level.fatal,description:K(t)}}),"send"in r||(r.send=!0),"alert"in r||(r.alert={level:l.Alert.Level.fatal,description:K(r.error)}),e.error(e,r)}return!e.fail},l.createSessionCache=function(e,t){var r=null;if(e&&e.getSession&&e.setSession&&e.order)r=e;else{r={},r.cache=e||{},r.capacity=Math.max(t||100,1),r.order=[];for(var o in e)r.order.length<=t?r.order.push(o):delete e[o];r.getSession=function(e){var t=null,o=null;if(e?o=n.util.bytesToHex(e):r.order.length>0&&(o=r.order[0]),null!==o&&o in r.cache){t=r.cache[o],delete r.cache[o];for(var i in r.order)if(r.order[i]===o){r.order.splice(i,1);break}}return t},r.setSession=function(e,t){if(r.order.length===r.capacity){var o=r.order.shift();delete r.cache[o]}var o=n.util.bytesToHex(e);r.order.push(o),r.cache[o]=t}}return r},l.createConnection=function(e){var t=null;t=e.caStore?n.util.isArray(e.caStore)?n.pki.createCaStore(e.caStore):e.caStore:n.pki.createCaStore();var r=e.cipherSuites||null;if(null===r){r=[];for(var o in l.CipherSuites)r.push(l.CipherSuites[o])}var i=e.server?l.ConnectionEnd.server:l.ConnectionEnd.client,a=e.sessionCache?l.createSessionCache(e.sessionCache):null,s={version:{major:l.Version.major,minor:l.Version.minor},entity:i,sessionId:e.sessionId,caStore:t,sessionCache:a,cipherSuites:r,connected:e.connected,virtualHost:e.virtualHost||null,verifyClient:e.verifyClient||!1,verify:e.verify||function(e,t,r,n){return t},getCertificate:e.getCertificate||null,getPrivateKey:e.getPrivateKey||null,getSignature:e.getSignature||null,input:n.util.createBuffer(),tlsData:n.util.createBuffer(),data:n.util.createBuffer(),tlsDataReady:e.tlsDataReady,dataReady:e.dataReady,heartbeatReceived:e.heartbeatReceived,closed:e.closed,error:function(t,r){r.origin=r.origin||(t.entity===l.ConnectionEnd.client?"client":"server"),r.send&&(l.queue(t,l.createAlert(t,r.alert)),l.flush(t));var n=!1!==r.fatal;n&&(t.fail=!0),e.error(t,r),n&&t.close(!1)},deflate:e.deflate||null,inflate:e.inflate||null};s.reset=function(e){s.version={major:l.Version.major,minor:l.Version.minor},s.record=null,s.session=null,s.peerCertificate=null,s.state={pending:null,current:null},s.expect=(s.entity,l.ConnectionEnd.client,0),s.fragmented=null,s.records=[],s.open=!1,s.handshakes=0,s.handshaking=!1,s.isConnected=!1,s.fail=!(e||void 0===e),s.input.clear(),s.tlsData.clear(),s.data.clear(),s.state.current=l.createConnectionState(s)},s.reset();var u=function(e,t){var r=t.type-l.ContentType.change_cipher_spec,n=P[e.entity][e.expect];r in n?n[r](e,t):l.handleUnexpected(e,t)},c=function(e){var t=0,r=e.input,o=r.length();if(o<5)t=5-o;else{e.record={type:r.getByte(),version:{major:r.getByte(),minor:r.getByte()},length:r.getInt16(),fragment:n.util.createBuffer(),ready:!1};var i=e.record.version.major===e.version.major;i&&e.session&&e.session.version&&(i=e.record.version.minor===e.version.minor),i||e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.protocol_version}})}return t},f=function(e){var t=0,r=e.input,n=r.length();if(n<e.record.length)t=e.record.length-n;else{e.record.fragment.putBytes(r.getBytes(e.record.length)),r.compact();e.state.current.read.update(e,e.record)&&(null!==e.fragmented&&(e.fragmented.type===e.record.type?(e.fragmented.fragment.putBuffer(e.record.fragment),e.record=e.fragmented):e.error(e,{message:"Invalid fragmented record.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.unexpected_message}})),e.record.ready=!0)}return t};return s.handshake=function(e){if(s.entity!==l.ConnectionEnd.client)s.error(s,{message:"Cannot initiate handshake as a server.",fatal:!1});else if(s.handshaking)s.error(s,{message:"Handshake already in progress.",fatal:!1});else{s.fail&&!s.open&&0===s.handshakes&&(s.fail=!1),s.handshaking=!0,e=e||"";var t=null;e.length>0&&(s.sessionCache&&(t=s.sessionCache.getSession(e)),null===t&&(e="")),0===e.length&&s.sessionCache&&null!==(t=s.sessionCache.getSession())&&(e=t.id),s.session={id:e,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:n.md.md5.create(),sha1:n.md.sha1.create()},t&&(s.version=t.version,s.session.sp=t.sp),s.session.sp.client_random=l.createRandom().getBytes(),s.open=!0,l.queue(s,l.createRecord(s,{type:l.ContentType.handshake,data:l.createClientHello(s)})),l.flush(s)}},s.process=function(e){var t=0;return e&&s.input.putBytes(e),s.fail||(null!==s.record&&s.record.ready&&s.record.fragment.isEmpty()&&(s.record=null),null===s.record&&(t=c(s)),s.fail||null===s.record||s.record.ready||(t=f(s)),!s.fail&&null!==s.record&&s.record.ready&&u(s,s.record)),t},s.prepare=function(e){return l.queue(s,l.createRecord(s,{type:l.ContentType.application_data,data:n.util.createBuffer(e)})),l.flush(s)},s.prepareHeartbeatRequest=function(e,t){return e instanceof n.util.ByteBuffer&&(e=e.bytes()),void 0===t&&(t=e.length),s.expectedHeartbeatPayload=e,l.queue(s,l.createRecord(s,{type:l.ContentType.heartbeat,data:l.createHeartbeat(l.HeartbeatMessageType.heartbeat_request,e,t)})),l.flush(s)},s.close=function(e){if(!s.fail&&s.sessionCache&&s.session){var t={id:s.session.id,version:s.session.version,sp:s.session.sp};t.sp.keys=null,s.sessionCache.setSession(t.id,t)}s.open&&(s.open=!1,s.input.clear(),(s.isConnected||s.handshaking)&&(s.isConnected=s.handshaking=!1,l.queue(s,l.createAlert(s,{level:l.Alert.Level.warning,description:l.Alert.Description.close_notify})),l.flush(s)),s.closed(s)),s.reset(e)},s},e.exports=n.tls=n.tls||{};for(var z in l)"function"!=typeof l[z]&&(n.tls[z]=l[z]);n.tls.prf_tls1=o,n.tls.hmac_sha1=i,n.tls.createSessionCache=l.createSessionCache,n.tls.createConnection=l.createConnection},function(e,t,r){var n=r(1);r(7),r(11),r(47),r(12),r(30),r(54),r(33),r(20),r(2),r(32);var o=n.asn1,i=e.exports=n.pki=n.pki||{};i.pemToDer=function(e){var t=n.pem.decode(e)[0];if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert PEM to DER; PEM is encrypted.");return n.util.createBuffer(t.body)},i.privateKeyFromPem=function(e){var t=n.pem.decode(e)[0];if("PRIVATE KEY"!==t.type&&"RSA PRIVATE KEY"!==t.type){var r=new Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');throw r.headerType=t.type,r}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert private key from PEM; PEM is encrypted.");var a=o.fromDer(t.body);return i.privateKeyFromAsn1(a)},i.privateKeyToPem=function(e,t){var r={type:"RSA PRIVATE KEY",body:o.toDer(i.privateKeyToAsn1(e)).getBytes()};return n.pem.encode(r,{maxline:t})},i.privateKeyInfoToPem=function(e,t){var r={type:"PRIVATE KEY",body:o.toDer(e).getBytes()};return n.pem.encode(r,{maxline:t})}},function(e,t,r){function n(e,t){return e.start().update(t).digest().getBytes()}function o(e){var t;if(e){if(!(t=l.oids[c.derToOid(e)])){var r=new Error("Unsupported PRF OID.");throw r.oid=e,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}}else t="hmacWithSHA1";return i(t)}function i(e){var t=s.md;switch(e){case"hmacWithSHA224":t=s.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":e=e.substr(8).toLowerCase();break;default:var r=new Error("Unsupported PRF algorithm.");throw r.algorithm=e,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}if(!(t&&e in t))throw new Error("Unknown hash algorithm: "+e);return t[e].create()}function a(e,t,r,n){var o=c.create(c.Class.UNIVERSAL,c.Type.SEQUENCE,!0,[c.create(c.Class.UNIVERSAL,c.Type.OCTETSTRING,!1,e),c.create(c.Class.UNIVERSAL,c.Type.INTEGER,!1,t.getBytes())]);return"hmacWithSHA1"!==n&&o.value.push(c.create(c.Class.UNIVERSAL,c.Type.INTEGER,!1,s.util.hexToBytes(r.toString(16))),c.create(c.Class.UNIVERSAL,c.Type.SEQUENCE,!0,[c.create(c.Class.UNIVERSAL,c.Type.OID,!1,c.oidToDer(l.oids[n]).getBytes()),c.create(c.Class.UNIVERSAL,c.Type.NULL,!1,"")])),o}var s=r(1);if(r(10),r(7),r(19),r(8),r(11),r(30),r(12),r(6),r(51),r(20),r(2),void 0===u)var u=s.jsbn.BigInteger;var c=s.asn1,l=s.pki=s.pki||{};e.exports=l.pbe=s.pbe=s.pbe||{};var f=l.oids,p={name:"EncryptedPrivateKeyInfo",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:c.Class.UNIVERSAL,type:c.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:c.Class.UNIVERSAL,type:c.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},d={name:"PBES2Algorithms",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:c.Class.UNIVERSAL,type:c.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:c.Class.UNIVERSAL,type:c.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:c.Class.UNIVERSAL,type:c.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:c.Class.UNIVERSAL,type:c.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:c.Class.UNIVERSAL,type:c.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:c.Class.UNIVERSAL,type:c.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:c.Class.UNIVERSAL,type:c.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},h={name:"pkcs-12PbeParams",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:c.Class.UNIVERSAL,type:c.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:c.Class.UNIVERSAL,type:c.Type.INTEGER,constructed:!1,capture:"iterations"}]};l.encryptPrivateKeyInfo=function(e,t,r){r=r||{},r.saltSize=r.saltSize||8,r.count=r.count||2048,r.algorithm=r.algorithm||"aes128",r.prfAlgorithm=r.prfAlgorithm||"sha1";var n,o,u,p=s.random.getBytesSync(r.saltSize),d=r.count,h=c.integerToDer(d);if(0===r.algorithm.indexOf("aes")||"des"===r.algorithm){var y,m,g;switch(r.algorithm){case"aes128":n=16,y=16,m=f["aes128-CBC"],g=s.aes.createEncryptionCipher;break;case"aes192":n=24,y=16,m=f["aes192-CBC"],g=s.aes.createEncryptionCipher;break;case"aes256":n=32,y=16,m=f["aes256-CBC"],g=s.aes.createEncryptionCipher;break;case"des":n=8,y=8,m=f.desCBC,g=s.des.createEncryptionCipher;break;default:var v=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw v.algorithm=r.algorithm,v}var b="hmacWith"+r.prfAlgorithm.toUpperCase(),E=i(b),C=s.pkcs5.pbkdf2(t,p,d,n,E),_=s.random.getBytesSync(y),w=g(C);w.start(_),w.update(c.toDer(e)),w.finish(),u=w.output.getBytes();var T=a(p,h,n,b);o=c.create(c.Class.UNIVERSAL,c.Type.SEQUENCE,!0,[c.create(c.Class.UNIVERSAL,c.Type.OID,!1,c.oidToDer(f.pkcs5PBES2).getBytes()),c.create(c.Class.UNIVERSAL,c.Type.SEQUENCE,!0,[c.create(c.Class.UNIVERSAL,c.Type.SEQUENCE,!0,[c.create(c.Class.UNIVERSAL,c.Type.OID,!1,c.oidToDer(f.pkcs5PBKDF2).getBytes()),T]),c.create(c.Class.UNIVERSAL,c.Type.SEQUENCE,!0,[c.create(c.Class.UNIVERSAL,c.Type.OID,!1,c.oidToDer(m).getBytes()),c.create(c.Class.UNIVERSAL,c.Type.OCTETSTRING,!1,_)])])])}else{if("3des"!==r.algorithm){var v=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw v.algorithm=r.algorithm,v}n=24;var S=new s.util.ByteBuffer(p),C=l.pbe.generatePkcs12Key(t,S,1,d,n),_=l.pbe.generatePkcs12Key(t,S,2,d,n),w=s.des.createEncryptionCipher(C);w.start(_),w.update(c.toDer(e)),w.finish(),u=w.output.getBytes(),o=c.create(c.Class.UNIVERSAL,c.Type.SEQUENCE,!0,[c.create(c.Class.UNIVERSAL,c.Type.OID,!1,c.oidToDer(f["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),c.create(c.Class.UNIVERSAL,c.Type.SEQUENCE,!0,[c.create(c.Class.UNIVERSAL,c.Type.OCTETSTRING,!1,p),c.create(c.Class.UNIVERSAL,c.Type.INTEGER,!1,h.getBytes())])])}return c.create(c.Class.UNIVERSAL,c.Type.SEQUENCE,!0,[o,c.create(c.Class.UNIVERSAL,c.Type.OCTETSTRING,!1,u)])},l.decryptPrivateKeyInfo=function(e,t){var r=null,n={},o=[];if(!c.validate(e,p,n,o)){var i=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw i.errors=o,i}var a=c.derToOid(n.encryptionOid),u=l.pbe.getCipher(a,n.encryptionParams,t),f=s.util.createBuffer(n.encryptedData);return u.update(f),u.finish()&&(r=c.fromDer(u.output)),r},l.encryptedPrivateKeyToPem=function(e,t){var r={type:"ENCRYPTED PRIVATE KEY",body:c.toDer(e).getBytes()};return s.pem.encode(r,{maxline:t})},l.encryptedPrivateKeyFromPem=function(e){var t=s.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==t.type){var r=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw r.headerType=t.type,r}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return c.fromDer(t.body)},l.encryptRsaPrivateKey=function(e,t,r){if(r=r||{},!r.legacy){var n=l.wrapRsaPrivateKey(l.privateKeyToAsn1(e));return n=l.encryptPrivateKeyInfo(n,t,r),l.encryptedPrivateKeyToPem(n)}var o,i,a,u;switch(r.algorithm){case"aes128":o="AES-128-CBC",a=16,i=s.random.getBytesSync(16),u=s.aes.createEncryptionCipher;break;case"aes192":o="AES-192-CBC",a=24,i=s.random.getBytesSync(16),u=s.aes.createEncryptionCipher;break;case"aes256":o="AES-256-CBC",a=32,i=s.random.getBytesSync(16),u=s.aes.createEncryptionCipher;break;case"3des":o="DES-EDE3-CBC",a=24,i=s.random.getBytesSync(8),u=s.des.createEncryptionCipher;break;case"des":o="DES-CBC",a=8,i=s.random.getBytesSync(8),u=s.des.createEncryptionCipher;break;default:var f=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+r.algorithm+'".');throw f.algorithm=r.algorithm,f}var p=s.pbe.opensslDeriveBytes(t,i.substr(0,8),a),d=u(p);d.start(i),d.update(c.toDer(l.privateKeyToAsn1(e))),d.finish();var h={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:o,parameters:s.util.bytesToHex(i).toUpperCase()},body:d.output.getBytes()};return s.pem.encode(h)},l.decryptRsaPrivateKey=function(e,t){var r=null,n=s.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==n.type&&"PRIVATE KEY"!==n.type&&"RSA PRIVATE KEY"!==n.type){var o=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".');throw o.headerType=o,o}if(n.procType&&"ENCRYPTED"===n.procType.type){var i,a;switch(n.dekInfo.algorithm){case"DES-CBC":i=8,a=s.des.createDecryptionCipher;break;case"DES-EDE3-CBC":i=24,a=s.des.createDecryptionCipher;break;case"AES-128-CBC":i=16,a=s.aes.createDecryptionCipher;break;case"AES-192-CBC":i=24,a=s.aes.createDecryptionCipher;break;case"AES-256-CBC":i=32,a=s.aes.createDecryptionCipher;break;case"RC2-40-CBC":i=5,a=function(e){return s.rc2.createDecryptionCipher(e,40)};break;case"RC2-64-CBC":i=8,a=function(e){return s.rc2.createDecryptionCipher(e,64)};break;case"RC2-128-CBC":i=16,a=function(e){return s.rc2.createDecryptionCipher(e,128)};break;default:var o=new Error('Could not decrypt private key; unsupported encryption algorithm "'+n.dekInfo.algorithm+'".');throw o.algorithm=n.dekInfo.algorithm,o}var u=s.util.hexToBytes(n.dekInfo.parameters),f=s.pbe.opensslDeriveBytes(t,u.substr(0,8),i),p=a(f);if(p.start(u),p.update(s.util.createBuffer(n.body)),!p.finish())return r;r=p.output.getBytes()}else r=n.body;return r="ENCRYPTED PRIVATE KEY"===n.type?l.decryptPrivateKeyInfo(c.fromDer(r),t):c.fromDer(r),null!==r&&(r=l.privateKeyFromAsn1(r)),r},l.pbe.generatePkcs12Key=function(e,t,r,n,o,i){var a,u;if(void 0===i||null===i){if(!("sha1"in s.md))throw new Error('"sha1" hash algorithm unavailable.');i=s.md.sha1.create()}var c=i.digestLength,l=i.blockLength,f=new s.util.ByteBuffer,p=new s.util.ByteBuffer;if(null!==e&&void 0!==e){for(u=0;u<e.length;u++)p.putInt16(e.charCodeAt(u));p.putInt16(0)}var d=p.length(),h=t.length(),y=new s.util.ByteBuffer;y.fillWithByte(r,l);var m=l*Math.ceil(h/l),g=new s.util.ByteBuffer;for(u=0;u<m;u++)g.putByte(t.at(u%h));var v=l*Math.ceil(d/l),b=new s.util.ByteBuffer;for(u=0;u<v;u++)b.putByte(p.at(u%d));var E=g;E.putBuffer(b);for(var C=Math.ceil(o/c),_=1;_<=C;_++){var w=new s.util.ByteBuffer;w.putBytes(y.bytes()),w.putBytes(E.bytes());for(var T=0;T<n;T++)i.start(),i.update(w.getBytes()),w=i.digest();var S=new s.util.ByteBuffer;for(u=0;u<l;u++)S.putByte(w.at(u%c));var I=Math.ceil(h/l)+Math.ceil(d/l),A=new s.util.ByteBuffer;for(a=0;a<I;a++){var k=new s.util.ByteBuffer(E.getBytes(l)),B=511;for(u=S.length()-1;u>=0;u--)B>>=8,B+=S.at(u)+k.at(u),k.setAt(u,255&B);A.putBuffer(k)}E=A,f.putBuffer(w)}return f.truncate(f.length()-o),f},l.pbe.getCipher=function(e,t,r){switch(e){case l.oids.pkcs5PBES2:return l.pbe.getCipherForPBES2(e,t,r);case l.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case l.oids["pbewithSHAAnd40BitRC2-CBC"]:return l.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},l.pbe.getCipherForPBES2=function(e,t,r){var n={},i=[];if(!c.validate(t,d,n,i)){var a=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw a.errors=i,a}if((e=c.derToOid(n.kdfOid))!==l.oids.pkcs5PBKDF2){var a=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw a.oid=e,a.supportedOids=["pkcs5PBKDF2"],a}if((e=c.derToOid(n.encOid))!==l.oids["aes128-CBC"]&&e!==l.oids["aes192-CBC"]&&e!==l.oids["aes256-CBC"]&&e!==l.oids["des-EDE3-CBC"]&&e!==l.oids.desCBC){var a=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw a.oid=e,a.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],a}var u=n.kdfSalt,f=s.util.createBuffer(n.kdfIterationCount);f=f.getInt(f.length()<<3);var p,h;switch(l.oids[e]){case"aes128-CBC":p=16,h=s.aes.createDecryptionCipher;break;case"aes192-CBC":p=24,h=s.aes.createDecryptionCipher;break;case"aes256-CBC":p=32,h=s.aes.createDecryptionCipher;break;case"des-EDE3-CBC":p=24,h=s.des.createDecryptionCipher;break;case"desCBC":p=8,h=s.des.createDecryptionCipher}var y=o(n.prfOid),m=s.pkcs5.pbkdf2(r,u,f,p,y),g=n.encIv,v=h(m);return v.start(g),v},l.pbe.getCipherForPKCS12PBE=function(e,t,r){var n={},i=[];if(!c.validate(t,h,n,i)){var a=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw a.errors=i,a}var u=s.util.createBuffer(n.salt),f=s.util.createBuffer(n.iterations);f=f.getInt(f.length()<<3);var p,d,y;switch(e){case l.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:p=24,d=8,y=s.des.startDecrypting;break;case l.oids["pbewithSHAAnd40BitRC2-CBC"]:p=5,d=8,y=function(e,t){var r=s.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:var a=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw a.oid=e,a}var m=o(n.prfOid),g=l.pbe.generatePkcs12Key(r,u,1,f,p,m);return m.start(),y(g,l.pbe.generatePkcs12Key(r,u,2,f,d,m))},l.pbe.opensslDeriveBytes=function(e,t,r,o){if(void 0===o||null===o){if(!("md5"in s.md))throw new Error('"md5" hash algorithm unavailable.');o=s.md.md5.create()}null===t&&(t="");for(var i=[n(o,e+t)],a=16,u=1;a<r;++u,a+=16)i.push(n(o,i[u-1]+e+t));return i.join("").substr(0,r)}},function(e,t){},function(e,t,r){function n(){s=String.fromCharCode(128),s+=i.util.fillString(String.fromCharCode(0),64),c=[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],u=!0}function o(e,t,r){for(var n,o,i,a,s,u,l,f,p,d,h,y,m,g,v,b=r.length();b>=64;){for(l=0;l<16;++l)t[l]=r.getInt32();for(;l<64;++l)n=t[l-2],n=(n>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,o=t[l-15],o=(o>>>7|o<<25)^(o>>>18|o<<14)^o>>>3,t[l]=n+t[l-7]+o+t[l-16]|0;for(f=e.h0,p=e.h1,d=e.h2,h=e.h3,y=e.h4,m=e.h5,g=e.h6,v=e.h7,l=0;l<64;++l)a=(y>>>6|y<<26)^(y>>>11|y<<21)^(y>>>25|y<<7),s=g^y&(m^g),i=(f>>>2|f<<30)^(f>>>13|f<<19)^(f>>>22|f<<10),u=f&p|d&(f^p),n=v+a+s+c[l]+t[l],o=i+u,v=g,g=m,m=y,y=h+n>>>0,h=d,d=p,p=f,f=n+o>>>0;e.h0=e.h0+f|0,e.h1=e.h1+p|0,e.h2=e.h2+d|0,e.h3=e.h3+h|0,e.h4=e.h4+y|0,e.h5=e.h5+m|0,e.h6=e.h6+g|0,e.h7=e.h7+v|0,b-=64}}var i=r(1);r(8),r(2);var a=e.exports=i.sha256=i.sha256||{};i.md.sha256=i.md.algorithms.sha256=a,a.create=function(){u||n();var e=null,t=i.util.createBuffer(),r=new Array(64),a={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8};return a.start=function(){a.messageLength=0,a.fullMessageLength=a.messageLength64=[];for(var r=a.messageLengthSize/4,n=0;n<r;++n)a.fullMessageLength.push(0);return t=i.util.createBuffer(),e={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},a},a.start(),a.update=function(n,s){"utf8"===s&&(n=i.util.encodeUtf8(n));var u=n.length;a.messageLength+=u,u=[u/4294967296>>>0,u>>>0];for(var c=a.fullMessageLength.length-1;c>=0;--c)a.fullMessageLength[c]+=u[1],u[1]=u[0]+(a.fullMessageLength[c]/4294967296>>>0),a.fullMessageLength[c]=a.fullMessageLength[c]>>>0,u[0]=u[1]/4294967296>>>0;return t.putBytes(n),o(e,r,t),(t.read>2048||0===t.length())&&t.compact(),a},a.digest=function(){var n=i.util.createBuffer();n.putBytes(t.bytes());var u=a.fullMessageLength[a.fullMessageLength.length-1]+a.messageLengthSize,c=u&a.blockLength-1;n.putBytes(s.substr(0,a.blockLength-c));for(var l,f,p=8*a.fullMessageLength[0],d=0;d<a.fullMessageLength.length-1;++d)l=8*a.fullMessageLength[d+1],f=l/4294967296>>>0,p+=f,n.putInt32(p>>>0),p=l>>>0;n.putInt32(p);var h={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4,h5:e.h5,h6:e.h6,h7:e.h7};o(h,r,n);var y=i.util.createBuffer();return y.putInt32(h.h0),y.putInt32(h.h1),y.putInt32(h.h2),y.putInt32(h.h3),y.putInt32(h.h4),y.putInt32(h.h5),y.putInt32(h.h6),y.putInt32(h.h7),y},a};var s=null,u=!1,c=null},function(e,t,r){var n=r(1);r(2);var o=null;!n.util.isNodejs||n.options.usePureJavaScript||process.versions["node-webkit"]||(o=r(48)),(e.exports=n.prng=n.prng||{}).create=function(e){function t(e){if(s.pools[0].messageLength>=32)return i(),e();var t=32-s.pools[0].messageLength<<5;s.seedFile(t,function(t,r){if(t)return e(t);s.collect(r),i(),e()})}function r(){if(s.pools[0].messageLength>=32)return i();var e=32-s.pools[0].messageLength<<5;s.collect(s.seedFileSync(e)),i()}function i(){var e=s.plugin.md.create();e.update(s.pools[0].digest().getBytes()),s.pools[0].start();for(var t=1,r=1;r<32;++r)(t=31===t?2147483648:t<<2)%s.reseeds==0&&(e.update(s.pools[r].digest().getBytes()),s.pools[r].start());var n=e.digest().getBytes();e.start(),e.update(n);var o=e.digest().getBytes();s.key=s.plugin.formatKey(n),s.seed=s.plugin.formatSeed(o),s.reseeds=4294967295===s.reseeds?0:s.reseeds+1,s.generated=0}function a(e){var t=null;if("undefined"!=typeof window){var r=window.crypto||window.msCrypto;r&&r.getRandomValues&&(t=function(e){return r.getRandomValues(e)})}var o=n.util.createBuffer();if(t)for(;o.length()<e;){var i=Math.max(1,Math.min(e-o.length(),65536)/4),a=new Uint32Array(Math.floor(i));try{t(a);for(var s=0;s<a.length;++s)o.putInt32(a[s])}catch(e){if(!("undefined"!=typeof QuotaExceededError&&e instanceof QuotaExceededError))throw e}}if(o.length()<e)for(var u,c,l,f=Math.floor(65536*Math.random());o.length()<e;){c=16807*(65535&f),u=16807*(f>>16),c+=(32767&u)<<16,c+=u>>15,c=(2147483647&c)+(c>>31),f=4294967295&c;for(var s=0;s<3;++s)l=f>>>(s<<3),l^=Math.floor(256*Math.random()),o.putByte(String.fromCharCode(255&l))}return o.getBytes(e)}for(var s={plugin:e,key:null,seed:null,time:null,reseeds:0,generated:0},u=e.md,c=new Array(32),l=0;l<32;++l)c[l]=u.create();return s.pools=c,s.pool=0,s.generate=function(e,r){function o(f){if(f)return r(f);if(l.length()>=e)return r(null,l.getBytes(e));if(s.generated>1048575&&(s.key=null),null===s.key)return n.util.nextTick(function(){t(o)});var p=i(s.key,s.seed);s.generated+=p.length,l.putBytes(p),s.key=u(i(s.key,a(s.seed))),s.seed=c(i(s.key,s.seed)),n.util.setImmediate(o)}if(!r)return s.generateSync(e);var i=s.plugin.cipher,a=s.plugin.increment,u=s.plugin.formatKey,c=s.plugin.formatSeed,l=n.util.createBuffer();s.key=null,o()},s.generateSync=function(e){var t=s.plugin.cipher,o=s.plugin.increment,i=s.plugin.formatKey,a=s.plugin.formatSeed;s.key=null;for(var u=n.util.createBuffer();u.length()<e;){s.generated>1048575&&(s.key=null),null===s.key&&r();var c=t(s.key,s.seed);s.generated+=c.length,u.putBytes(c),s.key=i(t(s.key,o(s.seed))),s.seed=a(t(s.key,s.seed))}return u.getBytes(e)},o?(s.seedFile=function(e,t){o.randomBytes(e,function(e,r){if(e)return t(e);t(null,r.toString())})},s.seedFileSync=function(e){return o.randomBytes(e).toString()}):(s.seedFile=function(e,t){try{t(null,a(e))}catch(e){t(e)}},s.seedFileSync=a),s.collect=function(e){for(var t=e.length,r=0;r<t;++r)s.pools[s.pool].update(e.substr(r,1)),s.pool=31===s.pool?0:s.pool+1},s.collectInt=function(e,t){for(var r="",n=0;n<t;n+=8)r+=String.fromCharCode(e>>n&255);s.collect(r)},s.registerWorker=function(e){if(e===self)s.seedFile=function(e,t){function r(e){var n=e.data;n.forge&&n.forge.prng&&(self.removeEventListener("message",r),t(n.forge.prng.err,n.forge.prng.bytes))}self.addEventListener("message",r),self.postMessage({forge:{prng:{needed:e}}})};else{var t=function(t){var r=t.data;r.forge&&r.forge.prng&&s.seedFile(r.forge.prng.needed,function(t,r){e.postMessage({forge:{prng:{err:t,bytes:r}}})})};e.addEventListener("message",t)}},s}},function(e,t,r){var n=r(1);r(2);var o=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],i=[1,2,3,5],a=function(e,t){return e<<t&65535|(65535&e)>>16-t},s=function(e,t){return(65535&e)>>t|e<<16-t&65535};e.exports=n.rc2=n.rc2||{},n.rc2.expandKey=function(e,t){"string"==typeof e&&(e=n.util.createBuffer(e)),t=t||128;var r,i=e,a=e.length(),s=t,u=Math.ceil(s/8),c=255>>(7&s);for(r=a;r<128;r++)i.putByte(o[i.at(r-1)+i.at(r-a)&255]);for(i.setAt(128-u,o[i.at(128-u)&c]),r=127-u;r>=0;r--)i.setAt(r,o[i.at(r+1)^i.at(r+u)]);return i};var u=function(e,t,r){var o,u,c,l,f=!1,p=null,d=null,h=null,y=[];for(e=n.rc2.expandKey(e,t),c=0;c<64;c++)y.push(e.getInt16Le());r?(o=function(e){for(c=0;c<4;c++)e[c]+=y[l]+(e[(c+3)%4]&e[(c+2)%4])+(~e[(c+3)%4]&e[(c+1)%4]),e[c]=a(e[c],i[c]),l++},u=function(e){for(c=0;c<4;c++)e[c]+=y[63&e[(c+3)%4]]}):(o=function(e){for(c=3;c>=0;c--)e[c]=s(e[c],i[c]),e[c]-=y[l]+(e[(c+3)%4]&e[(c+2)%4])+(~e[(c+3)%4]&e[(c+1)%4]),l--},u=function(e){for(c=3;c>=0;c--)e[c]-=y[63&e[(c+3)%4]]});var m=function(e){var t=[];for(c=0;c<4;c++){var n=p.getInt16Le();null!==h&&(r?n^=h.getInt16Le():h.putInt16Le(n)),t.push(65535&n)}l=r?0:63;for(var o=0;o<e.length;o++)for(var i=0;i<e[o][0];i++)e[o][1](t);for(c=0;c<4;c++)null!==h&&(r?h.putInt16Le(t[c]):t[c]^=h.getInt16Le()),d.putInt16Le(t[c])},g=null;return g={start:function(e,t){e&&"string"==typeof e&&(e=n.util.createBuffer(e)),f=!1,p=n.util.createBuffer(),d=t||new n.util.createBuffer,h=e,g.output=d},update:function(e){for(f||p.putBuffer(e);p.length()>=8;)m([[5,o],[1,u],[6,o],[1,u],[5,o]])},finish:function(e){var t=!0;if(r)if(e)t=e(8,p,!r);else{var n=8===p.length()?8:8-p.length();p.fillWithByte(n,n)}if(t&&(f=!0,g.update()),!r&&(t=0===p.length()))if(e)t=e(8,d,!r);else{var o=d.length(),i=d.at(o-1);i>o?t=!1:d.truncate(i)}return t}}};n.rc2.startEncrypting=function(e,t,r){var o=n.rc2.createEncryptionCipher(e,128);return o.start(t,r),o},n.rc2.createEncryptionCipher=function(e,t){return u(e,t,!0)},n.rc2.startDecrypting=function(e,t,r){var o=n.rc2.createDecryptionCipher(e,128);return o.start(t,r),o},n.rc2.createDecryptionCipher=function(e,t){return u(e,t,!1)}},function(e,t,r){function n(e,t,r){r||(r=o.md.sha1.create());for(var n="",i=Math.ceil(t/r.digestLength),a=0;a<i;++a){var s=String.fromCharCode(a>>24&255,a>>16&255,a>>8&255,255&a);r.start(),r.update(e+s),n+=r.digest().getBytes()}return n.substring(0,t)}var o=r(1);r(2),r(6),r(15);var i=e.exports=o.pkcs1=o.pkcs1||{};i.encode_rsa_oaep=function(e,t,r){var i,a,s,u;"string"==typeof r?(i=r,a=arguments[3]||void 0,s=arguments[4]||void 0):r&&(i=r.label||void 0,a=r.seed||void 0,s=r.md||void 0,r.mgf1&&r.mgf1.md&&(u=r.mgf1.md)),s?s.start():s=o.md.sha1.create(),u||(u=s);var c=Math.ceil(e.n.bitLength()/8),l=c-2*s.digestLength-2;if(t.length>l){var f=new Error("RSAES-OAEP input message length is too long.");throw f.length=t.length,f.maxLength=l,f}i||(i=""),s.update(i,"raw");for(var p=s.digest(),d="",h=l-t.length,y=0;y<h;y++)d+="\0";var m=p.getBytes()+d+""+t;if(a){if(a.length!==s.digestLength){var f=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.");throw f.seedLength=a.length,f.digestLength=s.digestLength,f}}else a=o.random.getBytes(s.digestLength);var g=n(a,c-s.digestLength-1,u),v=o.util.xorBytes(m,g,m.length),b=n(v,s.digestLength,u);return"\0"+o.util.xorBytes(a,b,a.length)+v},i.decode_rsa_oaep=function(e,t,r){var i,a,s;"string"==typeof r?(i=r,a=arguments[3]||void 0):r&&(i=r.label||void 0,a=r.md||void 0,r.mgf1&&r.mgf1.md&&(s=r.mgf1.md));var u=Math.ceil(e.n.bitLength()/8);if(t.length!==u){var c=new Error("RSAES-OAEP encoded message length is invalid.");throw c.length=t.length,c.expectedLength=u,c}if(void 0===a?a=o.md.sha1.create():a.start(),s||(s=a),u<2*a.digestLength+2)throw new Error("RSAES-OAEP key is too short for the hash function.");i||(i=""),a.update(i,"raw");for(var l=a.digest().getBytes(),f=t.charAt(0),p=t.substring(1,a.digestLength+1),d=t.substring(1+a.digestLength),h=n(d,a.digestLength,s),y=o.util.xorBytes(p,h,p.length),m=n(y,u-a.digestLength-1,s),g=o.util.xorBytes(d,m,d.length),v=g.substring(0,a.digestLength),c="\0"!==f,b=0;b<a.digestLength;++b)c|=l.charAt(b)!==v.charAt(b);for(var E=1,C=a.digestLength,_=a.digestLength;_<g.length;_++){var w=g.charCodeAt(_),T=1&w^1;c|=w&(E?65534:0),E&=T,C+=E}if(c||1!==g.charCodeAt(C))throw new Error("Invalid RSAES-OAEP padding.");return g.substring(C+1)}},function(e,t,r){var n=r(1);r(2),r(31),r(6),function(){function t(e,t,n,o){return"workers"in n?i(e,t,n,o):r(e,t,n,o)}function r(e,t,r,n){var i=a(e,t),u=s(i.bitLength());"millerRabinTests"in r&&(u=r.millerRabinTests);var c=10;"maxBlockTime"in r&&(c=r.maxBlockTime),o(i,e,t,0,u,c,n)}function o(e,t,r,i,s,u,c){var f=+new Date;do{if(e.bitLength()>t&&(e=a(t,r)),e.isProbablePrime(s))return c(null,e);e.dAddOffset(l[i++%8],0)}while(u<0||+new Date-f<u);n.util.setImmediate(function(){o(e,t,r,i,s,u,c)})}function i(e,t,o,i){function s(){function r(r){if(!h){--s;var o=r.data;if(o.found){for(var l=0;l<n.length;++l)n[l].terminate();return h=!0,i(null,new c(o.prime,16))}u.bitLength()>e&&(u=a(e,t));var d=u.toString(16);r.target.postMessage({hex:d,workLoad:f}),u.dAddOffset(p,0)}}l=Math.max(1,l);for(var n=[],o=0;o<l;++o)n[o]=new Worker(d);for(var s=l,o=0;o<l;++o)n[o].addEventListener("message",r);var h=!1}if("undefined"==typeof Worker)return r(e,t,o,i);var u=a(e,t),l=o.workers,f=o.workLoad||100,p=30*f/8,d=o.workerScript||"forge/prime.worker.js";if(-1===l)return n.util.estimateCores(function(e,t){e&&(t=2),l=t-1,s()});s()}function a(e,t){var r=new c(e,t),n=e-1;return r.testBit(n)||r.bitwiseTo(c.ONE.shiftLeft(n),p,r),r.dAddOffset(31-r.mod(f).byteValue(),0),r}function s(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}if(n.prime)return void(e.exports=n.prime);var u=e.exports=n.prime=n.prime||{},c=n.jsbn.BigInteger,l=[6,4,2,4,2,4,6,2],f=new c(null);f.fromInt(30);var p=function(e,t){return e|t};u.generateProbablePrime=function(e,r,o){"function"==typeof r&&(o=r,r={}),r=r||{};var i=r.algorithm||"PRIMEINC";"string"==typeof i&&(i={name:i}),i.options=i.options||{};var a=r.prng||n.random,s={nextBytes:function(e){for(var t=a.getBytesSync(e.length),r=0;r<e.length;++r)e[r]=t.charCodeAt(r)}};if("PRIMEINC"===i.name)return t(e,s,i.options,o);throw new Error("Invalid prime generation algorithm: "+i.name)}}()},function(e,t,r){function n(e,t,r,n){for(var o=[],i=0;i<e.length;i++)for(var a=0;a<e[i].safeBags.length;a++){var s=e[i].safeBags[a];void 0!==n&&s.type!==n||(null!==t?void 0!==s.attributes[t]&&s.attributes[t].indexOf(r)>=0&&o.push(s):o.push(s))}return o}function o(e){if(e.composed||e.constructed){for(var t=c.util.createBuffer(),r=0;r<e.value.length;++r)t.putBytes(e.value[r].value);e.composed=e.constructed=!1,e.value=t.getBytes()}return e}function i(e,t,r,n){if(t=l.fromDer(t,r),t.tagClass!==l.Class.UNIVERSAL||t.type!==l.Type.SEQUENCE||!0!==t.constructed)throw new Error("PKCS#12 AuthenticatedSafe expected to be a SEQUENCE OF ContentInfo");for(var i=0;i<t.value.length;i++){var u=t.value[i],c={},p=[];if(!l.validate(u,d,c,p)){var h=new Error("Cannot read ContentInfo.");throw h.errors=p,h}var y={encrypted:!1},m=null,g=c.content.value[0];switch(l.derToOid(c.contentType)){case f.oids.data:if(g.tagClass!==l.Class.UNIVERSAL||g.type!==l.Type.OCTETSTRING)throw new Error("PKCS#12 SafeContents Data is not an OCTET STRING.");m=o(g).value;break;case f.oids.encryptedData:m=a(g,n),y.encrypted=!0;break;default:var h=new Error("Unsupported PKCS#12 contentType.");throw h.contentType=l.derToOid(c.contentType),h}y.safeBags=s(m,r,n),e.safeContents.push(y)}}function a(e,t){var r={},n=[];if(!l.validate(e,c.pkcs7.asn1.encryptedDataValidator,r,n)){var i=new Error("Cannot read EncryptedContentInfo.");throw i.errors=n,i}var a=l.derToOid(r.contentType);if(a!==f.oids.data){var i=new Error("PKCS#12 EncryptedContentInfo ContentType is not Data.");throw i.oid=a,i}a=l.derToOid(r.encAlgorithm);var s=f.pbe.getCipher(a,r.encParameter,t),u=o(r.encryptedContentAsn1),p=c.util.createBuffer(u.value);if(s.update(p),!s.finish())throw new Error("Failed to decrypt PKCS#12 SafeContents.");return s.output.getBytes()}function s(e,t,r){if(!t&&0===e.length)return[];if(e=l.fromDer(e,t),e.tagClass!==l.Class.UNIVERSAL||e.type!==l.Type.SEQUENCE||!0!==e.constructed)throw new Error("PKCS#12 SafeContents expected to be a SEQUENCE OF SafeBag.");for(var n=[],o=0;o<e.value.length;o++){var i=e.value[o],a={},s=[];if(!l.validate(i,y,a,s)){var c=new Error("Cannot read SafeBag.");throw c.errors=s,c}var p={type:l.derToOid(a.bagId),attributes:u(a.bagAttributes)};n.push(p);var d,h,m=a.bagValue.value[0];switch(p.type){case f.oids.pkcs8ShroudedKeyBag:if(null===(m=f.decryptPrivateKeyInfo(m,r)))throw new Error("Unable to decrypt PKCS#8 ShroudedKeyBag, wrong password?");case f.oids.keyBag:try{p.key=f.privateKeyFromAsn1(m)}catch(e){p.key=null,p.asn1=m}continue;case f.oids.certBag:d=g,h=function(){if(l.derToOid(a.certId)!==f.oids.x509Certificate){var e=new Error("Unsupported certificate type, only X.509 supported.");throw e.oid=l.derToOid(a.certId),e}var r=l.fromDer(a.cert,t);try{p.cert=f.certificateFromAsn1(r,!0)}catch(e){p.cert=null,p.asn1=r}};break;default:var c=new Error("Unsupported PKCS#12 SafeBag type.");throw c.oid=p.type,c}if(void 0!==d&&!l.validate(m,d,a,s)){var c=new Error("Cannot read PKCS#12 "+d.name);throw c.errors=s,c}h()}return n}function u(e){var t={};if(void 0!==e)for(var r=0;r<e.length;++r){var n={},o=[];if(!l.validate(e[r],m,n,o)){var i=new Error("Cannot read PKCS#12 BagAttribute.");throw i.errors=o,i}var a=l.derToOid(n.oid);if(void 0!==f.oids[a]){t[f.oids[a]]=[];for(var s=0;s<n.values.length;++s)t[f.oids[a]].push(n.values[s].value)}}return t}var c=r(1);r(7),r(14),r(11),r(55),r(47),r(6),r(20),r(15),r(2),r(32);var l=c.asn1,f=c.pki,p=e.exports=c.pkcs12=c.pkcs12||{},d={name:"ContentInfo",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.contentType",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:l.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"content"}]},h={name:"PFX",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.version",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"version"},d,{name:"PFX.macData",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"mac",value:[{name:"PFX.macData.mac",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"macAlgorithm"},{name:"PFX.macData.mac.digestAlgorithm.parameters",tagClass:l.Class.UNIVERSAL,captureAsn1:"macAlgorithmParameters"}]},{name:"PFX.macData.mac.digest",tagClass:l.Class.UNIVERSAL,type:l.Type.OCTETSTRING,constructed:!1,capture:"macDigest"}]},{name:"PFX.macData.macSalt",tagClass:l.Class.UNIVERSAL,type:l.Type.OCTETSTRING,constructed:!1,capture:"macSalt"},{name:"PFX.macData.iterations",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,optional:!0,capture:"macIterations"}]}]},y={name:"SafeBag",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"SafeBag.bagId",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"bagId"},{name:"SafeBag.bagValue",tagClass:l.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"bagValue"},{name:"SafeBag.bagAttributes",tagClass:l.Class.UNIVERSAL,type:l.Type.SET,constructed:!0,optional:!0,capture:"bagAttributes"}]},m={name:"Attribute",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"Attribute.attrId",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"oid"},{name:"Attribute.attrValues",tagClass:l.Class.UNIVERSAL,type:l.Type.SET,constructed:!0,capture:"values"}]},g={name:"CertBag",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"CertBag.certId",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"certId"},{name:"CertBag.certValue",tagClass:l.Class.CONTEXT_SPECIFIC,constructed:!0,value:[{name:"CertBag.certValue[0]",tagClass:l.Class.UNIVERSAL,type:l.Class.OCTETSTRING,constructed:!1,capture:"cert"}]}]};p.pkcs12FromAsn1=function(e,t,r){"string"==typeof t?(r=t,t=!0):void 0===t&&(t=!0);var a={},s=[];if(!l.validate(e,h,a,s)){var u=new Error("Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX.");throw u.errors=u,u}var d={version:a.version.charCodeAt(0),safeContents:[],getBags:function(e){var t,r={};return"localKeyId"in e?t=e.localKeyId:"localKeyIdHex"in e&&(t=c.util.hexToBytes(e.localKeyIdHex)),void 0===t&&!("friendlyName"in e)&&"bagType"in e&&(r[e.bagType]=n(d.safeContents,null,null,e.bagType)),void 0!==t&&(r.localKeyId=n(d.safeContents,"localKeyId",t,e.bagType)),"friendlyName"in e&&(r.friendlyName=n(d.safeContents,"friendlyName",e.friendlyName,e.bagType)),r},getBagsByFriendlyName:function(e,t){return n(d.safeContents,"friendlyName",e,t)},getBagsByLocalKeyId:function(e,t){return n(d.safeContents,"localKeyId",e,t)}};if(3!==a.version.charCodeAt(0)){var u=new Error("PKCS#12 PFX of version other than 3 not supported.");throw u.version=a.version.charCodeAt(0),u}if(l.derToOid(a.contentType)!==f.oids.data){var u=new Error("Only PKCS#12 PFX in password integrity mode supported.");throw u.oid=l.derToOid(a.contentType),u}var y=a.content.value[0];if(y.tagClass!==l.Class.UNIVERSAL||y.type!==l.Type.OCTETSTRING)throw new Error("PKCS#12 authSafe content data is not an OCTET STRING.");if(y=o(y),a.mac){var m=null,g=0,v=l.derToOid(a.macAlgorithm);switch(v){case f.oids.sha1:m=c.md.sha1.create(),g=20;break;case f.oids.sha256:m=c.md.sha256.create(),g=32;break;case f.oids.sha384:m=c.md.sha384.create(),g=48;break;case f.oids.sha512:m=c.md.sha512.create(),g=64;break;case f.oids.md5:m=c.md.md5.create(),g=16}if(null===m)throw new Error("PKCS#12 uses unsupported MAC algorithm: "+v);var b=new c.util.ByteBuffer(a.macSalt),E="macIterations"in a?parseInt(c.util.bytesToHex(a.macIterations),16):1,C=p.generateKey(r,b,3,E,g,m),_=c.hmac.create();_.start(m,C),_.update(y.value);if(_.getMac().getBytes()!==a.macDigest)throw new Error("PKCS#12 MAC could not be verified. Invalid password?")}return i(d,y.value,t,r),d},p.toPkcs12Asn1=function(e,t,r,n){n=n||{},n.saltSize=n.saltSize||8,n.count=n.count||2048,n.algorithm=n.algorithm||n.encAlgorithm||"aes128","useMac"in n||(n.useMac=!0),"localKeyId"in n||(n.localKeyId=null),"generateLocalKeyId"in n||(n.generateLocalKeyId=!0);var o,i=n.localKeyId;if(null!==i)i=c.util.hexToBytes(i);else if(n.generateLocalKeyId)if(t){var a=c.util.isArray(t)?t[0]:t;"string"==typeof a&&(a=f.certificateFromPem(a));var s=c.md.sha1.create();s.update(l.toDer(f.certificateToAsn1(a)).getBytes()),i=s.digest().getBytes()}else i=c.random.getBytes(20);var u=[];null!==i&&u.push(l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(f.oids.localKeyId).getBytes()),l.create(l.Class.UNIVERSAL,l.Type.SET,!0,[l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,i)])])),"friendlyName"in n&&u.push(l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(f.oids.friendlyName).getBytes()),l.create(l.Class.UNIVERSAL,l.Type.SET,!0,[l.create(l.Class.UNIVERSAL,l.Type.BMPSTRING,!1,n.friendlyName)])])),u.length>0&&(o=l.create(l.Class.UNIVERSAL,l.Type.SET,!0,u));var d=[],h=[];null!==t&&(h=c.util.isArray(t)?t:[t]);for(var y=[],m=0;m<h.length;++m){t=h[m],"string"==typeof t&&(t=f.certificateFromPem(t));var g=0===m?o:void 0,v=f.certificateToAsn1(t),b=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(f.oids.certBag).getBytes()),l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(f.oids.x509Certificate).getBytes()),l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,l.toDer(v).getBytes())])])]),g]);y.push(b)}if(y.length>0){var E=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,y),C=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(f.oids.data).getBytes()),l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,l.toDer(E).getBytes())])]);d.push(C)}var _=null;if(null!==e){var w=f.wrapRsaPrivateKey(f.privateKeyToAsn1(e));_=null===r?l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(f.oids.keyBag).getBytes()),l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[w]),o]):l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(f.oids.pkcs8ShroudedKeyBag).getBytes()),l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[f.encryptPrivateKeyInfo(w,r,n)]),o]);var T=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[_]),S=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(f.oids.data).getBytes()),l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,l.toDer(T).getBytes())])]);d.push(S)}var I,A=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,d);if(n.useMac){var s=c.md.sha1.create(),k=new c.util.ByteBuffer(c.random.getBytes(n.saltSize)),B=n.count,e=p.generateKey(r,k,3,B,20),R=c.hmac.create();R.start(s,e),R.update(l.toDer(A).getBytes());var P=R.getMac();I=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(f.oids.sha1).getBytes()),l.create(l.Class.UNIVERSAL,l.Type.NULL,!1,"")]),l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,P.getBytes())]),l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,k.getBytes()),l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(B).getBytes())])}return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(3).getBytes()),l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(f.oids.data).getBytes()),l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,l.toDer(A).getBytes())])]),I])},p.generateKey=c.pbe.generatePkcs12Key},function(e,t,r){var n=r(1);r(7),r(2);var o=n.asn1,i=e.exports=n.pkcs7asn1=n.pkcs7asn1||{};n.pkcs7=n.pkcs7||{},n.pkcs7.asn1=i;var a={name:"ContentInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:o.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};i.contentInfoValidator=a;var s={name:"EncryptedContentInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:o.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:o.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};i.envelopedDataValidator={name:"EnvelopedData",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:o.Class.UNIVERSAL,type:o.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(s)},i.encryptedDataValidator={name:"EncryptedData",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"version"}].concat(s)};var u={name:"SignerInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:o.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:o.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:o.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};i.signedDataValidator={name:"SignedData",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:o.Class.UNIVERSAL,type:o.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},a,{name:"SignedData.Certificates",tagClass:o.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:o.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:o.Class.UNIVERSAL,type:o.Type.SET,capture:"signerInfos",optional:!0,value:[u]}]},i.recipientInfoValidator={name:"RecipientInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:o.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter"}]},{name:"RecipientInfo.encryptedKey",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}},function(e,t,r){var n=r(1);r(2),n.mgf=n.mgf||{},(e.exports=n.mgf.mgf1=n.mgf1=n.mgf1||{}).create=function(e){return{generate:function(t,r){for(var o=new n.util.ByteBuffer,i=Math.ceil(r/e.digestLength),a=0;a<i;a++){var s=new n.util.ByteBuffer;s.putInt32(a),e.start(),e.update(t+s.getBytes()),o.putBuffer(e.digest())}return o.truncate(o.length()-r),o.getBytes()}}}},function(e,t,r){var n=r(1);e.exports=n.debug=n.debug||{},n.debug.storage={},n.debug.get=function(e,t){var r;return void 0===e?r=n.debug.storage:e in n.debug.storage&&(r=void 0===t?n.debug.storage[e]:n.debug.storage[e][t]),r},n.debug.set=function(e,t,r){e in n.debug.storage||(n.debug.storage[e]={}),n.debug.storage[e][t]=r},n.debug.clear=function(e,t){void 0===e?n.debug.storage={}:e in n.debug.storage&&(void 0===t?delete n.debug.storage[e]:delete n.debug.storage[e][t])}},function(e,t,r){var n=r(1);r(2),e.exports=n.log=n.log||{},n.log.levels=["none","error","warning","info","debug","verbose","max"];var o={},i=[],a=null;n.log.LEVEL_LOCKED=2,n.log.NO_LEVEL_CHECK=4,n.log.INTERPOLATE=8;for(var s=0;s<n.log.levels.length;++s){var u=n.log.levels[s];o[u]={index:s,name:u.toUpperCase()}}n.log.logMessage=function(e){for(var t=o[e.level].index,r=0;r<i.length;++r){var a=i[r];if(a.flags&n.log.NO_LEVEL_CHECK)a.f(e);else{t<=o[a.level].index&&a.f(a,e)}}},n.log.prepareStandard=function(e){"standard"in e||(e.standard=o[e.level].name+" ["+e.category+"] "+e.message)},n.log.prepareFull=function(e){if(!("full"in e)){var t=[e.message];t=t.concat([]||e.arguments),e.full=n.util.format.apply(this,t)}},n.log.prepareStandardFull=function(e){"standardFull"in e||(n.log.prepareStandard(e),e.standardFull=e.standard)};for(var c=["error","warning","info","debug","verbose"],s=0;s<c.length;++s)!function(e){n.log[e]=function(t,r){var o=Array.prototype.slice.call(arguments).slice(2),i={timestamp:new Date,level:e,category:t,message:r,arguments:o};n.log.logMessage(i)}}(c[s]);if(n.log.makeLogger=function(e){var t={flags:0,f:e};return n.log.setLevel(t,"none"),t},n.log.setLevel=function(e,t){var r=!1;if(e&&!(e.flags&n.log.LEVEL_LOCKED))for(var o=0;o<n.log.levels.length;++o){var i=n.log.levels[o];if(t==i){e.level=t,r=!0;break}}return r},n.log.lock=function(e,t){void 0===t||t?e.flags|=n.log.LEVEL_LOCKED:e.flags&=~n.log.LEVEL_LOCKED},n.log.addLogger=function(e){i.push(e)},"undefined"!=typeof console&&"log"in console){var l;if(console.error&&console.warn&&console.info&&console.debug){var f={error:console.error,warning:console.warn,info:console.info,debug:console.debug,verbose:console.debug},p=function(e,t){n.log.prepareStandard(t);var r=f[t.level],o=[t.standard];o=o.concat(t.arguments.slice()),r.apply(console,o)};l=n.log.makeLogger(p)}else{var p=function(e,t){n.log.prepareStandardFull(t),console.log(t.standardFull)};l=n.log.makeLogger(p)}n.log.setLevel(l,"debug"),n.log.addLogger(l),a=l}else console={log:function(){}};if(null!==a){var d=n.util.getQueryVariables();if("console.level"in d&&n.log.setLevel(a,d["console.level"].slice(-1)[0]),"console.lock"in d){"true"==d["console.lock"].slice(-1)[0]&&n.log.lock(a)}}n.log.consoleLogger=a},function(e,t,r){"use strict";t.__esModule=!0;var n={UPLOADING:"uploading",FILE_ERROR:"file-error",PROCESSING:"processing",ARCHIVED:"archived",PROOFERS_NEEDED:"proofers-needed",TODOS_REQUESTED:"todos-requested",AWAITING_NEW_VERSION:"awaiting-new-version",HAS_NEW_VERSION:"has-new-version",APPROVED:"approved",NOT_STARTED:"not-started",OVERDUE:"overdue",ACTIVE:"active",SETUP_NEEDED:"setup-needed",BRIEFING:"briefing",AWAITING_PROOF:"awaiting-proof"};t.default=n},function(e,t,r){"use strict";t.__esModule=!0;var n={PROOF:1,BRIEF:2};t.default=n},function(e,t,r){"use strict";var n={Proof:"P",Workflow:"W",File:"F",User:"U",Brief:"B"},o={};Object.keys(n).forEach(function(e){o["is"+e+"Id"]=function(t){return t&&16===t.length&&t[0]===n[e]}}),e.exports=o},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=r(3),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a={id:"ProofId",version:"Version",canDelete:"CanDelete"},s=function(){function e(){n(this,e)}return e.prototype.fromProofVersion=function(e){return(0,i.default)(this,a,e),this},e}();t.default=s},function(e,t,r){"use strict";function n(e,t){return o(function(t){return t[e]},t)}function o(e,t){var r=t?1:-1,n=t?-1:1;return function(t,o){var i=e(t),a=e(o);return i<a?r:i>a?n:0}}function i(e,t){var r={};t.forEach(function(e,t){r[e]=t});var n="function"==typeof e?e:function(t){return t[e]};return function(e,t){var o=r[n(e)],i=r[n(t)];return o<i?-1:o>i?1:0}}function a(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=t.length;return function(e,r){for(var o=0;o<n;o++){var i=t[o](e,r);if(i)return i}return 0}}t.__esModule=!0,t.sortObjectsByKey=n,t.sortObjectsBy=o,t.sortObjectsByValues=i,t.combineSort=a},function(e,t,r){"use strict";function n(e){return String.fromCharCode.apply(null,new Uint8Array(e))}t.__esModule=!0,t.default=n},function(e,t,r){"use strict";t.__esModule=!0;var n={NONE:"none",GOOGLE_DRIVE:"drive",DROPBOX:"dropbox",ONEDRIVE:"onedrive",BOX:"box",CANVA:"canva",WEBSITE:"website"};t.default=n},function(e,t,r){"use strict";function n(e,t){var r=void 0;return function(){r||(r=setTimeout(function(){e(),r=null},t))}}t.__esModule=!0,t.default=n},function(e,t,r){"use strict";t.__esModule=!0,t.default=function(e,t,r){return new Promise(function(n,o){setTimeout(function(){void 0!==r?o(r):n(t)},e)})}},function(e,t,r){"use strict";t.__esModule=!0;var n={NONE:null,NOT_VISIBLE:"not-visible",VISIBLE:"visible",SEEN:"seen",SKIPPED:"skipped",FINISHED:"finished"};t.default=n},function(e,t,r){"use strict";t.__esModule=!0;var n={NONE:null,NOT_VISIBLE:"not-visible",VISIBLE:"visible",COMPLETE:"complete"};t.default=n},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(0),u=function(e){return e&&e.__esModule?e:{default:e}}(s),c=function(e){function t(r,i){n(this,t);var a=o(this,e.call(this,r));return a.level=i,a}return i(t,e),t.prototype.configurations=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return this.client.request("integrations.get-configurations",{level:this.level,integration_keys:e.join(",")}).then(function(e){return e.data?e.data.integrations:null})},t.prototype.getSetupUrl=function(e,t){return this.client.request("integrations.get-setup-url",{params:a({},t,{integration_key:e,level:this.level})}).then(function(e){return{url:e.data.url,windowFeatures:e.data.windowFeatures}})},t.prototype.disable=function(e){return this.client.request("integrations.disable",{level:this.level,integration_key:e})},t.prototype.updateConfiguration=function(e,t,r){return this.client.request("integrations.update-configuration",{level:this.level,integrationKey:e,key:t,value:r})},t}(u.default);t.default=c},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},a=r(3),s=n(a),u=r(9),c=n(u),l=r(36),f=n(l),p=r(39),d=n(p),h=r(72),y=n(h),m=r(73),g={id:"CommentId",proofId:"ProofId",pins:function(e){return(0,m.parsePins)(e.XY).map(function(t,r){return 0===r&&e.BoxFillType?i({},t,{fill:e.BoxFillType&&{type:e.BoxFillType,image:e.BoxFillImage}}):t})},pin:function(){return this.pins[0]},user:function(e){return(new c.default).fromUser(e)},comment$:"EncryptedComment",envelope:"Envelope",attachments:function(e){return e.Attachments?e.Attachments.map(function(t){return(new f.default).fromCommentAttachment(i({CommentId:e.CommentId},t))}):[]},agreeCount:function(e){return e.Agrees.length},pageNumber:(0,a.number)("Page"),mediaTime:function(){return this.pin&&this.pin.time},mediaDuration:function(){return this.pin&&this.pin.duration},createdDate:(0,a.date)("Timestamp"),updatedDate:(0,a.date)("Updated"),parentCommentId:(0,a.optional)("Parent"),metadata:(0,a.json)("Metadata",{}),sourceMetadata:"SourceMetadata",state:function(e){return(0,y.default)(e)},isPrivate:"Private"},v=function(){function e(){o(this,e)}return e.prototype.fromComment=function(e){return(0,s.default)(this,g,e),this},e.prototype.fromRawComment=function(e){var t=(0,d.default)(e);return this.raw=e,this.tokens=t,this},e}();t.default=v},function(e,t,r){"use strict";function n(e){return+e.Done?i.default.DONE:+e.Change?i.default.TODO:i.default.UNMARKED}t.__esModule=!0;var o=r(41),i=function(e){return e&&e.__esModule?e:{default:e}}(o);t.default=n},function(e,t,r){"use strict";function n(e){if("{"===e[0]){var t=JSON.parse(e);return t.pins?[3,t.pins]:[2,t]}return-1!==e.indexOf(",")?[1,e]:[null]}function o(e){var t=e.split(",").map(function(e){return parseFloat(e)}),r=t[0],n=t[1];return[c({x:r,y:n})]}function i(e){return[c(e)]}function a(e){return e.map(c)}function s(e){if(null==e)return[];var t=[],r=n(e),s=r[0],u=r[1];switch(s){case 3:t=a(u);break;case 2:t=i(u);break;case 1:t=o(u)}return t}t.__esModule=!0,t.parsePins=s;var u=r(74),c=function(e){return{x:(0,u.withinPinBounds)((0,u.numberOrNull)(e.x)),y:(0,u.withinPinBounds)((0,u.numberOrNull)(e.y)),x2:(0,u.withinPinBounds)((0,u.numberOrNull)(e.x2)),y2:(0,u.withinPinBounds)((0,u.numberOrNull)(e.y2)),time:(0,u.numberOrNull)(e.time),duration:(0,u.numberOrNull)(e.duration)}}},function(e,t,r){"use strict";function n(e){return o(e)?e:null}function o(e){return"number"==typeof e&&!isNaN(e)}function i(e){return o(e)?Math.max(-.5,Math.min(.5,e)):e}t.__esModule=!0,t.numberOrNull=n,t.isFiniteNumber=o,t.withinPinBounds=i},function(e,t,r){"use strict";function n(e){var t=[];return e.blocks.forEach(function(e){e.entities.forEach(function(e){if("mention"===e.type){var r=e.metadata.id;-1===t.indexOf(r)&&t.push(r)}})}),t}t.__esModule=!0,t.default=n},function(e,t,r){"use strict";function n(e,t){for(var r=new Array(t),n=t;n>0;--n)r[n]=e[Math.round(Math.random()*(e.length-1))];return r.join("")}t.__esModule=!0;t.lower="abcdefghijklmnopqrstuvwxyz",t.upper="ABCDEFGHIJKLMNOPQRSTUVWXYZ",t.numbers="0123456789",t.symbols="~`!@#$%^&*()_+-={}[]:\";'<>?,./|\\";t.default=n},function(e,t,r){"use strict";function n(e,t){if(!(0,i.isFiniteNumber)(t.x)||!(0,i.isFiniteNumber)(t.y))throw new Error("Malformed pin. Pins must contain, at minimum, an x and y coordinate.");return e.x=(0,i.withinPinBounds)(t.x),e.y=(0,i.withinPinBounds)(t.y),(0,i.isFiniteNumber)(t.x2)&&(e.x2=(0,i.withinPinBounds)(t.x2)),(0,i.isFiniteNumber)(t.y2)&&(e.y2=(0,i.withinPinBounds)(t.y2)),(0,i.isFiniteNumber)(t.time)&&(e.time=t.time),(0,i.isFiniteNumber)(t.duration)&&(e.duration=t.duration),e}function o(e){if(0===e.length)return"";var t={};return n(t,e[0]),e.length>1&&(t.pins=e.map(function(e){return n({},e)})),JSON.stringify(t)}t.__esModule=!0,t.serializePins=o;var i=r(74)},function(e,t,r){"use strict";function n(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return e.map(function(e,t){return e+(void 0!==r[t]?r[t]:"")}).join("")}t.__esModule=!0,t.gql=n},function(e,t,r){"use strict";function n(e){return"string"==typeof e?e.replace(/</g,"&lt;").replace(/>/g,"&gt;"):e}t.__esModule=!0,t.default=n},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function a(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments[2],n=arguments[3],o=0,a=[].concat(i(e),i(t)).sort(function(e,t){return e.offset-t.offset}),s=[];return a.length<1?(s.push(new d.default({block:n,start:0,end:r.length})),s):(a.forEach(function(e){e.offset>o&&s.push(new d.default({block:n,start:o,end:e.offset})),s.push(new d.default({block:n,entity:e.key,decorator:e.component,decoratorProps:e.decoratorProps,decoratedText:e.component?h(r,e.offset,e.offset+e.length):void 0,start:e.offset,end:e.offset+e.length,contentState:e.contentState})),o=e.offset+e.length}),o<r.length&&s.push(new d.default({block:n,start:o,end:r.length})),s)}function s(e,t){return t.forEach(function(t){e.push(t.offset),e.push(t.offset+t.length)}),e}function u(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],o=[];return o=s(o,t),o=s(o,r),o=s(o,n),o.push(0),o.push(e.length),o.filter(function(e,t,r){return r.indexOf(e)===t}).sort(function(e,t){return e-t})}Object.defineProperty(t,"__esModule",{value:!0});var c=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),l=r(81),f=n(l),p=r(207),d=n(p),h=function(e,t,r){return f.default.ucs2.encode(e.slice(t,r))},y=function(){function e(t){var r=t.flat,n=void 0!==r&&r;o(this,e),this.flat=n}return c(e,[{key:"relevantStyles",value:function(e){return this.ranges.filter(function(t){return e>=t.offset&&e<t.offset+t.length}).map(function(e){return e.style})}},{key:"nodeIterator",value:function(e,t,r){var n=this,o=this.relevantIndexes.slice(this.relevantIndexes.indexOf(t),this.relevantIndexes.indexOf(r));return o.forEach(function(t,i){var a=n.relevantStyles(t),s=o[i+1]?o[i+1]-t:1,u=h(n.textArray,t,t+s);e.pushContent(u,a,n.flat),!o[i+1]&&t<r&&e.pushContent(h(n.textArray,t+1,r),n.relevantStyles(r-1),n.flat)}),e}},{key:"parse",value:function(e){var t=this,r=e.text,n=e.inlineStyleRanges,o=e.entityRanges,i=e.decoratorRanges,s=void 0===i?[]:i;this.textArray=f.default.ucs2.decode(r),this.ranges=n,this.iterator=0,this.relevantIndexes=u(r,n,o,s);var c=a(o,s,this.textArray,e),l=c.map(function(e){return t.nodeIterator(e,e.start,e.end)});return new d.default({block:e,content:l})}}]),e}();t.default=y},function(e,t,r){"use strict";function n(e){throw new RangeError(f[e])}function o(e,t){for(var r=[],n=e.length;n--;)r[n]=t(e[n]);return r}function i(e,t){var r=e.split("@"),n="";return r.length>1&&(n=r[0]+"@",e=r[1]),e=e.replace(l,"."),n+o(e.split("."),t).join(".")}function a(e){for(var t=[],r=0,n=e.length;r<n;){var o=e.charCodeAt(r++);if(o>=55296&&o<=56319&&r<n){var i=e.charCodeAt(r++);56320==(64512&i)?t.push(((1023&o)<<10)+(1023&i)+65536):(t.push(o),r--)}else t.push(o)}return t}t.__esModule=!0;var s=2147483647,u=/^xn--/,c=/[^\0-\x7E]/,l=/[\x2E\u3002\uFF0E\uFF61]/g,f={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},p=Math.floor,d=String.fromCharCode,h=function(e){return String.fromCodePoint.apply(String,e)},y=function(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:36},m=function(e,t){return e+22+75*(e<26)-((0!=t)<<5)},g=function(e,t,r){var n=0;for(e=r?p(e/700):e>>1,e+=p(e/t);e>455;n+=36)e=p(e/35);return p(n+36*e/(e+38))},v=function(e){var t=[],r=e.length,o=0,i=128,a=72,u=e.lastIndexOf("-");u<0&&(u=0);for(var c=0;c<u;++c)e.charCodeAt(c)>=128&&n("not-basic"),t.push(e.charCodeAt(c));for(var l=u>0?u+1:0;l<r;){for(var f=o,d=1,h=36;;h+=36){l>=r&&n("invalid-input");var m=y(e.charCodeAt(l++));(m>=36||m>p((s-o)/d))&&n("overflow"),o+=m*d;var v=h<=a?1:h>=a+26?26:h-a;if(m<v)break;var b=36-v;d>p(s/b)&&n("overflow"),d*=b}var E=t.length+1;a=g(o-f,E,0==f),p(o/E)>s-i&&n("overflow"),i+=p(o/E),o%=E,t.splice(o++,0,i)}return String.fromCodePoint.apply(String,t)},b=function(e){var t=[];e=a(e);for(var r=e.length,o=128,i=0,u=72,c=e,l=Array.isArray(c),f=0,c=l?c:c[Symbol.iterator]();;){var h;if(l){if(f>=c.length)break;h=c[f++]}else{if(f=c.next(),f.done)break;h=f.value}var y=h;y<128&&t.push(d(y))}var v=t.length,b=v;for(v&&t.push("-");b<r;){for(var E=s,C=e,_=Array.isArray(C),w=0,C=_?C:C[Symbol.iterator]();;){var T;if(_){if(w>=C.length)break;T=C[w++]}else{if(w=C.next(),w.done)break;T=w.value}var S=T;S>=o&&S<E&&(E=S)}var I=b+1;E-o>p((s-i)/I)&&n("overflow"),i+=(E-o)*I,o=E;for(var A=e,k=Array.isArray(A),B=0,A=k?A:A[Symbol.iterator]();;){var R;if(k){if(B>=A.length)break;R=A[B++]}else{if(B=A.next(),B.done)break;R=B.value}var P=R;if(P<o&&++i>s&&n("overflow"),P==o){for(var O=i,D=36;;D+=36){var N=D<=u?1:D>=u+26?26:D-u;if(O<N)break;var L=O-N,U=36-N;t.push(d(m(N+L%U,0))),O=p(L/U)}t.push(d(m(O,0))),u=g(i,I,b==v),i=0,++b}}++i,++o}return t.join("")},E=function(e){return i(e,function(e){return u.test(e)?v(e.slice(4).toLowerCase()):e})},C=function(e){return i(e,function(e){return c.test(e)?"xn--"+b(e):e})},_={version:"2.1.0",ucs2:{decode:a,encode:h},decode:v,encode:b,toASCII:C,toUnicode:E};t.ucs2decode=a,t.ucs2encode=h,t.decode=v,t.encode=b,t.toASCII=C,t.toUnicode=E,t.default=_},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t,r){for(var n=t;n<r;n++)if(null!=e[n])return!1;return!0}function i(e,t,r,n){for(var o=t;o<r;o++)e[o]=n}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),s=function(){function e(t){n(this,e),this.decorators=t.slice()}return a(e,[{key:"getDecorations",value:function(e,t){var r=Array(e.getText().length).fill(null);return this.decorators.forEach(function(n,a){var s=0;(0,n.strategy)(e,function(e,t){o(r,e,t)&&(i(r,e,t,a+"."+s),s++)},t)}),r}},{key:"getComponentForKey",value:function(e){var t=parseInt(e.split(".")[0],10);return this.decorators[t].component}},{key:"getPropsForKey",value:function(e){var t=parseInt(e.split(".")[0],10);return this.decorators[t].props}}]),e}();t.default=s},function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function o(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0,t.version=t.util=t.Model=t.Enum=t.Bluffer=t.Client=void 0;var i=r(84),a=o(i),s=r(4),u=o(s),c=r(193),l=n(c),f=r(202),p=n(f),d=r(27),h=o(d),y=r(203),m=n(y);t.default=a.default,t.Client=a.default,t.Bluffer=u.default,t.Enum=l,t.Model=p,t.util=m,t.version=h.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=r(85),a=n(i),s=r(90),u=n(s),c=r(91),l=n(c),f=r(94),p=n(f),d=r(96),h=n(d),y=r(108),m=n(y),g=r(114),v=n(g),b=r(115),E=n(b),C=r(139),_=n(C),w=r(140),T=n(w),S=r(144),I=n(S),A=r(166),k=n(A),B=r(168),R=n(B),P=r(170),O=n(P),D=r(174),N=n(D),L=r(175),U=n(L),x=r(176),M=n(x),V=r(177),j=n(V),F=r(178),q=n(F),K=r(18),G=n(K),z=r(179),H=n(z),W=r(16),Q=n(W),X=r(67),Y=n(X),Z=r(5),$=r(180),J=n($),ee=r(181),te=r(182),re=r(183),ne=n(re),oe=r(184),ie=n(oe),ae=r(187),se=n(ae),ue=r(188),ce=n(ue),le=r(189),fe=n(le),pe=r(190),de=n(pe),he=r(27),ye=n(he),me=r(192),ge=n(me),ve=r(34)("PageProof"),be=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.options,n=void 0===r?{}:r,i=t.adapters,s=void 0===i?[]:i;o(this,e),this.options=n,this.clientId=n.clientId||(0,ge.default)(),this.events=new H.default,this.adapters=new a.default(s),this.cache=new u.default(this),this.keyPairs=new fe.default(this),this.accounts=new h.default(this),this.comments=new O.default(this),this.dashboard=new m.default(this),this.files=new T.default(this),this.profile=new N.default(this),this.proofs=new E.default(this),this.briefs=new _.default(this),this.users=new v.default(this),this.workflows=new k.default(this),this.preferences=new R.default(this),this.sessions=new U.default(this),this.encryption=new M.default(this),this.live=new j.default(this),this.reports=new ne.default(this),this.teams=new ie.default(this),this.printing=new se.default(this),this.freeTrial=new ce.default(this),this.checklistTemplates=new de.default(this),this.__admin=new I.default(this),this._hijackAdmin(),this._init(),this._registerCoreHooks(),this._enhance()}return e.prototype._init=function(){var e=this.adapters.getRequestAdapter();if(this.options.endpoint||(this.options.endpoint=e.options.endpoint),this.options.applicationId||(this.options.applicationId=e.options.applicationId),this.options.subscriptionKey||(this.options.subscriptionKey=e.options.key||this.options.key),this.options.subscriptionKey&&!this.options.applicationId)throw new Error("You must provide an applicationId.")},e.prototype._hijackAdmin=function(){var e=this;Object.getOwnPropertyNames(this.__admin).forEach(function(t){return e.admin[t]=e.__admin[t]})},e.prototype._registerCoreHooks=function(){this.on("error.throttled",function(e){var t=e.data.response.data.timeout;return ve("Sleeping "+t+"ms until rate limit resets"),(0,Y.default)(t)})},e.prototype._enhance=function(){var e=this;this.adapters.getEnhancementAdapters().forEach(function(t){return t.onClientReady(e)})},e.prototype.setSession=function(e){return!e||e instanceof G.default?this.session=e||null:this.session=(new G.default).fromJSON(e),this.session},e.prototype.rawRequest=function(e,t){var r=e.method,n=e.url,o=e.host,i=e.path,a=e.query,s=e.body,u=e.headers,c=this.adapters.getRequestAdapter();return n&&(o=n.origin,i=n.pathname,a=n.search),c.send({host:o,method:r,path:i,query:a,body:s,headers:u,credentials:!1},t)},e.prototype.getRequestLocalEncodedMetadata=function(){return[(0,J.default)()].map(function(e){return null!==e&&void 0!==e?encodeURIComponent(e):"#"}).join(":")},e.prototype.request=function(e,t,r){var n=this,o=new l.default(this.options.endpoint,e,t),i=this.adapters.getRequestAdapter(),a=Promise.resolve();if(!o.endpoint.anonymous){if(!this.session)return Promise.reject(new Error("Cannot make call to endpoint ("+e+") when unauthorized."));a=this.adapters.getCryptoAdapter().generateAuthorizationHeaders(o.getMethod(),o.getPath(),this.session).then(function(e){return o.addHeaders(e)})}this.options.applicationId&&o.addHeader(Z.DEVICE_ID_HEADER,this.options.applicationId),this.options.subscriptionKey&&o.addHeader(Z.SUBSCRIPTION_KEY_HEADER,this.options.subscriptionKey),"graphql"===e&&(o.addHeader("apollographql-client-name",this.options.applicationId?this.options.applicationId+" (via @pageproof/sdk)":"@pageproof/sdk"),o.addHeader("apollographql-client-version",ye.default),this.clientId&&o.addHeader("spider-client-id",this.clientId));var s=this.getRequestLocalEncodedMetadata();s&&o.addHeader(Z.LOCAL_ENCODED_METADATA_HEADER,s);var u={request:o};return a.then(function(){var e=o.build();return n.events.emit("experimental.request.before",u,!0).then(function(){return e})}).then(function(e){return i.send(e,r)}).then(p.default.parse).then(function(o){if(u.response=o,n.events.emit("experimental.request.after",u),o.code===Q.default.ERROR_THROTTLED){var i=n.events.emit("error.throttled",u);if(i.some(Boolean))return Promise.all(i).then(function(){return n.events.emit("experimental.request.retry",u),n.request(e,t,r)})}if(o.code===Q.default.ERROR_UNAUTHORISED){var a=n.session?n.session.token:null;return n.events.emit("error.unauthorized",u,!0).then(function(){return n.session&&n.session.token!==a?n.request(e,t,r):o})}if(o.deprecated){var s="The "+e+" API has been deprecated. "+(o.deprecated||"");n.events.emit("error.deprecated",{name:e,message:s})}return o}).then(function(t){try{if(t.error){n.events.emit("error.response",u);var r=new Error(t.message+" ["+e+"]");return r.response=t,r.request=o,Promise.reject(r)}return n.events.emit("experimental.request.resolve",u),Promise.resolve(t)}finally{n.events.emit("experimental.request.finally",u)}})},e.prototype.graphql=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{throwOnError:!0,minifyDocument:!0},n=!r||!1!==r.throwOnError,o=!0===r.minifyDocument,i=o?e.replace(/\s+/g," ").replace(/ { /g,"{").replace(/ } /g,"}").trim():e;return this.request("graphql",{query:i,variables:t}).then(function(e){var t=e.data;if(t.errors&&t.errors.length&&n){throw new ee.AggregateError("One or more GraphQL errors occurred.",t.errors.map(function(e){return new te.GraphQLError(e.message,e.locations,e.path)}))}return t})},e.prototype.admin=function(){return this.session?this.session.user.isAdmin?(this._admin||(this._admin=Promise.resolve(this.__admin)),this._admin):Promise.reject(new Error("The current user must be an administrator of a team or enterprise account.")):Promise.reject(new Error("You must be logged in to use the Admin API."))},e.prototype.brian=function(){return this.session&&this.session.userId===Z.BRIAN_USER_ID?(this._brian||(this._brian=Promise.resolve(new q.default(this))),this._brian):Promise.reject(new Error("You do not have permission to use this API."))},e.prototype.crypto=function(){return this.adapters.getCryptoAdapter()},e.prototype.protobuf=function(){return this.adapters.getProtobufAdapter()},e.prototype.on=function(e,t){return this.events.on(e,t)},e}();t.default=be},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=r(86),a=n(i),s=r(87),u=n(s),c=r(88),l=n(c),f=r(89),p=n(f),d=function(){function e(t){o(this,e),this.adapters=[].concat(t)}return e.prototype.getAdapterInstanceOf=function(e){return this.getAnyAdaptersInstanceOf(e)[0]||null},e.prototype.getAnyAdaptersInstanceOf=function(e){for(var t=[],r=e.__adapter__,n=0;n<this.adapters.length;n+=1)for(var o=this.adapters[n],i=o;null!==i;){if(i.constructor&&i.constructor.__adapter__===r){t.push(o);break}i=Object.getPrototypeOf(i)}return t},e.prototype.getCryptoAdapter=function(){var e=this.getAdapterInstanceOf(a.default);if(!e)throw new Error("ICryptoAdapter not found. This adapter is required for the SDK to function correctly.");return e},e.prototype.getRequestAdapter=function(){var e=this.getAdapterInstanceOf(u.default);if(!e)throw new Error("IRequestAdapter not found. This adapter is required for the SDK to function correctly.");return e},e.prototype.getCacheAdapter=function(){return this.getAdapterInstanceOf(l.default)},e.prototype.getEnhancementAdapters=function(){return this.getAnyAdaptersInstanceOf(p.default)},e.prototype.getProtobufAdapter=function(){return this.getAdapterInstanceOf({__adapter__:"ProtobufAdapter"})},e}();t.default=d},function(e,t,r){"use strict";function n(){}t.__esModule=!0,n.__adapter__="ICryptoAdapter",t.default=n},function(e,t,r){"use strict";function n(){}t.__esModule=!0,n.__adapter__="IRequestAdapter",t.default=n},function(e,t,r){"use strict";function n(){}t.__esModule=!0,n.__adapter__="ICacheAdapter",t.default=n},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t,r){var n=e[t];e[t]=function(){for(var e=arguments.length,t=Array(e),o=0;o<e;o++)t[o]=arguments[o];var i=n.bind.apply(n,[this].concat(t));return r(i,this,t).apply(this,t)}}function i(e){function t(o){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],a=Object.getOwnPropertyNames(o).filter(function(t){return o[t].client===e}),s=Object.getPrototypeOf(o),u=Object.keys(s).filter(function(e){return"function"==typeof s[e]&&0!==e.indexOf("_")});if(i.length||r){var c=i.join(".");0===c.indexOf("__")&&(c=c.substring(2)),u.forEach(function(e){n.push({namespace:c,name:e,api:o})})}a.forEach(function(e){t(o[e],i.concat(e))})}var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=[];return t(e),n}t.__esModule=!0;var a,s,u=(s=a=function(){function e(){n(this,e)}return e.prototype.onClientReady=function(e){var t=this;i(e).forEach(function(e){var r={api:e.api,namespace:e.namespace,name:e.name,displayName:e.namespace+"."+e.name};t.onMethodEnhance(r),o(e.api,e.name,function(e){return t.onMethodBefore(r),function(){var n=void 0;try{n=e()}catch(e){throw r.error=e,t.onMethodThrown(r),e}finally{r.value=n,t.onMethodAfter(r),n&&"function"==typeof n.then&&n.then(function(e){r.resolved=e,t.onMethodResolve(r)},function(e){r.rejected=e,t.onMethodReject(r)}).then(function(){t.onMethodFinally(r)})}return n}})}),e.on("experimental.request.before",function(e){return t.onRequestBefore(e.data)}),e.on("experimental.request.after",function(e){return t.onRequestAfter(e.data)}),e.on("error.response",function(e){return t.onRequestReject(e.data)}),e.on("error.throttled",function(e){return t.onRequestThrottled(e.data)}),e.on("experimental.request.retry",function(e){return t.onRequestRetry(e.data)}),e.on("error.unauthorized",function(e){return t.onRequestUnauthorized(e.data)}),e.on("error.deprecated",function(e){return t.onRequestDeprecated(e.data)}),e.on("experimental.request.resolve",function(e){return t.onRequestResolve(e.data)}),e.on("experimental.request.finally",function(e){return t.onRequestFinally(e.data)})},e.prototype.onMethodEnhance=function(e){},e.prototype.onMethodBefore=function(e){},e.prototype.onMethodAfter=function(e){},e.prototype.onMethodReject=function(e){},e.prototype.onMethodResolve=function(e){},e.prototype.onMethodFinally=function(e){},e.prototype.onMethodThrown=function(e){},e.prototype.onRequestBefore=function(e){},e.prototype.onRequestAfter=function(e){},e.prototype.onRequestReject=function(e){},e.prototype.onRequestThrottled=function(e){},e.prototype.onRequestRetry=function(e){},e.prototype.onRequestUnauthorized=function(e){},e.prototype.onRequestDeprecated=function(e){},e.prototype.onRequestResolve=function(e){},e.prototype.onRequestFinally=function(e){},e}(),a.__adapter__="IEnhancementAdapter",s);t.default=u},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=function(){function e(t){n(this,e),this.client=t}return e.prototype.auto=function(e,t){var r=this.client.adapters.getCacheAdapter(),n=function(){};return r?(n=function(t){void 0!==t&&r.set(e,t)},r.get(e).catch(function(){return Promise.resolve(t(n)).then(function(e){return n(e),e})})):Promise.resolve(t(n))},e}();t.default=o},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},a=r(92),s=n(a),u=r(26),c=n(u),l=r(27),f=n(l),p=r(5),d=function(){function e(t,r,n){if(o(this,e),this.host=t,this.name=r,this.endpoint=s.default[r],!this.endpoint)throw new Error('Unknown request endpoint "'+r+'".');this.params={},this.addParams(n),this.headers={}}return e.prototype.addHeaders=function(e){return this.headers=i({},this.headers,e),this},e.prototype.addHeader=function(e,t){return this.headers[e]=t,this},e.prototype.addParams=function(e){return this.params=i({},this.params,e),this},e.prototype.addParam=function(e,t){this.params[e]=t},e.prototype.getPath=function(){var e=this,t=this.endpoint,r=t.path,n=t.chain,o=t.trailing,i=r;return n&&n.forEach(function(t){"/"!==i[i.length-1]&&(i+="/"),i+=e.params[t]}),o&&"/"!==i[i.length-1]&&(i+="/"),i},e.prototype.getQuery=function(){var e=this,t=this.endpoint.query;if(t){var r=[];if("string"==typeof t){var n=this.params[t];(0,c.default)(n)&&Object.keys(n).forEach(function(e){void 0!==n[e]&&r.push(e+"="+encodeURIComponent(n[e]))})}else t.forEach(function(t){void 0!==e.params[t]&&r.push(t+"="+encodeURIComponent(e.params[t]))});if(r.length)return"?"+r.filter(Boolean).join("&")}return""},e.prototype.getHeaders=function(){var e,t=i({},this.headers,(e={},e[p.SDK_VERSION_HEADER]=f.default,e));if("POST"===this.endpoint.method||"PATCH"===this.endpoint.method||"PUT"===this.endpoint.method)switch(this.endpoint.version){case 2:t["Content-Type"]="application/json";break;case 1:default:t["Content-Type"]="application/x-www-form-urlencoded"}return t},e.prototype.getBody=function(){var e=this,t=this.endpoint;if(t.body){if("string"==typeof t.body){var r=this.params[t.body];return r=(0,c.default)(r)?JSON.stringify(r):String(r)}var n=!0===t.body?Object.keys(this.params):t.body,o={};switch(n.forEach(function(t){var r=e.params[t];void 0!==r&&(o[t]=r)}),t.version){case 2:return JSON.stringify(o);case 1:default:return Object.keys(o).map(function(t){return t+"="+encodeURIComponent(e.params[t])}).join("&")}}return null},e.prototype.getMethod=function(){return(this.endpoint.method||"GET").toUpperCase()},e.prototype.isWithCredentials=function(){return!0===this.endpoint.credentials},e.prototype.build=function(){return{host:this.host,method:this.getMethod(),path:this.getPath(),query:this.getQuery(),body:this.getBody(),headers:this.getHeaders(),credentials:this.isWithCredentials()}},e}();t.default=d},function(e,t){e.exports={"accounts.register":{method:"POST",path:"/api/users/register",body:["email","password","privateKey","publicKey","referrer"],anonymous:!0},"accounts.login":{method:"POST",path:"/api/users/login",body:["email","password","totp"],anonymous:!0},"accounts.generate-activation-code":{method:"GET",path:"/api/users/auth/generate",chain:["userId"],trailing:!0},"accounts.activate":{method:"POST",path:"/api/users/auth/activate",body:["userId","authCode"],trailing:!0},"accounts.forgot-password":{method:"POST",path:"/api/users/resetpasswordrequest",body:["email"],anonymous:!0},"accounts.set-password-request":{method:"POST",path:"/api/users/setpasswordrequest",body:["email"],anonymous:!0},"accounts.reset-password":{method:"POST",path:"/api/users/resetpassword",body:["email","secret","newPassword","newPrivateKey","newPublicKey"],anonymous:!0},"accounts.set-password":{method:"POST",path:"/api/users/setpassword",body:["email","secret","newPassword","newPrivateKey","newPublicKey"],anonymous:!0},"accounts.logout":{method:"GET",path:"/api/users/logout"},"profile.upload-avatar":{method:"POST",path:"/api/media/file/avatar",body:["uploadedImage"]},"profile.delete-avatar":{method:"POST",path:"/api/media/file/avatar/delete"},"profile.change-password":{method:"POST",path:"/api/users/changepassword",body:["oldPassword","newPassword","newPrivateKey"],trailing:!0},"profile.status":{method:"GET",path:"/api/users/status"},"profile.set-status":{version:2,method:"POST",path:"/api/users/status/set",body:["emoji","message","away"]},"profile.clear-status":{method:"POST",path:"/api/users/status/clear"},"preferences.all":{method:"GET",path:"/api/users/preferences/all"},"preferences.get":{method:"GET",path:"/api/users/preferences/get",query:["preferences"]},"preferences.update":{version:2,method:"POST",path:"/api/users/preferences/update",body:!0},"preferences.reset":{version:2,method:"POST",path:"/api/users/preferences/reset",body:["preferences"]},"dashboard.inbox":{method:"GET",path:"/api/proofs/dashboard/proofin",trailing:!0},"dashboard.sent":{method:"GET",path:"/api/proofs/dashboard/proofout",trailing:!0},"dashboard.outbox":{method:"GET",path:"/api/proofs/dashboard/proofoutbox",trailing:!0},"dashboard.briefs":{method:"GET",path:"/api/briefs/dashboard",trailing:!0},"dashboard.search":{method:"POST",path:"/api/proofs/search",body:["query","all","filterBy"]},"dashboard.groups.filter-by":{method:"GET",path:"/api/proofs/dashboard/groups",chain:["filterBy"],trailing:!0},"team.dashboard.inbox":{method:"GET",path:"/api/admin/dashboard/proofin",chain:["page"],trailing:!0},"team.dashboard.sent":{method:"GET",path:"/api/admin/dashboard/proofsent",chain:["page"],trailing:!0},"team.dashboard.outbox":{method:"GET",path:"/api/admin/dashboard/proofout",chain:["page"],trailing:!0},"team.dashboard.search":{method:"POST",path:"/api/admin/search",body:["query","all","filterBy","page"]},"admin.team.dashboard.groups.category":{method:"GET",path:"/api/admin/dashboard/groups",chain:["category"]},"admin.team.proofs.groups.load":{method:"GET",path:"/api/admin/group",chain:["groupId"]},"users.by-id":{method:"GET",path:"/api/users",chain:["userId"]},"users.by-email":{method:"POST",path:"/api/users/email",body:["email"],trailing:!0},"users.invite":{method:"POST",path:"/api/users/create",body:["email"]},"proofs.create":{version:2,method:"POST",path:"/api/v2/proofs/create",body:"proof"},"proofs.normalize-workflow":{method:"POST",path:"/api/proofs/permission/check",body:["proofId","workflowId"]},"proofs.get-workflow-metrics":{method:"GET",path:"/api/workflows/metrics",query:["proofId"]},"proofs.set-workflow":{method:"POST",path:"/api/proofs/update",body:["proofId","workflowId"]},"proofs.set-tags":{method:"POST",path:"/api/tags/create",body:["relatedId","tag"]},"proofs.set-file":{method:"POST",path:"/api/proofs/update",body:["proofId","fileId"]},"proofs.distribute-file":{method:"GET",path:"/api/proofs/distribute",chain:["proofId"],trailing:!0},"proofs.archive":{version:2,method:"POST",path:"/api/proofs/close",body:["proofIds"]},"proofs.unarchive":{method:"GET",path:"/api/proofs/reopen",chain:["proofId"],trailing:!0},"proofs.delete":{method:"GET",path:"/api/proofs/delete",chain:["proofId"],trailing:!0},"proofs.start":{method:"POST",path:"/api/proofs/startworkflow",body:["proofId"],trailing:!0},"proofs.manual-approval":{method:"POST",path:"/api/proofs/manualapproval",body:["proofId","message"],trailing:!0},"proofs.withdraw-approval":{method:"POST",path:"/api/proofs/revertapproval",body:["proofId","messageToSender"],trailing:!0},"proofs.editors.add":{version:2,method:"POST",path:"/api/proofs/editor/add",body:["proofId","editors","editorMessage"]},"proofs.editors.add-bulk":{version:2,method:"POST",path:"/api/proofs/editor/add/bulk",body:["proofsWithEditors"]},"proofs.bulk-update":{version:2,method:"POST",path:"/api/proofs/update/bulk",body:["proofs"]},"proofs.editors.remove":{version:2,method:"POST",path:"/api/proofs/editor/remove",body:["proofId","editors"]},"proofs.editors.replace":{version:2,method:"POST",path:"/api/proofs/editor/replace",body:["proofId","oldEditors","newEditors"]},"proofs.editors.set":{version:2,method:"POST",path:"/api/proofs/editor/set",body:["proofId","editors"]},"briefs.start":{method:"POST",path:"/api/briefs/start",body:["briefId"]},"proofs.return":{version:2,method:"POST",path:"/api/v2/proofs/return",body:["proofIds"]},"proofs.groups.create":{method:"POST",path:"/api/proofs/groups/create",body:["name","ownedByTeam"]},"proofs.groups.update":{version:2,method:"POST",path:"/api/proofs/groups/update",body:["groupId","name","ownedByTeam","folderName"]},"proofs.groups.delete":{method:"POST",path:"/api/groups/delete",body:["groupId"]},"proofs.groups.load":{method:"GET",path:"/api/proofs/group",chain:["groupId"]},"proofs.groups.ready":{method:"POST",path:"/api/proofs/groups/ready",body:["groupId"]},"proofs.groups.archive":{version:2,method:"POST",path:"/api/groups/archive",body:["groupIds","archiveProofs"]},"proofs.groups.reopen":{version:2,method:"POST",path:"/api/groups/reopen",body:["groupIds"]},"proofs.groups.remove-proof":{method:"POST",path:"/api/groups/proof/remove",body:["proofId"]},"proofs.groups.add-proof":{method:"POST",path:"/api/groups/proof/add",body:["proofId","groupId"]},"proofs.groups.owners.add":{version:2,method:"POST",path:"/api/v2/proofs/owners/groups/add",body:["groupId","owners"]},"proofs.groups.workflows.add-reviewers":{version:2,method:"POST",path:"/api/v2/workflows/groups/reviewers/add",body:["groupId","reviewers"]},"proofs.groups.replace-approver":{version:2,method:"POST",path:"/api/groups/approver/replace",body:["groupId","user"]},"proofs.versions.attach":{method:"POST",path:"/api/proofs/versions/create",body:["proofId","versionId"]},"proofs.versions.list":{method:"GET",path:"/api/proofs/versions",chain:["proofId"],trailing:!0},"proofs.load":{method:"GET",path:"/api/proofs/",chain:["proofId"],trailing:!0},"proofs.next":{method:"POST",path:"/api/proofs/next",body:["proofId"]},"proofs.request-access":{method:"GET",path:"/api/proofs/requestaccess",chain:["proofId"]},"proofs.lock":{method:"GET",path:"/api/proofs/lock/",chain:["proofId"],trailing:!0},"proofs.unlock":{method:"GET",path:"/api/proofs/unlock/",chain:["proofId"],trailing:!0},"proofs.request-unlock":{method:"GET",path:"/api/proofs/unlockemail/",chain:["proofId"],trailing:!0},"proofs.images":{method:"GET",path:"/api/proofs/graph/thumbnails/",chain:["proofId"]},"proofs.video-credentials":{method:"GET",path:"/api/proofs/assets/video-credentials/",chain:["proofId"]},"proofs.finish":{method:"POST",path:"/api/proofs/finished",body:["proofId","decision"]},"proofs.update-decision":{method:"POST",path:"/api/proofs/update/decision",body:["proofId","decision"]},"proofs.decisions.load":{method:"GET",path:"/api/decisions/proofs",chain:["proofId"]},"proofs.decisions.get-options":{method:"GET",path:"/api/decisions/proofs",chain:["proofId","type"]},"proofs.decisions.leave-decision":{version:2,method:"POST",path:"/api/decisions/proofs",body:["decisionId"],chain:["proofId"]},"proofs.assets.extracted-text":{version:2,method:"GET",path:"/api/proofs/assets/extracted-text",chain:["proofId"]},"proofs.assets.color-separations":{version:2,method:"GET",path:"/api/proofs/assets/color-separations",chain:["proofId"]},"files.legacy.generate-token":{method:"GET",path:"/api/media/getfiletoken",query:["relatedId","fileType"]},"files.legacy.upload-block":{method:"POST",path:"/api/media/file",query:["block","part","token"],body:"data"},"files.legacy.upload-complete":{method:"POST",path:"/api/media/file",query:["block","blockCount","part","token","extn","pages","filename","storeoriginal","adobeExportData"],body:"envelope"},"files.details":{method:"GET",path:"/api/media/file/details",chain:["fileId"]},"files.download-block":{method:"GET",path:"/api/media/getfilechunk",chain:["proofId","fileId","block"],query:["s"]},"files.thumbnail":{method:"GET",path:"/api/media/getimage/thumb",chain:["fileId"]},"files.preview":{method:"GET",path:"/api/media/getimage",chain:["fileId","quality","pageNumber"],trailing:!0},"files.import.generic":{method:"POST",path:"/api/media/filedropbox",body:["extn","filename","url","envelope","storeOriginal"]},"files.import.drive":{method:"POST",path:"/api/media/filedrive",body:["extn","filename","url","envelope","storeOriginal","accessToken"]},"files.import.onedrive":{method:"POST",path:"/api/media/fileonedrive",body:["extn","filename","url","envelope","storeOriginal","accessToken"]},"files.import.box":{method:"POST",path:"/api/media/filebox",body:["extn","filename","url","envelope","storeOriginal","accessToken"]},"files.import.dropbox":{method:"POST",path:"/api/media/filedropbox",body:["extn","filename","url","envelope","storeOriginal","accessToken"]},"files.import.canva":{method:"POST",path:"/api/media/filecanva",body:["extn","filename","url","envelope","storeOriginal","accessToken"]},"files.v2.generate-credentials":{version:2,method:"POST",path:"/api/media/file/upload",body:["files","supports"]},"files.v2.upload-complete":{version:2,method:"POST",path:"/api/media/file/queue",body:["files"]},"files.can-download.update":{method:"POST",path:"/api/media/downloadoption",body:["fileId","downloadOriginal"]},"files.import.web.validate":{method:"POST",path:"/api/media/import/url/validate",body:["url"]},"files.import.web":{method:"POST",path:"/api/media/import/url",body:["url","envelope"]},"files.create-email":{version:2,method:"POST",path:"/api/email-upload/files/create"},"files.duplicate":{version:2,method:"POST",path:"/api/files/v2/duplicate",body:["id"]},"workflows.create":{version:2,method:"POST",path:"/api/v2/workflows/create",body:["title","ownedByTeam"]},"workflows.favorite":{method:"POST",path:"/api/workflows/favorite",body:["workflowId"]},"workflows.unfavorite":{method:"POST",path:"/api/workflows/unfavorite",body:["workflowId"]},"workflows.update":{method:"POST",path:"/api/workflows/update",body:["workflowId","title","ownedByTeam"]},"workflows.load":{version:2,method:"GET",path:"/api/v2/workflows/detail",chain:["workflowId"]},"workflows.nudge-message":{method:"GET",path:"/api/workflows/nudgemessage",query:["workflowId","userId"]},"workflows.steps.add":{version:2,method:"POST",path:"/api/v2/workflows/steps/add",body:["workflowId","title","position","dueDate","mandatoryDecisionThreshold"]},"workflows.steps.update":{version:2,method:"POST",path:"/api/v2/workflows/steps/update",body:["stepId","title","dueDate","mandatoryDecisionThreshold"]},"workflows.steps.move-before":{method:"POST",path:"/api/workflows/step/movebefore",body:["stepId","beforeStepId"]},"workflows.steps.move-after":{method:"POST",path:"/api/workflows/step/moveafter",body:["stepId","afterStepId"]},"workflows.steps.swap":{method:"POST",path:"/api/workflows/step/swap",body:["stepId","swapStepId"]},"workflows.users.set":{version:2,method:"POST",path:"/api/v2/workflows/users/set",body:["workflowId","stepId","position","users"]},"workflows.users.update":{version:2,method:"POST",path:"/api/v2/workflows/users/update",body:["workflowId","stepId","userId","role","permissions"]},"workflows.users.add":{version:2,method:"POST",path:"/api/v2/workflows/users/add",body:["workflowId","stepId","users"]},"workflows.users.skip-all":{method:"POST",path:"/api/workflows/skipall",body:["workflowId"]},"workflows.user.nudge":{version:2,method:"POST",path:"/api/workflows/user/nudge",body:["workflowId","userId","message"]},"workflows.nudge-all":{version:2,method:"POST",path:"/api/v2/workflows/nudgeall",body:["workflowIds","message"]},"workflows.delete":{method:"POST",path:"/api/workflows/delete",body:["workflowId"]},"workflows.duplicate":{method:"POST",path:"/api/workflows/duplicateonly",body:["workflowId","noOwners","includeOwnedByTeam","excludeStepDueDates","includeSharedUsers"]},"workflows.set-starting-step":{method:"POST",path:"/api/workflows/startfrom",body:["workflowId","stepId"]},"workflows.owned":{method:"GET",path:"/api/workflows",trailing:!0},"workflows.shared":{method:"GET",path:"/api/workflows/share/user",trailing:!0},"workflows.owned.email-list":{method:"GET",path:"/api/workflows/emaillist",trailing:!0},"workflows.shared.email-list":{method:"GET",path:"/api/workflows/share/emaillist",trailing:!0},"workflows.replace-approver":{version:2,method:"POST",path:"/api/v2/workflows/approver/replace/bulk",body:["workflowIds","user"]},"workflows.proof-owners.add":{version:2,method:"POST",path:"/api/workflows/permission/add",body:!0},"comments.load-all":{method:"POST",path:"/api/proofs/recent",body:["proofId","timestamp"]},"comments.load-page":{method:"POST",path:"/api/proofs/comment/recent",body:["proofId","timestamp","page"]},"comments.state.update":{method:"POST",path:"/api/proofs/comment/updatestatus",body:["commentId","change","done"]},"comments.state.multiple-update":{version:2,method:"POST",path:"/api/comments/update/status/batch",body:["proofId","commentIds","change","done"]},"comments.create":{version:2,method:"POST",path:"/api/proofs/comment/create",body:["proofId","page","envelope","encryptedComment","xy","parent","mentions","metadata","sourceMetadata","creationToken","change","done","boxFillImage","boxFillType","autoState","private"]},"comments.delete":{method:"POST",path:"/api/proofs/comment/delete",body:["commentId"]},"comments.import.create-task":{version:2,method:"POST",path:"/api/proofs/comments/import/tasks",body:"options"},"comments.import.action-task":{version:2,method:"POST",path:"/api/proofs/comments/import/tasks",chain:["id","action"],body:"options"},"comments.import.get-task":{method:"GET",path:"/api/proofs/comments/import/tasks",chain:["id"]},"comments.load-context":{method:"GET",path:"/api/comments/context",chain:["commentId"]},"proofs-owners.add":{version:2,method:"POST",path:"/api/v2/proofs/owners/add",body:["proofIds","users"]},"proofs-reviewers.add":{version:2,method:"POST",path:"/api/proofs/reviewers/add",body:["proofIds","reviewers"]},"proofs-workflow.add-bulk":{version:2,method:"POST",path:"/api/proofs/workflow/add/bulk",body:["proofIds","workflowTemplateId"]},"proofs-owners.remove":{version:2,method:"POST",path:"/api/v2/proofs/owners/remove",body:["proofId","users"]},"proofs.tag-delete":{method:"POST",path:"/api/tags/delete",body:["relatedId","tag"]},"proofs.return-todos":{version:2,method:"POST",path:"/api/proofs/returntodos",body:["proofIds","messageToOwners","markCommentAsTodo"]},"proofs.set-message-to-reviewers":{version:2,method:"POST",path:"/api/proofs/messagetoreviewers/update/bulk",body:["proofIds","messageToReviewers"]},"proofs.remove-editor":{method:"GET",path:"/api/proofs/deleteeditor",chain:["proofId"],trailing:!0},"proofs.update":{version:2,method:"POST",path:"/api/v2/proofs/update",body:"proof"},"briefs.create":{method:"POST",path:"/api/briefs/create",body:["title","messageToRecipient","dueDate","tag","isPublic"]},"briefs.update":{method:"POST",path:"/api/briefs/update",body:["briefId","title","messageToRecipient","dueDate","tag","recipient","editorId","editorMessage","isPublic"]},"admin.team.users.enabled":{method:"GET",path:"/api/admin/getusers/active",trailing:!0},"admin.team.users.disabled":{method:"GET",path:"/api/admin/getusers/inactive",trailing:!0},"admin.team.users.set-enabled":{method:"POST",path:"/api/admin/setenabled",body:["email","enabled"]},"admin.team.users.invite":{version:2,method:"POST",path:"/api/admin/member/invite",body:["emails"]},"admin.team.users.remove-from-team":{version:2,method:"POST",path:"/api/admin/member/remove",body:["users"]},"admin.team.users.upload-avatar":{method:"POST",path:"/api/admin/member/avatar",body:["userId","uploadedImage"]},"admin.team.users.delete-avatar":{method:"POST",path:"/api/admin/member/avatar/delete",body:["userId"]},"admin.team.users.invitations":{method:"GET",path:"/api/admin/team/users/invitations"},"admin.team.users.revoke-invitation":{version:2,method:"POST",path:"/api/admin/team/users/revoke-invitation",body:["email","invitationId"]},"admin.team.features.load":{method:"GET",path:"/api/admin/settings",trailing:!0},"admin.team.features.update":{version:2,method:"POST",path:"/api/admin/settings",body:["displayComments","generalComments","privateComments","enableWebhooks","editComments","ownerCanDeleteComments","proofReference","proofReferenceRequired","displayTeamName","emailTitleTextColor","emailLinkTextColor","emailButtonBackgroundColor","emailButtonTextColor","disableReplyingToCommentsInStatuses","publicProofs","defaultProofIsPublic","messageToOwners","allowedDecisions","enableChecklists","suggestionsIncludeTeamMembers","enableUserGroups","enableCommentVisibility","defaultCommentVisibility","usePreviousVersionDueDate","enableViewOnlyReviewers","enableIntelligence","enableIntelligenceSmartTags","enableProofMagicAccess","enableIntelligenceSmartCheckCr","defaultGifOutput"]},"admin.team.features.sender-email.set":{version:2,method:"POST",path:"/api/admin/sender-email/set",body:["senderEmail"]},"integrations.get-setup-url":{method:"GET",path:"/api/integrations/setup_url",query:"params"},"integrations.get-proof-setup":{method:"GET",path:"/api/integrations/proof_setup",query:["integration_key","id"]},"integrations.get-configurations":{method:"GET",path:"/api/integrations/configuration",query:["level","integration_keys"]},"integrations.disable":{method:"POST",path:"/api/integrations/disable",query:["level","integration_key"]},"integrations.update-configuration":{version:2,method:"POST",path:"/api/integrations/configuration/update",body:["level","integrationKey","key","value"]},"integrations.get-available-reference-integrations":{method:"GET",path:"/api/integrations/reference/available_integrations"},"integrations.get-available-reference-options":{method:"GET",path:"/api/integrations/reference/options",query:"params"},"integrations.load-reference-additional-information":{method:"GET",path:"/api/integrations/reference/additional_information",query:"params"},"integrations.proof-integration-references.add":{version:2,method:"POST",path:"/api/integrations/reference/proof_integration_references",body:["proofId","integrationReference"]},"integrations.proof-integration-references.remove":{version:2,method:"POST",path:"/api/integrations/reference/proof_integration_references/remove",body:["proofId","referenceId"]},"admin.team.preferences.notifications.load":{method:"GET",path:"/api/admin/preferences/notifications",trailing:!0},"admin.team.preferences.notifications.set":{method:"POST",path:"/api/admin/preferences/notifications/set",body:["ownerAddedByAdmin"]},"admin.team.workflows.owned":{method:"GET",path:"/api/admin/workflows/templates"},"admin.team.workflows.owned.email-list":{method:"GET",path:"/api/admin/workflows/templates/emaillist"},"admin.team.custom-tools.load":{method:"GET",path:"/api/custom-tools/admin/team"},"admin.team.custom-tools.update":{version:2,method:"PATCH",path:"/api/custom-tools/admin/team",body:"updates"},"sessions.check":{method:"GET",path:"/api/sessions/check"},"sso.get-public-key":{method:"GET",path:"/sso/public_key",anonymous:!0},"sso.get-session":{version:2,method:"POST",path:"/sso/session",body:["nonce"],anonymous:!0,credentials:!0},"sso.get-login-options":{version:2,method:"POST",path:"/sso/login_options",body:["email"],anonymous:!0},"sso.initiate-login":{version:2,method:"POST",path:"/sso/initiate_login",body:["email","sessionId","source"],anonymous:!0},"sso.get-isolated-login-status":{version:2,method:"POST",path:"/sso/isolated/status",body:["email","sessionId","applicationId"],anonymous:!0},"sso.get-isolated-login-session":{version:2,method:"POST",path:"/sso/isolated/session",body:["sessionId","applicationId","encryptedSessionToken","nonce"],anonymous:!0},"mfa.setup":{method:"POST",path:"/api/users/mfa/setup"},"mfa.enable":{method:"POST",path:"/api/users/mfa/enable",body:["totp"]},"mfa.remove":{method:"POST",path:"/api/users/mfa/remove",body:["password"]},"reminders.add":{version:2,method:"POST",path:"/api/reminders/add",body:["entityId","reminders"]},"reminders.update":{version:2,method:"POST",path:"/api/reminders/update",body:["reminderId","relativeDate"]},"reminders.delete":{version:2,method:"POST",path:"/api/reminders/delete",body:["reminderIds"]},"reminders.all":{version:2,method:"GET",path:"/api/reminders/list",chain:["entityId"]},"reminders.set":{version:2,method:"POST",path:"/api/reminders/list",chain:["entityId","reminders"]},"proofs.audit.summary":{version:2,method:"GET",path:"/api/proofs/audit/summary",chain:["proofId"]},"brian.rekey-users-proofs":{version:2,method:"GET",path:"/api/brian/rekey/proofs",chain:["userId"]},"live.generate-access-token":{version:2,method:"GET",path:"/api/users/live/token"},"reports.create":{version:2,method:"POST",path:"/api/reports",body:!0},"reports.configurations":{version:2,method:"GET",path:"/api/reports/configurations"},"printing.create":{version:2,method:"POST",body:!0,path:"/api/print"},"printing.options":{version:2,method:"GET",query:["proofId"],path:"/api/print/options"},"teams.invitations.info":{version:2,method:"GET",path:"/api/teams/invitations/info",chain:["invitationId"]},"teams.invitations.accept":{version:2,method:"POST",path:"/api/teams/invitations/accept",chain:["invitationId"]},"teams.invitations.decline":{version:2,method:"POST",path:"/api/teams/invitations/decline",chain:["invitationId"]},"scim.admin.settings":{method:"GET",path:"/api/scim/admin/settings"},"scim.admin.enable":{method:"POST",path:"/api/scim/admin/enable"},"scim.admin.disable":{method:"POST",path:"/api/scim/admin/disable"},"scim.admin.regenerate-access-token":{version:2,method:"POST",path:"/api/scim/admin/regenerate-access-token",body:["type"]},"proofs.custom-tools.load":{method:"GET",path:"/api/custom-tools/proof",chain:["proofId"]},"proofs.custom-tools.update":{version:2,method:"PATCH",path:"/api/custom-tools/proof",chain:["proofId"],body:"updates"},"proofs.custom-tools.validate":{version:2,method:"POST",path:"/api/custom-tools/validate",body:"schema"},"email.proofs.generate":{version:2,method:"POST",path:"/api/email-upload/email-address",body:!0},"proofs.link-check.results":{version:2,method:"GET",chain:["proofId"],path:"/api/link-check/results"},"proofs.link-check.recheck":{version:2,method:"POST",body:["proofId"],path:"/api/link-check/recheck"},"free-trial.request-team":{version:2,method:"POST",path:"/api/free-trial/request/team",body:!0},"proofs.send-share-link":{version:2,method:"POST",path:"/api/public-proofs/proof/send-share-link",body:["proofId","message","emailAddresses"]},graphql:{version:2,method:"POST",path:"/spider/graphql",body:!0}}},function(e,t,r){"use strict";t.__esModule=!0;var n=Object.prototype.toString;t.default=function(e){return n.call(e)}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=r(16),a=n(i),s=r(95),u=r(5),c=r(17),l=n(c),f=r(42),p=function(){function e(){o(this,e),this.error=!1,this.code=-1,this.data=null,this.message=null,this.deprecated=null}return e.parse=function(t){var r=t.status,n=t.headers,o=void 0===n?{}:n,i=t.body,c=new e;if(r===s.TOO_MANY_REQUESTS_STATUS)return c.error=!0,c.message="Too many requests. Unable to process request due to high volume of requests from your application.",c.code=a.default.ERROR_THROTTLED,c.data={timeout:1e3*(parseFloat(o[u.RETRY_AFTER_HEADER])||60)},c;if((0,l.default)(o,"deprecated")&&(c.deprecated=o.deprecated),r===s.OK_STATUS&&!i)return c.code=a.default.OK,c;try{var p=JSON.parse(i);if("string"==typeof p||(p&&"ResponseCode"in p?(c.code=p.ResponseCode,c.code!==a.default.OK&&(c.error=!0)):p.Message&&1===Object.keys(p).length?(c.error=!0,c.code=a.default.ERROR_CRITICAL):"boolean"==typeof p.success&&p.message&&(c.error=!1===p.success,c.code=r,c.message=p.message)),c.error){var d="Response returned with the response code: "+c.code+". Please check SDK error documentation for details.",h=(0,f.getErrorMessage)(c.code,d);c.message=c.message||h}c.data=p}catch(e){c.error=!0}return c},e}();t.default=p},function(e,t,r){"use strict";t.__esModule=!0;t.TOO_MANY_REQUESTS_STATUS=429,t.OK_STATUS=200},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=r(0),u=n(s),c=r(18),l=n(c),f=r(97),p=n(f),d=r(107),h=n(d),y=function(e){function t(r){o(this,t);var n=i(this,e.call(this,r));return n.sso=new p.default(r),n.mfa=new h.default(r),n}return a(t,e),t.prototype._generateCredentials=function(e){var t=this;return this.client.crypto().generatePasswordHash(e).then(function(e){return Promise.all([e,t.client.crypto().generateKeyPair()])}).then(function(r){var n=r[0],o=r[1];return Promise.all([n,o,t.client.crypto().encryptPrivateKey(o.privateKeyPEM,e)])})},t.prototype.register=function(e,t){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return"string"==typeof n&&(console.warn("Warning: Passing the user's activation code during account creation has been moved into an options object. For compatibility reasons, the legacy behaviour still functions as expected, but please update your code as this will be changed in a future version."),n={activationCode:n}),this._generateCredentials(t).then(function(t){var o=t[0],i=t[1],a=t[2];return Promise.all([i,r.client.request("accounts.register",{email:e,password:o,privateKey:a,publicKey:i.publicKeyPEM,referrer:n.referrer})])}).then(function(n){var o=n[0];return Promise.all([o,r.login(e,t,void 0,!1)])}).then(function(e){var t=e[0],o=e[1];return Promise.all([t,o,n.activationCode?r.activate(n.activationCode).catch(function(){return r.generateActivationCode()}):r.generateActivationCode()])}).then(function(e){var t=e[0],r=e[1];return r.privateKeyPEM=t.privateKeyPEM,r})},t.prototype.generateActivationCode=function(){return this.client.request("accounts.generate-activation-code",{userId:this.client.session.userId})},t.prototype.activate=function(e){var t=this;return this.client.request("accounts.activate",{userId:this.client.session.userId,authCode:e}).then(function(){t.client.session.user.hasActivated=!0})},t.prototype.login=function(e,t,r){var n=this,o=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];return this.client.crypto().generatePasswordHash(t).then(function(t){return n.client.request("accounts.login",{email:e,password:t,totp:r})}).then(function(t){var r=(new l.default).fromSession(t.data);return r.user.email=e,r}).then(function(e){return o?n.client.crypto().decryptPrivateKey(e.privateKeyPEM$,t).then(function(t){return e.privateKeyPEM=t,e}):e}).then(function(e){return n.client.setSession(e),e})},t.prototype.resetPassword=function(e){var t=this,r=e.email,n=e.code,o=e.password;return this._generateCredentials(o).then(function(e){var o=e[0],i=e[1],a=e[2];return Promise.all([i,t.client.request("accounts.reset-password",{email:r,secret:n,newPassword:o,newPrivateKey:a,newPublicKey:i.publicKeyPEM})])}).then(function(e){var n=e[0];return Promise.all([n,t.login(r,o,void 0,!1)])}).then(function(e){var t=e[0],r=e[1];return r.privateKeyPEM=t.privateKeyPEM,r})},t.prototype.forgotPassword=function(e){return this.client.request("accounts.forgot-password",{email:e})},t.prototype.setPasswordRequest=function(e){return this.client.request("accounts.set-password-request",{email:e})},t.prototype.setPassword=function(e){var t=this,r=e.email,n=e.code,o=e.password;return this._generateCredentials(o).then(function(e){var o=e[0],i=e[1],a=e[2];return Promise.all([i,t.client.request("accounts.set-password",{email:r,secret:n,newPassword:o,newPrivateKey:a,newPublicKey:i.publicKeyPEM})])}).then(function(e){var n=e[0];return Promise.all([n,t.login(r,o,void 0,!1)])}).then(function(e){var t=e[0],r=e[1];return r.privateKeyPEM=t.privateKeyPEM,r})},t.prototype.logout=function(){var e=this;return this.client.request("accounts.logout").catch(function(t){return e.client.setSession(null),Promise.reject(t)}).then(function(){e.client.setSession(null)})},t}(u.default);t.default=y},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=r(43),u=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(s),c=r(0),l=n(c),f=r(18),p=n(f),d=r(106),h=n(d),y=function(e){function t(){return o(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.getSession=function(){var e=this;return this.client.request("sso.get-public-key").then(function(e){return e.data.ServerPublicKey}).then(function(t){return e.client.crypto().generateWrappedSymmetricKey(t)}).then(function(t){var r=t.key,n=t.key$;return Promise.all([r,e.client.request("sso.get-session",{nonce:n})])}).then(function(t){var r=t[0],n=t[1],o=(new p.default).fromSession(n.data);return Promise.all([o,e.client.crypto().decryptManagedPrivateKey(o.privateKeyPEM$,r)])}).then(function(e){var t=e[0],r=e[1];return t.privateKeyPEM=r,t})},t.prototype.getLoginOptions=function(e){return this.client.request("sso.get-login-options",{email:e}).then(function(e){return e.data})},t.prototype.initiateLogin=function(e,t,r){return this.client.request("sso.initiate-login",{email:e,sessionId:t,source:r}).then(function(e){return e.data})},t.prototype.getIsolatedLoginStatus=function(e,t,r){var n=this;if(!h.default)throw new Error("ISOLATED_AUTH_PRIVATE_KEY is not set");if(!e||!t||!r)throw new Error("Missing required parameters");return this.client.request("sso.get-isolated-login-status",{email:e,sessionId:t,applicationId:r}).catch(function(e){throw new Error("Error getting isolated login status: "+e.message)}).then(function(e){var t=e.data;if(t.encryptedSessionToken){var r=void 0;try{r=JSON.parse(u.util.decode64(t.nonce))}catch(e){throw new Error("Error decoding / parsing nonce: "+e.message)}return n.client.crypto().decryptSessionToken(t.encryptedSessionToken,h.default).catch(function(e){throw new Error("Error decrypting session token: "+e.message)}).then(function(e){var t=void 0;try{t=n.client.crypto().encryptSessionToken(e,r)}catch(e){throw new Error("Error re-encrypting session token: "+e.message)}return t}).then(function(e){return{success:!0,status:t.status,sessionToken:e}})}return t})},t.prototype.getIsolatedLoginSession=function(e,t,r){var n=this;if(!h.default)throw new Error("ISOLATED_AUTH_PRIVATE_KEY is not set");if(!e||!t||!r)throw new Error("Missing required parameters");return this.client.request("sso.get-public-key").catch(function(e){throw new Error("Error getting public key: "+e.message)}).then(function(e){return n.client.crypto().generateWrappedSymmetricKey(e.data.ServerPublicKey)}).catch(function(e){throw new Error("Error generating wrapped symmetric key: "+e.message)}).then(function(o){var i=o.key,a=o.key$;return Promise.all([i,n.client.request("sso.get-isolated-login-session",{sessionId:e,applicationId:t,encryptedSessionToken:r,nonce:a})])}).catch(function(e){throw new Error("Error getting isolated login session: "+e.message)}).then(function(e){var t=e[0],r=e[1];return Promise.all([t,n.client.crypto().decryptSessionData(r.data.encryptedSession,h.default)])}).catch(function(e){throw new Error("Error decrypting session data: "+e.message)}).then(function(e){var t=e[0],r=e[1],o=void 0;try{o=(new p.default).fromSession(JSON.parse(r))}catch(e){throw new Error("Error parsing session data: "+e.message)}return Promise.all([o,n.client.crypto().decryptManagedPrivateKey(o.privateKeyPEM$,t).catch(function(e){throw new Error("Error decrypting managed private key: "+e.message)})])}).then(function(e){var t=e[0],r=e[1];return t.privateKeyPEM=r,t})},t}(l.default);t.default=y},function(e,t,r){function n(e,t,r){var n=t.entity===c.tls.ConnectionEnd.client;e.read.cipherState={init:!1,cipher:c.cipher.createDecipher("AES-CBC",n?r.keys.server_write_key:r.keys.client_write_key),iv:n?r.keys.server_write_IV:r.keys.client_write_IV},e.write.cipherState={init:!1,cipher:c.cipher.createCipher("AES-CBC",n?r.keys.client_write_key:r.keys.server_write_key),iv:n?r.keys.client_write_IV:r.keys.server_write_IV},e.read.cipherFunction=s,e.write.cipherFunction=o,e.read.macLength=e.write.macLength=r.mac_length,e.read.macFunction=e.write.macFunction=l.hmac_sha1}function o(e,t){var r=!1,n=t.macFunction(t.macKey,t.sequenceNumber,e);e.fragment.putBytes(n),t.updateSequenceNumber();var o;o=e.version.minor===l.Versions.TLS_1_0.minor?t.cipherState.init?null:t.cipherState.iv:c.random.getBytesSync(16),t.cipherState.init=!0;var a=t.cipherState.cipher;return a.start({iv:o}),e.version.minor>=l.Versions.TLS_1_1.minor&&a.output.putBytes(o),a.update(e.fragment),a.finish(i)&&(e.fragment=a.output,e.length=e.fragment.length(),r=!0),r}function i(e,t,r){if(!r){var n=e-t.length()%e;t.fillWithByte(n-1,n)}return!0}function a(e,t,r){var n=!0;if(r){for(var o=t.length(),i=t.last(),a=o-1-i;a<o-1;++a)n=n&&t.at(a)==i;n&&t.truncate(i+1)}return n}function s(e,t){var r=!1;++f;var n;n=e.version.minor===l.Versions.TLS_1_0.minor?t.cipherState.init?null:t.cipherState.iv:e.fragment.getBytes(16),t.cipherState.init=!0;var o=t.cipherState.cipher;o.start({iv:n}),o.update(e.fragment),r=o.finish(a);var i=t.macLength,s=c.random.getBytesSync(i),p=o.output.length();p>=i?(e.fragment=o.output.getBytes(p-i),s=o.output.getBytes(i)):e.fragment=o.output.getBytes(),e.fragment=c.util.createBuffer(e.fragment),e.length=e.fragment.length();var d=t.macFunction(t.macKey,t.sequenceNumber,e);return t.updateSequenceNumber(),r=u(t.macKey,s,d)&&r}function u(e,t,r){var n=c.hmac.create();return n.start("SHA1",e),n.update(t),t=n.digest().getBytes(),n.start(null,null),n.update(r),r=n.digest().getBytes(),t===r}var c=r(1);r(10),r(45);var l=e.exports=c.tls;l.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=l.BulkCipherAlgorithm.aes,e.cipher_type=l.CipherType.block,e.enc_key_length=16,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=l.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n},l.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=l.BulkCipherAlgorithm.aes,e.cipher_type=l.CipherType.block,e.enc_key_length=32,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=l.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n};var f=0},function(e,t,r){var n=r(1);r(56),e.exports=n.mgf=n.mgf||{},n.mgf.mgf1=n.mgf1},function(e,t,r){function n(e,t,r,n){e.generate=function(e,i){for(var a=new o.util.ByteBuffer,s=Math.ceil(i/n)+r,u=new o.util.ByteBuffer,c=r;c<s;++c){u.putInt32(c),t.start(),t.update(e+u.getBytes());var l=t.digest();a.putBytes(l.getBytes(n))}return a.truncate(a.length()-i),a.getBytes()}}var o=r(1);r(2),r(6),r(31),e.exports=o.kem=o.kem||{};var i=o.jsbn.BigInteger;o.kem.rsa={},o.kem.rsa.create=function(e,t){t=t||{};var r=t.prng||o.random,n={};return n.encrypt=function(t,n){var a,s=Math.ceil(t.n.bitLength()/8);do{a=new i(o.util.bytesToHex(r.getBytesSync(s)),16).mod(t.n)}while(a.equals(i.ZERO));a=o.util.hexToBytes(a.toString(16));var u=s-a.length;return u>0&&(a=o.util.fillString(String.fromCharCode(0),u)+a),{encapsulation:t.encrypt(a,"NONE"),key:e.generate(a,n)}},n.decrypt=function(t,r,n){var o=t.decrypt(r,"NONE");return e.generate(o,n)},n},o.kem.kdf1=function(e,t){n(this,e,0,t||e.digestLength)},o.kem.kdf2=function(e,t){n(this,e,1,t||e.digestLength)}},function(e,t,r){e.exports=r(8),r(29),r(15),r(49),r(102)},function(e,t,r){function n(){u=String.fromCharCode(128),u+=i.util.fillString(String.fromCharCode(0),128),l=[[1116352408,3609767458],[1899447441,602891725],[3049323471,3964484399],[3921009573,2173295548],[961987163,4081628472],[1508970993,3053834265],[2453635748,2937671579],[2870763221,3664609560],[3624381080,2734883394],[310598401,1164996542],[607225278,1323610764],[1426881987,3590304994],[1925078388,4068182383],[2162078206,991336113],[2614888103,633803317],[3248222580,3479774868],[3835390401,2666613458],[4022224774,944711139],[264347078,2341262773],[604807628,2007800933],[770255983,1495990901],[1249150122,1856431235],[1555081692,3175218132],[1996064986,2198950837],[2554220882,3999719339],[2821834349,766784016],[2952996808,2566594879],[3210313671,3203337956],[3336571891,1034457026],[3584528711,2466948901],[113926993,3758326383],[338241895,168717936],[666307205,1188179964],[773529912,1546045734],[1294757372,1522805485],[1396182291,2643833823],[1695183700,2343527390],[1986661051,1014477480],[2177026350,1206759142],[2456956037,344077627],[2730485921,1290863460],[2820302411,3158454273],[3259730800,3505952657],[3345764771,106217008],[3516065817,3606008344],[3600352804,1432725776],[4094571909,1467031594],[275423344,851169720],[430227734,3100823752],[506948616,1363258195],[659060556,3750685593],[883997877,3785050280],[958139571,3318307427],[1322822218,3812723403],[1537002063,2003034995],[1747873779,3602036899],[1955562222,1575990012],[2024104815,1125592928],[2227730452,2716904306],[2361852424,442776044],[2428436474,593698344],[2756734187,3733110249],[3204031479,2999351573],[3329325298,3815920427],[3391569614,3928383900],[3515267271,566280711],[3940187606,3454069534],[4118630271,4000239992],[116418474,1914138554],[174292421,2731055270],[289380356,3203993006],[460393269,320620315],[685471733,587496836],[852142971,1086792851],[1017036298,365543100],[1126000580,2618297676],[1288033470,3409855158],[1501505948,4234509866],[1607167915,987167468],[1816402316,1246189591]],f={},f["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],f["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],f["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],f["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],c=!0}function o(e,t,r){for(var n,o,i,a,s,u,c,f,p,d,h,y,m,g,v,b,E,C,_,w,T,S,I,A,k,B,R,P,O,D,N,L,U,x,M,V=r.length();V>=128;){for(O=0;O<16;++O)t[O][0]=r.getInt32()>>>0,t[O][1]=r.getInt32()>>>0;for(;O<80;++O)L=t[O-2],D=L[0],N=L[1],n=((D>>>19|N<<13)^(N>>>29|D<<3)^D>>>6)>>>0,o=((D<<13|N>>>19)^(N<<3|D>>>29)^(D<<26|N>>>6))>>>0,x=t[O-15],D=x[0],N=x[1],i=((D>>>1|N<<31)^(D>>>8|N<<24)^D>>>7)>>>0,a=((D<<31|N>>>1)^(D<<24|N>>>8)^(D<<25|N>>>7))>>>0,U=t[O-7],M=t[O-16],N=o+U[1]+a+M[1],t[O][0]=n+U[0]+i+M[0]+(N/4294967296>>>0)>>>0,t[O][1]=N>>>0;for(m=e[0][0],g=e[0][1],v=e[1][0],b=e[1][1],E=e[2][0],C=e[2][1],_=e[3][0],w=e[3][1],T=e[4][0],S=e[4][1],I=e[5][0],A=e[5][1],k=e[6][0],B=e[6][1],R=e[7][0],P=e[7][1],O=0;O<80;++O)c=((T>>>14|S<<18)^(T>>>18|S<<14)^(S>>>9|T<<23))>>>0,f=((T<<18|S>>>14)^(T<<14|S>>>18)^(S<<23|T>>>9))>>>0,p=(k^T&(I^k))>>>0,d=(B^S&(A^B))>>>0,s=((m>>>28|g<<4)^(g>>>2|m<<30)^(g>>>7|m<<25))>>>0,u=((m<<4|g>>>28)^(g<<30|m>>>2)^(g<<25|m>>>7))>>>0,h=(m&v|E&(m^v))>>>0,y=(g&b|C&(g^b))>>>0,N=P+f+d+l[O][1]+t[O][1],n=R+c+p+l[O][0]+t[O][0]+(N/4294967296>>>0)>>>0,o=N>>>0,N=u+y,i=s+h+(N/4294967296>>>0)>>>0,a=N>>>0,R=k,P=B,k=I,B=A,I=T,A=S,N=w+o,T=_+n+(N/4294967296>>>0)>>>0,S=N>>>0,_=E,w=C,E=v,C=b,v=m,b=g,N=o+a,m=n+i+(N/4294967296>>>0)>>>0,g=N>>>0;N=e[0][1]+g,e[0][0]=e[0][0]+m+(N/4294967296>>>0)>>>0,e[0][1]=N>>>0,N=e[1][1]+b,e[1][0]=e[1][0]+v+(N/4294967296>>>0)>>>0,e[1][1]=N>>>0,N=e[2][1]+C,e[2][0]=e[2][0]+E+(N/4294967296>>>0)>>>0,e[2][1]=N>>>0,N=e[3][1]+w,e[3][0]=e[3][0]+_+(N/4294967296>>>0)>>>0,e[3][1]=N>>>0,N=e[4][1]+S,e[4][0]=e[4][0]+T+(N/4294967296>>>0)>>>0,e[4][1]=N>>>0,N=e[5][1]+A,e[5][0]=e[5][0]+I+(N/4294967296>>>0)>>>0,e[5][1]=N>>>0,N=e[6][1]+B,e[6][0]=e[6][0]+k+(N/4294967296>>>0)>>>0,e[6][1]=N>>>0,N=e[7][1]+P,e[7][0]=e[7][0]+R+(N/4294967296>>>0)>>>0,e[7][1]=N>>>0,V-=128}}var i=r(1);r(8),r(2);var a=e.exports=i.sha512=i.sha512||{};i.md.sha512=i.md.algorithms.sha512=a;var s=i.sha384=i.sha512.sha384=i.sha512.sha384||{};s.create=function(){return a.create("SHA-384")},i.md.sha384=i.md.algorithms.sha384=s,i.sha512.sha256=i.sha512.sha256||{create:function(){return a.create("SHA-512/256")}},i.md["sha512/256"]=i.md.algorithms["sha512/256"]=i.sha512.sha256,i.sha512.sha224=i.sha512.sha224||{create:function(){return a.create("SHA-512/224")}},i.md["sha512/224"]=i.md.algorithms["sha512/224"]=i.sha512.sha224,a.create=function(e){if(c||n(),void 0===e&&(e="SHA-512"),!(e in f))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=f[e],r=null,a=i.util.createBuffer(),s=new Array(80),l=0;l<80;++l)s[l]=new Array(2);var p=64;switch(e){case"SHA-384":p=48;break;case"SHA-512/256":p=32;break;case"SHA-512/224":p=28}var d={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:p,messageLength:0,fullMessageLength:null,messageLengthSize:16};return d.start=function(){d.messageLength=0,d.fullMessageLength=d.messageLength128=[];for(var e=d.messageLengthSize/4,n=0;n<e;++n)d.fullMessageLength.push(0);a=i.util.createBuffer(),r=new Array(t.length);for(var n=0;n<t.length;++n)r[n]=t[n].slice(0);return d},d.start(),d.update=function(e,t){"utf8"===t&&(e=i.util.encodeUtf8(e));var n=e.length;d.messageLength+=n,n=[n/4294967296>>>0,n>>>0];for(var u=d.fullMessageLength.length-1;u>=0;--u)d.fullMessageLength[u]+=n[1],n[1]=n[0]+(d.fullMessageLength[u]/4294967296>>>0),d.fullMessageLength[u]=d.fullMessageLength[u]>>>0,n[0]=n[1]/4294967296>>>0;return a.putBytes(e),o(r,s,a),(a.read>2048||0===a.length())&&a.compact(),d},d.digest=function(){var t=i.util.createBuffer();t.putBytes(a.bytes());var n=d.fullMessageLength[d.fullMessageLength.length-1]+d.messageLengthSize,c=n&d.blockLength-1;t.putBytes(u.substr(0,d.blockLength-c));for(var l,f,p=8*d.fullMessageLength[0],h=0;h<d.fullMessageLength.length-1;++h)l=8*d.fullMessageLength[h+1],f=l/4294967296>>>0,p+=f,t.putInt32(p>>>0),p=l>>>0;t.putInt32(p);for(var y=new Array(r.length),h=0;h<r.length;++h)y[h]=r[h].slice(0);o(y,s,t);var m,g=i.util.createBuffer();m="SHA-512"===e?y.length:"SHA-384"===e?y.length-2:y.length-4;for(var h=0;h<m;++h)g.putInt32(y[h][0]),h===m-1&&"SHA-512/224"===e||g.putInt32(y[h][1]);return g},d};var u=null,c=!1,l=null,f=null},function(e,t,r){function n(e){var t={},r=[];if(!h.validate(e,y.asn1.recipientInfoValidator,t,r)){var n=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw n.errors=r,n}return{version:t.version.charCodeAt(0),issuer:d.pki.RDNAttributesAsArray(t.issuer),serialNumber:d.util.createBuffer(t.serial).toHex(),encryptedContent:{algorithm:h.derToOid(t.encAlgorithm),parameter:t.encParameter.value,content:t.encKey}}}function o(e){return h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,h.integerToDer(e.version).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[d.pki.distinguishedNameToAsn1({attributes:e.issuer}),h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,d.util.hexToBytes(e.serialNumber))]),h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(e.encryptedContent.algorithm).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.NULL,!1,"")]),h.create(h.Class.UNIVERSAL,h.Type.OCTETSTRING,!1,e.encryptedContent.content)])}function i(e){for(var t=[],r=0;r<e.length;++r)t.push(n(e[r]));return t}function a(e){for(var t=[],r=0;r<e.length;++r)t.push(o(e[r]));return t}function s(e){var t=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,h.integerToDer(e.version).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[d.pki.distinguishedNameToAsn1({attributes:e.issuer}),h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,d.util.hexToBytes(e.serialNumber))]),h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(e.digestAlgorithm).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.NULL,!1,"")])]);if(e.authenticatedAttributesAsn1&&t.value.push(e.authenticatedAttributesAsn1),t.value.push(h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(e.signatureAlgorithm).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.NULL,!1,"")])),t.value.push(h.create(h.Class.UNIVERSAL,h.Type.OCTETSTRING,!1,e.signature)),e.unauthenticatedAttributes.length>0){for(var r=h.create(h.Class.CONTEXT_SPECIFIC,1,!0,[]),n=0;n<e.unauthenticatedAttributes.length;++n){var o=e.unauthenticatedAttributes[n];r.values.push(c(o))}t.value.push(r)}return t}function u(e){for(var t=[],r=0;r<e.length;++r)t.push(s(e[r]));return t}function c(e){var t;if(e.type===d.pki.oids.contentType)t=h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(e.value).getBytes());else if(e.type===d.pki.oids.messageDigest)t=h.create(h.Class.UNIVERSAL,h.Type.OCTETSTRING,!1,e.value.bytes());else if(e.type===d.pki.oids.signingTime){var r=new Date("1950-01-01T00:00:00Z"),n=new Date("2050-01-01T00:00:00Z"),o=e.value;if("string"==typeof o){var i=Date.parse(o);o=isNaN(i)?13===o.length?h.utcTimeToDate(o):h.generalizedTimeToDate(o):new Date(i)}t=o>=r&&o<n?h.create(h.Class.UNIVERSAL,h.Type.UTCTIME,!1,h.dateToUtcTime(o)):h.create(h.Class.UNIVERSAL,h.Type.GENERALIZEDTIME,!1,h.dateToGeneralizedTime(o))}return h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(e.type).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.SET,!0,[t])])}function l(e){return[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(d.pki.oids.data).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(e.algorithm).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.OCTETSTRING,!1,e.parameter.getBytes())]),h.create(h.Class.CONTEXT_SPECIFIC,0,!0,[h.create(h.Class.UNIVERSAL,h.Type.OCTETSTRING,!1,e.content.getBytes())])]}function f(e,t,r){var n={},o=[];if(!h.validate(t,r,n,o)){var i=new Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message.");throw i.errors=i,i}if(h.derToOid(n.contentType)!==d.pki.oids.data)throw new Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(n.encryptedContent){var a="";if(d.util.isArray(n.encryptedContent))for(var s=0;s<n.encryptedContent.length;++s){if(n.encryptedContent[s].type!==h.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");a+=n.encryptedContent[s].value}else a=n.encryptedContent;e.encryptedContent={algorithm:h.derToOid(n.encAlgorithm),parameter:d.util.createBuffer(n.encParameter.value),content:d.util.createBuffer(a)}}if(n.content){var a="";if(d.util.isArray(n.content))for(var s=0;s<n.content.length;++s){if(n.content[s].type!==h.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");a+=n.content[s].value}else a=n.content;e.content=d.util.createBuffer(a)}return e.version=n.version.charCodeAt(0),e.rawCapture=n,n}function p(e){if(void 0===e.encryptedContent.key)throw new Error("Symmetric key not available.");if(void 0===e.content){var t;switch(e.encryptedContent.algorithm){case d.pki.oids["aes128-CBC"]:case d.pki.oids["aes192-CBC"]:case d.pki.oids["aes256-CBC"]:t=d.aes.createDecryptionCipher(e.encryptedContent.key);break;case d.pki.oids.desCBC:case d.pki.oids["des-EDE3-CBC"]:t=d.des.createDecryptionCipher(e.encryptedContent.key);break;default:throw new Error("Unsupported symmetric cipher, OID "+e.encryptedContent.algorithm)}if(t.start(e.encryptedContent.parameter),t.update(e.encryptedContent.content),!t.finish())throw new Error("Symmetric decryption failed.");e.content=t.output}}var d=r(1);r(10),r(7),r(19),r(11),r(12),r(55),r(6),r(2),r(32);var h=d.asn1,y=e.exports=d.pkcs7=d.pkcs7||{};y.messageFromPem=function(e){var t=d.pem.decode(e)[0];if("PKCS7"!==t.type){var r=new Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');throw r.headerType=t.type,r}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");var n=h.fromDer(t.body);return y.messageFromAsn1(n)},y.messageToPem=function(e,t){var r={type:"PKCS7",body:h.toDer(e.toAsn1()).getBytes()};return d.pem.encode(r,{maxline:t})},y.messageFromAsn1=function(e){var t={},r=[];if(!h.validate(e,y.asn1.contentInfoValidator,t,r)){var n=new Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo.");throw n.errors=r,n}var o,i=h.derToOid(t.contentType);switch(i){case d.pki.oids.envelopedData:o=y.createEnvelopedData();break;case d.pki.oids.encryptedData:o=y.createEncryptedData();break;case d.pki.oids.signedData:o=y.createSignedData();break;default:throw new Error("Cannot read PKCS#7 message. ContentType with OID "+i+" is not (yet) supported.")}return o.fromAsn1(t.content.value[0]),o},y.createSignedData=function(){function e(){for(var e={},t=0;t<r.signers.length;++t){var n=r.signers[t],o=n.digestAlgorithm;o in e||(e[o]=d.md[d.pki.oids[o]].create()),0===n.authenticatedAttributes.length?n.md=e[o]:n.md=d.md[d.pki.oids[o]].create()}r.digestAlgorithmIdentifiers=[];for(var o in e)r.digestAlgorithmIdentifiers.push(h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(o).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.NULL,!1,"")]));return e}function t(e){if(r.contentInfo.value.length<2)throw new Error("Could not sign PKCS#7 message; there is no content to sign.");var t=h.derToOid(r.contentInfo.value[0].value),n=r.contentInfo.value[1];n=n.value[0];var o=h.toDer(n);o.getByte(),h.getBerValueLength(o),o=o.getBytes();for(var i in e)e[i].start().update(o);for(var a=new Date,s=0;s<r.signers.length;++s){var l=r.signers[s];if(0===l.authenticatedAttributes.length){if(t!==d.pki.oids.data)throw new Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.")}else{l.authenticatedAttributesAsn1=h.create(h.Class.CONTEXT_SPECIFIC,0,!0,[]);for(var f=h.create(h.Class.UNIVERSAL,h.Type.SET,!0,[]),p=0;p<l.authenticatedAttributes.length;++p){var y=l.authenticatedAttributes[p];y.type===d.pki.oids.messageDigest?y.value=e[l.digestAlgorithm].digest():y.type===d.pki.oids.signingTime&&(y.value||(y.value=a)),f.value.push(c(y)),l.authenticatedAttributesAsn1.value.push(c(y))}o=h.toDer(f).getBytes(),l.md.start().update(o)}l.signature=l.key.sign(l.md,"RSASSA-PKCS1-V1_5")}r.signerInfos=u(r.signers)}var r=null;return r={type:d.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(e){f(r,e,y.asn1.signedDataValidator),r.certificates=[],r.crls=[],r.digestAlgorithmIdentifiers=[],r.contentInfo=null,r.signerInfos=[];for(var t=r.rawCapture.certificates.value,n=0;n<t.length;++n)r.certificates.push(d.pki.certificateFromAsn1(t[n]))},toAsn1:function(){r.contentInfo||r.sign();for(var e=[],t=0;t<r.certificates.length;++t)e.push(d.pki.certificateToAsn1(r.certificates[t]));var n=[],o=h.create(h.Class.CONTEXT_SPECIFIC,0,!0,[h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,h.integerToDer(r.version).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.SET,!0,r.digestAlgorithmIdentifiers),r.contentInfo])]);return e.length>0&&o.value[0].value.push(h.create(h.Class.CONTEXT_SPECIFIC,0,!0,e)),n.length>0&&o.value[0].value.push(h.create(h.Class.CONTEXT_SPECIFIC,1,!0,n)),o.value[0].value.push(h.create(h.Class.UNIVERSAL,h.Type.SET,!0,r.signerInfos)),h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(r.type).getBytes()),o])},addSigner:function(e){var t=e.issuer,n=e.serialNumber;if(e.certificate){var o=e.certificate;"string"==typeof o&&(o=d.pki.certificateFromPem(o)),t=o.issuer.attributes,n=o.serialNumber}var i=e.key;if(!i)throw new Error("Could not add PKCS#7 signer; no private key specified.");"string"==typeof i&&(i=d.pki.privateKeyFromPem(i));var a=e.digestAlgorithm||d.pki.oids.sha1;switch(a){case d.pki.oids.sha1:case d.pki.oids.sha256:case d.pki.oids.sha384:case d.pki.oids.sha512:case d.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+a)}var s=e.authenticatedAttributes||[];if(s.length>0){for(var u=!1,c=!1,l=0;l<s.length;++l){var f=s[l];if(u||f.type!==d.pki.oids.contentType){if(c||f.type!==d.pki.oids.messageDigest);else if(c=!0,u)break}else if(u=!0,c)break}if(!u||!c)throw new Error("Invalid signer.authenticatedAttributes. If signer.authenticatedAttributes is specified, then it must contain at least two attributes, PKCS #9 content-type and PKCS #9 message-digest.")}r.signers.push({key:i,version:1,issuer:t,serialNumber:n,digestAlgorithm:a,signatureAlgorithm:d.pki.oids.rsaEncryption,signature:null,authenticatedAttributes:s,unauthenticatedAttributes:[]})},sign:function(){if(("object"!=typeof r.content||null===r.contentInfo)&&(r.contentInfo=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(d.pki.oids.data).getBytes())]),"content"in r)){var n;r.content instanceof d.util.ByteBuffer?n=r.content.bytes():"string"==typeof r.content&&(n=d.util.encodeUtf8(r.content)),r.contentInfo.value.push(h.create(h.Class.CONTEXT_SPECIFIC,0,!0,[h.create(h.Class.UNIVERSAL,h.Type.OCTETSTRING,!1,n)]))}if(0!==r.signers.length){t(e())}},verify:function(){throw new Error("PKCS#7 signature verification not yet implemented.")},addCertificate:function(e){"string"==typeof e&&(e=d.pki.certificateFromPem(e)),r.certificates.push(e)},addCertificateRevokationList:function(e){throw new Error("PKCS#7 CRL support not yet implemented.")}}},y.createEncryptedData=function(){var e=null;return e={type:d.pki.oids.encryptedData,version:0,encryptedContent:{algorithm:d.pki.oids["aes256-CBC"]},fromAsn1:function(t){f(e,t,y.asn1.encryptedDataValidator)},decrypt:function(t){void 0!==t&&(e.encryptedContent.key=t),p(e)}}},y.createEnvelopedData=function(){var e=null;return e={type:d.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:d.pki.oids["aes256-CBC"]},fromAsn1:function(t){var r=f(e,t,y.asn1.envelopedDataValidator);e.recipients=i(r.recipientInfos.value)},toAsn1:function(){return h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(e.type).getBytes()),h.create(h.Class.CONTEXT_SPECIFIC,0,!0,[h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,h.integerToDer(e.version).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.SET,!0,a(e.recipients)),h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,l(e.encryptedContent))])])])},findRecipient:function(t){for(var r=t.issuer.attributes,n=0;n<e.recipients.length;++n){var o=e.recipients[n],i=o.issuer;if(o.serialNumber===t.serialNumber&&i.length===r.length){for(var a=!0,s=0;s<r.length;++s)if(i[s].type!==r[s].type||i[s].value!==r[s].value){a=!1;break}if(a)return o}}return null},decrypt:function(t,r){if(void 0===e.encryptedContent.key&&void 0!==t&&void 0!==r)switch(t.encryptedContent.algorithm){case d.pki.oids.rsaEncryption:case d.pki.oids.desCBC:var n=r.decrypt(t.encryptedContent.content);e.encryptedContent.key=d.util.createBuffer(n);break;default:throw new Error("Unsupported asymmetric cipher, OID "+t.encryptedContent.algorithm)}p(e)},addRecipient:function(t){e.recipients.push({version:0,issuer:t.issuer.attributes,serialNumber:t.serialNumber,encryptedContent:{algorithm:d.pki.oids.rsaEncryption,key:t.publicKey}})},encrypt:function(t,r){if(void 0===e.encryptedContent.content){r=r||e.encryptedContent.algorithm,t=t||e.encryptedContent.key;var n,o,i;switch(r){case d.pki.oids["aes128-CBC"]:n=16,o=16,i=d.aes.createEncryptionCipher;break;case d.pki.oids["aes192-CBC"]:n=24,o=16,i=d.aes.createEncryptionCipher;break;case d.pki.oids["aes256-CBC"]:n=32,o=16,i=d.aes.createEncryptionCipher;break;case d.pki.oids["des-EDE3-CBC"]:n=24,o=8,i=d.des.createEncryptionCipher;break;default:throw new Error("Unsupported symmetric cipher, OID "+r)}if(void 0===t)t=d.util.createBuffer(d.random.getBytes(n));else if(t.length()!=n)throw new Error("Symmetric key has wrong length; got "+t.length()+" bytes, expected "+n+".");e.encryptedContent.algorithm=r,e.encryptedContent.key=t,e.encryptedContent.parameter=d.util.createBuffer(d.random.getBytes(o));var a=i(t);if(a.start(e.encryptedContent.parameter.copy()),a.update(e.content),!a.finish())throw new Error("Symmetric encryption failed.");e.encryptedContent.content=a.output}for(var s=0;s<e.recipients.length;++s){var u=e.recipients[s];if(void 0===u.encryptedContent.content)switch(u.encryptedContent.algorithm){case d.pki.oids.rsaEncryption:u.encryptedContent.content=u.encryptedContent.key.encrypt(e.encryptedContent.key.data);break;default:throw new Error("Unsupported asymmetric cipher, OID "+u.encryptedContent.algorithm)}}}}}},function(e,t,r){function n(e,t){var r=t.toString(16);r[0]>="8"&&(r="00"+r);var n=a.util.hexToBytes(r);e.putInt32(n.length),e.putBytes(n)}function o(e,t){e.putInt32(t.length),e.putString(t)}function i(){for(var e=a.md.sha1.create(),t=arguments.length,r=0;r<t;++r)e.update(arguments[r]);return e.digest()}var a=r(1);r(10),r(14),r(29),r(15),r(2);var s=e.exports=a.ssh=a.ssh||{};s.privateKeyToPutty=function(e,t,r){r=r||"",t=t||"";var s=""===t?"none":"aes256-cbc",u="PuTTY-User-Key-File-2: ssh-rsa\r\n";u+="Encryption: "+s+"\r\n",u+="Comment: "+r+"\r\n";var c=a.util.createBuffer();o(c,"ssh-rsa"),n(c,e.e),n(c,e.n);var l=a.util.encode64(c.bytes(),64),f=Math.floor(l.length/66)+1;u+="Public-Lines: "+f+"\r\n",u+=l;var p=a.util.createBuffer();n(p,e.d),n(p,e.p),n(p,e.q),n(p,e.qInv);var d;if(t){var h=p.length()+16-1;h-=h%16;var y=i(p.bytes());y.truncate(y.length()-h+p.length()),p.putBuffer(y);var m=a.util.createBuffer();m.putBuffer(i("\0\0\0\0",t)),m.putBuffer(i("\0\0\0",t));var g=a.aes.createEncryptionCipher(m.truncate(8),"CBC");g.start(a.util.createBuffer().fillWithByte(0,16)),g.update(p.copy()),g.finish();var v=g.output;v.truncate(16),d=a.util.encode64(v.bytes(),64)}else d=a.util.encode64(p.bytes(),64);f=Math.floor(d.length/66)+1,u+="\r\nPrivate-Lines: "+f+"\r\n",u+=d;var b=i("putty-private-key-file-mac-key",t),E=a.util.createBuffer();o(E,"ssh-rsa"),o(E,s),o(E,r),E.putInt32(c.length()),E.putBuffer(c),E.putInt32(p.length()),E.putBuffer(p);var C=a.hmac.create();return C.start("sha1",b),C.update(E.bytes()),u+="\r\nPrivate-MAC: "+C.digest().toHex()+"\r\n"},s.publicKeyToOpenSSH=function(e,t){t=t||"";var r=a.util.createBuffer();return o(r,"ssh-rsa"),n(r,e.e),n(r,e.n),"ssh-rsa "+a.util.encode64(r.bytes())+" "+t},s.privateKeyToOpenSSH=function(e,t){return t?a.pki.encryptRsaPrivateKey(e,t,{legacy:!0,algorithm:"aes128"}):a.pki.privateKeyToPem(e)},s.getPublicKeyFingerprint=function(e,t){t=t||{};var r=t.md||a.md.md5.create(),i=a.util.createBuffer();o(i,"ssh-rsa"),n(i,e.e),n(i,e.n),r.start(),r.update(i.getBytes());var s=r.digest();if("hex"===t.encoding){var u=s.toHex();return t.delimiter?u.match(/.{2}/g).join(t.delimiter):u}if("binary"===t.encoding)return s.getBytes();if(t.encoding)throw new Error('Unknown encoding "'+t.encoding+'".');return s}},function(e,t,r){var n=r(1);r(57),r(58),r(2);var o="forge.task",i={},a=0;n.debug.set(o,"tasks",i);var s={};n.debug.set(o,"queues",s);var u="ready",c="running",l="blocked",f="sleeping",p="done",d="error",h="stop",y="start",m={};m[u]={},m[u][h]=u,m[u][y]=c,m[u].cancel=p,m[u].fail=d,m[c]={},m[c][h]=u,m[c][y]=c,m[c].block=l,m[c].unblock=c,m[c].sleep=f,m[c].wakeup=c,m[c].cancel=p,m[c].fail=d,m[l]={},m[l][h]=l,m[l][y]=l,m[l].block=l,m[l].unblock=l,m[l].sleep=l,m[l].wakeup=l,m[l].cancel=p,m[l].fail=d,m[f]={},m[f][h]=f,m[f][y]=f,m[f].block=f,m[f].unblock=f,m[f].sleep=f,m[f].wakeup=f,m[f].cancel=p,m[f].fail=d,m[p]={},m[p][h]=p,m[p][y]=p,m[p].block=p,m[p].unblock=p,m[p].sleep=p,m[p].wakeup=p,m[p].cancel=p,m[p].fail=d,m[d]={},m[d][h]=d,m[d][y]=d,m[d].block=d,m[d].unblock=d,m[d].sleep=d,m[d].wakeup=d,m[d].cancel=d,m[d].fail=d;var g=function(e){this.id=-1,this.name=e.name||"?",this.parent=e.parent||null,this.run=e.run,this.subtasks=[],this.error=!1,this.state=u,this.blocks=0,this.timeoutId=null,this.swapTime=null,this.userData=null,this.id=a++,i[this.id]=this};g.prototype.debug=function(e){e=e||"",n.log.debug(o,e,"[%s][%s] task:",this.id,this.name,this,"subtasks:",this.subtasks.length,"queue:",s)},g.prototype.next=function(e,t){"function"==typeof e&&(t=e,e=this.name);var r=new g({run:t,name:e,parent:this});return r.state=c,r.type=this.type,r.successCallback=this.successCallback||null,r.failureCallback=this.failureCallback||null,this.subtasks.push(r),this},g.prototype.parallel=function(e,t){return n.util.isArray(e)&&(t=e,e=this.name),this.next(e,function(r){var o=r;o.block(t.length);for(var i=0;i<t.length;i++){var a=e+"__parallel-"+r.id+"-"+i,s=i;!function(e,r){n.task.start({type:e,run:function(e){t[r](e)},success:function(e){o.unblock()},failure:function(e){o.unblock()}})}(a,s)}})},g.prototype.stop=function(){this.state=m[this.state][h]},g.prototype.start=function(){this.error=!1,this.state=m[this.state][y],this.state===c&&(this.start=new Date,this.run(this),b(this,0))},g.prototype.block=function(e){e=void 0===e?1:e,this.blocks+=e,this.blocks>0&&(this.state=m[this.state].block)},g.prototype.unblock=function(e){return e=void 0===e?1:e,this.blocks-=e,0===this.blocks&&this.state!==p&&(this.state=c,b(this,0)),this.blocks},g.prototype.sleep=function(e){e=void 0===e?0:e,this.state=m[this.state].sleep;var t=this;this.timeoutId=setTimeout(function(){t.timeoutId=null,t.state=c,b(t,0)},e)},g.prototype.wait=function(e){e.wait(this)},g.prototype.wakeup=function(){this.state===f&&(cancelTimeout(this.timeoutId),this.timeoutId=null,this.state=c,b(this,0))},g.prototype.cancel=function(){this.state=m[this.state].cancel,this.permitsNeeded=0,null!==this.timeoutId&&(cancelTimeout(this.timeoutId),this.timeoutId=null),this.subtasks=[]},g.prototype.fail=function(e){if(this.error=!0,E(this,!0),e)e.error=this.error,e.swapTime=this.swapTime,e.userData=this.userData,b(e,0);else{if(null!==this.parent){for(var t=this.parent;null!==t.parent;)t.error=this.error,t.swapTime=this.swapTime,t.userData=this.userData,t=t.parent;E(t,!0)}this.failureCallback&&this.failureCallback(this)}};var v=function(e){e.error=!1,e.state=m[e.state][y],setTimeout(function(){e.state===c&&(e.swapTime=+new Date,e.run(e),b(e,0))},0)},b=function(e,t){var r=t>30||+new Date-e.swapTime>20,n=function(t){if(t++,e.state===c)if(r&&(e.swapTime=+new Date),e.subtasks.length>0){var n=e.subtasks.shift();n.error=e.error,n.swapTime=e.swapTime,n.userData=e.userData,n.run(n),n.error||b(n,t)}else E(e),e.error||null!==e.parent&&(e.parent.error=e.error,e.parent.swapTime=e.swapTime,e.parent.userData=e.userData,b(e.parent,t))};r?setTimeout(n,0):n(t)},E=function(e,t){e.state=p,delete i[e.id],null===e.parent&&(e.type in s?0===s[e.type].length?n.log.error(o,"[%s][%s] task queue empty [%s]",e.id,e.name,e.type):s[e.type][0]!==e?n.log.error(o,"[%s][%s] task not first in queue [%s]",e.id,e.name,e.type):(s[e.type].shift(),0===s[e.type].length?delete s[e.type]:s[e.type][0].start()):n.log.error(o,"[%s][%s] task queue missing [%s]",e.id,e.name,e.type),t||(e.error&&e.failureCallback?e.failureCallback(e):!e.error&&e.successCallback&&e.successCallback(e)))};e.exports=n.task=n.task||{},n.task.start=function(e){var t=new g({run:e.run,name:e.name||"?"});t.type=e.type,t.successCallback=e.success||null,t.failureCallback=e.failure||null,t.type in s?s[e.type].push(t):(s[t.type]=[t],v(t))},n.task.cancel=function(e){e in s&&(s[e]=[s[e][0]])},n.task.createCondition=function(){var e={tasks:{}};return e.wait=function(t){t.id in e.tasks||(t.block(),e.tasks[t.id]=t)},e.notify=function(){var t=e.tasks;e.tasks={};for(var r in t)t[r].unblock()},e}},function(e,t,r){"use strict";t.__esModule=!0;var n=r(43),o=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(n),i=function(){try{if("undefined"!=typeof process&&process.env&&process.env.ISOLATED_AUTH_PRIVATE_KEY)return o.util.decode64(process.env.ISOLATED_AUTH_PRIVATE_KEY)}catch(e){}return null}();t.default=i},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=r(0),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=function(e){function t(){return n(this,t),o(this,e.apply(this,arguments))}return i(t,e),t.prototype.setup=function(){return this.client.request("mfa.setup").then(function(e){return{secret:e.data.SetupSecret,qrCodeImage:e.data.SetupQrCode}})},t.prototype.enable=function(e){return this.client.request("mfa.enable",{totp:e})},t.prototype.remove=function(e){var t=this;return this.client.crypto().generatePasswordHash(e).then(function(e){return t.client.request("mfa.remove",{password:e})})},t}(s.default);t.default=u},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){var t={};return Object.keys(g).forEach(function(r){t[r]=e[g[r]]}),t}function u(e){return(e||[]).map(function(e){return(new p.default).fromProof(e)})}t.__esModule=!0;var c=r(0),l=n(c),f=r(13),p=n(f),d=r(21),h=n(d),y=r(113),m=n(y),g={inbox:"ProofIn",sent:"ProofOut",outbox:"ProofOutBox",briefs:"AllBriefs"},v=function(e){function t(r){o(this,t);var n=i(this,e.call(this,r));return n.groups=new m.default(r),n}return a(t,e),t.prototype.inbox=function(){return this._loadSingleTabProofs("inbox")},t.prototype.sent=function(){return this._loadSingleTabProofs("sent")},t.prototype.outbox=function(){return this._loadSingleTabProofs("outbox")},t.prototype.briefs=function(){return this._loadSingleTabProofs("briefs")},t.prototype._loadSingleTabProofs=function(e){return this.client.request("dashboard."+e).then(function(e){return s(e.data)}).then(function(t){return t[e]}).then(u)},t.prototype.search=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.status,n=t.everything;return this._loadSearchProofs({query:e,filterBy:void 0===r?void 0:[].concat(r).join(","),all:n?1:0})},t.prototype.everything=function(){return this.search(void 0,{everything:!0})},t.prototype.approved=function(){return this.search(void 0,{status:h.default.APPROVED})},t.prototype.archived=function(){return this.search(void 0,{status:h.default.ARCHIVED})},t.prototype._loadSearchProofs=function(e){return this.client.request("dashboard.search",e).then(function(e){return u(e.data.Proofs)})},t}(l.default);t.default=v},function(e,t,r){"use strict";function n(e,t,r){return(1-(t+r))*e+t}t.__esModule=!0,t.default=n},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=r(3),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a={count:(0,o.number)("Count"),decision:(0,o.number)("Decision"),users:(0,o.each)("Users",function(e){return{id:e.UserId,name:e.Name,email:e.Email,nudgedDate:(0,o.date)("NudgedInStep")(e)}})},s=function(){function e(){n(this,e)}return e.prototype.fromDecisionSummary=function(e){return(0,i.default)(this,a,e),this},e}();t.default=s},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=r(3),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a={referenceId:"ReferenceId",referenceUrl:"ReferenceUrl",referenceType:"ReferenceType",referenceLabel:"ReferenceLabel",metadata:"Metadata"},s=function(){function e(){n(this,e)}return e.prototype.fromProofIntegrationReference=function(e){return(0,i.default)(this,a,e),this},e}();t.default=s},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=r(3),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a={id:"Id",templateId:"TemplateId",name:"Name",description:"Description",isRequiredForFinalApproval:"IsRequiredForFinalApproval",shouldOpenOnProofLoad:"ShouldOpenOnProofLoad"},s=function(){function e(){n(this,e)}return e.prototype.fromProofChecklist=function(e){return(0,i.default)(this,a,e),this},e}();t.default=s},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){return(e||[]).map(function(e){return(new f.default).fromProofGroup(e)})}t.__esModule=!0;var u=r(0),c=n(u),l=r(23),f=n(l),p=function(e){function t(){return o(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype._loadGroups=function(e){return this.client.request("dashboard.groups.filter-by",{filterBy:e}).then(function(e){return s(e.data)})},t.prototype.current=function(){return this._loadGroups("current")},t.prototype.archived=function(){return this._loadGroups("archived")},t}(c.default);t.default=p},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){return e.data.length>0?(new p.default).fromUser(e.data[0]):(new p.default).fromUser(e.data)}function u(e){return e.data.length?(new p.default).fromUser(e.data[0]):null}t.__esModule=!0;var c=r(0),l=n(c),f=r(9),p=n(f),d=function(e){function t(){return o(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.byEmail=function(e){return this.client.request("users.by-email",{email:e}).then(u)},t.prototype.byId=function(e){return this.client.request("users.by-id",{userId:e}).then(s)},t.prototype.invite=function(e){return this.client.request("users.invite",{email:e}).then(s)},t}(l.default);t.default=d},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){var t=[].concat(e);return t.forEach(function(e){e.proofId=e.id,delete e.id}),t}t.__esModule=!0;var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},c=r(0),l=n(c),f=r(116),p=n(f),d=r(117),h=n(d),y=r(118),m=n(y),g=r(119),v=n(g),b=r(120),E=n(b),C=r(123),_=n(C),w=r(124),T=n(w),S=r(133),I=n(S),A=r(134),k=n(A),B=r(135),R=n(B),P=r(136),O=n(P),D=r(13),N=n(D),L=r(137),U=n(L),x=r(24),M=n(x),V=r(5),j=r(4),F=n(j),q=function(e){function t(r){o(this,t);var n=i(this,e.call(this,r));return n.owners=new p.default(r),n.editors=new h.default(r),n.reviewers=new m.default(r),n.versions=new v.default(r),n.groups=new E.default(r),n.reminders=new U.default(r),n.audit=new _.default(r),n.assets=new T.default(r),n.customTools=new I.default(r),n.integrationReferences=new k.default(r),n.linkCheck=new R.default(r),n.decisions=new O.default(r),n}return a(t,e),t.prototype.setWorkflow=function(e,t){var r=this;return this.client.request("proofs.normalize-workflow",{proofId:e,workflowId:t}).then(function(){return r.client.request("proofs.set-workflow",{proofId:e,workflowId:t})})},t.prototype.setTags=function(e,t){return this.client.request("proofs.set-tags",{relatedId:e,tag:t.join(",")})},t.prototype.deleteTag=function(e,t){return this.client.request("proofs.tag-delete",{relatedId:e,tag:t})},t.prototype.setFile=function(e,t){var r=this;return this.client.request("proofs.set-file",{proofId:e,fileId:t}).then(function(){return r.client.request("proofs.distribute-file",{proofId:e})})},t.prototype.create=function(e){var t=this,r=e.name,n=e.tags,o=void 0===n?[]:n,i=e.dueDate,a=void 0===i?new Date(Date.now()+3*V.DAY_IN_MS):i,s=e.messageToReviewers,u=e.workflow,c=e.workflowTemplate,l=e.proofTemplate,f=e.checklist,p=e.file,d=e.group,h=e.previousProof,y=e.team,m=e.reference,g=e.customTools,v=e.integrationReferences,b=e.reminders,E=void 0===b?[]:b,C=e.owners,_=e.canDownload,w=e.isPublic,T=e.start,S=void 0===T||T,I=e.commentVisibility,A=void 0===I?null:I,k=e.priority,B=e.scheduledDate;return this.client.request("proofs.create",{proof:{name:r,tags:o,dueDate:a.toISOString?a.toISOString():String(a),messageToReviewers:s,workflowId:u&&u.id||void 0,workflowTemplateId:c&&c.id||void 0,proofTemplateId:l&&l.id||void 0,checklist:f,fileId:p&&p.id||void 0,groupId:d&&d.id||void 0,previousProofId:h&&h.id||void 0,teamSlug:y&&y.slug||void 0,reference:m,integrationReferences:v,reminders:[].concat(E),owners:C,canDownload:_,isPublic:w,start:S,commentVisibility:A,priority:k,scheduledDate:B.toISOString?B.toISOString():String(B)}}).then(function(e){var r=(new N.default).fromProof(e.data);return r.calculateState(),g&&!h?t.customTools.update(r.id,g).then(function(){return r}):r})},t.prototype.archive=function(e){return this.client.request("proofs.archive",{proofIds:e})},t.prototype.unarchive=function(e){return this.client.request("proofs.unarchive",{proofId:e})},t.prototype.delete=function(e){return this.client.request("proofs.delete",{proofId:e})},t.prototype.finish=function(e,t){return this.client.request("proofs.finish",{proofId:e,decision:t})},t.prototype.approve=function(e,t){return this.client.request("proofs.manual-approval",{proofId:e,message:t})},t.prototype.withdrawApproval=function(e,t){return this.client.request("proofs.withdraw-approval",{proofId:e,messageToSender:t})},t.prototype.generateEmail=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.client.request("email.proofs.generate",u({proofId:e},t)).then(function(e){return e.data})},t.prototype.return=function(e){return this.client.request("proofs.return",{proofIds:[].concat(e)}).then(function(e){return{proofIds:e.data.ProofIds,errors:e.data.Errors.map(function(e){return{proofId:e.ProofId,errorCode:e.ErrorCode,errorMessage:e.ErrorMessage}})}})},t.prototype.start=function(e){return this.client.request("proofs.start",{proofId:e})},t.prototype.removeEditor=function(e){return this.client.request("proofs.remove-editor",{proofId:e})},t.prototype.load=function(e){return this.client.request("proofs.load",{proofId:e}).then(function(e){return(new N.default).fromProof(e.data)})},t.prototype.lock=function(e){return this.client.request("proofs.lock",{proofId:e})},t.prototype.unlock=function(e){return this.client.request("proofs.unlock",{proofId:e})},t.prototype.requestUnlock=function(e){return this.client.request("proofs.request-unlock",{proofId:e})},t.prototype.requestAccess=function(e){return this.client.request("proofs.request-access",{proofId:e})},t.prototype.images=function(e){return this.client.request("proofs.images",{proofId:e}).then(function(e){return e.data.proof.file})},t.prototype.videoCredentials=function(e){var t=this;return this.client.cache.auto(V.VIDEO_CREDENTIALS_CACHE_PREFIX+e,function(){return t._videoCredentials(e)})},t.prototype._videoCredentials=function(e){var t=this,r=new F.default;return this.client.request("proofs.video-credentials",{proofId:e}).then(function(e){return Promise.all([e.data.envelope.envelope,t.client.rawRequest({method:"GET",url:new M.default(e.data.videoCredentials.url)}).then(function(e){return e.body})])}).then(function(e){var r=e[0],n=e[1];return t.client.crypto().decryptImage(r+"-"+n,t.client.keyPairs.getPrivateKeyPEMs())}).then(function(e){return r.createBase64(e).then(function(e){return r.read(e)})}).then(function(e){try{return JSON.parse(e)}catch(o){var t=e.split("|"),r=t[0],n=t[1];return{streamingUrl:r.replace("http://","https://")+"/manifest(format=m3u8-aapl,encryption=cbc)",accessToken:n,manifestUrl:r.replace("http://","https://")+"/manifest",bearerToken:n}}})},t.prototype._getProofSetup=function(e,t){return this.client.request("integrations.get-proof-setup",{integration_key:e,id:t}).then(function(e){return{payload:e.data.payload}})},t.prototype.setMessageToReviewers=function(e,t){return this.client.request("proofs.set-message-to-reviewers",{proofIds:[].concat(e),messageToReviewers:t})},t.prototype.returnTodos=function(e,t){var r=t.messageToOwners,n=t.markCommentsAsTodo,o=void 0!==n&&n;return this.client.request("proofs.return-todos",{proofIds:[].concat(e),messageToOwners:r,markCommentAsTodo:o})},t.prototype.updateDecision=function(e,t){return this.client.request("proofs.update-decision",{proofId:e,decision:t})},t.prototype.update=function(e){if(1===e.length||void 0===e.length){var t=[].concat(e)[0],r=t.id,n=t.name,o=t.tags,i=t.dueDate,a=t.messageToReviewers,u=t.workflow,c=t.checklist,l=t.group,f=t.proofTemplate,p=t.file,d=t.reference,h=t.integrationReferences,y=t.reminders,m=t.owners,g=t.canDownload,v=t.isPublic,b=t.start,E=t.commentVisibility,C=t.priority,_=t.scheduledDate;return this.client.request("proofs.update",{proof:{id:r,name:n,tags:o,dueDate:i?i.toISOString():void 0,messageToReviewers:a,workflowId:u&&u.id||void 0,proofTemplateId:f&&f.id||void 0,checklist:c,fileId:p&&p.id||void 0,groupId:l&&l.id||void 0,reference:d,integrationReferences:h,reminders:y?[].concat(y):void 0,owners:m,canDownload:g,isPublic:v,start:b,commentVisibility:E,priority:C,scheduledDate:_?_.toISOString():void 0}}).then(function(e){var t=(new N.default).fromProof(e.data);return t.calculateState(),t})}return this.client.request("proofs.bulk-update",{proofs:s(e)})},t.prototype.next=function(e){return this.client.request("proofs.next",{proofId:e}).then(function(e){return(new N.default).fromProof(e.data)})},t.prototype.addWorkflow=function(e,t){return this.client.request("proofs-workflow.add-bulk",{proofIds:[].concat(e),workflowTemplateId:t})},t.prototype.sendShareLink=function(e){var t=e.proofId,r=e.message,n=e.emailAddresses;return this.client.request("proofs.send-share-link",{proofId:t,message:r,emailAddresses:n})},t.prototype.getWorkflowMetrics=function(e){return this.client.request("proofs.get-workflow-metrics",{proofId:e}).then(function(e){return e.data?e.data.workflowMetrics:null})},t}(l.default);t.default=q},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=r(0),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=function(e){function t(){return n(this,t),o(this,e.apply(this,arguments))}return i(t,e),t.prototype.add=function(e,t){return this.client.request("proofs-owners.add",{proofIds:[].concat(e),users:[].concat(t)})},t.prototype.remove=function(e,t){return this.client.request("proofs-owners.remove",{proofId:e,users:[].concat(t)})},t}(s.default);t.default=u},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function a(e){var t=[].concat(e);return t.forEach(function(e){e.editorMessage=e.messageToEditors,delete e.messageToEditors}),t}t.__esModule=!0;var s=r(0),u=function(e){return e&&e.__esModule?e:{default:e}}(s),c=function(e){function t(){return n(this,t),o(this,e.apply(this,arguments))}return i(t,e),t.prototype.add=function(e,t,r){var n={proofId:e,editors:[].concat(t),editorMessage:null===r?"":r};return this.client.request("proofs.editors.add",n)},t.prototype.addBulk=function(e){return this.client.request("proofs.editors.add-bulk",{proofsWithEditors:a(e)})},t.prototype.remove=function(e,t){return this.client.request("proofs.editors.remove",{proofId:e,editors:[].concat(t)})},t.prototype.replace=function(e,t,r){return this.client.request("proofs.editors.replace",{proofId:e,oldEditors:[].concat(t),newEditors:[].concat(r)})},t.prototype.set=function(e,t){return this.client.request("proofs.editors.set",{proofId:e,editors:[].concat(t)})},t}(u.default);t.default=c},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=r(0),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=function(e){function t(){return n(this,t),o(this,e.apply(this,arguments))}return i(t,e),t.prototype.add=function(e,t){return this.client.request("proofs-reviewers.add",{proofIds:[].concat(e),reviewers:[].concat(t)})},t}(s.default);t.default=u},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=r(0),u=n(s),c=r(62),l=n(c),f=r(63),p=(0,f.sortObjectsByKey)("version"),d=function(e){function t(){return o(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.attach=function(e,t){return this.client.request("proofs.versions.attach",{proofId:e,versionId:t})},t.prototype.list=function(e){return this.client.request("proofs.versions.list",{proofId:e}).then(function(e){return e.data.map(function(e){return(new l.default).fromProofVersion(e)}).sort(p)})},t}(u.default);t.default=d},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){return(new p.default).fromProofGroup(e.data)}t.__esModule=!0;var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},c=r(0),l=n(c),f=r(23),p=n(f),d=r(121),h=n(d),y=r(122),m=n(y),g=function(e){function t(r){o(this,t);var n=i(this,e.call(this,r));return n.owners=new h.default(r),n.workflows=new m.default(r),n}return a(t,e),t.prototype.create=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.name,r=e.isOwnedByTeam;return this.client.request("proofs.groups.create",{name:t,ownedByTeam:r}).then(s)},t.prototype.load=function(e){return this.client.request("proofs.groups.load",{groupId:e}).then(s)},t.prototype.ready=function(e){return this.client.request("proofs.groups.ready",{groupId:e})},t.prototype.update=function(e,t){var r=t.name,n=t.isOwnedByTeam,o=t.folder;return this.client.request("proofs.groups.update",{groupId:e,name:r,ownedByTeam:n,folderName:o&&o.name}).then(s)},t.prototype.removeProof=function(e){return this.client.request("proofs.groups.remove-proof",{proofId:e})},t.prototype.addProof=function(e,t){return this.client.request("proofs.groups.add-proof",{groupId:e,proofId:t})},t.prototype.delete=function(e){return this.client.request("proofs.groups.delete",{groupId:e})},t.prototype.archive=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];if(t.every(function(e){return"string"==typeof e}))return this.client.request("proofs.groups.archive",{groupIds:t});var n={archiveProofs:!1},o=t[0],i=t[1],a=void 0===i?n:i,s=[].concat(o);return this.client.request("proofs.groups.archive",u({groupIds:s},a))},t.prototype.reopen=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.client.request("proofs.groups.reopen",{groupIds:t})},t}(l.default);t.default=g},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=r(0),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=function(e){function t(){return n(this,t),o(this,e.apply(this,arguments))}return i(t,e),t.prototype.add=function(e,t){return this.client.request("proofs.groups.owners.add",{groupId:e,owners:[].concat(t)})},t}(s.default);t.default=u},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=r(0),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=function(e){function t(){return n(this,t),o(this,e.apply(this,arguments))}return i(t,e),t.prototype.addReviewers=function(e,t){return this.client.request("proofs.groups.workflows.add-reviewers",{groupId:e,reviewers:[].concat(t)})},t.prototype.replaceApprover=function(e,t){return this.client.request("proofs.groups.replace-approver",{groupId:e,user:t})},t}(s.default);t.default=u},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=r(0),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=function(e){function t(){return n(this,t),o(this,e.apply(this,arguments))}return i(t,e),t.prototype.summary=function(e){return this.client.request("proofs.audit.summary",{proofId:e}).then(function(e){return e.data.summary})},t}(s.default);t.default=u},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=r(0),u=n(s),c=r(125),l=n(c),f=r(132),p=n(f),d=function(e){function t(r){o(this,t);var n=i(this,e.call(this,r));return n.extractedText=new p.default(r),n.colorSeparations=new l.default(r),n}return a(t,e),t}(u.default);t.default=d},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=r(0),u=n(s),c=r(24),l=n(c),f=r(4),p=n(f),d=function(e){function t(){return o(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.resources=function(e){return this.client.request("proofs.assets.color-separations",{proofId:e}).then(function(e){return e.data.result}).catch(function(e){if(!e||!e.response||400!==e.response.code)throw e})},t.prototype.download=function(e,t,r){var n=this,o=e.pages.filter(function(e){return e.number===t});if(!o.length)return Promise.reject(new Error("Page does not have any color separation plates."));var i=o[0].plates.filter(function(e){return e.name===r});if(!i.length)return Promise.reject(new Error("Page "+t+' does not have a plate named "'+r+'".'));var a=new l.default(i[0].url),s=e.envelope,u=new p.default;return this.client.rawRequest({method:"GET",url:a},{bluffer:!0}).then(function(e){return e.body}).then(function(e){return u.readBase64(e)}).then(function(e){return n.client.crypto().decryptBytes(e,s,n.client.keyPairs.getPrivateKeyPEMs(),[],[])}).then(function(e){return u.createBase64(e)})},t}(u.default);t.default=d},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=r(35),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a=function(){function e(){n(this,e)}return e.prototype.create=function(e){return Promise.resolve(new Blob([(0,i.default)(e)]))},e.prototype.createBase64=function(e){return this.create(atob(e))},e.prototype.createArrayBuffer=function(e){return Promise.resolve(new Blob([e]))},e.prototype.combine=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return Promise.resolve(new Blob(t))},e.prototype.slice=function(e,t,r){return Promise.resolve(e.slice(t,r))},e.prototype.read=function(e){return new Promise(function(t,r){var n=new FileReader;n.onload=function(){t(n.result)},n.onerror=function(){r(n.error)},n.readAsText(e)})},e.prototype.readBase64=function(e){return new Promise(function(t,r){var n=new FileReader;n.onload=function(){var e=n.result;t(e.substring(e.indexOf(",")+1))},n.onerror=function(){r(n.error)},n.readAsDataURL(e)})},e.prototype.readArrayBuffer=function(e){return new Promise(function(t,r){var n=new FileReader;n.onload=function(){t(n.result)},n.onerror=function(){r(n.error)},n.readAsArrayBuffer(e)})},e.prototype.size=function(e){return e.size},e}();t.default=a},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=function(){function e(){n(this,e)}return e.prototype.create=function(e){return Promise.resolve(Buffer.from(e))},e.prototype.createBase64=function(e){return Promise.resolve(Buffer.from(e,"base64"))},e.prototype.createArrayBuffer=function(e){for(var t=Buffer.alloc(e.byteLength),r=new Uint8Array(e),n=0;n<t.length;n++)t[n]=r[n];return Promise.resolve(t)},e.prototype.combine=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return Promise.resolve(Buffer.concat(t))},e.prototype.slice=function(e,t,r){return Promise.resolve(e.slice(t,r))},e.prototype.read=function(e){return Promise.resolve(e.toString())},e.prototype.readBase64=function(e){return Promise.resolve(e.toString("base64"))},e.prototype.readArrayBuffer=function(e){for(var t=new ArrayBuffer(e.length),r=new Uint8Array(t),n=0;n<e.length;n++)r[n]=e[n];return Promise.resolve(t)},e.prototype.size=function(e){return Buffer.byteLength(e)},e}();t.default=o},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e){for(var t=e.length,r=e.length-1;r>=0;r--){var n=e.charCodeAt(r);n>127&&n<=2047?t++:n>2047&&n<=65535&&(t+=2),n>=56320&&n<=57343&&r--}return t}t.__esModule=!0;var a=r(129),s=r(64),u=n(s),c=r(35),l=n(c),f=function(){function e(){o(this,e)}return e.prototype.create=function(e){return Promise.resolve(e)},e.prototype.createBase64=function(e){return Promise.resolve((0,a.atob)(e))},e.prototype.createArrayBuffer=function(e){return Promise.resolve((0,u.default)(e))},e.prototype.combine=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return Promise.resolve(t.join(""))},e.prototype.slice=function(e,t,r){return Promise.resolve(e.slice(t,r))},e.prototype.read=function(e){return Promise.resolve(e)},e.prototype.readBase64=function(e){return Promise.resolve((0,a.btoa)(e))},e.prototype.readArrayBuffer=function(e){return Promise.resolve((0,l.default)(e))},e.prototype.size=function(e){return i(e)},e}();t.default=f},function(e,t,r){!function(){function e(e){this.message=e}var r=t,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";e.prototype=new Error,e.prototype.name="InvalidCharacterError",r.btoa||(r.btoa=function(t){for(var r,o,i=String(t),a=0,s=n,u="";i.charAt(0|a)||(s="=",a%1);u+=s.charAt(63&r>>8-a%1*8)){if((o=i.charCodeAt(a+=.75))>255)throw new e("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");r=r<<8|o}return u}),r.atob||(r.atob=function(t){var r=String(t).replace(/[=]+$/,"");if(r.length%4==1)throw new e("'atob' failed: The string to be decoded is not correctly encoded.");for(var o,i,a=0,s=0,u="";i=r.charAt(s++);~i&&(o=a%4?64*o+i:i,a++%4)?u+=String.fromCharCode(255&o>>(-2*a&6)):0)i=n.indexOf(i);return u})}()},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e){return e.byteLength!==e.buffer.byteLength?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):e.buffer}function a(e){return new Uint8Array(e)}function s(e){return(0,d.default)(i(e))}function u(e){return a((0,y.default)(e))}function c(e){for(var t=new Uint8Array(e.reduce(function(e,t){return e+t.byteLength},0)),r=0,n=0;r<e.length;r++)t.set(e[r],n),n+=e[r].byteLength;return t}t.__esModule=!0;var l=r(131),f=n(l),p=r(64),d=n(p),h=r(35),y=n(h),m=function(){function e(){o(this,e)}return e.prototype.create=function(e){return Promise.resolve(u(e))},e.prototype.createBase64=function(e){return Promise.resolve(f.default.toByteArray(e))},e.prototype.createArrayBuffer=function(e){return Promise.resolve(a(e))},e.prototype.combine=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return Promise.resolve(c(t))},e.prototype.slice=function(e,t,r){return Promise.resolve(e.slice(t,r))},e.prototype.read=function(e){return Promise.resolve(s(e))},e.prototype.readBase64=function(e){return Promise.resolve(f.default.fromByteArray(e))},e.prototype.readArrayBuffer=function(e){return Promise.resolve(i(e))},e.prototype.size=function(e){return e.byteLength},e}();t.default=m},function(e,t,r){"use strict";function n(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function o(e){var t=n(e),r=t[0],o=t[1];return 3*(r+o)/4-o}function i(e,t,r){return 3*(t+r)/4-r}function a(e){var t,r,o=n(e),a=o[0],s=o[1],u=new p(i(e,a,s)),c=0,l=s>0?a-4:a;for(r=0;r<l;r+=4)t=f[e.charCodeAt(r)]<<18|f[e.charCodeAt(r+1)]<<12|f[e.charCodeAt(r+2)]<<6|f[e.charCodeAt(r+3)],u[c++]=t>>16&255,u[c++]=t>>8&255,u[c++]=255&t;return 2===s&&(t=f[e.charCodeAt(r)]<<2|f[e.charCodeAt(r+1)]>>4,u[c++]=255&t),1===s&&(t=f[e.charCodeAt(r)]<<10|f[e.charCodeAt(r+1)]<<4|f[e.charCodeAt(r+2)]>>2,u[c++]=t>>8&255,u[c++]=255&t),u}function s(e){return l[e>>18&63]+l[e>>12&63]+l[e>>6&63]+l[63&e]}function u(e,t,r){for(var n,o=[],i=t;i<r;i+=3)n=(e[i]<<16&16711680)+(e[i+1]<<8&65280)+(255&e[i+2]),o.push(s(n));return o.join("")}function c(e){for(var t,r=e.length,n=r%3,o=[],i=0,a=r-n;i<a;i+=16383)o.push(u(e,i,i+16383>a?a:i+16383));return 1===n?(t=e[r-1],o.push(l[t>>2]+l[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],o.push(l[t>>10]+l[t>>4&63]+l[t<<2&63]+"=")),o.join("")}t.byteLength=o,t.toByteArray=a,t.fromByteArray=c;for(var l=[],f=[],p="undefined"!=typeof Uint8Array?Uint8Array:Array,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h=0,y=d.length;h<y;++h)l[h]=d[h],f[d.charCodeAt(h)]=h;f["-".charCodeAt(0)]=62,f["_".charCodeAt(0)]=63},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=r(0),u=n(s),c=r(24),l=n(c),f=r(4),p=n(f),d=function(e){function t(){return o(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.resources=function(e){return this.client.request("proofs.assets.extracted-text",{proofId:e}).then(function(e){return e.data.result}).catch(function(e){if(!e||!e.response||400!==e.response.code)throw e})},t.prototype.download=function(e,t){var r=this,n=e.pages.filter(function(e){return e.number===t});if(!n||!n.length)return Promise.reject(new Error("Page does not contain any text."));var o=e.envelope,i=new l.default(n[0].chunks[0].url),a=new p.default;return this.client.rawRequest({method:"GET",url:i},{bluffer:!0}).then(function(e){return e.body}).then(function(e){return a.readBase64(e)}).then(function(e){return r.client.crypto().decryptBytes(e,o,r.client.keyPairs.getPrivateKeyPEMs(),[],["unzip"])}).then(function(e){return a.createBase64(e)}).then(function(e){return a.readArrayBuffer(e)}).then(function(e){return r.client.protobuf().ExtractedText(e)})},t}(u.default);t.default=d},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=r(0),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=function(e){function t(){return n(this,t),o(this,e.apply(this,arguments))}return i(t,e),t.prototype.validate=function(e){return this.client.request("proofs.custom-tools.validate",{schema:e}).then(function(){})},t.prototype.load=function(e){return this.client.request("proofs.custom-tools.load",{proofId:e}).then(function(e){return e.data.tools})},t.prototype.update=function(e,t){return this.client.request("proofs.custom-tools.update",{proofId:e,updates:t}).then(function(e){return e.data.tools})},t}(s.default);t.default=u},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(0),u=function(e){return e&&e.__esModule?e:{default:e}}(s),c=function(e){function t(){return n(this,t),o(this,e.apply(this,arguments))}return i(t,e),t.prototype.availableIntegrations=function(){return this.client.request("integrations.get-available-reference-integrations").then(function(e){return e.data.integrations})},t.prototype.options=function(e,t){return this.client.request("integrations.get-available-reference-options",{params:a({},t,{integration_key:e})}).then(function(e){return e.data.optionTypes})},t.prototype.add=function(e,t){return this.client.request("integrations.proof-integration-references.add",{proofId:e,integrationReference:t})},t.prototype.remove=function(e,t){return this.client.request("integrations.proof-integration-references.remove",{proofId:e,referenceId:t})},t.prototype.loadReferenceAdditionalInformation=function(e,t,r){return this.client.request("integrations.load-reference-additional-information",{params:a({},r,{reference_type:e,reference_id:t})}).then(function(e){return e.data.information})},t}(u.default);t.default=c},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=r(0),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=function(e){function t(){return n(this,t),o(this,e.apply(this,arguments))}return i(t,e),t.prototype.results=function(e){return this.client.request("proofs.link-check.results",{proofId:e})},t.prototype.recheck=function(e){return this.client.request("proofs.link-check.recheck",{proofId:e})},t}(s.default);t.default=u},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=r(0),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=function(e){function t(){return n(this,t),o(this,e.apply(this,arguments))}return i(t,e),t.prototype.load=function(e){return this.client.request("proofs.decisions.load",{proofId:e}).then(function(e){return e.data.decisions})},t.prototype.getOptions=function(e){return this.client.request("proofs.decisions.get-options",{proofId:e,type:"options"}).then(function(e){return{currentDecision:e.data.currentDecision,options:e.data.options}})},t.prototype.leaveDecision=function(e,t){return this.client.request("proofs.decisions.leave-decision",{proofId:e,decisionId:t})},t}(s.default);t.default=u},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){return e.map(function(e){return(new f.default).fromReminder(e)})}t.__esModule=!0;var u=r(0),c=n(u),l=r(138),f=n(l),p=function(e){function t(){return o(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.add=function(e,t){return this.client.request("reminders.add",{entityId:e,reminders:[{action:t.action,relativeTo:t.relativeTo,relativeDate:t.relativeDate,absoluteDate:t.absoluteDate}]}).then(function(e){return s(e.data)})},t.prototype.set=function(e,t){return this.client.request("reminders.set",{entityId:e,reminders:t.map(function(e){return[{action:e.action,relativeTo:e.relativeTo,relativeDate:e.relativeDate,absoluteDate:e.absoluteDate}]})}).then(function(e){return s(e.data)})},t.prototype.update=function(e,t){return this.client.request("reminders.update",{reminderId:e,relativeDate:t})},t.prototype.delete=function(e){return this.client.request("reminders.delete",{reminderIds:[].concat(e)})},t.prototype.all=function(e){return this.client.request("reminders.all",{entityId:e}).then(function(e){return s(e.data)})},t}(c.default);t.default=p},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=r(3),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a={id:"ReminderId",action:"Action",absoluteDate:(0,o.date)("TriggerDate"),relativeTo:"RelativeTo",relativeDate:"RelativeDate"},s=function(){function e(){n(this,e)}return e.prototype.fromReminder=function(e){return(0,i.default)(this,a,e),this},e}();t.default=s},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=r(0),u=n(s),c=r(13),l=n(c),f=r(22),p=n(f),d=r(5),h=function(e){function t(){return o(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.setTags=function(e,t){return this.client.request("proofs.set-tags",{relatedId:e,tag:t.join(",")})},t.prototype.deleteTag=function(e,t){return this.client.request("proofs.tag-delete",{relatedId:e,tag:t})},t.prototype.setFile=function(e,t){var r=this;return this.client.request("proofs.set-file",{proofId:e,fileId:t}).then(function(){return r.client.request("proofs.distribute-file",{proofId:e})})},t.prototype.create=function(e){var t=this,r=e.name,n=e.file,o=e.isPublic,i=e.tags,a=void 0===i?[]:i,s=e.dueDate,u=void 0===s?new Date(Date.now()+3*d.DAY_IN_MS):s;return this.client.request("briefs.create",{title:r,isPublic:o,messageToRecipient:"",dueDate:u.toISOString(),tag:a.join(",")}).then(function(e){var r=(new l.default).fromProof(e.data.Brief);return Promise.all([r,n&&t.setFile(r.id,n.id)])}).then(function(e){var t=e[0];return n&&(t.fileId=n.id,t.fileStatus=p.default.UPLOADING),t.calculateState(),t})},t.prototype.update=function(e){var t=this,r=e.briefId,n=e.data,o=e.start,i=void 0!==o&&o;return this.client.request("briefs.update",{briefId:r,title:n.title,messageToRecipient:n.messageToRecipient,dueDate:n.dueDate?n.dueDate.toISOString():"",tag:n.tags?n.tags.join(","):"",recipient:n.recipient,editorId:n.editorId,editorMessage:n.editorMessage,isPublic:n.isPublic}).then(function(e){return(new l.default).fromProof(e.data.Brief)}).then(function(e){return Promise.resolve(i&&t.start(e.id)).then(function(){return e})})},t.prototype.delete=function(e){return this.client.request("proofs.delete",{proofId:e})},t.prototype.start=function(e){return this.client.request("briefs.start",{briefId:e})},t}(u.default);t.default=h},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function u(e,t,r){return(1-(t+r))*e+t}t.__esModule=!0;var c=r(0),l=n(c),f=r(36),p=n(f),d=r(22),h=n(d),y=r(65),m=n(y),g=r(141),v=n(g),b=r(4),E=n(b),C=r(5),_=r(66),w=n(_),T=r(142),S=n(T),I=r(67),A=n(I),k=r(143),B=function(e){function t(){return i(this,t),a(this,e.apply(this,arguments))}return s(t,e),t.prototype.generateToken=function(e,t){return e&&!t?Promise.reject(Error('The "assignedType" option is required when specifying the "assignedTo" option.')):!e&&t?Promise.reject(Error('The "assignedTo" option is required when specifying the "assignedType" option.')):this.client.request("files.legacy.generate-token",{relatedId:e,fileType:t}).then(function(e){return e.data.Token})},t.prototype.setCanDownload=function(e,t){return this.client.request("files.can-download.update",{fileId:e,downloadOriginal:t?1:0})},t.prototype._waitFileProcessed=function(e){var t=this;return new Promise(function(r,n){var o=null,i=null;!function a(){t.details(e).then(function(t){switch(o=null,t.status){case h.default.OK:r(t);break;case h.default.ERROR:n(new Error("File "+e+" encountered a processing error: "+t.message));break;default:o=setTimeout(a,5e3)}o&&t.status!==h.default.RIPPING||clearTimeout(i)}).catch(n)}(),i=setTimeout(function(){clearTimeout(o),n(new Error("File did not finish processing within specified duration."))},3e4)})},t.prototype._createWebsiteFile=function(e){var t=this;return this._generateKeyIVEnvelope().then(function(r){var n=r.envelope;return t.client.request("files.import.web",{url:e,envelope:n})}).then(function(e){return e.data})},t.prototype._importFileFromUrl=function(e){var t=this,r=e.name,n=e.url,o=e.provider,i=e.auth,a=e.download,s=o;o===m.default.NONE&&(s="generic");var u=(0,k.parseFilename)(r),c=u.name,l=u.extension;return this._generateKeyIVEnvelope().then(function(e){var r=e.envelope;return t.client.request("files.import."+s,{extn:l,filename:c,url:n,envelope:r,accessToken:i,storeOriginal:a})}).then(function(e){return e.data})},t.prototype.import=function(e){var t=this,r=e.name,n=e.url,o=e.provider,i=void 0===o?m.default.NONE:o,a=e.auth,s=e.download,u=void 0!==s&&s,c=e.process,l=void 0!==c&&c;return Object.keys(m.default).some(function(e){return m.default[e]===i})?(i===m.default.WEBSITE?this._createWebsiteFile(n):this._importFileFromUrl({name:r,url:n,provider:i,auth:a,download:u})).then(function(e){if(l)return t._waitFileProcessed(e);var r=new p.default;return r.id=e,r}):Promise.reject(new Error('Unsupported provider "'+i+'"'))},t.prototype.email=function(){return this.client.request("files.create-email").then(function(e){return e.data})},t.prototype._generateKeyIVEnvelope=function(){var e=this;return this.client.crypto().generateKeyIV().then(function(t){return Promise.all([t,e.client.crypto().envelopeSeal(t.keyIV,e.client.keyPairs.getPublicKeyPEMs())])}).then(function(e){return{keyIV:e[0],envelope:e[1]}})},t.prototype.upload=function(){return this.upload__v2.apply(this,arguments)},t.prototype.upload__v2=function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.concurrent,i=void 0===n?6:n,a=o(r,["concurrent"]),s=(0,S.default)(i),u=(0,S.default)(1),c=[],l=Array.isArray(e),f=l?e:[e],d=void 0;try{d=(0,k.prepareFilesForUpload)(f)}catch(e){return Promise.reject(e)}var h=function(e){return c.push(e),u(function(){if(c.length){var e=c.slice();return c.length=0,t.client.request("files.v2.upload-complete",{files:e})}return null})},y=new E.default;return this.client.request("files.v2.generate-credentials",{supports:{providers:["abs","custom"]},files:d.map(function(e){var t=void 0,r=void 0;if(e.extension){var n=[e.name,e.extension];t=n[0],r=n[1]}else{var o=[e.parsedFilename.name,e.parsedFilename.extension];t=o[0],r=o[1]}var i=y.size(e.contents),a=Math.ceil(i/C.BYTES_PER_BLOCK);return e.onProgress&&e.onProgress(0),{name:t,extension:r,chunks:a,size:i,fileTypeOverride:e.fileTypeOverride,hash:null,adobeExportData:e.adobeExportData?JSON.stringify(e.adobeExportData):null,assignedTo:e.assignedTo,assignedType:e.assignedType,canDownload:void 0===e.download||!!e.download}})}).then(function(e){return Promise.all(d.map(function(r,n){var o=e.data[n];r.onProgress&&r.onProgress(1);var i=new p.default;return i.id=o.FileId,r.onFileDetails&&r.onFileDetails(i),t._upload__v2(r,o,a,s,h).then(function(){return i})}))}).then(function(e){return l?e:e[0]})},t.prototype._upload__v2=function(e,t,r,n,o){var i=this;return this._generateKeyIVEnvelope().then(function(a){var s=a.keyIV,c=a.envelope;return new Promise(function(a,l){function f(e,t){var r=O(e,t);return _.push(r),r}function p(){m||n(function(){return b().then(function(e){if(e)return p(),f(e,g++);if(!m){m=!0;var t=Promise.all(_).then(D);a(t)}})})}var d=t.FileId,h=t.UploadCredentials,y=new E.default,m=!1,g=0,b=(0,v.default)(e.contents,function(e){return y.readBase64(e)}),_=[],w=Math.ceil(y.size(e.contents)/C.BYTES_PER_BLOCK),T=new Array(w),S=1,I=function(){},k=e.onProgress;k&&(I=function(e,t){T[e]=Math.max(t,T[e]||0);var n=100*u(T.reduce(function(e,t){return e+(t||0)},0)/w/100,.01,.01);void 0!==r.progressDecimalPlaces&&(n=+n.toFixed(r.progressDecimalPlaces)),S!==n&&(k(n),S=n)});var B=function(e,t){return i.client.rawRequest({method:"PUT",host:h.url,path:"/"+d+"/"+t,query:h.sas,body:e,headers:{"x-ms-blob-type":"BlockBlob"}},{onUploadProgress:I.bind(null,t)})},R=function(e,t){var r={"file.id":d,"chunk.index":t},n=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(e){return e};return e.replace(/\{([\w\.]+)\}/g,function(e,n){return t(r[n])})},o={};return Object.keys(h.headers).forEach(function(e){var t=n(h.headers[e]);o[n(e)]=t}),i.client.rawRequest({method:h.method,host:n(h.host),path:n(h.path,encodeURIComponent),query:n(h.query,encodeURIComponent),body:e,headers:o},{onUploadProgress:I.bind(null,t)})},P={abs:B,custom:R}[h.type],O=function(e,t){return i.client.crypto().encryptFileBlock(s,e,!0).then(function(e){return y.createBase64(e)}).then(function(e){return y.readArrayBuffer(e)}).then(function(e){function n(){return P(e,t).then(function(e){if(-1===[200,201].indexOf(e.status)){if(o<i)return o++,r.chunkRetryDelay?(0,A.default)(r.chunkRetryDelay).then(n):n();var a=new Error("Failed to upload block #"+t+" (retried "+o+" times).");throw l(a),m=!0,a}return e})}var o=0,i=void 0!==r.chunkRetryLimit?r.chunkRetryLimit:3;return n()})},D=function(){return o({fileId:d,envelope:c}).then(function(){k&&k(100)})};p(),!1!==e.async&&a()})})},t.prototype.upload__legacy=function(e){var t=this,r=e.name,n=e.contents,o=e.adobeExportData,i=e.assignedTo,a=e.assignedType,s=e.download,u=void 0!==s&&s,c=e.async,l=void 0===c||c,f=e.onProgress,d=e.onError,h=void 0;try{h=(0,k.parseFilename)(r)}catch(e){return Promise.reject(e)}return this.generateToken(i,a).then(function(e){return Promise.all([e,t._generateKeyIVEnvelope()])}).then(function(e){var r=e[0],i=e[1],a=i.keyIV,s=i.envelope,c=t._upload__legacy({parsedFilename:h,contents:n,adobeExportData:o,download:u,token:r,keyIV:a,envelope:s,onProgress:f,onError:d});return l&&(c=Promise.resolve()),c.then(function(){return r})}).then(function(e){var t=new p.default;return t.id=e,t})},t.prototype._upload__legacy=function(e){var t=this,r=e.parsedFilename,n=e.contents,o=e.adobeExportData,i=e.download,a=e.token,s=e.keyIV,u=e.envelope,c=e.onProgress;return new Promise(function(e){function l(){h().then(function(t){if(!g)if(null===t)g=!0,e(y.then(I));else{var r=S(t,m++);y=y.then(function(){return r}),r.then(l)}})}var f=4,p=r.name,d=r.extension,h=(0,v.default)(n),y=Promise.resolve(),m=0,g=!1,b=new E.default,_=Math.ceil(b.size(n)/C.BYTES_PER_BLOCK),w=new Array(_),T=function(){};c&&(T=function(e,t){w[e]=Math.max(t,w[e]||0),c(w.reduce(function(e,t){return e+(t||0)},0)/_*.99)});for(var S=function(e,r){return t.client.crypto().encryptFileBlock(s,e).then(function(e){return t.client.request("files.legacy.upload-block",{block:r,part:1,token:a,data:e},{onUploadProgress:T.bind(null,r)})})},I=function(){return t.client.request("files.legacy.upload-complete",{block:0,blockCount:m,part:0,token:a,extn:d,pages:1,filename:p,storeoriginal:i?1:0,adobeExportData:o?JSON.stringify(o):null,envelope:u}).then(function(){return c&&c(100)})};f--;)l()})},t.prototype.download=function(e){var t=this,r="string"==typeof e?{fileId:e}:e,n=r.fileId,o=r.onFileDetails;return this.details(n).then(function(e){if(!r.silent){if(!e.downloadable)throw new Error("File "+n+" is not downloadable.");if(e.status!==h.default.OK)throw new Error("File "+n+" cannot be download. The file may still be uploading, processing or has errored.");if(!e.blocks)throw new Error("File "+n+" is empty.")}return o&&o(e),t._downloadFile(e,r)})},t.prototype._downloadFile=function(e,t){var r=this;return new Promise(function(n){function o(){if(!y)if(h<u.length){var e=h++,t=d(e);c=c.then(function(){return t.then(function(t){return l(t,e,s)})}),t.then(o)}else y=!0,n(c.then(m))}var i=4,a=new E.default,s=e.blocks,u=new Array(s),c=Promise.resolve(),l=t.onData||function(e,t){u[t]=e},f=function(){};if(t.onProgress){var p=new Array(s);f=function(e,r){p[e]=Math.max(r,p[e]||0),t.onProgress(p.reduce(function(e,t){return e+(t||0)},0)/s*.99)}}for(var d=function(n){return r.client.request("files.download-block",{proofId:e.assignedTo,fileId:e.id,block:n+1,s:t.silent?1:void 0},{onDownloadProgress:f.bind(null,n)}).then(function(e){return r.client.crypto().decryptFileBlock(e.data,r.client.keyPairs.getPrivateKeyPEMs()).then(function(e){return a.createBase64(e)})})},h=0,y=!1,m=function(){return t.onProgress&&t.onProgress(100),t.onData?null:a.combine.apply(a,u)};i--;)o()})},t.prototype.details=function(e){return this.client.request("files.details",{fileId:e}).then(function(e){return(new p.default).fromFile(e.data)})},t.prototype.thumbnail=function(e){var t=this;return this.client.cache.auto(C.THUMBNAIL_CACHE_PREFIX+e,function(){return t._thumbnail(e)})},t.prototype._thumbnail=function(e){var t=this;return this.client.request("files.thumbnail",{fileId:e}).then(function(e){return t.client.crypto().decryptImage(e.data,t.client.keyPairs.getPrivateKeyPEMs())}).then(function(e){return(new E.default).createBase64(e)})},t.prototype.preview=function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"low";return this.client.cache.auto(C.PREVIEW_CACHE_PREFIX+e+r+n,function(){return t._preview(e,r,n)})},t.prototype._preview=function(e,t,r){var n=this;return this.client.request("files.preview",{fileId:e,pageNumber:t,quality:{low:"lo",high:"hi"}[r]||r}).then(function(e){return n.client.crypto().decryptImage(e.data,n.client.keyPairs.getPrivateKeyPEMs())}).then(function(e){return(new E.default).createBase64(e)})},t.prototype.thumbnails=function(e,t){var r=this,n=t.async,o=void 0!==n&&n,i=t.onLoadThumbnail,a=t.onLoadThumbnails,s=t.onLoadThumbnailsThrottleMs,u=void 0===s?1e3:s,c=t.onLoadError,l=[],f={},p=a?(0,w.default)(function(){Object.keys(f).length&&(a(f),f={})},u):function(){};return Promise.all(e.map(function(e){return r.client.cache.auto(C.THUMBNAIL_CACHE_PREFIX+e,function(t){l.push({fileId:e,resolve:t})}).then(function(t){var r;return t&&(r={},r[e]=t,r)})})).then(function(e){var t=Promise.all(l.map(function(e){var t=e.fileId,n=e.resolve;return r._thumbnail(t).then(function(e){var r;if(n(e),i){var o;i((o={},o[t]=e,o))}return f[t]=e,p(),r={},r[t]=e,r}).catch(function(e){return c&&c(e,t),o?{}:Promise.reject(e)})}));return o?e:t.then(function(t){return[].concat(e,t)})}).then(function(e){return Object.assign.apply(Object,[{}].concat(e))})},t.prototype.duplicate=function(e){return this.client.request("files.duplicate",{id:e}).then(function(e){return e.data.file})},t}(l.default);t.default=B},function(e,t,r){"use strict";function n(e){return(new s.default).readBase64(e).then(function(e){return"data:;base64,"+e})}function o(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n,r=new s.default,o=0,a=Promise.resolve(),u=r.size(e);return function(){var n=o++*i.BYTES_PER_BLOCK,s=n+i.BYTES_PER_BLOCK;return a=a.then(function(){return n>u?null:r.slice(e,n,s).then(t)})}}t.__esModule=!0;var i=r(5),a=r(4),s=function(e){return e&&e.__esModule?e:{default:e}}(a);t.default=o},function(e,t,r){"use strict";function n(e){function t(){if(r<e&&n.length){var o=n.shift(),i=o.handler,a=o.callback;return r+=1,Promise.resolve(i()).then(function(){return a(null)},function(e){return a(e)}).then(function(){return r-=1,t()})}return Promise.resolve()}var r=0,n=[];return function(e){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return new Promise(function(o,i){var a={handler:e,callback:function(e){e?i(e):o()}};r?n.splice(0,0,a):n.push(a),t()})}}t.__esModule=!0,t.default=n},function(e,t,r){"use strict";function n(e,t){var r=(0,l.getErrorMessage)(e,t);return{error:!0,code:e||-1,data:{ResponseStatus:e?Object.keys(p.default).find(function(t){return p.default[t]===e})||"UNKNOWN":"UNKNOWN",ResponseCode:e||-1},message:r,deprecated:null}}function o(e){if(!e||"string"!=typeof e){throw n(p.default.ERROR_FILE_UPLOAD_INVALID_FILENAME,"Filename must be a non-empty string")}var t=e.lastIndexOf(".");if(-1===t||t===e.length-1){throw n(p.default.ERROR_FILE_UPLOAD_MISSING_EXTENSION,'Invalid filename "'+e+'". Filename must include a file extension')}if(0===t){throw n(p.default.ERROR_FILE_UPLOAD_INVALID_FILENAME)}var r=e.substring(0,t),o=e.substring(t+1);if(!r.trim()){throw n(p.default.ERROR_FILE_UPLOAD_INVALID_FILENAME)}if(!o.trim()){throw n(p.default.ERROR_FILE_UPLOAD_MISSING_EXTENSION)}return{name:r.trim(),extension:o.trim().toLowerCase()}}function i(e){if(!Array.isArray(e)){throw new Error("Files must be an array")}e.forEach(function(e,t){if(!e||"object"!==(void 0===e?"undefined":c(e))){throw new Error("File at index "+t+" must be an object")}if(!e.name||"string"!=typeof e.name){throw new Error("File at index "+t+" must have a valid name (string)")}if(!e.contents){throw new Error("File at index "+t+" must have contents")}})}function a(e){return e.map(function(e){var t=null;if(!e.extension)try{t=o(e.name)}catch(e){throw e}return u({},e,{parsedFilename:t})})}function s(e){return i(e),a(e)}var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l=r(42),f=r(16),p=function(e){return e&&e.__esModule?e:{default:e}}(f);e.exports={parseFilename:o,validateFiles:i,addParsedFilenames:a,prepareFilesForUpload:s}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=r(0),u=n(s),c=r(145),l=n(c),f=function(e){function t(r){o(this,t);var n=i(this,e.call(this,r));return n.team=new l.default(r),n}return a(t,e),t}(u.default);t.default=f},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=r(0),u=n(s),c=r(146),l=n(c),f=r(147),p=n(f),d=r(149),h=n(d),y=r(160),m=n(y),g=r(163),v=n(g),b=r(164),E=n(b),C=r(70),_=n(C),w=r(165),T=n(w),S=function(e){function t(r){o(this,t);var n=i(this,e.call(this,r));return n.users=new l.default(r),n.dashboard=new p.default(r),n.features=new h.default(r),n.preferences=new m.default(r),n.scim=new v.default(r),n.workflows=new E.default(r),n.integrations=new _.default(r,"team"),n.customTools=new T.default(r),n}return a(t,e),t}(u.default);t.default=S},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){return e.data.map(function(e){return(new d.default).fromUser(e)})}t.__esModule=!0;var u=r(0),c=n(u),l=r(4),f=n(l),p=r(9),d=n(p),h=function(e){function t(){return o(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.enabled=function(){return this.client.request("admin.team.users.enabled").then(s)},t.prototype.disabled=function(){return this.client.request("admin.team.users.disabled").then(s)},t.prototype.getInvitations=function(){return this.client.request("admin.team.users.invitations").then(function(e){return e.data})},t.prototype._setEnabled=function(e,t){return this.client.request("admin.team.users.set-enabled",{email:e,enabled:t})},t.prototype.enable=function(e){return this._setEnabled(e,!0)},t.prototype.disable=function(e){return this._setEnabled(e,!1)},t.prototype.invite=function(e){return this.client.request("admin.team.users.invite",{emails:[].concat(e)})},t.prototype.revokeInvitation=function(e){var t=e.email,r=e.invitationId;return this.client.request("admin.team.users.revoke-invitation",{email:t,invitationId:r})},t.prototype.remove=function(e){return this.client.request("admin.team.users.remove-from-team",{users:[].concat(e)})},t.prototype.uploadAvatar=function(e,t){var r=this;return(new f.default).readBase64(t).then(function(t){return r.client.request("admin.team.users.upload-avatar",{userId:e,uploadedImage:"data:image/png;base64,"+t})})},t.prototype.deleteAvatar=function(e){return this.client.request("admin.team.users.delete-avatar",{userId:e})},t}(c.default);t.default=h},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e,t){var r={};return r.proofs=u(e[g[t]]),r.total=e.ProofsNumber,r}function u(e){return(e||[]).map(function(e){return(new p.default).fromProof(e)})}t.__esModule=!0;var c=r(0),l=n(c),f=r(13),p=n(f),d=r(21),h=n(d),y=r(148),m=n(y),g={inbox:"ProofIn",sent:"ProofSent",outbox:"ProofOut",search:"Proofs"},v=function(e){function t(r){o(this,t);var n=i(this,e.call(this,r));return n.groups=new m.default(r),n}return a(t,e),t.prototype.inbox=function(e){return this._loadSingleTeamTabProofs("inbox",{page:e})},t.prototype.sent=function(e){return this._loadSingleTeamTabProofs("sent",{page:e})},t.prototype.outbox=function(e){return this._loadSingleTeamTabProofs("outbox",{page:e})},t.prototype._loadSingleTeamTabProofs=function(e,t){return this.client.request("team.dashboard."+e,t).then(function(t){return s(t.data,e)}).then(function(e){return e})},t.prototype.everything=function(e){return this.search(void 0,{everything:!0,page:e})},t.prototype.approved=function(e){return this.search(void 0,{status:h.default.APPROVED,page:e})},t.prototype.archived=function(e){return this.search(void 0,{status:h.default.ARCHIVED,page:e})},t.prototype.search=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.status,n=t.everything,o=t.page;return this._loadTeamSearchProofs({query:e,filterBy:void 0===r?void 0:[].concat(r).join(","),all:n?1:0,page:o})},t.prototype._loadTeamSearchProofs=function(e){return this.client.request("team.dashboard.search",e).then(function(e){return s(e.data,"search")})},t}(l.default);t.default=v},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){return(e||[]).map(function(e){return(new p.default).fromProofGroup(e)})}function u(e){return(new p.default).fromProofGroup(e.data)}t.__esModule=!0;var c=r(0),l=n(c),f=r(23),p=n(f),d=function(e){function t(){return o(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype._loadGroups=function(e){return this.client.request("admin.team.dashboard.groups.category",{category:e}).then(function(e){return s(e.data)})},t.prototype.load=function(e){return this.client.request("admin.team.proofs.groups.load",{groupId:e}).then(u)},t.prototype.current=function(){return this._loadGroups("current")},t.prototype.archived=function(){return this._loadGroups("archived")},t}(l.default);t.default=d},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=r(0),u=n(s),c=r(150),l=n(c),f=function(e){function t(){return o(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.load=function(){return this.client.request("admin.team.features.load").then(function(e){return e.data?(new l.default).fromTeamFeatures(e.data):null})},t.prototype.update=function(e){var t=e.emails,r=e.comments,n=e.proofs,o=e.workflows,i=e.addressBook,a=e.userGroups,s=e.webhooks,u=e.intelligence,c=t&&t.displayComments,l=t&&t.displayTeamName,f=r&&r.generalComments,p=r&&r.privateComments,d=r&&r.enableCommentVisibility,h=r&&r.defaultCommentVisibility,y=o&&o.enableViewOnlyReviewers,m=t&&t.titleTextColor,g=t&&t.linkTextColor,v=t&&t.buttonBackgroundColor,b=t&&t.buttonTextColor,E=r&&r.editComments,C=r&&r.ownerCanDeleteComments,_=r&&r.disableReplyingToCommentsInStatuses&&[].concat(r.disableReplyingToCommentsInStatuses),w=n&&n.reference,T=n&&n.referenceRequired,S=n&&n.publicProofs,I=n&&n.usePreviousVersionDueDate,A=n&&n.defaultIsPublic,k=n&&n.messageToOwners,B=n&&n.allowedDecisions,R=n&&n.enableChecklists,P=n&&n.enableProofMagicAccess,O=n&&n.defaultGifOutput,D=i&&i.suggestionsIncludeTeamMembers,N=a&&a.enableUserGroups,L=s&&s.enabled,U=u&&u.enableIntelligence,x=u&&u.enableSmartTags,M=u&&u.enableSmartCheckCr;return this.client.request("admin.team.features.update",{displayComments:c,displayTeamName:l,generalComments:f,privateComments:p,enableWebhooks:L,enableCommentVisibility:d,defaultCommentVisibility:h,enableViewOnlyReviewers:y,emailTitleTextColor:m,emailLinkTextColor:g,emailButtonBackgroundColor:v,emailButtonTextColor:b,editComments:E,ownerCanDeleteComments:C,disableReplyingToCommentsInStatuses:_,proofReference:w,proofReferenceRequired:T,publicProofs:S,defaultProofIsPublic:A,messageToOwners:k,allowedDecisions:B,enableChecklists:R,enableProofMagicAccess:P,defaultGifOutput:O,enableIntelligence:U,enableIntelligenceSmartTags:x,enableIntelligenceSmartCheckCr:M,suggestionsIncludeTeamMembers:D,enableUserGroups:N,usePreviousVersionDueDate:I})},t.prototype.setSenderEmail=function(e){return this.client.request("admin.team.features.sender-email.set",{senderEmail:e}).then(function(e){return{success:e.data.Success,domain:e.data.Domain,email:e.data.Email,records:e.data.Records&&e.data.Records.map(function(e){return{version:e.Version,current:e.Current,new:e.New}})}})},t}(u.default);t.default=f},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=r(3),a=n(i),s=r(151),u=n(s),c=r(152),l=n(c),f=r(153),p=n(f),d=r(154),h=n(d),y=r(155),m=n(y),g=r(156),v=n(g),b=r(157),E=n(b),C=r(158),_=n(C),w=r(159),T=n(w),S={emails:function(e){return(new u.default).fromTeamEmailFeatures(e)},comments:function(e){return(new l.default).fromTeamCommentFeatures(e)},proofs:function(e){return(new p.default).fromTeamProofFeatures(e)},workflows:function(e){return(new h.default).fromTeamWorkflowFeatures(e)},addressBook:function(e){return(new m.default).fromTeamAddressBookFeatures(e)},accounts:function(e){return(new v.default).fromTeamAccountFeatures(e)},webhooks:function(e){return(new E.default).fromTeamWebhookFeatures(e)},userGroups:function(e){return(new T.default).fromTeamUserGroupsFeatures(e)},intelligence:function(e){return(new _.default).fromTeamIntelligenceFeatures(e)}},I=function(){function e(){o(this,e)}return e.prototype.fromTeamFeatures=function(e){return(0,a.default)(this,S,e),this},e}();t.default=I},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=r(3),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a={displayComments:"DisplayComments",displayTeamName:"DisplayTeamName",customStyles:"EmailCustomStyles",titleTextColor:"EmailTitleTextColor",linkTextColor:"EmailLinkTextColor",buttonBackgroundColor:"EmailButtonBackgroundColor",buttonTextColor:"EmailButtonTextColor",senderEmail:"SenderEmail"},s=function(){function e(){n(this,e)}return e.prototype.fromTeamEmailFeatures=function(e){return(0,i.default)(this,a,e),this},e}();t.default=s},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=r(3),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a={editComments:"EditComments",ownerCanDeleteComments:"OwnerCanDeleteComments",disableReplyingToCommentsInStatuses:"DisableReplyingToCommentsInStatuses",generalComments:"GeneralComments",configurePrivateComments:"LicensePrivateComments",privateComments:"PrivateComments",configureCommentVisibility:"LicenseCommentVisibility",enableCommentVisibility:"EnableCommentVisibility",defaultCommentVisibility:"DefaultCommentVisibility"},s=function(){function e(){n(this,e)}return e.prototype.fromTeamCommentFeatures=function(e){return(0,i.default)(this,a,e),this},e}();t.default=s},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=r(3),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a={reference:"ProofReference",referenceRequired:"ProofReferenceRequired",publicProofs:"PublicProofs",usePreviousVersionDueDate:"UsePreviousVersionDueDate",defaultIsPublic:"DefaultProofIsPublic",messageToOwners:"MessageToOwners",allowedDecisions:"AllowedDecisions",enableChecklists:"EnableChecklists",defaultGifOutput:"DefaultGifOutput",enableProofMagicAccess:"EnableProofMagicAccess"},s=function(){function e(){n(this,e)}return e.prototype.fromTeamProofFeatures=function(e){return(0,i.default)(this,a,e),this},e}();t.default=s},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=r(3),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a={configureViewOnlyReviewers:"LicenseViewOnlyReviewers",enableViewOnlyReviewers:"EnableViewOnlyReviewers"},s=function(){function e(){n(this,e)}return e.prototype.fromTeamWorkflowFeatures=function(e){return(0,i.default)(this,a,e),this},e}();t.default=s},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=r(3),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a={suggestionsIncludeTeamMembers:"SuggestionsIncludeTeamMembers",configureSuggestionsIncludeTeamMembers:"LicenseSuggestionsIncludeTeamMembers"},s=function(){function e(){n(this,e)}return e.prototype.fromTeamAddressBookFeatures=function(e){return(0,i.default)(this,a,e),this},e}();t.default=s},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=r(3),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a={teamId:"Id",teamName:"Name",teamType:"Type",teamIsPlus:"IsPlus",teamIsTrial:"IsTrial"},s=function(){function e(){n(this,e)}return e.prototype.fromTeamAccountFeatures=function(e){return(0,i.default)(this,a,e),this},e}();t.default=s},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=r(3),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a={configurable:"LicenseWebhooks",enabled:"EnableWebhooks"},s=function(){function e(){n(this,e)}return e.prototype.fromTeamWebhookFeatures=function(e){return(0,i.default)(this,a,e),this},e}();t.default=s},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=r(3),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a={enableIntelligence:"EnableIntelligence",enableSmartTags:"EnableIntelligenceSmartTags",enableSmartCheckCr:"EnableIntelligenceSmartCheckCr"},s=function(){function e(){n(this,e)}return e.prototype.fromTeamIntelligenceFeatures=function(e){return(0,i.default)(this,a,e),this},e}();t.default=s},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=r(3),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a={licenseUserGroups:"LicenseUserGroups",enableUserGroups:"EnableUserGroups"},s=function(){function e(){n(this,e)}return e.prototype.fromTeamUserGroupsFeatures=function(e){return(0,i.default)(this,a,e),this},e}();t.default=s},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=r(0),u=n(s),c=r(161),l=n(c),f=function(e){function t(r){o(this,t);var n=i(this,e.call(this,r));return n.notifications=new l.default(r),n}return a(t,e),t}(u.default);t.default=f},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=r(0),u=n(s),c=r(162),l=n(c),f=function(e){function t(){return o(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.load=function(){return this.client.request("admin.team.preferences.notifications.load").then(function(e){return e.data?(new l.default).fromTeamNotifications(e.data):null})},t.prototype.set=function(e){var t=e.ownerAddedByAdmin;return this.client.request("admin.team.preferences.notifications.set",{ownerAddedByAdmin:t})},t}(u.default);t.default=f},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=r(3),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a={teamId:"TeamId",ownerAddedByAdmin:"OwnerAddedByAdmin"},s=function(){function e(){n(this,e)}return e.prototype.fromTeamNotifications=function(e){return(0,i.default)(this,a,e),this},e}();t.default=s},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=r(0),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=function(e){function t(){return n(this,t),o(this,e.apply(this,arguments))}return i(t,e),t.prototype.settings=function(){return this.client.request("scim.admin.settings").then(function(e){return e.data.settings})},t.prototype.enable=function(){return this.client.request("scim.admin.enable").then(function(e){return e.data.settings})},t.prototype.disable=function(){return this.client.request("scim.admin.disable").then(function(){})},t.prototype.regenerateAccessToken=function(e){return this.client.request("scim.admin.regenerate-access-token",{type:e}).then(function(e){return e.data.settings})},t}(s.default);t.default=u},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){return(e||[]).map(function(e){return(new f.default).fromWorkflow(e)})}t.__esModule=!0;var u=r(0),c=n(u),l=r(37),f=n(l),p=function(e){function t(){return o(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.owned=function(){return this.client.request("admin.team.workflows.owned").then(function(e){return s(e.data)})},t.prototype._getOwnedEmailList=function(){return this.client.request("admin.team.workflows.owned.email-list").then(function(e){return e.data.map(function(e){return{id:e.WorkflowId,emails:e.Emails}})})},t}(c.default);t.default=p},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=r(0),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=function(e){function t(){return n(this,t),o(this,e.apply(this,arguments))}return i(t,e),t.prototype.load=function(){return this.client.request("admin.team.custom-tools.load").then(function(e){return e.data.tools})},t.prototype.update=function(e){return this.client.request("admin.team.custom-tools.update",{updates:e}).then(function(e){return e.data.tools})},t}(s.default);t.default=u},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){return e&&((0,g.isUserId)(e.id)||e.email)}function u(e){return(e||[]).map(function(e){return(new p.default).fromWorkflow(e)})}t.__esModule=!0;var c=r(0),l=n(c),f=r(37),p=n(f),d=r(25),h=n(d),y=r(38),m=n(y),g=r(61),v=r(167),b=n(v),E=function(e){function t(r){o(this,t);var n=i(this,e.call(this,r));return n.steps=new b.default(r),n}return a(t,e),t.prototype.create=function(e){var t=this,r=e.save,n=void 0!==r&&r,o=e.name,i=e.steps,a=void 0===i?[]:i,u=e.reviewers,c=e.approver,l=e.owners,f=e.isOwnedByTeam,p=void 0!==f&&f,d=Array.isArray(c)?c:[c];if(c&&!d.every(s))return Promise.reject(Error("Please provide an id or email address for every approver."));if(n&&!o)return Promise.reject(Error("A workflow must have a name when saving it as a workflow template."));var h=a;u&&u.length&&h.splice(0,0,{users:u}),c&&h.push({position:1e3,users:d,start:c.start});for(var y=0,m=0;m<h.length;m++){var g=h[m];g.users=g.users||[],(!g.position||g.position<y)&&(g.position=y+1),y=Math.max(y,g.position);for(var v=0;v<g.users.length;v++){if(!s(g.users[v]))return Promise.reject(Error("A user id or email address must be provided for a workflow user."))}}var b=void 0;return this._createWorkflow(o,p).then(function(e){return b=e.id,Promise.all([e,Promise.all(h.map(function(r){var n=e.getStepByPosition(r.position),o={};return r.dueDate&&(o.dueDate=r.dueDate),void 0!==r.mandatoryDecisionThreshold&&(o.mandatoryDecisionThreshold=r.mandatoryDecisionThreshold),r.name&&(o.title=r.name),n?Promise.resolve(Object.keys(o).length&&t.steps.update(n.id,o).then(function(e){n.dueDate=e.dueDate})).then(function(){return t._setWorkflowStepUsersMutate(e.id,n,r.users,r.start)}):t._addWorkflowStepAndUsers(e.id,r,r.start)})),l&&Promise.all(l.map(function(e){return t._addProofOwnerToWorkflowTemplate(b,e)}))])}).then(function(e){var t=e[0],r=e[1];return t.steps=r,t}).then(function(e){return n?t._duplicateWorkflow(b):e}).catch(function(e){return Promise.resolve(b&&t._deleteWorkflow(b)).then(function(){return Promise.reject(e)})})},t.prototype.load=function(e){return this.client.request("workflows.load",{workflowId:e}).then(function(e){return(new p.default).fromWorkflow(e.data)})},t.prototype.use=function(e,t){return this.duplicate(e,t)},t.prototype.duplicate=function(e,t){return this._duplicateWorkflow(e,t)},t.prototype.delete=function(e){return this._deleteWorkflow(e)},t.prototype.all=function(){return Promise.all([this.owned(),this.shared()]).then(function(e){return[].concat(e[0],e[1])})},t.prototype.owned=function(){return this.client.request("workflows.owned").then(function(e){return u(e.data)})},t.prototype.shared=function(){return this.client.request("workflows.shared").then(function(e){return u(e.data)})},t.prototype.setApprover=function(e,t){return this.client.request("workflows.users.set",{workflowId:e,position:1e3,users:[t]})},t.prototype.skipAll=function(e){return this.client.request("workflows.users.skip-all",{workflowId:e})},t.prototype.nudgeUser=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return this.client.request("workflows.user.nudge",{workflowId:e,userId:t,message:r})},t.prototype.nudgeAll=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this.client.request("workflows.nudge-all",{workflowIds:[].concat(e),message:t}).then(function(e){return{nudgedWorkflows:e.data.NudgedWorkflows.map(function(e){return{workflowId:e.WorkflowId,users:e.Users.map(function(e){return{userId:e.UserId,role:e.Role,stepId:e.StepId,position:Number(e.Position)}})}}),errors:e.data.Errors.map(function(e){return{workflowId:e.WorkflowId,errorCode:e.ErrorCode,errorMessage:e.ErrorMessage}})}})},t.prototype.setStartingStep=function(e,t){return this.client.request("workflows.set-starting-step",{workflowId:e,stepId:t})},t.prototype.replaceApprover=function(e,t){return this.client.request("workflows.replace-approver",{workflowIds:[].concat(e),user:t})},t.prototype.update=function(e,t){var r=t.name,n=t.isOwnedByTeam;return this.client.request("workflows.update",{workflowId:e,title:r,ownedByTeam:n}).then(function(e){return(new p.default).fromWorkflow(e.data)})},t.prototype.getNudgeAllMessage=function(e){return this.client.request("workflows.nudge-message",{workflowId:e}).then(function(e){return e.data.Message})},t.prototype.getNudgeMessage=function(e,t){return this.client.request("workflows.nudge-message",{workflowId:e,userId:t}).then(function(e){return e.data.Message})},t.prototype.favorite=function(e){return this.client.request("workflows.favorite",{workflowId:e})},t.prototype.unfavorite=function(e){return this.client.request("workflows.unfavorite",{workflowId:e})},t.prototype._duplicateWorkflow=function(e,t){var r=this;return this.client.request("workflows.duplicate",{workflowId:e,noOwners:!(!t||!1!==t.includeOwners)||void 0,excludeStepDueDates:!(!t||!1!==t.includeStepDueDates)||void 0,includeOwnedByTeam:t&&!0===t.includeOwnedByTeam||void 0,includeSharedUsers:t&&!0===t.includeSharedUsers||void 0}).then(function(e){var t=e.data.WorkflowId;return r.load(t)})},t.prototype._deleteWorkflow=function(e){return this.client.request("workflows.delete",{workflowId:e})},t.prototype._createWorkflow=function(e,t){return this.client.request("workflows.create",{title:e,ownedByTeam:t}).then(function(e){return(new p.default).fromWorkflow(e.data)})},t.prototype._addWorkflowStepAndUsers=function(e,t,r){var n=this;return this.client.request("workflows.steps.add",{workflowId:e,title:t.name,position:t.position,dueDate:t.dueDate,mandatoryDecisionThreshold:t.mandatoryDecisionThreshold}).then(function(o){var i=(new h.default).fromWorkflowStep(o.data);return n._setWorkflowStepUsersMutate(e,i,t.users,r)})},t.prototype._setWorkflowStepUsersMutate=function(e,t,r,n){var o=this;return this.client.request("workflows.users.set",{workflowId:e,stepId:t.id,users:r.map(function(e){return{email:e.email,userId:e.id,role:e.role,permissions:e.permissions&&{inviter:!!e.permissions.inviter}}})}).then(function(e){var r=e.data.map(function(e){return(new m.default).fromWorkflowUser(e)});t.users=r}).then(function(){return!0===n?o.setStartingStep(e,t.id).then(function(){return t}):t})},t.prototype._addProofOwnerToWorkflowTemplate=function(e,t){return this.client.request("workflows.proof-owners.add",{relatedId:e,workflowCopyToProof:1,userId:t.id,email:t.email})},t.prototype._getOwnedEmailList=function(){return this.client.request("workflows.owned.email-list").then(function(e){return e.data.map(function(e){return{id:e.WorkflowId,emails:e.Emails}})})},t.prototype._getSharedEmailList=function(){return this.client.request("workflows.shared.email-list").then(function(e){return e.data.map(function(e){return{id:e.WorkflowId,emails:e.Emails}})})},t}(l.default);t.default=E},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=r(25),u=n(s),c=r(0),l=n(c),f=function(e){function t(){return o(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.moveBefore=function(e,t){return this.client.request("workflows.steps.move-before",{stepId:e,beforeStepId:t})},t.prototype.moveAfter=function(e,t){return this.client.request("workflows.steps.move-after",{stepId:e,afterStepId:t})},t.prototype.swap=function(e,t){return this.client.request("workflows.steps.swap",{stepId:e,swapStepId:t})},t.prototype.update=function(e,t){var r=t.title,n=t.dueDate,o=t.mandatoryDecisionThreshold;return this.client.request("workflows.steps.update",{stepId:e,title:r,dueDate:n,mandatoryDecisionThreshold:o}).then(function(e){return(new u.default).fromWorkflowStep(e.data)})},t}(l.default);t.default=f},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){return(new p.default).fromPreference(e)}function u(e,t){var r=new Array(e.length);return t.forEach(function(t){r[e.indexOf(t.name)]=t}),r}t.__esModule=!0;var c=r(0),l=n(c),f=r(169),p=n(f),d=function(e){function t(){return o(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.all=function(){return this.client.request("preferences.all")},t.prototype.get=function(e){var t=[].concat(e);return this.client.request("preferences.get",{preferences:t}).then(function(e){return e.data.map(s)}).then(function(r){return"string"==typeof e?r[0]:u(t,r)})},t.prototype.update=function(e,t){var r,n=void 0!==t?(r={},r[e]=t,r):e;return this.client.request("preferences.update",n)},t.prototype.reset=function(e){return this.client.request("preferences.reset",{preferences:[].concat(e)})},t}(l.default);t.default=d},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=r(3),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a={name:"Name",defaultValue:"DefaultValue",value:"Value"},s=function(){function e(){n(this,e)}return e.prototype.getValueOrDefault=function(){return null===this.value?this.defaultValue:this.value},e.prototype.fromPreference=function(e){return(0,i.default)(this,a,e),this},e}();t.default=s},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){var t=[];return Object.keys(e).forEach(function(r){e[r].Comments.forEach(function(e){t.push(e)})}),t}function u(e){var t=[],r=[];e.forEach(function(e){var n=(new p.default).fromComment(e);n.parentCommentId?r.push(n):t.push(n)}),t.sort(L);var n=t.map(function(e){return e.id}),o=(0,m.sortObjectsBy)(function(e){return n.indexOf(e.parentCommentId)},!0);return r.sort((0,m.combineSort)(U,o)),t.concat(r)}t.__esModule=!0;var c=r(0),l=n(c),f=r(71),p=n(f),d=r(41),h=n(d),y=r(5),m=r(63),g=r(40),v=r(75),b=n(v),E=r(39),C=n(E),_=r(172),w=r(66),T=n(w),S=r(72),I=n(S),A=r(77),k=r(173),B=n(k),R=r(4),P=n(R),O=(0,m.sortObjectsByKey)("pageNumber"),D=(0,m.sortObjectsByKey)("createdDate",!0),N=(0,m.sortObjectsByKey)("createdDate",!1),L=(0,m.combineSort)(O,D),U=(0,m.combineSort)(O,N),x=function(e){function t(r){o(this,t);var n=i(this,e.call(this,r));return n.import=new B.default(r),n}return a(t,e),t.prototype._mark=function(e,t,r){if(-1===Object.keys(h.default).map(function(e){return h.default[e]}).indexOf(t))throw new Error('Cannot mark comment state "'+t+'".');var n=h.default.TODO,o=h.default.DONE,i=h.default.UNMARKED,a={commentId:e};switch(t){case i:a.change=0,a.done=0;break;case n:a.change=r?1:0,a.done=0;break;case o:a.done=r?1:0}return this.client.request("comments.state.update",a).then(function(e){return(0,I.default)(e.data)})},t.prototype._markAll=function(e,t,r,n){if(-1===Object.keys(h.default).map(function(e){return h.default[e]}).indexOf(r))throw new Error('Cannot mark comment state "'+r+'".');var o=h.default.TODO,i=h.default.DONE,a=h.default.UNMARKED,s={proofId:e,commentIds:t};switch(r){case a:s.change=0,s.done=0;break;case o:s.change=n?1:0,s.done=0;break;case i:s.done=n?1:0}return this.client.request("comments.state.multiple-update",s).then(function(e){return e.data.map(function(e){return{commentId:e.CommentId,commentState:(0,I.default)(e)}})})},t.prototype.mark=function(e,t){return this._mark(e,t,!0)},t.prototype.unmark=function(e,t){return this._mark(e,t,!1)},t.prototype.markAll=function(e,t,r){return this._markAll(e,t,r,!0)},t.prototype.unmarkAll=function(e,t,r){return this._markAll(e,t,r,!1)},t.prototype.delete=function(e){return this.client.request("comments.delete",{commentId:e})},t.prototype.load=function(e){var t=this,r="string"==typeof e?{proofId:e}:e,n=r.proofId,o=r.pageNumber,i=void 0===o?null:o,a=r.sinceDate,c=void 0===a?null:a,l=r.async,f=void 0!==l&&l,p=r.decrypt,d=void 0===p||p,h=r.onDecryptComment,m=r.onDecryptComments,g=r.onDecryptCommentsThrottleMs,v=void 0===g?1e3:g,b=r.onDecryptError,E=c?c.toISOString().match(y.ISO_REGEX)[0]:y.DEFAULT_ISO_DATE,C={proofId:n,page:i,timestamp:E};return this.client.request(null!==i?"comments.load-page":"comments.load-all",C).then(function(e){var r=u(e.data.Pages?s(e.data.Pages):e.data),n=Promise.resolve();if(d){var o=[],i=[],a=m?(0,T.default)(function(){i.length&&(m(i),i=[])},v):function(){},c=Promise.all(r.map(function(e){return t.client.cache.auto(y.COMMENT_CACHE_PREFIX+e.comment$,function(t){o.push({comment:e,resolve:t})}).then(function(t){return t&&e.fromRawComment(t),e})}));n=n.then(function(){return c}),n=n.then(function(){var e=o.map(function(e){var r=e.comment,n=e.resolve;return t.client.crypto().decryptComment(r.comment$,r.envelope,t.client.keyPairs.getPrivateKeyPEMs()).then(function(e){r.fromRawComment(e),n(e),h&&h(r),i.push(r),a()}).catch(function(e){if(b&&b(e,r),!f)return Promise.reject(e)})});return f?null:Promise.all(e)})}return n.then(function(){return r})})},t.prototype.create=function(e){var t=this,r=e.raw,n=e.tokens,o=e.proofId,i=e.pageNumber,a=void 0===i?1:i,s=e.pin,u=e.pins,c=e.mediaTime,l=e.mediaDuration,f=e.parentCommentId,d=e.metadata,y=e.sourceMetadata,m=e.state,v=e.autoState,E=e.isPrivate,w=e.creationToken,T=[],S=r||(0,g.serialize)(n),I=n||(0,C.default)(r);T.push.apply(T,(0,b.default)(I));var k=[],B=void 0;u?k=k.concat(u):s&&k.push(s);var R=k[0];R&&(R.fill&&(B=R.fill),c&&(R.time=c),l&&(R.duration=l));var P=w||(0,_.generateCreationToken)();return this.client.crypto().encryptComment(S,this.client.keyPairs.getPublicKeyPEMs()).then(function(e){var t=e.envelope,r=e.comment$;return{proofId:o,page:f?void 0:a,envelope:t,encryptedComment:r,xy:(0,A.serializePins)(k),boxFillImage:B?B.image:void 0,boxFillType:B?B.type:void 0,parent:f||void 0,mentions:T,metadata:d?JSON.stringify(d):"{}",sourceMetadata:y,creationToken:P,change:m===h.default.TODO?"1":void 0,done:m===h.default.DONE?"1":void 0,autoState:v,private:void 0!==E?E?"1":"0":void 0}}).then(function(e){return t.client.request("comments.create",e).then(function(e){return(new p.default).fromComment(e.data).fromRawComment(S)})}).catch(function(e){return e&&(e.creationToken=P),Promise.reject(e)})},t.prototype.loadContext=function(e){var t=this;return this.client.request("comments.load-context",{commentId:e}).then(function(e){return t.client.crypto().decryptImage(e.data,t.client.keyPairs.getPrivateKeyPEMs())}).then(function(e){return(new P.default).createBase64(e)})},t}(l.default);t.default=x},function(e,t,r){"use strict";function n(e){for(var t=[],r=e.split(/\n/g),n=0;n<r.length;n++){var i=r[n],a=[];if(0===n){var s=i.match(o.COMMENT_LABEL_REGEX);s&&a.push({type:"label",index:0,length:s[0].length,metadata:{label:s[1].toLowerCase()}})}for(var u=void 0;null!==(u=o.MENTION_REGEX.exec(i));){var c=u,l=c[0],f=c[1],p=c[2];a.push({type:"mention",index:u.index,length:p.length,metadata:{id:f}}),i=i.substring(0,u.index)+p+i.substring(u.index+l.length)}t.push({type:"text",value:i,styles:[],entities:a})}return{version:2,blocks:t}}t.__esModule=!0,t.parse=void 0;var o=r(5);t.parse=n},function(e,t,r){"use strict";function n(){var e=(new Date).getTime();return(0,i.default)(s,a)+"-"+e}t.__esModule=!0,t.generateCreationToken=void 0;var o=r(76),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a=32,s=o.lower+o.upper+o.numbers+o.symbols;t.generateCreationToken=n},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},c=r(0),l=n(c),f=r(24),p=n(f),d=r(4),h=n(d),y=function(e){function t(){return i(this,t),a(this,e.apply(this,arguments))}return s(t,e),t.prototype._createTask=function(e){var t=this;return this.client.crypto().generateCommentImportKey(this.client.session.serverPublicKeyPEM).then(function(r){var n=r.key,o=r.key$;return t.client.request("comments.import.create-task",{options:u({},e,{key:o})}).then(function(e){return[e.data,n]})})},t.prototype._startTask=function(e,t){return this.client.request("comments.import.action-task",{id:e,options:t,action:"start"}).then(function(e){return e.data.task})},t.prototype.fromFile=function(e,t,r){var n=this,i=t.proofId,a=t.fileName,s=o(t,["proofId","fileName"]);return this._createTask({type:"pdf",proofId:i,fileName:a}).then(function(t){var o=t[0],i=o.task,a=o.uploadRequest,s=t[1],u=new h.default;return u.readBase64(e).then(function(e){return n.client.crypto().encryptCommentImportFile(s,e)}).then(function(e){return u.createBase64(e)}).then(function(e){return n.client.rawRequest({url:new p.default(a.url),method:a.method,headers:a.headers,body:e},{onUploadProgress:r})}).then(function(){return i})}).then(function(e){return n._startTask(e.id,s)})},t.prototype.info=function(e){return this.client.request("comments.import.get-task",{id:e}).then(function(e){return e.data.task})},t.prototype.cancel=function(e){return this.client.request("comments.import.action-task",{id:e,action:"cancel",options:{}}).then(function(e){return e.data.task})},t}(l.default);t.default=y},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=r(0),u=n(s),c=r(4),l=n(c),f=r(70),p=n(f),d=function(e){function t(r){o(this,t);var n=i(this,e.call(this,r));return n.integrations=new p.default(r,"user"),n}return a(t,e),t.prototype.uploadAvatar=function(e){var t=this;return(new l.default).readBase64(e).then(function(e){return t.client.request("profile.upload-avatar",{uploadedImage:"data:image/png;base64,"+e})})},t.prototype.deleteAvatar=function(){return this.client.request("profile.delete-avatar")},t.prototype.changePassword=function(e,t){var r=this,n=this.client.crypto();return Promise.all([n.generatePasswordHash(e),n.generatePasswordHash(t),n.encryptPrivateKey(this.client.session.privateKeyPEM,t)]).then(function(e){var t=e[0],n=e[1],o=e[2];return r.client.request("profile.change-password",{oldPassword:t,newPassword:n,newPrivateKey:o})})},t.prototype.getStatus=function(){return this.client.request("profile.status").then(function(e){return e.data.status})},t.prototype.setStatus=function(e){return this.client.request("profile.set-status",e)},t.prototype.clearStatus=function(){return this.client.request("profile.clear-status")},t}(u.default);t.default=d},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=r(0),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=function(e){function t(){return n(this,t),o(this,e.apply(this,arguments))}return i(t,e),t.prototype.check=function(){return this.client.request("sessions.check").then(function(){return null})},t}(s.default);t.default=u},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=r(0),u=n(s),c=r(4),l=n(c),f=function(e){function t(){return o(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.decrypt=function(e){var t=this,r=e.version,n=e.data,o=e.envelope,i=new l.default;return("string"==typeof n?i.create(n):Promise.resolve(n)).then(function(e){return i.read(e).then(function(e){return t.client.crypto().decryptData(r,e,o,t.client.keyPairs.getPrivateKeyPEMs()).then(function(e){return i.create(e)})})})},t}(u.default);t.default=f},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=r(0),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=function(e){function t(){return n(this,t),o(this,e.apply(this,arguments))}return i(t,e),t.prototype.generateAccessToken=function(){return this.client.request("live.generate-access-token").then(function(e){return e.data.AccessToken})},t}(s.default);t.default=u},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=r(0),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=function(e){function t(){return n(this,t),o(this,e.apply(this,arguments))}return i(t,e),t.prototype.rekeyUsersProofs=function(e){return this.client.request("brian.rekey-users-proofs",{userId:e.userId})},t}(s.default);t.default=u},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=r(17),a=function(e){return e&&e.__esModule?e:{default:e}}(i),s=r(34)("EventEmitter"),u=function(){function e(){n(this,e),this.handlers={}}return e.prototype.getHandlers=function(e){var t=this,r=[],n=[e];if(-1!==e.indexOf("."))for(var o=e;(o=o.substring(0,o.lastIndexOf("."))).length;)n.push(o+".*");return n.push("*"),n.forEach(function(e){(0,a.default)(t.handlers,e)&&r.push.apply(r,t.handlers[e])}),r},e.prototype.on=function(e,t){if("function"!=typeof t)return void s("Handler is not a function, got "+(void 0===t?"undefined":o(t)));(0,a.default)(this.handlers,e)||(this.handlers[e]=[]),this.handlers[e].push(t)},e.prototype.off=function(e,t){if((0,a.default)(this.handlers,e)){var r=this.handlers[e];r.splice(r.indexOf(t),1)}},e.prototype.addEventListener=function(e,t){return this.on(e,t)},e.prototype.removeEventListener=function(e,t){return this.off(e,t)},e.prototype.emit=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=this.getHandlers(e),o=new Array(n.length);s("Emitting"+(r?" async":"")+' "'+e+'" event ('+(t?"with":"without")+" data) to "+n.length+" handler(s)");var i=Object.freeze({type:e,data:t,timestamp:Date.now()});return n.forEach(function(e,t){try{o[t]=e(i)}catch(e){o[t]=e}}),r?Promise.all(o):o},e}();t.default=u},function(e,t,r){"use strict";function n(){try{o||(o=Intl.DateTimeFormat().resolvedOptions().timeZone||null)}catch(e){}return o}t.__esModule=!0;var o=null;t.default=n},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;t.AggregateError="undefined"!=typeof globalThis&&globalThis.AggregateError||"undefined"!=typeof global&&global.AggregateError||"undefined"!=typeof window&&window.AggregateError||function(e){function t(r,i){n(this,t);var a=o(this,e.call(this,r));return a.name="AggregateError",a.errors=i,a}return i(t,e),t}(Error)},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;t.GraphQLError=function(e){function t(r,i,a){n(this,t);var s=o(this,e.call(this,r));return s.name="GraphQLError",i&&(s.locations=i),a&&(s.path=a),s}return i(t,e),t}(Error)},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(0),u=function(e){return e&&e.__esModule?e:{default:e}}(s),c=function(e){function t(){return n(this,t),o(this,e.apply(this,arguments))}return i(t,e),t.prototype.listConfigurations=function(){return this.client.request("reports.configurations")},t.prototype.create=function(e,t){return this.client.request("reports.create",a({report:e},t))},t}(u.default);t.default=c},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=r(0),u=n(s),c=r(185),l=n(c),f=function(e){function t(r){o(this,t);var n=i(this,e.call(this,r));return n.invitations=new l.default(r),n}return a(t,e),t}(u.default);t.default=f},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=r(0),u=n(s),c=r(186),l=n(c),f=function(e){function t(){return o(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.info=function(e){return this.client.request("teams.invitations.info",{invitationId:e}).then(function(e){return(new l.default).fromTeamInvitation(e.data)})},t.prototype.accept=function(e){return this.client.request("teams.invitations.accept",{invitationId:e}).then(function(){return null})},t.prototype.decline=function(e){return this.client.request("teams.invitations.decline",{invitationId:e}).then(function(){return null})},t}(u.default);t.default=f},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=r(3),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a={name:"Name",logo:"Logo",teamId:"TeamId"},s=function(){function e(){n(this,e)}return e.prototype.fromTeamInvitation=function(e){return(0,i.default)(this,a,e),this},e}();t.default=s},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=r(0),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=function(e){function t(){return n(this,t),o(this,e.apply(this,arguments))}return i(t,e),t.prototype.options=function(e){return this.client.request("printing.options",{proofId:e})},t.prototype.create=function(e){return this.client.request("printing.create",e)},t}(s.default);t.default=u},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=r(0),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=function(e){function t(){return n(this,t),o(this,e.apply(this,arguments))}return i(t,e),t.prototype.requestTeam=function(e){return this.client.request("free-trial.request-team",e).then(function(e){return e.data})},t}(s.default);t.default=u},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=function(){function e(t){n(this,e),this.keyPairs=[],this.client=t}return e.prototype.addKeyPair=function(e){var t=this;return this.keyPairs.push(e),function(){return t.removeKeyPair(e)}},e.prototype.removeKeyPair=function(e){this.keyPairs.splice(this.keyPairs.indexOf(e),1)},e.prototype.getPrivateKeyPEMs=function(){return[this.client.session&&this.client.session.privateKeyPEM].concat(this.keyPairs.map(function(e){return e.privateKeyPEM})).filter(Boolean)},e.prototype.getPublicKeyPEMs=function(){return[this.client.session&&this.client.session.serverPublicKeyPEM,this.client.session&&this.client.session.publicKeyPEM].concat(this.keyPairs.map(function(e){return e.publicKeyPEM})).filter(Boolean)},e}();t.default=o},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e,t){return e.raw=t,e}t.__esModule=!0;var u=s(["\n fragment ChecklistTemplate on ChecklistTemplate {\n id\n state\n name\n description\n defaultIsRequiredForFinalApproval\n defaultShouldOpenOnProofLoad\n }\n"],["\n fragment ChecklistTemplate on ChecklistTemplate {\n id\n state\n name\n description\n defaultIsRequiredForFinalApproval\n defaultShouldOpenOnProofLoad\n }\n"]),c=s(["\n mutation sdk_ChecklistTemplates_create($input: CreateChecklistTemplateInput!) {\n createChecklistTemplate(input: $input) {\n ...ChecklistTemplate\n }\n }\n ","\n"],["\n mutation sdk_ChecklistTemplates_create($input: CreateChecklistTemplateInput!) {\n createChecklistTemplate(input: $input) {\n ...ChecklistTemplate\n }\n }\n ","\n"]),l=s(["\n mutation sdk_ChecklistTemplates_update($id: ID!, $input: UpdateChecklistTemplateInput!) {\n updateChecklistTemplate(id: $id, input: $input) {\n ...ChecklistTemplate\n }\n }\n ","\n"],["\n mutation sdk_ChecklistTemplates_update($id: ID!, $input: UpdateChecklistTemplateInput!) {\n updateChecklistTemplate(id: $id, input: $input) {\n ...ChecklistTemplate\n }\n }\n ","\n"]),f=s(["\n query sdk_ChecklistTemplates_list($states: [ChecklistTemplateState!]) {\n checklistTemplates(states: $states) {\n ...ChecklistTemplate\n }\n }\n ","\n"],["\n query sdk_ChecklistTemplates_list($states: [ChecklistTemplateState!]) {\n checklistTemplates(states: $states) {\n ...ChecklistTemplate\n }\n }\n ","\n"]),p=s(["\n query sdk_ChecklistTemplates_load($id: ID!) {\n checklistTemplate(id: $id) {\n ...ChecklistTemplate\n }\n }\n ","\n"],["\n query sdk_ChecklistTemplates_load($id: ID!) {\n checklistTemplate(id: $id) {\n ...ChecklistTemplate\n }\n }\n ","\n"]),d=r(0),h=n(d),y=r(78),m=r(191),g=n(m),v=(0,y.gql)(u),b=(0,y.gql)(c,v),E=(0,y.gql)(l,v),C=(0,y.gql)(f,v),_=(0,y.gql)(p,v),w=function(e){function t(r){o(this,t);var n=i(this,e.call(this,r));return n.entities=new g.default(r),n}return a(t,e),t.prototype.create=function(e){return this.client.graphql(b,{input:e}).then(function(e){return e.data.createChecklistTemplate})},t.prototype.update=function(e,t){return this.client.graphql(E,{id:e,input:t}).then(function(e){return e.data.updateChecklistTemplate})},t.prototype.list=function(e){return this.client.graphql(C,e).then(function(e){return e.data.checklistTemplates})},t.prototype.load=function(e){return this.client.graphql(_,{id:e}).then(function(e){return e.data.checklistTemplate})},t}(h.default);t.default=w},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function a(e,t){return e.raw=t,e}t.__esModule=!0;var s=a(["\n fragment ChecklistTemplateEntity on ChecklistTemplateEntity {\n id\n name\n type\n description\n }\n"],["\n fragment ChecklistTemplateEntity on ChecklistTemplateEntity {\n id\n name\n type\n description\n }\n"]),u=a(["\n query sdk_ChecklistTemplatesEntities_list($checklistId: ID!) {\n checklistTemplate(id: $checklistId) {\n entities {\n ...ChecklistTemplateEntity\n ...on ChecklistTemplateEntityGroup {\n entities {\n ...ChecklistTemplateEntity\n ...on ChecklistTemplateEntityGroup {\n entities {\n ...ChecklistTemplateEntity\n ...on ChecklistTemplateEntityGroup {\n entities {\n ...ChecklistTemplateEntity\n ...on ChecklistTemplateEntityGroup {\n entities {\n ...ChecklistTemplateEntity\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n ","\n"],["\n query sdk_ChecklistTemplatesEntities_list($checklistId: ID!) {\n checklistTemplate(id: $checklistId) {\n entities {\n ...ChecklistTemplateEntity\n ...on ChecklistTemplateEntityGroup {\n entities {\n ...ChecklistTemplateEntity\n ...on ChecklistTemplateEntityGroup {\n entities {\n ...ChecklistTemplateEntity\n ...on ChecklistTemplateEntityGroup {\n entities {\n ...ChecklistTemplateEntity\n ...on ChecklistTemplateEntityGroup {\n entities {\n ...ChecklistTemplateEntity\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n ","\n"]),c=r(0),l=function(e){return e&&e.__esModule?e:{default:e}}(c),f=r(78),p=(0,f.gql)(s),d=(0,f.gql)(u,p),h=function(e){function t(){return n(this,t),o(this,e.apply(this,arguments))}return i(t,e),t.prototype.list=function(e){return this.client.graphql(d,{checklistId:e}).then(function(e){return e.data.checklistTemplate.entities})},t}(l.default);t.default=h},function(e,t,r){"use strict";function n(e){return e?(e^16*Math.random()>>e/4).toString(16):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,n)}t.__esModule=!0,t.default=n},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0,t.ProofRole=t.Decision=t.Preference=t.FileCategory=t.ProofType=t.ReminderRelativeTo=t.ReminderAction=t.WorkflowUserState=t.WorkflowUserRole=t.WorkflowStepState=t.ResponseStatus=t.ProofStatus=t.ProofState=t.ImportProvider=t.FileStatus=t.FileAssignee=t.CommentState=void 0;var o=r(41),i=n(o),a=r(194),s=n(a),u=r(22),c=n(u),l=r(65),f=n(l),p=r(59),d=n(p),h=r(21),y=n(h),m=r(16),g=n(m),v=r(69),b=n(v),E=r(195),C=n(E),_=r(68),w=n(_),T=r(196),S=n(T),I=r(197),A=n(I),k=r(60),B=n(k),R=r(198),P=n(R),O=r(199),D=n(O),N=r(200),L=n(N),U=r(201),x=n(U);t.CommentState=i.default,t.FileAssignee=s.default,t.FileStatus=c.default,t.ImportProvider=f.default,t.ProofState=d.default,t.ProofStatus=y.default,t.ResponseStatus=g.default,t.WorkflowStepState=b.default,t.WorkflowUserRole=C.default,t.WorkflowUserState=w.default,t.ReminderAction=S.default,t.ReminderRelativeTo=A.default,t.ProofType=B.default,t.FileCategory=P.default,t.Preference=D.default,t.Decision=L.default,t.ProofRole=x.default},function(e,t,r){"use strict";t.__esModule=!0;var n={PROOF:"proof",ATTACHMENT:"attachment",SNAPSHOT:"snapshot"};t.default=n},function(e,t,r){"use strict";t.__esModule=!0;var n={VIEW_ONLY:"view-only",REVIEWER:"reviewer",MANDATORY:"mandatory",GATEKEEPER:"gatekeeper",APPROVER:"approver"};t.default=n},function(e,t,r){"use strict";t.__esModule=!0;var n={WORKFLOW_NUDGE_ALL:"nudge_all"};t.default=n},function(e,t,r){"use strict";t.__esModule=!0;var n={PROOF_DUE_DATE:"due_date"};t.default=n},function(e,t,r){"use strict";t.__esModule=!0;var n={STATIC:"static",VIDEO:"video",AUDIO:"audio",WEB:"web"};t.default=n},function(e,t,r){"use strict";t.__esModule=!0;var n={DEFAULT_DUE_DATE:"dueDate",DEFAULT_DUE_TIME:"dueTime",DEFAULT_MESSAGE_TO_REVIEWERS:"messageToReviewers",COLORS:"colors",DEFAULT_REMINDER:"proofReminders"};t.default=n},function(e,t,r){"use strict";t.__esModule=!0;var n={NO_DECISION:0,APPROVED:1,SEND_CHANGES:2,APPROVED_WITH_CHANGES:3};t.default=n},function(e,t,r){"use strict";t.__esModule=!0;var n={UNLISTED_REVIEWER:"unlisted-reviewer"};t.default=n},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0,t.WorkflowUser=t.WorkflowStep=t.Workflow=t.User=t.Session=t.ProofVersion=t.ProofGroup=t.Proof=t.File=t.Comment=void 0;var o=r(71),i=n(o),a=r(36),s=n(a),u=r(13),c=n(u),l=r(23),f=n(l),p=r(62),d=n(p),h=r(18),y=n(h),m=r(9),g=n(m),v=r(37),b=n(v),E=r(25),C=n(E),_=r(38),w=n(_);t.Comment=i.default,t.File=s.default,t.Proof=c.default,t.ProofGroup=f.default,t.ProofVersion=d.default,t.Session=y.default,t.User=g.default,t.Workflow=b.default,t.WorkflowStep=C.default,t.WorkflowUser=w.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){return"string"==typeof e&&(e=(0,a.default)(e)),(0,c.default)(e)}t.__esModule=!0,t.pins=t.comments=void 0;var i=r(39),a=n(i),s=r(40),u=r(75),c=n(u),l=r(204),f=n(l),p=r(205),d=n(p),h=r(73),y=r(77);t.comments={parse:a.default,serialize:s.serialize,mentions:o,text:f.default,html:d.default},t.pins={parse:h.parsePins,serialize:y.serializePins}},function(e,t,r){"use strict";function n(e){return e.blocks.map(function(e){return e.value}).map(i.default).join("\n")}t.__esModule=!0;var o=r(79),i=function(e){return e&&e.__esModule?e:{default:e}}(o);t.default=n},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){return{trusted:!0,value:e}}function i(e){return[].concat(e)}function a(e){return Object.keys(e).map(function(t){return t+": "+e[t]}).join("; ")}function s(e){var t=(0,h.default)(e);return u((0,l.default)(t,w))}function u(e){function t(e){e.forEach(function(e){e&&("string"==typeof e?r.push((0,m.default)(e)):!0===e.trusted?r.push(e.value):e.length&&t(e))})}var r=[];return t(e),r.join("")}t.__esModule=!0;var c=r(206),l=n(c),f=r(221),p=n(f),d=r(229),h=n(d),y=r(79),m=n(y),g={BOLD:{"font-weight":"bold"},ITALIC:{"font-style":"italic"},UNDERLINE:{"text-decoration":"underline"},STRIKETHROUGH:{"text-decoration":"line-through"},SUPERSCRIPT:{"font-size":"0.8em","vertical-align":"super"},SUBSCRIPT:{"font-size":"0.8em","vertical-align":"sub"}},v=function(e){var t=e.style,r=e.children;return[o('<span style="'+a(t)+'">'),i(r),o("</span>")]},b=function(e){return function(t){return[o("<"+e+">")].concat(t.map(function(e){return[o("<li>"),i(e),o("</li>")]}),[o("</"+e+">")])}},E={unstyled:function(e){return e.map(function(e){return[o("<div>"),i(e),o("<br /></div>")]})},"unordered-list-item":b("ul"),"ordered-list-item":b("ol")},C={mention:function(e,t){return[o('<span data-mention-user-id="'+t.mention.link+'">'),i(e),o("</span>")]}},_=[{strategy:p.default,component:function(e){var t=e.children;return[o('<a href="'+e.decoratedText+'" target="_blank" rel="noopener noreferrer">'),i(t),o("</a>")]}}],w={styles:(0,c.createStylesRenderer)(v,g),blocks:E,entities:C,decorators:_};t.default=s},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.CompositeDecorator=t.renderNode=t.RawParser=t.createBlockRenderer=t.createStylesRenderer=void 0;var o=r(80),i=n(o),a=r(209),s=n(a),u=r(210),c=r(82),l=n(c),f=r(220),p=n(f);t.createStylesRenderer=s.default,t.createBlockRenderer=p.default,t.RawParser=i.default,t.renderNode=u.renderNode,t.CompositeDecorator=l.default,t.default=u.render},function(e,t,r){"use strict";function n(e){return Array.isArray(e)?e:Array.from(e)}function o(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),s=r(208),u=function(e){return e&&e.__esModule?e:{default:e}}(s),c=function(){function e(t){i(this,e),this.content=t.content||[],this.start=void 0!==t.start?t.start:null,this.end=void 0!==t.end?t.end:null,this.entity=void 0!==t.entity?t.entity:null,this.decorator=void 0!==t.decorator?t.decorator:null,this.decoratorProps=t.decoratorProps||null,this.decoratedText=void 0!==t.decoratedText?t.decoratedText:null,this.contentState=t.contentState,this.style=t.style||null,this.styles=t.styles||null,this.block=t.block||{}}return a(e,[{key:"getCurrentContent",value:function(){return this.content[this.content.length-1]}},{key:"addToCurrentContent",value:function(e){this.content[this.content.length-1]=this.content[this.content.length-1]+e}},{key:"handleFlatPush",value:function(t,r){var n=this.getCurrentContent();if(n instanceof e&&(0,u.default)(r,n.styles))return void n.addToCurrentContent(t);var i=new e({styles:[].concat(o(r)),content:[t]});this.content.push(i)}},{key:"pushContent",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!r||r.length<1)return"string"==typeof t&&"string"==typeof this.getCurrentContent()?this.addToCurrentContent(t):this.content.push(t),this;if(o)return this.handleFlatPush(t,r),this;var i=n(r),a=i[0],s=i.slice(1),u=this.getCurrentContent();if(u instanceof e&&u.style===a)u.pushContent(t,s,o);else{var c=new e({style:a});c.pushContent(t,s,o),this.content.push(c)}return this}}]),e}();t.default=c},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0};t.default=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e,t){return e.map(function(e){return t[e]}).reduce(function(e,t){var r={};if(void 0!==t){var n="text-decoration"in t?"text-decoration":"textDecoration";t[n]!==e[n]&&(r[n]=[e[n],t[n]].join(" ").trim())}return Object.assign(e,t,r)},{})},o=function(e,t){return function(r,o,i){var a=n(o,t);return e(Object.assign({},{children:r},i,{style:a}))}};t.default=o},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.render=t.renderNode=void 0;var o=r(80),i=n(o),a=r(211),s=n(a),u=r(212),c=n(u),l=r(213),f=n(l),p=r(214),d=n(p),h=r(215),y=n(h),m=r(216),g=n(m),v=r(217),b=n(v),E=t.renderNode=function e(t,r,n,o,i,a,s){if(t.styles&&o)return o((0,d.default)(t.content,a),t.styles,{key:s()});var u=[],c=0;if(t.content.forEach(function(t){"string"==typeof t?u=(0,y.default)(t,u,c):(c+=1,u[c]=e(t,r,n,o,i,a,s),c+=1)}),t.style&&r[t.style])return r[t.style]((0,d.default)(u,a),{key:s()});if(null!==t.entity){var l=i[t.entity];if(l&&n[l.type])return n[l.type]((0,d.default)(u,a),l.data,{key:t.entity})}if(null!==t.decorator){var f=[t.block.key,t.start,0].join(".");return t.decorator(Object.assign({children:(0,d.default)(u,a),decoratedText:t.decoratedText,contentState:t.contentState,entityKey:t.entity,offsetKey:f,key:f},t.decoratorProps))}return u},C=function(e){var t=[],r=[],n=0,o=function(e){var o=n-e;for(r.length<o&&(o=r.length),o;o>0;o-=1){var i=t;t=r.pop(),t[t.length-1].children=i}};return e.forEach(function(e){n<e.depth?(r.push(t),t=[]):n>e.depth&&o(e.depth),n=e.depth,t.push(e)}),0!==n&&o(0),t},_=function(e,t,r,n,o){var i=n.prevType,a=n.prevDepth,s=n.prevKeys,u=n.prevData;if(0!==e.length){var c=t[i]||t[o.blockFallback];if(c){var l={depth:a,keys:s};return u&&u.some(function(e){return!!e})&&(l.data=u),void r.push(c(e,l))}r.push(e)}},w=function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},a=arguments[4],s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:{},l=Object.assign({},g.default,u),p=[],h=[],y=null,m=0,v=[],b=[],C=!1,w=new i.default({flat:!!a});return t.forEach(function(t){if((0,c.default)(t,y,l))return void(!0===l.cleanup.split&&(C=!0));var i=w.parse(t),u=E(i,r,o,a,s,l,(0,f.default)());if((y&&y!==t.type||C)&&(_(h,n,p,{prevType:y,prevDepth:m,prevKeys:v,prevData:b},l),b=[],v=[],h=[],C=!1),t.children){var d=e(t.children,r,n,o,a,s,l);u.push(d)}h.push(u),y=t.type,m=t.depth,v.push(t.key),b.push(t.data)}),_(h,n,p,{prevType:y,prevDepth:m,prevKeys:v,prevData:b},l),(0,d.default)(p,l)};t.render=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!e||!Array.isArray(e.blocks))return(0,s.default)("invalid raw object"),null;if(!e.blocks.length)return null;var n=t.inline,o=t.blocks,i=t.entities,a=t.styles,u=t.decorators,c=u?(0,b.default)(e,u,r):e.blocks,l=C(c);return w(l,n,o,i,a,e.entityMap,r)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e){};t.default=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e,t){return!!(t.trim?e.trim():e)},o=function(e,t){return!!n(e.text,t)||(!(!e.data||!Object.keys(e.data).length)||!(!e.entityRanges||!e.entityRanges.length))},i=function(e,t,r){var n=r.cleanup;return!(!n||o(e,n))&&((!n.after||"all"===n.after||-1!==n.after.indexOf(t))&&(!(!n.except||-1!==n.except.indexOf(e.type))||!(!n.types||"all"!==n.types&&-1===n.types.indexOf(e.type))))};t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){var e=0;return function(){var t=e;return e+=1,t}};t.default=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e,t){return Array.isArray(e)&&t.joinOutput?e.join(""):e};t.default=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e,t,r){var n=t;return t[r]?n[r]+=e:n[r]=e,n};t.default=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={joinOutput:!1,cleanup:{after:["atomic"],types:["unstyled"],trim:!1,split:!0},blockFallback:"unstyled"};t.default=n},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}Object.defineProperty(t,"__esModule",{value:!0});var i=r(81),a=n(i),s=r(82),u=n(s),c=r(218),l=n(c),f=r(219),p=n(f),d=function(e,t){return e.forEach(function(e){var r=t.text.substring(0,e.offset),n=t.text.substring(e.offset,e.offset+e.length);e.offset=a.default.ucs2.decode(r).length,e.length=a.default.ucs2.decode(n).length}),e},h=function(e){return"function"==typeof e.getDecorations&&"function"==typeof e.getComponentForKey&&"function"==typeof e.getPropsForKey},y=function(e){var t=new u.default(e.filter(function(e){return!h(e)})),r=e.filter(function(e){return h(e)}),n=[].concat(o(r),[t]);return new l.default(n)},m=function(e,t,r,n){var o=n.createContentBlock,i=[],a=y(t),s=o?o(e):(0,p.default)(e),u=a.getDecorations(s,r),c=0;return u.forEach(function(e,t){if(!e)return void(c+=1);var n=t+1,o=u[n];o&&o===e||(i.push({offset:c,length:n-c,component:a.getComponentForKey(e),decoratorProps:a.getPropsForKey(e)||{},contentState:r}),c=n)}),Object.assign({},e,{decoratorRanges:d(i,e)})},g=function(e,t,r){var n=r.convertFromRaw&&r.convertFromRaw(e);return e.blocks.map(function(e){return m(e,t,n,r||{})})};t.default=g},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=function(){function e(t){n(this,e),this.decorators=t}return o(e,[{key:"getDecorations",value:function(e,t){var r=new Array(e.getText().length).fill(null);return this.decorators.forEach(function(n,o){n.getDecorations(e,t).forEach(function(e,t){e&&(r[t]=o+"-"+e)})}),r}},{key:"getComponentForKey",value:function(t){return this.getDecoratorForKey(t).getComponentForKey(e.getInnerKey(t))}},{key:"getPropsForKey",value:function(t){return this.getDecoratorForKey(t).getPropsForKey(e.getInnerKey(t))}},{key:"getDecoratorForKey",value:function(e){var t=e.split("-"),r=Number(t[0]);return this.decorators[r]}}],[{key:"getInnerKey",value:function(e){return e.split("-").slice(1).join("-")}}]),e}();t.default=i},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=function(){function e(t){n(this,e),Object.assign(this,t)}return o(e,[{key:"get",value:function(e){return this[e]}},{key:"getText",value:function(){return this.text}},{key:"getType",value:function(){return this.type}},{key:"getKey",value:function(){return this.key}},{key:"getLength",value:function(){return this.text.length}},{key:"getDepth",value:function(){return this.depth}},{key:"getData",value:function(){return this.data}}]),e}(),a=function(e){return new i(e)};t.default=a},function(e,t,r){"use strict";function n(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}Object.defineProperty(t,"__esModule",{value:!0});var o=function(e,t){var r=e.keys;if(t)return t;if(r)return r.join(",")},i=function(e,t){return function(r,i,a){var s=Object.assign({},i),u=o(s,a);return delete s.depth,delete s.keys,t.apply(void 0,[e,Object.assign({},s,{key:u})].concat(n(r)))}},a=function(e,t,r){var n=r.children,o=r.props,a=r.key,s=i(t.wrapper,e),u=i(t.element,e);return s(n.map(function(e,t){return u(e,{depth:o.depth},o.keys&&o.keys[t])}),o,a)},s=function(e,t){var r={};return Object.keys(t).forEach(function(n){var o=t[n];if(o.wrapper)return void(r[n]=function(t,r,n){return a(e,o,{children:t,props:r,key:n})});r[n]=i(o.element,e)}),r};t.default=s},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var o=r(222),i=n(o),a=r(228),s=n(a),u=(0,i.default)();u.tlds(s.default).set({fuzzyEmail:!1});var c=function(e,t){var r=u.match(e.get("text"));if(void 0!==r&&null!==r)for(var n=0;n<r.length;n+=1)t(r[n].index,r[n].lastIndex)};t.default=c},function(e,t,r){"use strict";function n(e){return Array.prototype.slice.call(arguments,1).forEach(function(t){t&&Object.keys(t).forEach(function(r){e[r]=t[r]})}),e}function o(e){return Object.prototype.toString.call(e)}function i(e){return"[object String]"===o(e)}function a(e){return"[object Object]"===o(e)}function s(e){return"[object RegExp]"===o(e)}function u(e){return"[object Function]"===o(e)}function c(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function l(e){return Object.keys(e||{}).reduce(function(e,t){return e||v.hasOwnProperty(t)},!1)}function f(e){e.__index__=-1,e.__text_cache__=""}function p(e){return function(t,r){var n=t.slice(r);return e.test(n)?n.match(e)[0].length:0}}function d(){return function(e,t){t.normalize(e)}}function h(e){function t(e){return e.replace("%TLDS%",o.src_tlds)}function n(e,t){throw new Error('(LinkifyIt) Invalid schema "'+e+'": '+t)}var o=e.re=r(223)(e.__opts__),l=e.__tlds__.slice();e.onCompile(),e.__tlds_replaced__||l.push(E),l.push(o.src_xn),o.src_tlds=l.join("|"),o.email_fuzzy=RegExp(t(o.tpl_email_fuzzy),"i"),o.link_fuzzy=RegExp(t(o.tpl_link_fuzzy),"i"),o.link_no_ip_fuzzy=RegExp(t(o.tpl_link_no_ip_fuzzy),"i"),o.host_fuzzy_test=RegExp(t(o.tpl_host_fuzzy_test),"i");var h=[];e.__compiled__={},Object.keys(e.__schemas__).forEach(function(t){var r=e.__schemas__[t];if(null!==r){var o={validate:null,link:null};return e.__compiled__[t]=o,a(r)?(s(r.validate)?o.validate=p(r.validate):u(r.validate)?o.validate=r.validate:n(t,r),void(u(r.normalize)?o.normalize=r.normalize:r.normalize?n(t,r):o.normalize=d())):i(r)?void h.push(t):void n(t,r)}}),h.forEach(function(t){e.__compiled__[e.__schemas__[t]]&&(e.__compiled__[t].validate=e.__compiled__[e.__schemas__[t]].validate,e.__compiled__[t].normalize=e.__compiled__[e.__schemas__[t]].normalize)}),e.__compiled__[""]={validate:null,normalize:d()};var y=Object.keys(e.__compiled__).filter(function(t){return t.length>0&&e.__compiled__[t]}).map(c).join("|");e.re.schema_test=RegExp("(^|(?!_)(?:[><|]|"+o.src_ZPCc+"))("+y+")","i"),e.re.schema_search=RegExp("(^|(?!_)(?:[><|]|"+o.src_ZPCc+"))("+y+")","ig"),e.re.pretest=RegExp("("+e.re.schema_test.source+")|("+e.re.host_fuzzy_test.source+")|@","i"),f(e)}function y(e,t){var r=e.__index__,n=e.__last_index__,o=e.__text_cache__.slice(r,n);this.schema=e.__schema__.toLowerCase(),this.index=r+t,this.lastIndex=n+t,this.raw=o,this.text=o,this.url=o}function m(e,t){var r=new y(e,t);return e.__compiled__[r.schema].normalize(r,e),r}function g(e,t){if(!(this instanceof g))return new g(e,t);t||l(e)&&(t=e,e={}),this.__opts__=n({},v,t),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=n({},b,e),this.__compiled__={},this.__tlds__=C,this.__tlds_replaced__=!1,this.re={},h(this)}var v={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1},b={"http:":{validate:function(e,t,r){var n=e.slice(t);return r.re.http||(r.re.http=new RegExp("^\\/\\/"+r.re.src_auth+r.re.src_host_port_strict+r.re.src_path,"i")),r.re.http.test(n)?n.match(r.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(e,t,r){var n=e.slice(t);return r.re.no_http||(r.re.no_http=new RegExp("^"+r.re.src_auth+"(?:localhost|(?:(?:"+r.re.src_domain+")\\.)+"+r.re.src_domain_root+")"+r.re.src_port+r.re.src_host_terminator+r.re.src_path,"i")),r.re.no_http.test(n)?t>=3&&":"===e[t-3]?0:t>=3&&"/"===e[t-3]?0:n.match(r.re.no_http)[0].length:0}},"mailto:":{validate:function(e,t,r){var n=e.slice(t);return r.re.mailto||(r.re.mailto=new RegExp("^"+r.re.src_email_name+"@"+r.re.src_host_strict,"i")),r.re.mailto.test(n)?n.match(r.re.mailto)[0].length:0}}},E="a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]",C="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");g.prototype.add=function(e,t){return this.__schemas__[e]=t,h(this),this},g.prototype.set=function(e){return this.__opts__=n(this.__opts__,e),this},g.prototype.test=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return!1;var t,r,n,o,i,a,s,u;if(this.re.schema_test.test(e))for(s=this.re.schema_search,s.lastIndex=0;null!==(t=s.exec(e));)if(o=this.testSchemaAt(e,t[2],s.lastIndex)){this.__schema__=t[2],this.__index__=t.index+t[1].length,this.__last_index__=t.index+t[0].length+o;break}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(u=e.search(this.re.host_fuzzy_test))>=0&&(this.__index__<0||u<this.__index__)&&null!==(r=e.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy))&&(i=r.index+r[1].length,(this.__index__<0||i<this.__index__)&&(this.__schema__="",this.__index__=i,this.__last_index__=r.index+r[0].length)),this.__opts__.fuzzyEmail&&this.__compiled__["mailto:"]&&e.indexOf("@")>=0&&null!==(n=e.match(this.re.email_fuzzy))&&(i=n.index+n[1].length,a=n.index+n[0].length,(this.__index__<0||i<this.__index__||i===this.__index__&&a>this.__last_index__)&&(this.__schema__="mailto:",this.__index__=i,this.__last_index__=a)),this.__index__>=0},g.prototype.pretest=function(e){return this.re.pretest.test(e)},g.prototype.testSchemaAt=function(e,t,r){return this.__compiled__[t.toLowerCase()]?this.__compiled__[t.toLowerCase()].validate(e,r,this):0},g.prototype.match=function(e){var t=0,r=[];this.__index__>=0&&this.__text_cache__===e&&(r.push(m(this,t)),t=this.__last_index__);for(var n=t?e.slice(t):e;this.test(n);)r.push(m(this,t)),n=n.slice(this.__last_index__),t+=this.__last_index__;return r.length?r:null},g.prototype.tlds=function(e,t){return e=Array.isArray(e)?e:[e],t?(this.__tlds__=this.__tlds__.concat(e).sort().filter(function(e,t,r){return e!==r[t-1]}).reverse(),h(this),this):(this.__tlds__=e.slice(),this.__tlds_replaced__=!0,h(this),this)},g.prototype.normalize=function(e){e.schema||(e.url="http://"+e.url),"mailto:"!==e.schema||/^mailto:/i.test(e.url)||(e.url="mailto:"+e.url)},g.prototype.onCompile=function(){},e.exports=g},function(e,t,r){"use strict";e.exports=function(e){var t={};t.src_Any=r(224).source,t.src_Cc=r(225).source,t.src_Z=r(226).source,t.src_P=r(227).source,t.src_ZPCc=[t.src_Z,t.src_P,t.src_Cc].join("|"),t.src_ZCc=[t.src_Z,t.src_Cc].join("|");return t.src_pseudo_letter="(?:(?![><|]|"+t.src_ZPCc+")"+t.src_Any+")",t.src_ip4="(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)",t.src_auth="(?:(?:(?!"+t.src_ZCc+"|[@/\\[\\]()]).)+@)?",t.src_port="(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?",t.src_host_terminator="(?=$|[><|]|"+t.src_ZPCc+")(?!-|_|:\\d|\\.-|\\.(?!$|"+t.src_ZPCc+"))",t.src_path="(?:[/?#](?:(?!"+t.src_ZCc+"|[><|]|[()[\\]{}.,\"'?!\\-]).|\\[(?:(?!"+t.src_ZCc+"|\\]).)*\\]|\\((?:(?!"+t.src_ZCc+"|[)]).)*\\)|\\{(?:(?!"+t.src_ZCc+'|[}]).)*\\}|\\"(?:(?!'+t.src_ZCc+'|["]).)+\\"|\\\'(?:(?!'+t.src_ZCc+"|[']).)+\\'|\\'(?="+t.src_pseudo_letter+"|[-]).|\\.{2,3}[a-zA-Z0-9%/]|\\.(?!"+t.src_ZCc+"|[.]).|"+(e&&e["---"]?"\\-(?!--(?:[^-]|$))(?:-*)|":"\\-+|")+"\\,(?!"+t.src_ZCc+").|\\!(?!"+t.src_ZCc+"|[!]).|\\?(?!"+t.src_ZCc+"|[?]).)+|\\/)?",t.src_email_name='[\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]+',t.src_xn="xn--[a-z0-9\\-]{1,59}",t.src_domain_root="(?:"+t.src_xn+"|"+t.src_pseudo_letter+"{1,63})",t.src_domain="(?:"+t.src_xn+"|(?:"+t.src_pseudo_letter+")|(?:"+t.src_pseudo_letter+"(?:-(?!-)|"+t.src_pseudo_letter+"){0,61}"+t.src_pseudo_letter+"))",t.src_host="(?:(?:(?:(?:"+t.src_domain+")\\.)*"+t.src_domain+"))",t.tpl_host_fuzzy="(?:"+t.src_ip4+"|(?:(?:(?:"+t.src_domain+")\\.)+(?:%TLDS%)))",t.tpl_host_no_ip_fuzzy="(?:(?:(?:"+t.src_domain+")\\.)+(?:%TLDS%))",t.src_host_strict=t.src_host+t.src_host_terminator,t.tpl_host_fuzzy_strict=t.tpl_host_fuzzy+t.src_host_terminator,t.src_host_port_strict=t.src_host+t.src_port+t.src_host_terminator,t.tpl_host_port_fuzzy_strict=t.tpl_host_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_port_no_ip_fuzzy_strict=t.tpl_host_no_ip_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_fuzzy_test="localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:"+t.src_ZPCc+"|>|$))",t.tpl_email_fuzzy="(^|[><|]|\\(|"+t.src_ZCc+")("+t.src_email_name+"@"+t.tpl_host_fuzzy_strict+")",t.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+t.src_ZPCc+"))((?![$+<=>^`||])"+t.tpl_host_port_fuzzy_strict+t.src_path+")",t.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+t.src_ZPCc+"))((?![$+<=>^`||])"+t.tpl_host_port_no_ip_fuzzy_strict+t.src_path+")",t}},function(e,t){e.exports=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/},function(e,t){e.exports=/[\0-\x1F\x7F-\x9F]/},function(e,t){e.exports=/[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/},function(e,t){e.exports=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E49\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDF3C-\uDF3E]|\uD806[\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2]|\uD807[\uDC41-\uDC45\uDC70\uDC71]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/},function(e,t){e.exports=["aaa","aarp","abarth","abb","abbott","abbvie","abc","able","abogado","abudhabi","ac","academy","accenture","accountant","accountants","aco","active","actor","ad","adac","ads","adult","ae","aeg","aero","aetna","af","afamilycompany","afl","africa","ag","agakhan","agency","ai","aig","aigo","airbus","airforce","airtel","akdn","al","alfaromeo","alibaba","alipay","allfinanz","allstate","ally","alsace","alstom","am","americanexpress","americanfamily","amex","amfam","amica","amsterdam","analytics","android","anquan","anz","ao","aol","apartments","app","apple","aq","aquarelle","ar","arab","aramco","archi","army","arpa","art","arte","as","asda","asia","associates","at","athleta","attorney","au","auction","audi","audible","audio","auspost","author","auto","autos","avianca","aw","aws","ax","axa","az","azure","ba","baby","baidu","banamex","bananarepublic","band","bank","bar","barcelona","barclaycard","barclays","barefoot","bargains","baseball","basketball","bauhaus","bayern","bb","bbc","bbt","bbva","bcg","bcn","bd","be","beats","beauty","beer","bentley","berlin","best","bestbuy","bet","bf","bg","bh","bharti","bi","bible","bid","bike","bing","bingo","bio","biz","bj","black","blackfriday","blanco","blockbuster","blog","bloomberg","blue","bm","bms","bmw","bn","bnl","bnpparibas","bo","boats","boehringer","bofa","bom","bond","boo","book","booking","bosch","bostik","boston","bot","boutique","box","br","bradesco","bridgestone","broadway","broker","brother","brussels","bs","bt","budapest","bugatti","build","builders","business","buy","buzz","bv","bw","by","bz","bzh","ca","cab","cafe","cal","call","calvinklein","cam","camera","camp","cancerresearch","canon","capetown","capital","capitalone","car","caravan","cards","care","career","careers","cars","cartier","casa","case","caseih","cash","casino","cat","catering","catholic","cba","cbn","cbre","cbs","cc","cd","ceb","center","ceo","cern","cf","cfa","cfd","cg","ch","chanel","channel","chase","chat","cheap","chintai","christmas","chrome","chrysler","church","ci","cipriani","circle","cisco","citadel","citi","citic","city","cityeats","ck","cl","claims","cleaning","click","clinic","clinique","clothing","cloud","club","clubmed","cm","cn","co","coach","codes","coffee","college","cologne","com","comcast","commbank","community","company","compare","computer","comsec","condos","construction","consulting","contact","contractors","cooking","cookingchannel","cool","coop","corsica","country","coupon","coupons","courses","cr","credit","creditcard","creditunion","cricket","crown","crs","cruise","cruises","csc","cu","cuisinella","cv","cw","cx","cy","cymru","cyou","cz","dabur","dad","dance","data","date","dating","datsun","day","dclk","dds","de","deal","dealer","deals","degree","delivery","dell","deloitte","delta","democrat","dental","dentist","desi","design","dev","dhl","diamonds","diet","digital","direct","directory","discount","discover","dish","diy","dj","dk","dm","dnp","do","docs","doctor","dodge","dog","doha","domains","dot","download","drive","dtv","dubai","duck","dunlop","duns","dupont","durban","dvag","dvr","dz","earth","eat","ec","eco","edeka","edu","education","ee","eg","email","emerck","energy","engineer","engineering","enterprises","epost","epson","equipment","er","ericsson","erni","es","esq","estate","esurance","et","etisalat","eu","eurovision","eus","events","everbank","exchange","expert","exposed","express","extraspace","fage","fail","fairwinds","faith","family","fan","fans","farm","farmers","fashion","fast","fedex","feedback","ferrari","ferrero","fi","fiat","fidelity","fido","film","final","finance","financial","fire","firestone","firmdale","fish","fishing","fit","fitness","fj","fk","flickr","flights","flir","florist","flowers","fly","fm","fo","foo","food","foodnetwork","football","ford","forex","forsale","forum","foundation","fox","fr","free","fresenius","frl","frogans","frontdoor","frontier","ftr","fujitsu","fujixerox","fun","fund","furniture","futbol","fyi","ga","gal","gallery","gallo","gallup","game","games","gap","garden","gb","gbiz","gd","gdn","ge","gea","gent","genting","george","gf","gg","ggee","gh","gi","gift","gifts","gives","giving","gl","glade","glass","gle","global","globo","gm","gmail","gmbh","gmo","gmx","gn","godaddy","gold","goldpoint","golf","goo","goodhands","goodyear","goog","google","gop","got","gov","gp","gq","gr","grainger","graphics","gratis","green","gripe","grocery","group","gs","gt","gu","guardian","gucci","guge","guide","guitars","guru","gw","gy","hair","hamburg","hangout","haus","hbo","hdfc","hdfcbank","health","healthcare","help","helsinki","here","hermes","hgtv","hiphop","hisamitsu","hitachi","hiv","hk","hkt","hm","hn","hockey","holdings","holiday","homedepot","homegoods","homes","homesense","honda","honeywell","horse","hospital","host","hosting","hot","hoteles","hotels","hotmail","house","how","hr","hsbc","ht","hu","hughes","hyatt","hyundai","ibm","icbc","ice","icu","id","ie","ieee","ifm","ikano","il","im","imamat","imdb","immo","immobilien","in","industries","infiniti","info","ing","ink","institute","insurance","insure","int","intel","international","intuit","investments","io","ipiranga","iq","ir","irish","is","iselect","ismaili","ist","istanbul","it","itau","itv","iveco","iwc","jaguar","java","jcb","jcp","je","jeep","jetzt","jewelry","jio","jlc","jll","jm","jmp","jnj","jo","jobs","joburg","jot","joy","jp","jpmorgan","jprs","juegos","juniper","kaufen","kddi","ke","kerryhotels","kerrylogistics","kerryproperties","kfh","kg","kh","ki","kia","kim","kinder","kindle","kitchen","kiwi","km","kn","koeln","komatsu","kosher","kp","kpmg","kpn","kr","krd","kred","kuokgroup","kw","ky","kyoto","kz","la","lacaixa","ladbrokes","lamborghini","lamer","lancaster","lancia","lancome","land","landrover","lanxess","lasalle","lat","latino","latrobe","law","lawyer","lb","lc","lds","lease","leclerc","lefrak","legal","lego","lexus","lgbt","li","liaison","lidl","life","lifeinsurance","lifestyle","lighting","like","lilly","limited","limo","lincoln","linde","link","lipsy","live","living","lixil","lk","llc","loan","loans","locker","locus","loft","lol","london","lotte","lotto","love","lpl","lplfinancial","lr","ls","lt","ltd","ltda","lu","lundbeck","lupin","luxe","luxury","lv","ly","ma","macys","madrid","maif","maison","makeup","man","management","mango","map","market","marketing","markets","marriott","marshalls","maserati","mattel","mba","mc","mckinsey","md","me","med","media","meet","melbourne","meme","memorial","men","menu","meo","merckmsd","metlife","mg","mh","miami","microsoft","mil","mini","mint","mit","mitsubishi","mk","ml","mlb","mls","mm","mma","mn","mo","mobi","mobile","mobily","moda","moe","moi","mom","monash","money","monster","mopar","mormon","mortgage","moscow","moto","motorcycles","mov","movie","movistar","mp","mq","mr","ms","msd","mt","mtn","mtr","mu","museum","mutual","mv","mw","mx","my","mz","na","nab","nadex","nagoya","name","nationwide","natura","navy","nba","nc","ne","nec","net","netbank","netflix","network","neustar","new","newholland","news","next","nextdirect","nexus","nf","nfl","ng","ngo","nhk","ni","nico","nike","nikon","ninja","nissan","nissay","nl","no","nokia","northwesternmutual","norton","now","nowruz","nowtv","np","nr","nra","nrw","ntt","nu","nyc","nz","obi","observer","off","office","okinawa","olayan","olayangroup","oldnavy","ollo","om","omega","one","ong","onl","online","onyourside","ooo","open","oracle","orange","org","organic","origins","osaka","otsuka","ott","ovh","pa","page","panasonic","panerai","paris","pars","partners","parts","party","passagens","pay","pccw","pe","pet","pf","pfizer","pg","ph","pharmacy","phd","philips","phone","photo","photography","photos","physio","piaget","pics","pictet","pictures","pid","pin","ping","pink","pioneer","pizza","pk","pl","place","play","playstation","plumbing","plus","pm","pn","pnc","pohl","poker","politie","porn","post","pr","pramerica","praxi","press","prime","pro","prod","productions","prof","progressive","promo","properties","property","protection","pru","prudential","ps","pt","pub","pw","pwc","py","qa","qpon","quebec","quest","qvc","racing","radio","raid","re","read","realestate","realtor","realty","recipes","red","redstone","redumbrella","rehab","reise","reisen","reit","reliance","ren","rent","rentals","repair","report","republican","rest","restaurant","review","reviews","rexroth","rich","richardli","ricoh","rightathome","ril","rio","rip","rmit","ro","rocher","rocks","rodeo","rogers","room","rs","rsvp","ru","rugby","ruhr","run","rw","rwe","ryukyu","sa","saarland","safe","safety","sakura","sale","salon","samsclub","samsung","sandvik","sandvikcoromant","sanofi","sap","sapo","sarl","sas","save","saxo","sb","sbi","sbs","sc","sca","scb","schaeffler","schmidt","scholarships","school","schule","schwarz","science","scjohnson","scor","scot","sd","se","search","seat","secure","security","seek","select","sener","services","ses","seven","sew","sex","sexy","sfr","sg","sh","shangrila","sharp","shaw","shell","shia","shiksha","shoes","shop","shopping","shouji","show","showtime","shriram","si","silk","sina","singles","site","sj","sk","ski","skin","sky","skype","sl","sling","sm","smart","smile","sn","sncf","so","soccer","social","softbank","software","sohu","solar","solutions","song","sony","soy","space","spiegel","sport","spot","spreadbetting","sr","srl","srt","st","stada","staples","star","starhub","statebank","statefarm","statoil","stc","stcgroup","stockholm","storage","store","stream","studio","study","style","su","sucks","supplies","supply","support","surf","surgery","suzuki","sv","swatch","swiftcover","swiss","sx","sy","sydney","symantec","systems","sz","tab","taipei","talk","taobao","target","tatamotors","tatar","tattoo","tax","taxi","tc","tci","td","tdk","team","tech","technology","tel","telecity","telefonica","temasek","tennis","teva","tf","tg","th","thd","theater","theatre","tiaa","tickets","tienda","tiffany","tips","tires","tirol","tj","tjmaxx","tjx","tk","tkmaxx","tl","tm","tmall","tn","to","today","tokyo","tools","top","toray","toshiba","total","tours","town","toyota","toys","tr","trade","trading","training","travel","travelchannel","travelers","travelersinsurance","trust","trv","tt","tube","tui","tunes","tushu","tv","tvs","tw","tz","ua","ubank","ubs","uconnect","ug","uk","unicom","university","uno","uol","ups","us","uy","uz","va","vacations","vana","vanguard","vc","ve","vegas","ventures","verisign","versicherung","vet","vg","vi","viajes","video","vig","viking","villas","vin","vip","virgin","visa","vision","vista","vistaprint","viva","vivo","vlaanderen","vn","vodka","volkswagen","volvo","vote","voting","voto","voyage","vu","vuelos","wales","walmart","walter","wang","wanggou","warman","watch","watches","weather","weatherchannel","webcam","weber","website","wed","wedding","weibo","weir","wf","whoswho","wien","wiki","williamhill","win","windows","wine","winners","wme","wolterskluwer","woodside","work","works","world","wow","ws","wtc","wtf","xbox","xerox","xfinity","xihuan","xin","कॉम","セール","佛山","ಭಾರತ","慈善","集团","在线","한국","ଭାରତ","大众汽车","点看","คอม","ভাৰত","ভারত","八卦","موقع","বাংলা","公益","公司","香格里拉","网站","移动","我爱你","москва","қаз","католик","онлайн","сайт","联通","срб","бг","бел","קום","时尚","微博","淡马锡","ファッション","орг","नेट","ストア","삼성","சிங்கப்பூர்","商标","商店","商城","дети","мкд","ею","ポイント","新闻","工行","家電","كوم","中文网","中信","中国","中國","娱乐","谷歌","భారత్","ලංකා","電訊盈科","购物","クラウド","ભારત","通販","भारतम्","भारत","भारोत","网店","संगठन","餐厅","网络","ком","укр","香港","诺基亚","食品","飞利浦","台湾","台灣","手表","手机","мон","الجزائر","عمان","ارامكو","ایران","العليان","اتصالات","امارات","بازار","پاکستان","الاردن","موبايلي","بارت","بھارت","المغرب","ابوظبي","السعودية","ڀارت","كاثوليك","سودان","همراه","عراق","مليسيا","澳門","닷컴","政府","شبكة","بيتك","عرب","გე","机构","组织机构","健康","ไทย","سورية","招聘","рус","рф","珠宝","تونس","大拿","みんな","グーグル","ελ","世界","書籍","ഭാരതം","ਭਾਰਤ","网址","닷넷","コム","天主教","游戏","vermögensberater","vermögensberatung","企业","信息","嘉里大酒店","嘉里","مصر","قطر","广东","இலங்கை","இந்தியா","հայ","新加坡","فلسطين","政务","xperia","xxx","xyz","yachts","yahoo","yamaxun","yandex","ye","yodobashi","yoga","yokohama","you","youtube","yt","yun","za","zappos","zara","zero","zip","zippo","zm","zone","zuerich","zw"]},function(e,t,r){"use strict";function n(){return(0,s.default)(a.lower+a.upper+a.numbers,6)}function o(e){var t=0,r={},o=[];return e.blocks.forEach(function(e){var i=[],a=[];e.entities.forEach(function(n){var o=t++,i=e.value.substr(n.index,n.length);switch(n.type){case"mention":r[o]={type:"mention",mutability:"IMMUTABLE",data:{mention:{link:n.metadata.id,name:i}}};break;default:return}a.push({key:o,offset:n.index,length:n.length})}),e.styles.forEach(function(e){var t=u[e.type];t&&i.push({style:t,offset:e.index,length:e.length})}),o.push({key:n(),type:"text"===e.type?"unstyled":e.type,text:e.value,inlineStyleRanges:i,entityRanges:a,data:{},depth:0})}),{blocks:o,entityMap:r}}t.__esModule=!0;var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},a=r(76),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=function(){return Object.keys({italic:!0,bold:!0,underline:!0,strikethrough:!0,superscript:!0,subscript:!0}).reduce(function(e,t){var r;return i({},e,(r={},r[t]=t.toUpperCase(),r[t.toUpperCase()]=t,r))},{})}();t.default=o}])});
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.PageProof=t():e.PageProof=t()}(this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=83)}([function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=function e(t){n(this,e),this.client=t};t.default=o},function(e,t){e.exports={options:{usePureJavaScript:!1}}},function(e,t,r){function n(e){if(8!==e&&16!==e&&24!==e&&32!==e)throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}function o(e){if(this.data="",this.read=0,"string"==typeof e)this.data=e;else if(s.isArrayBuffer(e)||s.isArrayBufferView(e)){var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch(e){for(var r=0;r<t.length;++r)this.putByte(t[r])}}else(e instanceof o||"object"==typeof e&&"string"==typeof e.data&&"number"==typeof e.read)&&(this.data=e.data,this.read=e.read);this._constructedStringLength=0}function i(e,t){t=t||{},this.read=t.readOffset||0,this.growSize=t.growSize||1024;var r=s.isArrayBuffer(e),n=s.isArrayBufferView(e);if(r||n)return this.data=r?new DataView(e):new DataView(e.buffer,e.byteOffset,e.byteLength),void(this.write="writeOffset"in t?t.writeOffset:this.data.byteLength);this.data=new DataView(new ArrayBuffer(0)),this.write=0,null!==e&&void 0!==e&&this.putBytes(e),"writeOffset"in t&&(this.write=t.writeOffset)}var a=r(1),s=e.exports=a.util=a.util||{};!function(){function e(e){if(e.source===window&&e.data===t){e.stopPropagation();var n=r.slice();r.length=0,n.forEach(function(e){e()})}}if("undefined"!=typeof process&&process.nextTick)return s.nextTick=process.nextTick,void("function"==typeof setImmediate?s.setImmediate=setImmediate:s.setImmediate=s.nextTick);if("function"==typeof setImmediate)return s.setImmediate=function(){return setImmediate.apply(void 0,arguments)},void(s.nextTick=function(e){return setImmediate(e)});if(s.setImmediate=function(e){setTimeout(e,0)},"undefined"!=typeof window&&"function"==typeof window.postMessage){var t="forge.setImmediate",r=[];s.setImmediate=function(e){r.push(e),1===r.length&&window.postMessage(t,"*")},window.addEventListener("message",e,!0)}if("undefined"!=typeof MutationObserver){var n=Date.now(),o=!0,i=document.createElement("div"),r=[];new MutationObserver(function(){var e=r.slice();r.length=0,e.forEach(function(e){e()})}).observe(i,{attributes:!0});var a=s.setImmediate;s.setImmediate=function(e){Date.now()-n>15?(n=Date.now(),a(e)):(r.push(e),1===r.length&&i.setAttribute("a",o=!o))}}s.nextTick=s.setImmediate}(),s.isNodejs="undefined"!=typeof process&&process.versions&&process.versions.node,s.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},s.isArrayBuffer=function(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer},s.isArrayBufferView=function(e){return e&&s.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},s.ByteBuffer=o,s.ByteStringBuffer=o;s.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},s.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},s.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},s.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},s.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var r=this.data;t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return this.data=r,this._optimizeConstructedString(t),this},s.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},s.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(s.encodeUtf8(e))},s.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},s.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},s.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},s.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},s.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},s.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))},s.ByteStringBuffer.prototype.putInt=function(e,t){n(t);var r="";do{t-=8,r+=String.fromCharCode(e>>t&255)}while(t>0);return this.putBytes(r)},s.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<<t-1),this.putInt(e,t)},s.ByteStringBuffer.prototype.putBuffer=function(e){return this.putBytes(e.getBytes())},s.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)},s.ByteStringBuffer.prototype.getInt16=function(){var e=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,e},s.ByteStringBuffer.prototype.getInt24=function(){var e=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,e},s.ByteStringBuffer.prototype.getInt32=function(){var e=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+3);return this.read+=4,e},s.ByteStringBuffer.prototype.getInt16Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,e},s.ByteStringBuffer.prototype.getInt24Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,e},s.ByteStringBuffer.prototype.getInt32Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16^this.data.charCodeAt(this.read+3)<<24;return this.read+=4,e},s.ByteStringBuffer.prototype.getInt=function(e){n(e);var t=0;do{t=(t<<8)+this.data.charCodeAt(this.read++),e-=8}while(e>0);return t},s.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<<e-2;return t>=r&&(t-=r<<1),t},s.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},s.ByteStringBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},s.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},s.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this},s.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},s.ByteStringBuffer.prototype.copy=function(){var e=s.createBuffer(this.data);return e.read=this.read,e},s.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},s.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},s.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this},s.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.length;++t){var r=this.data.charCodeAt(t);r<16&&(e+="0"),e+=r.toString(16)}return e},s.ByteStringBuffer.prototype.toString=function(){return s.decodeUtf8(this.bytes())},s.DataBuffer=i,s.DataBuffer.prototype.length=function(){return this.write-this.read},s.DataBuffer.prototype.isEmpty=function(){return this.length()<=0},s.DataBuffer.prototype.accommodate=function(e,t){if(this.length()>=e)return this;t=Math.max(t||this.growSize,e);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),n=new Uint8Array(this.length()+t);return n.set(r),this.data=new DataView(n.buffer),this},s.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},s.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var r=0;r<t;++r)this.data.setUint8(e);return this},s.DataBuffer.prototype.putBytes=function(e,t){if(s.isArrayBufferView(e)){var r=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),n=r.byteLength-r.byteOffset;this.accommodate(n);var o=new Uint8Array(this.data.buffer,this.write);return o.set(r),this.write+=n,this}if(s.isArrayBuffer(e)){var r=new Uint8Array(e);this.accommodate(r.byteLength);var o=new Uint8Array(this.data.buffer);return o.set(r,this.write),this.write+=r.byteLength,this}if(e instanceof s.DataBuffer||"object"==typeof e&&"number"==typeof e.read&&"number"==typeof e.write&&s.isArrayBufferView(e.data)){var r=new Uint8Array(e.data.byteLength,e.read,e.length());this.accommodate(r.byteLength);var o=new Uint8Array(e.data.byteLength,this.write);return o.set(r),this.write+=r.byteLength,this}if(e instanceof s.ByteStringBuffer&&(e=e.data,t="binary"),t=t||"binary","string"==typeof e){var i;if("hex"===t)return this.accommodate(Math.ceil(e.length/2)),i=new Uint8Array(this.data.buffer,this.write),this.write+=s.binary.hex.decode(e,i,this.write),this;if("base64"===t)return this.accommodate(3*Math.ceil(e.length/4)),i=new Uint8Array(this.data.buffer,this.write),this.write+=s.binary.base64.decode(e,i,this.write),this;if("utf8"===t&&(e=s.encodeUtf8(e),t="binary"),"binary"===t||"raw"===t)return this.accommodate(e.length),i=new Uint8Array(this.data.buffer,this.write),this.write+=s.binary.raw.decode(i),this;if("utf16"===t)return this.accommodate(2*e.length),i=new Uint16Array(this.data.buffer,this.write),this.write+=s.text.utf16.encode(i),this;throw new Error("Invalid encoding: "+t)}throw Error("Invalid parameter: "+e)},s.DataBuffer.prototype.putBuffer=function(e){return this.putBytes(e),e.clear(),this},s.DataBuffer.prototype.putString=function(e){return this.putBytes(e,"utf16")},s.DataBuffer.prototype.putInt16=function(e){return this.accommodate(2),this.data.setInt16(this.write,e),this.write+=2,this},s.DataBuffer.prototype.putInt24=function(e){return this.accommodate(3),this.data.setInt16(this.write,e>>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},s.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},s.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},s.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this},s.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},s.DataBuffer.prototype.putInt=function(e,t){n(t),this.accommodate(t/8);do{t-=8,this.data.setInt8(this.write++,e>>t&255)}while(t>0);return this},s.DataBuffer.prototype.putSignedInt=function(e,t){return n(t),this.accommodate(t/8),e<0&&(e+=2<<t-1),this.putInt(e,t)},s.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)},s.DataBuffer.prototype.getInt16=function(){var e=this.data.getInt16(this.read);return this.read+=2,e},s.DataBuffer.prototype.getInt24=function(){var e=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,e},s.DataBuffer.prototype.getInt32=function(){var e=this.data.getInt32(this.read);return this.read+=4,e},s.DataBuffer.prototype.getInt16Le=function(){var e=this.data.getInt16(this.read,!0);return this.read+=2,e},s.DataBuffer.prototype.getInt24Le=function(){var e=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,e},s.DataBuffer.prototype.getInt32Le=function(){var e=this.data.getInt32(this.read,!0);return this.read+=4,e},s.DataBuffer.prototype.getInt=function(e){n(e);var t=0;do{t=(t<<8)+this.data.getInt8(this.read++),e-=8}while(e>0);return t},s.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<<e-2;return t>=r&&(t-=r<<1),t},s.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},s.DataBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},s.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},s.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},s.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},s.DataBuffer.prototype.copy=function(){return new s.DataBuffer(this)},s.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this},s.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},s.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},s.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.byteLength;++t){var r=this.data.getUint8(t);r<16&&(e+="0"),e+=r.toString(16)}return e},s.DataBuffer.prototype.toString=function(e){var t=new Uint8Array(this.data,this.read,this.length());if("binary"===(e=e||"utf8")||"raw"===e)return s.binary.raw.encode(t);if("hex"===e)return s.binary.hex.encode(t);if("base64"===e)return s.binary.base64.encode(t);if("utf8"===e)return s.text.utf8.decode(t);if("utf16"===e)return s.text.utf16.decode(t);throw new Error("Invalid encoding: "+e)},s.createBuffer=function(e,t){return t=t||"raw",void 0!==e&&"utf8"===t&&(e=s.encodeUtf8(e)),new s.ByteBuffer(e)},s.fillString=function(e,t){for(var r="";t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return r},s.xorBytes=function(e,t,r){for(var n="",o="",i="",a=0,s=0;r>0;--r,++a)o=e.charCodeAt(a)^t.charCodeAt(a),s>=10&&(n+=i,i="",s=0),i+=String.fromCharCode(o),++s;return n+=i},s.hexToBytes=function(e){var t="",r=0;for(!0&e.length&&(r=1,t+=String.fromCharCode(parseInt(e[0],16)));r<e.length;r+=2)t+=String.fromCharCode(parseInt(e.substr(r,2),16));return t},s.bytesToHex=function(e){return s.createBuffer(e).toHex()},s.int32ToBytes=function(e){return String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)};var u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",c=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51];s.encode64=function(e,t){for(var r,n,o,i="",a="",s=0;s<e.length;)r=e.charCodeAt(s++),n=e.charCodeAt(s++),o=e.charCodeAt(s++),i+=u.charAt(r>>2),i+=u.charAt((3&r)<<4|n>>4),isNaN(n)?i+="==":(i+=u.charAt((15&n)<<2|o>>6),i+=isNaN(o)?"=":u.charAt(63&o)),t&&i.length>t&&(a+=i.substr(0,t)+"\r\n",i=i.substr(t));return a+=i},s.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t,r,n,o,i="",a=0;a<e.length;)t=c[e.charCodeAt(a++)-43],r=c[e.charCodeAt(a++)-43],n=c[e.charCodeAt(a++)-43],o=c[e.charCodeAt(a++)-43],i+=String.fromCharCode(t<<2|r>>4),64!==n&&(i+=String.fromCharCode((15&r)<<4|n>>2),64!==o&&(i+=String.fromCharCode((3&n)<<6|o)));return i},s.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},s.decodeUtf8=function(e){return decodeURIComponent(escape(e))},s.binary={raw:{},hex:{},base64:{}},s.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},s.binary.raw.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(e.length)),r=r||0;for(var o=r,i=0;i<e.length;++i)n[o++]=e.charCodeAt(i);return t?o-r:n},s.binary.hex.encode=s.bytesToHex,s.binary.hex.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(Math.ceil(e.length/2))),r=r||0;var o=0,i=r;for(1&e.length&&(o=1,n[i++]=parseInt(e[0],16));o<e.length;o+=2)n[i++]=parseInt(e.substr(o,2),16);return t?i-r:n},s.binary.base64.encode=function(e,t){for(var r,n,o,i="",a="",s=0;s<e.byteLength;)r=e[s++],n=e[s++],o=e[s++],i+=u.charAt(r>>2),i+=u.charAt((3&r)<<4|n>>4),isNaN(n)?i+="==":(i+=u.charAt((15&n)<<2|o>>6),i+=isNaN(o)?"=":u.charAt(63&o)),t&&i.length>t&&(a+=i.substr(0,t)+"\r\n",i=i.substr(t));return a+=i},s.binary.base64.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,""),r=r||0;for(var o,i,a,s,u=0,l=r;u<e.length;)o=c[e.charCodeAt(u++)-43],i=c[e.charCodeAt(u++)-43],a=c[e.charCodeAt(u++)-43],s=c[e.charCodeAt(u++)-43],n[l++]=o<<2|i>>4,64!==a&&(n[l++]=(15&i)<<4|a>>2,64!==s&&(n[l++]=(3&a)<<6|s));return t?l-r:n.subarray(0,l)},s.text={utf8:{},utf16:{}},s.text.utf8.encode=function(e,t,r){e=s.encodeUtf8(e);var n=t;n||(n=new Uint8Array(e.length)),r=r||0;for(var o=r,i=0;i<e.length;++i)n[o++]=e.charCodeAt(i);return t?o-r:n},s.text.utf8.decode=function(e){return s.decodeUtf8(String.fromCharCode.apply(null,e))},s.text.utf16.encode=function(e,t,r){var n=t;n||(n=new Uint8Array(2*e.length));var o=new Uint16Array(n.buffer);r=r||0;for(var i=r,a=r,s=0;s<e.length;++s)o[a++]=e.charCodeAt(s),i+=2;return t?i-r:n},s.text.utf16.decode=function(e){return String.fromCharCode.apply(null,new Uint16Array(e.buffer))},s.deflate=function(e,t,r){if(t=s.decode64(e.deflate(s.encode64(t)).rval),r){var n=2;32&t.charCodeAt(1)&&(n=6),t=t.substring(n,t.length-4)}return t},s.inflate=function(e,t,r){var n=e.inflate(s.encode64(t)).rval;return null===n?null:s.decode64(n)};var l=function(e,t,r){if(!e)throw new Error("WebStorage not available.");var n;if(null===r?n=e.removeItem(t):(r=s.encode64(JSON.stringify(r)),n=e.setItem(t,r)),void 0!==n&&!0!==n.rval){var o=new Error(n.error.message);throw o.id=n.error.id,o.name=n.error.name,o}},f=function(e,t){if(!e)throw new Error("WebStorage not available.");var r=e.getItem(t);if(e.init)if(null===r.rval){if(r.error){var n=new Error(r.error.message);throw n.id=r.error.id,n.name=r.error.name,n}r=null}else r=r.rval;return null!==r&&(r=JSON.parse(s.decode64(r))),r},p=function(e,t,r,n){var o=f(e,t);null===o&&(o={}),o[r]=n,l(e,t,o)},d=function(e,t,r){var n=f(e,t);return null!==n&&(n=r in n?n[r]:null),n},h=function(e,t,r){var n=f(e,t);if(null!==n&&r in n){delete n[r];var o=!0;for(var i in n){o=!1;break}o&&(n=null),l(e,t,n)}},y=function(e,t){l(e,t,null)},m=function(e,t,r){var n=null;void 0===r&&(r=["web","flash"]);var o,i=!1,a=null;for(var s in r){o=r[s];try{if("flash"===o||"both"===o){if(null===t[0])throw new Error("Flash local storage not available.");n=e.apply(this,t),i="flash"===o}"web"!==o&&"both"!==o||(t[0]=localStorage,n=e.apply(this,t),i=!0)}catch(e){a=e}if(i)break}if(!i)throw a;return n};s.setItem=function(e,t,r,n,o){m(p,arguments,o)},s.getItem=function(e,t,r,n){return m(d,arguments,n)},s.removeItem=function(e,t,r,n){m(h,arguments,n)},s.clearItems=function(e,t,r){m(y,arguments,r)},s.parseUrl=function(e){var t=/^(https?):\/\/([^:&^\/]*):?(\d*)(.*)$/g;t.lastIndex=0;var r=t.exec(e),n=null===r?null:{full:e,scheme:r[1],host:r[2],port:r[3],path:r[4]};return n&&(n.fullHost=n.host,n.port?80!==n.port&&"http"===n.scheme?n.fullHost+=":"+n.port:443!==n.port&&"https"===n.scheme&&(n.fullHost+=":"+n.port):"http"===n.scheme?n.port=80:"https"===n.scheme&&(n.port=443),n.full=n.scheme+"://"+n.fullHost),n};var g=null;s.getQueryVariables=function(e){var t,r=function(e){for(var t={},r=e.split("&"),n=0;n<r.length;n++){var o,i,a=r[n].indexOf("=");a>0?(o=r[n].substring(0,a),i=r[n].substring(a+1)):(o=r[n],i=null),o in t||(t[o]=[]),o in Object.prototype||null===i||t[o].push(unescape(i))}return t};return void 0===e?(null===g&&(g="undefined"!=typeof window&&window.location&&window.location.search?r(window.location.search.substring(1)):{}),t=g):t=r(e),t},s.parseFragment=function(e){var t=e,r="",n=e.indexOf("?");n>0&&(t=e.substring(0,n),r=e.substring(n+1));var o=t.split("/");return o.length>0&&""===o[0]&&o.shift(),{pathString:t,queryString:r,path:o,query:""===r?{}:s.getQueryVariables(r)}},s.makeRequest=function(e){var t=s.parseFragment(e),r={path:t.pathString,query:t.queryString,getPath:function(e){return void 0===e?t.path:t.path[e]},getQuery:function(e,r){var n;return void 0===e?n=t.query:(n=t.query[e])&&void 0!==r&&(n=n[r]),n},getQueryLast:function(e,t){var n=r.getQuery(e);return n?n[n.length-1]:t}};return r},s.makeLink=function(e,t,r){e=jQuery.isArray(e)?e.join("/"):e;var n=jQuery.param(t||{});return r=r||"",e+(n.length>0?"?"+n:"")+(r.length>0?"#"+r:"")},s.setPath=function(e,t,r){if("object"==typeof e&&null!==e)for(var n=0,o=t.length;n<o;){var i=t[n++];if(n==o)e[i]=r;else{var a=i in e;(!a||a&&"object"!=typeof e[i]||a&&null===e[i])&&(e[i]={}),e=e[i]}}},s.getPath=function(e,t,r){for(var n=0,o=t.length,i=!0;i&&n<o&&"object"==typeof e&&null!==e;){var a=t[n++];i=a in e,i&&(e=e[a])}return i?e:r},s.deletePath=function(e,t){if("object"==typeof e&&null!==e)for(var r=0,n=t.length;r<n;){var o=t[r++];if(r==n)delete e[o];else{if(!(o in e)||"object"!=typeof e[o]||null===e[o])break;e=e[o]}}},s.isEmpty=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},s.format=function(e){for(var t,r,n=/%./g,o=0,i=[],a=0;t=n.exec(e);){r=e.substring(a,n.lastIndex-2),r.length>0&&i.push(r),a=n.lastIndex;var s=t[0][1];switch(s){case"s":case"o":o<arguments.length?i.push(arguments[1+o++]):i.push("<?>");break;case"%":i.push("%");break;default:i.push("<%"+s+"?>")}}return i.push(e.substring(a)),i.join("")},s.formatNumber=function(e,t,r,n){var o=e,i=isNaN(t=Math.abs(t))?2:t,a=void 0===r?",":r,s=void 0===n?".":n,u=o<0?"-":"",c=parseInt(o=Math.abs(+o||0).toFixed(i),10)+"",l=c.length>3?c.length%3:0;return u+(l?c.substr(0,l)+s:"")+c.substr(l).replace(/(\d{3})(?=\d)/g,"$1"+s)+(i?a+Math.abs(o-c).toFixed(i).slice(2):"")},s.formatSize=function(e){return e=e>=1073741824?s.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?s.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?s.formatNumber(e/1024,0)+" KiB":s.formatNumber(e,0)+" bytes"},s.bytesFromIP=function(e){return-1!==e.indexOf(".")?s.bytesFromIPv4(e):-1!==e.indexOf(":")?s.bytesFromIPv6(e):null},s.bytesFromIPv4=function(e){if(e=e.split("."),4!==e.length)return null;for(var t=s.createBuffer(),r=0;r<e.length;++r){var n=parseInt(e[r],10);if(isNaN(n))return null;t.putByte(n)}return t.getBytes()},s.bytesFromIPv6=function(e){var t=0;e=e.split(":").filter(function(e){return 0===e.length&&++t,!0});for(var r=2*(8-e.length+t),n=s.createBuffer(),o=0;o<8;++o)if(e[o]&&0!==e[o].length){var i=s.hexToBytes(e[o]);i.length<2&&n.putByte(0),n.putBytes(i)}else n.fillWithByte(0,r),r=0;return n.getBytes()},s.bytesToIP=function(e){return 4===e.length?s.bytesToIPv4(e):16===e.length?s.bytesToIPv6(e):null},s.bytesToIPv4=function(e){if(4!==e.length)return null;for(var t=[],r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t.join(".")},s.bytesToIPv6=function(e){if(16!==e.length)return null;for(var t=[],r=[],n=0,o=0;o<e.length;o+=2){for(var i=s.bytesToHex(e[o]+e[o+1]);"0"===i[0]&&"0"!==i;)i=i.substr(1);if("0"===i){var a=r[r.length-1],u=t.length;a&&u===a.end+1?(a.end=u,a.end-a.start>r[n].end-r[n].start&&(n=r.length-1)):r.push({start:u,end:u})}t.push(i)}if(r.length>0){var c=r[n];c.end-c.start>0&&(t.splice(c.start,c.end-c.start+1,""),0===c.start&&t.unshift(""),7===c.end&&t.push(""))}return t.join(":")},s.estimateCores=function(e,t){function r(e,a,u){if(0===a){var c=Math.floor(e.reduce(function(e,t){return e+t},0)/e.length);return s.cores=Math.max(1,c),URL.revokeObjectURL(i),t(null,s.cores)}n(u,function(t,n){e.push(o(u,n)),r(e,a-1,u)})}function n(e,t){for(var r=[],n=[],o=0;o<e;++o){var a=new Worker(i);a.addEventListener("message",function(o){if(n.push(o.data),n.length===e){for(var i=0;i<e;++i)r[i].terminate();t(null,n)}}),r.push(a)}for(var o=0;o<e;++o)r[o].postMessage(o)}function o(e,t){for(var r=[],n=0;n<e;++n)for(var o=t[n],i=r[n]=[],a=0;a<e;++a)if(n!==a){var s=t[a];(o.st>s.st&&o.st<s.et||s.st>o.st&&s.st<o.et)&&i.push(a)}return r.reduce(function(e,t){return Math.max(e,t.length)},0)}if("function"==typeof e&&(t=e,e={}),e=e||{},"cores"in s&&!e.update)return t(null,s.cores);if("undefined"!=typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return s.cores=navigator.hardwareConcurrency,t(null,s.cores);if("undefined"==typeof Worker)return s.cores=1,t(null,s.cores);if("undefined"==typeof Blob)return s.cores=2,t(null,s.cores);var i=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(e){for(var t=Date.now(),r=t+4;Date.now()<r;);self.postMessage({st:t,et:r})})}.toString(),")()"],{type:"application/javascript"}));r([],5,16)}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t,r){var n=[],o={};return Array.isArray(t)?(n=t,t.forEach(function(e){o[e]=e})):(0,y.default)(t)&&(n=Object.keys(t),o=t),n.forEach(function(t){var n=o[t],i=void 0;if("string"==typeof n)i=-1!==n.indexOf(".")?function(){for(var e=n.split("."),t=r,o=0;o<e.length;o++){var i=e[o];if(!(0,g.default)(t,i)){t=void 0;break}t=t[i]}return t}:function(){return r[n]};else{if("function"!=typeof n){if(null===n)return;throw new Error("Unknown transformer.")}i=n}var a=i.call(e,r);void 0!==a&&(e[t]=a)}),e}function i(e){return function(t){return Number(t[e])}}function a(e,t){return function(r){return t[r[e]]}}function s(e){return function(t){var r=t[e];if(r&&"0001-01-01T00:00:00"!==r)return"number"==typeof r?new Date(1e3*r):r.endsWith("Z")?new Date(r):new Date(r+"Z")}}function u(e){return function(t){var r=String(t[e]);return"1"===r||"true"===r}}function c(e){return function(t){return g.default.call(t,e)}}function l(e,t){return function(r){return r[e]?r[e].map(t):[]}}function f(e,t){return function(r){return r[e]?JSON.parse(r[e]):Array.isArray(t)?[].concat(t):d({},t)}}function p(e){return function(t){return t[e]?t[e]:void 0}}t.__esModule=!0;var d=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e};t.number=i,t.enumeration=a,t.date=s,t.truthy=u,t.exists=c,t.each=l,t.json=f,t.optional=p;var h=r(26),y=n(h),m=r(17),g=n(m);t.default=o},function(e,t,r){"use strict";function n(){if("function"==typeof n.driver){return new(0,n.driver)}if("string"==typeof n.driver){var e=void 0;switch(n.driver){case"Blob":e=r(126).default;break;case"Buffer":e=r(127).default;break;case"String":e=r(128).default;break;case"Uint8Array":e=r(130).default;break;default:throw new Error('Unknown Bluffer driver "'+n.driver+'".')}if(e)return new e;throw new Error('Bluffer driver "'+n.driver+'" not found.')}throw new Error('Bluffer.driver must be either "Blob", "Bluffer", "Uint8Array" (experimental), or "String" or a custom constructor.')}t.__esModule=!0;var o=r(34)("bluffer");n.driver="String","undefined"!=typeof Blob?n.driver="Blob":(o("The current JavaScript environment does not support native Bluffer, falling back to using StringBluffer."),n.driver="String"),t.default=n},function(e,t,r){"use strict";t.__esModule=!0;t.TOKEN_HEADER="x-authorization-token",t.HMAC_HEADER="x-authorization-hmac",t.TIMESTAMP_HEADER="x-timestamp",t.DEVICE_ID_HEADER="x-device-id",t.SUBSCRIPTION_KEY_HEADER="ocp-apim-subscription-key",t.LOCAL_ENCODED_METADATA_HEADER="x-p-lem",t.SDK_VERSION_HEADER="x-pageproof-javascript-sdk",t.RETRY_AFTER_HEADER="retry-after",t.BYTES_PER_BLOCK=2097152,t.MENTION_REGEX=/@{(U[a-zA-Z0-9]{15}|~everyone)}{(.*?)}/,t.COMMENT_LABEL_REGEX=/^(approved|highlight):/i,t.ISO_REGEX=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/,t.DEFAULT_ISO_DATE="0001-01-01T00:00:00",t.DAY_IN_MS=864e5,t.COMMENT_CACHE_PREFIX="comment",t.THUMBNAIL_CACHE_PREFIX="thumbnail",t.PREVIEW_CACHE_PREFIX="preview",t.BRIAN_USER_ID="__brian__",t.BRIAN_TOKEN_HEADER="x-authorization-apitoken",t.BRIAN_HMAC_HEADER="x-authorization-api_hmac",t.VIDEO_CREDENTIALS_CACHE_PREFIX="video-credentials-json-"},function(e,t,r){var n=r(1);r(10),r(49),r(50),r(2),function(){if(n.random&&n.random.getBytes)return void(e.exports=n.random);!function(t){function r(){var e=n.prng.create(o);return e.getBytes=function(t,r){return e.generate(t,r)},e.getBytesSync=function(t){return e.generate(t)},e}var o={},i=new Array(4),a=n.util.createBuffer();o.formatKey=function(e){var t=n.util.createBuffer(e);return e=new Array(4),e[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),n.aes._expandKey(e,!1)},o.formatSeed=function(e){var t=n.util.createBuffer(e);return e=new Array(4),e[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),e},o.cipher=function(e,t){return n.aes._updateBlock(e,t,i,!1),a.putInt32(i[0]),a.putInt32(i[1]),a.putInt32(i[2]),a.putInt32(i[3]),a.getBytes()},o.increment=function(e){return++e[3],e},o.md=n.md.sha256;var s=r(),u=null;if("undefined"!=typeof window){var c=window.crypto||window.msCrypto;c&&c.getRandomValues&&(u=function(e){return c.getRandomValues(e)})}if(n.options.usePureJavaScript||!n.util.isNodejs&&!u){if("undefined"==typeof window||window.document,s.collectInt(+new Date,32),"undefined"!=typeof navigator){var l="";for(var f in navigator)try{"string"==typeof navigator[f]&&(l+=navigator[f])}catch(e){}s.collect(l),l=null}t&&(t().mousemove(function(e){s.collectInt(e.clientX,16),s.collectInt(e.clientY,16)}),t().keypress(function(e){s.collectInt(e.charCode,8)}))}if(n.random)for(var f in s)n.random[f]=s[f];else n.random=s;n.random.createInstance=r,e.exports=n.random}("undefined"!=typeof jQuery?jQuery:null)}()},function(e,t,r){function n(e,t,r){if(r>t){var n=new Error("Too few bytes to parse DER.");throw n.available=e.length(),n.remaining=t,n.requested=r,n}}function o(e,t,r,i){var u;n(e,t,2);var c=e.getByte();t--;var l=192&c,f=31&c;u=e.length();var p=s(e,t);if(t-=u-e.length(),void 0!==p&&p>t){if(i.strict){var d=new Error("Too few bytes to read ASN.1 value.");throw d.available=e.length(),d.remaining=t,d.requested=p,d}p=t}var h,y,m=32==(32&c);if(m)if(h=[],void 0===p)for(;;){if(n(e,t,2),e.bytes(2)===String.fromCharCode(0,0)){e.getBytes(2),t-=2;break}u=e.length(),h.push(o(e,t,r+1,i)),t-=u-e.length()}else for(;p>0;)u=e.length(),h.push(o(e,p,r+1,i)),t-=u-e.length(),p-=u-e.length();if(void 0===h&&l===a.Class.UNIVERSAL&&f===a.Type.BITSTRING&&(y=e.bytes(p)),void 0===h&&i.decodeBitStrings&&l===a.Class.UNIVERSAL&&f===a.Type.BITSTRING&&p>1){var g=e.read,v=t,b=0;if(f===a.Type.BITSTRING&&(n(e,t,1),b=e.getByte(),t--),0===b)try{u=e.length();var E={verbose:i.verbose,strict:!0,decodeBitStrings:!0},C=o(e,t,r+1,E),_=u-e.length();t-=_,f==a.Type.BITSTRING&&_++;var w=C.tagClass;_!==p||w!==a.Class.UNIVERSAL&&w!==a.Class.CONTEXT_SPECIFIC||(h=[C])}catch(e){}void 0===h&&(e.read=g,t=v)}if(void 0===h){if(void 0===p){if(i.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");p=t}if(f===a.Type.BMPSTRING)for(h="";p>0;p-=2)n(e,t,2),h+=String.fromCharCode(e.getInt16()),t-=2;else h=e.getBytes(p)}var T=void 0===y?null:{bitStringContents:y};return a.create(l,f,m,h,T)}var i=r(1);r(2),r(11);var a=e.exports=i.asn1=i.asn1||{};a.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},a.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},a.create=function(e,t,r,n,o){if(i.util.isArray(n)){for(var s=[],u=0;u<n.length;++u)void 0!==n[u]&&s.push(n[u]);n=s}var c={tagClass:e,type:t,constructed:r,composed:r||i.util.isArray(n),value:n};return o&&"bitStringContents"in o&&(c.bitStringContents=o.bitStringContents,c.original=a.copy(c)),c},a.copy=function(e,t){var r;if(i.util.isArray(e)){r=[];for(var n=0;n<e.length;++n)r.push(a.copy(e[n],t));return r}return"string"==typeof e?e:(r={tagClass:e.tagClass,type:e.type,constructed:e.constructed,composed:e.composed,value:a.copy(e.value,t)},t&&!t.excludeBitStringContents&&(r.bitStringContents=e.bitStringContents),r)},a.equals=function(e,t,r){if(i.util.isArray(e)){if(!i.util.isArray(t))return!1;if(e.length!==t.length)return!1;for(var n=0;n<e.length;++n)return!!a.equals(e[n],t[n])}if(typeof e!=typeof t)return!1;if("string"==typeof e)return e===t;var o=e.tagClass===t.tagClass&&e.type===t.type&&e.constructed===t.constructed&&e.composed===t.composed&&a.equals(e.value,t.value);return r&&r.includeBitStringContents&&(o=o&&e.bitStringContents===t.bitStringContents),o},a.getBerValueLength=function(e){var t=e.getByte();if(128!==t){return 128&t?e.getInt((127&t)<<3):t}};var s=function(e,t){var r=e.getByte();if(t--,128!==r){var o;if(128&r){var i=127&r;n(e,t,i),o=e.getInt(i<<3)}else o=r;if(o<0)throw new Error("Negative length: "+o);return o}};a.fromDer=function(e,t){return void 0===t&&(t={strict:!0,decodeBitStrings:!0}),"boolean"==typeof t&&(t={strict:t,decodeBitStrings:!0}),"strict"in t||(t.strict=!0),"decodeBitStrings"in t||(t.decodeBitStrings=!0),"string"==typeof e&&(e=i.util.createBuffer(e)),o(e,e.length(),0,t)},a.toDer=function(e){var t=i.util.createBuffer(),r=e.tagClass|e.type,n=i.util.createBuffer(),o=!1;if("bitStringContents"in e&&(o=!0,e.original&&(o=a.equals(e,e.original))),o)n.putBytes(e.bitStringContents);else if(e.composed){e.constructed?r|=32:n.putByte(0);for(var s=0;s<e.value.length;++s)void 0!==e.value[s]&&n.putBuffer(a.toDer(e.value[s]))}else if(e.type===a.Type.BMPSTRING)for(var s=0;s<e.value.length;++s)n.putInt16(e.value.charCodeAt(s));else e.type===a.Type.INTEGER&&e.value.length>1&&(0===e.value.charCodeAt(0)&&0==(128&e.value.charCodeAt(1))||255===e.value.charCodeAt(0)&&128==(128&e.value.charCodeAt(1)))?n.putBytes(e.value.substr(1)):n.putBytes(e.value);if(t.putByte(r),n.length()<=127)t.putByte(127&n.length());else{var u=n.length(),c="";do{c+=String.fromCharCode(255&u),u>>>=8}while(u>0);t.putByte(128|c.length);for(var s=c.length-1;s>=0;--s)t.putByte(c.charCodeAt(s))}return t.putBuffer(n),t},a.oidToDer=function(e){var t=e.split("."),r=i.util.createBuffer();r.putByte(40*parseInt(t[0],10)+parseInt(t[1],10));for(var n,o,a,s,u=2;u<t.length;++u){n=!0,o=[],a=parseInt(t[u],10);do{s=127&a,a>>>=7,n||(s|=128),o.push(s),n=!1}while(a>0);for(var c=o.length-1;c>=0;--c)r.putByte(o[c])}return r},a.derToOid=function(e){var t;"string"==typeof e&&(e=i.util.createBuffer(e));var r=e.getByte();t=Math.floor(r/40)+"."+r%40;for(var n=0;e.length()>0;)r=e.getByte(),n<<=7,128&r?n+=127&r:(t+="."+(n+r),n=0);return t},a.utcTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,2),10);r=r>=50?1900+r:2e3+r;var n=parseInt(e.substr(2,2),10)-1,o=parseInt(e.substr(4,2),10),i=parseInt(e.substr(6,2),10),a=parseInt(e.substr(8,2),10),s=0;if(e.length>11){var u=e.charAt(10),c=10;"+"!==u&&"-"!==u&&(s=parseInt(e.substr(10,2),10),c+=2)}if(t.setUTCFullYear(r,n,o),t.setUTCHours(i,a,s,0),c&&("+"===(u=e.charAt(c))||"-"===u)){var l=parseInt(e.substr(c+1,2),10),f=parseInt(e.substr(c+4,2),10),p=60*l+f;p*=6e4,"+"===u?t.setTime(+t-p):t.setTime(+t+p)}return t},a.generalizedTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,4),10),n=parseInt(e.substr(4,2),10)-1,o=parseInt(e.substr(6,2),10),i=parseInt(e.substr(8,2),10),a=parseInt(e.substr(10,2),10),s=parseInt(e.substr(12,2),10),u=0,c=0,l=!1;"Z"===e.charAt(e.length-1)&&(l=!0);var f=e.length-5,p=e.charAt(f);if("+"===p||"-"===p){c=60*parseInt(e.substr(f+1,2),10)+parseInt(e.substr(f+4,2),10),c*=6e4,"+"===p&&(c*=-1),l=!0}return"."===e.charAt(14)&&(u=1e3*parseFloat(e.substr(14),10)),l?(t.setUTCFullYear(r,n,o),t.setUTCHours(i,a,s,u),t.setTime(+t+c)):(t.setFullYear(r,n,o),t.setHours(i,a,s,u)),t},a.dateToUtcTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push((""+e.getUTCFullYear()).substr(2)),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n<r.length;++n)r[n].length<2&&(t+="0"),t+=r[n];return t+="Z"},a.dateToGeneralizedTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push(""+e.getUTCFullYear()),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n<r.length;++n)r[n].length<2&&(t+="0"),t+=r[n];return t+="Z"},a.integerToDer=function(e){var t=i.util.createBuffer();if(e>=-128&&e<128)return t.putSignedInt(e,8);if(e>=-32768&&e<32768)return t.putSignedInt(e,16);if(e>=-8388608&&e<8388608)return t.putSignedInt(e,24);if(e>=-2147483648&&e<2147483648)return t.putSignedInt(e,32);var r=new Error("Integer too large; max is 32-bits.");throw r.integer=e,r},a.derToInteger=function(e){"string"==typeof e&&(e=i.util.createBuffer(e));var t=8*e.length();if(t>32)throw new Error("Integer too large; max is 32-bits.");return e.getSignedInt(t)},a.validate=function(e,t,r,n){var o=!1;if(e.tagClass!==t.tagClass&&void 0!==t.tagClass||e.type!==t.type&&void 0!==t.type)n&&(e.tagClass!==t.tagClass&&n.push("["+t.name+'] Expected tag class "'+t.tagClass+'", got "'+e.tagClass+'"'),e.type!==t.type&&n.push("["+t.name+'] Expected type "'+t.type+'", got "'+e.type+'"'));else if(e.constructed===t.constructed||void 0===t.constructed){if(o=!0,t.value&&i.util.isArray(t.value))for(var s=0,u=0;o&&u<t.value.length;++u)o=t.value[u].optional||!1,e.value[s]&&(o=a.validate(e.value[s],t.value[u],r,n),o?++s:t.value[u].optional&&(o=!0)),!o&&n&&n.push("["+t.name+'] Tag class "'+t.tagClass+'", type "'+t.type+'" expected value length "'+t.value.length+'", got "'+e.value.length+'"');if(o&&r&&(t.capture&&(r[t.capture]=e.value),t.captureAsn1&&(r[t.captureAsn1]=e),t.captureBitStringContents&&"bitStringContents"in e&&(r[t.captureBitStringContents]=e.bitStringContents),t.captureBitStringValue&&"bitStringContents"in e)){if(e.bitStringContents.length<2)r[t.captureBitStringValue]="";else{var c=e.bitStringContents.charCodeAt(0);if(0!==c)throw new Error("captureBitStringValue only supported for zero unused bits");r[t.captureBitStringValue]=e.bitStringContents.slice(1)}}}else n&&n.push("["+t.name+'] Expected constructed "'+t.constructed+'", got "'+e.constructed+'"');return o};var u=/[^\\u0000-\\u00ff]/;a.prettyPrint=function(e,t,r){var n="";t=t||0,r=r||2,t>0&&(n+="\n");for(var o="",s=0;s<t*r;++s)o+=" ";switch(n+=o+"Tag: ",e.tagClass){case a.Class.UNIVERSAL:n+="Universal:";break;case a.Class.APPLICATION:n+="Application:";break;case a.Class.CONTEXT_SPECIFIC:n+="Context-Specific:";break;case a.Class.PRIVATE:n+="Private:"}if(e.tagClass===a.Class.UNIVERSAL)switch(n+=e.type,e.type){case a.Type.NONE:n+=" (None)";break;case a.Type.BOOLEAN:n+=" (Boolean)";break;case a.Type.INTEGER:n+=" (Integer)";break;case a.Type.BITSTRING:n+=" (Bit string)";break;case a.Type.OCTETSTRING:n+=" (Octet string)";break;case a.Type.NULL:n+=" (Null)";break;case a.Type.OID:n+=" (Object Identifier)";break;case a.Type.ODESC:n+=" (Object Descriptor)";break;case a.Type.EXTERNAL:n+=" (External or Instance of)";break;case a.Type.REAL:n+=" (Real)";break;case a.Type.ENUMERATED:n+=" (Enumerated)";break;case a.Type.EMBEDDED:n+=" (Embedded PDV)";break;case a.Type.UTF8:n+=" (UTF8)";break;case a.Type.ROID:n+=" (Relative Object Identifier)";break;case a.Type.SEQUENCE:n+=" (Sequence)";break;case a.Type.SET:n+=" (Set)";break;case a.Type.PRINTABLESTRING:n+=" (Printable String)";break;case a.Type.IA5String:n+=" (IA5String (ASCII))";break;case a.Type.UTCTIME:n+=" (UTC time)";break;case a.Type.GENERALIZEDTIME:n+=" (Generalized time)";break;case a.Type.BMPSTRING:n+=" (BMP String)"}else n+=e.type;if(n+="\n",n+=o+"Constructed: "+e.constructed+"\n",e.composed){for(var c=0,l="",s=0;s<e.value.length;++s)void 0!==e.value[s]&&(c+=1,l+=a.prettyPrint(e.value[s],t+1,r),s+1<e.value.length&&(l+=","));n+=o+"Sub values: "+c+l}else{if(n+=o+"Value: ",e.type===a.Type.OID){var f=a.derToOid(e.value);n+=f,i.pki&&i.pki.oids&&f in i.pki.oids&&(n+=" ("+i.pki.oids[f]+") ")}if(e.type===a.Type.INTEGER)try{n+=a.derToInteger(e.value)}catch(t){n+="0x"+i.util.bytesToHex(e.value)}else if(e.type===a.Type.BITSTRING){if(e.value.length>1?n+="0x"+i.util.bytesToHex(e.value.slice(1)):n+="(none)",e.value.length>0){var p=e.value.charCodeAt(0);1==p?n+=" (1 unused bit shown)":p>1&&(n+=" ("+p+" unused bits shown)")}}else e.type===a.Type.OCTETSTRING?(u.test(e.value)||(n+="("+e.value+") "),n+="0x"+i.util.bytesToHex(e.value)):e.type===a.Type.UTF8?n+=i.util.decodeUtf8(e.value):e.type===a.Type.PRINTABLESTRING||e.type===a.Type.IA5String?n+=e.value:u.test(e.value)?n+="0x"+i.util.bytesToHex(e.value):0===e.value.length?n+="[null]":n+=e.value}return n}},function(e,t,r){var n=r(1);e.exports=n.md=n.md||{},n.md.algorithms=n.md.algorithms||{}},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=r(3),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a={id:"UserId",name:"Name",email:"Email",hasActivated:"Activated",hasRegistered:"IsRegistered",hasAvatar:"HasAvatar",accountType:"AccountType",teamType:"TeamType",teamLogo:"Branding.LogoURL",registeredDate:(0,o.date)("Registered"),lastLoginDate:(0,o.date)("LastLogin"),lastUploadDate:(0,o.date)("LastUpload"),isAdmin:"IsDomainAdmin",features:"Features",teamId:"DomainId",hasTOTP:"TotpEnabled"},s=function(){function e(){n(this,e)}return e.prototype.fromJSON=function(e){return(0,i.default)(this,Object.keys(a),e),this},e.prototype.fromUser=function(e){return(0,i.default)(this,a,e),this},e}();t.default=s},function(e,t,r){function n(e,t){var r=function(){return new u.aes.Algorithm(e,t)};u.cipher.registerAlgorithm(e,r)}function o(){h=!0,f=[0,1,2,4,8,16,32,64,128,27,54];for(var e=new Array(256),t=0;t<128;++t)e[t]=t<<1,e[t+128]=t+128<<1^283;c=new Array(256),l=new Array(256),p=new Array(4),d=new Array(4);for(var t=0;t<4;++t)p[t]=new Array(256),d[t]=new Array(256);for(var r,n,o,i,a,s,u,y=0,m=0,t=0;t<256;++t){i=m^m<<1^m<<2^m<<3^m<<4,i=i>>8^255&i^99,c[y]=i,l[i]=y,a=e[i],r=e[y],n=e[r],o=e[n],s=a<<24^i<<16^i<<8^i^a,u=(r^n^o)<<24^(y^o)<<16^(y^n^o)<<8^y^r^o;for(var g=0;g<4;++g)p[g][y]=s,d[g][i]=u,s=s<<24|s>>>8,u=u<<24|u>>>8;0===y?y=m=1:(y=r^e[e[e[r^o]]],m^=e[e[m]])}}function i(e,t){for(var r,n=e.slice(0),o=1,i=n.length,a=i+6+1,s=y*a,u=i;u<s;++u)r=n[u-1],u%i==0?(r=c[r>>>16&255]<<24^c[r>>>8&255]<<16^c[255&r]<<8^c[r>>>24]^f[o]<<24,o++):i>6&&u%i==4&&(r=c[r>>>24]<<24^c[r>>>16&255]<<16^c[r>>>8&255]<<8^c[255&r]),n[u]=n[u-i]^r;if(t){var l,p=d[0],h=d[1],m=d[2],g=d[3],v=n.slice(0);s=n.length;for(var u=0,b=s-y;u<s;u+=y,b-=y)if(0===u||u===s-y)v[u]=n[b],v[u+1]=n[b+3],v[u+2]=n[b+2],v[u+3]=n[b+1];else for(var E=0;E<y;++E)l=n[b+E],v[u+(3&-E)]=p[c[l>>>24]]^h[c[l>>>16&255]]^m[c[l>>>8&255]]^g[c[255&l]];n=v}return n}function a(e,t,r,n){var o,i,a,s,u,f=e.length/4-1;n?(o=d[0],i=d[1],a=d[2],s=d[3],u=l):(o=p[0],i=p[1],a=p[2],s=p[3],u=c);var h,y,m,g,v,b,E;h=t[0]^e[0],y=t[n?3:1]^e[1],m=t[2]^e[2],g=t[n?1:3]^e[3];for(var C=3,_=1;_<f;++_)v=o[h>>>24]^i[y>>>16&255]^a[m>>>8&255]^s[255&g]^e[++C],b=o[y>>>24]^i[m>>>16&255]^a[g>>>8&255]^s[255&h]^e[++C],E=o[m>>>24]^i[g>>>16&255]^a[h>>>8&255]^s[255&y]^e[++C],g=o[g>>>24]^i[h>>>16&255]^a[y>>>8&255]^s[255&m]^e[++C],h=v,y=b,m=E;r[0]=u[h>>>24]<<24^u[y>>>16&255]<<16^u[m>>>8&255]<<8^u[255&g]^e[++C],r[n?3:1]=u[y>>>24]<<24^u[m>>>16&255]<<16^u[g>>>8&255]<<8^u[255&h]^e[++C],r[2]=u[m>>>24]<<24^u[g>>>16&255]<<16^u[h>>>8&255]<<8^u[255&y]^e[++C],r[n?1:3]=u[g>>>24]<<24^u[h>>>16&255]<<16^u[y>>>8&255]<<8^u[255&m]^e[++C]}function s(e){e=e||{};var t,r=(e.mode||"CBC").toUpperCase(),n="AES-"+r;t=e.decrypt?u.cipher.createDecipher(n,e.key):u.cipher.createCipher(n,e.key);var o=t.start;return t.start=function(e,r){var n=null;r instanceof u.util.ByteBuffer&&(n=r,r={}),r=r||{},r.output=n,r.iv=e,o.call(t,r)},t}var u=r(1);r(28),r(44),r(2),e.exports=u.aes=u.aes||{},u.aes.startEncrypting=function(e,t,r,n){var o=s({key:e,output:r,decrypt:!1,mode:n});return o.start(t),o},u.aes.createEncryptionCipher=function(e,t){return s({key:e,output:null,decrypt:!1,mode:t})},u.aes.startDecrypting=function(e,t,r,n){var o=s({key:e,output:r,decrypt:!0,mode:n});return o.start(t),o},u.aes.createDecryptionCipher=function(e,t){return s({key:e,output:null,decrypt:!0,mode:t})},u.aes.Algorithm=function(e,t){h||o();var r=this;r.name=e,r.mode=new t({blockSize:16,cipher:{encrypt:function(e,t){return a(r._w,e,t,!1)},decrypt:function(e,t){return a(r._w,e,t,!0)}}}),r._init=!1},u.aes.Algorithm.prototype.initialize=function(e){if(!this._init){var t,r=e.key;if("string"!=typeof r||16!==r.length&&24!==r.length&&32!==r.length){if(u.util.isArray(r)&&(16===r.length||24===r.length||32===r.length)){t=r,r=u.util.createBuffer();for(var n=0;n<t.length;++n)r.putByte(t[n])}}else r=u.util.createBuffer(r);if(!u.util.isArray(r)){t=r,r=[];var o=t.length();if(16===o||24===o||32===o){o>>>=2;for(var n=0;n<o;++n)r.push(t.getInt32())}}if(!u.util.isArray(r)||4!==r.length&&6!==r.length&&8!==r.length)throw new Error("Invalid key parameter.");var a=this.mode.name,s=-1!==["CFB","OFB","CTR","GCM"].indexOf(a);this._w=i(r,e.decrypt&&!s),this._init=!0}},u.aes._expandKey=function(e,t){return h||o(),i(e,t)},u.aes._updateBlock=a,n("AES-ECB",u.cipher.modes.ecb),n("AES-CBC",u.cipher.modes.cbc),n("AES-CFB",u.cipher.modes.cfb),n("AES-OFB",u.cipher.modes.ofb),n("AES-CTR",u.cipher.modes.ctr),n("AES-GCM",u.cipher.modes.gcm);var c,l,f,p,d,h=!1,y=4},function(e,t,r){function n(e,t){a[e]=t,a[t]=e}function o(e,t){a[e]=t}var i=r(1);i.pki=i.pki||{};var a=e.exports=i.pki.oids=i.oids=i.oids||{};n("1.2.840.113549.1.1.1","rsaEncryption"),n("1.2.840.113549.1.1.4","md5WithRSAEncryption"),n("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),n("1.2.840.113549.1.1.7","RSAES-OAEP"),n("1.2.840.113549.1.1.8","mgf1"),n("1.2.840.113549.1.1.9","pSpecified"),n("1.2.840.113549.1.1.10","RSASSA-PSS"),n("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),n("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),n("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),n("1.3.14.3.2.7","desCBC"),n("1.3.14.3.2.26","sha1"),n("2.16.840.1.101.3.4.2.1","sha256"),n("2.16.840.1.101.3.4.2.2","sha384"),n("2.16.840.1.101.3.4.2.3","sha512"),n("1.2.840.113549.2.5","md5"),n("1.2.840.113549.1.7.1","data"),n("1.2.840.113549.1.7.2","signedData"),n("1.2.840.113549.1.7.3","envelopedData"),n("1.2.840.113549.1.7.4","signedAndEnvelopedData"),n("1.2.840.113549.1.7.5","digestedData"),n("1.2.840.113549.1.7.6","encryptedData"),n("1.2.840.113549.1.9.1","emailAddress"),n("1.2.840.113549.1.9.2","unstructuredName"),n("1.2.840.113549.1.9.3","contentType"),n("1.2.840.113549.1.9.4","messageDigest"),n("1.2.840.113549.1.9.5","signingTime"),n("1.2.840.113549.1.9.6","counterSignature"),n("1.2.840.113549.1.9.7","challengePassword"),n("1.2.840.113549.1.9.8","unstructuredAddress"),n("1.2.840.113549.1.9.14","extensionRequest"),n("1.2.840.113549.1.9.20","friendlyName"),n("1.2.840.113549.1.9.21","localKeyId"),n("1.2.840.113549.1.9.22.1","x509Certificate"),n("1.2.840.113549.1.12.10.1.1","keyBag"),n("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),n("1.2.840.113549.1.12.10.1.3","certBag"),n("1.2.840.113549.1.12.10.1.4","crlBag"),n("1.2.840.113549.1.12.10.1.5","secretBag"),n("1.2.840.113549.1.12.10.1.6","safeContentsBag"),n("1.2.840.113549.1.5.13","pkcs5PBES2"),n("1.2.840.113549.1.5.12","pkcs5PBKDF2"),n("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),n("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),n("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),n("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),n("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),n("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),n("1.2.840.113549.2.7","hmacWithSHA1"),n("1.2.840.113549.2.8","hmacWithSHA224"),n("1.2.840.113549.2.9","hmacWithSHA256"),n("1.2.840.113549.2.10","hmacWithSHA384"),n("1.2.840.113549.2.11","hmacWithSHA512"),n("1.2.840.113549.3.7","des-EDE3-CBC"),n("2.16.840.1.101.3.4.1.2","aes128-CBC"),n("2.16.840.1.101.3.4.1.22","aes192-CBC"),n("2.16.840.1.101.3.4.1.42","aes256-CBC"),n("2.5.4.3","commonName"),n("2.5.4.5","serialName"),n("2.5.4.6","countryName"),n("2.5.4.7","localityName"),n("2.5.4.8","stateOrProvinceName"),n("2.5.4.10","organizationName"),n("2.5.4.11","organizationalUnitName"),n("2.16.840.1.113730.1.1","nsCertType"),o("2.5.29.1","authorityKeyIdentifier"),o("2.5.29.2","keyAttributes"),o("2.5.29.3","certificatePolicies"),o("2.5.29.4","keyUsageRestriction"),o("2.5.29.5","policyMapping"),o("2.5.29.6","subtreesConstraint"),o("2.5.29.7","subjectAltName"),o("2.5.29.8","issuerAltName"),o("2.5.29.9","subjectDirectoryAttributes"),o("2.5.29.10","basicConstraints"),o("2.5.29.11","nameConstraints"),o("2.5.29.12","policyConstraints"),o("2.5.29.13","basicConstraints"),n("2.5.29.14","subjectKeyIdentifier"),n("2.5.29.15","keyUsage"),o("2.5.29.16","privateKeyUsagePeriod"),n("2.5.29.17","subjectAltName"),n("2.5.29.18","issuerAltName"),n("2.5.29.19","basicConstraints"),o("2.5.29.20","cRLNumber"),o("2.5.29.21","cRLReason"),o("2.5.29.22","expirationDate"),o("2.5.29.23","instructionCode"),o("2.5.29.24","invalidityDate"),o("2.5.29.25","cRLDistributionPoints"),o("2.5.29.26","issuingDistributionPoint"),o("2.5.29.27","deltaCRLIndicator"),o("2.5.29.28","issuingDistributionPoint"),o("2.5.29.29","certificateIssuer"),o("2.5.29.30","nameConstraints"),n("2.5.29.31","cRLDistributionPoints"),n("2.5.29.32","certificatePolicies"),o("2.5.29.33","policyMappings"),o("2.5.29.34","policyConstraints"),n("2.5.29.35","authorityKeyIdentifier"),o("2.5.29.36","policyConstraints"),n("2.5.29.37","extKeyUsage"),o("2.5.29.46","freshestCRL"),o("2.5.29.54","inhibitAnyPolicy"),n("1.3.6.1.4.1.11129.2.4.2","timestampList"),n("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),n("1.3.6.1.5.5.7.3.1","serverAuth"),n("1.3.6.1.5.5.7.3.2","clientAuth"),n("1.3.6.1.5.5.7.3.3","codeSigning"),n("1.3.6.1.5.5.7.3.4","emailProtection"),n("1.3.6.1.5.5.7.3.8","timeStamping")},function(e,t,r){function n(e){for(var t=e.name+": ",r=[],n=function(e,t){return" "+t},o=0;o<e.values.length;++o)r.push(e.values[o].replace(/^(\S+\r\n)/,n));t+=r.join(",")+"\r\n";for(var i=0,a=-1,o=0;o<t.length;++o,++i)if(i>65&&-1!==a){var s=t[a];","===s?(++a,t=t.substr(0,a)+"\r\n "+t.substr(a)):t=t.substr(0,a)+"\r\n"+s+t.substr(a+1),i=o-a-1,a=-1,++o}else" "!==t[o]&&"\t"!==t[o]&&","!==t[o]||(a=o);return t}function o(e){return e.replace(/^\s+/,"")}var i=r(1);r(2);var a=e.exports=i.pem=i.pem||{};a.encode=function(e,t){t=t||{};var r,o="-----BEGIN "+e.type+"-----\r\n";if(e.procType&&(r={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]},o+=n(r)),e.contentDomain&&(r={name:"Content-Domain",values:[e.contentDomain]},o+=n(r)),e.dekInfo&&(r={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&r.values.push(e.dekInfo.parameters),o+=n(r)),e.headers)for(var a=0;a<e.headers.length;++a)o+=n(e.headers[a]);return e.procType&&(o+="\r\n"),o+=i.util.encode64(e.body,t.maxline||64)+"\r\n",o+="-----END "+e.type+"-----\r\n"},a.decode=function(e){for(var t,r=[],n=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,a=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,s=/\r?\n/;;){if(!(t=n.exec(e)))break;var u={type:t[1],procType:null,contentDomain:null,dekInfo:null,headers:[],body:i.util.decode64(t[3])};if(r.push(u),t[2]){for(var c=t[2].split(s),l=0;t&&l<c.length;){for(var f=c[l].replace(/\s+$/,""),p=l+1;p<c.length;++p){var d=c[p];if(!/\s/.test(d[0]))break;f+=d,l=p}if(t=f.match(a)){for(var h={name:t[1],values:[]},y=t[2].split(","),m=0;m<y.length;++m)h.values.push(o(y[m]));if(u.procType)if(u.contentDomain||"Content-Domain"!==h.name)if(u.dekInfo||"DEK-Info"!==h.name)u.headers.push(h);else{if(0===h.values.length)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');u.dekInfo={algorithm:y[0],parameters:y[1]||null}}else u.contentDomain=y[0]||"";else{if("Proc-Type"!==h.name)throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(2!==h.values.length)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');u.procType={version:y[0],type:y[1]}}}++l}if("ENCRYPTED"===u.procType&&!u.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(0===r.length)throw new Error("Invalid PEM formatted message.");return r}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(){return this.dueDate&&this.dueDate.getTime()<Date.now()}t.__esModule=!0;var a=r(3),s=n(a),u=r(59),c=n(u),l=r(21),f=n(l),p=r(60),d=n(p),h=r(22),y=n(h),m=r(61),g=r(109),v=n(g),b=r(9),E=n(b),C=r(110),_=n(C),w=r(111),T=n(w),S=r(112),I=n(S),A={id:"ProofId",name:"Title",status:"Status",workflowId:"WorkflowId",proofTemplateId:"ProofTemplateId",version:"Version",dueDate:(0,a.date)("DueDate"),createdDate:(0,a.date)("CreateDate"),approvedDate:(0,a.date)("ApprovedDate"),isLocked:"Locked",isArchived:"Closed",isOverdue:i,uploaderUserId:"UserId",ownerUserIds:"OwnerIds",editorUserId:"EditorId",editorUserIds:"EditorIds",lockerUserId:"ProofLockerId",messageToReviewers:"Description",messageToOwners:"OwnerMessage",messageToEditor:"EditorMessage",fileId:"FileId",fileExtension:"Extension",fileStatus:"FileStatus",fileMessage:"FileStatusMessage",fileSize:"FileSize",pageCount:(0,a.number)("Pages"),commentCount:(0,a.number)("ParentComments"),canDownload:(0,a.truthy)("DownloadOriginal"),type:"Type",processStatus:"ProcessStatus",recipient:"Recipient",recipientEmail:"RecipientEmail",todoCommentCount:(0,a.number)("CountTodoComments"),doneCommentCount:(0,a.number)("CountDoneComments"),fileCategory:"FileCategory",isAdminOnProof:"IsAdminOnProof",groupId:"GroupId",canReupload:"CanReupload",hasEditors:"HasEditors",groupName:"GroupName",role:"Role",canOthersEditComments:"FeatureEditComments",canAddCommentReplies:"FeatureCanAddCommentReplies",canHaveGeneralComments:"FeatureGeneralComments",canHavePrivateComments:"FeaturePrivateComments",canAddChecklist:"FeatureCanAddChecklist",hasDecisionsEnabled:"FeatureDecisions",hasColorSeparations:"HasColorSeparations",reference:"Reference",integrationReferences:(0,a.each)("IntegrationReferences",function(e){return(new T.default).fromProofIntegrationReference(e)}),checklist:function(e){return e.Checklist&&(new I.default).fromProofChecklist(e.Checklist)},isReferenceEnabled:"FeatureProofReference",source:"Source",owners:(0,a.each)("Owners",function(e){return(new E.default).fromUser(e)}),decisionSummary:(0,a.each)("Decisions",function(e){return(new _.default).fromDecisionSummary(e)}),tags:(0,a.each)("Tags",function(e){return e.Value}),teamId:"TeamId",isPublic:"IsPublic",canBePublic:"FeaturePublicProofs",availableWorkflowRoles:"FeatureAvailableWorkflowRoles",usePreviousVersionDueDate:"FeatureUsePreviousVersionDueDate",canSendShareLink:"FeatureSendShareLink",publicProofKeyPair:function(e){return e.PublicProofKeyPair&&{publicKeyPEM:e.PublicProofKeyPair.PublicKey,privateKeyPEM:e.PublicProofKeyPair.PrivateKey}},canSendMessageToOwners:"FeatureMessageToOwners",workflowMetrics:"WorkflowMetrics",commentVisibility:"CommentVisibility",canHaveCommentVisibility:"FeatureCommentVisibility",importUrl:"ImportURL",priority:"Priority",scheduledDate:"ScheduledDate"},k=function(){function e(){o(this,e)}return e.prototype.isUserAdminOfProofTeam=function(e){return e.isAdmin&&this.teamId===e.teamId},e.prototype.getState=function(){var e=c.default.ACTIVE;if(this.fileStatus===y.default.UPLOADING)e=c.default.UPLOADING;else if(this.hasFileError())e=c.default.FILE_ERROR;else if(this.isProcessing())e=c.default.PROCESSING;else if(this.type===d.default.BRIEF)switch(this.status){case f.default.NEW:e=c.default.SETUP_NEEDED;break;case f.default.PROOFING:e=c.default.BRIEFING;break;case f.default.AWAITING_NEW_VERSION:e=c.default.AWAITING_PROOF;break;case f.default.HAS_NEW_VERSION:e=c.default.HAS_NEW_VERSION;break;case f.default.ARCHIVED:e=c.default.ARCHIVED}else this.status===f.default.ARCHIVED?e=c.default.ARCHIVED:this.status===f.default.TODOS_REQUESTED?e=c.default.TODOS_REQUESTED:this.status===f.default.AWAITING_NEW_VERSION?e=c.default.AWAITING_NEW_VERSION:this.status===f.default.HAS_NEW_VERSION?e=c.default.HAS_NEW_VERSION:this.status===f.default.APPROVED?e=c.default.APPROVED:this.hasWorkflow()?this.hasWorkflowStarted()?this.isOverdue&&(e=c.default.OVERDUE):e=c.default.NOT_STARTED:e=c.default.PROOFERS_NEEDED;return e},e.prototype.getVideoProcessingProgress=function(){var e=0,t=String(this.fileMessage);if(t){var r=/^Thumb-\w+\-([-+]?[0-9]*\.?[0-9]*)/g.exec(t),n=/^Video-\w+\-([-+]?[0-9]*\.?[0-9]*)/g.exec(t);t.startsWith("Video-Scheduled-")?e=0:n?e=(0,v.default)(parseFloat(n[1])/100,0,.2):r&&(e=(0,v.default)(parseFloat(r[1])/100,.8,0))}return e},e.prototype.hasWorkflowStarted=function(){return this.hasWorkflow()&&this.status!==f.default.NEW},e.prototype.isProcessing=function(){return this.fileStatus===y.default.UPLOADING||this.fileStatus===y.default.QUEUED||this.fileStatus===y.default.RIPPING},e.prototype.isAwaitingFile=function(){return this.source&&this.fileStatus===y.default.CREATED},e.prototype.getProcessingProgress=function(){switch(this.fileStatus){case y.default.UPLOADING:return.1;case y.default.QUEUED:return.2;case y.default.RIPPING:return"video"===this.fileCategory?(0,v.default)(this.getVideoProcessingProgress(),.2,.1).toFixed(2):.6;default:return-1}},e.prototype.hasWorkflow=function(){return(0,m.isWorkflowId)(this.workflowId)},e.prototype.hasFile=function(){return(0,m.isFileId)(this.fileId)},e.prototype.hasFileError=function(){return this.fileStatus===y.default.ERROR||!this.fileStatus||!this.hasFile()},e.prototype.hasEditor=function(){return(0,m.isUserId)(this.editorUserId)},e.prototype.hasThumbnail=function(){return this.fileStatus===y.default.OK},e.prototype.canUserUploadNewVersion=function(e){return this.getState()===c.default.AWAITING_NEW_VERSION&&(this.isEditor(e)||this.isOwner(e))||this.getState()===c.default.AWAITING_PROOF&&(this.isEditor(e)||this.isRecipient(e))},e.prototype.isOwner=function(e){return-1!==this.ownerUserIds.indexOf(e)},e.prototype.isEditor=function(e){return-1!==this.editorUserIds.indexOf(e)},e.prototype.isRecipient=function(e){return this.recipient===e},e.prototype.calculateState=function(){this.state=this.getState()},e.prototype.fromProof=function(e){return(0,s.default)(this,A,e),this.calculateState(),this},e}();t.default=k},function(e,t,r){var n=r(1);r(8),r(2),(e.exports=n.hmac=n.hmac||{}).create=function(){var e=null,t=null,r=null,o=null,i={};return i.start=function(i,a){if(null!==i)if("string"==typeof i){if(!((i=i.toLowerCase())in n.md.algorithms))throw new Error('Unknown hash algorithm "'+i+'"');t=n.md.algorithms[i].create()}else t=i;if(null===a)a=e;else{if("string"==typeof a)a=n.util.createBuffer(a);else if(n.util.isArray(a)){var s=a;a=n.util.createBuffer();for(var u=0;u<s.length;++u)a.putByte(s[u])}var c=a.length();c>t.blockLength&&(t.start(),t.update(a.bytes()),a=t.digest()),r=n.util.createBuffer(),o=n.util.createBuffer(),c=a.length();for(var u=0;u<c;++u){var s=a.at(u);r.putByte(54^s),o.putByte(92^s)}if(c<t.blockLength)for(var s=t.blockLength-c,u=0;u<s;++u)r.putByte(54),o.putByte(92);e=a,r=r.bytes(),o=o.bytes()}t.start(),t.update(r)},i.update=function(e){t.update(e)},i.getMac=function(){var e=t.digest().bytes();return t.start(),t.update(o),t.update(e),t.digest()},i.digest=i.getMac,i}},function(e,t,r){function n(){s=String.fromCharCode(128),s+=i.util.fillString(String.fromCharCode(0),64),u=!0}function o(e,t,r){for(var n,o,i,a,s,u,c,l,f=r.length();f>=64;){for(o=e.h0,i=e.h1,a=e.h2,s=e.h3,u=e.h4,l=0;l<16;++l)n=r.getInt32(),t[l]=n,c=s^i&(a^s),n=(o<<5|o>>>27)+c+u+1518500249+n,u=s,s=a,a=(i<<30|i>>>2)>>>0,i=o,o=n;for(;l<20;++l)n=t[l-3]^t[l-8]^t[l-14]^t[l-16],n=n<<1|n>>>31,t[l]=n,c=s^i&(a^s),n=(o<<5|o>>>27)+c+u+1518500249+n,u=s,s=a,a=(i<<30|i>>>2)>>>0,i=o,o=n;for(;l<32;++l)n=t[l-3]^t[l-8]^t[l-14]^t[l-16],n=n<<1|n>>>31,t[l]=n,c=i^a^s,n=(o<<5|o>>>27)+c+u+1859775393+n,u=s,s=a,a=(i<<30|i>>>2)>>>0,i=o,o=n;for(;l<40;++l)n=t[l-6]^t[l-16]^t[l-28]^t[l-32],n=n<<2|n>>>30,t[l]=n,c=i^a^s,n=(o<<5|o>>>27)+c+u+1859775393+n,u=s,s=a,a=(i<<30|i>>>2)>>>0,i=o,o=n;for(;l<60;++l)n=t[l-6]^t[l-16]^t[l-28]^t[l-32],n=n<<2|n>>>30,t[l]=n,c=i&a|s&(i^a),n=(o<<5|o>>>27)+c+u+2400959708+n,u=s,s=a,a=(i<<30|i>>>2)>>>0,i=o,o=n;for(;l<80;++l)n=t[l-6]^t[l-16]^t[l-28]^t[l-32],n=n<<2|n>>>30,t[l]=n,c=i^a^s,n=(o<<5|o>>>27)+c+u+3395469782+n,u=s,s=a,a=(i<<30|i>>>2)>>>0,i=o,o=n;e.h0=e.h0+o|0,e.h1=e.h1+i|0,e.h2=e.h2+a|0,e.h3=e.h3+s|0,e.h4=e.h4+u|0,f-=64}}var i=r(1);r(8),r(2);var a=e.exports=i.sha1=i.sha1||{};i.md.sha1=i.md.algorithms.sha1=a,a.create=function(){u||n();var e=null,t=i.util.createBuffer(),r=new Array(80),a={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8};return a.start=function(){a.messageLength=0,a.fullMessageLength=a.messageLength64=[];for(var r=a.messageLengthSize/4,n=0;n<r;++n)a.fullMessageLength.push(0);return t=i.util.createBuffer(),e={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},a},a.start(),a.update=function(n,s){"utf8"===s&&(n=i.util.encodeUtf8(n));var u=n.length;a.messageLength+=u,u=[u/4294967296>>>0,u>>>0];for(var c=a.fullMessageLength.length-1;c>=0;--c)a.fullMessageLength[c]+=u[1],u[1]=u[0]+(a.fullMessageLength[c]/4294967296>>>0),a.fullMessageLength[c]=a.fullMessageLength[c]>>>0,u[0]=u[1]/4294967296>>>0;return t.putBytes(n),o(e,r,t),(t.read>2048||0===t.length())&&t.compact(),a},a.digest=function(){var n=i.util.createBuffer();n.putBytes(t.bytes());var u=a.fullMessageLength[a.fullMessageLength.length-1]+a.messageLengthSize,c=u&a.blockLength-1;n.putBytes(s.substr(0,a.blockLength-c));for(var l,f,p=8*a.fullMessageLength[0],d=0;d<a.fullMessageLength.length-1;++d)l=8*a.fullMessageLength[d+1],f=l/4294967296>>>0,p+=f,n.putInt32(p>>>0),p=l>>>0;n.putInt32(p);var h={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4};o(h,r,n);var y=i.util.createBuffer();return y.putInt32(h.h0),y.putInt32(h.h1),y.putInt32(h.h2),y.putInt32(h.h3),y.putInt32(h.h4),y},a};var s=null,u=!1},function(e,t,r){"use strict";t.__esModule=!0;var n={ERROR_CRITICAL:3,OK:200,ERROR_INVALID:201,ERROR_NO_ACCESS:100,ERROR_NO_ACCESS_WRITE:101,ERROR_RESTRICTED:102,ERROR_SQL_ERROR:105,ERROR_OUT_SYNC:106,ERROR_STORAGE_ERROR:110,ERROR_QUEUE_ERROR:111,ERROR_SQL_DEADLOCK_ERROR:121,ERROR_BAD_REQUEST:400,ERROR_UNAUTHORISED:401,ERROR_MEDIA_PERMISSION_NO_ACCESS:402,ERROR_NOT_FOUND:1e3,ERROR_CREATE:1001,ERROR_UPDATE:1002,ERROR_DELETE:1003,ERROR_EXISTS:1004,ERROR_USER_INVALID_LOGIN:1010,ERROR_USER_INVALID_PASSWORD:1011,ERROR_USER_IS_REGISTERED:1012,ERROR_USER_INVALID_EMAIL:1013,ERROR_USER_INVALID_LOGIN_COUNT:1014,ERROR_USER_DISABLED:1015,ERROR_BAD_REQUEST_DATE:201,ERROR_THROTTLED:429,ERROR_REUSED_CREATION_TOKEN:2011,ERROR_UPGRADE_REQUIRED:3e3,ERROR_VISIBLE_WORKFLOW_USERS_EXIST:3001,ERROR_GROUP_EXISTS:3002,ERROR_GROUP_PROOFS_EXIST:3003,ERROR_FILE_UPLOAD_INVALID_FILE:4001,ERROR_FILE_UPLOAD_INVALID_FILENAME:4005,ERROR_FILE_UPLOAD_MISSING_EXTENSION:4007};t.default=n},function(e,t,r){"use strict";t.__esModule=!0,t.default=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=r(3),a=n(i),s=r(9),u=n(s),c=r(5),l={userId:"UserId",token:"Token",sharedKey:"SharedKey",privateKeyPEM$:"PrivateKey",privateKeyPEM:null,publicKeyPEM:"PublicKey",serverPublicKeyPEM:"PublicServerKey",redirectUrl:"RedirectURL"},f=function(){function e(){o(this,e)}return e.prototype.fromJSON=function(e){return(0,a.default)(this,Object.keys(l),e),this.user=(new u.default).fromJSON(e.user),this},e.prototype.fromSession=function(e){return(0,a.default)(this,l,e),this.user=(new u.default).fromUser(e),this},e.prototype.fromBrian=function(e){return this.userId=c.BRIAN_USER_ID,this.token=e.token,this.sharedKey=e.sharedKey,this.origin=e.origin,this},e}();t.default=f},function(e,t,r){function n(e,t){var r=function(){return new s.des.Algorithm(e,t)};s.cipher.registerAlgorithm(e,r)}function o(e){for(var t,r=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],n=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],o=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],i=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],a=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],s=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],u=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],c=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],l=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],f=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],p=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],d=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],h=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],y=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],m=e.length()>8?3:1,g=[],v=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=0,E=0;E<m;E++){var C=e.getInt32(),_=e.getInt32();t=252645135&(C>>>4^_),_^=t,C^=t<<4,t=65535&(_>>>-16^C),C^=t,_^=t<<-16,t=858993459&(C>>>2^_),_^=t,C^=t<<2,t=65535&(_>>>-16^C),C^=t,_^=t<<-16,t=1431655765&(C>>>1^_),_^=t,C^=t<<1,t=16711935&(_>>>8^C),C^=t,_^=t<<8,t=1431655765&(C>>>1^_),_^=t,C^=t<<1,t=C<<8|_>>>20&240,C=_<<24|_<<8&16711680|_>>>8&65280|_>>>24&240,_=t;for(var w=0;w<v.length;++w){v[w]?(C=C<<2|C>>>26,_=_<<2|_>>>26):(C=C<<1|C>>>27,_=_<<1|_>>>27),C&=-15,_&=-15;var T=r[C>>>28]|n[C>>>24&15]|o[C>>>20&15]|i[C>>>16&15]|a[C>>>12&15]|s[C>>>8&15]|u[C>>>4&15],S=c[_>>>28]|l[_>>>24&15]|f[_>>>20&15]|p[_>>>16&15]|d[_>>>12&15]|h[_>>>8&15]|y[_>>>4&15];t=65535&(S>>>16^T),g[b++]=T^t,g[b++]=S^t<<16}}return g}function i(e,t,r,n){var o,i=32===e.length?3:9;o=3===i?n?[30,-2,-2]:[0,32,2]:n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var a,s=t[0],m=t[1];a=252645135&(s>>>4^m),m^=a,s^=a<<4,a=65535&(s>>>16^m),m^=a,s^=a<<16,a=858993459&(m>>>2^s),s^=a,m^=a<<2,a=16711935&(m>>>8^s),s^=a,m^=a<<8,a=1431655765&(s>>>1^m),m^=a,s^=a<<1,s=s<<1|s>>>31,m=m<<1|m>>>31;for(var g=0;g<i;g+=3){for(var v=o[g+1],b=o[g+2],E=o[g];E!=v;E+=b){var C=m^e[E],_=(m>>>4|m<<28)^e[E+1];a=s,s=m,m=a^(c[C>>>24&63]|f[C>>>16&63]|d[C>>>8&63]|y[63&C]|u[_>>>24&63]|l[_>>>16&63]|p[_>>>8&63]|h[63&_])}a=s,s=m,m=a}s=s>>>1|s<<31,m=m>>>1|m<<31,a=1431655765&(s>>>1^m),m^=a,s^=a<<1,a=16711935&(m>>>8^s),s^=a,m^=a<<8,a=858993459&(m>>>2^s),s^=a,m^=a<<2,a=65535&(s>>>16^m),m^=a,s^=a<<16,a=252645135&(s>>>4^m),m^=a,s^=a<<4,r[0]=s,r[1]=m}function a(e){e=e||{};var t,r=(e.mode||"CBC").toUpperCase(),n="DES-"+r;t=e.decrypt?s.cipher.createDecipher(n,e.key):s.cipher.createCipher(n,e.key);var o=t.start;return t.start=function(e,r){var n=null;r instanceof s.util.ByteBuffer&&(n=r,r={}),r=r||{},r.output=n,r.iv=e,o.call(t,r)},t}var s=r(1);r(28),r(44),r(2),e.exports=s.des=s.des||{},s.des.startEncrypting=function(e,t,r,n){var o=a({key:e,output:r,decrypt:!1,mode:n||(null===t?"ECB":"CBC")});return o.start(t),o},s.des.createEncryptionCipher=function(e,t){return a({key:e,output:null,decrypt:!1,mode:t})},s.des.startDecrypting=function(e,t,r,n){var o=a({key:e,output:r,decrypt:!0,mode:n||(null===t?"ECB":"CBC")});return o.start(t),o},s.des.createDecryptionCipher=function(e,t){return a({key:e,output:null,decrypt:!0,mode:t})},s.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return i(r._keys,e,t,!1)},decrypt:function(e,t){return i(r._keys,e,t,!0)}}}),r._init=!1},s.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=s.util.createBuffer(e.key);if(0===this.name.indexOf("3DES")&&24!==t.length())throw new Error("Invalid Triple-DES key size: "+8*t.length());this._keys=o(t),this._init=!0}},n("DES-ECB",s.cipher.modes.ecb),n("DES-CBC",s.cipher.modes.cbc),n("DES-CFB",s.cipher.modes.cfb),n("DES-OFB",s.cipher.modes.ofb),n("DES-CTR",s.cipher.modes.ctr),n("3DES-ECB",s.cipher.modes.ecb),n("3DES-CBC",s.cipher.modes.cbc),n("3DES-CFB",s.cipher.modes.cfb),n("3DES-OFB",s.cipher.modes.ofb),n("3DES-CTR",s.cipher.modes.ctr);var u=[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],c=[-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],l=[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],f=[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],p=[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],d=[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],h=[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],y=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696]},function(e,t,r){function n(e,t,r){var n=f.util.createBuffer(),o=Math.ceil(t.n.bitLength()/8);if(e.length>o-11){var i=new Error("Message is too long for PKCS#1 v1.5 padding.");throw i.length=e.length,i.max=o-11,i}n.putByte(0),n.putByte(r);var a,s=o-3-e.length;if(0===r||1===r){a=0===r?0:255;for(var u=0;u<s;++u)n.putByte(a)}else for(;s>0;){for(var c=0,l=f.random.getBytes(s),u=0;u<s;++u)a=l.charCodeAt(u),0===a?++c:n.putByte(a);s=c}return n.putByte(0),n.putBytes(e),n}function o(e,t,r,n){var o=Math.ceil(t.n.bitLength()/8),i=f.util.createBuffer(e),a=i.getByte(),s=i.getByte();if(0!==a||r&&0!==s&&1!==s||!r&&2!=s||r&&0===s&&void 0===n)throw new Error("Encryption block is invalid.");var u=0;if(0===s){u=o-3-n;for(var c=0;c<u;++c)if(0!==i.getByte())throw new Error("Encryption block is invalid.")}else if(1===s)for(u=0;i.length()>1;){if(255!==i.getByte()){--i.read;break}++u}else if(2===s)for(u=0;i.length()>1;){if(0===i.getByte()){--i.read;break}++u}if(0!==i.getByte()||u!==o-3-i.length())throw new Error("Encryption block is invalid.");return i.getBytes()}function i(e,t,r){function n(){o(e.pBits,function(t,n){return t?r(t):(e.p=n,null!==e.q?i(t,e.q):void o(e.qBits,i))})}function o(e,t){f.prime.generateProbablePrime(e,a,t)}function i(t,a){if(t)return r(t);if(e.q=a,e.p.compareTo(e.q)<0){var s=e.p;e.p=e.q,e.q=s}if(0!==e.p.subtract(p.ONE).gcd(e.e).compareTo(p.ONE))return e.p=null,void n();if(0!==e.q.subtract(p.ONE).gcd(e.e).compareTo(p.ONE))return e.q=null,void o(e.qBits,i);if(e.p1=e.p.subtract(p.ONE),e.q1=e.q.subtract(p.ONE),e.phi=e.p1.multiply(e.q1),0!==e.phi.gcd(e.e).compareTo(p.ONE))return e.p=e.q=null,void n();if(e.n=e.p.multiply(e.q),e.n.bitLength()!==e.bits)return e.q=null,void o(e.qBits,i);var u=e.e.modInverse(e.phi);e.keys={privateKey:h.rsa.setPrivateKey(e.n,e.e,u,e.p,e.q,u.mod(e.p1),u.mod(e.q1),e.q.modInverse(e.p)),publicKey:h.rsa.setPublicKey(e.n,e.e)},r(null,e.keys)}"function"==typeof t&&(r=t,t={}),t=t||{};var a={algorithm:{name:t.algorithm||"PRIMEINC",options:{workers:t.workers||2,workLoad:t.workLoad||100,workerScript:t.workerScript}}};"prng"in t&&(a.prng=t.prng),n()}function a(e){var t=e.toString(16);t[0]>="8"&&(t="00"+t);var r=f.util.hexToBytes(t);return r.length>1&&(0===r.charCodeAt(0)&&0==(128&r.charCodeAt(1))||255===r.charCodeAt(0)&&128==(128&r.charCodeAt(1)))?r.substr(1):r}function s(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}function u(e){return"undefined"!=typeof window&&"object"==typeof window.crypto&&"object"==typeof window.crypto.subtle&&"function"==typeof window.crypto.subtle[e]}function c(e){return"undefined"!=typeof window&&"object"==typeof window.msCrypto&&"object"==typeof window.msCrypto.subtle&&"function"==typeof window.msCrypto.subtle[e]}function l(e){for(var t=f.util.hexToBytes(e.toString(16)),r=new Uint8Array(t.length),n=0;n<t.length;++n)r[n]=t.charCodeAt(n);return r}var f=r(1);if(r(7),r(31),r(11),r(52),r(53),r(6),r(2),void 0===p)var p=f.jsbn.BigInteger;var d=f.asn1;f.pki=f.pki||{},e.exports=f.pki.rsa=f.rsa=f.rsa||{};var h=f.pki,y=[6,4,2,4,2,4,6,2],m={name:"PrivateKeyInfo",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:d.Class.UNIVERSAL,type:d.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:d.Class.UNIVERSAL,type:d.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},g={name:"RSAPrivateKey",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},v={name:"RSAPublicKey",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},b=f.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:d.Class.UNIVERSAL,type:d.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:d.Class.UNIVERSAL,type:d.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},E=function(e){var t;if(!(e.algorithm in h.oids)){var r=new Error("Unknown message digest algorithm.");throw r.algorithm=e.algorithm,r}t=h.oids[e.algorithm];var n=d.oidToDer(t).getBytes(),o=d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[]),i=d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[]);i.value.push(d.create(d.Class.UNIVERSAL,d.Type.OID,!1,n)),i.value.push(d.create(d.Class.UNIVERSAL,d.Type.NULL,!1,""));var a=d.create(d.Class.UNIVERSAL,d.Type.OCTETSTRING,!1,e.digest().getBytes());return o.value.push(i),o.value.push(a),d.toDer(o).getBytes()},C=function(e,t,r){if(r)return e.modPow(t.e,t.n);if(!t.p||!t.q)return e.modPow(t.d,t.n);t.dP||(t.dP=t.d.mod(t.p.subtract(p.ONE))),t.dQ||(t.dQ=t.d.mod(t.q.subtract(p.ONE))),t.qInv||(t.qInv=t.q.modInverse(t.p));var n;do{n=new p(f.util.bytesToHex(f.random.getBytes(t.n.bitLength()/8)),16)}while(n.compareTo(t.n)>=0||!n.gcd(t.n).equals(p.ONE));e=e.multiply(n.modPow(t.e,t.n)).mod(t.n);for(var o=e.mod(t.p).modPow(t.dP,t.p),i=e.mod(t.q).modPow(t.dQ,t.q);o.compareTo(i)<0;)o=o.add(t.p);var a=o.subtract(i).multiply(t.qInv).mod(t.p).multiply(t.q).add(i);return a=a.multiply(n.modInverse(t.n)).mod(t.n)};h.rsa.encrypt=function(e,t,r){var o,i=r,a=Math.ceil(t.n.bitLength()/8);!1!==r&&!0!==r?(i=2===r,o=n(e,t,r)):(o=f.util.createBuffer(),o.putBytes(e));for(var s=new p(o.toHex(),16),u=C(s,t,i),c=u.toString(16),l=f.util.createBuffer(),d=a-Math.ceil(c.length/2);d>0;)l.putByte(0),--d;return l.putBytes(f.util.hexToBytes(c)),l.getBytes()},h.rsa.decrypt=function(e,t,r,n){var i=Math.ceil(t.n.bitLength()/8);if(e.length!==i){var a=new Error("Encrypted message length is invalid.");throw a.length=e.length,a.expected=i,a}var s=new p(f.util.createBuffer(e).toHex(),16);if(s.compareTo(t.n)>=0)throw new Error("Encrypted message is invalid.");for(var u=C(s,t,r),c=u.toString(16),l=f.util.createBuffer(),d=i-Math.ceil(c.length/2);d>0;)l.putByte(0),--d;return l.putBytes(f.util.hexToBytes(c)),!1!==n?o(l.getBytes(),t,r):l.getBytes()},h.rsa.createKeyPairGenerationState=function(e,t,r){"string"==typeof e&&(e=parseInt(e,10)),e=e||2048,r=r||{};var n,o=r.prng||f.random,i={nextBytes:function(e){for(var t=o.getBytesSync(e.length),r=0;r<e.length;++r)e[r]=t.charCodeAt(r)}},a=r.algorithm||"PRIMEINC";if("PRIMEINC"!==a)throw new Error("Invalid key generation algorithm: "+a);return n={algorithm:a,state:0,bits:e,rng:i,eInt:t||65537,e:new p(null),p:null,q:null,qBits:e>>1,pBits:e-(e>>1),pqState:0,num:null,keys:null},n.e.fromInt(n.eInt),n},h.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var r=new p(null);r.fromInt(30);for(var n,o=0,i=function(e,t){return e|t},a=+new Date,u=0;null===e.keys&&(t<=0||u<t);){if(0===e.state){var c=null===e.p?e.pBits:e.qBits,l=c-1;0===e.pqState?(e.num=new p(c,e.rng),e.num.testBit(l)||e.num.bitwiseTo(p.ONE.shiftLeft(l),i,e.num),e.num.dAddOffset(31-e.num.mod(r).byteValue(),0),o=0,++e.pqState):1===e.pqState?e.num.bitLength()>c?e.pqState=0:e.num.isProbablePrime(s(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(y[o++%8],0):2===e.pqState?e.pqState=0===e.num.subtract(p.ONE).gcd(e.e).compareTo(p.ONE)?3:0:3===e.pqState&&(e.pqState=0,null===e.p?e.p=e.num:e.q=e.num,null!==e.p&&null!==e.q&&++e.state,e.num=null)}else if(1===e.state)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(2===e.state)e.p1=e.p.subtract(p.ONE),e.q1=e.q.subtract(p.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(3===e.state)0===e.phi.gcd(e.e).compareTo(p.ONE)?++e.state:(e.p=null,e.q=null,e.state=0);else if(4===e.state)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(5===e.state){var f=e.e.modInverse(e.phi);e.keys={privateKey:h.rsa.setPrivateKey(e.n,e.e,f,e.p,e.q,f.mod(e.p1),f.mod(e.q1),e.q.modInverse(e.p)),publicKey:h.rsa.setPublicKey(e.n,e.e)}}n=+new Date,u+=n-a,a=n}return null!==e.keys},h.rsa.generateKeyPair=function(e,t,r,n){if(1===arguments.length?"object"==typeof e?(r=e,e=void 0):"function"==typeof e&&(n=e,e=void 0):2===arguments.length?"number"==typeof e?"function"==typeof t?(n=t,t=void 0):"number"!=typeof t&&(r=t,t=void 0):(r=e,n=t,e=void 0,t=void 0):3===arguments.length&&("number"==typeof t?"function"==typeof r&&(n=r,r=void 0):(n=r,r=t,t=void 0)),r=r||{},void 0===e&&(e=r.bits||2048),void 0===t&&(t=r.e||65537),!f.options.usePureJavaScript&&n&&e>=256&&e<=16384&&(65537===t||3===t)){if(u("generateKey")&&u("exportKey"))return window.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:l(t),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(e){return window.crypto.subtle.exportKey("pkcs8",e.privateKey)}).then(void 0,function(e){n(e)}).then(function(e){if(e){var t=h.privateKeyFromAsn1(d.fromDer(f.util.createBuffer(e)));n(null,{privateKey:t,publicKey:h.setRsaPublicKey(t.n,t.e)})}});if(c("generateKey")&&c("exportKey")){var o=window.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:l(t),hash:{name:"SHA-256"}},!0,["sign","verify"]);return o.oncomplete=function(e){var t=e.target.result,r=window.msCrypto.subtle.exportKey("pkcs8",t.privateKey);r.oncomplete=function(e){var t=e.target.result,r=h.privateKeyFromAsn1(d.fromDer(f.util.createBuffer(t)));n(null,{privateKey:r,publicKey:h.setRsaPublicKey(r.n,r.e)})},r.onerror=function(e){n(e)}},void(o.onerror=function(e){n(e)})}}var a=h.rsa.createKeyPairGenerationState(e,t,r);if(!n)return h.rsa.stepKeyPairGenerationState(a,0),a.keys;i(a,r,n)},h.setRsaPublicKey=h.rsa.setPublicKey=function(e,t){var r={n:e,e:t};return r.encrypt=function(e,t,o){if("string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5"),"RSAES-PKCS1-V1_5"===t)t={encode:function(e,t,r){return n(e,t,2).getBytes()}};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={encode:function(e,t){return f.pkcs1.encode_rsa_oaep(t,e,o)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(t))t={encode:function(e){return e}};else if("string"==typeof t)throw new Error('Unsupported encryption scheme: "'+t+'".');var i=t.encode(e,r,!0);return h.rsa.encrypt(i,r,!0)},r.verify=function(e,t,n){"string"==typeof n?n=n.toUpperCase():void 0===n&&(n="RSASSA-PKCS1-V1_5"),"RSASSA-PKCS1-V1_5"===n?n={verify:function(e,t){return t=o(t,r,!0),e===d.fromDer(t).value[1].value}}:"NONE"!==n&&"NULL"!==n&&null!==n||(n={verify:function(e,t){return t=o(t,r,!0),e===t}});var i=h.rsa.decrypt(t,r,!0,!1);return n.verify(e,i,r.n.bitLength())},r},h.setRsaPrivateKey=h.rsa.setPrivateKey=function(e,t,r,n,i,a,s,u){var c={n:e,e:t,d:r,p:n,q:i,dP:a,dQ:s,qInv:u};return c.decrypt=function(e,t,r){"string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5");var n=h.rsa.decrypt(e,c,!1,!1);if("RSAES-PKCS1-V1_5"===t)t={decode:o};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={decode:function(e,t){return f.pkcs1.decode_rsa_oaep(t,e,r)}};else{if(-1===["RAW","NONE","NULL",null].indexOf(t))throw new Error('Unsupported encryption scheme: "'+t+'".');t={decode:function(e){return e}}}return t.decode(n,c,!1)},c.sign=function(e,t){var r=!1;"string"==typeof t&&(t=t.toUpperCase()),void 0===t||"RSASSA-PKCS1-V1_5"===t?(t={encode:E},r=1):"NONE"!==t&&"NULL"!==t&&null!==t||(t={encode:function(){return e}},r=1);var n=t.encode(e,c.n.bitLength());return h.rsa.encrypt(n,c,r)},c},h.wrapRsaPrivateKey=function(e){return d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,d.integerToDer(0).getBytes()),d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.OID,!1,d.oidToDer(h.oids.rsaEncryption).getBytes()),d.create(d.Class.UNIVERSAL,d.Type.NULL,!1,"")]),d.create(d.Class.UNIVERSAL,d.Type.OCTETSTRING,!1,d.toDer(e).getBytes())])},h.privateKeyFromAsn1=function(e){var t={},r=[];if(d.validate(e,m,t,r)&&(e=d.fromDer(f.util.createBuffer(t.privateKey))),t={},r=[],!d.validate(e,g,t,r)){var n=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw n.errors=r,n}var o,i,a,s,u,c,l,y;return o=f.util.createBuffer(t.privateKeyModulus).toHex(),i=f.util.createBuffer(t.privateKeyPublicExponent).toHex(),a=f.util.createBuffer(t.privateKeyPrivateExponent).toHex(),s=f.util.createBuffer(t.privateKeyPrime1).toHex(),u=f.util.createBuffer(t.privateKeyPrime2).toHex(),c=f.util.createBuffer(t.privateKeyExponent1).toHex(),l=f.util.createBuffer(t.privateKeyExponent2).toHex(),y=f.util.createBuffer(t.privateKeyCoefficient).toHex(),h.setRsaPrivateKey(new p(o,16),new p(i,16),new p(a,16),new p(s,16),new p(u,16),new p(c,16),new p(l,16),new p(y,16))},h.privateKeyToAsn1=h.privateKeyToRSAPrivateKey=function(e){return d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,d.integerToDer(0).getBytes()),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,a(e.n)),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,a(e.e)),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,a(e.d)),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,a(e.p)),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,a(e.q)),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,a(e.dP)),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,a(e.dQ)),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,a(e.qInv))])},h.publicKeyFromAsn1=function(e){var t={},r=[];if(d.validate(e,b,t,r)){var n=d.derToOid(t.publicKeyOid);if(n!==h.oids.rsaEncryption){var o=new Error("Cannot read public key. Unknown OID.");throw o.oid=n,o}e=t.rsaPublicKey}if(r=[],!d.validate(e,v,t,r)){var o=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw o.errors=r,o}var i=f.util.createBuffer(t.publicKeyModulus).toHex(),a=f.util.createBuffer(t.publicKeyExponent).toHex();return h.setRsaPublicKey(new p(i,16),new p(a,16))},h.publicKeyToAsn1=h.publicKeyToSubjectPublicKeyInfo=function(e){return d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.OID,!1,d.oidToDer(h.oids.rsaEncryption).getBytes()),d.create(d.Class.UNIVERSAL,d.Type.NULL,!1,"")]),d.create(d.Class.UNIVERSAL,d.Type.BITSTRING,!1,[h.publicKeyToRSAPublicKey(e)])])},h.publicKeyToRSAPublicKey=function(e){return d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,a(e.n)),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,a(e.e))])}},function(e,t,r){"use strict";t.__esModule=!0;var n={NEW:0,PROOFING:10,FINAL_APPROVING:30,TODOS_REQUESTED:50,AWAITING_NEW_VERSION:60,HAS_NEW_VERSION:66,APPROVED:70,ARCHIVED:100};t.default=n},function(e,t,r){"use strict";t.__esModule=!0;var n={CREATED:"Created",OK:"OK",UPLOADING:"Uploading",QUEUED:"Queued",RIPPING:"Ripping",ERROR:"Error"};t.default=n},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=r(3),a=n(i),s=r(13),u=n(s),c={canAddProofs:"CanAddProofs",id:"GroupId",name:"Name",description:"Description",isEmpty:"IsEmpty",isArchived:"Archived",teamId:"TeamId",createdBy:"CreatedBy",isOwnedByTeam:"OwnedByTeam",folder:function(e){return null!==e.FolderName?{name:e.FolderName}:null},proofs:(0,i.each)("ProofInfo",function(e){return(new u.default).fromProof(e)})},l=function(){function e(){o(this,e)}return e.prototype.isUserAdminOfGroupTeam=function(e){return e.isAdmin&&this.teamId===e.teamId},e.prototype.fromProofGroup=function(e){return(0,a.default)(this,c,e),this},e}();t.default=l},function(e,t,r){"use strict";t.__esModule=!0;var n="undefined"!=typeof window?window.URL:global.URL||global.require("url").URL;t.default=n},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=r(3),a=n(i),s=r(38),u=n(s),c=r(69),l=n(c),f={id:"StepId",name:"Title",position:(0,i.number)("Position"),dueDate:(0,i.date)("DueDate"),visibleDate:(0,i.date)("VisibleDate"),completeDate:(0,i.date)("CompleteDate"),mandatoryDecisionThreshold:"MandatoryDecisionThreshold",state:function(e){return e.Complete?l.default.COMPLETE:e.Visible?l.default.VISIBLE:l.default.NOT_VISIBLE},users:(0,i.each)("Users",function(e,t){var r=(new u.default).fromWorkflowUser(e);return r._calculateState(e,t),r})},p=function(){function e(){o(this,e)}return e.prototype.fromWorkflowStep=function(e){return(0,a.default)(this,f,e),this},e}();t.default=p},function(e,t,r){"use strict";t.__esModule=!0;var n=r(93),o=function(e){return e&&e.__esModule?e:{default:e}}(n);t.default=function(e){return"[object Object]"===(0,o.default)(e)}},function(e,t,r){"use strict";t.__esModule=!0;var n=void 0;n="616.0.1758772063779",t.default=n},function(e,t,r){var n=r(1);r(2),e.exports=n.cipher=n.cipher||{},n.cipher.algorithms=n.cipher.algorithms||{},n.cipher.createCipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!1})},n.cipher.createDecipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!0})},n.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),n.cipher.algorithms[e]=t},n.cipher.getAlgorithm=function(e){return e=e.toUpperCase(),e in n.cipher.algorithms?n.cipher.algorithms[e]:null};var o=n.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};o.prototype.start=function(e){e=e||{};var t={};for(var r in e)t[r]=e[r];t.decrypt=this._decrypt,this._finish=!1,this._input=n.util.createBuffer(),this.output=e.output||n.util.createBuffer(),this.mode.start(t)},o.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},o.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t))&&(this._finish=!0,this.update(),!(this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))&&!(this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))}},function(e,t,r){function n(){s=String.fromCharCode(128),s+=i.util.fillString(String.fromCharCode(0),64),u=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],c=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],l=new Array(64);for(var e=0;e<64;++e)l[e]=Math.floor(4294967296*Math.abs(Math.sin(e+1)));f=!0}function o(e,t,r){for(var n,o,i,a,s,f,p,d,h=r.length();h>=64;){for(o=e.h0,i=e.h1,a=e.h2,s=e.h3,d=0;d<16;++d)t[d]=r.getInt32Le(),f=s^i&(a^s),n=o+f+l[d]+t[d],p=c[d],o=s,s=a,a=i,i+=n<<p|n>>>32-p;for(;d<32;++d)f=a^s&(i^a),n=o+f+l[d]+t[u[d]],p=c[d],o=s,s=a,a=i,i+=n<<p|n>>>32-p;for(;d<48;++d)f=i^a^s,n=o+f+l[d]+t[u[d]],p=c[d],o=s,s=a,a=i,i+=n<<p|n>>>32-p;for(;d<64;++d)f=a^(i|~s),n=o+f+l[d]+t[u[d]],p=c[d],o=s,s=a,a=i,i+=n<<p|n>>>32-p;e.h0=e.h0+o|0,e.h1=e.h1+i|0,e.h2=e.h2+a|0,e.h3=e.h3+s|0,h-=64}}var i=r(1);r(8),r(2);var a=e.exports=i.md5=i.md5||{};i.md.md5=i.md.algorithms.md5=a,a.create=function(){f||n();var e=null,t=i.util.createBuffer(),r=new Array(16),a={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8};return a.start=function(){a.messageLength=0,a.fullMessageLength=a.messageLength64=[];for(var r=a.messageLengthSize/4,n=0;n<r;++n)a.fullMessageLength.push(0);return t=i.util.createBuffer(),e={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878},a},a.start(),a.update=function(n,s){"utf8"===s&&(n=i.util.encodeUtf8(n));var u=n.length;a.messageLength+=u,u=[u/4294967296>>>0,u>>>0];for(var c=a.fullMessageLength.length-1;c>=0;--c)a.fullMessageLength[c]+=u[1],u[1]=u[0]+(a.fullMessageLength[c]/4294967296>>>0),a.fullMessageLength[c]=a.fullMessageLength[c]>>>0,u[0]=u[1]/4294967296>>>0;return t.putBytes(n),o(e,r,t),(t.read>2048||0===t.length())&&t.compact(),a},a.digest=function(){var n=i.util.createBuffer();n.putBytes(t.bytes());var u=a.fullMessageLength[a.fullMessageLength.length-1]+a.messageLengthSize,c=u&a.blockLength-1;n.putBytes(s.substr(0,a.blockLength-c));for(var l,f=0,p=a.fullMessageLength.length-1;p>=0;--p)l=8*a.fullMessageLength[p]+f,f=l/4294967296>>>0,n.putInt32Le(l>>>0);var d={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};o(d,r,n);var h=i.util.createBuffer();return h.putInt32Le(d.h0),h.putInt32Le(d.h1),h.putInt32Le(d.h2),h.putInt32Le(d.h3),h},a};var s=null,u=null,c=null,l=null,f=!1},function(e,t,r){var n=r(1);r(14),r(8),r(2);var o,i=n.pkcs5=n.pkcs5||{};n.util.isNodejs&&!n.options.usePureJavaScript&&(o=r(48)),e.exports=n.pbkdf2=i.pbkdf2=function(e,t,r,i,a,s){function u(){if(b>p)return s(null,v);h.start(null,null),h.update(t),h.update(n.util.int32ToBytes(b)),y=g=h.digest().getBytes(),E=2,c()}function c(){if(E<=r)return h.start(null,null),h.update(g),m=h.digest().getBytes(),y=n.util.xorBytes(y,m,l),g=m,++E,n.util.setImmediate(c);v+=b<p?y:y.substr(0,d),++b,u()}if("function"==typeof a&&(s=a,a=null),n.util.isNodejs&&!n.options.usePureJavaScript&&o.pbkdf2&&(null===a||"object"!=typeof a)&&(o.pbkdf2Sync.length>4||!a||"sha1"===a))return"string"!=typeof a&&(a="sha1"),e=new Buffer(e,"binary"),t=new Buffer(t,"binary"),s?4===o.pbkdf2Sync.length?o.pbkdf2(e,t,r,i,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):o.pbkdf2(e,t,r,i,a,function(e,t){if(e)return s(e);s(null,t.toString("binary"))}):4===o.pbkdf2Sync.length?o.pbkdf2Sync(e,t,r,i).toString("binary"):o.pbkdf2Sync(e,t,r,i,a).toString("binary");if(void 0!==a&&null!==a||(a="sha1"),"string"==typeof a){if(!(a in n.md.algorithms))throw new Error("Unknown hash algorithm: "+a);a=n.md[a].create()}var l=a.digestLength;if(i>4294967295*l){var f=new Error("Derived key is too long.");if(s)return s(f);throw f}var p=Math.ceil(i/l),d=i-(p-1)*l,h=n.hmac.create();h.start(a,e);var y,m,g,v="";if(!s){for(var b=1;b<=p;++b){h.start(null,null),h.update(t),h.update(n.util.int32ToBytes(b)),y=g=h.digest().getBytes();for(var E=2;E<=r;++E)h.start(null,null),h.update(g),m=h.digest().getBytes(),y=n.util.xorBytes(y,m,l),g=m;v+=b<p?y:y.substr(0,d)}return v}var E,b=1;u()}},function(e,t,r){function n(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function o(){return new n(null)}function i(e,t,r,n,o,i){for(;--i>=0;){var a=t*this.data[e++]+r.data[n]+o;o=Math.floor(a/67108864),r.data[n++]=67108863&a}return o}function a(e,t,r,n,o,i){for(var a=32767&t,s=t>>15;--i>=0;){var u=32767&this.data[e],c=this.data[e++]>>15,l=s*u+c*a;u=a*u+((32767&l)<<15)+r.data[n]+(1073741823&o),o=(u>>>30)+(l>>>15)+s*c+(o>>>30),r.data[n++]=1073741823&u}return o}function s(e,t,r,n,o,i){for(var a=16383&t,s=t>>14;--i>=0;){var u=16383&this.data[e],c=this.data[e++]>>14,l=s*u+c*a;u=a*u+((16383&l)<<14)+r.data[n]+o,o=(u>>28)+(l>>14)+s*c,r.data[n++]=268435455&u}return o}function u(e){return it.charAt(e)}function c(e,t){var r=at[e.charCodeAt(t)];return null==r?-1:r}function l(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s}function f(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0}function p(e){var t=o();return t.fromInt(e),t}function d(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var o=e.length,i=!1,a=0;--o>=0;){var s=8==r?255&e[o]:c(e,o);s<0?"-"==e.charAt(o)&&(i=!0):(i=!1,0==a?this.data[this.t++]=s:a+r>this.DB?(this.data[this.t-1]|=(s&(1<<this.DB-a)-1)<<a,this.data[this.t++]=s>>this.DB-a):this.data[this.t-1]|=s<<a,(a+=r)>=this.DB&&(a-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,a>0&&(this.data[this.t-1]|=(1<<this.DB-a)-1<<a)),this.clamp(),i&&n.ZERO.subTo(this,this)}function h(){for(var e=this.s&this.DM;this.t>0&&this.data[this.t-1]==e;)--this.t}function y(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<<t)-1,o=!1,i="",a=this.t,s=this.DB-a*this.DB%t;if(a-- >0)for(s<this.DB&&(r=this.data[a]>>s)>0&&(o=!0,i=u(r));a>=0;)s<t?(r=(this.data[a]&(1<<s)-1)<<t-s,r|=this.data[--a]>>(s+=this.DB-t)):(r=this.data[a]>>(s-=t)&n,s<=0&&(s+=this.DB,--a)),r>0&&(o=!0),o&&(i+=u(r));return o?i:"0"}function m(){var e=o();return n.ZERO.subTo(this,e),e}function g(){return this.s<0?this.negate():this}function v(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0}function b(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function E(){return this.t<=0?0:this.DB*(this.t-1)+b(this.data[this.t-1]^this.s&this.DM)}function C(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s}function _(e,t){for(var r=e;r<this.t;++r)t.data[r-e]=this.data[r];t.t=Math.max(this.t-e,0),t.s=this.s}function w(e,t){var r,n=e%this.DB,o=this.DB-n,i=(1<<o)-1,a=Math.floor(e/this.DB),s=this.s<<n&this.DM;for(r=this.t-1;r>=0;--r)t.data[r+a+1]=this.data[r]>>o|s,s=(this.data[r]&i)<<n;for(r=a-1;r>=0;--r)t.data[r]=0;t.data[a]=s,t.t=this.t+a+1,t.s=this.s,t.clamp()}function T(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)return void(t.t=0);var n=e%this.DB,o=this.DB-n,i=(1<<n)-1;t.data[0]=this.data[r]>>n;for(var a=r+1;a<this.t;++a)t.data[a-r-1]|=(this.data[a]&i)<<o,t.data[a-r]=this.data[a]>>n;n>0&&(t.data[this.t-r-1]|=(this.s&i)<<o),t.t=this.t-r,t.clamp()}function S(e,t){for(var r=0,n=0,o=Math.min(e.t,this.t);r<o;)n+=this.data[r]-e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n-=e.s;r<this.t;)n+=this.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n-=e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t.data[r++]=this.DV+n:n>0&&(t.data[r++]=n),t.t=r,t.clamp()}function I(e,t){var r=this.abs(),o=e.abs(),i=r.t;for(t.t=i+o.t;--i>=0;)t.data[i]=0;for(i=0;i<o.t;++i)t.data[i+r.t]=r.am(0,o.data[i],t,i,0,r.t);t.s=0,t.clamp(),this.s!=e.s&&n.ZERO.subTo(t,t)}function A(e){for(var t=this.abs(),r=e.t=2*t.t;--r>=0;)e.data[r]=0;for(r=0;r<t.t-1;++r){var n=t.am(r,t.data[r],e,2*r,0,1);(e.data[r+t.t]+=t.am(r+1,2*t.data[r],e,2*r+1,n,t.t-r-1))>=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()}function k(e,t,r){var i=e.abs();if(!(i.t<=0)){var a=this.abs();if(a.t<i.t)return null!=t&&t.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=o());var s=o(),u=this.s,c=e.s,l=this.DB-b(i.data[i.t-1]);l>0?(i.lShiftTo(l,s),a.lShiftTo(l,r)):(i.copyTo(s),a.copyTo(r));var f=s.t,p=s.data[f-1];if(0!=p){var d=p*(1<<this.F1)+(f>1?s.data[f-2]>>this.F2:0),h=this.FV/d,y=(1<<this.F1)/d,m=1<<this.F2,g=r.t,v=g-f,E=null==t?o():t;for(s.dlShiftTo(v,E),r.compareTo(E)>=0&&(r.data[r.t++]=1,r.subTo(E,r)),n.ONE.dlShiftTo(f,E),E.subTo(s,s);s.t<f;)s.data[s.t++]=0;for(;--v>=0;){var C=r.data[--g]==p?this.DM:Math.floor(r.data[g]*h+(r.data[g-1]+m)*y);if((r.data[g]+=s.am(0,C,r,v,0,f))<C)for(s.dlShiftTo(v,E),r.subTo(E,r);r.data[g]<--C;)r.subTo(E,r)}null!=t&&(r.drShiftTo(f,t),u!=c&&n.ZERO.subTo(t,t)),r.t=f,r.clamp(),l>0&&r.rShiftTo(l,r),u<0&&n.ZERO.subTo(r,r)}}}function B(e){var t=o();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(n.ZERO)>0&&e.subTo(t,t),t}function R(e){this.m=e}function P(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function O(e){return e}function D(e){e.divRemTo(this.m,null,e)}function N(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function L(e,t){e.squareTo(t),this.reduce(t)}function U(){if(this.t<1)return 0;var e=this.data[0];if(0==(1&e))return 0;var t=3&e;return t=t*(2-(15&e)*t)&15,t=t*(2-(255&e)*t)&255,t=t*(2-((65535&e)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t}function x(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function M(e){var t=o();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(n.ZERO)>0&&this.m.subTo(t,t),t}function V(e){var t=o();return e.copyTo(t),this.reduce(t),t}function j(e){for(;e.t<=this.mt2;)e.data[e.t++]=0;for(var t=0;t<this.m.t;++t){var r=32767&e.data[t],n=r*this.mpl+((r*this.mph+(e.data[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e.data[r]+=this.m.am(0,n,e,t,0,this.m.t);e.data[r]>=e.DV;)e.data[r]-=e.DV,e.data[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}function F(e,t){e.squareTo(t),this.reduce(t)}function q(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function K(){return 0==(this.t>0?1&this.data[0]:this.s)}function G(e,t){if(e>4294967295||e<1)return n.ONE;var r=o(),i=o(),a=t.convert(this),s=b(e)-1;for(a.copyTo(r);--s>=0;)if(t.sqrTo(r,i),(e&1<<s)>0)t.mulTo(i,a,r);else{var u=r;r=i,i=u}return t.revert(r)}function z(e,t){var r;return r=e<256||t.isEven()?new R(t):new x(t),this.exp(e,r)}function H(){var e=o();return this.copyTo(e),e}function W(){if(this.s<0){if(1==this.t)return this.data[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this.data[0];if(0==this.t)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]}function Q(){return 0==this.t?this.s:this.data[0]<<24>>24}function X(){return 0==this.t?this.s:this.data[0]<<16>>16}function Y(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function Z(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1}function $(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),n=p(r),i=o(),a=o(),s="";for(this.divRemTo(n,i,a);i.signum()>0;)s=(r+a.intValue()).toString(e).substr(1)+s,i.divRemTo(n,i,a);return a.intValue().toString(e)+s}function J(e,t){this.fromInt(0),null==t&&(t=10);for(var r=this.chunkSize(t),o=Math.pow(t,r),i=!1,a=0,s=0,u=0;u<e.length;++u){var l=c(e,u);l<0?"-"==e.charAt(u)&&0==this.signum()&&(i=!0):(s=t*s+l,++a>=r&&(this.dMultiply(o),this.dAddOffset(s,0),a=0,s=0))}a>0&&(this.dMultiply(Math.pow(t,a)),this.dAddOffset(s,0)),i&&n.ZERO.subTo(this,this)}function ee(e,t,r){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(n.ONE.shiftLeft(e-1),ue,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(n.ONE.shiftLeft(e-1),this);else{var o=new Array,i=7&e;o.length=1+(e>>3),t.nextBytes(o),i>0?o[0]&=(1<<i)-1:o[0]=0,this.fromString(o,256)}}function te(){var e=this.t,t=new Array;t[0]=this.s;var r,n=this.DB-e*this.DB%8,o=0;if(e-- >0)for(n<this.DB&&(r=this.data[e]>>n)!=(this.s&this.DM)>>n&&(t[o++]=r|this.s<<this.DB-n);e>=0;)n<8?(r=(this.data[e]&(1<<n)-1)<<8-n,r|=this.data[--e]>>(n+=this.DB-8)):(r=this.data[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),0!=(128&r)&&(r|=-256),0==o&&(128&this.s)!=(128&r)&&++o,(o>0||r!=this.s)&&(t[o++]=r);return t}function re(e){return 0==this.compareTo(e)}function ne(e){return this.compareTo(e)<0?this:e}function oe(e){return this.compareTo(e)>0?this:e}function ie(e,t,r){var n,o,i=Math.min(e.t,this.t);for(n=0;n<i;++n)r.data[n]=t(this.data[n],e.data[n]);if(e.t<this.t){for(o=e.s&this.DM,n=i;n<this.t;++n)r.data[n]=t(this.data[n],o);r.t=this.t}else{for(o=this.s&this.DM,n=i;n<e.t;++n)r.data[n]=t(o,e.data[n]);r.t=e.t}r.s=t(this.s,e.s),r.clamp()}function ae(e,t){return e&t}function se(e){var t=o();return this.bitwiseTo(e,ae,t),t}function ue(e,t){return e|t}function ce(e){var t=o();return this.bitwiseTo(e,ue,t),t}function le(e,t){return e^t}function fe(e){var t=o();return this.bitwiseTo(e,le,t),t}function pe(e,t){return e&~t}function de(e){var t=o();return this.bitwiseTo(e,pe,t),t}function he(){for(var e=o(),t=0;t<this.t;++t)e.data[t]=this.DM&~this.data[t];return e.t=this.t,e.s=~this.s,e}function ye(e){var t=o();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t}function me(e){var t=o();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t}function ge(e){if(0==e)return-1;var t=0;return 0==(65535&e)&&(e>>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function ve(){for(var e=0;e<this.t;++e)if(0!=this.data[e])return e*this.DB+ge(this.data[e]);return this.s<0?this.t*this.DB:-1}function be(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function Ee(){for(var e=0,t=this.s&this.DM,r=0;r<this.t;++r)e+=be(this.data[r]^t);return e}function Ce(e){var t=Math.floor(e/this.DB);return t>=this.t?0!=this.s:0!=(this.data[t]&1<<e%this.DB)}function _e(e,t){var r=n.ONE.shiftLeft(e);return this.bitwiseTo(r,t,r),r}function we(e){return this.changeBit(e,ue)}function Te(e){return this.changeBit(e,pe)}function Se(e){return this.changeBit(e,le)}function Ie(e,t){for(var r=0,n=0,o=Math.min(e.t,this.t);r<o;)n+=this.data[r]+e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n+=e.s;r<this.t;)n+=this.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n+=e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=e.s}t.s=n<0?-1:0,n>0?t.data[r++]=n:n<-1&&(t.data[r++]=this.DV+n),t.t=r,t.clamp()}function Ae(e){var t=o();return this.addTo(e,t),t}function ke(e){var t=o();return this.subTo(e,t),t}function Be(e){var t=o();return this.multiplyTo(e,t),t}function Re(e){var t=o();return this.divRemTo(e,t,null),t}function Pe(e){var t=o();return this.divRemTo(e,null,t),t}function Oe(e){var t=o(),r=o();return this.divRemTo(e,t,r),new Array(t,r)}function De(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function Ne(e,t){if(0!=e){for(;this.t<=t;)this.data[this.t++]=0;for(this.data[t]+=e;this.data[t]>=this.DV;)this.data[t]-=this.DV,++t>=this.t&&(this.data[this.t++]=0),++this.data[t]}}function Le(){}function Ue(e){return e}function xe(e,t,r){e.multiplyTo(t,r)}function Me(e,t){e.squareTo(t)}function Ve(e){return this.exp(e,new Le)}function je(e,t,r){var n=Math.min(this.t+e.t,t);for(r.s=0,r.t=n;n>0;)r.data[--n]=0;var o;for(o=r.t-this.t;n<o;++n)r.data[n+this.t]=this.am(0,e.data[n],r,n,0,this.t);for(o=Math.min(e.t,t);n<o;++n)this.am(0,e.data[n],r,n,0,t-n);r.clamp()}function Fe(e,t,r){--t;var n=r.t=this.t+e.t-t;for(r.s=0;--n>=0;)r.data[n]=0;for(n=Math.max(t-this.t,0);n<e.t;++n)r.data[this.t+n-t]=this.am(t-n,e.data[n],r,0,0,this.t+n-t);r.clamp(),r.drShiftTo(1,r)}function qe(e){this.r2=o(),this.q3=o(),n.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}function Ke(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=o();return e.copyTo(t),this.reduce(t),t}function Ge(e){return e}function ze(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)}function He(e,t){e.squareTo(t),this.reduce(t)}function We(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function Qe(e,t){var r,n,i=e.bitLength(),a=p(1);if(i<=0)return a;r=i<18?1:i<48?3:i<144?4:i<768?5:6,n=i<8?new R(t):t.isEven()?new qe(t):new x(t);var s=new Array,u=3,c=r-1,l=(1<<r)-1;if(s[1]=n.convert(this),r>1){var f=o();for(n.sqrTo(s[1],f);u<=l;)s[u]=o(),n.mulTo(f,s[u-2],s[u]),u+=2}var d,h,y=e.t-1,m=!0,g=o();for(i=b(e.data[y])-1;y>=0;){for(i>=c?d=e.data[y]>>i-c&l:(d=(e.data[y]&(1<<i+1)-1)<<c-i,y>0&&(d|=e.data[y-1]>>this.DB+i-c)),u=r;0==(1&d);)d>>=1,--u;if((i-=u)<0&&(i+=this.DB,--y),m)s[d].copyTo(a),m=!1;else{for(;u>1;)n.sqrTo(a,g),n.sqrTo(g,a),u-=2;u>0?n.sqrTo(a,g):(h=a,a=g,g=h),n.mulTo(g,s[d],a)}for(;y>=0&&0==(e.data[y]&1<<i);)n.sqrTo(a,g),h=a,a=g,g=h,--i<0&&(i=this.DB-1,--y)}return n.revert(a)}function Xe(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var n=t;t=r,r=n}var o=t.getLowestSetBit(),i=r.getLowestSetBit();if(i<0)return t;for(o<i&&(i=o),i>0&&(t.rShiftTo(i,t),r.rShiftTo(i,r));t.signum()>0;)(o=t.getLowestSetBit())>0&&t.rShiftTo(o,t),(o=r.getLowestSetBit())>0&&r.rShiftTo(o,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return i>0&&r.lShiftTo(i,r),r}function Ye(e){if(e<=0)return 0;var t=this.DV%e,r=this.s<0?e-1:0;if(this.t>0)if(0==t)r=this.data[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this.data[n])%e;return r}function Ze(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return n.ZERO;for(var r=e.clone(),o=this.clone(),i=p(1),a=p(0),s=p(0),u=p(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),t?(i.isEven()&&a.isEven()||(i.addTo(this,i),a.subTo(e,a)),i.rShiftTo(1,i)):a.isEven()||a.subTo(e,a),a.rShiftTo(1,a);for(;o.isEven();)o.rShiftTo(1,o),t?(s.isEven()&&u.isEven()||(s.addTo(this,s),u.subTo(e,u)),s.rShiftTo(1,s)):u.isEven()||u.subTo(e,u),u.rShiftTo(1,u);r.compareTo(o)>=0?(r.subTo(o,r),t&&i.subTo(s,i),a.subTo(u,a)):(o.subTo(r,o),t&&s.subTo(i,s),u.subTo(a,u))}return 0!=o.compareTo(n.ONE)?n.ZERO:u.compareTo(e)>=0?u.subtract(e):u.signum()<0?(u.addTo(e,u),u.signum()<0?u.add(e):u):u}function $e(e){var t,r=this.abs();if(1==r.t&&r.data[0]<=st[st.length-1]){for(t=0;t<st.length;++t)if(r.data[0]==st[t])return!0;return!1}if(r.isEven())return!1;for(t=1;t<st.length;){for(var n=st[t],o=t+1;o<st.length&&n<ut;)n*=st[o++];for(n=r.modInt(n);t<o;)if(n%st[t++]==0)return!1}return r.millerRabin(e)}function Je(e){var t=this.subtract(n.ONE),r=t.getLowestSetBit();if(r<=0)return!1;for(var o,i=t.shiftRight(r),a=et(),s=0;s<e;++s){do{o=new n(this.bitLength(),a)}while(o.compareTo(n.ONE)<=0||o.compareTo(t)>=0);var u=o.modPow(i,this);if(0!=u.compareTo(n.ONE)&&0!=u.compareTo(t)){for(var c=1;c++<r&&0!=u.compareTo(t);)if(u=u.modPowInt(2,this),0==u.compareTo(n.ONE))return!1;if(0!=u.compareTo(t))return!1}}return!0}function et(){return{nextBytes:function(e){for(var t=0;t<e.length;++t)e[t]=Math.floor(256*Math.random())}}}var tt=r(1);e.exports=tt.jsbn=tt.jsbn||{};var rt;tt.jsbn.BigInteger=n,"undefined"==typeof navigator?(n.prototype.am=s,rt=28):"Microsoft Internet Explorer"==navigator.appName?(n.prototype.am=a,rt=30):"Netscape"!=navigator.appName?(n.prototype.am=i,rt=26):(n.prototype.am=s,rt=28),n.prototype.DB=rt,n.prototype.DM=(1<<rt)-1,n.prototype.DV=1<<rt;n.prototype.FV=Math.pow(2,52),n.prototype.F1=52-rt,n.prototype.F2=2*rt-52;var nt,ot,it="0123456789abcdefghijklmnopqrstuvwxyz",at=new Array;for(nt="0".charCodeAt(0),ot=0;ot<=9;++ot)at[nt++]=ot;for(nt="a".charCodeAt(0),ot=10;ot<36;++ot)at[nt++]=ot;for(nt="A".charCodeAt(0),ot=10;ot<36;++ot)at[nt++]=ot;R.prototype.convert=P,R.prototype.revert=O,R.prototype.reduce=D,R.prototype.mulTo=N,R.prototype.sqrTo=L,x.prototype.convert=M,x.prototype.revert=V,x.prototype.reduce=j,x.prototype.mulTo=q,x.prototype.sqrTo=F,n.prototype.copyTo=l,n.prototype.fromInt=f,n.prototype.fromString=d,n.prototype.clamp=h,n.prototype.dlShiftTo=C,n.prototype.drShiftTo=_,n.prototype.lShiftTo=w,n.prototype.rShiftTo=T,n.prototype.subTo=S,n.prototype.multiplyTo=I,n.prototype.squareTo=A,n.prototype.divRemTo=k,n.prototype.invDigit=U,n.prototype.isEven=K,n.prototype.exp=G,n.prototype.toString=y,n.prototype.negate=m,n.prototype.abs=g,n.prototype.compareTo=v,n.prototype.bitLength=E,n.prototype.mod=B,n.prototype.modPowInt=z,n.ZERO=p(0),n.ONE=p(1),Le.prototype.convert=Ue,Le.prototype.revert=Ue,Le.prototype.mulTo=xe,Le.prototype.sqrTo=Me,qe.prototype.convert=Ke,qe.prototype.revert=Ge,qe.prototype.reduce=ze,qe.prototype.mulTo=We,qe.prototype.sqrTo=He;var st=[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],ut=(1<<26)/st[st.length-1];n.prototype.chunkSize=Y,n.prototype.toRadix=$,n.prototype.fromRadix=J,n.prototype.fromNumber=ee,n.prototype.bitwiseTo=ie,n.prototype.changeBit=_e,n.prototype.addTo=Ie,n.prototype.dMultiply=De,n.prototype.dAddOffset=Ne,n.prototype.multiplyLowerTo=je,n.prototype.multiplyUpperTo=Fe,n.prototype.modInt=Ye,n.prototype.millerRabin=Je,n.prototype.clone=H,n.prototype.intValue=W,n.prototype.byteValue=Q,n.prototype.shortValue=X,n.prototype.signum=Z,n.prototype.toByteArray=te,n.prototype.equals=re,n.prototype.min=ne,n.prototype.max=oe,n.prototype.and=se,n.prototype.or=ce,n.prototype.xor=fe,n.prototype.andNot=de,n.prototype.not=he,n.prototype.shiftLeft=ye,n.prototype.shiftRight=me,n.prototype.getLowestSetBit=ve,n.prototype.bitCount=Ee,n.prototype.testBit=Ce,n.prototype.setBit=we,n.prototype.clearBit=Te,n.prototype.flipBit=Se,n.prototype.add=Ae,n.prototype.subtract=ke,n.prototype.multiply=Be,n.prototype.divide=Re,n.prototype.remainder=Pe,n.prototype.divideAndRemainder=Oe,n.prototype.modPow=Qe,n.prototype.modInverse=Ze,n.prototype.pow=Ve,n.prototype.gcd=Xe,n.prototype.isProbablePrime=$e},function(e,t,r){function n(e,t){"string"==typeof t&&(t={shortName:t});for(var r,n=null,o=0;null===n&&o<e.attributes.length;++o)r=e.attributes[o],t.type&&t.type===r.type?n=r:t.name&&t.name===r.name?n=r:t.shortName&&t.shortName===r.shortName&&(n=r);return n}function o(e){for(var t,r,n=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]),o=e.attributes,i=0;i<o.length;++i){t=o[i];var a=t.value,s=l.Type.PRINTABLESTRING;"valueTagClass"in t&&(s=t.valueTagClass)===l.Type.UTF8&&(a=c.util.encodeUtf8(a)),r=l.create(l.Class.UNIVERSAL,l.Type.SET,!0,[l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(t.type).getBytes()),l.create(l.Class.UNIVERSAL,s,!1,a)])]),n.value.push(r)}return n}function i(e){for(var t,r=0;r<e.length;++r){if(t=e[r],void 0===t.name&&(t.type&&t.type in f.oids?t.name=f.oids[t.type]:t.shortName&&t.shortName in d&&(t.name=f.oids[d[t.shortName]])),void 0===t.type){if(!(t.name&&t.name in f.oids)){var n=new Error("Attribute type not specified.");throw n.attribute=t,n}t.type=f.oids[t.name]}if(void 0===t.shortName&&t.name&&t.name in d&&(t.shortName=d[t.name]),t.type===p.extensionRequest&&(t.valueConstructed=!0,t.valueTagClass=l.Type.SEQUENCE,!t.value&&t.extensions)){t.value=[];for(var o=0;o<t.extensions.length;++o)t.value.push(f.certificateExtensionToAsn1(a(t.extensions[o])))}if(void 0===t.value){var n=new Error("Attribute value not specified.");throw n.attribute=t,n}}}function a(e,t){if(t=t||{},void 0===e.name&&e.id&&e.id in f.oids&&(e.name=f.oids[e.id]),void 0===e.id){if(!(e.name&&e.name in f.oids)){var r=new Error("Extension ID not specified.");throw r.extension=e,r}e.id=f.oids[e.name]}if(void 0!==e.value)return e;if("keyUsage"===e.name){var n=0,i=0,a=0;e.digitalSignature&&(i|=128,n=7),e.nonRepudiation&&(i|=64,n=6),e.keyEncipherment&&(i|=32,n=5),e.dataEncipherment&&(i|=16,n=4),e.keyAgreement&&(i|=8,n=3),e.keyCertSign&&(i|=4,n=2),e.cRLSign&&(i|=2,n=1),e.encipherOnly&&(i|=1,n=0),e.decipherOnly&&(a|=128,n=7);var s=String.fromCharCode(n);0!==a?s+=String.fromCharCode(i)+String.fromCharCode(a):0!==i&&(s+=String.fromCharCode(i)),e.value=l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,s)}else if("basicConstraints"===e.name)e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]),e.cA&&e.value.value.push(l.create(l.Class.UNIVERSAL,l.Type.BOOLEAN,!1,String.fromCharCode(255))),"pathLenConstraint"in e&&e.value.value.push(l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(e.pathLenConstraint).getBytes()));else if("extKeyUsage"===e.name){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);var u=e.value.value;for(var d in e)!0===e[d]&&(d in p?u.push(l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(p[d]).getBytes())):-1!==d.indexOf(".")&&u.push(l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(d).getBytes())))}else if("nsCertType"===e.name){var n=0,i=0;e.client&&(i|=128,n=7),e.server&&(i|=64,n=6),e.email&&(i|=32,n=5),e.objsign&&(i|=16,n=4),e.reserved&&(i|=8,n=3),e.sslCA&&(i|=4,n=2),e.emailCA&&(i|=2,n=1),e.objCA&&(i|=1,n=0);var s=String.fromCharCode(n);0!==i&&(s+=String.fromCharCode(i)),e.value=l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,s)}else if("subjectAltName"===e.name||"issuerAltName"===e.name){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);for(var h,y=0;y<e.altNames.length;++y){h=e.altNames[y];var s=h.value;if(7===h.type&&h.ip){if(null===(s=c.util.bytesFromIP(h.ip))){var r=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw r.extension=e,r}}else 8===h.type&&(s=h.oid?l.oidToDer(l.oidToDer(h.oid)):l.oidToDer(s));e.value.value.push(l.create(l.Class.CONTEXT_SPECIFIC,h.type,!1,s))}}else if("subjectKeyIdentifier"===e.name&&t.cert){var m=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=m.toHex(),e.value=l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,m.getBytes())}else if("authorityKeyIdentifier"===e.name&&t.cert){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);var u=e.value.value;if(e.keyIdentifier){var g=!0===e.keyIdentifier?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;u.push(l.create(l.Class.CONTEXT_SPECIFIC,0,!1,g))}if(e.authorityCertIssuer){var v=[l.create(l.Class.CONTEXT_SPECIFIC,4,!0,[o(!0===e.authorityCertIssuer?t.cert.issuer:e.authorityCertIssuer)])];u.push(l.create(l.Class.CONTEXT_SPECIFIC,1,!0,v))}if(e.serialNumber){var b=c.util.hexToBytes(!0===e.serialNumber?t.cert.serialNumber:e.serialNumber);u.push(l.create(l.Class.CONTEXT_SPECIFIC,2,!1,b))}}else if("cRLDistributionPoints"===e.name){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);for(var h,u=e.value.value,E=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]),C=l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[]),y=0;y<e.altNames.length;++y){h=e.altNames[y];var s=h.value;if(7===h.type&&h.ip){if(null===(s=c.util.bytesFromIP(h.ip))){var r=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw r.extension=e,r}}else 8===h.type&&(s=h.oid?l.oidToDer(l.oidToDer(h.oid)):l.oidToDer(s));C.value.push(l.create(l.Class.CONTEXT_SPECIFIC,h.type,!1,s))}E.value.push(l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[C])),u.push(E)}if(void 0===e.value){var r=new Error("Extension value not specified.");throw r.extension=e,r}return e}function s(e,t){switch(e){case p["RSASSA-PSS"]:var r=[];return void 0!==t.hash.algorithmOid&&r.push(l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(t.hash.algorithmOid).getBytes()),l.create(l.Class.UNIVERSAL,l.Type.NULL,!1,"")])])),void 0!==t.mgf.algorithmOid&&r.push(l.create(l.Class.CONTEXT_SPECIFIC,1,!0,[l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(t.mgf.algorithmOid).getBytes()),l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(t.mgf.hash.algorithmOid).getBytes()),l.create(l.Class.UNIVERSAL,l.Type.NULL,!1,"")])])])),void 0!==t.saltLength&&r.push(l.create(l.Class.CONTEXT_SPECIFIC,2,!0,[l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(t.saltLength).getBytes())])),l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,r);default:return l.create(l.Class.UNIVERSAL,l.Type.NULL,!1,"")}}function u(e){var t=l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[]);if(0===e.attributes.length)return t;for(var r=e.attributes,n=0;n<r.length;++n){var o=r[n],i=o.value,a=l.Type.UTF8;"valueTagClass"in o&&(a=o.valueTagClass),a===l.Type.UTF8&&(i=c.util.encodeUtf8(i));var s=!1;"valueConstructed"in o&&(s=o.valueConstructed);var u=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(o.type).getBytes()),l.create(l.Class.UNIVERSAL,l.Type.SET,!0,[l.create(l.Class.UNIVERSAL,a,s,i)])]);t.value.push(u)}return t}var c=r(1);r(10),r(7),r(19),r(8),r(99),r(11),r(12),r(33),r(20),r(2);var l=c.asn1,f=e.exports=c.pki=c.pki||{},p=f.oids,d={};d.CN=p.commonName,d.commonName="CN",d.C=p.countryName,d.countryName="C",d.L=p.localityName,d.localityName="L",d.ST=p.stateOrProvinceName,d.stateOrProvinceName="ST",d.O=p.organizationName,d.organizationName="O",d.OU=p.organizationalUnitName,d.organizationalUnitName="OU",d.E=p.emailAddress,d.emailAddress="E";var h=c.pki.rsa.publicKeyValidator,y={name:"Certificate",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:l.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:l.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:l.Class.UNIVERSAL,type:l.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:l.Class.UNIVERSAL,type:l.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:l.Class.UNIVERSAL,type:l.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:l.Class.UNIVERSAL,type:l.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},h,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:l.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:l.Class.UNIVERSAL,type:l.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:l.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:l.Class.UNIVERSAL,type:l.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:l.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:l.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:l.Class.UNIVERSAL,type:l.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},m={name:"rsapss",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:l.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:l.Class.UNIVERSAL,type:l.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:l.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:l.Class.UNIVERSAL,type:l.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:l.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:l.Class.UNIVERSAL,type:l.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:l.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:l.Class.UNIVERSAL,type:l.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},g={name:"CertificationRequestInfo",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},h,{name:"CertificationRequestInfo.attributes",tagClass:l.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:l.Class.UNIVERSAL,type:l.Type.SET,constructed:!0}]}]}]},v={name:"CertificationRequest",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[g,{name:"CertificationRequest.signatureAlgorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:l.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:l.Class.UNIVERSAL,type:l.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};f.RDNAttributesAsArray=function(e,t){for(var r,n,o,i=[],a=0;a<e.value.length;++a){r=e.value[a];for(var s=0;s<r.value.length;++s)o={},n=r.value[s],o.type=l.derToOid(n.value[0].value),o.value=n.value[1].value,o.valueTagClass=n.value[1].type,o.type in p&&(o.name=p[o.type],o.name in d&&(o.shortName=d[o.name])),t&&(t.update(o.type),t.update(o.value)),i.push(o)}return i},f.CRIAttributesAsArray=function(e){for(var t=[],r=0;r<e.length;++r)for(var n=e[r],o=l.derToOid(n.value[0].value),i=n.value[1].value,a=0;a<i.length;++a){var s={};if(s.type=o,s.value=i[a].value,s.valueTagClass=i[a].type,s.type in p&&(s.name=p[s.type],s.name in d&&(s.shortName=d[s.name])),s.type===p.extensionRequest){s.extensions=[];for(var u=0;u<s.value.length;++u)s.extensions.push(f.certificateExtensionFromAsn1(s.value[u]))}t.push(s)}return t};var b=function(e,t,r){var n={};if(e!==p["RSASSA-PSS"])return n;r&&(n={hash:{algorithmOid:p.sha1},mgf:{algorithmOid:p.mgf1,hash:{algorithmOid:p.sha1}},saltLength:20});var o={},i=[];if(!l.validate(t,m,o,i)){var a=new Error("Cannot read RSASSA-PSS parameter block.");throw a.errors=i,a}return void 0!==o.hashOid&&(n.hash=n.hash||{},n.hash.algorithmOid=l.derToOid(o.hashOid)),void 0!==o.maskGenOid&&(n.mgf=n.mgf||{},n.mgf.algorithmOid=l.derToOid(o.maskGenOid),n.mgf.hash=n.mgf.hash||{},n.mgf.hash.algorithmOid=l.derToOid(o.maskGenHashOid)),void 0!==o.saltLength&&(n.saltLength=o.saltLength.charCodeAt(0)),n};f.certificateFromPem=function(e,t,r){var n=c.pem.decode(e)[0];if("CERTIFICATE"!==n.type&&"X509 CERTIFICATE"!==n.type&&"TRUSTED CERTIFICATE"!==n.type){var o=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw o.headerType=n.type,o}if(n.procType&&"ENCRYPTED"===n.procType.type)throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var i=l.fromDer(n.body,r);return f.certificateFromAsn1(i,t)},f.certificateToPem=function(e,t){var r={type:"CERTIFICATE",body:l.toDer(f.certificateToAsn1(e)).getBytes()};return c.pem.encode(r,{maxline:t})},f.publicKeyFromPem=function(e){var t=c.pem.decode(e)[0];if("PUBLIC KEY"!==t.type&&"RSA PUBLIC KEY"!==t.type){var r=new Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');throw r.headerType=t.type,r}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert public key from PEM; PEM is encrypted.");var n=l.fromDer(t.body);return f.publicKeyFromAsn1(n)},f.publicKeyToPem=function(e,t){var r={type:"PUBLIC KEY",body:l.toDer(f.publicKeyToAsn1(e)).getBytes()};return c.pem.encode(r,{maxline:t})},f.publicKeyToRSAPublicKeyPem=function(e,t){var r={type:"RSA PUBLIC KEY",body:l.toDer(f.publicKeyToRSAPublicKey(e)).getBytes()};return c.pem.encode(r,{maxline:t})},f.getPublicKeyFingerprint=function(e,t){t=t||{};var r,n=t.md||c.md.sha1.create(),o=t.type||"RSAPublicKey";switch(o){case"RSAPublicKey":r=l.toDer(f.publicKeyToRSAPublicKey(e)).getBytes();break;case"SubjectPublicKeyInfo":r=l.toDer(f.publicKeyToAsn1(e)).getBytes();break;default:throw new Error('Unknown fingerprint type "'+t.type+'".')}n.start(),n.update(r);var i=n.digest();if("hex"===t.encoding){var a=i.toHex();return t.delimiter?a.match(/.{2}/g).join(t.delimiter):a}if("binary"===t.encoding)return i.getBytes();if(t.encoding)throw new Error('Unknown encoding "'+t.encoding+'".');return i},f.certificationRequestFromPem=function(e,t,r){var n=c.pem.decode(e)[0];if("CERTIFICATE REQUEST"!==n.type){var o=new Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".');throw o.headerType=n.type,o}if(n.procType&&"ENCRYPTED"===n.procType.type)throw new Error("Could not convert certification request from PEM; PEM is encrypted.");var i=l.fromDer(n.body,r);return f.certificationRequestFromAsn1(i,t)},f.certificationRequestToPem=function(e,t){var r={type:"CERTIFICATE REQUEST",body:l.toDer(f.certificationRequestToAsn1(e)).getBytes()};return c.pem.encode(r,{maxline:t})},f.createCertificate=function(){var e={};return e.version=2,e.serialNumber="00",e.signatureOid=null,e.signature=null,e.siginfo={},e.siginfo.algorithmOid=null,e.validity={},e.validity.notBefore=new Date,e.validity.notAfter=new Date,e.issuer={},e.issuer.getField=function(t){return n(e.issuer,t)},e.issuer.addField=function(t){i([t]),e.issuer.attributes.push(t)},e.issuer.attributes=[],e.issuer.hash=null,e.subject={},e.subject.getField=function(t){return n(e.subject,t)},e.subject.addField=function(t){i([t]),e.subject.attributes.push(t)},e.subject.attributes=[],e.subject.hash=null,e.extensions=[],e.publicKey=null,e.md=null,e.setSubject=function(t,r){i(t),e.subject.attributes=t,delete e.subject.uniqueId,r&&(e.subject.uniqueId=r),e.subject.hash=null},e.setIssuer=function(t,r){i(t),e.issuer.attributes=t,delete e.issuer.uniqueId,r&&(e.issuer.uniqueId=r),e.issuer.hash=null},e.setExtensions=function(t){for(var r=0;r<t.length;++r)a(t[r],{cert:e});e.extensions=t},e.getExtension=function(t){"string"==typeof t&&(t={name:t});for(var r,n=null,o=0;null===n&&o<e.extensions.length;++o)r=e.extensions[o],t.id&&r.id===t.id?n=r:t.name&&r.name===t.name&&(n=r);return n},e.sign=function(t,r){e.md=r||c.md.sha1.create();var n=p[e.md.algorithm+"WithRSAEncryption"];if(!n){var o=new Error("Could not compute certificate digest. Unknown message digest algorithm OID.");throw o.algorithm=e.md.algorithm,o}e.signatureOid=e.siginfo.algorithmOid=n,e.tbsCertificate=f.getTBSCertificate(e);var i=l.toDer(e.tbsCertificate);e.md.update(i.getBytes()),e.signature=t.sign(e.md)},e.verify=function(t){var r=!1;if(!e.issued(t)){var n=t.issuer,o=e.subject,i=new Error("The parent certificate did not issue the given child certificate; the child certificate's issuer does not match the parent's subject.");throw i.expectedIssuer=n.attributes,i.actualIssuer=o.attributes,i}var a=t.md;if(null===a){if(t.signatureOid in p){switch(p[t.signatureOid]){case"sha1WithRSAEncryption":a=c.md.sha1.create();break;case"md5WithRSAEncryption":a=c.md.md5.create();break;case"sha256WithRSAEncryption":a=c.md.sha256.create();break;case"sha512WithRSAEncryption":a=c.md.sha512.create();break;case"RSASSA-PSS":a=c.md.sha256.create()}}if(null===a){var i=new Error("Could not compute certificate digest. Unknown signature OID.");throw i.signatureOid=t.signatureOid,i}var s=t.tbsCertificate||f.getTBSCertificate(t),u=l.toDer(s);a.update(u.getBytes())}if(null!==a){var d;switch(t.signatureOid){case p.sha1WithRSAEncryption:d=void 0;break;case p["RSASSA-PSS"]:var h,y;if(void 0===(h=p[t.signatureParameters.mgf.hash.algorithmOid])||void 0===c.md[h]){var i=new Error("Unsupported MGF hash function.");throw i.oid=t.signatureParameters.mgf.hash.algorithmOid,i.name=h,i}if(void 0===(y=p[t.signatureParameters.mgf.algorithmOid])||void 0===c.mgf[y]){var i=new Error("Unsupported MGF function.");throw i.oid=t.signatureParameters.mgf.algorithmOid,i.name=y,i}if(y=c.mgf[y].create(c.md[h].create()),void 0===(h=p[t.signatureParameters.hash.algorithmOid])||void 0===c.md[h])throw{message:"Unsupported RSASSA-PSS hash function.",oid:t.signatureParameters.hash.algorithmOid,name:h};d=c.pss.create(c.md[h].create(),y,t.signatureParameters.saltLength)}r=e.publicKey.verify(a.digest().getBytes(),t.signature,d)}return r},e.isIssuer=function(t){var r=!1,n=e.issuer,o=t.subject;if(n.hash&&o.hash)r=n.hash===o.hash;else if(n.attributes.length===o.attributes.length){r=!0;for(var i,a,s=0;r&&s<n.attributes.length;++s)i=n.attributes[s],a=o.attributes[s],i.type===a.type&&i.value===a.value||(r=!1)}return r},e.issued=function(t){return t.isIssuer(e)},e.generateSubjectKeyIdentifier=function(){return f.getPublicKeyFingerprint(e.publicKey,{type:"RSAPublicKey"})},e.verifySubjectKeyIdentifier=function(){for(var t=p.subjectKeyIdentifier,r=0;r<e.extensions.length;++r){var n=e.extensions[r];if(n.id===t){var o=e.generateSubjectKeyIdentifier().getBytes();return c.util.hexToBytes(n.subjectKeyIdentifier)===o}}return!1},e},f.certificateFromAsn1=function(e,t){var r={},o=[];if(!l.validate(e,y,r,o)){var a=new Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.");throw a.errors=o,a}var s=l.derToOid(r.publicKeyOid);if(s!==f.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var u=f.createCertificate();u.version=r.certVersion?r.certVersion.charCodeAt(0):0;var d=c.util.createBuffer(r.certSerialNumber);u.serialNumber=d.toHex(),u.signatureOid=c.asn1.derToOid(r.certSignatureOid),u.signatureParameters=b(u.signatureOid,r.certSignatureParams,!0),u.siginfo.algorithmOid=c.asn1.derToOid(r.certinfoSignatureOid),u.siginfo.parameters=b(u.siginfo.algorithmOid,r.certinfoSignatureParams,!1),u.signature=r.certSignature;var h=[];if(void 0!==r.certValidity1UTCTime&&h.push(l.utcTimeToDate(r.certValidity1UTCTime)),void 0!==r.certValidity2GeneralizedTime&&h.push(l.generalizedTimeToDate(r.certValidity2GeneralizedTime)),void 0!==r.certValidity3UTCTime&&h.push(l.utcTimeToDate(r.certValidity3UTCTime)),void 0!==r.certValidity4GeneralizedTime&&h.push(l.generalizedTimeToDate(r.certValidity4GeneralizedTime)),h.length>2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(h.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(u.validity.notBefore=h[0],u.validity.notAfter=h[1],u.tbsCertificate=r.tbsCertificate,t){if(u.md=null,u.signatureOid in p){var s=p[u.signatureOid];switch(s){case"sha1WithRSAEncryption":u.md=c.md.sha1.create();break;case"md5WithRSAEncryption":u.md=c.md.md5.create();break;case"sha256WithRSAEncryption":u.md=c.md.sha256.create();break;case"sha512WithRSAEncryption":u.md=c.md.sha512.create();break;case"RSASSA-PSS":u.md=c.md.sha256.create()}}if(null===u.md){var a=new Error("Could not compute certificate digest. Unknown signature OID.");throw a.signatureOid=u.signatureOid,a}var m=l.toDer(u.tbsCertificate);u.md.update(m.getBytes())}var g=c.md.sha1.create();u.issuer.getField=function(e){return n(u.issuer,e)},u.issuer.addField=function(e){i([e]),u.issuer.attributes.push(e)},u.issuer.attributes=f.RDNAttributesAsArray(r.certIssuer,g),r.certIssuerUniqueId&&(u.issuer.uniqueId=r.certIssuerUniqueId),u.issuer.hash=g.digest().toHex();var v=c.md.sha1.create();return u.subject.getField=function(e){return n(u.subject,e)},u.subject.addField=function(e){i([e]),u.subject.attributes.push(e)},u.subject.attributes=f.RDNAttributesAsArray(r.certSubject,v),r.certSubjectUniqueId&&(u.subject.uniqueId=r.certSubjectUniqueId),u.subject.hash=v.digest().toHex(),r.certExtensions?u.extensions=f.certificateExtensionsFromAsn1(r.certExtensions):u.extensions=[],u.publicKey=f.publicKeyFromAsn1(r.subjectPublicKeyInfo),u},f.certificateExtensionsFromAsn1=function(e){for(var t=[],r=0;r<e.value.length;++r)for(var n=e.value[r],o=0;o<n.value.length;++o)t.push(f.certificateExtensionFromAsn1(n.value[o]));return t},f.certificateExtensionFromAsn1=function(e){var t={};if(t.id=l.derToOid(e.value[0].value),t.critical=!1,e.value[1].type===l.Type.BOOLEAN?(t.critical=0!==e.value[1].value.charCodeAt(0),t.value=e.value[2].value):t.value=e.value[1].value,t.id in p)if(t.name=p[t.id],"keyUsage"===t.name){var r=l.fromDer(t.value),n=0,o=0;r.value.length>1&&(n=r.value.charCodeAt(1),o=r.value.length>2?r.value.charCodeAt(2):0),t.digitalSignature=128==(128&n),t.nonRepudiation=64==(64&n),t.keyEncipherment=32==(32&n),t.dataEncipherment=16==(16&n),t.keyAgreement=8==(8&n),t.keyCertSign=4==(4&n),t.cRLSign=2==(2&n),t.encipherOnly=1==(1&n),t.decipherOnly=128==(128&o)}else if("basicConstraints"===t.name){var r=l.fromDer(t.value);r.value.length>0&&r.value[0].type===l.Type.BOOLEAN?t.cA=0!==r.value[0].value.charCodeAt(0):t.cA=!1;var i=null;r.value.length>0&&r.value[0].type===l.Type.INTEGER?i=r.value[0].value:r.value.length>1&&(i=r.value[1].value),null!==i&&(t.pathLenConstraint=l.derToInteger(i))}else if("extKeyUsage"===t.name)for(var r=l.fromDer(t.value),a=0;a<r.value.length;++a){var s=l.derToOid(r.value[a].value);s in p?t[p[s]]=!0:t[s]=!0}else if("nsCertType"===t.name){var r=l.fromDer(t.value),n=0;r.value.length>1&&(n=r.value.charCodeAt(1)),t.client=128==(128&n),t.server=64==(64&n),t.email=32==(32&n),t.objsign=16==(16&n),t.reserved=8==(8&n),t.sslCA=4==(4&n),t.emailCA=2==(2&n),t.objCA=1==(1&n)}else if("subjectAltName"===t.name||"issuerAltName"===t.name){t.altNames=[];for(var u,r=l.fromDer(t.value),f=0;f<r.value.length;++f){u=r.value[f];var d={type:u.type,value:u.value};switch(t.altNames.push(d),u.type){case 1:case 2:case 6:break;case 7:d.ip=c.util.bytesToIP(u.value);break;case 8:d.oid=l.derToOid(u.value)}}}else if("subjectKeyIdentifier"===t.name){var r=l.fromDer(t.value);t.subjectKeyIdentifier=c.util.bytesToHex(r.value)}return t},f.certificationRequestFromAsn1=function(e,t){var r={},o=[];if(!l.validate(e,v,r,o)){var a=new Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.");throw a.errors=o,a}var s=l.derToOid(r.publicKeyOid);if(s!==f.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var u=f.createCertificationRequest();if(u.version=r.csrVersion?r.csrVersion.charCodeAt(0):0,u.signatureOid=c.asn1.derToOid(r.csrSignatureOid),u.signatureParameters=b(u.signatureOid,r.csrSignatureParams,!0),u.siginfo.algorithmOid=c.asn1.derToOid(r.csrSignatureOid),u.siginfo.parameters=b(u.siginfo.algorithmOid,r.csrSignatureParams,!1),u.signature=r.csrSignature,u.certificationRequestInfo=r.certificationRequestInfo,t){if(u.md=null,u.signatureOid in p){var s=p[u.signatureOid];switch(s){case"sha1WithRSAEncryption":u.md=c.md.sha1.create();break;case"md5WithRSAEncryption":u.md=c.md.md5.create();break;case"sha256WithRSAEncryption":u.md=c.md.sha256.create();break;case"sha512WithRSAEncryption":u.md=c.md.sha512.create();break;case"RSASSA-PSS":u.md=c.md.sha256.create()}}if(null===u.md){var a=new Error("Could not compute certification request digest. Unknown signature OID.");throw a.signatureOid=u.signatureOid,a}var d=l.toDer(u.certificationRequestInfo);u.md.update(d.getBytes())}var h=c.md.sha1.create();return u.subject.getField=function(e){return n(u.subject,e)},u.subject.addField=function(e){i([e]),u.subject.attributes.push(e)},u.subject.attributes=f.RDNAttributesAsArray(r.certificationRequestInfoSubject,h),u.subject.hash=h.digest().toHex(),u.publicKey=f.publicKeyFromAsn1(r.subjectPublicKeyInfo),u.getAttribute=function(e){return n(u,e)},u.addAttribute=function(e){i([e]),u.attributes.push(e)},u.attributes=f.CRIAttributesAsArray(r.certificationRequestInfoAttributes||[]),u},f.createCertificationRequest=function(){var e={};return e.version=0,e.signatureOid=null,e.signature=null,e.siginfo={},e.siginfo.algorithmOid=null,e.subject={},e.subject.getField=function(t){return n(e.subject,t)},e.subject.addField=function(t){i([t]),e.subject.attributes.push(t)},e.subject.attributes=[],e.subject.hash=null,e.publicKey=null,e.attributes=[],e.getAttribute=function(t){return n(e,t)},e.addAttribute=function(t){i([t]),e.attributes.push(t)},e.md=null,e.setSubject=function(t){i(t),e.subject.attributes=t,e.subject.hash=null},e.setAttributes=function(t){i(t),e.attributes=t},e.sign=function(t,r){e.md=r||c.md.sha1.create();var n=p[e.md.algorithm+"WithRSAEncryption"];if(!n){var o=new Error("Could not compute certification request digest. Unknown message digest algorithm OID.");throw o.algorithm=e.md.algorithm,o}e.signatureOid=e.siginfo.algorithmOid=n,e.certificationRequestInfo=f.getCertificationRequestInfo(e);var i=l.toDer(e.certificationRequestInfo);e.md.update(i.getBytes()),e.signature=t.sign(e.md)},e.verify=function(){var t=!1,r=e.md;if(null===r){if(e.signatureOid in p){switch(p[e.signatureOid]){case"sha1WithRSAEncryption":r=c.md.sha1.create();break;case"md5WithRSAEncryption":r=c.md.md5.create();break;case"sha256WithRSAEncryption":r=c.md.sha256.create();break;case"sha512WithRSAEncryption":r=c.md.sha512.create();break;case"RSASSA-PSS":r=c.md.sha256.create()}}if(null===r){var n=new Error("Could not compute certification request digest. Unknown signature OID.");throw n.signatureOid=e.signatureOid,n}var o=e.certificationRequestInfo||f.getCertificationRequestInfo(e),i=l.toDer(o);r.update(i.getBytes())}if(null!==r){var a;switch(e.signatureOid){case p.sha1WithRSAEncryption:break;case p["RSASSA-PSS"]:var s,u;if(void 0===(s=p[e.signatureParameters.mgf.hash.algorithmOid])||void 0===c.md[s]){var n=new Error("Unsupported MGF hash function.");throw n.oid=e.signatureParameters.mgf.hash.algorithmOid,n.name=s,n}if(void 0===(u=p[e.signatureParameters.mgf.algorithmOid])||void 0===c.mgf[u]){var n=new Error("Unsupported MGF function.");throw n.oid=e.signatureParameters.mgf.algorithmOid,n.name=u,n}if(u=c.mgf[u].create(c.md[s].create()),void 0===(s=p[e.signatureParameters.hash.algorithmOid])||void 0===c.md[s]){var n=new Error("Unsupported RSASSA-PSS hash function.");throw n.oid=e.signatureParameters.hash.algorithmOid,n.name=s,n}a=c.pss.create(c.md[s].create(),u,e.signatureParameters.saltLength)}t=e.publicKey.verify(r.digest().getBytes(),e.signature,a)}return t},e},f.getTBSCertificate=function(e){var t=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(e.version).getBytes())]),l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,c.util.hexToBytes(e.serialNumber)),l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(e.siginfo.algorithmOid).getBytes()),s(e.siginfo.algorithmOid,e.siginfo.parameters)]),o(e.issuer),l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.UTCTIME,!1,l.dateToUtcTime(e.validity.notBefore)),l.create(l.Class.UNIVERSAL,l.Type.UTCTIME,!1,l.dateToUtcTime(e.validity.notAfter))]),o(e.subject),f.publicKeyToAsn1(e.publicKey)]);return e.issuer.uniqueId&&t.value.push(l.create(l.Class.CONTEXT_SPECIFIC,1,!0,[l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,String.fromCharCode(0)+e.issuer.uniqueId)])),e.subject.uniqueId&&t.value.push(l.create(l.Class.CONTEXT_SPECIFIC,2,!0,[l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,String.fromCharCode(0)+e.subject.uniqueId)])),e.extensions.length>0&&t.value.push(f.certificateExtensionsToAsn1(e.extensions)),t},f.getCertificationRequestInfo=function(e){return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(e.version).getBytes()),o(e.subject),f.publicKeyToAsn1(e.publicKey),u(e)])},f.distinguishedNameToAsn1=function(e){return o(e)},f.certificateToAsn1=function(e){var t=e.tbsCertificate||f.getTBSCertificate(e);return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[t,l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(e.signatureOid).getBytes()),s(e.signatureOid,e.signatureParameters)]),l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},f.certificateExtensionsToAsn1=function(e){var t=l.create(l.Class.CONTEXT_SPECIFIC,3,!0,[]),r=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);t.value.push(r);for(var n=0;n<e.length;++n)r.value.push(f.certificateExtensionToAsn1(e[n]));return t},f.certificateExtensionToAsn1=function(e){var t=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);t.value.push(l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(e.id).getBytes())),e.critical&&t.value.push(l.create(l.Class.UNIVERSAL,l.Type.BOOLEAN,!1,String.fromCharCode(255)));var r=e.value;return"string"!=typeof e.value&&(r=l.toDer(r).getBytes()),t.value.push(l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,r)),t},f.certificationRequestToAsn1=function(e){var t=e.certificationRequestInfo||f.getCertificationRequestInfo(e);return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[t,l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(e.signatureOid).getBytes()),s(e.signatureOid,e.signatureParameters)]),l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},f.createCaStore=function(e){function t(e){return r(e),n.certs[e.hash]||null}function r(e){if(!e.hash){var t=c.md.sha1.create();e.attributes=f.RDNAttributesAsArray(o(e),t),e.hash=t.digest().toHex()}}var n={certs:{}};if(n.getIssuer=function(e){return t(e.issuer)},n.addCertificate=function(e){if("string"==typeof e&&(e=c.pki.certificateFromPem(e)),r(e.subject),!n.hasCertificate(e))if(e.subject.hash in n.certs){var t=n.certs[e.subject.hash];c.util.isArray(t)||(t=[t]),t.push(e),n.certs[e.subject.hash]=t}else n.certs[e.subject.hash]=e},n.hasCertificate=function(e){"string"==typeof e&&(e=c.pki.certificateFromPem(e));var r=t(e.subject);if(!r)return!1;c.util.isArray(r)||(r=[r]);for(var n=l.toDer(f.certificateToAsn1(e)).getBytes(),o=0;o<r.length;++o){if(n===l.toDer(f.certificateToAsn1(r[o])).getBytes())return!0}return!1},n.listAllCertificates=function(){var e=[];for(var t in n.certs)if(n.certs.hasOwnProperty(t)){var r=n.certs[t];if(c.util.isArray(r))for(var o=0;o<r.length;++o)e.push(r[o]);else e.push(r)}return e},n.removeCertificate=function(e){var o;if("string"==typeof e&&(e=c.pki.certificateFromPem(e)),r(e.subject),!n.hasCertificate(e))return null;var i=t(e.subject);if(!c.util.isArray(i))return o=n.certs[e.subject.hash],delete n.certs[e.subject.hash],o;for(var a=l.toDer(f.certificateToAsn1(e)).getBytes(),s=0;s<i.length;++s){a===l.toDer(f.certificateToAsn1(i[s])).getBytes()&&(o=i[s],i.splice(s,1))}return 0===i.length&&delete n.certs[e.subject.hash],o},e)for(var i=0;i<e.length;++i){var a=e[i];n.addCertificate(a)}return n},f.certificateError={bad_certificate:"forge.pki.BadCertificate",unsupported_certificate:"forge.pki.UnsupportedCertificate",certificate_revoked:"forge.pki.CertificateRevoked",certificate_expired:"forge.pki.CertificateExpired",certificate_unknown:"forge.pki.CertificateUnknown",unknown_ca:"forge.pki.UnknownCertificateAuthority"},f.verifyCertificateChain=function(e,t,r){t=t.slice(0);var n=t.slice(0),o=new Date,i=!0,a=null,s=0;do{var u=t.shift(),l=null,p=!1;if((o<u.validity.notBefore||o>u.validity.notAfter)&&(a={message:"Certificate is not valid yet or has expired.",error:f.certificateError.certificate_expired,notBefore:u.validity.notBefore,notAfter:u.validity.notAfter,now:o}),null===a){if(l=t[0]||e.getIssuer(u),null===l&&u.isIssuer(u)&&(p=!0,l=u),l){var d=l;c.util.isArray(d)||(d=[d]);for(var h=!1;!h&&d.length>0;){l=d.shift();try{h=l.verify(u)}catch(e){}}h||(a={message:"Certificate signature is invalid.",error:f.certificateError.bad_certificate})}null!==a||l&&!p||e.hasCertificate(u)||(a={message:"Certificate is not trusted.",error:f.certificateError.unknown_ca})}if(null===a&&l&&!u.isIssuer(l)&&(a={message:"Certificate issuer is invalid.",error:f.certificateError.bad_certificate}),null===a)for(var y={keyUsage:!0,basicConstraints:!0},m=0;null===a&&m<u.extensions.length;++m){var g=u.extensions[m];!g.critical||g.name in y||(a={message:"Certificate has an unsupported critical extension.",error:f.certificateError.unsupported_certificate})}if(null===a&&(!i||0===t.length&&(!l||p))){var v=u.getExtension("basicConstraints"),b=u.getExtension("keyUsage");if(null!==b&&(b.keyCertSign&&null!==v||(a={message:"Certificate keyUsage or basicConstraints conflict or indicate that the certificate is not a CA. If the certificate is the only one in the chain or isn't the first then the certificate must be a valid CA.",error:f.certificateError.bad_certificate})),null!==a||null===v||v.cA||(a={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:f.certificateError.bad_certificate}),null===a&&null!==b&&"pathLenConstraint"in v){s-1>v.pathLenConstraint&&(a={message:"Certificate basicConstraints pathLenConstraint violated.",error:f.certificateError.bad_certificate})}}var E=null===a||a.error,C=r?r(E,s,n):E;if(!0!==C)throw!0===E&&(a={message:"The application rejected the certificate.",error:f.certificateError.bad_certificate}),(C||0===C)&&("object"!=typeof C||c.util.isArray(C)?"string"==typeof C&&(a.error=C):(C.message&&(a.message=C.message),C.error&&(a.error=C.error))),a;a=null,i=!1,++s}while(t.length>0);return!0}},function(e,t,r){var n=r(1);r(6),r(2),(e.exports=n.pss=n.pss||{}).create=function(e){3===arguments.length&&(e={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var t=e.md,r=e.mgf,o=t.digestLength,i=e.salt||null;"string"==typeof i&&(i=n.util.createBuffer(i));var a;if("saltLength"in e)a=e.saltLength;else{if(null===i)throw new Error("Salt length not specified or specific salt not given.");a=i.length()}if(null!==i&&i.length()!==a)throw new Error("Given salt length does not match length of given salt.");var s=e.prng||n.random,u={};return u.encode=function(e,u){var c,l=u-1,f=Math.ceil(l/8),p=e.digest().getBytes();if(f<o+a+2)throw new Error("Message is too long to encrypt.");var d;d=null===i?s.getBytesSync(a):i.bytes();var h=new n.util.ByteBuffer;h.fillWithByte(0,8),h.putBytes(p),h.putBytes(d),t.start(),t.update(h.getBytes());var y=t.digest().getBytes(),m=new n.util.ByteBuffer;m.fillWithByte(0,f-a-o-2),m.putByte(1),m.putBytes(d);var g=m.getBytes(),v=f-o-1,b=r.generate(y,v),E="";for(c=0;c<v;c++)E+=String.fromCharCode(g.charCodeAt(c)^b.charCodeAt(c));var C=65280>>8*f-l&255;return(E=String.fromCharCode(E.charCodeAt(0)&~C)+E.substr(1))+y+String.fromCharCode(188)},u.verify=function(e,i,s){var u,c=s-1,l=Math.ceil(c/8);if(i=i.substr(-l),l<o+a+2)throw new Error("Inconsistent parameters to PSS signature verification.");if(188!==i.charCodeAt(l-1))throw new Error("Encoded message does not end in 0xBC.");var f=l-o-1,p=i.substr(0,f),d=i.substr(f,o),h=65280>>8*l-c&255;if(0!=(p.charCodeAt(0)&h))throw new Error("Bits beyond keysize not zero as expected.");var y=r.generate(d,f),m="";for(u=0;u<f;u++)m+=String.fromCharCode(p.charCodeAt(u)^y.charCodeAt(u));m=String.fromCharCode(m.charCodeAt(0)&~h)+m.substr(1);var g=l-o-a-2;for(u=0;u<g;u++)if(0!==m.charCodeAt(u))throw new Error("Leftmost octets not zero as expected");if(1!==m.charCodeAt(g))throw new Error("Inconsistent PSS signature, 0x01 marker not found");var v=m.substr(-a),b=new n.util.ByteBuffer;return b.fillWithByte(0,8),b.putBytes(e),b.putBytes(v),t.start(),t.update(b.getBytes()),d===t.digest().getBytes()},u}},function(e,t,r){"use strict";e.exports=function e(){return e}},function(e,t,r){"use strict";function n(e){for(var t=new ArrayBuffer(e.length),r=new Uint8Array(t),n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return t}t.__esModule=!0,t.default=n},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=r(3),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a={id:"FileId",name:"Name",blocks:"Chunks",size:"Size",downloadable:"Downloadable",assignedTo:"AssignedTo",assignedType:"AssignedType",status:"Status",message:"Message",adobeExportData:function(e){var t=e.AdobeExportData;if(t&&t.length)try{return JSON.parse(t)}catch(e){}return null},sourceMetadata:function(e){var t=e.SourceMetadata;if(t&&t.length)try{return JSON.parse(t)}catch(e){}return null},importUrl:"ImportURL"},s={id:"FileId",name:"Name",blocks:"Chunks",assignedTo:"CommentId",assignedType:function(){return"attachment"},status:"Status",message:function(){return""}},u=function(){function e(){n(this,e)}return e.prototype.fromFile=function(e){return(0,i.default)(this,a,e),this},e.prototype.fromCommentAttachment=function(e){return(0,i.default)(this,s,e),this},e}();t.default=u},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=r(3),a=n(i),s=r(25),u=n(s),c={id:"WorkflowId",name:"Title",isOwnedByTeam:"OwnedByTeam",teamId:"TeamId",ownerId:"UserId",startFrom:"StartFrom",isFavorite:"IsFavorite",availableRoles:"AvailableRoles",steps:(0,i.each)("WorkflowSteps",function(e){return(new u.default).fromWorkflowStep(e)})},l=function(){function e(){o(this,e)}return e.prototype.getStepByPosition=function(e){for(var t=this.steps.length,r=0;r<t;r+=1){var n=this.steps[r];if(n.position===e)return n}return null},e.prototype.getOrderedSteps=function(){return this.steps.sort(function(e,t){return e.position<t.position?-1:e.position>t.position?1:0})},e.prototype.getApproverStep=function(){return this.getStepByPosition(1e3)},e.prototype.fromWorkflow=function(e){return(0,a.default)(this,c,e),this},e}();t.default=l},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=r(3),u=n(s),c=r(9),l=n(c),f=r(68),p=n(f),d={id:"UserId",name:"Name",email:"Email",hasAvatar:"HasAvatar",hasRegistered:"IsRegistered",role:"Role",permissions:function(e){return{inviter:e.IsInviter}},firstViewedDate:(0,s.date)("FirstViewedDate"),nudgedDate:(0,s.date)("NudgedInStep"),decisionDate:(0,s.date)("DecisionDate"),decisionId:"Decision"},h=function(e){function t(){return o(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype._calculateState=function(e,t){e.SkippedInStep?this.state=p.default.SKIPPED:e.CompleteInStep?this.state=p.default.FINISHED:e.ViewedInStep?this.state=p.default.SEEN:t.Visible?this.state=p.default.VISIBLE:this.state=p.default.NOT_VISIBLE},t.prototype.fromWorkflowUser=function(e){return this._calculateState({},{}),(0,u.default)(this,d,e),this},t}(l.default);t.default=h},function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function o(e){if(0===e.indexOf(d)){var t=e.substring(d.length,e.indexOf(h));return parseInt(t,10)}if(e.match(f))try{return JSON.parse(e)[p]}catch(e){}return 1}function i(e){var t=o(e),r=l[t];if(r)return r(e);throw new Error("Unsupported comment schema version. Please update to a newer version of the SDK.")}t.__esModule=!0,t.getVersionNumber=void 0;var a=r(171),s=n(a),u=r(40),c=n(u),l={2:c.parse,1:s.parse},f=/^\s*{/,p="_",d='{"_":',h=",";t.default=i,t.getVersionNumber=o},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(Array.isArray(e))return e.map(function(e){return o(e,t)});if((0,f.default)(e)){var r={};for(var n in e)(0,c.default)(e,n)&&t[n]&&(r[t[n]]=o(e[n],t));return r}return e}function i(e){return o(JSON.parse(e),p)}function a(e){var t=o(s({version:2},e),d);return JSON.stringify(t)}t.__esModule=!0,t.serialize=t.parse=void 0;var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u=r(17),c=n(u),l=r(26),f=n(l),p={_:"version",bs:"blocks",t:"type",v:"value",i:"index",l:"length",st:"styles",en:"entities",md:"metadata",i_:"id",lb:"label",ur:"url"},d={};for(var h in p)(0,c.default)(p,h)&&(d[p[h]]=h);t.parse=i,t.serialize=a},function(e,t,r){"use strict";t.__esModule=!0;var n={TODO:"todo",DONE:"done",UNMARKED:"unmarked"};t.default=n},function(e,t,r){"use strict";function n(e,t){return o[e]||t||"Unknown error occurred (Code: "+e+"). Please contact support."}t.__esModule=!0,t.getErrorMessage=n;var o={400:"Bad request: The request contains invalid data.",401:"Unauthorized: Please log in to access this resource.",404:"Not found: The requested resource does not exist.",406:"Authentication failed.",407:"Authentication failed.",1010:"Authentication failed.",1011:"Authentication failed.",1012:"Operation failed. Please contact support.",1013:"Invalid format.",1014:"Too many requests. Please try again later.",1015:"Access unavailable. Please contact support.",1016:"System error. Please contact support.",1017:"Authentication failed.",1018:"Invalid or expired code.",1019:"Invalid or expired code.",1020:"System error. Please contact support.",1021:"Access denied. Please contact support.",1022:"Invalid or expired code.",1023:"Invalid or expired code.",1024:"System error. Please contact support.",4001:"File upload failed: Unable to queue file for processing.",4002:"File upload failed: Queueing process failed.",4005:"File upload failed: Invalid filename. Please use only letters, numbers, and standard characters.",4006:"File upload failed: This file is already attached to another proof.",4007:"File upload failed: File is missing a file extension. Please ensure your file has a proper extension (e.g., .pdf, .jpg).",4008:"File upload failed: Unsupported file type. Please check the supported file formats.",100:"Access denied. Please contact support if you believe this is an error.",101:"Access denied. Please contact support if you believe this is an error.",102:"Resource temporarily unavailable. Please try again later.",124:"Access denied. Please contact support if you believe this is an error.",125:"Access denied. Please contact support if you believe this is an error.",126:"Access denied. Please contact support if you believe this is an error.",402:"Access denied. Please contact support if you believe this is an error.",403:"Operation not supported.",1e3:"Resource not found.",1001:"Failed to create resource.",1002:"Failed to update resource.",1003:"Failed to delete resource.",1004:"Resource already exists.",1005:"System configuration error. Please contact support.",2010:"Invalid format.",2011:"Invalid request.",3e3:"Account upgrade required. Please contact support.",6005:"Feature not available. Please contact support.",3001:"Group workflow has already been started.",3002:"A group with this name already exists.",3003:"Cannot delete group: active proofs exist.",3004:"No proofs found for this group.",5e3:"Resource already exists.",6e3:"Invalid format. Please check your input.",6001:"Verification failed. Please contact support.",6002:"Invalid format. Please check your input.",6003:"Required information missing. Please contact support.",6004:"Resource unavailable. Please try a different option.",6500:"Prerequisites not met. Please contact support.",106:"System error. Please try again later.",110:"System error. Please try again later.",120:"System error. Please try again later.",121:"System error. Please try again later.",122:"Operation failed. Please try again.",123:"Operation failed. Please try again.",7e3:"Internal server error. Please try again later."};t.default=o},function(e,t,r){e.exports=r(1),r(10),r(98),r(7),r(28),r(57),r(19),r(14),r(100),r(58),r(101),r(56),r(30),r(12),r(52),r(54),r(103),r(46),r(53),r(50),r(33),r(6),r(51),r(104),r(105),r(45),r(2)},function(e,t,r){function n(e){if("string"==typeof e&&(e=a.util.createBuffer(e)),a.util.isArray(e)&&e.length>4){var t=e;e=a.util.createBuffer();for(var r=0;r<t.length;++r)e.putByte(t[r])}return a.util.isArray(e)||(e=[e.getInt32(),e.getInt32(),e.getInt32(),e.getInt32()]),e}function o(e){e[e.length-1]=e[e.length-1]+1&4294967295}function i(e){return[e/4294967296|0,4294967295&e]}var a=r(1);r(2),a.cipher=a.cipher||{};var s=e.exports=a.cipher.modes=a.cipher.modes||{};s.ecb=function(e){e=e||{},this.name="ECB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},s.ecb.prototype.start=function(e){},s.ecb.prototype.encrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var n=0;n<this._ints;++n)t.putInt32(this._outBlock[n])},s.ecb.prototype.decrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var n=0;n<this._ints;++n)t.putInt32(this._outBlock[n])},s.ecb.prototype.pad=function(e,t){var r=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(r,r),!0},s.ecb.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},s.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},s.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._prev=this._iv.slice(0)}},s.cbc.prototype.encrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=this._prev[n]^e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var n=0;n<this._ints;++n)t.putInt32(this._outBlock[n]);this._prev=this._outBlock},s.cbc.prototype.decrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var n=0;n<this._ints;++n)t.putInt32(this._prev[n]^this._outBlock[n]);this._prev=this._inBlock.slice(0)},s.cbc.prototype.pad=function(e,t){var r=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(r,r),!0},s.cbc.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},s.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=a.util.createBuffer(),this._partialBytes=0},s.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},s.cfb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var o=0;o<this._ints;++o)this._inBlock[o]=e.getInt32()^this._outBlock[o],t.putInt32(this._inBlock[o]);else{var i=(this.blockSize-n)%this.blockSize;i>0&&(i=this.blockSize-i),this._partialOutput.clear();for(var o=0;o<this._ints;++o)this._partialBlock[o]=e.getInt32()^this._outBlock[o],this._partialOutput.putInt32(this._partialBlock[o]);if(i>0)e.read-=this.blockSize;else for(var o=0;o<this._ints;++o)this._inBlock[o]=this._partialBlock[o];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},s.cfb.prototype.decrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var o=0;o<this._ints;++o)this._inBlock[o]=e.getInt32(),t.putInt32(this._inBlock[o]^this._outBlock[o]);else{var i=(this.blockSize-n)%this.blockSize;i>0&&(i=this.blockSize-i),this._partialOutput.clear();for(var o=0;o<this._ints;++o)this._partialBlock[o]=e.getInt32(),this._partialOutput.putInt32(this._partialBlock[o]^this._outBlock[o]);if(i>0)e.read-=this.blockSize;else for(var o=0;o<this._ints;++o)this._inBlock[o]=this._partialBlock[o];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},s.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=a.util.createBuffer(),this._partialBytes=0},s.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},s.ofb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var o=0;o<this._ints;++o)t.putInt32(e.getInt32()^this._outBlock[o]),this._inBlock[o]=this._outBlock[o];else{var i=(this.blockSize-n)%this.blockSize;i>0&&(i=this.blockSize-i),this._partialOutput.clear();for(var o=0;o<this._ints;++o)this._partialOutput.putInt32(e.getInt32()^this._outBlock[o]);if(i>0)e.read-=this.blockSize;else for(var o=0;o<this._ints;++o)this._inBlock[o]=this._outBlock[o];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},s.ofb.prototype.decrypt=s.ofb.prototype.encrypt,s.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=a.util.createBuffer(),this._partialBytes=0},s.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=n(e.iv),this._inBlock=this._iv.slice(0),this._partialBytes=0},s.ctr.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i<this._ints;++i)t.putInt32(e.getInt32()^this._outBlock[i]);else{var a=(this.blockSize-n)%this.blockSize;a>0&&(a=this.blockSize-a),this._partialOutput.clear();for(var i=0;i<this._ints;++i)this._partialOutput.putInt32(e.getInt32()^this._outBlock[i]);if(a>0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}o(this._inBlock)},s.ctr.prototype.decrypt=s.ctr.prototype.encrypt,s.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=a.util.createBuffer(),this._partialBytes=0,this._R=3774873600},s.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t=a.util.createBuffer(e.iv);this._cipherLength=0;var r;if(r="additionalData"in e?a.util.createBuffer(e.additionalData):a.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=a.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var n=t.length();if(12===n)this._j0=[t.getInt32(),t.getInt32(),t.getInt32(),1];else{for(this._j0=[0,0,0,0];t.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(i(8*n)))}this._inBlock=this._j0.slice(0),o(this._inBlock),this._partialBytes=0,r=a.util.createBuffer(r),this._aDataLength=i(8*r.length());var s=r.length()%this.blockSize;for(s&&r.fillWithByte(0,this.blockSize-s),this._s=[0,0,0,0];r.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()])},s.gcm.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var i=0;i<this._ints;++i)t.putInt32(this._outBlock[i]^=e.getInt32());this._cipherLength+=this.blockSize}else{var a=(this.blockSize-n)%this.blockSize;a>0&&(a=this.blockSize-a),this._partialOutput.clear();for(var i=0;i<this._ints;++i)this._partialOutput.putInt32(e.getInt32()^this._outBlock[i]);if(0===a||r){if(r){var s=n%this.blockSize;this._cipherLength+=s,this._partialOutput.truncate(this.blockSize-s)}else this._cipherLength+=this.blockSize;for(var i=0;i<this._ints;++i)this._outBlock[i]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),a>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=a,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),o(this._inBlock)},s.gcm.prototype.decrypt=function(e,t,r){var n=e.length();if(n<this.blockSize&&!(r&&n>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),o(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i<this._ints;++i)t.putInt32(this._outBlock[i]^this._hashBlock[i]);n<this.blockSize?this._cipherLength+=n%this.blockSize:this._cipherLength+=this.blockSize},s.gcm.prototype.afterFinish=function(e,t){var r=!0;t.decrypt&&t.overflow&&e.truncate(this.blockSize-t.overflow),this.tag=a.util.createBuffer();var n=this._aDataLength.concat(i(8*this._cipherLength));this._s=this.ghash(this._hashSubkey,this._s,n);var o=[];this.cipher.encrypt(this._j0,o);for(var s=0;s<this._ints;++s)this.tag.putInt32(this._s[s]^o[s]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),t.decrypt&&this.tag.bytes()!==this._tag&&(r=!1),r},s.gcm.prototype.multiply=function(e,t){for(var r=[0,0,0,0],n=t.slice(0),o=0;o<128;++o){e[o/32|0]&1<<31-o%32&&(r[0]^=n[0],r[1]^=n[1],r[2]^=n[2],r[3]^=n[3]),this.pow(n,n)}return r},s.gcm.prototype.pow=function(e,t){for(var r=1&e[3],n=3;n>0;--n)t[n]=e[n]>>>1|(1&e[n-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},s.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var n=r/8|0,o=e[n]>>>4*(7-r%8)&15,i=this._m[r][o];t[0]^=i[0],t[1]^=i[1],t[2]^=i[2],t[3]^=i[3]}return t},s.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},s.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,n=4*r,o=16*r,i=new Array(o),a=0;a<o;++a){var s=[0,0,0,0],u=a/n|0,c=(n-1-a%n)*t;s[u]=1<<t-1<<c,i[a]=this.generateSubHashTable(this.multiply(s,e),t)}return i},s.gcm.prototype.generateSubHashTable=function(e,t){var r=1<<t,n=r>>>1,o=new Array(r);o[n]=e.slice(0);for(var i=n>>>1;i>0;)this.pow(o[2*i],o[i]=[]),i>>=1;for(i=2;i<n;){for(var a=1;a<i;++a){var s=o[i],u=o[a];o[i+a]=[s[0]^u[0],s[1]^u[1],s[2]^u[2],s[3]^u[3]]}i*=2}for(o[0]=[0,0,0,0],i=n+1;i<r;++i){var c=o[i^n];o[i]=[e[0]^c[0],e[1]^c[1],e[2]^c[2],e[3]^c[3]]}return o}},function(e,t,r){var n=r(1);r(7),r(14),r(29),r(12),r(46),r(6),r(15),r(2);var o=function(e,t,r,o){var i=n.util.createBuffer(),a=e.length>>1,s=a+(1&e.length),u=e.substr(0,s),c=e.substr(a,s),l=n.util.createBuffer(),f=n.hmac.create();r=t+r;var p=Math.ceil(o/16),d=Math.ceil(o/20);f.start("MD5",u);var h=n.util.createBuffer();l.putBytes(r);for(var y=0;y<p;++y)f.start(null,null),f.update(l.getBytes()),l.putBuffer(f.digest()),f.start(null,null),f.update(l.bytes()+r),h.putBuffer(f.digest());f.start("SHA1",c);var m=n.util.createBuffer();l.clear(),l.putBytes(r);for(var y=0;y<d;++y)f.start(null,null),f.update(l.getBytes()),l.putBuffer(f.digest()),f.start(null,null),f.update(l.bytes()+r),m.putBuffer(f.digest());return i.putBytes(n.util.xorBytes(h.getBytes(),m.getBytes(),o)),i},i=function(e,t,r){var o=n.hmac.create();o.start("SHA1",e);var i=n.util.createBuffer();return i.putInt32(t[0]),i.putInt32(t[1]),i.putByte(r.type),i.putByte(r.version.major),i.putByte(r.version.minor),i.putInt16(r.length),i.putBytes(r.fragment.bytes()),o.update(i.getBytes()),o.digest().getBytes()},a=function(e,t,r){var o=!1;try{var i=e.deflate(t.fragment.getBytes());t.fragment=n.util.createBuffer(i),t.length=i.length,o=!0}catch(e){}return o},s=function(e,t,r){var o=!1;try{var i=e.inflate(t.fragment.getBytes());t.fragment=n.util.createBuffer(i),t.length=i.length,o=!0}catch(e){}return o},u=function(e,t){var r=0;switch(t){case 1:r=e.getByte();break;case 2:r=e.getInt16();break;case 3:r=e.getInt24();break;case 4:r=e.getInt32()}return n.util.createBuffer(e.getBytes(r))},c=function(e,t,r){e.putInt(r.length(),t<<3),e.putBuffer(r)},l={};l.Versions={TLS_1_0:{major:3,minor:1},TLS_1_1:{major:3,minor:2},TLS_1_2:{major:3,minor:3}},l.SupportedVersions=[l.Versions.TLS_1_1,l.Versions.TLS_1_0],l.Version=l.SupportedVersions[0],l.MaxFragment=15360,l.ConnectionEnd={server:0,client:1},l.PRFAlgorithm={tls_prf_sha256:0},l.BulkCipherAlgorithm={none:null,rc4:0,des3:1,aes:2},l.CipherType={stream:0,block:1,aead:2},l.MACAlgorithm={none:null,hmac_md5:0,hmac_sha1:1,hmac_sha256:2,hmac_sha384:3,hmac_sha512:4},l.CompressionMethod={none:0,deflate:1},l.ContentType={change_cipher_spec:20,alert:21,handshake:22,application_data:23,heartbeat:24},l.HandshakeType={hello_request:0,client_hello:1,server_hello:2,certificate:11,server_key_exchange:12,certificate_request:13,server_hello_done:14,certificate_verify:15,client_key_exchange:16,finished:20},l.Alert={},l.Alert.Level={warning:1,fatal:2},l.Alert.Description={close_notify:0,unexpected_message:10,bad_record_mac:20,decryption_failed:21,record_overflow:22,decompression_failure:30,handshake_failure:40,bad_certificate:42,unsupported_certificate:43,certificate_revoked:44,certificate_expired:45,certificate_unknown:46,illegal_parameter:47,unknown_ca:48,access_denied:49,decode_error:50,decrypt_error:51,export_restriction:60,protocol_version:70,insufficient_security:71,internal_error:80,user_canceled:90,no_renegotiation:100},l.HeartbeatMessageType={heartbeat_request:1,heartbeat_response:2},l.CipherSuites={},l.getCipherSuite=function(e){var t=null;for(var r in l.CipherSuites){var n=l.CipherSuites[r];if(n.id[0]===e.charCodeAt(0)&&n.id[1]===e.charCodeAt(1)){t=n;break}}return t},l.handleUnexpected=function(e,t){!e.open&&e.entity===l.ConnectionEnd.client||e.error(e,{message:"Unexpected message. Received TLS record out of order.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.unexpected_message}})},l.handleHelloRequest=function(e,t,r){!e.handshaking&&e.handshakes>0&&(l.queue(e,l.createAlert(e,{level:l.Alert.Level.warning,description:l.Alert.Description.no_renegotiation})),l.flush(e)),e.process()},l.parseHelloMessage=function(e,t,r){var o=null,i=e.entity===l.ConnectionEnd.client;if(r<38)e.error(e,{message:i?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.illegal_parameter}});else{var a=t.fragment,s=a.length();if(o={version:{major:a.getByte(),minor:a.getByte()},random:n.util.createBuffer(a.getBytes(32)),session_id:u(a,1),extensions:[]},i?(o.cipher_suite=a.getBytes(2),o.compression_method=a.getByte()):(o.cipher_suites=u(a,2),o.compression_methods=u(a,1)),(s=r-(s-a.length()))>0){for(var c=u(a,2);c.length()>0;)o.extensions.push({type:[c.getByte(),c.getByte()],data:u(c,2)});if(!i)for(var f=0;f<o.extensions.length;++f){var p=o.extensions[f];if(0===p.type[0]&&0===p.type[1])for(var d=u(p.data,2);d.length()>0;){var h=d.getByte();if(0!==h)break;e.session.extensions.server_name.serverNameList.push(u(d,2).getBytes())}}}if(e.session.version&&(o.version.major!==e.session.version.major||o.version.minor!==e.session.version.minor))return e.error(e,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.protocol_version}});if(i)e.session.cipherSuite=l.getCipherSuite(o.cipher_suite);else for(var y=n.util.createBuffer(o.cipher_suites.bytes());y.length()>0&&(e.session.cipherSuite=l.getCipherSuite(y.getBytes(2)),null===e.session.cipherSuite););if(null===e.session.cipherSuite)return e.error(e,{message:"No cipher suites in common.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.handshake_failure},cipherSuite:n.util.bytesToHex(o.cipher_suite)});e.session.compressionMethod=i?o.compression_method:l.CompressionMethod.none}return o},l.createSecurityParameters=function(e,t){var r=e.entity===l.ConnectionEnd.client,n=t.random.bytes(),o=r?e.session.sp.client_random:n,i=r?n:l.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:l.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:e.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:o,server_random:i}},l.handleServerHello=function(e,t,r){var n=l.parseHelloMessage(e,t,r);if(!e.fail){if(!(n.version.minor<=e.version.minor))return e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.protocol_version}});e.version.minor=n.version.minor,e.session.version=e.version;var o=n.session_id.bytes();o.length>0&&o===e.session.id?(e.expect=y,e.session.resuming=!0,e.session.sp.server_random=n.random.bytes()):(e.expect=f,e.session.resuming=!1,l.createSecurityParameters(e,n)),e.session.id=o,e.process()}},l.handleClientHello=function(e,t,r){var o=l.parseHelloMessage(e,t,r);if(!e.fail){var i=o.session_id.bytes(),a=null;if(e.sessionCache&&(a=e.sessionCache.getSession(i),null===a?i="":(a.version.major!==o.version.major||a.version.minor>o.version.minor)&&(a=null,i="")),0===i.length&&(i=n.random.getBytes(32)),e.session.id=i,e.session.clientHelloVersion=o.version,e.session.sp={},a)e.version=e.session.version=a.version,e.session.sp=a.sp;else{for(var s,u=1;u<l.SupportedVersions.length&&(s=l.SupportedVersions[u],!(s.minor<=o.version.minor));++u);e.version={major:s.major,minor:s.minor},e.session.version=e.version}null!==a?(e.expect=_,e.session.resuming=!0,e.session.sp.client_random=o.random.bytes()):(e.expect=!1!==e.verifyClient?b:E,e.session.resuming=!1,l.createSecurityParameters(e,o)),e.open=!0,l.queue(e,l.createRecord(e,{type:l.ContentType.handshake,data:l.createServerHello(e)})),e.session.resuming?(l.queue(e,l.createRecord(e,{type:l.ContentType.change_cipher_spec,data:l.createChangeCipherSpec()})),e.state.pending=l.createConnectionState(e),e.state.current.write=e.state.pending.write,l.queue(e,l.createRecord(e,{type:l.ContentType.handshake,data:l.createFinished(e)}))):(l.queue(e,l.createRecord(e,{type:l.ContentType.handshake,data:l.createCertificate(e)})),e.fail||(l.queue(e,l.createRecord(e,{type:l.ContentType.handshake,data:l.createServerKeyExchange(e)})),!1!==e.verifyClient&&l.queue(e,l.createRecord(e,{type:l.ContentType.handshake,data:l.createCertificateRequest(e)})),l.queue(e,l.createRecord(e,{type:l.ContentType.handshake,data:l.createServerHelloDone(e)})))),l.flush(e),e.process()}},l.handleCertificate=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.illegal_parameter}});var o,i,a=t.fragment,s={certificate_list:u(a,3)},c=[];try{for(;s.certificate_list.length()>0;)o=u(s.certificate_list,3),i=n.asn1.fromDer(o),o=n.pki.certificateFromAsn1(i,!0),c.push(o)}catch(t){return e.error(e,{message:"Could not parse certificate list.",cause:t,send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.bad_certificate}})}var f=e.entity===l.ConnectionEnd.client;!f&&!0!==e.verifyClient||0!==c.length?0===c.length?e.expect=f?p:E:(f?e.session.serverCertificate=c[0]:e.session.clientCertificate=c[0],l.verifyCertificateChain(e,c)&&(e.expect=f?p:E)):e.error(e,{message:f?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.illegal_parameter}}),e.process()},l.handleServerKeyExchange=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.unsupported_certificate}});e.expect=d,e.process()},l.handleClientKeyExchange=function(e,t,r){if(r<48)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.unsupported_certificate}});var o=t.fragment,i={enc_pre_master_secret:u(o,2).getBytes()},a=null;if(e.getPrivateKey)try{a=e.getPrivateKey(e,e.session.serverCertificate),a=n.pki.privateKeyFromPem(a)}catch(t){e.error(e,{message:"Could not get private key.",cause:t,send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.internal_error}})}if(null===a)return e.error(e,{message:"No private key set.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.internal_error}});try{var s=e.session.sp;s.pre_master_secret=a.decrypt(i.enc_pre_master_secret);var c=e.session.clientHelloVersion;if(c.major!==s.pre_master_secret.charCodeAt(0)||c.minor!==s.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch(e){s.pre_master_secret=n.random.getBytes(48)}e.expect=_,null!==e.session.clientCertificate&&(e.expect=C),e.process()},l.handleCertificateRequest=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.illegal_parameter}});var n=t.fragment,o={certificate_types:u(n,1),certificate_authorities:u(n,2)};e.session.certificateRequest=o,e.expect=h,e.process()},l.handleCertificateVerify=function(e,t,r){if(r<2)return e.error(e,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.illegal_parameter}});var o=t.fragment;o.read-=4;var i=o.bytes();o.read+=4;var a={signature:u(o,2).getBytes()},s=n.util.createBuffer();s.putBuffer(e.session.md5.digest()),s.putBuffer(e.session.sha1.digest()),s=s.getBytes();try{if(!e.session.clientCertificate.publicKey.verify(s,a.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");e.session.md5.update(i),e.session.sha1.update(i)}catch(t){return e.error(e,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.handshake_failure}})}e.expect=_,e.process()},l.handleServerHelloDone=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.record_overflow}});if(null===e.serverCertificate){var o={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.insufficient_security}},i=e.verify(e,o.alert.description,0,[]);if(!0!==i)return(i||0===i)&&("object"!=typeof i||n.util.isArray(i)?"number"==typeof i&&(o.alert.description=i):(i.message&&(o.message=i.message),i.alert&&(o.alert.description=i.alert))),e.error(e,o)}null!==e.session.certificateRequest&&(t=l.createRecord(e,{type:l.ContentType.handshake,data:l.createCertificate(e)}),l.queue(e,t)),t=l.createRecord(e,{type:l.ContentType.handshake,data:l.createClientKeyExchange(e)}),l.queue(e,t),e.expect=v;var a=function(e,t){null!==e.session.certificateRequest&&null!==e.session.clientCertificate&&l.queue(e,l.createRecord(e,{type:l.ContentType.handshake,data:l.createCertificateVerify(e,t)})),l.queue(e,l.createRecord(e,{type:l.ContentType.change_cipher_spec,data:l.createChangeCipherSpec()})),e.state.pending=l.createConnectionState(e),e.state.current.write=e.state.pending.write,l.queue(e,l.createRecord(e,{type:l.ContentType.handshake,data:l.createFinished(e)})),e.expect=y,l.flush(e),e.process()};if(null===e.session.certificateRequest||null===e.session.clientCertificate)return a(e,null);l.getClientSignature(e,a)},l.handleChangeCipherSpec=function(e,t){if(1!==t.fragment.getByte())return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.illegal_parameter}});var r=e.entity===l.ConnectionEnd.client;(e.session.resuming&&r||!e.session.resuming&&!r)&&(e.state.pending=l.createConnectionState(e)),e.state.current.read=e.state.pending.read,(!e.session.resuming&&r||e.session.resuming&&!r)&&(e.state.pending=null),e.expect=r?m:w,e.process()},l.handleFinished=function(e,t,r){var i=t.fragment;i.read-=4;var a=i.bytes();i.read+=4;var s=t.fragment.getBytes();i=n.util.createBuffer(),i.putBuffer(e.session.md5.digest()),i.putBuffer(e.session.sha1.digest());var u=e.entity===l.ConnectionEnd.client,c=u?"server finished":"client finished",f=e.session.sp;if(i=o(f.master_secret,c,i.getBytes(),12),i.getBytes()!==s)return e.error(e,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.decrypt_error}});e.session.md5.update(a),e.session.sha1.update(a),(e.session.resuming&&u||!e.session.resuming&&!u)&&(l.queue(e,l.createRecord(e,{type:l.ContentType.change_cipher_spec,data:l.createChangeCipherSpec()})),e.state.current.write=e.state.pending.write,e.state.pending=null,l.queue(e,l.createRecord(e,{type:l.ContentType.handshake,data:l.createFinished(e)}))),e.expect=u?g:T,e.handshaking=!1,++e.handshakes,e.peerCertificate=u?e.session.serverCertificate:e.session.clientCertificate,l.flush(e),e.isConnected=!0,e.connected(e),e.process()},l.handleAlert=function(e,t){var r,n=t.fragment,o={level:n.getByte(),description:n.getByte()};switch(o.description){case l.Alert.Description.close_notify:r="Connection closed.";break;case l.Alert.Description.unexpected_message:r="Unexpected message.";break;case l.Alert.Description.bad_record_mac:r="Bad record MAC.";break;case l.Alert.Description.decryption_failed:r="Decryption failed.";break;case l.Alert.Description.record_overflow:r="Record overflow.";break;case l.Alert.Description.decompression_failure:r="Decompression failed.";break;case l.Alert.Description.handshake_failure:r="Handshake failure.";break;case l.Alert.Description.bad_certificate:r="Bad certificate.";break;case l.Alert.Description.unsupported_certificate:r="Unsupported certificate.";break;case l.Alert.Description.certificate_revoked:r="Certificate revoked.";break;case l.Alert.Description.certificate_expired:r="Certificate expired.";break;case l.Alert.Description.certificate_unknown:r="Certificate unknown.";break;case l.Alert.Description.illegal_parameter:r="Illegal parameter.";break;case l.Alert.Description.unknown_ca:r="Unknown certificate authority.";break;case l.Alert.Description.access_denied:r="Access denied.";break;case l.Alert.Description.decode_error:r="Decode error.";break;case l.Alert.Description.decrypt_error:r="Decrypt error.";break;case l.Alert.Description.export_restriction:r="Export restriction.";break;case l.Alert.Description.protocol_version:r="Unsupported protocol version.";break;case l.Alert.Description.insufficient_security:r="Insufficient security.";break;case l.Alert.Description.internal_error:r="Internal error.";break;case l.Alert.Description.user_canceled:r="User canceled.";break;case l.Alert.Description.no_renegotiation:r="Renegotiation not supported.";break;default:r="Unknown error."}if(o.description===l.Alert.Description.close_notify)return e.close();e.error(e,{message:r,send:!1,origin:e.entity===l.ConnectionEnd.client?"server":"client",alert:o}),e.process()},l.handleHandshake=function(e,t){var r=t.fragment,o=r.getByte(),i=r.getInt24();if(i>r.length())return e.fragmented=t,t.fragment=n.util.createBuffer(),r.read-=4,e.process();e.fragmented=null,r.read-=4;var a=r.bytes(i+4);r.read+=4,o in V[e.entity][e.expect]?(e.entity!==l.ConnectionEnd.server||e.open||e.fail||(e.handshaking=!0,e.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:n.md.md5.create(),sha1:n.md.sha1.create()}),o!==l.HandshakeType.hello_request&&o!==l.HandshakeType.certificate_verify&&o!==l.HandshakeType.finished&&(e.session.md5.update(a),e.session.sha1.update(a)),V[e.entity][e.expect][o](e,t,i)):l.handleUnexpected(e,t)},l.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process()},l.handleHeartbeat=function(e,t){var r=t.fragment,o=r.getByte(),i=r.getInt16(),a=r.getBytes(i);if(o===l.HeartbeatMessageType.heartbeat_request){if(e.handshaking||i>a.length)return e.process();l.queue(e,l.createRecord(e,{type:l.ContentType.heartbeat,data:l.createHeartbeat(l.HeartbeatMessageType.heartbeat_response,a)})),l.flush(e)}else if(o===l.HeartbeatMessageType.heartbeat_response){if(a!==e.expectedHeartbeatPayload)return e.process();e.heartbeatReceived&&e.heartbeatReceived(e,n.util.createBuffer(a))}e.process()};var f=1,p=2,d=3,h=4,y=5,m=6,g=7,v=8,b=1,E=2,C=3,_=4,w=5,T=6,S=l.handleUnexpected,I=l.handleChangeCipherSpec,A=l.handleAlert,k=l.handleHandshake,B=l.handleApplicationData,R=l.handleHeartbeat,P=[];P[l.ConnectionEnd.client]=[[S,A,k,S,R],[S,A,k,S,R],[S,A,k,S,R],[S,A,k,S,R],[S,A,k,S,R],[I,A,S,S,R],[S,A,k,S,R],[S,A,k,B,R],[S,A,k,S,R]],P[l.ConnectionEnd.server]=[[S,A,k,S,R],[S,A,k,S,R],[S,A,k,S,R],[S,A,k,S,R],[I,A,S,S,R],[S,A,k,S,R],[S,A,k,B,R],[S,A,k,S,R]];var O=l.handleHelloRequest,D=l.handleServerHello,N=l.handleCertificate,L=l.handleServerKeyExchange,U=l.handleCertificateRequest,x=l.handleServerHelloDone,M=l.handleFinished,V=[];V[l.ConnectionEnd.client]=[[S,S,D,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S],[O,S,S,S,S,S,S,S,S,S,S,N,L,U,x,S,S,S,S,S,S],[O,S,S,S,S,S,S,S,S,S,S,S,L,U,x,S,S,S,S,S,S],[O,S,S,S,S,S,S,S,S,S,S,S,S,U,x,S,S,S,S,S,S],[O,S,S,S,S,S,S,S,S,S,S,S,S,S,x,S,S,S,S,S,S],[O,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S],[O,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,M],[O,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S],[O,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S]];var j=l.handleClientHello,F=l.handleClientKeyExchange,q=l.handleCertificateVerify;V[l.ConnectionEnd.server]=[[S,j,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S],[S,S,S,S,S,S,S,S,S,S,S,N,S,S,S,S,S,S,S,S,S],[S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,F,S,S,S,S],[S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,q,S,S,S,S,S],[S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S],[S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,M],[S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S],[S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S]],l.generateKeys=function(e,t){var r=o,n=t.client_random+t.server_random;e.session.resuming||(t.master_secret=r(t.pre_master_secret,"master secret",n,48).bytes(),t.pre_master_secret=null),n=t.server_random+t.client_random;var i=2*t.mac_key_length+2*t.enc_key_length,a=e.version.major===l.Versions.TLS_1_0.major&&e.version.minor===l.Versions.TLS_1_0.minor;a&&(i+=2*t.fixed_iv_length);var s=r(t.master_secret,"key expansion",n,i),u={client_write_MAC_key:s.getBytes(t.mac_key_length),server_write_MAC_key:s.getBytes(t.mac_key_length),client_write_key:s.getBytes(t.enc_key_length),server_write_key:s.getBytes(t.enc_key_length)};return a&&(u.client_write_IV=s.getBytes(t.fixed_iv_length),u.server_write_IV=s.getBytes(t.fixed_iv_length)),u},l.createConnectionState=function(e){var t=e.entity===l.ConnectionEnd.client,r=function(){var e={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,cipherState:null,cipherFunction:function(e){return!0},compressionState:null,compressFunction:function(e){return!0},updateSequenceNumber:function(){4294967295===e.sequenceNumber[1]?(e.sequenceNumber[1]=0,++e.sequenceNumber[0]):++e.sequenceNumber[1]}};return e},n={read:r(),write:r()};if(n.read.update=function(e,t){return n.read.cipherFunction(t,n.read)?n.read.compressFunction(e,t,n.read)||e.error(e,{message:"Could not decompress record.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.decompression_failure}}):e.error(e,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.bad_record_mac}}),!e.fail},n.write.update=function(e,t){return n.write.compressFunction(e,t,n.write)?n.write.cipherFunction(t,n.write)||e.error(e,{message:"Could not encrypt record.",send:!1,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.internal_error}}):e.error(e,{message:"Could not compress record.",send:!1,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.internal_error}}),!e.fail},e.session){var o=e.session.sp;switch(e.session.cipherSuite.initSecurityParameters(o),o.keys=l.generateKeys(e,o),n.read.macKey=t?o.keys.server_write_MAC_key:o.keys.client_write_MAC_key,n.write.macKey=t?o.keys.client_write_MAC_key:o.keys.server_write_MAC_key,e.session.cipherSuite.initConnectionState(n,e,o),o.compression_algorithm){case l.CompressionMethod.none:break;case l.CompressionMethod.deflate:n.read.compressFunction=s,n.write.compressFunction=a;break;default:throw new Error("Unsupported compression algorithm.")}}return n},l.createRandom=function(){var e=new Date,t=+e+6e4*e.getTimezoneOffset(),r=n.util.createBuffer();return r.putInt32(t),r.putBytes(n.random.getBytes(28)),r},l.createRecord=function(e,t){return t.data?{type:t.type,version:{major:e.version.major,minor:e.version.minor},length:t.data.length(),fragment:t.data}:null},l.createAlert=function(e,t){var r=n.util.createBuffer();return r.putByte(t.level),r.putByte(t.description),l.createRecord(e,{type:l.ContentType.alert,data:r})},l.createClientHello=function(e){e.session.clientHelloVersion={major:e.version.major,minor:e.version.minor};for(var t=n.util.createBuffer(),r=0;r<e.cipherSuites.length;++r){var o=e.cipherSuites[r];t.putByte(o.id[0]),t.putByte(o.id[1])}var i=t.length(),a=n.util.createBuffer();a.putByte(l.CompressionMethod.none);var s=a.length(),u=n.util.createBuffer();if(e.virtualHost){var f=n.util.createBuffer();f.putByte(0),f.putByte(0);var p=n.util.createBuffer();p.putByte(0),c(p,2,n.util.createBuffer(e.virtualHost));var d=n.util.createBuffer();c(d,2,p),c(f,2,d),u.putBuffer(f)}var h=u.length();h>0&&(h+=2);var y=e.session.id,m=y.length+1+2+4+28+2+i+1+s+h,g=n.util.createBuffer();return g.putByte(l.HandshakeType.client_hello),g.putInt24(m),g.putByte(e.version.major),g.putByte(e.version.minor),g.putBytes(e.session.sp.client_random),c(g,1,n.util.createBuffer(y)),c(g,2,t),c(g,1,a),h>0&&c(g,2,u),g},l.createServerHello=function(e){var t=e.session.id,r=t.length+1+2+4+28+2+1,o=n.util.createBuffer();return o.putByte(l.HandshakeType.server_hello),o.putInt24(r),o.putByte(e.version.major),o.putByte(e.version.minor),o.putBytes(e.session.sp.server_random),c(o,1,n.util.createBuffer(t)),o.putByte(e.session.cipherSuite.id[0]),o.putByte(e.session.cipherSuite.id[1]),o.putByte(e.session.compressionMethod),o},l.createCertificate=function(e){var t=e.entity===l.ConnectionEnd.client,r=null;if(e.getCertificate){var o;o=t?e.session.certificateRequest:e.session.extensions.server_name.serverNameList,r=e.getCertificate(e,o)}var i=n.util.createBuffer();if(null!==r)try{n.util.isArray(r)||(r=[r]);for(var a=null,s=0;s<r.length;++s){var u=n.pem.decode(r[s])[0];if("CERTIFICATE"!==u.type&&"X509 CERTIFICATE"!==u.type&&"TRUSTED CERTIFICATE"!==u.type){var f=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw f.headerType=u.type,f}if(u.procType&&"ENCRYPTED"===u.procType.type)throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var p=n.util.createBuffer(u.body);null===a&&(a=n.asn1.fromDer(p.bytes(),!1));var d=n.util.createBuffer();c(d,3,p),i.putBuffer(d)}r=n.pki.certificateFromAsn1(a),t?e.session.clientCertificate=r:e.session.serverCertificate=r}catch(t){return e.error(e,{message:"Could not send certificate list.",cause:t,send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.bad_certificate}})}var h=3+i.length(),y=n.util.createBuffer();return y.putByte(l.HandshakeType.certificate),y.putInt24(h),c(y,3,i),y},l.createClientKeyExchange=function(e){var t=n.util.createBuffer();t.putByte(e.session.clientHelloVersion.major),t.putByte(e.session.clientHelloVersion.minor),t.putBytes(n.random.getBytes(46));var r=e.session.sp;r.pre_master_secret=t.getBytes(),t=e.session.serverCertificate.publicKey.encrypt(r.pre_master_secret);var o=t.length+2,i=n.util.createBuffer();return i.putByte(l.HandshakeType.client_key_exchange),i.putInt24(o),i.putInt16(t.length),i.putBytes(t),i},l.createServerKeyExchange=function(e){var t=n.util.createBuffer();return t},l.getClientSignature=function(e,t){var r=n.util.createBuffer();r.putBuffer(e.session.md5.digest()),r.putBuffer(e.session.sha1.digest()),r=r.getBytes(),e.getSignature=e.getSignature||function(e,t,r){var o=null;if(e.getPrivateKey)try{o=e.getPrivateKey(e,e.session.clientCertificate),o=n.pki.privateKeyFromPem(o)}catch(t){e.error(e,{message:"Could not get private key.",cause:t,send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.internal_error}})}null===o?e.error(e,{message:"No private key set.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.internal_error}}):t=o.sign(t,null),r(e,t)},e.getSignature(e,r,t)},l.createCertificateVerify=function(e,t){var r=t.length+2,o=n.util.createBuffer();return o.putByte(l.HandshakeType.certificate_verify),o.putInt24(r),o.putInt16(t.length),o.putBytes(t),o},l.createCertificateRequest=function(e){var t=n.util.createBuffer();t.putByte(1);var r=n.util.createBuffer();for(var o in e.caStore.certs){var i=e.caStore.certs[o],a=n.pki.distinguishedNameToAsn1(i.subject),s=n.asn1.toDer(a);r.putInt16(s.length()),r.putBuffer(s)}var u=1+t.length()+2+r.length(),f=n.util.createBuffer();return f.putByte(l.HandshakeType.certificate_request),f.putInt24(u),c(f,1,t),c(f,2,r),f},l.createServerHelloDone=function(e){var t=n.util.createBuffer();return t.putByte(l.HandshakeType.server_hello_done),t.putInt24(0),t},l.createChangeCipherSpec=function(){var e=n.util.createBuffer();return e.putByte(1),e},l.createFinished=function(e){var t=n.util.createBuffer();t.putBuffer(e.session.md5.digest()),t.putBuffer(e.session.sha1.digest());var r=e.entity===l.ConnectionEnd.client,i=e.session.sp,a=o,s=r?"client finished":"server finished";t=a(i.master_secret,s,t.getBytes(),12);var u=n.util.createBuffer();return u.putByte(l.HandshakeType.finished),u.putInt24(t.length()),u.putBuffer(t),u},l.createHeartbeat=function(e,t,r){void 0===r&&(r=t.length);var o=n.util.createBuffer();o.putByte(e),o.putInt16(r),o.putBytes(t);var i=o.length(),a=Math.max(16,i-r-3);return o.putBytes(n.random.getBytes(a)),o},l.queue=function(e,t){if(t&&(0!==t.fragment.length()||t.type!==l.ContentType.handshake&&t.type!==l.ContentType.alert&&t.type!==l.ContentType.change_cipher_spec)){if(t.type===l.ContentType.handshake){var r=t.fragment.bytes();e.session.md5.update(r),e.session.sha1.update(r),r=null}var o;if(t.fragment.length()<=l.MaxFragment)o=[t];else{o=[];for(var i=t.fragment.bytes();i.length>l.MaxFragment;)o.push(l.createRecord(e,{type:t.type,data:n.util.createBuffer(i.slice(0,l.MaxFragment))})),i=i.slice(l.MaxFragment);i.length>0&&o.push(l.createRecord(e,{type:t.type,data:n.util.createBuffer(i)}))}for(var a=0;a<o.length&&!e.fail;++a){var s=o[a];e.state.current.write.update(e,s)&&e.records.push(s)}}},l.flush=function(e){for(var t=0;t<e.records.length;++t){var r=e.records[t];e.tlsData.putByte(r.type),e.tlsData.putByte(r.version.major),e.tlsData.putByte(r.version.minor),e.tlsData.putInt16(r.fragment.length()),e.tlsData.putBuffer(e.records[t].fragment)}return e.records=[],e.tlsDataReady(e)};var K=function(e){switch(e){case!0:return!0;case n.pki.certificateError.bad_certificate:return l.Alert.Description.bad_certificate;case n.pki.certificateError.unsupported_certificate:return l.Alert.Description.unsupported_certificate;case n.pki.certificateError.certificate_revoked:return l.Alert.Description.certificate_revoked;case n.pki.certificateError.certificate_expired:return l.Alert.Description.certificate_expired;case n.pki.certificateError.certificate_unknown:return l.Alert.Description.certificate_unknown;case n.pki.certificateError.unknown_ca:return l.Alert.Description.unknown_ca;default:return l.Alert.Description.bad_certificate}},G=function(e){switch(e){case!0:return!0;case l.Alert.Description.bad_certificate:return n.pki.certificateError.bad_certificate;case l.Alert.Description.unsupported_certificate:return n.pki.certificateError.unsupported_certificate;case l.Alert.Description.certificate_revoked:return n.pki.certificateError.certificate_revoked;case l.Alert.Description.certificate_expired:return n.pki.certificateError.certificate_expired;case l.Alert.Description.certificate_unknown:return n.pki.certificateError.certificate_unknown;case l.Alert.Description.unknown_ca:return n.pki.certificateError.unknown_ca;default:return n.pki.certificateError.bad_certificate}};l.verifyCertificateChain=function(e,t){try{n.pki.verifyCertificateChain(e.caStore,t,function(t,r,o){var i=(K(t),e.verify(e,t,r,o));if(!0!==i){if("object"==typeof i&&!n.util.isArray(i)){var a=new Error("The application rejected the certificate.");throw a.send=!0,a.alert={level:l.Alert.Level.fatal,description:l.Alert.Description.bad_certificate},i.message&&(a.message=i.message),i.alert&&(a.alert.description=i.alert),a}i!==t&&(i=G(i))}return i})}catch(t){var r=t;("object"!=typeof r||n.util.isArray(r))&&(r={send:!0,alert:{level:l.Alert.Level.fatal,description:K(t)}}),"send"in r||(r.send=!0),"alert"in r||(r.alert={level:l.Alert.Level.fatal,description:K(r.error)}),e.error(e,r)}return!e.fail},l.createSessionCache=function(e,t){var r=null;if(e&&e.getSession&&e.setSession&&e.order)r=e;else{r={},r.cache=e||{},r.capacity=Math.max(t||100,1),r.order=[];for(var o in e)r.order.length<=t?r.order.push(o):delete e[o];r.getSession=function(e){var t=null,o=null;if(e?o=n.util.bytesToHex(e):r.order.length>0&&(o=r.order[0]),null!==o&&o in r.cache){t=r.cache[o],delete r.cache[o];for(var i in r.order)if(r.order[i]===o){r.order.splice(i,1);break}}return t},r.setSession=function(e,t){if(r.order.length===r.capacity){var o=r.order.shift();delete r.cache[o]}var o=n.util.bytesToHex(e);r.order.push(o),r.cache[o]=t}}return r},l.createConnection=function(e){var t=null;t=e.caStore?n.util.isArray(e.caStore)?n.pki.createCaStore(e.caStore):e.caStore:n.pki.createCaStore();var r=e.cipherSuites||null;if(null===r){r=[];for(var o in l.CipherSuites)r.push(l.CipherSuites[o])}var i=e.server?l.ConnectionEnd.server:l.ConnectionEnd.client,a=e.sessionCache?l.createSessionCache(e.sessionCache):null,s={version:{major:l.Version.major,minor:l.Version.minor},entity:i,sessionId:e.sessionId,caStore:t,sessionCache:a,cipherSuites:r,connected:e.connected,virtualHost:e.virtualHost||null,verifyClient:e.verifyClient||!1,verify:e.verify||function(e,t,r,n){return t},getCertificate:e.getCertificate||null,getPrivateKey:e.getPrivateKey||null,getSignature:e.getSignature||null,input:n.util.createBuffer(),tlsData:n.util.createBuffer(),data:n.util.createBuffer(),tlsDataReady:e.tlsDataReady,dataReady:e.dataReady,heartbeatReceived:e.heartbeatReceived,closed:e.closed,error:function(t,r){r.origin=r.origin||(t.entity===l.ConnectionEnd.client?"client":"server"),r.send&&(l.queue(t,l.createAlert(t,r.alert)),l.flush(t));var n=!1!==r.fatal;n&&(t.fail=!0),e.error(t,r),n&&t.close(!1)},deflate:e.deflate||null,inflate:e.inflate||null};s.reset=function(e){s.version={major:l.Version.major,minor:l.Version.minor},s.record=null,s.session=null,s.peerCertificate=null,s.state={pending:null,current:null},s.expect=(s.entity,l.ConnectionEnd.client,0),s.fragmented=null,s.records=[],s.open=!1,s.handshakes=0,s.handshaking=!1,s.isConnected=!1,s.fail=!(e||void 0===e),s.input.clear(),s.tlsData.clear(),s.data.clear(),s.state.current=l.createConnectionState(s)},s.reset();var u=function(e,t){var r=t.type-l.ContentType.change_cipher_spec,n=P[e.entity][e.expect];r in n?n[r](e,t):l.handleUnexpected(e,t)},c=function(e){var t=0,r=e.input,o=r.length();if(o<5)t=5-o;else{e.record={type:r.getByte(),version:{major:r.getByte(),minor:r.getByte()},length:r.getInt16(),fragment:n.util.createBuffer(),ready:!1};var i=e.record.version.major===e.version.major;i&&e.session&&e.session.version&&(i=e.record.version.minor===e.version.minor),i||e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.protocol_version}})}return t},f=function(e){var t=0,r=e.input,n=r.length();if(n<e.record.length)t=e.record.length-n;else{e.record.fragment.putBytes(r.getBytes(e.record.length)),r.compact();e.state.current.read.update(e,e.record)&&(null!==e.fragmented&&(e.fragmented.type===e.record.type?(e.fragmented.fragment.putBuffer(e.record.fragment),e.record=e.fragmented):e.error(e,{message:"Invalid fragmented record.",send:!0,alert:{level:l.Alert.Level.fatal,description:l.Alert.Description.unexpected_message}})),e.record.ready=!0)}return t};return s.handshake=function(e){if(s.entity!==l.ConnectionEnd.client)s.error(s,{message:"Cannot initiate handshake as a server.",fatal:!1});else if(s.handshaking)s.error(s,{message:"Handshake already in progress.",fatal:!1});else{s.fail&&!s.open&&0===s.handshakes&&(s.fail=!1),s.handshaking=!0,e=e||"";var t=null;e.length>0&&(s.sessionCache&&(t=s.sessionCache.getSession(e)),null===t&&(e="")),0===e.length&&s.sessionCache&&null!==(t=s.sessionCache.getSession())&&(e=t.id),s.session={id:e,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:n.md.md5.create(),sha1:n.md.sha1.create()},t&&(s.version=t.version,s.session.sp=t.sp),s.session.sp.client_random=l.createRandom().getBytes(),s.open=!0,l.queue(s,l.createRecord(s,{type:l.ContentType.handshake,data:l.createClientHello(s)})),l.flush(s)}},s.process=function(e){var t=0;return e&&s.input.putBytes(e),s.fail||(null!==s.record&&s.record.ready&&s.record.fragment.isEmpty()&&(s.record=null),null===s.record&&(t=c(s)),s.fail||null===s.record||s.record.ready||(t=f(s)),!s.fail&&null!==s.record&&s.record.ready&&u(s,s.record)),t},s.prepare=function(e){return l.queue(s,l.createRecord(s,{type:l.ContentType.application_data,data:n.util.createBuffer(e)})),l.flush(s)},s.prepareHeartbeatRequest=function(e,t){return e instanceof n.util.ByteBuffer&&(e=e.bytes()),void 0===t&&(t=e.length),s.expectedHeartbeatPayload=e,l.queue(s,l.createRecord(s,{type:l.ContentType.heartbeat,data:l.createHeartbeat(l.HeartbeatMessageType.heartbeat_request,e,t)})),l.flush(s)},s.close=function(e){if(!s.fail&&s.sessionCache&&s.session){var t={id:s.session.id,version:s.session.version,sp:s.session.sp};t.sp.keys=null,s.sessionCache.setSession(t.id,t)}s.open&&(s.open=!1,s.input.clear(),(s.isConnected||s.handshaking)&&(s.isConnected=s.handshaking=!1,l.queue(s,l.createAlert(s,{level:l.Alert.Level.warning,description:l.Alert.Description.close_notify})),l.flush(s)),s.closed(s)),s.reset(e)},s},e.exports=n.tls=n.tls||{};for(var z in l)"function"!=typeof l[z]&&(n.tls[z]=l[z]);n.tls.prf_tls1=o,n.tls.hmac_sha1=i,n.tls.createSessionCache=l.createSessionCache,n.tls.createConnection=l.createConnection},function(e,t,r){var n=r(1);r(7),r(11),r(47),r(12),r(30),r(54),r(33),r(20),r(2),r(32);var o=n.asn1,i=e.exports=n.pki=n.pki||{};i.pemToDer=function(e){var t=n.pem.decode(e)[0];if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert PEM to DER; PEM is encrypted.");return n.util.createBuffer(t.body)},i.privateKeyFromPem=function(e){var t=n.pem.decode(e)[0];if("PRIVATE KEY"!==t.type&&"RSA PRIVATE KEY"!==t.type){var r=new Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');throw r.headerType=t.type,r}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert private key from PEM; PEM is encrypted.");var a=o.fromDer(t.body);return i.privateKeyFromAsn1(a)},i.privateKeyToPem=function(e,t){var r={type:"RSA PRIVATE KEY",body:o.toDer(i.privateKeyToAsn1(e)).getBytes()};return n.pem.encode(r,{maxline:t})},i.privateKeyInfoToPem=function(e,t){var r={type:"PRIVATE KEY",body:o.toDer(e).getBytes()};return n.pem.encode(r,{maxline:t})}},function(e,t,r){function n(e,t){return e.start().update(t).digest().getBytes()}function o(e){var t;if(e){if(!(t=l.oids[c.derToOid(e)])){var r=new Error("Unsupported PRF OID.");throw r.oid=e,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}}else t="hmacWithSHA1";return i(t)}function i(e){var t=s.md;switch(e){case"hmacWithSHA224":t=s.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":e=e.substr(8).toLowerCase();break;default:var r=new Error("Unsupported PRF algorithm.");throw r.algorithm=e,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}if(!(t&&e in t))throw new Error("Unknown hash algorithm: "+e);return t[e].create()}function a(e,t,r,n){var o=c.create(c.Class.UNIVERSAL,c.Type.SEQUENCE,!0,[c.create(c.Class.UNIVERSAL,c.Type.OCTETSTRING,!1,e),c.create(c.Class.UNIVERSAL,c.Type.INTEGER,!1,t.getBytes())]);return"hmacWithSHA1"!==n&&o.value.push(c.create(c.Class.UNIVERSAL,c.Type.INTEGER,!1,s.util.hexToBytes(r.toString(16))),c.create(c.Class.UNIVERSAL,c.Type.SEQUENCE,!0,[c.create(c.Class.UNIVERSAL,c.Type.OID,!1,c.oidToDer(l.oids[n]).getBytes()),c.create(c.Class.UNIVERSAL,c.Type.NULL,!1,"")])),o}var s=r(1);if(r(10),r(7),r(19),r(8),r(11),r(30),r(12),r(6),r(51),r(20),r(2),void 0===u)var u=s.jsbn.BigInteger;var c=s.asn1,l=s.pki=s.pki||{};e.exports=l.pbe=s.pbe=s.pbe||{};var f=l.oids,p={name:"EncryptedPrivateKeyInfo",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:c.Class.UNIVERSAL,type:c.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:c.Class.UNIVERSAL,type:c.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},d={name:"PBES2Algorithms",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:c.Class.UNIVERSAL,type:c.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:c.Class.UNIVERSAL,type:c.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:c.Class.UNIVERSAL,type:c.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:c.Class.UNIVERSAL,type:c.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:c.Class.UNIVERSAL,type:c.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:c.Class.UNIVERSAL,type:c.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:c.Class.UNIVERSAL,type:c.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},h={name:"pkcs-12PbeParams",tagClass:c.Class.UNIVERSAL,type:c.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:c.Class.UNIVERSAL,type:c.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:c.Class.UNIVERSAL,type:c.Type.INTEGER,constructed:!1,capture:"iterations"}]};l.encryptPrivateKeyInfo=function(e,t,r){r=r||{},r.saltSize=r.saltSize||8,r.count=r.count||2048,r.algorithm=r.algorithm||"aes128",r.prfAlgorithm=r.prfAlgorithm||"sha1";var n,o,u,p=s.random.getBytesSync(r.saltSize),d=r.count,h=c.integerToDer(d);if(0===r.algorithm.indexOf("aes")||"des"===r.algorithm){var y,m,g;switch(r.algorithm){case"aes128":n=16,y=16,m=f["aes128-CBC"],g=s.aes.createEncryptionCipher;break;case"aes192":n=24,y=16,m=f["aes192-CBC"],g=s.aes.createEncryptionCipher;break;case"aes256":n=32,y=16,m=f["aes256-CBC"],g=s.aes.createEncryptionCipher;break;case"des":n=8,y=8,m=f.desCBC,g=s.des.createEncryptionCipher;break;default:var v=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw v.algorithm=r.algorithm,v}var b="hmacWith"+r.prfAlgorithm.toUpperCase(),E=i(b),C=s.pkcs5.pbkdf2(t,p,d,n,E),_=s.random.getBytesSync(y),w=g(C);w.start(_),w.update(c.toDer(e)),w.finish(),u=w.output.getBytes();var T=a(p,h,n,b);o=c.create(c.Class.UNIVERSAL,c.Type.SEQUENCE,!0,[c.create(c.Class.UNIVERSAL,c.Type.OID,!1,c.oidToDer(f.pkcs5PBES2).getBytes()),c.create(c.Class.UNIVERSAL,c.Type.SEQUENCE,!0,[c.create(c.Class.UNIVERSAL,c.Type.SEQUENCE,!0,[c.create(c.Class.UNIVERSAL,c.Type.OID,!1,c.oidToDer(f.pkcs5PBKDF2).getBytes()),T]),c.create(c.Class.UNIVERSAL,c.Type.SEQUENCE,!0,[c.create(c.Class.UNIVERSAL,c.Type.OID,!1,c.oidToDer(m).getBytes()),c.create(c.Class.UNIVERSAL,c.Type.OCTETSTRING,!1,_)])])])}else{if("3des"!==r.algorithm){var v=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw v.algorithm=r.algorithm,v}n=24;var S=new s.util.ByteBuffer(p),C=l.pbe.generatePkcs12Key(t,S,1,d,n),_=l.pbe.generatePkcs12Key(t,S,2,d,n),w=s.des.createEncryptionCipher(C);w.start(_),w.update(c.toDer(e)),w.finish(),u=w.output.getBytes(),o=c.create(c.Class.UNIVERSAL,c.Type.SEQUENCE,!0,[c.create(c.Class.UNIVERSAL,c.Type.OID,!1,c.oidToDer(f["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),c.create(c.Class.UNIVERSAL,c.Type.SEQUENCE,!0,[c.create(c.Class.UNIVERSAL,c.Type.OCTETSTRING,!1,p),c.create(c.Class.UNIVERSAL,c.Type.INTEGER,!1,h.getBytes())])])}return c.create(c.Class.UNIVERSAL,c.Type.SEQUENCE,!0,[o,c.create(c.Class.UNIVERSAL,c.Type.OCTETSTRING,!1,u)])},l.decryptPrivateKeyInfo=function(e,t){var r=null,n={},o=[];if(!c.validate(e,p,n,o)){var i=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw i.errors=o,i}var a=c.derToOid(n.encryptionOid),u=l.pbe.getCipher(a,n.encryptionParams,t),f=s.util.createBuffer(n.encryptedData);return u.update(f),u.finish()&&(r=c.fromDer(u.output)),r},l.encryptedPrivateKeyToPem=function(e,t){var r={type:"ENCRYPTED PRIVATE KEY",body:c.toDer(e).getBytes()};return s.pem.encode(r,{maxline:t})},l.encryptedPrivateKeyFromPem=function(e){var t=s.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==t.type){var r=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw r.headerType=t.type,r}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return c.fromDer(t.body)},l.encryptRsaPrivateKey=function(e,t,r){if(r=r||{},!r.legacy){var n=l.wrapRsaPrivateKey(l.privateKeyToAsn1(e));return n=l.encryptPrivateKeyInfo(n,t,r),l.encryptedPrivateKeyToPem(n)}var o,i,a,u;switch(r.algorithm){case"aes128":o="AES-128-CBC",a=16,i=s.random.getBytesSync(16),u=s.aes.createEncryptionCipher;break;case"aes192":o="AES-192-CBC",a=24,i=s.random.getBytesSync(16),u=s.aes.createEncryptionCipher;break;case"aes256":o="AES-256-CBC",a=32,i=s.random.getBytesSync(16),u=s.aes.createEncryptionCipher;break;case"3des":o="DES-EDE3-CBC",a=24,i=s.random.getBytesSync(8),u=s.des.createEncryptionCipher;break;case"des":o="DES-CBC",a=8,i=s.random.getBytesSync(8),u=s.des.createEncryptionCipher;break;default:var f=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+r.algorithm+'".');throw f.algorithm=r.algorithm,f}var p=s.pbe.opensslDeriveBytes(t,i.substr(0,8),a),d=u(p);d.start(i),d.update(c.toDer(l.privateKeyToAsn1(e))),d.finish();var h={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:o,parameters:s.util.bytesToHex(i).toUpperCase()},body:d.output.getBytes()};return s.pem.encode(h)},l.decryptRsaPrivateKey=function(e,t){var r=null,n=s.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==n.type&&"PRIVATE KEY"!==n.type&&"RSA PRIVATE KEY"!==n.type){var o=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".');throw o.headerType=o,o}if(n.procType&&"ENCRYPTED"===n.procType.type){var i,a;switch(n.dekInfo.algorithm){case"DES-CBC":i=8,a=s.des.createDecryptionCipher;break;case"DES-EDE3-CBC":i=24,a=s.des.createDecryptionCipher;break;case"AES-128-CBC":i=16,a=s.aes.createDecryptionCipher;break;case"AES-192-CBC":i=24,a=s.aes.createDecryptionCipher;break;case"AES-256-CBC":i=32,a=s.aes.createDecryptionCipher;break;case"RC2-40-CBC":i=5,a=function(e){return s.rc2.createDecryptionCipher(e,40)};break;case"RC2-64-CBC":i=8,a=function(e){return s.rc2.createDecryptionCipher(e,64)};break;case"RC2-128-CBC":i=16,a=function(e){return s.rc2.createDecryptionCipher(e,128)};break;default:var o=new Error('Could not decrypt private key; unsupported encryption algorithm "'+n.dekInfo.algorithm+'".');throw o.algorithm=n.dekInfo.algorithm,o}var u=s.util.hexToBytes(n.dekInfo.parameters),f=s.pbe.opensslDeriveBytes(t,u.substr(0,8),i),p=a(f);if(p.start(u),p.update(s.util.createBuffer(n.body)),!p.finish())return r;r=p.output.getBytes()}else r=n.body;return r="ENCRYPTED PRIVATE KEY"===n.type?l.decryptPrivateKeyInfo(c.fromDer(r),t):c.fromDer(r),null!==r&&(r=l.privateKeyFromAsn1(r)),r},l.pbe.generatePkcs12Key=function(e,t,r,n,o,i){var a,u;if(void 0===i||null===i){if(!("sha1"in s.md))throw new Error('"sha1" hash algorithm unavailable.');i=s.md.sha1.create()}var c=i.digestLength,l=i.blockLength,f=new s.util.ByteBuffer,p=new s.util.ByteBuffer;if(null!==e&&void 0!==e){for(u=0;u<e.length;u++)p.putInt16(e.charCodeAt(u));p.putInt16(0)}var d=p.length(),h=t.length(),y=new s.util.ByteBuffer;y.fillWithByte(r,l);var m=l*Math.ceil(h/l),g=new s.util.ByteBuffer;for(u=0;u<m;u++)g.putByte(t.at(u%h));var v=l*Math.ceil(d/l),b=new s.util.ByteBuffer;for(u=0;u<v;u++)b.putByte(p.at(u%d));var E=g;E.putBuffer(b);for(var C=Math.ceil(o/c),_=1;_<=C;_++){var w=new s.util.ByteBuffer;w.putBytes(y.bytes()),w.putBytes(E.bytes());for(var T=0;T<n;T++)i.start(),i.update(w.getBytes()),w=i.digest();var S=new s.util.ByteBuffer;for(u=0;u<l;u++)S.putByte(w.at(u%c));var I=Math.ceil(h/l)+Math.ceil(d/l),A=new s.util.ByteBuffer;for(a=0;a<I;a++){var k=new s.util.ByteBuffer(E.getBytes(l)),B=511;for(u=S.length()-1;u>=0;u--)B>>=8,B+=S.at(u)+k.at(u),k.setAt(u,255&B);A.putBuffer(k)}E=A,f.putBuffer(w)}return f.truncate(f.length()-o),f},l.pbe.getCipher=function(e,t,r){switch(e){case l.oids.pkcs5PBES2:return l.pbe.getCipherForPBES2(e,t,r);case l.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case l.oids["pbewithSHAAnd40BitRC2-CBC"]:return l.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},l.pbe.getCipherForPBES2=function(e,t,r){var n={},i=[];if(!c.validate(t,d,n,i)){var a=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw a.errors=i,a}if((e=c.derToOid(n.kdfOid))!==l.oids.pkcs5PBKDF2){var a=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw a.oid=e,a.supportedOids=["pkcs5PBKDF2"],a}if((e=c.derToOid(n.encOid))!==l.oids["aes128-CBC"]&&e!==l.oids["aes192-CBC"]&&e!==l.oids["aes256-CBC"]&&e!==l.oids["des-EDE3-CBC"]&&e!==l.oids.desCBC){var a=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw a.oid=e,a.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],a}var u=n.kdfSalt,f=s.util.createBuffer(n.kdfIterationCount);f=f.getInt(f.length()<<3);var p,h;switch(l.oids[e]){case"aes128-CBC":p=16,h=s.aes.createDecryptionCipher;break;case"aes192-CBC":p=24,h=s.aes.createDecryptionCipher;break;case"aes256-CBC":p=32,h=s.aes.createDecryptionCipher;break;case"des-EDE3-CBC":p=24,h=s.des.createDecryptionCipher;break;case"desCBC":p=8,h=s.des.createDecryptionCipher}var y=o(n.prfOid),m=s.pkcs5.pbkdf2(r,u,f,p,y),g=n.encIv,v=h(m);return v.start(g),v},l.pbe.getCipherForPKCS12PBE=function(e,t,r){var n={},i=[];if(!c.validate(t,h,n,i)){var a=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw a.errors=i,a}var u=s.util.createBuffer(n.salt),f=s.util.createBuffer(n.iterations);f=f.getInt(f.length()<<3);var p,d,y;switch(e){case l.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:p=24,d=8,y=s.des.startDecrypting;break;case l.oids["pbewithSHAAnd40BitRC2-CBC"]:p=5,d=8,y=function(e,t){var r=s.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:var a=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw a.oid=e,a}var m=o(n.prfOid),g=l.pbe.generatePkcs12Key(r,u,1,f,p,m);return m.start(),y(g,l.pbe.generatePkcs12Key(r,u,2,f,d,m))},l.pbe.opensslDeriveBytes=function(e,t,r,o){if(void 0===o||null===o){if(!("md5"in s.md))throw new Error('"md5" hash algorithm unavailable.');o=s.md.md5.create()}null===t&&(t="");for(var i=[n(o,e+t)],a=16,u=1;a<r;++u,a+=16)i.push(n(o,i[u-1]+e+t));return i.join("").substr(0,r)}},function(e,t){},function(e,t,r){function n(){s=String.fromCharCode(128),s+=i.util.fillString(String.fromCharCode(0),64),c=[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],u=!0}function o(e,t,r){for(var n,o,i,a,s,u,l,f,p,d,h,y,m,g,v,b=r.length();b>=64;){for(l=0;l<16;++l)t[l]=r.getInt32();for(;l<64;++l)n=t[l-2],n=(n>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,o=t[l-15],o=(o>>>7|o<<25)^(o>>>18|o<<14)^o>>>3,t[l]=n+t[l-7]+o+t[l-16]|0;for(f=e.h0,p=e.h1,d=e.h2,h=e.h3,y=e.h4,m=e.h5,g=e.h6,v=e.h7,l=0;l<64;++l)a=(y>>>6|y<<26)^(y>>>11|y<<21)^(y>>>25|y<<7),s=g^y&(m^g),i=(f>>>2|f<<30)^(f>>>13|f<<19)^(f>>>22|f<<10),u=f&p|d&(f^p),n=v+a+s+c[l]+t[l],o=i+u,v=g,g=m,m=y,y=h+n>>>0,h=d,d=p,p=f,f=n+o>>>0;e.h0=e.h0+f|0,e.h1=e.h1+p|0,e.h2=e.h2+d|0,e.h3=e.h3+h|0,e.h4=e.h4+y|0,e.h5=e.h5+m|0,e.h6=e.h6+g|0,e.h7=e.h7+v|0,b-=64}}var i=r(1);r(8),r(2);var a=e.exports=i.sha256=i.sha256||{};i.md.sha256=i.md.algorithms.sha256=a,a.create=function(){u||n();var e=null,t=i.util.createBuffer(),r=new Array(64),a={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8};return a.start=function(){a.messageLength=0,a.fullMessageLength=a.messageLength64=[];for(var r=a.messageLengthSize/4,n=0;n<r;++n)a.fullMessageLength.push(0);return t=i.util.createBuffer(),e={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},a},a.start(),a.update=function(n,s){"utf8"===s&&(n=i.util.encodeUtf8(n));var u=n.length;a.messageLength+=u,u=[u/4294967296>>>0,u>>>0];for(var c=a.fullMessageLength.length-1;c>=0;--c)a.fullMessageLength[c]+=u[1],u[1]=u[0]+(a.fullMessageLength[c]/4294967296>>>0),a.fullMessageLength[c]=a.fullMessageLength[c]>>>0,u[0]=u[1]/4294967296>>>0;return t.putBytes(n),o(e,r,t),(t.read>2048||0===t.length())&&t.compact(),a},a.digest=function(){var n=i.util.createBuffer();n.putBytes(t.bytes());var u=a.fullMessageLength[a.fullMessageLength.length-1]+a.messageLengthSize,c=u&a.blockLength-1;n.putBytes(s.substr(0,a.blockLength-c));for(var l,f,p=8*a.fullMessageLength[0],d=0;d<a.fullMessageLength.length-1;++d)l=8*a.fullMessageLength[d+1],f=l/4294967296>>>0,p+=f,n.putInt32(p>>>0),p=l>>>0;n.putInt32(p);var h={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4,h5:e.h5,h6:e.h6,h7:e.h7};o(h,r,n);var y=i.util.createBuffer();return y.putInt32(h.h0),y.putInt32(h.h1),y.putInt32(h.h2),y.putInt32(h.h3),y.putInt32(h.h4),y.putInt32(h.h5),y.putInt32(h.h6),y.putInt32(h.h7),y},a};var s=null,u=!1,c=null},function(e,t,r){var n=r(1);r(2);var o=null;!n.util.isNodejs||n.options.usePureJavaScript||process.versions["node-webkit"]||(o=r(48)),(e.exports=n.prng=n.prng||{}).create=function(e){function t(e){if(s.pools[0].messageLength>=32)return i(),e();var t=32-s.pools[0].messageLength<<5;s.seedFile(t,function(t,r){if(t)return e(t);s.collect(r),i(),e()})}function r(){if(s.pools[0].messageLength>=32)return i();var e=32-s.pools[0].messageLength<<5;s.collect(s.seedFileSync(e)),i()}function i(){var e=s.plugin.md.create();e.update(s.pools[0].digest().getBytes()),s.pools[0].start();for(var t=1,r=1;r<32;++r)(t=31===t?2147483648:t<<2)%s.reseeds==0&&(e.update(s.pools[r].digest().getBytes()),s.pools[r].start());var n=e.digest().getBytes();e.start(),e.update(n);var o=e.digest().getBytes();s.key=s.plugin.formatKey(n),s.seed=s.plugin.formatSeed(o),s.reseeds=4294967295===s.reseeds?0:s.reseeds+1,s.generated=0}function a(e){var t=null;if("undefined"!=typeof window){var r=window.crypto||window.msCrypto;r&&r.getRandomValues&&(t=function(e){return r.getRandomValues(e)})}var o=n.util.createBuffer();if(t)for(;o.length()<e;){var i=Math.max(1,Math.min(e-o.length(),65536)/4),a=new Uint32Array(Math.floor(i));try{t(a);for(var s=0;s<a.length;++s)o.putInt32(a[s])}catch(e){if(!("undefined"!=typeof QuotaExceededError&&e instanceof QuotaExceededError))throw e}}if(o.length()<e)for(var u,c,l,f=Math.floor(65536*Math.random());o.length()<e;){c=16807*(65535&f),u=16807*(f>>16),c+=(32767&u)<<16,c+=u>>15,c=(2147483647&c)+(c>>31),f=4294967295&c;for(var s=0;s<3;++s)l=f>>>(s<<3),l^=Math.floor(256*Math.random()),o.putByte(String.fromCharCode(255&l))}return o.getBytes(e)}for(var s={plugin:e,key:null,seed:null,time:null,reseeds:0,generated:0},u=e.md,c=new Array(32),l=0;l<32;++l)c[l]=u.create();return s.pools=c,s.pool=0,s.generate=function(e,r){function o(f){if(f)return r(f);if(l.length()>=e)return r(null,l.getBytes(e));if(s.generated>1048575&&(s.key=null),null===s.key)return n.util.nextTick(function(){t(o)});var p=i(s.key,s.seed);s.generated+=p.length,l.putBytes(p),s.key=u(i(s.key,a(s.seed))),s.seed=c(i(s.key,s.seed)),n.util.setImmediate(o)}if(!r)return s.generateSync(e);var i=s.plugin.cipher,a=s.plugin.increment,u=s.plugin.formatKey,c=s.plugin.formatSeed,l=n.util.createBuffer();s.key=null,o()},s.generateSync=function(e){var t=s.plugin.cipher,o=s.plugin.increment,i=s.plugin.formatKey,a=s.plugin.formatSeed;s.key=null;for(var u=n.util.createBuffer();u.length()<e;){s.generated>1048575&&(s.key=null),null===s.key&&r();var c=t(s.key,s.seed);s.generated+=c.length,u.putBytes(c),s.key=i(t(s.key,o(s.seed))),s.seed=a(t(s.key,s.seed))}return u.getBytes(e)},o?(s.seedFile=function(e,t){o.randomBytes(e,function(e,r){if(e)return t(e);t(null,r.toString())})},s.seedFileSync=function(e){return o.randomBytes(e).toString()}):(s.seedFile=function(e,t){try{t(null,a(e))}catch(e){t(e)}},s.seedFileSync=a),s.collect=function(e){for(var t=e.length,r=0;r<t;++r)s.pools[s.pool].update(e.substr(r,1)),s.pool=31===s.pool?0:s.pool+1},s.collectInt=function(e,t){for(var r="",n=0;n<t;n+=8)r+=String.fromCharCode(e>>n&255);s.collect(r)},s.registerWorker=function(e){if(e===self)s.seedFile=function(e,t){function r(e){var n=e.data;n.forge&&n.forge.prng&&(self.removeEventListener("message",r),t(n.forge.prng.err,n.forge.prng.bytes))}self.addEventListener("message",r),self.postMessage({forge:{prng:{needed:e}}})};else{var t=function(t){var r=t.data;r.forge&&r.forge.prng&&s.seedFile(r.forge.prng.needed,function(t,r){e.postMessage({forge:{prng:{err:t,bytes:r}}})})};e.addEventListener("message",t)}},s}},function(e,t,r){var n=r(1);r(2);var o=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],i=[1,2,3,5],a=function(e,t){return e<<t&65535|(65535&e)>>16-t},s=function(e,t){return(65535&e)>>t|e<<16-t&65535};e.exports=n.rc2=n.rc2||{},n.rc2.expandKey=function(e,t){"string"==typeof e&&(e=n.util.createBuffer(e)),t=t||128;var r,i=e,a=e.length(),s=t,u=Math.ceil(s/8),c=255>>(7&s);for(r=a;r<128;r++)i.putByte(o[i.at(r-1)+i.at(r-a)&255]);for(i.setAt(128-u,o[i.at(128-u)&c]),r=127-u;r>=0;r--)i.setAt(r,o[i.at(r+1)^i.at(r+u)]);return i};var u=function(e,t,r){var o,u,c,l,f=!1,p=null,d=null,h=null,y=[];for(e=n.rc2.expandKey(e,t),c=0;c<64;c++)y.push(e.getInt16Le());r?(o=function(e){for(c=0;c<4;c++)e[c]+=y[l]+(e[(c+3)%4]&e[(c+2)%4])+(~e[(c+3)%4]&e[(c+1)%4]),e[c]=a(e[c],i[c]),l++},u=function(e){for(c=0;c<4;c++)e[c]+=y[63&e[(c+3)%4]]}):(o=function(e){for(c=3;c>=0;c--)e[c]=s(e[c],i[c]),e[c]-=y[l]+(e[(c+3)%4]&e[(c+2)%4])+(~e[(c+3)%4]&e[(c+1)%4]),l--},u=function(e){for(c=3;c>=0;c--)e[c]-=y[63&e[(c+3)%4]]});var m=function(e){var t=[];for(c=0;c<4;c++){var n=p.getInt16Le();null!==h&&(r?n^=h.getInt16Le():h.putInt16Le(n)),t.push(65535&n)}l=r?0:63;for(var o=0;o<e.length;o++)for(var i=0;i<e[o][0];i++)e[o][1](t);for(c=0;c<4;c++)null!==h&&(r?h.putInt16Le(t[c]):t[c]^=h.getInt16Le()),d.putInt16Le(t[c])},g=null;return g={start:function(e,t){e&&"string"==typeof e&&(e=n.util.createBuffer(e)),f=!1,p=n.util.createBuffer(),d=t||new n.util.createBuffer,h=e,g.output=d},update:function(e){for(f||p.putBuffer(e);p.length()>=8;)m([[5,o],[1,u],[6,o],[1,u],[5,o]])},finish:function(e){var t=!0;if(r)if(e)t=e(8,p,!r);else{var n=8===p.length()?8:8-p.length();p.fillWithByte(n,n)}if(t&&(f=!0,g.update()),!r&&(t=0===p.length()))if(e)t=e(8,d,!r);else{var o=d.length(),i=d.at(o-1);i>o?t=!1:d.truncate(i)}return t}}};n.rc2.startEncrypting=function(e,t,r){var o=n.rc2.createEncryptionCipher(e,128);return o.start(t,r),o},n.rc2.createEncryptionCipher=function(e,t){return u(e,t,!0)},n.rc2.startDecrypting=function(e,t,r){var o=n.rc2.createDecryptionCipher(e,128);return o.start(t,r),o},n.rc2.createDecryptionCipher=function(e,t){return u(e,t,!1)}},function(e,t,r){function n(e,t,r){r||(r=o.md.sha1.create());for(var n="",i=Math.ceil(t/r.digestLength),a=0;a<i;++a){var s=String.fromCharCode(a>>24&255,a>>16&255,a>>8&255,255&a);r.start(),r.update(e+s),n+=r.digest().getBytes()}return n.substring(0,t)}var o=r(1);r(2),r(6),r(15);var i=e.exports=o.pkcs1=o.pkcs1||{};i.encode_rsa_oaep=function(e,t,r){var i,a,s,u;"string"==typeof r?(i=r,a=arguments[3]||void 0,s=arguments[4]||void 0):r&&(i=r.label||void 0,a=r.seed||void 0,s=r.md||void 0,r.mgf1&&r.mgf1.md&&(u=r.mgf1.md)),s?s.start():s=o.md.sha1.create(),u||(u=s);var c=Math.ceil(e.n.bitLength()/8),l=c-2*s.digestLength-2;if(t.length>l){var f=new Error("RSAES-OAEP input message length is too long.");throw f.length=t.length,f.maxLength=l,f}i||(i=""),s.update(i,"raw");for(var p=s.digest(),d="",h=l-t.length,y=0;y<h;y++)d+="\0";var m=p.getBytes()+d+""+t;if(a){if(a.length!==s.digestLength){var f=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.");throw f.seedLength=a.length,f.digestLength=s.digestLength,f}}else a=o.random.getBytes(s.digestLength);var g=n(a,c-s.digestLength-1,u),v=o.util.xorBytes(m,g,m.length),b=n(v,s.digestLength,u);return"\0"+o.util.xorBytes(a,b,a.length)+v},i.decode_rsa_oaep=function(e,t,r){var i,a,s;"string"==typeof r?(i=r,a=arguments[3]||void 0):r&&(i=r.label||void 0,a=r.md||void 0,r.mgf1&&r.mgf1.md&&(s=r.mgf1.md));var u=Math.ceil(e.n.bitLength()/8);if(t.length!==u){var c=new Error("RSAES-OAEP encoded message length is invalid.");throw c.length=t.length,c.expectedLength=u,c}if(void 0===a?a=o.md.sha1.create():a.start(),s||(s=a),u<2*a.digestLength+2)throw new Error("RSAES-OAEP key is too short for the hash function.");i||(i=""),a.update(i,"raw");for(var l=a.digest().getBytes(),f=t.charAt(0),p=t.substring(1,a.digestLength+1),d=t.substring(1+a.digestLength),h=n(d,a.digestLength,s),y=o.util.xorBytes(p,h,p.length),m=n(y,u-a.digestLength-1,s),g=o.util.xorBytes(d,m,d.length),v=g.substring(0,a.digestLength),c="\0"!==f,b=0;b<a.digestLength;++b)c|=l.charAt(b)!==v.charAt(b);for(var E=1,C=a.digestLength,_=a.digestLength;_<g.length;_++){var w=g.charCodeAt(_),T=1&w^1;c|=w&(E?65534:0),E&=T,C+=E}if(c||1!==g.charCodeAt(C))throw new Error("Invalid RSAES-OAEP padding.");return g.substring(C+1)}},function(e,t,r){var n=r(1);r(2),r(31),r(6),function(){function t(e,t,n,o){return"workers"in n?i(e,t,n,o):r(e,t,n,o)}function r(e,t,r,n){var i=a(e,t),u=s(i.bitLength());"millerRabinTests"in r&&(u=r.millerRabinTests);var c=10;"maxBlockTime"in r&&(c=r.maxBlockTime),o(i,e,t,0,u,c,n)}function o(e,t,r,i,s,u,c){var f=+new Date;do{if(e.bitLength()>t&&(e=a(t,r)),e.isProbablePrime(s))return c(null,e);e.dAddOffset(l[i++%8],0)}while(u<0||+new Date-f<u);n.util.setImmediate(function(){o(e,t,r,i,s,u,c)})}function i(e,t,o,i){function s(){function r(r){if(!h){--s;var o=r.data;if(o.found){for(var l=0;l<n.length;++l)n[l].terminate();return h=!0,i(null,new c(o.prime,16))}u.bitLength()>e&&(u=a(e,t));var d=u.toString(16);r.target.postMessage({hex:d,workLoad:f}),u.dAddOffset(p,0)}}l=Math.max(1,l);for(var n=[],o=0;o<l;++o)n[o]=new Worker(d);for(var s=l,o=0;o<l;++o)n[o].addEventListener("message",r);var h=!1}if("undefined"==typeof Worker)return r(e,t,o,i);var u=a(e,t),l=o.workers,f=o.workLoad||100,p=30*f/8,d=o.workerScript||"forge/prime.worker.js";if(-1===l)return n.util.estimateCores(function(e,t){e&&(t=2),l=t-1,s()});s()}function a(e,t){var r=new c(e,t),n=e-1;return r.testBit(n)||r.bitwiseTo(c.ONE.shiftLeft(n),p,r),r.dAddOffset(31-r.mod(f).byteValue(),0),r}function s(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}if(n.prime)return void(e.exports=n.prime);var u=e.exports=n.prime=n.prime||{},c=n.jsbn.BigInteger,l=[6,4,2,4,2,4,6,2],f=new c(null);f.fromInt(30);var p=function(e,t){return e|t};u.generateProbablePrime=function(e,r,o){"function"==typeof r&&(o=r,r={}),r=r||{};var i=r.algorithm||"PRIMEINC";"string"==typeof i&&(i={name:i}),i.options=i.options||{};var a=r.prng||n.random,s={nextBytes:function(e){for(var t=a.getBytesSync(e.length),r=0;r<e.length;++r)e[r]=t.charCodeAt(r)}};if("PRIMEINC"===i.name)return t(e,s,i.options,o);throw new Error("Invalid prime generation algorithm: "+i.name)}}()},function(e,t,r){function n(e,t,r,n){for(var o=[],i=0;i<e.length;i++)for(var a=0;a<e[i].safeBags.length;a++){var s=e[i].safeBags[a];void 0!==n&&s.type!==n||(null!==t?void 0!==s.attributes[t]&&s.attributes[t].indexOf(r)>=0&&o.push(s):o.push(s))}return o}function o(e){if(e.composed||e.constructed){for(var t=c.util.createBuffer(),r=0;r<e.value.length;++r)t.putBytes(e.value[r].value);e.composed=e.constructed=!1,e.value=t.getBytes()}return e}function i(e,t,r,n){if(t=l.fromDer(t,r),t.tagClass!==l.Class.UNIVERSAL||t.type!==l.Type.SEQUENCE||!0!==t.constructed)throw new Error("PKCS#12 AuthenticatedSafe expected to be a SEQUENCE OF ContentInfo");for(var i=0;i<t.value.length;i++){var u=t.value[i],c={},p=[];if(!l.validate(u,d,c,p)){var h=new Error("Cannot read ContentInfo.");throw h.errors=p,h}var y={encrypted:!1},m=null,g=c.content.value[0];switch(l.derToOid(c.contentType)){case f.oids.data:if(g.tagClass!==l.Class.UNIVERSAL||g.type!==l.Type.OCTETSTRING)throw new Error("PKCS#12 SafeContents Data is not an OCTET STRING.");m=o(g).value;break;case f.oids.encryptedData:m=a(g,n),y.encrypted=!0;break;default:var h=new Error("Unsupported PKCS#12 contentType.");throw h.contentType=l.derToOid(c.contentType),h}y.safeBags=s(m,r,n),e.safeContents.push(y)}}function a(e,t){var r={},n=[];if(!l.validate(e,c.pkcs7.asn1.encryptedDataValidator,r,n)){var i=new Error("Cannot read EncryptedContentInfo.");throw i.errors=n,i}var a=l.derToOid(r.contentType);if(a!==f.oids.data){var i=new Error("PKCS#12 EncryptedContentInfo ContentType is not Data.");throw i.oid=a,i}a=l.derToOid(r.encAlgorithm);var s=f.pbe.getCipher(a,r.encParameter,t),u=o(r.encryptedContentAsn1),p=c.util.createBuffer(u.value);if(s.update(p),!s.finish())throw new Error("Failed to decrypt PKCS#12 SafeContents.");return s.output.getBytes()}function s(e,t,r){if(!t&&0===e.length)return[];if(e=l.fromDer(e,t),e.tagClass!==l.Class.UNIVERSAL||e.type!==l.Type.SEQUENCE||!0!==e.constructed)throw new Error("PKCS#12 SafeContents expected to be a SEQUENCE OF SafeBag.");for(var n=[],o=0;o<e.value.length;o++){var i=e.value[o],a={},s=[];if(!l.validate(i,y,a,s)){var c=new Error("Cannot read SafeBag.");throw c.errors=s,c}var p={type:l.derToOid(a.bagId),attributes:u(a.bagAttributes)};n.push(p);var d,h,m=a.bagValue.value[0];switch(p.type){case f.oids.pkcs8ShroudedKeyBag:if(null===(m=f.decryptPrivateKeyInfo(m,r)))throw new Error("Unable to decrypt PKCS#8 ShroudedKeyBag, wrong password?");case f.oids.keyBag:try{p.key=f.privateKeyFromAsn1(m)}catch(e){p.key=null,p.asn1=m}continue;case f.oids.certBag:d=g,h=function(){if(l.derToOid(a.certId)!==f.oids.x509Certificate){var e=new Error("Unsupported certificate type, only X.509 supported.");throw e.oid=l.derToOid(a.certId),e}var r=l.fromDer(a.cert,t);try{p.cert=f.certificateFromAsn1(r,!0)}catch(e){p.cert=null,p.asn1=r}};break;default:var c=new Error("Unsupported PKCS#12 SafeBag type.");throw c.oid=p.type,c}if(void 0!==d&&!l.validate(m,d,a,s)){var c=new Error("Cannot read PKCS#12 "+d.name);throw c.errors=s,c}h()}return n}function u(e){var t={};if(void 0!==e)for(var r=0;r<e.length;++r){var n={},o=[];if(!l.validate(e[r],m,n,o)){var i=new Error("Cannot read PKCS#12 BagAttribute.");throw i.errors=o,i}var a=l.derToOid(n.oid);if(void 0!==f.oids[a]){t[f.oids[a]]=[];for(var s=0;s<n.values.length;++s)t[f.oids[a]].push(n.values[s].value)}}return t}var c=r(1);r(7),r(14),r(11),r(55),r(47),r(6),r(20),r(15),r(2),r(32);var l=c.asn1,f=c.pki,p=e.exports=c.pkcs12=c.pkcs12||{},d={name:"ContentInfo",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.contentType",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:l.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"content"}]},h={name:"PFX",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.version",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"version"},d,{name:"PFX.macData",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"mac",value:[{name:"PFX.macData.mac",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"macAlgorithm"},{name:"PFX.macData.mac.digestAlgorithm.parameters",tagClass:l.Class.UNIVERSAL,captureAsn1:"macAlgorithmParameters"}]},{name:"PFX.macData.mac.digest",tagClass:l.Class.UNIVERSAL,type:l.Type.OCTETSTRING,constructed:!1,capture:"macDigest"}]},{name:"PFX.macData.macSalt",tagClass:l.Class.UNIVERSAL,type:l.Type.OCTETSTRING,constructed:!1,capture:"macSalt"},{name:"PFX.macData.iterations",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,optional:!0,capture:"macIterations"}]}]},y={name:"SafeBag",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"SafeBag.bagId",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"bagId"},{name:"SafeBag.bagValue",tagClass:l.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"bagValue"},{name:"SafeBag.bagAttributes",tagClass:l.Class.UNIVERSAL,type:l.Type.SET,constructed:!0,optional:!0,capture:"bagAttributes"}]},m={name:"Attribute",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"Attribute.attrId",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"oid"},{name:"Attribute.attrValues",tagClass:l.Class.UNIVERSAL,type:l.Type.SET,constructed:!0,capture:"values"}]},g={name:"CertBag",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"CertBag.certId",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"certId"},{name:"CertBag.certValue",tagClass:l.Class.CONTEXT_SPECIFIC,constructed:!0,value:[{name:"CertBag.certValue[0]",tagClass:l.Class.UNIVERSAL,type:l.Class.OCTETSTRING,constructed:!1,capture:"cert"}]}]};p.pkcs12FromAsn1=function(e,t,r){"string"==typeof t?(r=t,t=!0):void 0===t&&(t=!0);var a={},s=[];if(!l.validate(e,h,a,s)){var u=new Error("Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX.");throw u.errors=u,u}var d={version:a.version.charCodeAt(0),safeContents:[],getBags:function(e){var t,r={};return"localKeyId"in e?t=e.localKeyId:"localKeyIdHex"in e&&(t=c.util.hexToBytes(e.localKeyIdHex)),void 0===t&&!("friendlyName"in e)&&"bagType"in e&&(r[e.bagType]=n(d.safeContents,null,null,e.bagType)),void 0!==t&&(r.localKeyId=n(d.safeContents,"localKeyId",t,e.bagType)),"friendlyName"in e&&(r.friendlyName=n(d.safeContents,"friendlyName",e.friendlyName,e.bagType)),r},getBagsByFriendlyName:function(e,t){return n(d.safeContents,"friendlyName",e,t)},getBagsByLocalKeyId:function(e,t){return n(d.safeContents,"localKeyId",e,t)}};if(3!==a.version.charCodeAt(0)){var u=new Error("PKCS#12 PFX of version other than 3 not supported.");throw u.version=a.version.charCodeAt(0),u}if(l.derToOid(a.contentType)!==f.oids.data){var u=new Error("Only PKCS#12 PFX in password integrity mode supported.");throw u.oid=l.derToOid(a.contentType),u}var y=a.content.value[0];if(y.tagClass!==l.Class.UNIVERSAL||y.type!==l.Type.OCTETSTRING)throw new Error("PKCS#12 authSafe content data is not an OCTET STRING.");if(y=o(y),a.mac){var m=null,g=0,v=l.derToOid(a.macAlgorithm);switch(v){case f.oids.sha1:m=c.md.sha1.create(),g=20;break;case f.oids.sha256:m=c.md.sha256.create(),g=32;break;case f.oids.sha384:m=c.md.sha384.create(),g=48;break;case f.oids.sha512:m=c.md.sha512.create(),g=64;break;case f.oids.md5:m=c.md.md5.create(),g=16}if(null===m)throw new Error("PKCS#12 uses unsupported MAC algorithm: "+v);var b=new c.util.ByteBuffer(a.macSalt),E="macIterations"in a?parseInt(c.util.bytesToHex(a.macIterations),16):1,C=p.generateKey(r,b,3,E,g,m),_=c.hmac.create();_.start(m,C),_.update(y.value);if(_.getMac().getBytes()!==a.macDigest)throw new Error("PKCS#12 MAC could not be verified. Invalid password?")}return i(d,y.value,t,r),d},p.toPkcs12Asn1=function(e,t,r,n){n=n||{},n.saltSize=n.saltSize||8,n.count=n.count||2048,n.algorithm=n.algorithm||n.encAlgorithm||"aes128","useMac"in n||(n.useMac=!0),"localKeyId"in n||(n.localKeyId=null),"generateLocalKeyId"in n||(n.generateLocalKeyId=!0);var o,i=n.localKeyId;if(null!==i)i=c.util.hexToBytes(i);else if(n.generateLocalKeyId)if(t){var a=c.util.isArray(t)?t[0]:t;"string"==typeof a&&(a=f.certificateFromPem(a));var s=c.md.sha1.create();s.update(l.toDer(f.certificateToAsn1(a)).getBytes()),i=s.digest().getBytes()}else i=c.random.getBytes(20);var u=[];null!==i&&u.push(l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(f.oids.localKeyId).getBytes()),l.create(l.Class.UNIVERSAL,l.Type.SET,!0,[l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,i)])])),"friendlyName"in n&&u.push(l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(f.oids.friendlyName).getBytes()),l.create(l.Class.UNIVERSAL,l.Type.SET,!0,[l.create(l.Class.UNIVERSAL,l.Type.BMPSTRING,!1,n.friendlyName)])])),u.length>0&&(o=l.create(l.Class.UNIVERSAL,l.Type.SET,!0,u));var d=[],h=[];null!==t&&(h=c.util.isArray(t)?t:[t]);for(var y=[],m=0;m<h.length;++m){t=h[m],"string"==typeof t&&(t=f.certificateFromPem(t));var g=0===m?o:void 0,v=f.certificateToAsn1(t),b=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(f.oids.certBag).getBytes()),l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(f.oids.x509Certificate).getBytes()),l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,l.toDer(v).getBytes())])])]),g]);y.push(b)}if(y.length>0){var E=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,y),C=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(f.oids.data).getBytes()),l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,l.toDer(E).getBytes())])]);d.push(C)}var _=null;if(null!==e){var w=f.wrapRsaPrivateKey(f.privateKeyToAsn1(e));_=null===r?l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(f.oids.keyBag).getBytes()),l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[w]),o]):l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(f.oids.pkcs8ShroudedKeyBag).getBytes()),l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[f.encryptPrivateKeyInfo(w,r,n)]),o]);var T=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[_]),S=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(f.oids.data).getBytes()),l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,l.toDer(T).getBytes())])]);d.push(S)}var I,A=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,d);if(n.useMac){var s=c.md.sha1.create(),k=new c.util.ByteBuffer(c.random.getBytes(n.saltSize)),B=n.count,e=p.generateKey(r,k,3,B,20),R=c.hmac.create();R.start(s,e),R.update(l.toDer(A).getBytes());var P=R.getMac();I=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(f.oids.sha1).getBytes()),l.create(l.Class.UNIVERSAL,l.Type.NULL,!1,"")]),l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,P.getBytes())]),l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,k.getBytes()),l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(B).getBytes())])}return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(3).getBytes()),l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(f.oids.data).getBytes()),l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,l.toDer(A).getBytes())])]),I])},p.generateKey=c.pbe.generatePkcs12Key},function(e,t,r){var n=r(1);r(7),r(2);var o=n.asn1,i=e.exports=n.pkcs7asn1=n.pkcs7asn1||{};n.pkcs7=n.pkcs7||{},n.pkcs7.asn1=i;var a={name:"ContentInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:o.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};i.contentInfoValidator=a;var s={name:"EncryptedContentInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:o.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:o.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};i.envelopedDataValidator={name:"EnvelopedData",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:o.Class.UNIVERSAL,type:o.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(s)},i.encryptedDataValidator={name:"EncryptedData",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"version"}].concat(s)};var u={name:"SignerInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:o.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:o.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:o.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};i.signedDataValidator={name:"SignedData",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:o.Class.UNIVERSAL,type:o.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},a,{name:"SignedData.Certificates",tagClass:o.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:o.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:o.Class.UNIVERSAL,type:o.Type.SET,capture:"signerInfos",optional:!0,value:[u]}]},i.recipientInfoValidator={name:"RecipientInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:o.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter"}]},{name:"RecipientInfo.encryptedKey",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}},function(e,t,r){var n=r(1);r(2),n.mgf=n.mgf||{},(e.exports=n.mgf.mgf1=n.mgf1=n.mgf1||{}).create=function(e){return{generate:function(t,r){for(var o=new n.util.ByteBuffer,i=Math.ceil(r/e.digestLength),a=0;a<i;a++){var s=new n.util.ByteBuffer;s.putInt32(a),e.start(),e.update(t+s.getBytes()),o.putBuffer(e.digest())}return o.truncate(o.length()-r),o.getBytes()}}}},function(e,t,r){var n=r(1);e.exports=n.debug=n.debug||{},n.debug.storage={},n.debug.get=function(e,t){var r;return void 0===e?r=n.debug.storage:e in n.debug.storage&&(r=void 0===t?n.debug.storage[e]:n.debug.storage[e][t]),r},n.debug.set=function(e,t,r){e in n.debug.storage||(n.debug.storage[e]={}),n.debug.storage[e][t]=r},n.debug.clear=function(e,t){void 0===e?n.debug.storage={}:e in n.debug.storage&&(void 0===t?delete n.debug.storage[e]:delete n.debug.storage[e][t])}},function(e,t,r){var n=r(1);r(2),e.exports=n.log=n.log||{},n.log.levels=["none","error","warning","info","debug","verbose","max"];var o={},i=[],a=null;n.log.LEVEL_LOCKED=2,n.log.NO_LEVEL_CHECK=4,n.log.INTERPOLATE=8;for(var s=0;s<n.log.levels.length;++s){var u=n.log.levels[s];o[u]={index:s,name:u.toUpperCase()}}n.log.logMessage=function(e){for(var t=o[e.level].index,r=0;r<i.length;++r){var a=i[r];if(a.flags&n.log.NO_LEVEL_CHECK)a.f(e);else{t<=o[a.level].index&&a.f(a,e)}}},n.log.prepareStandard=function(e){"standard"in e||(e.standard=o[e.level].name+" ["+e.category+"] "+e.message)},n.log.prepareFull=function(e){if(!("full"in e)){var t=[e.message];t=t.concat([]||e.arguments),e.full=n.util.format.apply(this,t)}},n.log.prepareStandardFull=function(e){"standardFull"in e||(n.log.prepareStandard(e),e.standardFull=e.standard)};for(var c=["error","warning","info","debug","verbose"],s=0;s<c.length;++s)!function(e){n.log[e]=function(t,r){var o=Array.prototype.slice.call(arguments).slice(2),i={timestamp:new Date,level:e,category:t,message:r,arguments:o};n.log.logMessage(i)}}(c[s]);if(n.log.makeLogger=function(e){var t={flags:0,f:e};return n.log.setLevel(t,"none"),t},n.log.setLevel=function(e,t){var r=!1;if(e&&!(e.flags&n.log.LEVEL_LOCKED))for(var o=0;o<n.log.levels.length;++o){var i=n.log.levels[o];if(t==i){e.level=t,r=!0;break}}return r},n.log.lock=function(e,t){void 0===t||t?e.flags|=n.log.LEVEL_LOCKED:e.flags&=~n.log.LEVEL_LOCKED},n.log.addLogger=function(e){i.push(e)},"undefined"!=typeof console&&"log"in console){var l;if(console.error&&console.warn&&console.info&&console.debug){var f={error:console.error,warning:console.warn,info:console.info,debug:console.debug,verbose:console.debug},p=function(e,t){n.log.prepareStandard(t);var r=f[t.level],o=[t.standard];o=o.concat(t.arguments.slice()),r.apply(console,o)};l=n.log.makeLogger(p)}else{var p=function(e,t){n.log.prepareStandardFull(t),console.log(t.standardFull)};l=n.log.makeLogger(p)}n.log.setLevel(l,"debug"),n.log.addLogger(l),a=l}else console={log:function(){}};if(null!==a){var d=n.util.getQueryVariables();if("console.level"in d&&n.log.setLevel(a,d["console.level"].slice(-1)[0]),"console.lock"in d){"true"==d["console.lock"].slice(-1)[0]&&n.log.lock(a)}}n.log.consoleLogger=a},function(e,t,r){"use strict";t.__esModule=!0;var n={UPLOADING:"uploading",FILE_ERROR:"file-error",PROCESSING:"processing",ARCHIVED:"archived",PROOFERS_NEEDED:"proofers-needed",TODOS_REQUESTED:"todos-requested",AWAITING_NEW_VERSION:"awaiting-new-version",HAS_NEW_VERSION:"has-new-version",APPROVED:"approved",NOT_STARTED:"not-started",OVERDUE:"overdue",ACTIVE:"active",SETUP_NEEDED:"setup-needed",BRIEFING:"briefing",AWAITING_PROOF:"awaiting-proof"};t.default=n},function(e,t,r){"use strict";t.__esModule=!0;var n={PROOF:1,BRIEF:2};t.default=n},function(e,t,r){"use strict";var n={Proof:"P",Workflow:"W",File:"F",User:"U",Brief:"B"},o={};Object.keys(n).forEach(function(e){o["is"+e+"Id"]=function(t){return t&&16===t.length&&t[0]===n[e]}}),e.exports=o},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=r(3),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a={id:"ProofId",version:"Version",canDelete:"CanDelete"},s=function(){function e(){n(this,e)}return e.prototype.fromProofVersion=function(e){return(0,i.default)(this,a,e),this},e}();t.default=s},function(e,t,r){"use strict";function n(e,t){return o(function(t){return t[e]},t)}function o(e,t){var r=t?1:-1,n=t?-1:1;return function(t,o){var i=e(t),a=e(o);return i<a?r:i>a?n:0}}function i(e,t){var r={};t.forEach(function(e,t){r[e]=t});var n="function"==typeof e?e:function(t){return t[e]};return function(e,t){var o=r[n(e)],i=r[n(t)];return o<i?-1:o>i?1:0}}function a(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=t.length;return function(e,r){for(var o=0;o<n;o++){var i=t[o](e,r);if(i)return i}return 0}}t.__esModule=!0,t.sortObjectsByKey=n,t.sortObjectsBy=o,t.sortObjectsByValues=i,t.combineSort=a},function(e,t,r){"use strict";function n(e){return String.fromCharCode.apply(null,new Uint8Array(e))}t.__esModule=!0,t.default=n},function(e,t,r){"use strict";t.__esModule=!0;var n={NONE:"none",GOOGLE_DRIVE:"drive",DROPBOX:"dropbox",ONEDRIVE:"onedrive",BOX:"box",CANVA:"canva",WEBSITE:"website"};t.default=n},function(e,t,r){"use strict";function n(e,t){var r=void 0;return function(){r||(r=setTimeout(function(){e(),r=null},t))}}t.__esModule=!0,t.default=n},function(e,t,r){"use strict";t.__esModule=!0,t.default=function(e,t,r){return new Promise(function(n,o){setTimeout(function(){void 0!==r?o(r):n(t)},e)})}},function(e,t,r){"use strict";t.__esModule=!0;var n={NONE:null,NOT_VISIBLE:"not-visible",VISIBLE:"visible",SEEN:"seen",SKIPPED:"skipped",FINISHED:"finished"};t.default=n},function(e,t,r){"use strict";t.__esModule=!0;var n={NONE:null,NOT_VISIBLE:"not-visible",VISIBLE:"visible",COMPLETE:"complete"};t.default=n},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(0),u=function(e){return e&&e.__esModule?e:{default:e}}(s),c=function(e){function t(r,i){n(this,t);var a=o(this,e.call(this,r));return a.level=i,a}return i(t,e),t.prototype.configurations=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return this.client.request("integrations.get-configurations",{level:this.level,integration_keys:e.join(",")}).then(function(e){return e.data?e.data.integrations:null})},t.prototype.getSetupUrl=function(e,t){return this.client.request("integrations.get-setup-url",{params:a({},t,{integration_key:e,level:this.level})}).then(function(e){return{url:e.data.url,windowFeatures:e.data.windowFeatures}})},t.prototype.disable=function(e){return this.client.request("integrations.disable",{level:this.level,integration_key:e})},t.prototype.updateConfiguration=function(e,t,r){return this.client.request("integrations.update-configuration",{level:this.level,integrationKey:e,key:t,value:r})},t}(u.default);t.default=c},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},a=r(3),s=n(a),u=r(9),c=n(u),l=r(36),f=n(l),p=r(39),d=n(p),h=r(72),y=n(h),m=r(73),g={id:"CommentId",proofId:"ProofId",pins:function(e){return(0,m.parsePins)(e.XY).map(function(t,r){return 0===r&&e.BoxFillType?i({},t,{fill:e.BoxFillType&&{type:e.BoxFillType,image:e.BoxFillImage}}):t})},pin:function(){return this.pins[0]},user:function(e){return(new c.default).fromUser(e)},comment$:"EncryptedComment",envelope:"Envelope",attachments:function(e){return e.Attachments?e.Attachments.map(function(t){return(new f.default).fromCommentAttachment(i({CommentId:e.CommentId},t))}):[]},agreeCount:function(e){return e.Agrees.length},pageNumber:(0,a.number)("Page"),mediaTime:function(){return this.pin&&this.pin.time},mediaDuration:function(){return this.pin&&this.pin.duration},createdDate:(0,a.date)("Timestamp"),updatedDate:(0,a.date)("Updated"),parentCommentId:(0,a.optional)("Parent"),metadata:(0,a.json)("Metadata",{}),sourceMetadata:"SourceMetadata",state:function(e){return(0,y.default)(e)},isPrivate:"Private"},v=function(){function e(){o(this,e)}return e.prototype.fromComment=function(e){return(0,s.default)(this,g,e),this},e.prototype.fromRawComment=function(e){var t=(0,d.default)(e);return this.raw=e,this.tokens=t,this},e}();t.default=v},function(e,t,r){"use strict";function n(e){return+e.Done?i.default.DONE:+e.Change?i.default.TODO:i.default.UNMARKED}t.__esModule=!0;var o=r(41),i=function(e){return e&&e.__esModule?e:{default:e}}(o);t.default=n},function(e,t,r){"use strict";function n(e){if("{"===e[0]){var t=JSON.parse(e);return t.pins?[3,t.pins]:[2,t]}return-1!==e.indexOf(",")?[1,e]:[null]}function o(e){var t=e.split(",").map(function(e){return parseFloat(e)}),r=t[0],n=t[1];return[c({x:r,y:n})]}function i(e){return[c(e)]}function a(e){return e.map(c)}function s(e){if(null==e)return[];var t=[],r=n(e),s=r[0],u=r[1];switch(s){case 3:t=a(u);break;case 2:t=i(u);break;case 1:t=o(u)}return t}t.__esModule=!0,t.parsePins=s;var u=r(74),c=function(e){return{x:(0,u.withinPinBounds)((0,u.numberOrNull)(e.x)),y:(0,u.withinPinBounds)((0,u.numberOrNull)(e.y)),x2:(0,u.withinPinBounds)((0,u.numberOrNull)(e.x2)),y2:(0,u.withinPinBounds)((0,u.numberOrNull)(e.y2)),time:(0,u.numberOrNull)(e.time),duration:(0,u.numberOrNull)(e.duration)}}},function(e,t,r){"use strict";function n(e){return o(e)?e:null}function o(e){return"number"==typeof e&&!isNaN(e)}function i(e){return o(e)?Math.max(-.5,Math.min(.5,e)):e}t.__esModule=!0,t.numberOrNull=n,t.isFiniteNumber=o,t.withinPinBounds=i},function(e,t,r){"use strict";function n(e){var t=[];return e.blocks.forEach(function(e){e.entities.forEach(function(e){if("mention"===e.type){var r=e.metadata.id;-1===t.indexOf(r)&&t.push(r)}})}),t}t.__esModule=!0,t.default=n},function(e,t,r){"use strict";function n(e,t){for(var r=new Array(t),n=t;n>0;--n)r[n]=e[Math.round(Math.random()*(e.length-1))];return r.join("")}t.__esModule=!0;t.lower="abcdefghijklmnopqrstuvwxyz",t.upper="ABCDEFGHIJKLMNOPQRSTUVWXYZ",t.numbers="0123456789",t.symbols="~`!@#$%^&*()_+-={}[]:\";'<>?,./|\\";t.default=n},function(e,t,r){"use strict";function n(e,t){if(!(0,i.isFiniteNumber)(t.x)||!(0,i.isFiniteNumber)(t.y))throw new Error("Malformed pin. Pins must contain, at minimum, an x and y coordinate.");return e.x=(0,i.withinPinBounds)(t.x),e.y=(0,i.withinPinBounds)(t.y),(0,i.isFiniteNumber)(t.x2)&&(e.x2=(0,i.withinPinBounds)(t.x2)),(0,i.isFiniteNumber)(t.y2)&&(e.y2=(0,i.withinPinBounds)(t.y2)),(0,i.isFiniteNumber)(t.time)&&(e.time=t.time),(0,i.isFiniteNumber)(t.duration)&&(e.duration=t.duration),e}function o(e){if(0===e.length)return"";var t={};return n(t,e[0]),e.length>1&&(t.pins=e.map(function(e){return n({},e)})),JSON.stringify(t)}t.__esModule=!0,t.serializePins=o;var i=r(74)},function(e,t,r){"use strict";function n(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return e.map(function(e,t){return e+(void 0!==r[t]?r[t]:"")}).join("")}t.__esModule=!0,t.gql=n},function(e,t,r){"use strict";function n(e){return"string"==typeof e?e.replace(/</g,"&lt;").replace(/>/g,"&gt;"):e}t.__esModule=!0,t.default=n},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function a(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments[2],n=arguments[3],o=0,a=[].concat(i(e),i(t)).sort(function(e,t){return e.offset-t.offset}),s=[];return a.length<1?(s.push(new d.default({block:n,start:0,end:r.length})),s):(a.forEach(function(e){e.offset>o&&s.push(new d.default({block:n,start:o,end:e.offset})),s.push(new d.default({block:n,entity:e.key,decorator:e.component,decoratorProps:e.decoratorProps,decoratedText:e.component?h(r,e.offset,e.offset+e.length):void 0,start:e.offset,end:e.offset+e.length,contentState:e.contentState})),o=e.offset+e.length}),o<r.length&&s.push(new d.default({block:n,start:o,end:r.length})),s)}function s(e,t){return t.forEach(function(t){e.push(t.offset),e.push(t.offset+t.length)}),e}function u(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],o=[];return o=s(o,t),o=s(o,r),o=s(o,n),o.push(0),o.push(e.length),o.filter(function(e,t,r){return r.indexOf(e)===t}).sort(function(e,t){return e-t})}Object.defineProperty(t,"__esModule",{value:!0});var c=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),l=r(81),f=n(l),p=r(207),d=n(p),h=function(e,t,r){return f.default.ucs2.encode(e.slice(t,r))},y=function(){function e(t){var r=t.flat,n=void 0!==r&&r;o(this,e),this.flat=n}return c(e,[{key:"relevantStyles",value:function(e){return this.ranges.filter(function(t){return e>=t.offset&&e<t.offset+t.length}).map(function(e){return e.style})}},{key:"nodeIterator",value:function(e,t,r){var n=this,o=this.relevantIndexes.slice(this.relevantIndexes.indexOf(t),this.relevantIndexes.indexOf(r));return o.forEach(function(t,i){var a=n.relevantStyles(t),s=o[i+1]?o[i+1]-t:1,u=h(n.textArray,t,t+s);e.pushContent(u,a,n.flat),!o[i+1]&&t<r&&e.pushContent(h(n.textArray,t+1,r),n.relevantStyles(r-1),n.flat)}),e}},{key:"parse",value:function(e){var t=this,r=e.text,n=e.inlineStyleRanges,o=e.entityRanges,i=e.decoratorRanges,s=void 0===i?[]:i;this.textArray=f.default.ucs2.decode(r),this.ranges=n,this.iterator=0,this.relevantIndexes=u(r,n,o,s);var c=a(o,s,this.textArray,e),l=c.map(function(e){return t.nodeIterator(e,e.start,e.end)});return new d.default({block:e,content:l})}}]),e}();t.default=y},function(e,t,r){"use strict";function n(e){throw new RangeError(f[e])}function o(e,t){for(var r=[],n=e.length;n--;)r[n]=t(e[n]);return r}function i(e,t){var r=e.split("@"),n="";return r.length>1&&(n=r[0]+"@",e=r[1]),e=e.replace(l,"."),n+o(e.split("."),t).join(".")}function a(e){for(var t=[],r=0,n=e.length;r<n;){var o=e.charCodeAt(r++);if(o>=55296&&o<=56319&&r<n){var i=e.charCodeAt(r++);56320==(64512&i)?t.push(((1023&o)<<10)+(1023&i)+65536):(t.push(o),r--)}else t.push(o)}return t}t.__esModule=!0;var s=2147483647,u=/^xn--/,c=/[^\0-\x7E]/,l=/[\x2E\u3002\uFF0E\uFF61]/g,f={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},p=Math.floor,d=String.fromCharCode,h=function(e){return String.fromCodePoint.apply(String,e)},y=function(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:36},m=function(e,t){return e+22+75*(e<26)-((0!=t)<<5)},g=function(e,t,r){var n=0;for(e=r?p(e/700):e>>1,e+=p(e/t);e>455;n+=36)e=p(e/35);return p(n+36*e/(e+38))},v=function(e){var t=[],r=e.length,o=0,i=128,a=72,u=e.lastIndexOf("-");u<0&&(u=0);for(var c=0;c<u;++c)e.charCodeAt(c)>=128&&n("not-basic"),t.push(e.charCodeAt(c));for(var l=u>0?u+1:0;l<r;){for(var f=o,d=1,h=36;;h+=36){l>=r&&n("invalid-input");var m=y(e.charCodeAt(l++));(m>=36||m>p((s-o)/d))&&n("overflow"),o+=m*d;var v=h<=a?1:h>=a+26?26:h-a;if(m<v)break;var b=36-v;d>p(s/b)&&n("overflow"),d*=b}var E=t.length+1;a=g(o-f,E,0==f),p(o/E)>s-i&&n("overflow"),i+=p(o/E),o%=E,t.splice(o++,0,i)}return String.fromCodePoint.apply(String,t)},b=function(e){var t=[];e=a(e);for(var r=e.length,o=128,i=0,u=72,c=e,l=Array.isArray(c),f=0,c=l?c:c[Symbol.iterator]();;){var h;if(l){if(f>=c.length)break;h=c[f++]}else{if(f=c.next(),f.done)break;h=f.value}var y=h;y<128&&t.push(d(y))}var v=t.length,b=v;for(v&&t.push("-");b<r;){for(var E=s,C=e,_=Array.isArray(C),w=0,C=_?C:C[Symbol.iterator]();;){var T;if(_){if(w>=C.length)break;T=C[w++]}else{if(w=C.next(),w.done)break;T=w.value}var S=T;S>=o&&S<E&&(E=S)}var I=b+1;E-o>p((s-i)/I)&&n("overflow"),i+=(E-o)*I,o=E;for(var A=e,k=Array.isArray(A),B=0,A=k?A:A[Symbol.iterator]();;){var R;if(k){if(B>=A.length)break;R=A[B++]}else{if(B=A.next(),B.done)break;R=B.value}var P=R;if(P<o&&++i>s&&n("overflow"),P==o){for(var O=i,D=36;;D+=36){var N=D<=u?1:D>=u+26?26:D-u;if(O<N)break;var L=O-N,U=36-N;t.push(d(m(N+L%U,0))),O=p(L/U)}t.push(d(m(O,0))),u=g(i,I,b==v),i=0,++b}}++i,++o}return t.join("")},E=function(e){return i(e,function(e){return u.test(e)?v(e.slice(4).toLowerCase()):e})},C=function(e){return i(e,function(e){return c.test(e)?"xn--"+b(e):e})},_={version:"2.1.0",ucs2:{decode:a,encode:h},decode:v,encode:b,toASCII:C,toUnicode:E};t.ucs2decode=a,t.ucs2encode=h,t.decode=v,t.encode=b,t.toASCII=C,t.toUnicode=E,t.default=_},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t,r){for(var n=t;n<r;n++)if(null!=e[n])return!1;return!0}function i(e,t,r,n){for(var o=t;o<r;o++)e[o]=n}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),s=function(){function e(t){n(this,e),this.decorators=t.slice()}return a(e,[{key:"getDecorations",value:function(e,t){var r=Array(e.getText().length).fill(null);return this.decorators.forEach(function(n,a){var s=0;(0,n.strategy)(e,function(e,t){o(r,e,t)&&(i(r,e,t,a+"."+s),s++)},t)}),r}},{key:"getComponentForKey",value:function(e){var t=parseInt(e.split(".")[0],10);return this.decorators[t].component}},{key:"getPropsForKey",value:function(e){var t=parseInt(e.split(".")[0],10);return this.decorators[t].props}}]),e}();t.default=s},function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function o(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0,t.version=t.util=t.Model=t.Enum=t.Bluffer=t.Client=void 0;var i=r(84),a=o(i),s=r(4),u=o(s),c=r(193),l=n(c),f=r(202),p=n(f),d=r(27),h=o(d),y=r(203),m=n(y);t.default=a.default,t.Client=a.default,t.Bluffer=u.default,t.Enum=l,t.Model=p,t.util=m,t.version=h.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=r(85),a=n(i),s=r(90),u=n(s),c=r(91),l=n(c),f=r(94),p=n(f),d=r(96),h=n(d),y=r(108),m=n(y),g=r(114),v=n(g),b=r(115),E=n(b),C=r(139),_=n(C),w=r(140),T=n(w),S=r(144),I=n(S),A=r(166),k=n(A),B=r(168),R=n(B),P=r(170),O=n(P),D=r(174),N=n(D),L=r(175),U=n(L),x=r(176),M=n(x),V=r(177),j=n(V),F=r(178),q=n(F),K=r(18),G=n(K),z=r(179),H=n(z),W=r(16),Q=n(W),X=r(67),Y=n(X),Z=r(5),$=r(180),J=n($),ee=r(181),te=r(182),re=r(183),ne=n(re),oe=r(184),ie=n(oe),ae=r(187),se=n(ae),ue=r(188),ce=n(ue),le=r(189),fe=n(le),pe=r(190),de=n(pe),he=r(27),ye=n(he),me=r(192),ge=n(me),ve=r(34)("PageProof"),be=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.options,n=void 0===r?{}:r,i=t.adapters,s=void 0===i?[]:i;o(this,e),this.options=n,this.clientId=n.clientId||(0,ge.default)(),this.events=new H.default,this.adapters=new a.default(s),this.cache=new u.default(this),this.keyPairs=new fe.default(this),this.accounts=new h.default(this),this.comments=new O.default(this),this.dashboard=new m.default(this),this.files=new T.default(this),this.profile=new N.default(this),this.proofs=new E.default(this),this.briefs=new _.default(this),this.users=new v.default(this),this.workflows=new k.default(this),this.preferences=new R.default(this),this.sessions=new U.default(this),this.encryption=new M.default(this),this.live=new j.default(this),this.reports=new ne.default(this),this.teams=new ie.default(this),this.printing=new se.default(this),this.freeTrial=new ce.default(this),this.checklistTemplates=new de.default(this),this.__admin=new I.default(this),this._hijackAdmin(),this._init(),this._registerCoreHooks(),this._enhance()}return e.prototype._init=function(){var e=this.adapters.getRequestAdapter();if(this.options.endpoint||(this.options.endpoint=e.options.endpoint),this.options.applicationId||(this.options.applicationId=e.options.applicationId),this.options.subscriptionKey||(this.options.subscriptionKey=e.options.key||this.options.key),this.options.subscriptionKey&&!this.options.applicationId)throw new Error("You must provide an applicationId.")},e.prototype._hijackAdmin=function(){var e=this;Object.getOwnPropertyNames(this.__admin).forEach(function(t){return e.admin[t]=e.__admin[t]})},e.prototype._registerCoreHooks=function(){this.on("error.throttled",function(e){var t=e.data.response.data.timeout;return ve("Sleeping "+t+"ms until rate limit resets"),(0,Y.default)(t)})},e.prototype._enhance=function(){var e=this;this.adapters.getEnhancementAdapters().forEach(function(t){return t.onClientReady(e)})},e.prototype.setSession=function(e){return!e||e instanceof G.default?this.session=e||null:this.session=(new G.default).fromJSON(e),this.session},e.prototype.rawRequest=function(e,t){var r=e.method,n=e.url,o=e.host,i=e.path,a=e.query,s=e.body,u=e.headers,c=this.adapters.getRequestAdapter();return n&&(o=n.origin,i=n.pathname,a=n.search),c.send({host:o,method:r,path:i,query:a,body:s,headers:u,credentials:!1},t)},e.prototype.getRequestLocalEncodedMetadata=function(){return[(0,J.default)()].map(function(e){return null!==e&&void 0!==e?encodeURIComponent(e):"#"}).join(":")},e.prototype.request=function(e,t,r){var n=this,o=new l.default(this.options.endpoint,e,t),i=this.adapters.getRequestAdapter(),a=Promise.resolve();if(!o.endpoint.anonymous){if(!this.session)return Promise.reject(new Error("Cannot make call to endpoint ("+e+") when unauthorized."));a=this.adapters.getCryptoAdapter().generateAuthorizationHeaders(o.getMethod(),o.getPath(),this.session).then(function(e){return o.addHeaders(e)})}this.options.applicationId&&o.addHeader(Z.DEVICE_ID_HEADER,this.options.applicationId),this.options.subscriptionKey&&o.addHeader(Z.SUBSCRIPTION_KEY_HEADER,this.options.subscriptionKey),"graphql"===e&&(o.addHeader("apollographql-client-name",this.options.applicationId?this.options.applicationId+" (via @pageproof/sdk)":"@pageproof/sdk"),o.addHeader("apollographql-client-version",ye.default),this.clientId&&o.addHeader("spider-client-id",this.clientId));var s=this.getRequestLocalEncodedMetadata();s&&o.addHeader(Z.LOCAL_ENCODED_METADATA_HEADER,s);var u={request:o};return a.then(function(){var e=o.build();return n.events.emit("experimental.request.before",u,!0).then(function(){return e})}).then(function(e){return i.send(e,r)}).then(p.default.parse).then(function(o){if(u.response=o,n.events.emit("experimental.request.after",u),o.code===Q.default.ERROR_THROTTLED){var i=n.events.emit("error.throttled",u);if(i.some(Boolean))return Promise.all(i).then(function(){return n.events.emit("experimental.request.retry",u),n.request(e,t,r)})}if(o.code===Q.default.ERROR_UNAUTHORISED){var a=n.session?n.session.token:null;return n.events.emit("error.unauthorized",u,!0).then(function(){return n.session&&n.session.token!==a?n.request(e,t,r):o})}if(o.deprecated){var s="The "+e+" API has been deprecated. "+(o.deprecated||"");n.events.emit("error.deprecated",{name:e,message:s})}return o}).then(function(t){try{if(t.error){n.events.emit("error.response",u);var r=new Error(t.message+" ["+e+"]");return r.response=t,r.request=o,Promise.reject(r)}return n.events.emit("experimental.request.resolve",u),Promise.resolve(t)}finally{n.events.emit("experimental.request.finally",u)}})},e.prototype.graphql=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{throwOnError:!0,minifyDocument:!0},n=!r||!1!==r.throwOnError,o=!0===r.minifyDocument,i=o?e.replace(/\s+/g," ").replace(/ { /g,"{").replace(/ } /g,"}").trim():e;return this.request("graphql",{query:i,variables:t}).then(function(e){var t=e.data;if(t.errors&&t.errors.length&&n){throw new ee.AggregateError("One or more GraphQL errors occurred.",t.errors.map(function(e){return new te.GraphQLError(e.message,e.locations,e.path)}))}return t})},e.prototype.admin=function(){return this.session?this.session.user.isAdmin?(this._admin||(this._admin=Promise.resolve(this.__admin)),this._admin):Promise.reject(new Error("The current user must be an administrator of a team or enterprise account.")):Promise.reject(new Error("You must be logged in to use the Admin API."))},e.prototype.brian=function(){return this.session&&this.session.userId===Z.BRIAN_USER_ID?(this._brian||(this._brian=Promise.resolve(new q.default(this))),this._brian):Promise.reject(new Error("You do not have permission to use this API."))},e.prototype.crypto=function(){return this.adapters.getCryptoAdapter()},e.prototype.protobuf=function(){return this.adapters.getProtobufAdapter()},e.prototype.on=function(e,t){return this.events.on(e,t)},e}();t.default=be},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=r(86),a=n(i),s=r(87),u=n(s),c=r(88),l=n(c),f=r(89),p=n(f),d=function(){function e(t){o(this,e),this.adapters=[].concat(t)}return e.prototype.getAdapterInstanceOf=function(e){return this.getAnyAdaptersInstanceOf(e)[0]||null},e.prototype.getAnyAdaptersInstanceOf=function(e){for(var t=[],r=e.__adapter__,n=0;n<this.adapters.length;n+=1)for(var o=this.adapters[n],i=o;null!==i;){if(i.constructor&&i.constructor.__adapter__===r){t.push(o);break}i=Object.getPrototypeOf(i)}return t},e.prototype.getCryptoAdapter=function(){var e=this.getAdapterInstanceOf(a.default);if(!e)throw new Error("ICryptoAdapter not found. This adapter is required for the SDK to function correctly.");return e},e.prototype.getRequestAdapter=function(){var e=this.getAdapterInstanceOf(u.default);if(!e)throw new Error("IRequestAdapter not found. This adapter is required for the SDK to function correctly.");return e},e.prototype.getCacheAdapter=function(){return this.getAdapterInstanceOf(l.default)},e.prototype.getEnhancementAdapters=function(){return this.getAnyAdaptersInstanceOf(p.default)},e.prototype.getProtobufAdapter=function(){return this.getAdapterInstanceOf({__adapter__:"ProtobufAdapter"})},e}();t.default=d},function(e,t,r){"use strict";function n(){}t.__esModule=!0,n.__adapter__="ICryptoAdapter",t.default=n},function(e,t,r){"use strict";function n(){}t.__esModule=!0,n.__adapter__="IRequestAdapter",t.default=n},function(e,t,r){"use strict";function n(){}t.__esModule=!0,n.__adapter__="ICacheAdapter",t.default=n},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t,r){var n=e[t];e[t]=function(){for(var e=arguments.length,t=Array(e),o=0;o<e;o++)t[o]=arguments[o];var i=n.bind.apply(n,[this].concat(t));return r(i,this,t).apply(this,t)}}function i(e){function t(o){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],a=Object.getOwnPropertyNames(o).filter(function(t){return o[t].client===e}),s=Object.getPrototypeOf(o),u=Object.keys(s).filter(function(e){return"function"==typeof s[e]&&0!==e.indexOf("_")});if(i.length||r){var c=i.join(".");0===c.indexOf("__")&&(c=c.substring(2)),u.forEach(function(e){n.push({namespace:c,name:e,api:o})})}a.forEach(function(e){t(o[e],i.concat(e))})}var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=[];return t(e),n}t.__esModule=!0;var a,s,u=(s=a=function(){function e(){n(this,e)}return e.prototype.onClientReady=function(e){var t=this;i(e).forEach(function(e){var r={api:e.api,namespace:e.namespace,name:e.name,displayName:e.namespace+"."+e.name};t.onMethodEnhance(r),o(e.api,e.name,function(e){return t.onMethodBefore(r),function(){var n=void 0;try{n=e()}catch(e){throw r.error=e,t.onMethodThrown(r),e}finally{r.value=n,t.onMethodAfter(r),n&&"function"==typeof n.then&&n.then(function(e){r.resolved=e,t.onMethodResolve(r)},function(e){r.rejected=e,t.onMethodReject(r)}).then(function(){t.onMethodFinally(r)})}return n}})}),e.on("experimental.request.before",function(e){return t.onRequestBefore(e.data)}),e.on("experimental.request.after",function(e){return t.onRequestAfter(e.data)}),e.on("error.response",function(e){return t.onRequestReject(e.data)}),e.on("error.throttled",function(e){return t.onRequestThrottled(e.data)}),e.on("experimental.request.retry",function(e){return t.onRequestRetry(e.data)}),e.on("error.unauthorized",function(e){return t.onRequestUnauthorized(e.data)}),e.on("error.deprecated",function(e){return t.onRequestDeprecated(e.data)}),e.on("experimental.request.resolve",function(e){return t.onRequestResolve(e.data)}),e.on("experimental.request.finally",function(e){return t.onRequestFinally(e.data)})},e.prototype.onMethodEnhance=function(e){},e.prototype.onMethodBefore=function(e){},e.prototype.onMethodAfter=function(e){},e.prototype.onMethodReject=function(e){},e.prototype.onMethodResolve=function(e){},e.prototype.onMethodFinally=function(e){},e.prototype.onMethodThrown=function(e){},e.prototype.onRequestBefore=function(e){},e.prototype.onRequestAfter=function(e){},e.prototype.onRequestReject=function(e){},e.prototype.onRequestThrottled=function(e){},e.prototype.onRequestRetry=function(e){},e.prototype.onRequestUnauthorized=function(e){},e.prototype.onRequestDeprecated=function(e){},e.prototype.onRequestResolve=function(e){},e.prototype.onRequestFinally=function(e){},e}(),a.__adapter__="IEnhancementAdapter",s);t.default=u},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=function(){function e(t){n(this,e),this.client=t}return e.prototype.auto=function(e,t){var r=this.client.adapters.getCacheAdapter(),n=function(){};return r?(n=function(t){void 0!==t&&r.set(e,t)},r.get(e).catch(function(){return Promise.resolve(t(n)).then(function(e){return n(e),e})})):Promise.resolve(t(n))},e}();t.default=o},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},a=r(92),s=n(a),u=r(26),c=n(u),l=r(27),f=n(l),p=r(5),d=function(){function e(t,r,n){if(o(this,e),this.host=t,this.name=r,this.endpoint=s.default[r],!this.endpoint)throw new Error('Unknown request endpoint "'+r+'".');this.params={},this.addParams(n),this.headers={}}return e.prototype.addHeaders=function(e){return this.headers=i({},this.headers,e),this},e.prototype.addHeader=function(e,t){return this.headers[e]=t,this},e.prototype.addParams=function(e){return this.params=i({},this.params,e),this},e.prototype.addParam=function(e,t){this.params[e]=t},e.prototype.getPath=function(){var e=this,t=this.endpoint,r=t.path,n=t.chain,o=t.trailing,i=r;return n&&n.forEach(function(t){"/"!==i[i.length-1]&&(i+="/"),i+=e.params[t]}),o&&"/"!==i[i.length-1]&&(i+="/"),i},e.prototype.getQuery=function(){var e=this,t=this.endpoint.query;if(t){var r=[];if("string"==typeof t){var n=this.params[t];(0,c.default)(n)&&Object.keys(n).forEach(function(e){void 0!==n[e]&&r.push(e+"="+encodeURIComponent(n[e]))})}else t.forEach(function(t){void 0!==e.params[t]&&r.push(t+"="+encodeURIComponent(e.params[t]))});if(r.length)return"?"+r.filter(Boolean).join("&")}return""},e.prototype.getHeaders=function(){var e,t=i({},this.headers,(e={},e[p.SDK_VERSION_HEADER]=f.default,e));if("POST"===this.endpoint.method||"PATCH"===this.endpoint.method||"PUT"===this.endpoint.method)switch(this.endpoint.version){case 2:t["Content-Type"]="application/json";break;case 1:default:t["Content-Type"]="application/x-www-form-urlencoded"}return t},e.prototype.getBody=function(){var e=this,t=this.endpoint;if(t.body){if("string"==typeof t.body){var r=this.params[t.body];return r=(0,c.default)(r)?JSON.stringify(r):String(r)}var n=!0===t.body?Object.keys(this.params):t.body,o={};switch(n.forEach(function(t){var r=e.params[t];void 0!==r&&(o[t]=r)}),t.version){case 2:return JSON.stringify(o);case 1:default:return Object.keys(o).map(function(t){return t+"="+encodeURIComponent(e.params[t])}).join("&")}}return null},e.prototype.getMethod=function(){return(this.endpoint.method||"GET").toUpperCase()},e.prototype.isWithCredentials=function(){return!0===this.endpoint.credentials},e.prototype.build=function(){return{host:this.host,method:this.getMethod(),path:this.getPath(),query:this.getQuery(),body:this.getBody(),headers:this.getHeaders(),credentials:this.isWithCredentials()}},e}();t.default=d},function(e,t){e.exports={"accounts.register":{method:"POST",path:"/api/users/register",body:["email","password","privateKey","publicKey","referrer"],anonymous:!0},"accounts.login":{method:"POST",path:"/api/users/login",body:["email","password","totp"],anonymous:!0},"accounts.generate-activation-code":{method:"GET",path:"/api/users/auth/generate",chain:["userId"],trailing:!0},"accounts.activate":{method:"POST",path:"/api/users/auth/activate",body:["userId","authCode"],trailing:!0},"accounts.forgot-password":{method:"POST",path:"/api/users/resetpasswordrequest",body:["email"],anonymous:!0},"accounts.set-password-request":{method:"POST",path:"/api/users/setpasswordrequest",body:["email"],anonymous:!0},"accounts.reset-password":{method:"POST",path:"/api/users/resetpassword",body:["email","secret","newPassword","newPrivateKey","newPublicKey"],anonymous:!0},"accounts.set-password":{method:"POST",path:"/api/users/setpassword",body:["email","secret","newPassword","newPrivateKey","newPublicKey"],anonymous:!0},"accounts.logout":{method:"GET",path:"/api/users/logout"},"profile.upload-avatar":{method:"POST",path:"/api/media/file/avatar",body:["uploadedImage"]},"profile.delete-avatar":{method:"POST",path:"/api/media/file/avatar/delete"},"profile.change-password":{method:"POST",path:"/api/users/changepassword",body:["oldPassword","newPassword","newPrivateKey"],trailing:!0},"profile.status":{method:"GET",path:"/api/users/status"},"profile.set-status":{version:2,method:"POST",path:"/api/users/status/set",body:["emoji","message","away"]},"profile.clear-status":{method:"POST",path:"/api/users/status/clear"},"preferences.all":{method:"GET",path:"/api/users/preferences/all"},"preferences.get":{method:"GET",path:"/api/users/preferences/get",query:["preferences"]},"preferences.update":{version:2,method:"POST",path:"/api/users/preferences/update",body:!0},"preferences.reset":{version:2,method:"POST",path:"/api/users/preferences/reset",body:["preferences"]},"dashboard.inbox":{method:"GET",path:"/api/proofs/dashboard/proofin",trailing:!0},"dashboard.sent":{method:"GET",path:"/api/proofs/dashboard/proofout",trailing:!0},"dashboard.outbox":{method:"GET",path:"/api/proofs/dashboard/proofoutbox",trailing:!0},"dashboard.briefs":{method:"GET",path:"/api/briefs/dashboard",trailing:!0},"dashboard.search":{method:"POST",path:"/api/proofs/search",body:["query","all","filterBy"]},"dashboard.groups.filter-by":{method:"GET",path:"/api/proofs/dashboard/groups",chain:["filterBy"],trailing:!0},"team.dashboard.inbox":{method:"GET",path:"/api/admin/dashboard/proofin",chain:["page"],trailing:!0},"team.dashboard.sent":{method:"GET",path:"/api/admin/dashboard/proofsent",chain:["page"],trailing:!0},"team.dashboard.outbox":{method:"GET",path:"/api/admin/dashboard/proofout",chain:["page"],trailing:!0},"team.dashboard.search":{method:"POST",path:"/api/admin/search",body:["query","all","filterBy","page"]},"admin.team.dashboard.groups.category":{method:"GET",path:"/api/admin/dashboard/groups",chain:["category"]},"admin.team.proofs.groups.load":{method:"GET",path:"/api/admin/group",chain:["groupId"]},"users.by-id":{method:"GET",path:"/api/users",chain:["userId"]},"users.by-email":{method:"POST",path:"/api/users/email",body:["email"],trailing:!0},"users.invite":{method:"POST",path:"/api/users/create",body:["email"]},"proofs.create":{version:2,method:"POST",path:"/api/v2/proofs/create",body:"proof"},"proofs.normalize-workflow":{method:"POST",path:"/api/proofs/permission/check",body:["proofId","workflowId"]},"proofs.get-workflow-metrics":{method:"GET",path:"/api/workflows/metrics",query:["proofId"]},"proofs.set-workflow":{method:"POST",path:"/api/proofs/update",body:["proofId","workflowId"]},"proofs.set-tags":{method:"POST",path:"/api/tags/create",body:["relatedId","tag"]},"proofs.set-file":{method:"POST",path:"/api/proofs/update",body:["proofId","fileId"]},"proofs.distribute-file":{method:"GET",path:"/api/proofs/distribute",chain:["proofId"],trailing:!0},"proofs.archive":{version:2,method:"POST",path:"/api/proofs/close",body:["proofIds"]},"proofs.unarchive":{method:"GET",path:"/api/proofs/reopen",chain:["proofId"],trailing:!0},"proofs.delete":{method:"GET",path:"/api/proofs/delete",chain:["proofId"],trailing:!0},"proofs.start":{method:"POST",path:"/api/proofs/startworkflow",body:["proofId"],trailing:!0},"proofs.manual-approval":{method:"POST",path:"/api/proofs/manualapproval",body:["proofId","message"],trailing:!0},"proofs.withdraw-approval":{method:"POST",path:"/api/proofs/revertapproval",body:["proofId","messageToSender"],trailing:!0},"proofs.editors.add":{version:2,method:"POST",path:"/api/proofs/editor/add",body:["proofId","editors","editorMessage"]},"proofs.editors.add-bulk":{version:2,method:"POST",path:"/api/proofs/editor/add/bulk",body:["proofsWithEditors"]},"proofs.bulk-update":{version:2,method:"POST",path:"/api/proofs/update/bulk",body:["proofs"]},"proofs.editors.remove":{version:2,method:"POST",path:"/api/proofs/editor/remove",body:["proofId","editors"]},"proofs.editors.replace":{version:2,method:"POST",path:"/api/proofs/editor/replace",body:["proofId","oldEditors","newEditors"]},"proofs.editors.set":{version:2,method:"POST",path:"/api/proofs/editor/set",body:["proofId","editors"]},"briefs.start":{method:"POST",path:"/api/briefs/start",body:["briefId"]},"proofs.return":{version:2,method:"POST",path:"/api/v2/proofs/return",body:["proofIds"]},"proofs.groups.create":{method:"POST",path:"/api/proofs/groups/create",body:["name","ownedByTeam"]},"proofs.groups.update":{version:2,method:"POST",path:"/api/proofs/groups/update",body:["groupId","name","ownedByTeam","folderName"]},"proofs.groups.delete":{method:"POST",path:"/api/groups/delete",body:["groupId"]},"proofs.groups.load":{method:"GET",path:"/api/proofs/group",chain:["groupId"]},"proofs.groups.ready":{method:"POST",path:"/api/proofs/groups/ready",body:["groupId"]},"proofs.groups.archive":{version:2,method:"POST",path:"/api/groups/archive",body:["groupIds","archiveProofs"]},"proofs.groups.reopen":{version:2,method:"POST",path:"/api/groups/reopen",body:["groupIds"]},"proofs.groups.remove-proof":{method:"POST",path:"/api/groups/proof/remove",body:["proofId"]},"proofs.groups.add-proof":{method:"POST",path:"/api/groups/proof/add",body:["proofId","groupId"]},"proofs.groups.owners.add":{version:2,method:"POST",path:"/api/v2/proofs/owners/groups/add",body:["groupId","owners"]},"proofs.groups.workflows.add-reviewers":{version:2,method:"POST",path:"/api/v2/workflows/groups/reviewers/add",body:["groupId","reviewers"]},"proofs.groups.replace-approver":{version:2,method:"POST",path:"/api/groups/approver/replace",body:["groupId","user"]},"proofs.versions.attach":{method:"POST",path:"/api/proofs/versions/create",body:["proofId","versionId"]},"proofs.versions.list":{method:"GET",path:"/api/proofs/versions",chain:["proofId"],trailing:!0},"proofs.load":{method:"GET",path:"/api/proofs/",chain:["proofId"],trailing:!0},"proofs.next":{method:"POST",path:"/api/proofs/next",body:["proofId"]},"proofs.request-access":{method:"GET",path:"/api/proofs/requestaccess",chain:["proofId"]},"proofs.lock":{method:"GET",path:"/api/proofs/lock/",chain:["proofId"],trailing:!0},"proofs.unlock":{method:"GET",path:"/api/proofs/unlock/",chain:["proofId"],trailing:!0},"proofs.request-unlock":{method:"GET",path:"/api/proofs/unlockemail/",chain:["proofId"],trailing:!0},"proofs.images":{method:"GET",path:"/api/proofs/graph/thumbnails/",chain:["proofId"]},"proofs.video-credentials":{method:"GET",path:"/api/proofs/assets/video-credentials/",chain:["proofId"]},"proofs.finish":{method:"POST",path:"/api/proofs/finished",body:["proofId","decision"]},"proofs.update-decision":{method:"POST",path:"/api/proofs/update/decision",body:["proofId","decision"]},"proofs.decisions.load":{method:"GET",path:"/api/decisions/proofs",chain:["proofId"]},"proofs.decisions.get-options":{method:"GET",path:"/api/decisions/proofs",chain:["proofId","type"]},"proofs.decisions.leave-decision":{version:2,method:"POST",path:"/api/decisions/proofs",body:["decisionId"],chain:["proofId"]},"proofs.assets.extracted-text":{version:2,method:"GET",path:"/api/proofs/assets/extracted-text",chain:["proofId"]},"proofs.assets.color-separations":{version:2,method:"GET",path:"/api/proofs/assets/color-separations",chain:["proofId"]},"files.legacy.generate-token":{method:"GET",path:"/api/media/getfiletoken",query:["relatedId","fileType"]},"files.legacy.upload-block":{method:"POST",path:"/api/media/file",query:["block","part","token"],body:"data"},"files.legacy.upload-complete":{method:"POST",path:"/api/media/file",query:["block","blockCount","part","token","extn","pages","filename","storeoriginal","adobeExportData"],body:"envelope"},"files.details":{method:"GET",path:"/api/media/file/details",chain:["fileId"]},"files.download-block":{method:"GET",path:"/api/media/getfilechunk",chain:["proofId","fileId","block"],query:["s"]},"files.thumbnail":{method:"GET",path:"/api/media/getimage/thumb",chain:["fileId"]},"files.preview":{method:"GET",path:"/api/media/getimage",chain:["fileId","quality","pageNumber"],trailing:!0},"files.import.generic":{method:"POST",path:"/api/media/filedropbox",body:["extn","filename","url","envelope","storeOriginal"]},"files.import.drive":{method:"POST",path:"/api/media/filedrive",body:["extn","filename","url","envelope","storeOriginal","accessToken"]},"files.import.onedrive":{method:"POST",path:"/api/media/fileonedrive",body:["extn","filename","url","envelope","storeOriginal","accessToken"]},"files.import.box":{method:"POST",path:"/api/media/filebox",body:["extn","filename","url","envelope","storeOriginal","accessToken"]},"files.import.dropbox":{method:"POST",path:"/api/media/filedropbox",body:["extn","filename","url","envelope","storeOriginal","accessToken"]},"files.import.canva":{method:"POST",path:"/api/media/filecanva",body:["extn","filename","url","envelope","storeOriginal","accessToken"]},"files.v2.generate-credentials":{version:2,method:"POST",path:"/api/media/file/upload",body:["files","supports"]},"files.v2.upload-complete":{version:2,method:"POST",path:"/api/media/file/queue",body:["files"]},"files.can-download.update":{method:"POST",path:"/api/media/downloadoption",body:["fileId","downloadOriginal"]},"files.import.web.validate":{method:"POST",path:"/api/media/import/url/validate",body:["url"]},"files.import.web":{method:"POST",path:"/api/media/import/url",body:["url","envelope"]},"files.create-email":{version:2,method:"POST",path:"/api/email-upload/files/create"},"files.duplicate":{version:2,method:"POST",path:"/api/files/v2/duplicate",body:["id"]},"workflows.create":{version:2,method:"POST",path:"/api/v2/workflows/create",body:["title","ownedByTeam"]},"workflows.favorite":{method:"POST",path:"/api/workflows/favorite",body:["workflowId"]},"workflows.unfavorite":{method:"POST",path:"/api/workflows/unfavorite",body:["workflowId"]},"workflows.update":{method:"POST",path:"/api/workflows/update",body:["workflowId","title","ownedByTeam"]},"workflows.load":{version:2,method:"GET",path:"/api/v2/workflows/detail",chain:["workflowId"]},"workflows.nudge-message":{method:"GET",path:"/api/workflows/nudgemessage",query:["workflowId","userId"]},"workflows.steps.add":{version:2,method:"POST",path:"/api/v2/workflows/steps/add",body:["workflowId","title","position","dueDate","mandatoryDecisionThreshold"]},"workflows.steps.update":{version:2,method:"POST",path:"/api/v2/workflows/steps/update",body:["stepId","title","dueDate","mandatoryDecisionThreshold"]},"workflows.steps.move-before":{method:"POST",path:"/api/workflows/step/movebefore",body:["stepId","beforeStepId"]},"workflows.steps.move-after":{method:"POST",path:"/api/workflows/step/moveafter",body:["stepId","afterStepId"]},"workflows.steps.swap":{method:"POST",path:"/api/workflows/step/swap",body:["stepId","swapStepId"]},"workflows.users.set":{version:2,method:"POST",path:"/api/v2/workflows/users/set",body:["workflowId","stepId","position","users"]},"workflows.users.update":{version:2,method:"POST",path:"/api/v2/workflows/users/update",body:["workflowId","stepId","userId","role","permissions"]},"workflows.users.add":{version:2,method:"POST",path:"/api/v2/workflows/users/add",body:["workflowId","stepId","users"]},"workflows.users.skip-all":{method:"POST",path:"/api/workflows/skipall",body:["workflowId"]},"workflows.user.nudge":{version:2,method:"POST",path:"/api/workflows/user/nudge",body:["workflowId","userId","message"]},"workflows.nudge-all":{version:2,method:"POST",path:"/api/v2/workflows/nudgeall",body:["workflowIds","message"]},"workflows.delete":{method:"POST",path:"/api/workflows/delete",body:["workflowId"]},"workflows.duplicate":{method:"POST",path:"/api/workflows/duplicateonly",body:["workflowId","noOwners","includeOwnedByTeam","excludeStepDueDates","includeSharedUsers"]},"workflows.set-starting-step":{method:"POST",path:"/api/workflows/startfrom",body:["workflowId","stepId"]},"workflows.owned":{method:"GET",path:"/api/workflows",trailing:!0},"workflows.shared":{method:"GET",path:"/api/workflows/share/user",trailing:!0},"workflows.owned.email-list":{method:"GET",path:"/api/workflows/emaillist",trailing:!0},"workflows.shared.email-list":{method:"GET",path:"/api/workflows/share/emaillist",trailing:!0},"workflows.replace-approver":{version:2,method:"POST",path:"/api/v2/workflows/approver/replace/bulk",body:["workflowIds","user"]},"workflows.proof-owners.add":{version:2,method:"POST",path:"/api/workflows/permission/add",body:!0},"comments.load-all":{method:"POST",path:"/api/proofs/recent",body:["proofId","timestamp"]},"comments.load-page":{method:"POST",path:"/api/proofs/comment/recent",body:["proofId","timestamp","page"]},"comments.state.update":{method:"POST",path:"/api/proofs/comment/updatestatus",body:["commentId","change","done"]},"comments.state.multiple-update":{version:2,method:"POST",path:"/api/comments/update/status/batch",body:["proofId","commentIds","change","done"]},"comments.create":{version:2,method:"POST",path:"/api/proofs/comment/create",body:["proofId","page","envelope","encryptedComment","xy","parent","mentions","metadata","sourceMetadata","creationToken","change","done","boxFillImage","boxFillType","autoState","private"]},"comments.delete":{method:"POST",path:"/api/proofs/comment/delete",body:["commentId"]},"comments.import.create-task":{version:2,method:"POST",path:"/api/proofs/comments/import/tasks",body:"options"},"comments.import.action-task":{version:2,method:"POST",path:"/api/proofs/comments/import/tasks",chain:["id","action"],body:"options"},"comments.import.get-task":{method:"GET",path:"/api/proofs/comments/import/tasks",chain:["id"]},"comments.load-context":{method:"GET",path:"/api/comments/context",chain:["commentId"]},"proofs-owners.add":{version:2,method:"POST",path:"/api/v2/proofs/owners/add",body:["proofIds","users"]},"proofs-reviewers.add":{version:2,method:"POST",path:"/api/proofs/reviewers/add",body:["proofIds","reviewers"]},"proofs-workflow.add-bulk":{version:2,method:"POST",path:"/api/proofs/workflow/add/bulk",body:["proofIds","workflowTemplateId"]},"proofs-owners.remove":{version:2,method:"POST",path:"/api/v2/proofs/owners/remove",body:["proofId","users"]},"proofs.tag-delete":{method:"POST",path:"/api/tags/delete",body:["relatedId","tag"]},"proofs.return-todos":{version:2,method:"POST",path:"/api/proofs/returntodos",body:["proofIds","messageToOwners","markCommentAsTodo"]},"proofs.set-message-to-reviewers":{version:2,method:"POST",path:"/api/proofs/messagetoreviewers/update/bulk",body:["proofIds","messageToReviewers"]},"proofs.remove-editor":{method:"GET",path:"/api/proofs/deleteeditor",chain:["proofId"],trailing:!0},"proofs.update":{version:2,method:"POST",path:"/api/v2/proofs/update",body:"proof"},"briefs.create":{method:"POST",path:"/api/briefs/create",body:["title","messageToRecipient","dueDate","tag","isPublic"]},"briefs.update":{method:"POST",path:"/api/briefs/update",body:["briefId","title","messageToRecipient","dueDate","tag","recipient","editorId","editorMessage","isPublic"]},"admin.team.users.enabled":{method:"GET",path:"/api/admin/getusers/active",trailing:!0},"admin.team.users.disabled":{method:"GET",path:"/api/admin/getusers/inactive",trailing:!0},"admin.team.users.set-enabled":{method:"POST",path:"/api/admin/setenabled",body:["email","enabled"]},"admin.team.users.invite":{version:2,method:"POST",path:"/api/admin/member/invite",body:["emails"]},"admin.team.users.remove-from-team":{version:2,method:"POST",path:"/api/admin/member/remove",body:["users"]},"admin.team.users.upload-avatar":{method:"POST",path:"/api/admin/member/avatar",body:["userId","uploadedImage"]},"admin.team.users.delete-avatar":{method:"POST",path:"/api/admin/member/avatar/delete",body:["userId"]},"admin.team.users.invitations":{method:"GET",path:"/api/admin/team/users/invitations"},"admin.team.users.revoke-invitation":{version:2,method:"POST",path:"/api/admin/team/users/revoke-invitation",body:["email","invitationId"]},"admin.team.features.load":{method:"GET",path:"/api/admin/settings",trailing:!0},"admin.team.features.update":{version:2,method:"POST",path:"/api/admin/settings",body:["displayComments","generalComments","privateComments","enableWebhooks","editComments","ownerCanDeleteComments","proofReference","proofReferenceRequired","displayTeamName","emailTitleTextColor","emailLinkTextColor","emailButtonBackgroundColor","emailButtonTextColor","disableReplyingToCommentsInStatuses","publicProofs","defaultProofIsPublic","messageToOwners","allowedDecisions","enableChecklists","suggestionsIncludeTeamMembers","enableUserGroups","enableCommentVisibility","defaultCommentVisibility","usePreviousVersionDueDate","enableViewOnlyReviewers","enableIntelligence","enableIntelligenceSmartTags","enableProofMagicAccess","enableIntelligenceSmartCheckCr","defaultGifOutput"]},"admin.team.features.sender-email.set":{version:2,method:"POST",path:"/api/admin/sender-email/set",body:["senderEmail"]},"integrations.get-setup-url":{method:"GET",path:"/api/integrations/setup_url",query:"params"},"integrations.get-proof-setup":{method:"GET",path:"/api/integrations/proof_setup",query:["integration_key","id"]},"integrations.get-configurations":{method:"GET",path:"/api/integrations/configuration",query:["level","integration_keys"]},"integrations.disable":{method:"POST",path:"/api/integrations/disable",query:["level","integration_key"]},"integrations.update-configuration":{version:2,method:"POST",path:"/api/integrations/configuration/update",body:["level","integrationKey","key","value"]},"integrations.get-available-reference-integrations":{method:"GET",path:"/api/integrations/reference/available_integrations"},"integrations.get-available-reference-options":{method:"GET",path:"/api/integrations/reference/options",query:"params"},"integrations.load-reference-additional-information":{method:"GET",path:"/api/integrations/reference/additional_information",query:"params"},"integrations.proof-integration-references.add":{version:2,method:"POST",path:"/api/integrations/reference/proof_integration_references",body:["proofId","integrationReference"]},"integrations.proof-integration-references.remove":{version:2,method:"POST",path:"/api/integrations/reference/proof_integration_references/remove",body:["proofId","referenceId"]},"admin.team.preferences.notifications.load":{method:"GET",path:"/api/admin/preferences/notifications",trailing:!0},"admin.team.preferences.notifications.set":{method:"POST",path:"/api/admin/preferences/notifications/set",body:["ownerAddedByAdmin"]},"admin.team.workflows.owned":{method:"GET",path:"/api/admin/workflows/templates"},"admin.team.workflows.owned.email-list":{method:"GET",path:"/api/admin/workflows/templates/emaillist"},"admin.team.custom-tools.load":{method:"GET",path:"/api/custom-tools/admin/team"},"admin.team.custom-tools.update":{version:2,method:"PATCH",path:"/api/custom-tools/admin/team",body:"updates"},"sessions.check":{method:"GET",path:"/api/sessions/check"},"sso.get-public-key":{method:"GET",path:"/sso/public_key",anonymous:!0},"sso.get-session":{version:2,method:"POST",path:"/sso/session",body:["nonce"],anonymous:!0,credentials:!0},"sso.get-login-options":{version:2,method:"POST",path:"/sso/login_options",body:["email"],anonymous:!0},"sso.initiate-login":{version:2,method:"POST",path:"/sso/initiate_login",body:["email","sessionId","source"],anonymous:!0},"sso.get-isolated-login-status":{version:2,method:"POST",path:"/sso/isolated/status",body:["email","sessionId","applicationId"],anonymous:!0},"sso.get-isolated-login-session":{version:2,method:"POST",path:"/sso/isolated/session",body:["sessionId","applicationId","encryptedSessionToken","nonce"],anonymous:!0},"mfa.setup":{method:"POST",path:"/api/users/mfa/setup"},"mfa.enable":{method:"POST",path:"/api/users/mfa/enable",body:["totp"]},"mfa.remove":{method:"POST",path:"/api/users/mfa/remove",body:["password"]},"reminders.add":{version:2,method:"POST",path:"/api/reminders/add",body:["entityId","reminders"]},"reminders.update":{version:2,method:"POST",path:"/api/reminders/update",body:["reminderId","relativeDate"]},"reminders.delete":{version:2,method:"POST",path:"/api/reminders/delete",body:["reminderIds"]},"reminders.all":{version:2,method:"GET",path:"/api/reminders/list",chain:["entityId"]},"reminders.set":{version:2,method:"POST",path:"/api/reminders/list",chain:["entityId","reminders"]},"proofs.audit.summary":{version:2,method:"GET",path:"/api/proofs/audit/summary",chain:["proofId"]},"brian.rekey-users-proofs":{version:2,method:"GET",path:"/api/brian/rekey/proofs",chain:["userId"]},"live.generate-access-token":{version:2,method:"GET",path:"/api/users/live/token"},"reports.create":{version:2,method:"POST",path:"/api/reports",body:!0},"reports.configurations":{version:2,method:"GET",path:"/api/reports/configurations"},"printing.create":{version:2,method:"POST",body:!0,path:"/api/print"},"printing.options":{version:2,method:"GET",query:["proofId"],path:"/api/print/options"},"teams.invitations.info":{version:2,method:"GET",path:"/api/teams/invitations/info",chain:["invitationId"]},"teams.invitations.accept":{version:2,method:"POST",path:"/api/teams/invitations/accept",chain:["invitationId"]},"teams.invitations.decline":{version:2,method:"POST",path:"/api/teams/invitations/decline",chain:["invitationId"]},"scim.admin.settings":{method:"GET",path:"/api/scim/admin/settings"},"scim.admin.enable":{method:"POST",path:"/api/scim/admin/enable"},"scim.admin.disable":{method:"POST",path:"/api/scim/admin/disable"},"scim.admin.regenerate-access-token":{version:2,method:"POST",path:"/api/scim/admin/regenerate-access-token",body:["type"]},"proofs.custom-tools.load":{method:"GET",path:"/api/custom-tools/proof",chain:["proofId"]},"proofs.custom-tools.update":{version:2,method:"PATCH",path:"/api/custom-tools/proof",chain:["proofId"],body:"updates"},"proofs.custom-tools.validate":{version:2,method:"POST",path:"/api/custom-tools/validate",body:"schema"},"email.proofs.generate":{version:2,method:"POST",path:"/api/email-upload/email-address",body:!0},"proofs.link-check.results":{version:2,method:"GET",chain:["proofId"],path:"/api/link-check/results"},"proofs.link-check.recheck":{version:2,method:"POST",body:["proofId"],path:"/api/link-check/recheck"},"free-trial.request-team":{version:2,method:"POST",path:"/api/free-trial/request/team",body:!0},"proofs.send-share-link":{version:2,method:"POST",path:"/api/public-proofs/proof/send-share-link",body:["proofId","message","emailAddresses"]},graphql:{version:2,method:"POST",path:"/spider/graphql",body:!0}}},function(e,t,r){"use strict";t.__esModule=!0;var n=Object.prototype.toString;t.default=function(e){return n.call(e)}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=r(16),a=n(i),s=r(95),u=r(5),c=r(17),l=n(c),f=r(42),p=function(){function e(){o(this,e),this.error=!1,this.code=-1,this.data=null,this.message=null,this.deprecated=null}return e.parse=function(t){var r=t.status,n=t.headers,o=void 0===n?{}:n,i=t.body,c=new e;if(r===s.TOO_MANY_REQUESTS_STATUS)return c.error=!0,c.message="Too many requests. Unable to process request due to high volume of requests from your application.",c.code=a.default.ERROR_THROTTLED,c.data={timeout:1e3*(parseFloat(o[u.RETRY_AFTER_HEADER])||60)},c;if((0,l.default)(o,"deprecated")&&(c.deprecated=o.deprecated),r===s.OK_STATUS&&!i)return c.code=a.default.OK,c;try{var p=JSON.parse(i);if("string"==typeof p||(p&&"ResponseCode"in p?(c.code=p.ResponseCode,c.code!==a.default.OK&&(c.error=!0)):p.Message&&1===Object.keys(p).length?(c.error=!0,c.code=a.default.ERROR_CRITICAL):"boolean"==typeof p.success&&p.message&&(c.error=!1===p.success,c.code=r,c.message=p.message)),c.error){var d="Response returned with the response code: "+c.code+". Please check SDK error documentation for details.",h=(0,f.getErrorMessage)(c.code,d);c.message=c.message||h}c.data=p}catch(e){c.error=!0}return c},e}();t.default=p},function(e,t,r){"use strict";t.__esModule=!0;t.TOO_MANY_REQUESTS_STATUS=429,t.OK_STATUS=200},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=r(0),u=n(s),c=r(18),l=n(c),f=r(97),p=n(f),d=r(107),h=n(d),y=function(e){function t(r){o(this,t);var n=i(this,e.call(this,r));return n.sso=new p.default(r),n.mfa=new h.default(r),n}return a(t,e),t.prototype._generateCredentials=function(e){var t=this;return this.client.crypto().generatePasswordHash(e).then(function(e){return Promise.all([e,t.client.crypto().generateKeyPair()])}).then(function(r){var n=r[0],o=r[1];return Promise.all([n,o,t.client.crypto().encryptPrivateKey(o.privateKeyPEM,e)])})},t.prototype.register=function(e,t){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return"string"==typeof n&&(console.warn("Warning: Passing the user's activation code during account creation has been moved into an options object. For compatibility reasons, the legacy behaviour still functions as expected, but please update your code as this will be changed in a future version."),n={activationCode:n}),this._generateCredentials(t).then(function(t){var o=t[0],i=t[1],a=t[2];return Promise.all([i,r.client.request("accounts.register",{email:e,password:o,privateKey:a,publicKey:i.publicKeyPEM,referrer:n.referrer})])}).then(function(n){var o=n[0];return Promise.all([o,r.login(e,t,void 0,!1)])}).then(function(e){var t=e[0],o=e[1];return Promise.all([t,o,n.activationCode?r.activate(n.activationCode).catch(function(){return r.generateActivationCode()}):r.generateActivationCode()])}).then(function(e){var t=e[0],r=e[1];return r.privateKeyPEM=t.privateKeyPEM,r})},t.prototype.generateActivationCode=function(){return this.client.request("accounts.generate-activation-code",{userId:this.client.session.userId})},t.prototype.activate=function(e){var t=this;return this.client.request("accounts.activate",{userId:this.client.session.userId,authCode:e}).then(function(){t.client.session.user.hasActivated=!0})},t.prototype.login=function(e,t,r){var n=this,o=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];return this.client.crypto().generatePasswordHash(t).then(function(t){return n.client.request("accounts.login",{email:e,password:t,totp:r})}).then(function(t){var r=(new l.default).fromSession(t.data);return r.user.email=e,r}).then(function(e){return o?n.client.crypto().decryptPrivateKey(e.privateKeyPEM$,t).then(function(t){return e.privateKeyPEM=t,e}):e}).then(function(e){return n.client.setSession(e),e})},t.prototype.resetPassword=function(e){var t=this,r=e.email,n=e.code,o=e.password;return this._generateCredentials(o).then(function(e){var o=e[0],i=e[1],a=e[2];return Promise.all([i,t.client.request("accounts.reset-password",{email:r,secret:n,newPassword:o,newPrivateKey:a,newPublicKey:i.publicKeyPEM})])}).then(function(e){var n=e[0];return Promise.all([n,t.login(r,o,void 0,!1)])}).then(function(e){var t=e[0],r=e[1];return r.privateKeyPEM=t.privateKeyPEM,r})},t.prototype.forgotPassword=function(e){return this.client.request("accounts.forgot-password",{email:e})},t.prototype.setPasswordRequest=function(e){return this.client.request("accounts.set-password-request",{email:e})},t.prototype.setPassword=function(e){var t=this,r=e.email,n=e.code,o=e.password;return this._generateCredentials(o).then(function(e){var o=e[0],i=e[1],a=e[2];return Promise.all([i,t.client.request("accounts.set-password",{email:r,secret:n,newPassword:o,newPrivateKey:a,newPublicKey:i.publicKeyPEM})])}).then(function(e){var n=e[0];return Promise.all([n,t.login(r,o,void 0,!1)])}).then(function(e){var t=e[0],r=e[1];return r.privateKeyPEM=t.privateKeyPEM,r})},t.prototype.logout=function(){var e=this;return this.client.request("accounts.logout").catch(function(t){return e.client.setSession(null),Promise.reject(t)}).then(function(){e.client.setSession(null)})},t}(u.default);t.default=y},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=r(43),u=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(s),c=r(0),l=n(c),f=r(18),p=n(f),d=r(106),h=n(d),y=function(e){function t(){return o(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.getSession=function(){var e=this;return this.client.request("sso.get-public-key").then(function(e){return e.data.ServerPublicKey}).then(function(t){return e.client.crypto().generateWrappedSymmetricKey(t)}).then(function(t){var r=t.key,n=t.key$;return Promise.all([r,e.client.request("sso.get-session",{nonce:n})])}).then(function(t){var r=t[0],n=t[1],o=(new p.default).fromSession(n.data);return Promise.all([o,e.client.crypto().decryptManagedPrivateKey(o.privateKeyPEM$,r)])}).then(function(e){var t=e[0],r=e[1];return t.privateKeyPEM=r,t})},t.prototype.getLoginOptions=function(e){return this.client.request("sso.get-login-options",{email:e}).then(function(e){return e.data})},t.prototype.initiateLogin=function(e,t,r){return this.client.request("sso.initiate-login",{email:e,sessionId:t,source:r}).then(function(e){return e.data})},t.prototype.getIsolatedLoginStatus=function(e,t,r){var n=this;if(!h.default)throw new Error("ISOLATED_AUTH_PRIVATE_KEY is not set");if(!e||!t||!r)throw new Error("Missing required parameters");return this.client.request("sso.get-isolated-login-status",{email:e,sessionId:t,applicationId:r}).catch(function(e){throw new Error("Error getting isolated login status: "+e.message)}).then(function(e){var t=e.data;if(t.encryptedSessionToken){var r=void 0;try{r=JSON.parse(u.util.decode64(t.nonce))}catch(e){throw new Error("Error decoding / parsing nonce: "+e.message)}return n.client.crypto().decryptSessionToken(t.encryptedSessionToken,h.default).catch(function(e){throw new Error("Error decrypting session token: "+e.message)}).then(function(e){var t=void 0;try{t=n.client.crypto().encryptSessionToken(e,r)}catch(e){throw new Error("Error re-encrypting session token: "+e.message)}return t}).then(function(e){return{success:!0,status:t.status,sessionToken:e}})}return t})},t.prototype.getIsolatedLoginSession=function(e,t,r){var n=this;if(!h.default)throw new Error("ISOLATED_AUTH_PRIVATE_KEY is not set");if(!e||!t||!r)throw new Error("Missing required parameters");return this.client.request("sso.get-public-key").catch(function(e){throw new Error("Error getting public key: "+e.message)}).then(function(e){return n.client.crypto().generateWrappedSymmetricKey(e.data.ServerPublicKey)}).catch(function(e){throw new Error("Error generating wrapped symmetric key: "+e.message)}).then(function(o){var i=o.key,a=o.key$;return Promise.all([i,n.client.request("sso.get-isolated-login-session",{sessionId:e,applicationId:t,encryptedSessionToken:r,nonce:a})])}).catch(function(e){throw new Error("Error getting isolated login session: "+e.message)}).then(function(e){var t=e[0],r=e[1];return Promise.all([t,n.client.crypto().decryptSessionData(r.data.encryptedSession,h.default)])}).catch(function(e){throw new Error("Error decrypting session data: "+e.message)}).then(function(e){var t=e[0],r=e[1],o=void 0;try{o=(new p.default).fromSession(JSON.parse(r))}catch(e){throw new Error("Error parsing session data: "+e.message)}return Promise.all([o,n.client.crypto().decryptManagedPrivateKey(o.privateKeyPEM$,t).catch(function(e){throw new Error("Error decrypting managed private key: "+e.message)})])}).then(function(e){var t=e[0],r=e[1];return t.privateKeyPEM=r,t})},t}(l.default);t.default=y},function(e,t,r){function n(e,t,r){var n=t.entity===c.tls.ConnectionEnd.client;e.read.cipherState={init:!1,cipher:c.cipher.createDecipher("AES-CBC",n?r.keys.server_write_key:r.keys.client_write_key),iv:n?r.keys.server_write_IV:r.keys.client_write_IV},e.write.cipherState={init:!1,cipher:c.cipher.createCipher("AES-CBC",n?r.keys.client_write_key:r.keys.server_write_key),iv:n?r.keys.client_write_IV:r.keys.server_write_IV},e.read.cipherFunction=s,e.write.cipherFunction=o,e.read.macLength=e.write.macLength=r.mac_length,e.read.macFunction=e.write.macFunction=l.hmac_sha1}function o(e,t){var r=!1,n=t.macFunction(t.macKey,t.sequenceNumber,e);e.fragment.putBytes(n),t.updateSequenceNumber();var o;o=e.version.minor===l.Versions.TLS_1_0.minor?t.cipherState.init?null:t.cipherState.iv:c.random.getBytesSync(16),t.cipherState.init=!0;var a=t.cipherState.cipher;return a.start({iv:o}),e.version.minor>=l.Versions.TLS_1_1.minor&&a.output.putBytes(o),a.update(e.fragment),a.finish(i)&&(e.fragment=a.output,e.length=e.fragment.length(),r=!0),r}function i(e,t,r){if(!r){var n=e-t.length()%e;t.fillWithByte(n-1,n)}return!0}function a(e,t,r){var n=!0;if(r){for(var o=t.length(),i=t.last(),a=o-1-i;a<o-1;++a)n=n&&t.at(a)==i;n&&t.truncate(i+1)}return n}function s(e,t){var r=!1;++f;var n;n=e.version.minor===l.Versions.TLS_1_0.minor?t.cipherState.init?null:t.cipherState.iv:e.fragment.getBytes(16),t.cipherState.init=!0;var o=t.cipherState.cipher;o.start({iv:n}),o.update(e.fragment),r=o.finish(a);var i=t.macLength,s=c.random.getBytesSync(i),p=o.output.length();p>=i?(e.fragment=o.output.getBytes(p-i),s=o.output.getBytes(i)):e.fragment=o.output.getBytes(),e.fragment=c.util.createBuffer(e.fragment),e.length=e.fragment.length();var d=t.macFunction(t.macKey,t.sequenceNumber,e);return t.updateSequenceNumber(),r=u(t.macKey,s,d)&&r}function u(e,t,r){var n=c.hmac.create();return n.start("SHA1",e),n.update(t),t=n.digest().getBytes(),n.start(null,null),n.update(r),r=n.digest().getBytes(),t===r}var c=r(1);r(10),r(45);var l=e.exports=c.tls;l.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=l.BulkCipherAlgorithm.aes,e.cipher_type=l.CipherType.block,e.enc_key_length=16,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=l.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n},l.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=l.BulkCipherAlgorithm.aes,e.cipher_type=l.CipherType.block,e.enc_key_length=32,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=l.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:n};var f=0},function(e,t,r){var n=r(1);r(56),e.exports=n.mgf=n.mgf||{},n.mgf.mgf1=n.mgf1},function(e,t,r){function n(e,t,r,n){e.generate=function(e,i){for(var a=new o.util.ByteBuffer,s=Math.ceil(i/n)+r,u=new o.util.ByteBuffer,c=r;c<s;++c){u.putInt32(c),t.start(),t.update(e+u.getBytes());var l=t.digest();a.putBytes(l.getBytes(n))}return a.truncate(a.length()-i),a.getBytes()}}var o=r(1);r(2),r(6),r(31),e.exports=o.kem=o.kem||{};var i=o.jsbn.BigInteger;o.kem.rsa={},o.kem.rsa.create=function(e,t){t=t||{};var r=t.prng||o.random,n={};return n.encrypt=function(t,n){var a,s=Math.ceil(t.n.bitLength()/8);do{a=new i(o.util.bytesToHex(r.getBytesSync(s)),16).mod(t.n)}while(a.equals(i.ZERO));a=o.util.hexToBytes(a.toString(16));var u=s-a.length;return u>0&&(a=o.util.fillString(String.fromCharCode(0),u)+a),{encapsulation:t.encrypt(a,"NONE"),key:e.generate(a,n)}},n.decrypt=function(t,r,n){var o=t.decrypt(r,"NONE");return e.generate(o,n)},n},o.kem.kdf1=function(e,t){n(this,e,0,t||e.digestLength)},o.kem.kdf2=function(e,t){n(this,e,1,t||e.digestLength)}},function(e,t,r){e.exports=r(8),r(29),r(15),r(49),r(102)},function(e,t,r){function n(){u=String.fromCharCode(128),u+=i.util.fillString(String.fromCharCode(0),128),l=[[1116352408,3609767458],[1899447441,602891725],[3049323471,3964484399],[3921009573,2173295548],[961987163,4081628472],[1508970993,3053834265],[2453635748,2937671579],[2870763221,3664609560],[3624381080,2734883394],[310598401,1164996542],[607225278,1323610764],[1426881987,3590304994],[1925078388,4068182383],[2162078206,991336113],[2614888103,633803317],[3248222580,3479774868],[3835390401,2666613458],[4022224774,944711139],[264347078,2341262773],[604807628,2007800933],[770255983,1495990901],[1249150122,1856431235],[1555081692,3175218132],[1996064986,2198950837],[2554220882,3999719339],[2821834349,766784016],[2952996808,2566594879],[3210313671,3203337956],[3336571891,1034457026],[3584528711,2466948901],[113926993,3758326383],[338241895,168717936],[666307205,1188179964],[773529912,1546045734],[1294757372,1522805485],[1396182291,2643833823],[1695183700,2343527390],[1986661051,1014477480],[2177026350,1206759142],[2456956037,344077627],[2730485921,1290863460],[2820302411,3158454273],[3259730800,3505952657],[3345764771,106217008],[3516065817,3606008344],[3600352804,1432725776],[4094571909,1467031594],[275423344,851169720],[430227734,3100823752],[506948616,1363258195],[659060556,3750685593],[883997877,3785050280],[958139571,3318307427],[1322822218,3812723403],[1537002063,2003034995],[1747873779,3602036899],[1955562222,1575990012],[2024104815,1125592928],[2227730452,2716904306],[2361852424,442776044],[2428436474,593698344],[2756734187,3733110249],[3204031479,2999351573],[3329325298,3815920427],[3391569614,3928383900],[3515267271,566280711],[3940187606,3454069534],[4118630271,4000239992],[116418474,1914138554],[174292421,2731055270],[289380356,3203993006],[460393269,320620315],[685471733,587496836],[852142971,1086792851],[1017036298,365543100],[1126000580,2618297676],[1288033470,3409855158],[1501505948,4234509866],[1607167915,987167468],[1816402316,1246189591]],f={},f["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],f["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],f["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],f["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],c=!0}function o(e,t,r){for(var n,o,i,a,s,u,c,f,p,d,h,y,m,g,v,b,E,C,_,w,T,S,I,A,k,B,R,P,O,D,N,L,U,x,M,V=r.length();V>=128;){for(O=0;O<16;++O)t[O][0]=r.getInt32()>>>0,t[O][1]=r.getInt32()>>>0;for(;O<80;++O)L=t[O-2],D=L[0],N=L[1],n=((D>>>19|N<<13)^(N>>>29|D<<3)^D>>>6)>>>0,o=((D<<13|N>>>19)^(N<<3|D>>>29)^(D<<26|N>>>6))>>>0,x=t[O-15],D=x[0],N=x[1],i=((D>>>1|N<<31)^(D>>>8|N<<24)^D>>>7)>>>0,a=((D<<31|N>>>1)^(D<<24|N>>>8)^(D<<25|N>>>7))>>>0,U=t[O-7],M=t[O-16],N=o+U[1]+a+M[1],t[O][0]=n+U[0]+i+M[0]+(N/4294967296>>>0)>>>0,t[O][1]=N>>>0;for(m=e[0][0],g=e[0][1],v=e[1][0],b=e[1][1],E=e[2][0],C=e[2][1],_=e[3][0],w=e[3][1],T=e[4][0],S=e[4][1],I=e[5][0],A=e[5][1],k=e[6][0],B=e[6][1],R=e[7][0],P=e[7][1],O=0;O<80;++O)c=((T>>>14|S<<18)^(T>>>18|S<<14)^(S>>>9|T<<23))>>>0,f=((T<<18|S>>>14)^(T<<14|S>>>18)^(S<<23|T>>>9))>>>0,p=(k^T&(I^k))>>>0,d=(B^S&(A^B))>>>0,s=((m>>>28|g<<4)^(g>>>2|m<<30)^(g>>>7|m<<25))>>>0,u=((m<<4|g>>>28)^(g<<30|m>>>2)^(g<<25|m>>>7))>>>0,h=(m&v|E&(m^v))>>>0,y=(g&b|C&(g^b))>>>0,N=P+f+d+l[O][1]+t[O][1],n=R+c+p+l[O][0]+t[O][0]+(N/4294967296>>>0)>>>0,o=N>>>0,N=u+y,i=s+h+(N/4294967296>>>0)>>>0,a=N>>>0,R=k,P=B,k=I,B=A,I=T,A=S,N=w+o,T=_+n+(N/4294967296>>>0)>>>0,S=N>>>0,_=E,w=C,E=v,C=b,v=m,b=g,N=o+a,m=n+i+(N/4294967296>>>0)>>>0,g=N>>>0;N=e[0][1]+g,e[0][0]=e[0][0]+m+(N/4294967296>>>0)>>>0,e[0][1]=N>>>0,N=e[1][1]+b,e[1][0]=e[1][0]+v+(N/4294967296>>>0)>>>0,e[1][1]=N>>>0,N=e[2][1]+C,e[2][0]=e[2][0]+E+(N/4294967296>>>0)>>>0,e[2][1]=N>>>0,N=e[3][1]+w,e[3][0]=e[3][0]+_+(N/4294967296>>>0)>>>0,e[3][1]=N>>>0,N=e[4][1]+S,e[4][0]=e[4][0]+T+(N/4294967296>>>0)>>>0,e[4][1]=N>>>0,N=e[5][1]+A,e[5][0]=e[5][0]+I+(N/4294967296>>>0)>>>0,e[5][1]=N>>>0,N=e[6][1]+B,e[6][0]=e[6][0]+k+(N/4294967296>>>0)>>>0,e[6][1]=N>>>0,N=e[7][1]+P,e[7][0]=e[7][0]+R+(N/4294967296>>>0)>>>0,e[7][1]=N>>>0,V-=128}}var i=r(1);r(8),r(2);var a=e.exports=i.sha512=i.sha512||{};i.md.sha512=i.md.algorithms.sha512=a;var s=i.sha384=i.sha512.sha384=i.sha512.sha384||{};s.create=function(){return a.create("SHA-384")},i.md.sha384=i.md.algorithms.sha384=s,i.sha512.sha256=i.sha512.sha256||{create:function(){return a.create("SHA-512/256")}},i.md["sha512/256"]=i.md.algorithms["sha512/256"]=i.sha512.sha256,i.sha512.sha224=i.sha512.sha224||{create:function(){return a.create("SHA-512/224")}},i.md["sha512/224"]=i.md.algorithms["sha512/224"]=i.sha512.sha224,a.create=function(e){if(c||n(),void 0===e&&(e="SHA-512"),!(e in f))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=f[e],r=null,a=i.util.createBuffer(),s=new Array(80),l=0;l<80;++l)s[l]=new Array(2);var p=64;switch(e){case"SHA-384":p=48;break;case"SHA-512/256":p=32;break;case"SHA-512/224":p=28}var d={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:p,messageLength:0,fullMessageLength:null,messageLengthSize:16};return d.start=function(){d.messageLength=0,d.fullMessageLength=d.messageLength128=[];for(var e=d.messageLengthSize/4,n=0;n<e;++n)d.fullMessageLength.push(0);a=i.util.createBuffer(),r=new Array(t.length);for(var n=0;n<t.length;++n)r[n]=t[n].slice(0);return d},d.start(),d.update=function(e,t){"utf8"===t&&(e=i.util.encodeUtf8(e));var n=e.length;d.messageLength+=n,n=[n/4294967296>>>0,n>>>0];for(var u=d.fullMessageLength.length-1;u>=0;--u)d.fullMessageLength[u]+=n[1],n[1]=n[0]+(d.fullMessageLength[u]/4294967296>>>0),d.fullMessageLength[u]=d.fullMessageLength[u]>>>0,n[0]=n[1]/4294967296>>>0;return a.putBytes(e),o(r,s,a),(a.read>2048||0===a.length())&&a.compact(),d},d.digest=function(){var t=i.util.createBuffer();t.putBytes(a.bytes());var n=d.fullMessageLength[d.fullMessageLength.length-1]+d.messageLengthSize,c=n&d.blockLength-1;t.putBytes(u.substr(0,d.blockLength-c));for(var l,f,p=8*d.fullMessageLength[0],h=0;h<d.fullMessageLength.length-1;++h)l=8*d.fullMessageLength[h+1],f=l/4294967296>>>0,p+=f,t.putInt32(p>>>0),p=l>>>0;t.putInt32(p);for(var y=new Array(r.length),h=0;h<r.length;++h)y[h]=r[h].slice(0);o(y,s,t);var m,g=i.util.createBuffer();m="SHA-512"===e?y.length:"SHA-384"===e?y.length-2:y.length-4;for(var h=0;h<m;++h)g.putInt32(y[h][0]),h===m-1&&"SHA-512/224"===e||g.putInt32(y[h][1]);return g},d};var u=null,c=!1,l=null,f=null},function(e,t,r){function n(e){var t={},r=[];if(!h.validate(e,y.asn1.recipientInfoValidator,t,r)){var n=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw n.errors=r,n}return{version:t.version.charCodeAt(0),issuer:d.pki.RDNAttributesAsArray(t.issuer),serialNumber:d.util.createBuffer(t.serial).toHex(),encryptedContent:{algorithm:h.derToOid(t.encAlgorithm),parameter:t.encParameter.value,content:t.encKey}}}function o(e){return h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,h.integerToDer(e.version).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[d.pki.distinguishedNameToAsn1({attributes:e.issuer}),h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,d.util.hexToBytes(e.serialNumber))]),h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(e.encryptedContent.algorithm).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.NULL,!1,"")]),h.create(h.Class.UNIVERSAL,h.Type.OCTETSTRING,!1,e.encryptedContent.content)])}function i(e){for(var t=[],r=0;r<e.length;++r)t.push(n(e[r]));return t}function a(e){for(var t=[],r=0;r<e.length;++r)t.push(o(e[r]));return t}function s(e){var t=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,h.integerToDer(e.version).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[d.pki.distinguishedNameToAsn1({attributes:e.issuer}),h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,d.util.hexToBytes(e.serialNumber))]),h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(e.digestAlgorithm).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.NULL,!1,"")])]);if(e.authenticatedAttributesAsn1&&t.value.push(e.authenticatedAttributesAsn1),t.value.push(h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(e.signatureAlgorithm).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.NULL,!1,"")])),t.value.push(h.create(h.Class.UNIVERSAL,h.Type.OCTETSTRING,!1,e.signature)),e.unauthenticatedAttributes.length>0){for(var r=h.create(h.Class.CONTEXT_SPECIFIC,1,!0,[]),n=0;n<e.unauthenticatedAttributes.length;++n){var o=e.unauthenticatedAttributes[n];r.values.push(c(o))}t.value.push(r)}return t}function u(e){for(var t=[],r=0;r<e.length;++r)t.push(s(e[r]));return t}function c(e){var t;if(e.type===d.pki.oids.contentType)t=h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(e.value).getBytes());else if(e.type===d.pki.oids.messageDigest)t=h.create(h.Class.UNIVERSAL,h.Type.OCTETSTRING,!1,e.value.bytes());else if(e.type===d.pki.oids.signingTime){var r=new Date("1950-01-01T00:00:00Z"),n=new Date("2050-01-01T00:00:00Z"),o=e.value;if("string"==typeof o){var i=Date.parse(o);o=isNaN(i)?13===o.length?h.utcTimeToDate(o):h.generalizedTimeToDate(o):new Date(i)}t=o>=r&&o<n?h.create(h.Class.UNIVERSAL,h.Type.UTCTIME,!1,h.dateToUtcTime(o)):h.create(h.Class.UNIVERSAL,h.Type.GENERALIZEDTIME,!1,h.dateToGeneralizedTime(o))}return h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(e.type).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.SET,!0,[t])])}function l(e){return[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(d.pki.oids.data).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(e.algorithm).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.OCTETSTRING,!1,e.parameter.getBytes())]),h.create(h.Class.CONTEXT_SPECIFIC,0,!0,[h.create(h.Class.UNIVERSAL,h.Type.OCTETSTRING,!1,e.content.getBytes())])]}function f(e,t,r){var n={},o=[];if(!h.validate(t,r,n,o)){var i=new Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message.");throw i.errors=i,i}if(h.derToOid(n.contentType)!==d.pki.oids.data)throw new Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(n.encryptedContent){var a="";if(d.util.isArray(n.encryptedContent))for(var s=0;s<n.encryptedContent.length;++s){if(n.encryptedContent[s].type!==h.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");a+=n.encryptedContent[s].value}else a=n.encryptedContent;e.encryptedContent={algorithm:h.derToOid(n.encAlgorithm),parameter:d.util.createBuffer(n.encParameter.value),content:d.util.createBuffer(a)}}if(n.content){var a="";if(d.util.isArray(n.content))for(var s=0;s<n.content.length;++s){if(n.content[s].type!==h.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");a+=n.content[s].value}else a=n.content;e.content=d.util.createBuffer(a)}return e.version=n.version.charCodeAt(0),e.rawCapture=n,n}function p(e){if(void 0===e.encryptedContent.key)throw new Error("Symmetric key not available.");if(void 0===e.content){var t;switch(e.encryptedContent.algorithm){case d.pki.oids["aes128-CBC"]:case d.pki.oids["aes192-CBC"]:case d.pki.oids["aes256-CBC"]:t=d.aes.createDecryptionCipher(e.encryptedContent.key);break;case d.pki.oids.desCBC:case d.pki.oids["des-EDE3-CBC"]:t=d.des.createDecryptionCipher(e.encryptedContent.key);break;default:throw new Error("Unsupported symmetric cipher, OID "+e.encryptedContent.algorithm)}if(t.start(e.encryptedContent.parameter),t.update(e.encryptedContent.content),!t.finish())throw new Error("Symmetric decryption failed.");e.content=t.output}}var d=r(1);r(10),r(7),r(19),r(11),r(12),r(55),r(6),r(2),r(32);var h=d.asn1,y=e.exports=d.pkcs7=d.pkcs7||{};y.messageFromPem=function(e){var t=d.pem.decode(e)[0];if("PKCS7"!==t.type){var r=new Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');throw r.headerType=t.type,r}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");var n=h.fromDer(t.body);return y.messageFromAsn1(n)},y.messageToPem=function(e,t){var r={type:"PKCS7",body:h.toDer(e.toAsn1()).getBytes()};return d.pem.encode(r,{maxline:t})},y.messageFromAsn1=function(e){var t={},r=[];if(!h.validate(e,y.asn1.contentInfoValidator,t,r)){var n=new Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo.");throw n.errors=r,n}var o,i=h.derToOid(t.contentType);switch(i){case d.pki.oids.envelopedData:o=y.createEnvelopedData();break;case d.pki.oids.encryptedData:o=y.createEncryptedData();break;case d.pki.oids.signedData:o=y.createSignedData();break;default:throw new Error("Cannot read PKCS#7 message. ContentType with OID "+i+" is not (yet) supported.")}return o.fromAsn1(t.content.value[0]),o},y.createSignedData=function(){function e(){for(var e={},t=0;t<r.signers.length;++t){var n=r.signers[t],o=n.digestAlgorithm;o in e||(e[o]=d.md[d.pki.oids[o]].create()),0===n.authenticatedAttributes.length?n.md=e[o]:n.md=d.md[d.pki.oids[o]].create()}r.digestAlgorithmIdentifiers=[];for(var o in e)r.digestAlgorithmIdentifiers.push(h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(o).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.NULL,!1,"")]));return e}function t(e){if(r.contentInfo.value.length<2)throw new Error("Could not sign PKCS#7 message; there is no content to sign.");var t=h.derToOid(r.contentInfo.value[0].value),n=r.contentInfo.value[1];n=n.value[0];var o=h.toDer(n);o.getByte(),h.getBerValueLength(o),o=o.getBytes();for(var i in e)e[i].start().update(o);for(var a=new Date,s=0;s<r.signers.length;++s){var l=r.signers[s];if(0===l.authenticatedAttributes.length){if(t!==d.pki.oids.data)throw new Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.")}else{l.authenticatedAttributesAsn1=h.create(h.Class.CONTEXT_SPECIFIC,0,!0,[]);for(var f=h.create(h.Class.UNIVERSAL,h.Type.SET,!0,[]),p=0;p<l.authenticatedAttributes.length;++p){var y=l.authenticatedAttributes[p];y.type===d.pki.oids.messageDigest?y.value=e[l.digestAlgorithm].digest():y.type===d.pki.oids.signingTime&&(y.value||(y.value=a)),f.value.push(c(y)),l.authenticatedAttributesAsn1.value.push(c(y))}o=h.toDer(f).getBytes(),l.md.start().update(o)}l.signature=l.key.sign(l.md,"RSASSA-PKCS1-V1_5")}r.signerInfos=u(r.signers)}var r=null;return r={type:d.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(e){f(r,e,y.asn1.signedDataValidator),r.certificates=[],r.crls=[],r.digestAlgorithmIdentifiers=[],r.contentInfo=null,r.signerInfos=[];for(var t=r.rawCapture.certificates.value,n=0;n<t.length;++n)r.certificates.push(d.pki.certificateFromAsn1(t[n]))},toAsn1:function(){r.contentInfo||r.sign();for(var e=[],t=0;t<r.certificates.length;++t)e.push(d.pki.certificateToAsn1(r.certificates[t]));var n=[],o=h.create(h.Class.CONTEXT_SPECIFIC,0,!0,[h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,h.integerToDer(r.version).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.SET,!0,r.digestAlgorithmIdentifiers),r.contentInfo])]);return e.length>0&&o.value[0].value.push(h.create(h.Class.CONTEXT_SPECIFIC,0,!0,e)),n.length>0&&o.value[0].value.push(h.create(h.Class.CONTEXT_SPECIFIC,1,!0,n)),o.value[0].value.push(h.create(h.Class.UNIVERSAL,h.Type.SET,!0,r.signerInfos)),h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(r.type).getBytes()),o])},addSigner:function(e){var t=e.issuer,n=e.serialNumber;if(e.certificate){var o=e.certificate;"string"==typeof o&&(o=d.pki.certificateFromPem(o)),t=o.issuer.attributes,n=o.serialNumber}var i=e.key;if(!i)throw new Error("Could not add PKCS#7 signer; no private key specified.");"string"==typeof i&&(i=d.pki.privateKeyFromPem(i));var a=e.digestAlgorithm||d.pki.oids.sha1;switch(a){case d.pki.oids.sha1:case d.pki.oids.sha256:case d.pki.oids.sha384:case d.pki.oids.sha512:case d.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+a)}var s=e.authenticatedAttributes||[];if(s.length>0){for(var u=!1,c=!1,l=0;l<s.length;++l){var f=s[l];if(u||f.type!==d.pki.oids.contentType){if(c||f.type!==d.pki.oids.messageDigest);else if(c=!0,u)break}else if(u=!0,c)break}if(!u||!c)throw new Error("Invalid signer.authenticatedAttributes. If signer.authenticatedAttributes is specified, then it must contain at least two attributes, PKCS #9 content-type and PKCS #9 message-digest.")}r.signers.push({key:i,version:1,issuer:t,serialNumber:n,digestAlgorithm:a,signatureAlgorithm:d.pki.oids.rsaEncryption,signature:null,authenticatedAttributes:s,unauthenticatedAttributes:[]})},sign:function(){if(("object"!=typeof r.content||null===r.contentInfo)&&(r.contentInfo=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(d.pki.oids.data).getBytes())]),"content"in r)){var n;r.content instanceof d.util.ByteBuffer?n=r.content.bytes():"string"==typeof r.content&&(n=d.util.encodeUtf8(r.content)),r.contentInfo.value.push(h.create(h.Class.CONTEXT_SPECIFIC,0,!0,[h.create(h.Class.UNIVERSAL,h.Type.OCTETSTRING,!1,n)]))}if(0!==r.signers.length){t(e())}},verify:function(){throw new Error("PKCS#7 signature verification not yet implemented.")},addCertificate:function(e){"string"==typeof e&&(e=d.pki.certificateFromPem(e)),r.certificates.push(e)},addCertificateRevokationList:function(e){throw new Error("PKCS#7 CRL support not yet implemented.")}}},y.createEncryptedData=function(){var e=null;return e={type:d.pki.oids.encryptedData,version:0,encryptedContent:{algorithm:d.pki.oids["aes256-CBC"]},fromAsn1:function(t){f(e,t,y.asn1.encryptedDataValidator)},decrypt:function(t){void 0!==t&&(e.encryptedContent.key=t),p(e)}}},y.createEnvelopedData=function(){var e=null;return e={type:d.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:d.pki.oids["aes256-CBC"]},fromAsn1:function(t){var r=f(e,t,y.asn1.envelopedDataValidator);e.recipients=i(r.recipientInfos.value)},toAsn1:function(){return h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(e.type).getBytes()),h.create(h.Class.CONTEXT_SPECIFIC,0,!0,[h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,h.integerToDer(e.version).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.SET,!0,a(e.recipients)),h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,l(e.encryptedContent))])])])},findRecipient:function(t){for(var r=t.issuer.attributes,n=0;n<e.recipients.length;++n){var o=e.recipients[n],i=o.issuer;if(o.serialNumber===t.serialNumber&&i.length===r.length){for(var a=!0,s=0;s<r.length;++s)if(i[s].type!==r[s].type||i[s].value!==r[s].value){a=!1;break}if(a)return o}}return null},decrypt:function(t,r){if(void 0===e.encryptedContent.key&&void 0!==t&&void 0!==r)switch(t.encryptedContent.algorithm){case d.pki.oids.rsaEncryption:case d.pki.oids.desCBC:var n=r.decrypt(t.encryptedContent.content);e.encryptedContent.key=d.util.createBuffer(n);break;default:throw new Error("Unsupported asymmetric cipher, OID "+t.encryptedContent.algorithm)}p(e)},addRecipient:function(t){e.recipients.push({version:0,issuer:t.issuer.attributes,serialNumber:t.serialNumber,encryptedContent:{algorithm:d.pki.oids.rsaEncryption,key:t.publicKey}})},encrypt:function(t,r){if(void 0===e.encryptedContent.content){r=r||e.encryptedContent.algorithm,t=t||e.encryptedContent.key;var n,o,i;switch(r){case d.pki.oids["aes128-CBC"]:n=16,o=16,i=d.aes.createEncryptionCipher;break;case d.pki.oids["aes192-CBC"]:n=24,o=16,i=d.aes.createEncryptionCipher;break;case d.pki.oids["aes256-CBC"]:n=32,o=16,i=d.aes.createEncryptionCipher;break;case d.pki.oids["des-EDE3-CBC"]:n=24,o=8,i=d.des.createEncryptionCipher;break;default:throw new Error("Unsupported symmetric cipher, OID "+r)}if(void 0===t)t=d.util.createBuffer(d.random.getBytes(n));else if(t.length()!=n)throw new Error("Symmetric key has wrong length; got "+t.length()+" bytes, expected "+n+".");e.encryptedContent.algorithm=r,e.encryptedContent.key=t,e.encryptedContent.parameter=d.util.createBuffer(d.random.getBytes(o));var a=i(t);if(a.start(e.encryptedContent.parameter.copy()),a.update(e.content),!a.finish())throw new Error("Symmetric encryption failed.");e.encryptedContent.content=a.output}for(var s=0;s<e.recipients.length;++s){var u=e.recipients[s];if(void 0===u.encryptedContent.content)switch(u.encryptedContent.algorithm){case d.pki.oids.rsaEncryption:u.encryptedContent.content=u.encryptedContent.key.encrypt(e.encryptedContent.key.data);break;default:throw new Error("Unsupported asymmetric cipher, OID "+u.encryptedContent.algorithm)}}}}}},function(e,t,r){function n(e,t){var r=t.toString(16);r[0]>="8"&&(r="00"+r);var n=a.util.hexToBytes(r);e.putInt32(n.length),e.putBytes(n)}function o(e,t){e.putInt32(t.length),e.putString(t)}function i(){for(var e=a.md.sha1.create(),t=arguments.length,r=0;r<t;++r)e.update(arguments[r]);return e.digest()}var a=r(1);r(10),r(14),r(29),r(15),r(2);var s=e.exports=a.ssh=a.ssh||{};s.privateKeyToPutty=function(e,t,r){r=r||"",t=t||"";var s=""===t?"none":"aes256-cbc",u="PuTTY-User-Key-File-2: ssh-rsa\r\n";u+="Encryption: "+s+"\r\n",u+="Comment: "+r+"\r\n";var c=a.util.createBuffer();o(c,"ssh-rsa"),n(c,e.e),n(c,e.n);var l=a.util.encode64(c.bytes(),64),f=Math.floor(l.length/66)+1;u+="Public-Lines: "+f+"\r\n",u+=l;var p=a.util.createBuffer();n(p,e.d),n(p,e.p),n(p,e.q),n(p,e.qInv);var d;if(t){var h=p.length()+16-1;h-=h%16;var y=i(p.bytes());y.truncate(y.length()-h+p.length()),p.putBuffer(y);var m=a.util.createBuffer();m.putBuffer(i("\0\0\0\0",t)),m.putBuffer(i("\0\0\0",t));var g=a.aes.createEncryptionCipher(m.truncate(8),"CBC");g.start(a.util.createBuffer().fillWithByte(0,16)),g.update(p.copy()),g.finish();var v=g.output;v.truncate(16),d=a.util.encode64(v.bytes(),64)}else d=a.util.encode64(p.bytes(),64);f=Math.floor(d.length/66)+1,u+="\r\nPrivate-Lines: "+f+"\r\n",u+=d;var b=i("putty-private-key-file-mac-key",t),E=a.util.createBuffer();o(E,"ssh-rsa"),o(E,s),o(E,r),E.putInt32(c.length()),E.putBuffer(c),E.putInt32(p.length()),E.putBuffer(p);var C=a.hmac.create();return C.start("sha1",b),C.update(E.bytes()),u+="\r\nPrivate-MAC: "+C.digest().toHex()+"\r\n"},s.publicKeyToOpenSSH=function(e,t){t=t||"";var r=a.util.createBuffer();return o(r,"ssh-rsa"),n(r,e.e),n(r,e.n),"ssh-rsa "+a.util.encode64(r.bytes())+" "+t},s.privateKeyToOpenSSH=function(e,t){return t?a.pki.encryptRsaPrivateKey(e,t,{legacy:!0,algorithm:"aes128"}):a.pki.privateKeyToPem(e)},s.getPublicKeyFingerprint=function(e,t){t=t||{};var r=t.md||a.md.md5.create(),i=a.util.createBuffer();o(i,"ssh-rsa"),n(i,e.e),n(i,e.n),r.start(),r.update(i.getBytes());var s=r.digest();if("hex"===t.encoding){var u=s.toHex();return t.delimiter?u.match(/.{2}/g).join(t.delimiter):u}if("binary"===t.encoding)return s.getBytes();if(t.encoding)throw new Error('Unknown encoding "'+t.encoding+'".');return s}},function(e,t,r){var n=r(1);r(57),r(58),r(2);var o="forge.task",i={},a=0;n.debug.set(o,"tasks",i);var s={};n.debug.set(o,"queues",s);var u="ready",c="running",l="blocked",f="sleeping",p="done",d="error",h="stop",y="start",m={};m[u]={},m[u][h]=u,m[u][y]=c,m[u].cancel=p,m[u].fail=d,m[c]={},m[c][h]=u,m[c][y]=c,m[c].block=l,m[c].unblock=c,m[c].sleep=f,m[c].wakeup=c,m[c].cancel=p,m[c].fail=d,m[l]={},m[l][h]=l,m[l][y]=l,m[l].block=l,m[l].unblock=l,m[l].sleep=l,m[l].wakeup=l,m[l].cancel=p,m[l].fail=d,m[f]={},m[f][h]=f,m[f][y]=f,m[f].block=f,m[f].unblock=f,m[f].sleep=f,m[f].wakeup=f,m[f].cancel=p,m[f].fail=d,m[p]={},m[p][h]=p,m[p][y]=p,m[p].block=p,m[p].unblock=p,m[p].sleep=p,m[p].wakeup=p,m[p].cancel=p,m[p].fail=d,m[d]={},m[d][h]=d,m[d][y]=d,m[d].block=d,m[d].unblock=d,m[d].sleep=d,m[d].wakeup=d,m[d].cancel=d,m[d].fail=d;var g=function(e){this.id=-1,this.name=e.name||"?",this.parent=e.parent||null,this.run=e.run,this.subtasks=[],this.error=!1,this.state=u,this.blocks=0,this.timeoutId=null,this.swapTime=null,this.userData=null,this.id=a++,i[this.id]=this};g.prototype.debug=function(e){e=e||"",n.log.debug(o,e,"[%s][%s] task:",this.id,this.name,this,"subtasks:",this.subtasks.length,"queue:",s)},g.prototype.next=function(e,t){"function"==typeof e&&(t=e,e=this.name);var r=new g({run:t,name:e,parent:this});return r.state=c,r.type=this.type,r.successCallback=this.successCallback||null,r.failureCallback=this.failureCallback||null,this.subtasks.push(r),this},g.prototype.parallel=function(e,t){return n.util.isArray(e)&&(t=e,e=this.name),this.next(e,function(r){var o=r;o.block(t.length);for(var i=0;i<t.length;i++){var a=e+"__parallel-"+r.id+"-"+i,s=i;!function(e,r){n.task.start({type:e,run:function(e){t[r](e)},success:function(e){o.unblock()},failure:function(e){o.unblock()}})}(a,s)}})},g.prototype.stop=function(){this.state=m[this.state][h]},g.prototype.start=function(){this.error=!1,this.state=m[this.state][y],this.state===c&&(this.start=new Date,this.run(this),b(this,0))},g.prototype.block=function(e){e=void 0===e?1:e,this.blocks+=e,this.blocks>0&&(this.state=m[this.state].block)},g.prototype.unblock=function(e){return e=void 0===e?1:e,this.blocks-=e,0===this.blocks&&this.state!==p&&(this.state=c,b(this,0)),this.blocks},g.prototype.sleep=function(e){e=void 0===e?0:e,this.state=m[this.state].sleep;var t=this;this.timeoutId=setTimeout(function(){t.timeoutId=null,t.state=c,b(t,0)},e)},g.prototype.wait=function(e){e.wait(this)},g.prototype.wakeup=function(){this.state===f&&(cancelTimeout(this.timeoutId),this.timeoutId=null,this.state=c,b(this,0))},g.prototype.cancel=function(){this.state=m[this.state].cancel,this.permitsNeeded=0,null!==this.timeoutId&&(cancelTimeout(this.timeoutId),this.timeoutId=null),this.subtasks=[]},g.prototype.fail=function(e){if(this.error=!0,E(this,!0),e)e.error=this.error,e.swapTime=this.swapTime,e.userData=this.userData,b(e,0);else{if(null!==this.parent){for(var t=this.parent;null!==t.parent;)t.error=this.error,t.swapTime=this.swapTime,t.userData=this.userData,t=t.parent;E(t,!0)}this.failureCallback&&this.failureCallback(this)}};var v=function(e){e.error=!1,e.state=m[e.state][y],setTimeout(function(){e.state===c&&(e.swapTime=+new Date,e.run(e),b(e,0))},0)},b=function(e,t){var r=t>30||+new Date-e.swapTime>20,n=function(t){if(t++,e.state===c)if(r&&(e.swapTime=+new Date),e.subtasks.length>0){var n=e.subtasks.shift();n.error=e.error,n.swapTime=e.swapTime,n.userData=e.userData,n.run(n),n.error||b(n,t)}else E(e),e.error||null!==e.parent&&(e.parent.error=e.error,e.parent.swapTime=e.swapTime,e.parent.userData=e.userData,b(e.parent,t))};r?setTimeout(n,0):n(t)},E=function(e,t){e.state=p,delete i[e.id],null===e.parent&&(e.type in s?0===s[e.type].length?n.log.error(o,"[%s][%s] task queue empty [%s]",e.id,e.name,e.type):s[e.type][0]!==e?n.log.error(o,"[%s][%s] task not first in queue [%s]",e.id,e.name,e.type):(s[e.type].shift(),0===s[e.type].length?delete s[e.type]:s[e.type][0].start()):n.log.error(o,"[%s][%s] task queue missing [%s]",e.id,e.name,e.type),t||(e.error&&e.failureCallback?e.failureCallback(e):!e.error&&e.successCallback&&e.successCallback(e)))};e.exports=n.task=n.task||{},n.task.start=function(e){var t=new g({run:e.run,name:e.name||"?"});t.type=e.type,t.successCallback=e.success||null,t.failureCallback=e.failure||null,t.type in s?s[e.type].push(t):(s[t.type]=[t],v(t))},n.task.cancel=function(e){e in s&&(s[e]=[s[e][0]])},n.task.createCondition=function(){var e={tasks:{}};return e.wait=function(t){t.id in e.tasks||(t.block(),e.tasks[t.id]=t)},e.notify=function(){var t=e.tasks;e.tasks={};for(var r in t)t[r].unblock()},e}},function(e,t,r){"use strict";t.__esModule=!0;var n=r(43),o=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(n),i=function(){try{if("undefined"!=typeof process&&process.env&&process.env.ISOLATED_AUTH_PRIVATE_KEY)return o.util.decode64(process.env.ISOLATED_AUTH_PRIVATE_KEY)}catch(e){}return null}();t.default=i},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=r(0),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=function(e){function t(){return n(this,t),o(this,e.apply(this,arguments))}return i(t,e),t.prototype.setup=function(){return this.client.request("mfa.setup").then(function(e){return{secret:e.data.SetupSecret,qrCodeImage:e.data.SetupQrCode}})},t.prototype.enable=function(e){return this.client.request("mfa.enable",{totp:e})},t.prototype.remove=function(e){var t=this;return this.client.crypto().generatePasswordHash(e).then(function(e){return t.client.request("mfa.remove",{password:e})})},t}(s.default);t.default=u},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){var t={};return Object.keys(g).forEach(function(r){t[r]=e[g[r]]}),t}function u(e){return(e||[]).map(function(e){return(new p.default).fromProof(e)})}t.__esModule=!0;var c=r(0),l=n(c),f=r(13),p=n(f),d=r(21),h=n(d),y=r(113),m=n(y),g={inbox:"ProofIn",sent:"ProofOut",outbox:"ProofOutBox",briefs:"AllBriefs"},v=function(e){function t(r){o(this,t);var n=i(this,e.call(this,r));return n.groups=new m.default(r),n}return a(t,e),t.prototype.inbox=function(){return this._loadSingleTabProofs("inbox")},t.prototype.sent=function(){return this._loadSingleTabProofs("sent")},t.prototype.outbox=function(){return this._loadSingleTabProofs("outbox")},t.prototype.briefs=function(){return this._loadSingleTabProofs("briefs")},t.prototype._loadSingleTabProofs=function(e){return this.client.request("dashboard."+e).then(function(e){return s(e.data)}).then(function(t){return t[e]}).then(u)},t.prototype.search=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.status,n=t.everything;return this._loadSearchProofs({query:e,filterBy:void 0===r?void 0:[].concat(r).join(","),all:n?1:0})},t.prototype.everything=function(){return this.search(void 0,{everything:!0})},t.prototype.approved=function(){return this.search(void 0,{status:h.default.APPROVED})},t.prototype.archived=function(){return this.search(void 0,{status:h.default.ARCHIVED})},t.prototype._loadSearchProofs=function(e){return this.client.request("dashboard.search",e).then(function(e){return u(e.data.Proofs)})},t}(l.default);t.default=v},function(e,t,r){"use strict";function n(e,t,r){return(1-(t+r))*e+t}t.__esModule=!0,t.default=n},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=r(3),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a={count:(0,o.number)("Count"),decision:(0,o.number)("Decision"),users:(0,o.each)("Users",function(e){return{id:e.UserId,name:e.Name,email:e.Email,nudgedDate:(0,o.date)("NudgedInStep")(e)}})},s=function(){function e(){n(this,e)}return e.prototype.fromDecisionSummary=function(e){return(0,i.default)(this,a,e),this},e}();t.default=s},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=r(3),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a={referenceId:"ReferenceId",referenceUrl:"ReferenceUrl",referenceType:"ReferenceType",referenceLabel:"ReferenceLabel",metadata:"Metadata"},s=function(){function e(){n(this,e)}return e.prototype.fromProofIntegrationReference=function(e){return(0,i.default)(this,a,e),this},e}();t.default=s},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=r(3),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a={id:"Id",templateId:"TemplateId",name:"Name",description:"Description",isRequiredForFinalApproval:"IsRequiredForFinalApproval",shouldOpenOnProofLoad:"ShouldOpenOnProofLoad"},s=function(){function e(){n(this,e)}return e.prototype.fromProofChecklist=function(e){return(0,i.default)(this,a,e),this},e}();t.default=s},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){return(e||[]).map(function(e){return(new f.default).fromProofGroup(e)})}t.__esModule=!0;var u=r(0),c=n(u),l=r(23),f=n(l),p=function(e){function t(){return o(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype._loadGroups=function(e){return this.client.request("dashboard.groups.filter-by",{filterBy:e}).then(function(e){return s(e.data)})},t.prototype.current=function(){return this._loadGroups("current")},t.prototype.archived=function(){return this._loadGroups("archived")},t}(c.default);t.default=p},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){return e.data.length>0?(new p.default).fromUser(e.data[0]):(new p.default).fromUser(e.data)}function u(e){return e.data.length?(new p.default).fromUser(e.data[0]):null}t.__esModule=!0;var c=r(0),l=n(c),f=r(9),p=n(f),d=function(e){function t(){return o(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.byEmail=function(e){return this.client.request("users.by-email",{email:e}).then(u)},t.prototype.byId=function(e){return this.client.request("users.by-id",{userId:e}).then(s)},t.prototype.invite=function(e){return this.client.request("users.invite",{email:e}).then(s)},t}(l.default);t.default=d},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){var t=[].concat(e);return t.forEach(function(e){e.proofId=e.id,delete e.id}),t}t.__esModule=!0;var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},c=r(0),l=n(c),f=r(116),p=n(f),d=r(117),h=n(d),y=r(118),m=n(y),g=r(119),v=n(g),b=r(120),E=n(b),C=r(123),_=n(C),w=r(124),T=n(w),S=r(133),I=n(S),A=r(134),k=n(A),B=r(135),R=n(B),P=r(136),O=n(P),D=r(13),N=n(D),L=r(137),U=n(L),x=r(24),M=n(x),V=r(5),j=r(4),F=n(j),q=function(e){function t(r){o(this,t);var n=i(this,e.call(this,r));return n.owners=new p.default(r),n.editors=new h.default(r),n.reviewers=new m.default(r),n.versions=new v.default(r),n.groups=new E.default(r),n.reminders=new U.default(r),n.audit=new _.default(r),n.assets=new T.default(r),n.customTools=new I.default(r),n.integrationReferences=new k.default(r),n.linkCheck=new R.default(r),n.decisions=new O.default(r),n}return a(t,e),t.prototype.setWorkflow=function(e,t){var r=this;return this.client.request("proofs.normalize-workflow",{proofId:e,workflowId:t}).then(function(){return r.client.request("proofs.set-workflow",{proofId:e,workflowId:t})})},t.prototype.setTags=function(e,t){return this.client.request("proofs.set-tags",{relatedId:e,tag:t.join(",")})},t.prototype.deleteTag=function(e,t){return this.client.request("proofs.tag-delete",{relatedId:e,tag:t})},t.prototype.setFile=function(e,t){var r=this;return this.client.request("proofs.set-file",{proofId:e,fileId:t}).then(function(){return r.client.request("proofs.distribute-file",{proofId:e})})},t.prototype.create=function(e){var t=this,r=e.name,n=e.tags,o=void 0===n?[]:n,i=e.dueDate,a=void 0===i?new Date(Date.now()+3*V.DAY_IN_MS):i,s=e.messageToReviewers,u=e.workflow,c=e.workflowTemplate,l=e.proofTemplate,f=e.checklist,p=e.file,d=e.group,h=e.previousProof,y=e.team,m=e.reference,g=e.customTools,v=e.integrationReferences,b=e.reminders,E=void 0===b?[]:b,C=e.owners,_=e.canDownload,w=e.isPublic,T=e.start,S=void 0===T||T,I=e.commentVisibility,A=void 0===I?null:I,k=e.priority,B=e.scheduledDate;return this.client.request("proofs.create",{proof:{name:r,tags:o,dueDate:a.toISOString?a.toISOString():String(a),messageToReviewers:s,workflowId:u&&u.id||void 0,workflowTemplateId:c&&c.id||void 0,proofTemplateId:l&&l.id||void 0,checklist:f,fileId:p&&p.id||void 0,groupId:d&&d.id||void 0,previousProofId:h&&h.id||void 0,teamSlug:y&&y.slug||void 0,reference:m,integrationReferences:v,reminders:[].concat(E),owners:C,canDownload:_,isPublic:w,start:S,commentVisibility:A,priority:k,scheduledDate:B.toISOString?B.toISOString():String(B)}}).then(function(e){var r=(new N.default).fromProof(e.data);return r.calculateState(),g&&!h?t.customTools.update(r.id,g).then(function(){return r}):r})},t.prototype.archive=function(e){return this.client.request("proofs.archive",{proofIds:e})},t.prototype.unarchive=function(e){return this.client.request("proofs.unarchive",{proofId:e})},t.prototype.delete=function(e){return this.client.request("proofs.delete",{proofId:e})},t.prototype.finish=function(e,t){return this.client.request("proofs.finish",{proofId:e,decision:t})},t.prototype.approve=function(e,t){return this.client.request("proofs.manual-approval",{proofId:e,message:t})},t.prototype.withdrawApproval=function(e,t){return this.client.request("proofs.withdraw-approval",{proofId:e,messageToSender:t})},t.prototype.generateEmail=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.client.request("email.proofs.generate",u({proofId:e},t)).then(function(e){return e.data})},t.prototype.return=function(e){return this.client.request("proofs.return",{proofIds:[].concat(e)}).then(function(e){return{proofIds:e.data.ProofIds,errors:e.data.Errors.map(function(e){return{proofId:e.ProofId,errorCode:e.ErrorCode,errorMessage:e.ErrorMessage}})}})},t.prototype.start=function(e){return this.client.request("proofs.start",{proofId:e})},t.prototype.removeEditor=function(e){return this.client.request("proofs.remove-editor",{proofId:e})},t.prototype.load=function(e){return this.client.request("proofs.load",{proofId:e}).then(function(e){return(new N.default).fromProof(e.data)})},t.prototype.lock=function(e){return this.client.request("proofs.lock",{proofId:e})},t.prototype.unlock=function(e){return this.client.request("proofs.unlock",{proofId:e})},t.prototype.requestUnlock=function(e){return this.client.request("proofs.request-unlock",{proofId:e})},t.prototype.requestAccess=function(e){return this.client.request("proofs.request-access",{proofId:e})},t.prototype.images=function(e){return this.client.request("proofs.images",{proofId:e}).then(function(e){return e.data.proof.file})},t.prototype.videoCredentials=function(e){var t=this;return this.client.cache.auto(V.VIDEO_CREDENTIALS_CACHE_PREFIX+e,function(){return t._videoCredentials(e)})},t.prototype._videoCredentials=function(e){var t=this,r=new F.default;return this.client.request("proofs.video-credentials",{proofId:e}).then(function(e){return Promise.all([e.data.envelope.envelope,t.client.rawRequest({method:"GET",url:new M.default(e.data.videoCredentials.url)}).then(function(e){return e.body})])}).then(function(e){var r=e[0],n=e[1];return t.client.crypto().decryptImage(r+"-"+n,t.client.keyPairs.getPrivateKeyPEMs())}).then(function(e){return r.createBase64(e).then(function(e){return r.read(e)})}).then(function(e){try{return JSON.parse(e)}catch(o){var t=e.split("|"),r=t[0],n=t[1];return{streamingUrl:r.replace("http://","https://")+"/manifest(format=m3u8-aapl,encryption=cbc)",accessToken:n,manifestUrl:r.replace("http://","https://")+"/manifest",bearerToken:n}}})},t.prototype._getProofSetup=function(e,t){return this.client.request("integrations.get-proof-setup",{integration_key:e,id:t}).then(function(e){return{payload:e.data.payload}})},t.prototype.setMessageToReviewers=function(e,t){return this.client.request("proofs.set-message-to-reviewers",{proofIds:[].concat(e),messageToReviewers:t})},t.prototype.returnTodos=function(e,t){var r=t.messageToOwners,n=t.markCommentsAsTodo,o=void 0!==n&&n;return this.client.request("proofs.return-todos",{proofIds:[].concat(e),messageToOwners:r,markCommentAsTodo:o})},t.prototype.updateDecision=function(e,t){return this.client.request("proofs.update-decision",{proofId:e,decision:t})},t.prototype.update=function(e){if(1===e.length||void 0===e.length){var t=[].concat(e)[0],r=t.id,n=t.name,o=t.tags,i=t.dueDate,a=t.messageToReviewers,u=t.workflow,c=t.checklist,l=t.group,f=t.proofTemplate,p=t.file,d=t.reference,h=t.integrationReferences,y=t.reminders,m=t.owners,g=t.canDownload,v=t.isPublic,b=t.start,E=t.commentVisibility,C=t.priority,_=t.scheduledDate;return this.client.request("proofs.update",{proof:{id:r,name:n,tags:o,dueDate:i?i.toISOString():void 0,messageToReviewers:a,workflowId:u&&u.id||void 0,proofTemplateId:f&&f.id||void 0,checklist:c,fileId:p&&p.id||void 0,groupId:l&&l.id||void 0,reference:d,integrationReferences:h,reminders:y?[].concat(y):void 0,owners:m,canDownload:g,isPublic:v,start:b,commentVisibility:E,priority:C,scheduledDate:_?_.toISOString():void 0}}).then(function(e){var t=(new N.default).fromProof(e.data);return t.calculateState(),t})}return this.client.request("proofs.bulk-update",{proofs:s(e)})},t.prototype.next=function(e){return this.client.request("proofs.next",{proofId:e}).then(function(e){return(new N.default).fromProof(e.data)})},t.prototype.addWorkflow=function(e,t){return this.client.request("proofs-workflow.add-bulk",{proofIds:[].concat(e),workflowTemplateId:t})},t.prototype.sendShareLink=function(e){var t=e.proofId,r=e.message,n=e.emailAddresses;return this.client.request("proofs.send-share-link",{proofId:t,message:r,emailAddresses:n})},t.prototype.getWorkflowMetrics=function(e){return this.client.request("proofs.get-workflow-metrics",{proofId:e}).then(function(e){return e.data?e.data.workflowMetrics:null})},t}(l.default);t.default=q},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=r(0),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=function(e){function t(){return n(this,t),o(this,e.apply(this,arguments))}return i(t,e),t.prototype.add=function(e,t){return this.client.request("proofs-owners.add",{proofIds:[].concat(e),users:[].concat(t)})},t.prototype.remove=function(e,t){return this.client.request("proofs-owners.remove",{proofId:e,users:[].concat(t)})},t}(s.default);t.default=u},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function a(e){var t=[].concat(e);return t.forEach(function(e){e.editorMessage=e.messageToEditors,delete e.messageToEditors}),t}t.__esModule=!0;var s=r(0),u=function(e){return e&&e.__esModule?e:{default:e}}(s),c=function(e){function t(){return n(this,t),o(this,e.apply(this,arguments))}return i(t,e),t.prototype.add=function(e,t,r){var n={proofId:e,editors:[].concat(t),editorMessage:null===r?"":r};return this.client.request("proofs.editors.add",n)},t.prototype.addBulk=function(e){return this.client.request("proofs.editors.add-bulk",{proofsWithEditors:a(e)})},t.prototype.remove=function(e,t){return this.client.request("proofs.editors.remove",{proofId:e,editors:[].concat(t)})},t.prototype.replace=function(e,t,r){return this.client.request("proofs.editors.replace",{proofId:e,oldEditors:[].concat(t),newEditors:[].concat(r)})},t.prototype.set=function(e,t){return this.client.request("proofs.editors.set",{proofId:e,editors:[].concat(t)})},t}(u.default);t.default=c},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=r(0),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=function(e){function t(){return n(this,t),o(this,e.apply(this,arguments))}return i(t,e),t.prototype.add=function(e,t){return this.client.request("proofs-reviewers.add",{proofIds:[].concat(e),reviewers:[].concat(t)})},t}(s.default);t.default=u},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=r(0),u=n(s),c=r(62),l=n(c),f=r(63),p=(0,f.sortObjectsByKey)("version"),d=function(e){function t(){return o(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.attach=function(e,t){return this.client.request("proofs.versions.attach",{proofId:e,versionId:t})},t.prototype.list=function(e){return this.client.request("proofs.versions.list",{proofId:e}).then(function(e){return e.data.map(function(e){return(new l.default).fromProofVersion(e)}).sort(p)})},t}(u.default);t.default=d},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){return(new p.default).fromProofGroup(e.data)}t.__esModule=!0;var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},c=r(0),l=n(c),f=r(23),p=n(f),d=r(121),h=n(d),y=r(122),m=n(y),g=function(e){function t(r){o(this,t);var n=i(this,e.call(this,r));return n.owners=new h.default(r),n.workflows=new m.default(r),n}return a(t,e),t.prototype.create=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.name,r=e.isOwnedByTeam;return this.client.request("proofs.groups.create",{name:t,ownedByTeam:r}).then(s)},t.prototype.load=function(e){return this.client.request("proofs.groups.load",{groupId:e}).then(s)},t.prototype.ready=function(e){return this.client.request("proofs.groups.ready",{groupId:e})},t.prototype.update=function(e,t){var r=t.name,n=t.isOwnedByTeam,o=t.folder;return this.client.request("proofs.groups.update",{groupId:e,name:r,ownedByTeam:n,folderName:o&&o.name}).then(s)},t.prototype.removeProof=function(e){return this.client.request("proofs.groups.remove-proof",{proofId:e})},t.prototype.addProof=function(e,t){return this.client.request("proofs.groups.add-proof",{groupId:e,proofId:t})},t.prototype.delete=function(e){return this.client.request("proofs.groups.delete",{groupId:e})},t.prototype.archive=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];if(t.every(function(e){return"string"==typeof e}))return this.client.request("proofs.groups.archive",{groupIds:t});var n={archiveProofs:!1},o=t[0],i=t[1],a=void 0===i?n:i,s=[].concat(o);return this.client.request("proofs.groups.archive",u({groupIds:s},a))},t.prototype.reopen=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.client.request("proofs.groups.reopen",{groupIds:t})},t}(l.default);t.default=g},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=r(0),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=function(e){function t(){return n(this,t),o(this,e.apply(this,arguments))}return i(t,e),t.prototype.add=function(e,t){return this.client.request("proofs.groups.owners.add",{groupId:e,owners:[].concat(t)})},t}(s.default);t.default=u},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=r(0),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=function(e){function t(){return n(this,t),o(this,e.apply(this,arguments))}return i(t,e),t.prototype.addReviewers=function(e,t){return this.client.request("proofs.groups.workflows.add-reviewers",{groupId:e,reviewers:[].concat(t)})},t.prototype.replaceApprover=function(e,t){return this.client.request("proofs.groups.replace-approver",{groupId:e,user:t})},t}(s.default);t.default=u},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=r(0),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=function(e){function t(){return n(this,t),o(this,e.apply(this,arguments))}return i(t,e),t.prototype.summary=function(e){return this.client.request("proofs.audit.summary",{proofId:e}).then(function(e){return e.data.summary})},t}(s.default);t.default=u},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=r(0),u=n(s),c=r(125),l=n(c),f=r(132),p=n(f),d=function(e){function t(r){o(this,t);var n=i(this,e.call(this,r));return n.extractedText=new p.default(r),n.colorSeparations=new l.default(r),n}return a(t,e),t}(u.default);t.default=d},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=r(0),u=n(s),c=r(24),l=n(c),f=r(4),p=n(f),d=function(e){function t(){return o(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.resources=function(e){return this.client.request("proofs.assets.color-separations",{proofId:e}).then(function(e){return e.data.result}).catch(function(e){if(!e||!e.response||400!==e.response.code)throw e})},t.prototype.download=function(e,t,r){var n=this,o=e.pages.filter(function(e){return e.number===t});if(!o.length)return Promise.reject(new Error("Page does not have any color separation plates."));var i=o[0].plates.filter(function(e){return e.name===r});if(!i.length)return Promise.reject(new Error("Page "+t+' does not have a plate named "'+r+'".'));var a=new l.default(i[0].url),s=e.envelope,u=new p.default;return this.client.rawRequest({method:"GET",url:a},{bluffer:!0}).then(function(e){return e.body}).then(function(e){return u.readBase64(e)}).then(function(e){return n.client.crypto().decryptBytes(e,s,n.client.keyPairs.getPrivateKeyPEMs(),[],[])}).then(function(e){return u.createBase64(e)})},t}(u.default);t.default=d},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=r(35),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a=function(){function e(){n(this,e)}return e.prototype.create=function(e){return Promise.resolve(new Blob([(0,i.default)(e)]))},e.prototype.createBase64=function(e){return this.create(atob(e))},e.prototype.createArrayBuffer=function(e){return Promise.resolve(new Blob([e]))},e.prototype.combine=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return Promise.resolve(new Blob(t))},e.prototype.slice=function(e,t,r){return Promise.resolve(e.slice(t,r))},e.prototype.read=function(e){return new Promise(function(t,r){var n=new FileReader;n.onload=function(){t(n.result)},n.onerror=function(){r(n.error)},n.readAsText(e)})},e.prototype.readBase64=function(e){return new Promise(function(t,r){var n=new FileReader;n.onload=function(){var e=n.result;t(e.substring(e.indexOf(",")+1))},n.onerror=function(){r(n.error)},n.readAsDataURL(e)})},e.prototype.readArrayBuffer=function(e){return new Promise(function(t,r){var n=new FileReader;n.onload=function(){t(n.result)},n.onerror=function(){r(n.error)},n.readAsArrayBuffer(e)})},e.prototype.size=function(e){return e.size},e}();t.default=a},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=function(){function e(){n(this,e)}return e.prototype.create=function(e){return Promise.resolve(Buffer.from(e))},e.prototype.createBase64=function(e){return Promise.resolve(Buffer.from(e,"base64"))},e.prototype.createArrayBuffer=function(e){for(var t=Buffer.alloc(e.byteLength),r=new Uint8Array(e),n=0;n<t.length;n++)t[n]=r[n];return Promise.resolve(t)},e.prototype.combine=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return Promise.resolve(Buffer.concat(t))},e.prototype.slice=function(e,t,r){return Promise.resolve(e.slice(t,r))},e.prototype.read=function(e){return Promise.resolve(e.toString())},e.prototype.readBase64=function(e){return Promise.resolve(e.toString("base64"))},e.prototype.readArrayBuffer=function(e){for(var t=new ArrayBuffer(e.length),r=new Uint8Array(t),n=0;n<e.length;n++)r[n]=e[n];return Promise.resolve(t)},e.prototype.size=function(e){return Buffer.byteLength(e)},e}();t.default=o},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e){for(var t=e.length,r=e.length-1;r>=0;r--){var n=e.charCodeAt(r);n>127&&n<=2047?t++:n>2047&&n<=65535&&(t+=2),n>=56320&&n<=57343&&r--}return t}t.__esModule=!0;var a=r(129),s=r(64),u=n(s),c=r(35),l=n(c),f=function(){function e(){o(this,e)}return e.prototype.create=function(e){return Promise.resolve(e)},e.prototype.createBase64=function(e){return Promise.resolve((0,a.atob)(e))},e.prototype.createArrayBuffer=function(e){return Promise.resolve((0,u.default)(e))},e.prototype.combine=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return Promise.resolve(t.join(""))},e.prototype.slice=function(e,t,r){return Promise.resolve(e.slice(t,r))},e.prototype.read=function(e){return Promise.resolve(e)},e.prototype.readBase64=function(e){return Promise.resolve((0,a.btoa)(e))},e.prototype.readArrayBuffer=function(e){return Promise.resolve((0,l.default)(e))},e.prototype.size=function(e){return i(e)},e}();t.default=f},function(e,t,r){!function(){function e(e){this.message=e}var r=t,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";e.prototype=new Error,e.prototype.name="InvalidCharacterError",r.btoa||(r.btoa=function(t){for(var r,o,i=String(t),a=0,s=n,u="";i.charAt(0|a)||(s="=",a%1);u+=s.charAt(63&r>>8-a%1*8)){if((o=i.charCodeAt(a+=.75))>255)throw new e("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");r=r<<8|o}return u}),r.atob||(r.atob=function(t){var r=String(t).replace(/[=]+$/,"");if(r.length%4==1)throw new e("'atob' failed: The string to be decoded is not correctly encoded.");for(var o,i,a=0,s=0,u="";i=r.charAt(s++);~i&&(o=a%4?64*o+i:i,a++%4)?u+=String.fromCharCode(255&o>>(-2*a&6)):0)i=n.indexOf(i);return u})}()},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e){return e.byteLength!==e.buffer.byteLength?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):e.buffer}function a(e){return new Uint8Array(e)}function s(e){return(0,d.default)(i(e))}function u(e){return a((0,y.default)(e))}function c(e){for(var t=new Uint8Array(e.reduce(function(e,t){return e+t.byteLength},0)),r=0,n=0;r<e.length;r++)t.set(e[r],n),n+=e[r].byteLength;return t}t.__esModule=!0;var l=r(131),f=n(l),p=r(64),d=n(p),h=r(35),y=n(h),m=function(){function e(){o(this,e)}return e.prototype.create=function(e){return Promise.resolve(u(e))},e.prototype.createBase64=function(e){return Promise.resolve(f.default.toByteArray(e))},e.prototype.createArrayBuffer=function(e){return Promise.resolve(a(e))},e.prototype.combine=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return Promise.resolve(c(t))},e.prototype.slice=function(e,t,r){return Promise.resolve(e.slice(t,r))},e.prototype.read=function(e){return Promise.resolve(s(e))},e.prototype.readBase64=function(e){return Promise.resolve(f.default.fromByteArray(e))},e.prototype.readArrayBuffer=function(e){return Promise.resolve(i(e))},e.prototype.size=function(e){return e.byteLength},e}();t.default=m},function(e,t,r){"use strict";function n(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function o(e){var t=n(e),r=t[0],o=t[1];return 3*(r+o)/4-o}function i(e,t,r){return 3*(t+r)/4-r}function a(e){var t,r,o=n(e),a=o[0],s=o[1],u=new p(i(e,a,s)),c=0,l=s>0?a-4:a;for(r=0;r<l;r+=4)t=f[e.charCodeAt(r)]<<18|f[e.charCodeAt(r+1)]<<12|f[e.charCodeAt(r+2)]<<6|f[e.charCodeAt(r+3)],u[c++]=t>>16&255,u[c++]=t>>8&255,u[c++]=255&t;return 2===s&&(t=f[e.charCodeAt(r)]<<2|f[e.charCodeAt(r+1)]>>4,u[c++]=255&t),1===s&&(t=f[e.charCodeAt(r)]<<10|f[e.charCodeAt(r+1)]<<4|f[e.charCodeAt(r+2)]>>2,u[c++]=t>>8&255,u[c++]=255&t),u}function s(e){return l[e>>18&63]+l[e>>12&63]+l[e>>6&63]+l[63&e]}function u(e,t,r){for(var n,o=[],i=t;i<r;i+=3)n=(e[i]<<16&16711680)+(e[i+1]<<8&65280)+(255&e[i+2]),o.push(s(n));return o.join("")}function c(e){for(var t,r=e.length,n=r%3,o=[],i=0,a=r-n;i<a;i+=16383)o.push(u(e,i,i+16383>a?a:i+16383));return 1===n?(t=e[r-1],o.push(l[t>>2]+l[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],o.push(l[t>>10]+l[t>>4&63]+l[t<<2&63]+"=")),o.join("")}t.byteLength=o,t.toByteArray=a,t.fromByteArray=c;for(var l=[],f=[],p="undefined"!=typeof Uint8Array?Uint8Array:Array,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h=0,y=d.length;h<y;++h)l[h]=d[h],f[d.charCodeAt(h)]=h;f["-".charCodeAt(0)]=62,f["_".charCodeAt(0)]=63},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=r(0),u=n(s),c=r(24),l=n(c),f=r(4),p=n(f),d=function(e){function t(){return o(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.resources=function(e){return this.client.request("proofs.assets.extracted-text",{proofId:e}).then(function(e){return e.data.result}).catch(function(e){if(!e||!e.response||400!==e.response.code)throw e})},t.prototype.download=function(e,t){var r=this,n=e.pages.filter(function(e){return e.number===t});if(!n||!n.length)return Promise.reject(new Error("Page does not contain any text."));var o=e.envelope,i=new l.default(n[0].chunks[0].url),a=new p.default;return this.client.rawRequest({method:"GET",url:i},{bluffer:!0}).then(function(e){return e.body}).then(function(e){return a.readBase64(e)}).then(function(e){return r.client.crypto().decryptBytes(e,o,r.client.keyPairs.getPrivateKeyPEMs(),[],["unzip"])}).then(function(e){return a.createBase64(e)}).then(function(e){return a.readArrayBuffer(e)}).then(function(e){return r.client.protobuf().ExtractedText(e)})},t}(u.default);t.default=d},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=r(0),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=function(e){function t(){return n(this,t),o(this,e.apply(this,arguments))}return i(t,e),t.prototype.validate=function(e){return this.client.request("proofs.custom-tools.validate",{schema:e}).then(function(){})},t.prototype.load=function(e){return this.client.request("proofs.custom-tools.load",{proofId:e}).then(function(e){return e.data.tools})},t.prototype.update=function(e,t){return this.client.request("proofs.custom-tools.update",{proofId:e,updates:t}).then(function(e){return e.data.tools})},t}(s.default);t.default=u},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(0),u=function(e){return e&&e.__esModule?e:{default:e}}(s),c=function(e){function t(){return n(this,t),o(this,e.apply(this,arguments))}return i(t,e),t.prototype.availableIntegrations=function(){return this.client.request("integrations.get-available-reference-integrations").then(function(e){return e.data.integrations})},t.prototype.options=function(e,t){return this.client.request("integrations.get-available-reference-options",{params:a({},t,{integration_key:e})}).then(function(e){return e.data.optionTypes})},t.prototype.add=function(e,t){return this.client.request("integrations.proof-integration-references.add",{proofId:e,integrationReference:t})},t.prototype.remove=function(e,t){return this.client.request("integrations.proof-integration-references.remove",{proofId:e,referenceId:t})},t.prototype.loadReferenceAdditionalInformation=function(e,t,r){return this.client.request("integrations.load-reference-additional-information",{params:a({},r,{reference_type:e,reference_id:t})}).then(function(e){return e.data.information})},t}(u.default);t.default=c},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=r(0),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=function(e){function t(){return n(this,t),o(this,e.apply(this,arguments))}return i(t,e),t.prototype.results=function(e){return this.client.request("proofs.link-check.results",{proofId:e})},t.prototype.recheck=function(e){return this.client.request("proofs.link-check.recheck",{proofId:e})},t}(s.default);t.default=u},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=r(0),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=function(e){function t(){return n(this,t),o(this,e.apply(this,arguments))}return i(t,e),t.prototype.load=function(e){return this.client.request("proofs.decisions.load",{proofId:e}).then(function(e){return e.data.decisions})},t.prototype.getOptions=function(e){return this.client.request("proofs.decisions.get-options",{proofId:e,type:"options"}).then(function(e){return{currentDecision:e.data.currentDecision,options:e.data.options}})},t.prototype.leaveDecision=function(e,t){return this.client.request("proofs.decisions.leave-decision",{proofId:e,decisionId:t})},t}(s.default);t.default=u},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){return e.map(function(e){return(new f.default).fromReminder(e)})}t.__esModule=!0;var u=r(0),c=n(u),l=r(138),f=n(l),p=function(e){function t(){return o(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.add=function(e,t){return this.client.request("reminders.add",{entityId:e,reminders:[{action:t.action,relativeTo:t.relativeTo,relativeDate:t.relativeDate,absoluteDate:t.absoluteDate}]}).then(function(e){return s(e.data)})},t.prototype.set=function(e,t){return this.client.request("reminders.set",{entityId:e,reminders:t.map(function(e){return[{action:e.action,relativeTo:e.relativeTo,relativeDate:e.relativeDate,absoluteDate:e.absoluteDate}]})}).then(function(e){return s(e.data)})},t.prototype.update=function(e,t){return this.client.request("reminders.update",{reminderId:e,relativeDate:t})},t.prototype.delete=function(e){return this.client.request("reminders.delete",{reminderIds:[].concat(e)})},t.prototype.all=function(e){return this.client.request("reminders.all",{entityId:e}).then(function(e){return s(e.data)})},t}(c.default);t.default=p},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=r(3),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a={id:"ReminderId",action:"Action",absoluteDate:(0,o.date)("TriggerDate"),relativeTo:"RelativeTo",relativeDate:"RelativeDate"},s=function(){function e(){n(this,e)}return e.prototype.fromReminder=function(e){return(0,i.default)(this,a,e),this},e}();t.default=s},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=r(0),u=n(s),c=r(13),l=n(c),f=r(22),p=n(f),d=r(5),h=function(e){function t(){return o(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.setTags=function(e,t){return this.client.request("proofs.set-tags",{relatedId:e,tag:t.join(",")})},t.prototype.deleteTag=function(e,t){return this.client.request("proofs.tag-delete",{relatedId:e,tag:t})},t.prototype.setFile=function(e,t){var r=this;return this.client.request("proofs.set-file",{proofId:e,fileId:t}).then(function(){return r.client.request("proofs.distribute-file",{proofId:e})})},t.prototype.create=function(e){var t=this,r=e.name,n=e.file,o=e.isPublic,i=e.tags,a=void 0===i?[]:i,s=e.dueDate,u=void 0===s?new Date(Date.now()+3*d.DAY_IN_MS):s;return this.client.request("briefs.create",{title:r,isPublic:o,messageToRecipient:"",dueDate:u.toISOString(),tag:a.join(",")}).then(function(e){var r=(new l.default).fromProof(e.data.Brief);return Promise.all([r,n&&t.setFile(r.id,n.id)])}).then(function(e){var t=e[0];return n&&(t.fileId=n.id,t.fileStatus=p.default.UPLOADING),t.calculateState(),t})},t.prototype.update=function(e){var t=this,r=e.briefId,n=e.data,o=e.start,i=void 0!==o&&o;return this.client.request("briefs.update",{briefId:r,title:n.title,messageToRecipient:n.messageToRecipient,dueDate:n.dueDate?n.dueDate.toISOString():"",tag:n.tags?n.tags.join(","):"",recipient:n.recipient,editorId:n.editorId,editorMessage:n.editorMessage,isPublic:n.isPublic}).then(function(e){return(new l.default).fromProof(e.data.Brief)}).then(function(e){return Promise.resolve(i&&t.start(e.id)).then(function(){return e})})},t.prototype.delete=function(e){return this.client.request("proofs.delete",{proofId:e})},t.prototype.start=function(e){return this.client.request("briefs.start",{briefId:e})},t}(u.default);t.default=h},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function u(e,t,r){return(1-(t+r))*e+t}t.__esModule=!0;var c=r(0),l=n(c),f=r(36),p=n(f),d=r(22),h=n(d),y=r(65),m=n(y),g=r(141),v=n(g),b=r(4),E=n(b),C=r(5),_=r(66),w=n(_),T=r(142),S=n(T),I=r(67),A=n(I),k=r(143),B=function(e){function t(){return i(this,t),a(this,e.apply(this,arguments))}return s(t,e),t.prototype.generateToken=function(e,t){return e&&!t?Promise.reject(Error('The "assignedType" option is required when specifying the "assignedTo" option.')):!e&&t?Promise.reject(Error('The "assignedTo" option is required when specifying the "assignedType" option.')):this.client.request("files.legacy.generate-token",{relatedId:e,fileType:t}).then(function(e){return e.data.Token})},t.prototype.setCanDownload=function(e,t){return this.client.request("files.can-download.update",{fileId:e,downloadOriginal:t?1:0})},t.prototype._waitFileProcessed=function(e){var t=this;return new Promise(function(r,n){var o=null,i=null;!function a(){t.details(e).then(function(t){switch(o=null,t.status){case h.default.OK:r(t);break;case h.default.ERROR:n(new Error("File "+e+" encountered a processing error: "+t.message));break;default:o=setTimeout(a,5e3)}o&&t.status!==h.default.RIPPING||clearTimeout(i)}).catch(n)}(),i=setTimeout(function(){clearTimeout(o),n(new Error("File did not finish processing within specified duration."))},3e4)})},t.prototype._createWebsiteFile=function(e){var t=this;return this._generateKeyIVEnvelope().then(function(r){var n=r.envelope;return t.client.request("files.import.web",{url:e,envelope:n})}).then(function(e){return e.data})},t.prototype._importFileFromUrl=function(e){var t=this,r=e.name,n=e.url,o=e.provider,i=e.auth,a=e.download,s=o;o===m.default.NONE&&(s="generic");var u=(0,k.parseFilename)(r),c=u.name,l=u.extension;return this._generateKeyIVEnvelope().then(function(e){var r=e.envelope;return t.client.request("files.import."+s,{extn:l,filename:c,url:n,envelope:r,accessToken:i,storeOriginal:a})}).then(function(e){return e.data})},t.prototype.import=function(e){var t=this,r=e.name,n=e.url,o=e.provider,i=void 0===o?m.default.NONE:o,a=e.auth,s=e.download,u=void 0!==s&&s,c=e.process,l=void 0!==c&&c;return Object.keys(m.default).some(function(e){return m.default[e]===i})?(i===m.default.WEBSITE?this._createWebsiteFile(n):this._importFileFromUrl({name:r,url:n,provider:i,auth:a,download:u})).then(function(e){if(l)return t._waitFileProcessed(e);var r=new p.default;return r.id=e,r}):Promise.reject(new Error('Unsupported provider "'+i+'"'))},t.prototype.email=function(){return this.client.request("files.create-email").then(function(e){return e.data})},t.prototype._generateKeyIVEnvelope=function(){var e=this;return this.client.crypto().generateKeyIV().then(function(t){return Promise.all([t,e.client.crypto().envelopeSeal(t.keyIV,e.client.keyPairs.getPublicKeyPEMs())])}).then(function(e){return{keyIV:e[0],envelope:e[1]}})},t.prototype.upload=function(){return this.upload__v2.apply(this,arguments)},t.prototype.upload__v2=function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.concurrent,i=void 0===n?6:n,a=o(r,["concurrent"]),s=(0,S.default)(i),u=(0,S.default)(1),c=[],l=Array.isArray(e),f=l?e:[e],d=void 0;try{d=(0,k.prepareFilesForUpload)(f)}catch(e){return Promise.reject(e)}var h=function(e){return c.push(e),u(function(){if(c.length){var e=c.slice();return c.length=0,t.client.request("files.v2.upload-complete",{files:e})}return null})},y=new E.default;return this.client.request("files.v2.generate-credentials",{supports:{providers:["abs","custom"]},files:d.map(function(e){var t=void 0,r=void 0;if(e.extension){var n=[e.name,e.extension];t=n[0],r=n[1]}else{var o=[e.parsedFilename.name,e.parsedFilename.extension];t=o[0],r=o[1]}var i=y.size(e.contents),a=Math.ceil(i/C.BYTES_PER_BLOCK);return e.onProgress&&e.onProgress(0),{name:t,extension:r,chunks:a,size:i,fileTypeOverride:e.fileTypeOverride,hash:null,adobeExportData:e.adobeExportData?JSON.stringify(e.adobeExportData):null,assignedTo:e.assignedTo,assignedType:e.assignedType,canDownload:void 0===e.download||!!e.download}})}).then(function(e){return Promise.all(d.map(function(r,n){var o=e.data[n];r.onProgress&&r.onProgress(1);var i=new p.default;return i.id=o.FileId,r.onFileDetails&&r.onFileDetails(i),t._upload__v2(r,o,a,s,h).then(function(){return i})}))}).then(function(e){return l?e:e[0]})},t.prototype._upload__v2=function(e,t,r,n,o){var i=this;return this._generateKeyIVEnvelope().then(function(a){var s=a.keyIV,c=a.envelope;return new Promise(function(a,l){function f(e,t){var r=O(e,t);return _.push(r),r}function p(){m||n(function(){return b().then(function(e){if(e)return p(),f(e,g++);if(!m){m=!0;var t=Promise.all(_).then(D);a(t)}})})}var d=t.FileId,h=t.UploadCredentials,y=new E.default,m=!1,g=0,b=(0,v.default)(e.contents,function(e){return y.readBase64(e)}),_=[],w=Math.ceil(y.size(e.contents)/C.BYTES_PER_BLOCK),T=new Array(w),S=1,I=function(){},k=e.onProgress;k&&(I=function(e,t){T[e]=Math.max(t,T[e]||0);var n=100*u(T.reduce(function(e,t){return e+(t||0)},0)/w/100,.01,.01);void 0!==r.progressDecimalPlaces&&(n=+n.toFixed(r.progressDecimalPlaces)),S!==n&&(k(n),S=n)});var B=function(e,t){return i.client.rawRequest({method:"PUT",host:h.url,path:"/"+d+"/"+t,query:h.sas,body:e,headers:{"x-ms-blob-type":"BlockBlob"}},{onUploadProgress:I.bind(null,t)})},R=function(e,t){var r={"file.id":d,"chunk.index":t},n=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(e){return e};return e.replace(/\{([\w\.]+)\}/g,function(e,n){return t(r[n])})},o={};return Object.keys(h.headers).forEach(function(e){var t=n(h.headers[e]);o[n(e)]=t}),i.client.rawRequest({method:h.method,host:n(h.host),path:n(h.path,encodeURIComponent),query:n(h.query,encodeURIComponent),body:e,headers:o},{onUploadProgress:I.bind(null,t)})},P={abs:B,custom:R}[h.type],O=function(e,t){return i.client.crypto().encryptFileBlock(s,e,!0).then(function(e){return y.createBase64(e)}).then(function(e){return y.readArrayBuffer(e)}).then(function(e){function n(){return P(e,t).then(function(e){if(-1===[200,201].indexOf(e.status)){if(o<i)return o++,r.chunkRetryDelay?(0,A.default)(r.chunkRetryDelay).then(n):n();var a=new Error("Failed to upload block #"+t+" (retried "+o+" times).");throw l(a),m=!0,a}return e})}var o=0,i=void 0!==r.chunkRetryLimit?r.chunkRetryLimit:3;return n()})},D=function(){return o({fileId:d,envelope:c}).then(function(){k&&k(100)})};p(),!1!==e.async&&a()})})},t.prototype.upload__legacy=function(e){var t=this,r=e.name,n=e.contents,o=e.adobeExportData,i=e.assignedTo,a=e.assignedType,s=e.download,u=void 0!==s&&s,c=e.async,l=void 0===c||c,f=e.onProgress,d=e.onError,h=void 0;try{h=(0,k.parseFilename)(r)}catch(e){return Promise.reject(e)}return this.generateToken(i,a).then(function(e){return Promise.all([e,t._generateKeyIVEnvelope()])}).then(function(e){var r=e[0],i=e[1],a=i.keyIV,s=i.envelope,c=t._upload__legacy({parsedFilename:h,contents:n,adobeExportData:o,download:u,token:r,keyIV:a,envelope:s,onProgress:f,onError:d});return l&&(c=Promise.resolve()),c.then(function(){return r})}).then(function(e){var t=new p.default;return t.id=e,t})},t.prototype._upload__legacy=function(e){var t=this,r=e.parsedFilename,n=e.contents,o=e.adobeExportData,i=e.download,a=e.token,s=e.keyIV,u=e.envelope,c=e.onProgress;return new Promise(function(e){function l(){h().then(function(t){if(!g)if(null===t)g=!0,e(y.then(I));else{var r=S(t,m++);y=y.then(function(){return r}),r.then(l)}})}var f=4,p=r.name,d=r.extension,h=(0,v.default)(n),y=Promise.resolve(),m=0,g=!1,b=new E.default,_=Math.ceil(b.size(n)/C.BYTES_PER_BLOCK),w=new Array(_),T=function(){};c&&(T=function(e,t){w[e]=Math.max(t,w[e]||0),c(w.reduce(function(e,t){return e+(t||0)},0)/_*.99)});for(var S=function(e,r){return t.client.crypto().encryptFileBlock(s,e).then(function(e){return t.client.request("files.legacy.upload-block",{block:r,part:1,token:a,data:e},{onUploadProgress:T.bind(null,r)})})},I=function(){return t.client.request("files.legacy.upload-complete",{block:0,blockCount:m,part:0,token:a,extn:d,pages:1,filename:p,storeoriginal:i?1:0,adobeExportData:o?JSON.stringify(o):null,envelope:u}).then(function(){return c&&c(100)})};f--;)l()})},t.prototype.download=function(e){var t=this,r="string"==typeof e?{fileId:e}:e,n=r.fileId,o=r.onFileDetails;return this.details(n).then(function(e){if(!r.silent){if(!e.downloadable)throw new Error("File "+n+" is not downloadable.");if(e.status!==h.default.OK)throw new Error("File "+n+" cannot be download. The file may still be uploading, processing or has errored.");if(!e.blocks)throw new Error("File "+n+" is empty.")}return o&&o(e),t._downloadFile(e,r)})},t.prototype._downloadFile=function(e,t){var r=this;return new Promise(function(n){function o(){if(!y)if(h<u.length){var e=h++,t=d(e);c=c.then(function(){return t.then(function(t){return l(t,e,s)})}),t.then(o)}else y=!0,n(c.then(m))}var i=4,a=new E.default,s=e.blocks,u=new Array(s),c=Promise.resolve(),l=t.onData||function(e,t){u[t]=e},f=function(){};if(t.onProgress){var p=new Array(s);f=function(e,r){p[e]=Math.max(r,p[e]||0),t.onProgress(p.reduce(function(e,t){return e+(t||0)},0)/s*.99)}}for(var d=function(n){return r.client.request("files.download-block",{proofId:e.assignedTo,fileId:e.id,block:n+1,s:t.silent?1:void 0},{onDownloadProgress:f.bind(null,n)}).then(function(e){return r.client.crypto().decryptFileBlock(e.data,r.client.keyPairs.getPrivateKeyPEMs()).then(function(e){return a.createBase64(e)})})},h=0,y=!1,m=function(){return t.onProgress&&t.onProgress(100),t.onData?null:a.combine.apply(a,u)};i--;)o()})},t.prototype.details=function(e){return this.client.request("files.details",{fileId:e}).then(function(e){return(new p.default).fromFile(e.data)})},t.prototype.thumbnail=function(e){var t=this;return this.client.cache.auto(C.THUMBNAIL_CACHE_PREFIX+e,function(){return t._thumbnail(e)})},t.prototype._thumbnail=function(e){var t=this;return this.client.request("files.thumbnail",{fileId:e}).then(function(e){return t.client.crypto().decryptImage(e.data,t.client.keyPairs.getPrivateKeyPEMs())}).then(function(e){return(new E.default).createBase64(e)})},t.prototype.preview=function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"low";return this.client.cache.auto(C.PREVIEW_CACHE_PREFIX+e+r+n,function(){return t._preview(e,r,n)})},t.prototype._preview=function(e,t,r){var n=this;return this.client.request("files.preview",{fileId:e,pageNumber:t,quality:{low:"lo",high:"hi"}[r]||r}).then(function(e){return n.client.crypto().decryptImage(e.data,n.client.keyPairs.getPrivateKeyPEMs())}).then(function(e){return(new E.default).createBase64(e)})},t.prototype.thumbnails=function(e,t){var r=this,n=t.async,o=void 0!==n&&n,i=t.onLoadThumbnail,a=t.onLoadThumbnails,s=t.onLoadThumbnailsThrottleMs,u=void 0===s?1e3:s,c=t.onLoadError,l=[],f={},p=a?(0,w.default)(function(){Object.keys(f).length&&(a(f),f={})},u):function(){};return Promise.all(e.map(function(e){return r.client.cache.auto(C.THUMBNAIL_CACHE_PREFIX+e,function(t){l.push({fileId:e,resolve:t})}).then(function(t){var r;return t&&(r={},r[e]=t,r)})})).then(function(e){var t=Promise.all(l.map(function(e){var t=e.fileId,n=e.resolve;return r._thumbnail(t).then(function(e){var r;if(n(e),i){var o;i((o={},o[t]=e,o))}return f[t]=e,p(),r={},r[t]=e,r}).catch(function(e){return c&&c(e,t),o?{}:Promise.reject(e)})}));return o?e:t.then(function(t){return[].concat(e,t)})}).then(function(e){return Object.assign.apply(Object,[{}].concat(e))})},t.prototype.duplicate=function(e){return this.client.request("files.duplicate",{id:e}).then(function(e){return e.data.file})},t}(l.default);t.default=B},function(e,t,r){"use strict";function n(e){return(new s.default).readBase64(e).then(function(e){return"data:;base64,"+e})}function o(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n,r=new s.default,o=0,a=Promise.resolve(),u=r.size(e);return function(){var n=o++*i.BYTES_PER_BLOCK,s=n+i.BYTES_PER_BLOCK;return a=a.then(function(){return n>u?null:r.slice(e,n,s).then(t)})}}t.__esModule=!0;var i=r(5),a=r(4),s=function(e){return e&&e.__esModule?e:{default:e}}(a);t.default=o},function(e,t,r){"use strict";function n(e){function t(){if(r<e&&n.length){var o=n.shift(),i=o.handler,a=o.callback;return r+=1,Promise.resolve(i()).then(function(){return a(null)},function(e){return a(e)}).then(function(){return r-=1,t()})}return Promise.resolve()}var r=0,n=[];return function(e){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return new Promise(function(o,i){var a={handler:e,callback:function(e){e?i(e):o()}};r?n.splice(0,0,a):n.push(a),t()})}}t.__esModule=!0,t.default=n},function(e,t,r){"use strict";function n(e,t){var r=(0,l.getErrorMessage)(e,t);return{error:!0,code:e||-1,data:{ResponseStatus:e?Object.keys(p.default).find(function(t){return p.default[t]===e})||"UNKNOWN":"UNKNOWN",ResponseCode:e||-1},message:r,deprecated:null}}function o(e){if(!e||"string"!=typeof e){throw n(p.default.ERROR_FILE_UPLOAD_INVALID_FILENAME,"Filename must be a non-empty string")}var t=e.lastIndexOf(".");if(-1===t||t===e.length-1){throw n(p.default.ERROR_FILE_UPLOAD_MISSING_EXTENSION,'Invalid filename "'+e+'". Filename must include a file extension')}if(0===t){throw n(p.default.ERROR_FILE_UPLOAD_INVALID_FILENAME)}var r=e.substring(0,t),o=e.substring(t+1);if(!r.trim()){throw n(p.default.ERROR_FILE_UPLOAD_INVALID_FILENAME)}if(!o.trim()){throw n(p.default.ERROR_FILE_UPLOAD_MISSING_EXTENSION)}return{name:r.trim(),extension:o.trim().toLowerCase()}}function i(e){if(!Array.isArray(e)){throw new Error("Files must be an array")}e.forEach(function(e,t){if(!e||"object"!==(void 0===e?"undefined":c(e))){throw new Error("File at index "+t+" must be an object")}if(!e.name||"string"!=typeof e.name){throw new Error("File at index "+t+" must have a valid name (string)")}if(!e.contents){throw new Error("File at index "+t+" must have contents")}})}function a(e){return e.map(function(e){var t=null;if(!e.extension)try{t=o(e.name)}catch(e){throw e}return u({},e,{parsedFilename:t})})}function s(e){return i(e),a(e)}var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l=r(42),f=r(16),p=function(e){return e&&e.__esModule?e:{default:e}}(f);e.exports={parseFilename:o,validateFiles:i,addParsedFilenames:a,prepareFilesForUpload:s}},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=r(0),u=n(s),c=r(145),l=n(c),f=function(e){function t(r){o(this,t);var n=i(this,e.call(this,r));return n.team=new l.default(r),n}return a(t,e),t}(u.default);t.default=f},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=r(0),u=n(s),c=r(146),l=n(c),f=r(147),p=n(f),d=r(149),h=n(d),y=r(160),m=n(y),g=r(163),v=n(g),b=r(164),E=n(b),C=r(70),_=n(C),w=r(165),T=n(w),S=function(e){function t(r){o(this,t);var n=i(this,e.call(this,r));return n.users=new l.default(r),n.dashboard=new p.default(r),n.features=new h.default(r),n.preferences=new m.default(r),n.scim=new v.default(r),n.workflows=new E.default(r),n.integrations=new _.default(r,"team"),n.customTools=new T.default(r),n}return a(t,e),t}(u.default);t.default=S},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){return e.data.map(function(e){return(new d.default).fromUser(e)})}t.__esModule=!0;var u=r(0),c=n(u),l=r(4),f=n(l),p=r(9),d=n(p),h=function(e){function t(){return o(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.enabled=function(){return this.client.request("admin.team.users.enabled").then(s)},t.prototype.disabled=function(){return this.client.request("admin.team.users.disabled").then(s)},t.prototype.getInvitations=function(){return this.client.request("admin.team.users.invitations").then(function(e){return e.data})},t.prototype._setEnabled=function(e,t){return this.client.request("admin.team.users.set-enabled",{email:e,enabled:t})},t.prototype.enable=function(e){return this._setEnabled(e,!0)},t.prototype.disable=function(e){return this._setEnabled(e,!1)},t.prototype.invite=function(e){return this.client.request("admin.team.users.invite",{emails:[].concat(e)})},t.prototype.revokeInvitation=function(e){var t=e.email,r=e.invitationId;return this.client.request("admin.team.users.revoke-invitation",{email:t,invitationId:r})},t.prototype.remove=function(e){return this.client.request("admin.team.users.remove-from-team",{users:[].concat(e)})},t.prototype.uploadAvatar=function(e,t){var r=this;return(new f.default).readBase64(t).then(function(t){return r.client.request("admin.team.users.upload-avatar",{userId:e,uploadedImage:"data:image/png;base64,"+t})})},t.prototype.deleteAvatar=function(e){return this.client.request("admin.team.users.delete-avatar",{userId:e})},t}(c.default);t.default=h},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e,t){var r={};return r.proofs=u(e[g[t]]),r.total=e.ProofsNumber,r}function u(e){return(e||[]).map(function(e){return(new p.default).fromProof(e)})}t.__esModule=!0;var c=r(0),l=n(c),f=r(13),p=n(f),d=r(21),h=n(d),y=r(148),m=n(y),g={inbox:"ProofIn",sent:"ProofSent",outbox:"ProofOut",search:"Proofs"},v=function(e){function t(r){o(this,t);var n=i(this,e.call(this,r));return n.groups=new m.default(r),n}return a(t,e),t.prototype.inbox=function(e){return this._loadSingleTeamTabProofs("inbox",{page:e})},t.prototype.sent=function(e){return this._loadSingleTeamTabProofs("sent",{page:e})},t.prototype.outbox=function(e){return this._loadSingleTeamTabProofs("outbox",{page:e})},t.prototype._loadSingleTeamTabProofs=function(e,t){return this.client.request("team.dashboard."+e,t).then(function(t){return s(t.data,e)}).then(function(e){return e})},t.prototype.everything=function(e){return this.search(void 0,{everything:!0,page:e})},t.prototype.approved=function(e){return this.search(void 0,{status:h.default.APPROVED,page:e})},t.prototype.archived=function(e){return this.search(void 0,{status:h.default.ARCHIVED,page:e})},t.prototype.search=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.status,n=t.everything,o=t.page;return this._loadTeamSearchProofs({query:e,filterBy:void 0===r?void 0:[].concat(r).join(","),all:n?1:0,page:o})},t.prototype._loadTeamSearchProofs=function(e){return this.client.request("team.dashboard.search",e).then(function(e){return s(e.data,"search")})},t}(l.default);t.default=v},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){return(e||[]).map(function(e){return(new p.default).fromProofGroup(e)})}function u(e){return(new p.default).fromProofGroup(e.data)}t.__esModule=!0;var c=r(0),l=n(c),f=r(23),p=n(f),d=function(e){function t(){return o(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype._loadGroups=function(e){return this.client.request("admin.team.dashboard.groups.category",{category:e}).then(function(e){return s(e.data)})},t.prototype.load=function(e){return this.client.request("admin.team.proofs.groups.load",{groupId:e}).then(u)},t.prototype.current=function(){return this._loadGroups("current")},t.prototype.archived=function(){return this._loadGroups("archived")},t}(l.default);t.default=d},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=r(0),u=n(s),c=r(150),l=n(c),f=function(e){function t(){return o(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.load=function(){return this.client.request("admin.team.features.load").then(function(e){return e.data?(new l.default).fromTeamFeatures(e.data):null})},t.prototype.update=function(e){var t=e.emails,r=e.comments,n=e.proofs,o=e.workflows,i=e.addressBook,a=e.userGroups,s=e.webhooks,u=e.intelligence,c=t&&t.displayComments,l=t&&t.displayTeamName,f=r&&r.generalComments,p=r&&r.privateComments,d=r&&r.enableCommentVisibility,h=r&&r.defaultCommentVisibility,y=o&&o.enableViewOnlyReviewers,m=t&&t.titleTextColor,g=t&&t.linkTextColor,v=t&&t.buttonBackgroundColor,b=t&&t.buttonTextColor,E=r&&r.editComments,C=r&&r.ownerCanDeleteComments,_=r&&r.disableReplyingToCommentsInStatuses&&[].concat(r.disableReplyingToCommentsInStatuses),w=n&&n.reference,T=n&&n.referenceRequired,S=n&&n.publicProofs,I=n&&n.usePreviousVersionDueDate,A=n&&n.defaultIsPublic,k=n&&n.messageToOwners,B=n&&n.allowedDecisions,R=n&&n.enableChecklists,P=n&&n.enableProofMagicAccess,O=n&&n.defaultGifOutput,D=i&&i.suggestionsIncludeTeamMembers,N=a&&a.enableUserGroups,L=s&&s.enabled,U=u&&u.enableIntelligence,x=u&&u.enableSmartTags,M=u&&u.enableSmartCheckCr;return this.client.request("admin.team.features.update",{displayComments:c,displayTeamName:l,generalComments:f,privateComments:p,enableWebhooks:L,enableCommentVisibility:d,defaultCommentVisibility:h,enableViewOnlyReviewers:y,emailTitleTextColor:m,emailLinkTextColor:g,emailButtonBackgroundColor:v,emailButtonTextColor:b,editComments:E,ownerCanDeleteComments:C,disableReplyingToCommentsInStatuses:_,proofReference:w,proofReferenceRequired:T,publicProofs:S,defaultProofIsPublic:A,messageToOwners:k,allowedDecisions:B,enableChecklists:R,enableProofMagicAccess:P,defaultGifOutput:O,enableIntelligence:U,enableIntelligenceSmartTags:x,enableIntelligenceSmartCheckCr:M,suggestionsIncludeTeamMembers:D,enableUserGroups:N,usePreviousVersionDueDate:I})},t.prototype.setSenderEmail=function(e){return this.client.request("admin.team.features.sender-email.set",{senderEmail:e}).then(function(e){return{success:e.data.Success,domain:e.data.Domain,email:e.data.Email,records:e.data.Records&&e.data.Records.map(function(e){return{version:e.Version,current:e.Current,new:e.New}})}})},t}(u.default);t.default=f},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=r(3),a=n(i),s=r(151),u=n(s),c=r(152),l=n(c),f=r(153),p=n(f),d=r(154),h=n(d),y=r(155),m=n(y),g=r(156),v=n(g),b=r(157),E=n(b),C=r(158),_=n(C),w=r(159),T=n(w),S={emails:function(e){return(new u.default).fromTeamEmailFeatures(e)},comments:function(e){return(new l.default).fromTeamCommentFeatures(e)},proofs:function(e){return(new p.default).fromTeamProofFeatures(e)},workflows:function(e){return(new h.default).fromTeamWorkflowFeatures(e)},addressBook:function(e){return(new m.default).fromTeamAddressBookFeatures(e)},accounts:function(e){return(new v.default).fromTeamAccountFeatures(e)},webhooks:function(e){return(new E.default).fromTeamWebhookFeatures(e)},userGroups:function(e){return(new T.default).fromTeamUserGroupsFeatures(e)},intelligence:function(e){return(new _.default).fromTeamIntelligenceFeatures(e)}},I=function(){function e(){o(this,e)}return e.prototype.fromTeamFeatures=function(e){return(0,a.default)(this,S,e),this},e}();t.default=I},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=r(3),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a={displayComments:"DisplayComments",displayTeamName:"DisplayTeamName",customStyles:"EmailCustomStyles",titleTextColor:"EmailTitleTextColor",linkTextColor:"EmailLinkTextColor",buttonBackgroundColor:"EmailButtonBackgroundColor",buttonTextColor:"EmailButtonTextColor",senderEmail:"SenderEmail"},s=function(){function e(){n(this,e)}return e.prototype.fromTeamEmailFeatures=function(e){return(0,i.default)(this,a,e),this},e}();t.default=s},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=r(3),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a={editComments:"EditComments",ownerCanDeleteComments:"OwnerCanDeleteComments",disableReplyingToCommentsInStatuses:"DisableReplyingToCommentsInStatuses",generalComments:"GeneralComments",configurePrivateComments:"LicensePrivateComments",privateComments:"PrivateComments",configureCommentVisibility:"LicenseCommentVisibility",enableCommentVisibility:"EnableCommentVisibility",defaultCommentVisibility:"DefaultCommentVisibility"},s=function(){function e(){n(this,e)}return e.prototype.fromTeamCommentFeatures=function(e){return(0,i.default)(this,a,e),this},e}();t.default=s},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=r(3),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a={reference:"ProofReference",referenceRequired:"ProofReferenceRequired",publicProofs:"PublicProofs",usePreviousVersionDueDate:"UsePreviousVersionDueDate",defaultIsPublic:"DefaultProofIsPublic",messageToOwners:"MessageToOwners",allowedDecisions:"AllowedDecisions",enableChecklists:"EnableChecklists",defaultGifOutput:"DefaultGifOutput",enableProofMagicAccess:"EnableProofMagicAccess"},s=function(){function e(){n(this,e)}return e.prototype.fromTeamProofFeatures=function(e){return(0,i.default)(this,a,e),this},e}();t.default=s},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=r(3),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a={configureViewOnlyReviewers:"LicenseViewOnlyReviewers",enableViewOnlyReviewers:"EnableViewOnlyReviewers"},s=function(){function e(){n(this,e)}return e.prototype.fromTeamWorkflowFeatures=function(e){return(0,i.default)(this,a,e),this},e}();t.default=s},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=r(3),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a={suggestionsIncludeTeamMembers:"SuggestionsIncludeTeamMembers",configureSuggestionsIncludeTeamMembers:"LicenseSuggestionsIncludeTeamMembers"},s=function(){function e(){n(this,e)}return e.prototype.fromTeamAddressBookFeatures=function(e){return(0,i.default)(this,a,e),this},e}();t.default=s},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=r(3),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a={teamId:"Id",teamName:"Name",teamType:"Type",teamIsPlus:"IsPlus",teamIsTrial:"IsTrial"},s=function(){function e(){n(this,e)}return e.prototype.fromTeamAccountFeatures=function(e){return(0,i.default)(this,a,e),this},e}();t.default=s},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=r(3),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a={configurable:"LicenseWebhooks",enabled:"EnableWebhooks"},s=function(){function e(){n(this,e)}return e.prototype.fromTeamWebhookFeatures=function(e){return(0,i.default)(this,a,e),this},e}();t.default=s},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=r(3),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a={enableIntelligence:"EnableIntelligence",enableSmartTags:"EnableIntelligenceSmartTags",enableSmartCheckCr:"EnableIntelligenceSmartCheckCr"},s=function(){function e(){n(this,e)}return e.prototype.fromTeamIntelligenceFeatures=function(e){return(0,i.default)(this,a,e),this},e}();t.default=s},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=r(3),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a={licenseUserGroups:"LicenseUserGroups",enableUserGroups:"EnableUserGroups"},s=function(){function e(){n(this,e)}return e.prototype.fromTeamUserGroupsFeatures=function(e){return(0,i.default)(this,a,e),this},e}();t.default=s},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=r(0),u=n(s),c=r(161),l=n(c),f=function(e){function t(r){o(this,t);var n=i(this,e.call(this,r));return n.notifications=new l.default(r),n}return a(t,e),t}(u.default);t.default=f},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=r(0),u=n(s),c=r(162),l=n(c),f=function(e){function t(){return o(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.load=function(){return this.client.request("admin.team.preferences.notifications.load").then(function(e){return e.data?(new l.default).fromTeamNotifications(e.data):null})},t.prototype.set=function(e){var t=e.ownerAddedByAdmin;return this.client.request("admin.team.preferences.notifications.set",{ownerAddedByAdmin:t})},t}(u.default);t.default=f},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=r(3),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a={teamId:"TeamId",ownerAddedByAdmin:"OwnerAddedByAdmin"},s=function(){function e(){n(this,e)}return e.prototype.fromTeamNotifications=function(e){return(0,i.default)(this,a,e),this},e}();t.default=s},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=r(0),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=function(e){function t(){return n(this,t),o(this,e.apply(this,arguments))}return i(t,e),t.prototype.settings=function(){return this.client.request("scim.admin.settings").then(function(e){return e.data.settings})},t.prototype.enable=function(){return this.client.request("scim.admin.enable").then(function(e){return e.data.settings})},t.prototype.disable=function(){return this.client.request("scim.admin.disable").then(function(){})},t.prototype.regenerateAccessToken=function(e){return this.client.request("scim.admin.regenerate-access-token",{type:e}).then(function(e){return e.data.settings})},t}(s.default);t.default=u},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){return(e||[]).map(function(e){return(new f.default).fromWorkflow(e)})}t.__esModule=!0;var u=r(0),c=n(u),l=r(37),f=n(l),p=function(e){function t(){return o(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.owned=function(){return this.client.request("admin.team.workflows.owned").then(function(e){return s(e.data)})},t.prototype._getOwnedEmailList=function(){return this.client.request("admin.team.workflows.owned.email-list").then(function(e){return e.data.map(function(e){return{id:e.WorkflowId,emails:e.Emails}})})},t}(c.default);t.default=p},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=r(0),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=function(e){function t(){return n(this,t),o(this,e.apply(this,arguments))}return i(t,e),t.prototype.load=function(){return this.client.request("admin.team.custom-tools.load").then(function(e){return e.data.tools})},t.prototype.update=function(e){return this.client.request("admin.team.custom-tools.update",{updates:e}).then(function(e){return e.data.tools})},t}(s.default);t.default=u},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){return e&&((0,g.isUserId)(e.id)||e.email)}function u(e){return(e||[]).map(function(e){return(new p.default).fromWorkflow(e)})}t.__esModule=!0;var c=r(0),l=n(c),f=r(37),p=n(f),d=r(25),h=n(d),y=r(38),m=n(y),g=r(61),v=r(167),b=n(v),E=function(e){function t(r){o(this,t);var n=i(this,e.call(this,r));return n.steps=new b.default(r),n}return a(t,e),t.prototype.create=function(e){var t=this,r=e.save,n=void 0!==r&&r,o=e.name,i=e.steps,a=void 0===i?[]:i,u=e.reviewers,c=e.approver,l=e.owners,f=e.isOwnedByTeam,p=void 0!==f&&f,d=Array.isArray(c)?c:[c];if(c&&!d.every(s))return Promise.reject(Error("Please provide an id or email address for every approver."));if(n&&!o)return Promise.reject(Error("A workflow must have a name when saving it as a workflow template."));var h=a;u&&u.length&&h.splice(0,0,{users:u}),c&&h.push({position:1e3,users:d,start:c.start});for(var y=0,m=0;m<h.length;m++){var g=h[m];g.users=g.users||[],(!g.position||g.position<y)&&(g.position=y+1),y=Math.max(y,g.position);for(var v=0;v<g.users.length;v++){if(!s(g.users[v]))return Promise.reject(Error("A user id or email address must be provided for a workflow user."))}}var b=void 0;return this._createWorkflow(o,p).then(function(e){return b=e.id,Promise.all([e,Promise.all(h.map(function(r){var n=e.getStepByPosition(r.position),o={};return r.dueDate&&(o.dueDate=r.dueDate),void 0!==r.mandatoryDecisionThreshold&&(o.mandatoryDecisionThreshold=r.mandatoryDecisionThreshold),r.name&&(o.title=r.name),n?Promise.resolve(Object.keys(o).length&&t.steps.update(n.id,o).then(function(e){n.dueDate=e.dueDate})).then(function(){return t._setWorkflowStepUsersMutate(e.id,n,r.users,r.start)}):t._addWorkflowStepAndUsers(e.id,r,r.start)})),l&&Promise.all(l.map(function(e){return t._addProofOwnerToWorkflowTemplate(b,e)}))])}).then(function(e){var t=e[0],r=e[1];return t.steps=r,t}).then(function(e){return n?t._duplicateWorkflow(b):e}).catch(function(e){return Promise.resolve(b&&t._deleteWorkflow(b)).then(function(){return Promise.reject(e)})})},t.prototype.load=function(e){return this.client.request("workflows.load",{workflowId:e}).then(function(e){return(new p.default).fromWorkflow(e.data)})},t.prototype.use=function(e,t){return this.duplicate(e,t)},t.prototype.duplicate=function(e,t){return this._duplicateWorkflow(e,t)},t.prototype.delete=function(e){return this._deleteWorkflow(e)},t.prototype.all=function(){return Promise.all([this.owned(),this.shared()]).then(function(e){return[].concat(e[0],e[1])})},t.prototype.owned=function(){return this.client.request("workflows.owned").then(function(e){return u(e.data)})},t.prototype.shared=function(){return this.client.request("workflows.shared").then(function(e){return u(e.data)})},t.prototype.setApprover=function(e,t){return this.client.request("workflows.users.set",{workflowId:e,position:1e3,users:[t]})},t.prototype.skipAll=function(e){return this.client.request("workflows.users.skip-all",{workflowId:e})},t.prototype.nudgeUser=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return this.client.request("workflows.user.nudge",{workflowId:e,userId:t,message:r})},t.prototype.nudgeAll=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this.client.request("workflows.nudge-all",{workflowIds:[].concat(e),message:t}).then(function(e){return{nudgedWorkflows:e.data.NudgedWorkflows.map(function(e){return{workflowId:e.WorkflowId,users:e.Users.map(function(e){return{userId:e.UserId,role:e.Role,stepId:e.StepId,position:Number(e.Position)}})}}),errors:e.data.Errors.map(function(e){return{workflowId:e.WorkflowId,errorCode:e.ErrorCode,errorMessage:e.ErrorMessage}})}})},t.prototype.setStartingStep=function(e,t){return this.client.request("workflows.set-starting-step",{workflowId:e,stepId:t})},t.prototype.replaceApprover=function(e,t){return this.client.request("workflows.replace-approver",{workflowIds:[].concat(e),user:t})},t.prototype.update=function(e,t){var r=t.name,n=t.isOwnedByTeam;return this.client.request("workflows.update",{workflowId:e,title:r,ownedByTeam:n}).then(function(e){return(new p.default).fromWorkflow(e.data)})},t.prototype.getNudgeAllMessage=function(e){return this.client.request("workflows.nudge-message",{workflowId:e}).then(function(e){return e.data.Message})},t.prototype.getNudgeMessage=function(e,t){return this.client.request("workflows.nudge-message",{workflowId:e,userId:t}).then(function(e){return e.data.Message})},t.prototype.favorite=function(e){return this.client.request("workflows.favorite",{workflowId:e})},t.prototype.unfavorite=function(e){return this.client.request("workflows.unfavorite",{workflowId:e})},t.prototype._duplicateWorkflow=function(e,t){var r=this;return this.client.request("workflows.duplicate",{workflowId:e,noOwners:!(!t||!1!==t.includeOwners)||void 0,excludeStepDueDates:!(!t||!1!==t.includeStepDueDates)||void 0,includeOwnedByTeam:t&&!0===t.includeOwnedByTeam||void 0,includeSharedUsers:t&&!0===t.includeSharedUsers||void 0}).then(function(e){var t=e.data.WorkflowId;return r.load(t)})},t.prototype._deleteWorkflow=function(e){return this.client.request("workflows.delete",{workflowId:e})},t.prototype._createWorkflow=function(e,t){return this.client.request("workflows.create",{title:e,ownedByTeam:t}).then(function(e){return(new p.default).fromWorkflow(e.data)})},t.prototype._addWorkflowStepAndUsers=function(e,t,r){var n=this;return this.client.request("workflows.steps.add",{workflowId:e,title:t.name,position:t.position,dueDate:t.dueDate,mandatoryDecisionThreshold:t.mandatoryDecisionThreshold}).then(function(o){var i=(new h.default).fromWorkflowStep(o.data);return n._setWorkflowStepUsersMutate(e,i,t.users,r)})},t.prototype._setWorkflowStepUsersMutate=function(e,t,r,n){var o=this;return this.client.request("workflows.users.set",{workflowId:e,stepId:t.id,users:r.map(function(e){return{email:e.email,userId:e.id,role:e.role,permissions:e.permissions&&{inviter:!!e.permissions.inviter}}})}).then(function(e){var r=e.data.map(function(e){return(new m.default).fromWorkflowUser(e)});t.users=r}).then(function(){return!0===n?o.setStartingStep(e,t.id).then(function(){return t}):t})},t.prototype._addProofOwnerToWorkflowTemplate=function(e,t){return this.client.request("workflows.proof-owners.add",{relatedId:e,workflowCopyToProof:1,userId:t.id,email:t.email})},t.prototype._getOwnedEmailList=function(){return this.client.request("workflows.owned.email-list").then(function(e){return e.data.map(function(e){return{id:e.WorkflowId,emails:e.Emails}})})},t.prototype._getSharedEmailList=function(){return this.client.request("workflows.shared.email-list").then(function(e){return e.data.map(function(e){return{id:e.WorkflowId,emails:e.Emails}})})},t}(l.default);t.default=E},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=r(25),u=n(s),c=r(0),l=n(c),f=function(e){function t(){return o(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.moveBefore=function(e,t){return this.client.request("workflows.steps.move-before",{stepId:e,beforeStepId:t})},t.prototype.moveAfter=function(e,t){return this.client.request("workflows.steps.move-after",{stepId:e,afterStepId:t})},t.prototype.swap=function(e,t){return this.client.request("workflows.steps.swap",{stepId:e,swapStepId:t})},t.prototype.update=function(e,t){var r=t.title,n=t.dueDate,o=t.mandatoryDecisionThreshold;return this.client.request("workflows.steps.update",{stepId:e,title:r,dueDate:n,mandatoryDecisionThreshold:o}).then(function(e){return(new u.default).fromWorkflowStep(e.data)})},t}(l.default);t.default=f},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){return(new p.default).fromPreference(e)}function u(e,t){var r=new Array(e.length);return t.forEach(function(t){r[e.indexOf(t.name)]=t}),r}t.__esModule=!0;var c=r(0),l=n(c),f=r(169),p=n(f),d=function(e){function t(){return o(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.all=function(){return this.client.request("preferences.all")},t.prototype.get=function(e){var t=[].concat(e);return this.client.request("preferences.get",{preferences:t}).then(function(e){return e.data.map(s)}).then(function(r){return"string"==typeof e?r[0]:u(t,r)})},t.prototype.update=function(e,t){var r,n=void 0!==t?(r={},r[e]=t,r):e;return this.client.request("preferences.update",n)},t.prototype.reset=function(e){return this.client.request("preferences.reset",{preferences:[].concat(e)})},t}(l.default);t.default=d},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=r(3),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a={name:"Name",defaultValue:"DefaultValue",value:"Value"},s=function(){function e(){n(this,e)}return e.prototype.getValueOrDefault=function(){return null===this.value?this.defaultValue:this.value},e.prototype.fromPreference=function(e){return(0,i.default)(this,a,e),this},e}();t.default=s},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){var t=[];return Object.keys(e).forEach(function(r){e[r].Comments.forEach(function(e){t.push(e)})}),t}function u(e){var t=[],r=[];e.forEach(function(e){var n=(new p.default).fromComment(e);n.parentCommentId?r.push(n):t.push(n)}),t.sort(L);var n=t.map(function(e){return e.id}),o=(0,m.sortObjectsBy)(function(e){return n.indexOf(e.parentCommentId)},!0);return r.sort((0,m.combineSort)(U,o)),t.concat(r)}t.__esModule=!0;var c=r(0),l=n(c),f=r(71),p=n(f),d=r(41),h=n(d),y=r(5),m=r(63),g=r(40),v=r(75),b=n(v),E=r(39),C=n(E),_=r(172),w=r(66),T=n(w),S=r(72),I=n(S),A=r(77),k=r(173),B=n(k),R=r(4),P=n(R),O=(0,m.sortObjectsByKey)("pageNumber"),D=(0,m.sortObjectsByKey)("createdDate",!0),N=(0,m.sortObjectsByKey)("createdDate",!1),L=(0,m.combineSort)(O,D),U=(0,m.combineSort)(O,N),x=function(e){function t(r){o(this,t);var n=i(this,e.call(this,r));return n.import=new B.default(r),n}return a(t,e),t.prototype._mark=function(e,t,r){if(-1===Object.keys(h.default).map(function(e){return h.default[e]}).indexOf(t))throw new Error('Cannot mark comment state "'+t+'".');var n=h.default.TODO,o=h.default.DONE,i=h.default.UNMARKED,a={commentId:e};switch(t){case i:a.change=0,a.done=0;break;case n:a.change=r?1:0,a.done=0;break;case o:a.done=r?1:0}return this.client.request("comments.state.update",a).then(function(e){return(0,I.default)(e.data)})},t.prototype._markAll=function(e,t,r,n){if(-1===Object.keys(h.default).map(function(e){return h.default[e]}).indexOf(r))throw new Error('Cannot mark comment state "'+r+'".');var o=h.default.TODO,i=h.default.DONE,a=h.default.UNMARKED,s={proofId:e,commentIds:t};switch(r){case a:s.change=0,s.done=0;break;case o:s.change=n?1:0,s.done=0;break;case i:s.done=n?1:0}return this.client.request("comments.state.multiple-update",s).then(function(e){return e.data.map(function(e){return{commentId:e.CommentId,commentState:(0,I.default)(e)}})})},t.prototype.mark=function(e,t){return this._mark(e,t,!0)},t.prototype.unmark=function(e,t){return this._mark(e,t,!1)},t.prototype.markAll=function(e,t,r){return this._markAll(e,t,r,!0)},t.prototype.unmarkAll=function(e,t,r){return this._markAll(e,t,r,!1)},t.prototype.delete=function(e){return this.client.request("comments.delete",{commentId:e})},t.prototype.load=function(e){var t=this,r="string"==typeof e?{proofId:e}:e,n=r.proofId,o=r.pageNumber,i=void 0===o?null:o,a=r.sinceDate,c=void 0===a?null:a,l=r.async,f=void 0!==l&&l,p=r.decrypt,d=void 0===p||p,h=r.onDecryptComment,m=r.onDecryptComments,g=r.onDecryptCommentsThrottleMs,v=void 0===g?1e3:g,b=r.onDecryptError,E=c?c.toISOString().match(y.ISO_REGEX)[0]:y.DEFAULT_ISO_DATE,C={proofId:n,page:i,timestamp:E};return this.client.request(null!==i?"comments.load-page":"comments.load-all",C).then(function(e){var r=u(e.data.Pages?s(e.data.Pages):e.data),n=Promise.resolve();if(d){var o=[],i=[],a=m?(0,T.default)(function(){i.length&&(m(i),i=[])},v):function(){},c=Promise.all(r.map(function(e){return t.client.cache.auto(y.COMMENT_CACHE_PREFIX+e.comment$,function(t){o.push({comment:e,resolve:t})}).then(function(t){return t&&e.fromRawComment(t),e})}));n=n.then(function(){return c}),n=n.then(function(){var e=o.map(function(e){var r=e.comment,n=e.resolve;return t.client.crypto().decryptComment(r.comment$,r.envelope,t.client.keyPairs.getPrivateKeyPEMs()).then(function(e){r.fromRawComment(e),n(e),h&&h(r),i.push(r),a()}).catch(function(e){if(b&&b(e,r),!f)return Promise.reject(e)})});return f?null:Promise.all(e)})}return n.then(function(){return r})})},t.prototype.create=function(e){var t=this,r=e.raw,n=e.tokens,o=e.proofId,i=e.pageNumber,a=void 0===i?1:i,s=e.pin,u=e.pins,c=e.mediaTime,l=e.mediaDuration,f=e.parentCommentId,d=e.metadata,y=e.sourceMetadata,m=e.state,v=e.autoState,E=e.isPrivate,w=e.creationToken,T=[],S=r||(0,g.serialize)(n),I=n||(0,C.default)(r);T.push.apply(T,(0,b.default)(I));var k=[],B=void 0;u?k=k.concat(u):s&&k.push(s);var R=k[0];R&&(R.fill&&(B=R.fill),c&&(R.time=c),l&&(R.duration=l));var P=w||(0,_.generateCreationToken)();return this.client.crypto().encryptComment(S,this.client.keyPairs.getPublicKeyPEMs()).then(function(e){var t=e.envelope,r=e.comment$;return{proofId:o,page:f?void 0:a,envelope:t,encryptedComment:r,xy:(0,A.serializePins)(k),boxFillImage:B?B.image:void 0,boxFillType:B?B.type:void 0,parent:f||void 0,mentions:T,metadata:d?JSON.stringify(d):"{}",sourceMetadata:y,creationToken:P,change:m===h.default.TODO?"1":void 0,done:m===h.default.DONE?"1":void 0,autoState:v,private:void 0!==E?E?"1":"0":void 0}}).then(function(e){return t.client.request("comments.create",e).then(function(e){return(new p.default).fromComment(e.data).fromRawComment(S)})}).catch(function(e){return e&&(e.creationToken=P),Promise.reject(e)})},t.prototype.loadContext=function(e){var t=this;return this.client.request("comments.load-context",{commentId:e}).then(function(e){return t.client.crypto().decryptImage(e.data,t.client.keyPairs.getPrivateKeyPEMs())}).then(function(e){return(new P.default).createBase64(e)})},t}(l.default);t.default=x},function(e,t,r){"use strict";function n(e){for(var t=[],r=e.split(/\n/g),n=0;n<r.length;n++){var i=r[n],a=[];if(0===n){var s=i.match(o.COMMENT_LABEL_REGEX);s&&a.push({type:"label",index:0,length:s[0].length,metadata:{label:s[1].toLowerCase()}})}for(var u=void 0;null!==(u=o.MENTION_REGEX.exec(i));){var c=u,l=c[0],f=c[1],p=c[2];a.push({type:"mention",index:u.index,length:p.length,metadata:{id:f}}),i=i.substring(0,u.index)+p+i.substring(u.index+l.length)}t.push({type:"text",value:i,styles:[],entities:a})}return{version:2,blocks:t}}t.__esModule=!0,t.parse=void 0;var o=r(5);t.parse=n},function(e,t,r){"use strict";function n(){var e=(new Date).getTime();return(0,i.default)(s,a)+"-"+e}t.__esModule=!0,t.generateCreationToken=void 0;var o=r(76),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a=32,s=o.lower+o.upper+o.numbers+o.symbols;t.generateCreationToken=n},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},c=r(0),l=n(c),f=r(24),p=n(f),d=r(4),h=n(d),y=function(e){function t(){return i(this,t),a(this,e.apply(this,arguments))}return s(t,e),t.prototype._createTask=function(e){var t=this;return this.client.crypto().generateCommentImportKey(this.client.session.serverPublicKeyPEM).then(function(r){var n=r.key,o=r.key$;return t.client.request("comments.import.create-task",{options:u({},e,{key:o})}).then(function(e){return[e.data,n]})})},t.prototype._startTask=function(e,t){return this.client.request("comments.import.action-task",{id:e,options:t,action:"start"}).then(function(e){return e.data.task})},t.prototype.fromFile=function(e,t,r){var n=this,i=t.proofId,a=t.fileName,s=o(t,["proofId","fileName"]);return this._createTask({type:"pdf",proofId:i,fileName:a}).then(function(t){var o=t[0],i=o.task,a=o.uploadRequest,s=t[1],u=new h.default;return u.readBase64(e).then(function(e){return n.client.crypto().encryptCommentImportFile(s,e)}).then(function(e){return u.createBase64(e)}).then(function(e){return n.client.rawRequest({url:new p.default(a.url),method:a.method,headers:a.headers,body:e},{onUploadProgress:r})}).then(function(){return i})}).then(function(e){return n._startTask(e.id,s)})},t.prototype.info=function(e){return this.client.request("comments.import.get-task",{id:e}).then(function(e){return e.data.task})},t.prototype.cancel=function(e){return this.client.request("comments.import.action-task",{id:e,action:"cancel",options:{}}).then(function(e){return e.data.task})},t}(l.default);t.default=y},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=r(0),u=n(s),c=r(4),l=n(c),f=r(70),p=n(f),d=function(e){function t(r){o(this,t);var n=i(this,e.call(this,r));return n.integrations=new p.default(r,"user"),n}return a(t,e),t.prototype.uploadAvatar=function(e){var t=this;return(new l.default).readBase64(e).then(function(e){return t.client.request("profile.upload-avatar",{uploadedImage:"data:image/png;base64,"+e})})},t.prototype.deleteAvatar=function(){return this.client.request("profile.delete-avatar")},t.prototype.changePassword=function(e,t){var r=this,n=this.client.crypto();return Promise.all([n.generatePasswordHash(e),n.generatePasswordHash(t),n.encryptPrivateKey(this.client.session.privateKeyPEM,t)]).then(function(e){var t=e[0],n=e[1],o=e[2];return r.client.request("profile.change-password",{oldPassword:t,newPassword:n,newPrivateKey:o})})},t.prototype.getStatus=function(){return this.client.request("profile.status").then(function(e){return e.data.status})},t.prototype.setStatus=function(e){return this.client.request("profile.set-status",e)},t.prototype.clearStatus=function(){return this.client.request("profile.clear-status")},t}(u.default);t.default=d},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=r(0),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=function(e){function t(){return n(this,t),o(this,e.apply(this,arguments))}return i(t,e),t.prototype.check=function(){return this.client.request("sessions.check").then(function(){return null})},t}(s.default);t.default=u},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=r(0),u=n(s),c=r(4),l=n(c),f=function(e){function t(){return o(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.decrypt=function(e){var t=this,r=e.version,n=e.data,o=e.envelope,i=new l.default;return("string"==typeof n?i.create(n):Promise.resolve(n)).then(function(e){return i.read(e).then(function(e){return t.client.crypto().decryptData(r,e,o,t.client.keyPairs.getPrivateKeyPEMs()).then(function(e){return i.create(e)})})})},t}(u.default);t.default=f},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=r(0),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=function(e){function t(){return n(this,t),o(this,e.apply(this,arguments))}return i(t,e),t.prototype.generateAccessToken=function(){return this.client.request("live.generate-access-token").then(function(e){return e.data.AccessToken})},t}(s.default);t.default=u},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=r(0),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=function(e){function t(){return n(this,t),o(this,e.apply(this,arguments))}return i(t,e),t.prototype.rekeyUsersProofs=function(e){return this.client.request("brian.rekey-users-proofs",{userId:e.userId})},t}(s.default);t.default=u},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=r(17),a=function(e){return e&&e.__esModule?e:{default:e}}(i),s=r(34)("EventEmitter"),u=function(){function e(){n(this,e),this.handlers={}}return e.prototype.getHandlers=function(e){var t=this,r=[],n=[e];if(-1!==e.indexOf("."))for(var o=e;(o=o.substring(0,o.lastIndexOf("."))).length;)n.push(o+".*");return n.push("*"),n.forEach(function(e){(0,a.default)(t.handlers,e)&&r.push.apply(r,t.handlers[e])}),r},e.prototype.on=function(e,t){if("function"!=typeof t)return void s("Handler is not a function, got "+(void 0===t?"undefined":o(t)));(0,a.default)(this.handlers,e)||(this.handlers[e]=[]),this.handlers[e].push(t)},e.prototype.off=function(e,t){if((0,a.default)(this.handlers,e)){var r=this.handlers[e];r.splice(r.indexOf(t),1)}},e.prototype.addEventListener=function(e,t){return this.on(e,t)},e.prototype.removeEventListener=function(e,t){return this.off(e,t)},e.prototype.emit=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=this.getHandlers(e),o=new Array(n.length);s("Emitting"+(r?" async":"")+' "'+e+'" event ('+(t?"with":"without")+" data) to "+n.length+" handler(s)");var i=Object.freeze({type:e,data:t,timestamp:Date.now()});return n.forEach(function(e,t){try{o[t]=e(i)}catch(e){o[t]=e}}),r?Promise.all(o):o},e}();t.default=u},function(e,t,r){"use strict";function n(){try{o||(o=Intl.DateTimeFormat().resolvedOptions().timeZone||null)}catch(e){}return o}t.__esModule=!0;var o=null;t.default=n},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;t.AggregateError="undefined"!=typeof globalThis&&globalThis.AggregateError||"undefined"!=typeof global&&global.AggregateError||"undefined"!=typeof window&&window.AggregateError||function(e){function t(r,i){n(this,t);var a=o(this,e.call(this,r));return a.name="AggregateError",a.errors=i,a}return i(t,e),t}(Error)},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;t.GraphQLError=function(e){function t(r,i,a){n(this,t);var s=o(this,e.call(this,r));return s.name="GraphQLError",i&&(s.locations=i),a&&(s.path=a),s}return i(t,e),t}(Error)},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(0),u=function(e){return e&&e.__esModule?e:{default:e}}(s),c=function(e){function t(){return n(this,t),o(this,e.apply(this,arguments))}return i(t,e),t.prototype.listConfigurations=function(){return this.client.request("reports.configurations")},t.prototype.create=function(e,t){return this.client.request("reports.create",a({report:e},t))},t}(u.default);t.default=c},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=r(0),u=n(s),c=r(185),l=n(c),f=function(e){function t(r){o(this,t);var n=i(this,e.call(this,r));return n.invitations=new l.default(r),n}return a(t,e),t}(u.default);t.default=f},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var s=r(0),u=n(s),c=r(186),l=n(c),f=function(e){function t(){return o(this,t),i(this,e.apply(this,arguments))}return a(t,e),t.prototype.info=function(e){return this.client.request("teams.invitations.info",{invitationId:e}).then(function(e){return(new l.default).fromTeamInvitation(e.data)})},t.prototype.accept=function(e){return this.client.request("teams.invitations.accept",{invitationId:e}).then(function(){return null})},t.prototype.decline=function(e){return this.client.request("teams.invitations.decline",{invitationId:e}).then(function(){return null})},t}(u.default);t.default=f},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=r(3),i=function(e){return e&&e.__esModule?e:{default:e}}(o),a={name:"Name",logo:"Logo",teamId:"TeamId"},s=function(){function e(){n(this,e)}return e.prototype.fromTeamInvitation=function(e){return(0,i.default)(this,a,e),this},e}();t.default=s},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=r(0),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=function(e){function t(){return n(this,t),o(this,e.apply(this,arguments))}return i(t,e),t.prototype.options=function(e){return this.client.request("printing.options",{proofId:e})},t.prototype.create=function(e){return this.client.request("printing.create",e)},t}(s.default);t.default=u},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=r(0),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=function(e){function t(){return n(this,t),o(this,e.apply(this,arguments))}return i(t,e),t.prototype.requestTeam=function(e){return this.client.request("free-trial.request-team",e).then(function(e){return e.data})},t}(s.default);t.default=u},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=function(){function e(t){n(this,e),this.keyPairs=[],this.client=t}return e.prototype.addKeyPair=function(e){var t=this;return this.keyPairs.push(e),function(){return t.removeKeyPair(e)}},e.prototype.removeKeyPair=function(e){this.keyPairs.splice(this.keyPairs.indexOf(e),1)},e.prototype.getPrivateKeyPEMs=function(){return[this.client.session&&this.client.session.privateKeyPEM].concat(this.keyPairs.map(function(e){return e.privateKeyPEM})).filter(Boolean)},e.prototype.getPublicKeyPEMs=function(){return[this.client.session&&this.client.session.serverPublicKeyPEM,this.client.session&&this.client.session.publicKeyPEM].concat(this.keyPairs.map(function(e){return e.publicKeyPEM})).filter(Boolean)},e}();t.default=o},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e,t){return e.raw=t,e}t.__esModule=!0;var u=s(["\n fragment ChecklistTemplate on ChecklistTemplate {\n id\n state\n name\n description\n defaultIsRequiredForFinalApproval\n defaultShouldOpenOnProofLoad\n }\n"],["\n fragment ChecklistTemplate on ChecklistTemplate {\n id\n state\n name\n description\n defaultIsRequiredForFinalApproval\n defaultShouldOpenOnProofLoad\n }\n"]),c=s(["\n mutation sdk_ChecklistTemplates_create($input: CreateChecklistTemplateInput!) {\n createChecklistTemplate(input: $input) {\n ...ChecklistTemplate\n }\n }\n ","\n"],["\n mutation sdk_ChecklistTemplates_create($input: CreateChecklistTemplateInput!) {\n createChecklistTemplate(input: $input) {\n ...ChecklistTemplate\n }\n }\n ","\n"]),l=s(["\n mutation sdk_ChecklistTemplates_update($id: ID!, $input: UpdateChecklistTemplateInput!) {\n updateChecklistTemplate(id: $id, input: $input) {\n ...ChecklistTemplate\n }\n }\n ","\n"],["\n mutation sdk_ChecklistTemplates_update($id: ID!, $input: UpdateChecklistTemplateInput!) {\n updateChecklistTemplate(id: $id, input: $input) {\n ...ChecklistTemplate\n }\n }\n ","\n"]),f=s(["\n query sdk_ChecklistTemplates_list($states: [ChecklistTemplateState!]) {\n checklistTemplates(states: $states) {\n ...ChecklistTemplate\n }\n }\n ","\n"],["\n query sdk_ChecklistTemplates_list($states: [ChecklistTemplateState!]) {\n checklistTemplates(states: $states) {\n ...ChecklistTemplate\n }\n }\n ","\n"]),p=s(["\n query sdk_ChecklistTemplates_load($id: ID!) {\n checklistTemplate(id: $id) {\n ...ChecklistTemplate\n }\n }\n ","\n"],["\n query sdk_ChecklistTemplates_load($id: ID!) {\n checklistTemplate(id: $id) {\n ...ChecklistTemplate\n }\n }\n ","\n"]),d=r(0),h=n(d),y=r(78),m=r(191),g=n(m),v=(0,y.gql)(u),b=(0,y.gql)(c,v),E=(0,y.gql)(l,v),C=(0,y.gql)(f,v),_=(0,y.gql)(p,v),w=function(e){function t(r){o(this,t);var n=i(this,e.call(this,r));return n.entities=new g.default(r),n}return a(t,e),t.prototype.create=function(e){return this.client.graphql(b,{input:e}).then(function(e){return e.data.createChecklistTemplate})},t.prototype.update=function(e,t){return this.client.graphql(E,{id:e,input:t}).then(function(e){return e.data.updateChecklistTemplate})},t.prototype.list=function(e){return this.client.graphql(C,e).then(function(e){return e.data.checklistTemplates})},t.prototype.load=function(e){return this.client.graphql(_,{id:e}).then(function(e){return e.data.checklistTemplate})},t}(h.default);t.default=w},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function a(e,t){return e.raw=t,e}t.__esModule=!0;var s=a(["\n fragment ChecklistTemplateEntity on ChecklistTemplateEntity {\n id\n name\n type\n description\n }\n"],["\n fragment ChecklistTemplateEntity on ChecklistTemplateEntity {\n id\n name\n type\n description\n }\n"]),u=a(["\n query sdk_ChecklistTemplatesEntities_list($checklistId: ID!) {\n checklistTemplate(id: $checklistId) {\n entities {\n ...ChecklistTemplateEntity\n ...on ChecklistTemplateEntityGroup {\n entities {\n ...ChecklistTemplateEntity\n ...on ChecklistTemplateEntityGroup {\n entities {\n ...ChecklistTemplateEntity\n ...on ChecklistTemplateEntityGroup {\n entities {\n ...ChecklistTemplateEntity\n ...on ChecklistTemplateEntityGroup {\n entities {\n ...ChecklistTemplateEntity\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n ","\n"],["\n query sdk_ChecklistTemplatesEntities_list($checklistId: ID!) {\n checklistTemplate(id: $checklistId) {\n entities {\n ...ChecklistTemplateEntity\n ...on ChecklistTemplateEntityGroup {\n entities {\n ...ChecklistTemplateEntity\n ...on ChecklistTemplateEntityGroup {\n entities {\n ...ChecklistTemplateEntity\n ...on ChecklistTemplateEntityGroup {\n entities {\n ...ChecklistTemplateEntity\n ...on ChecklistTemplateEntityGroup {\n entities {\n ...ChecklistTemplateEntity\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n ","\n"]),c=r(0),l=function(e){return e&&e.__esModule?e:{default:e}}(c),f=r(78),p=(0,f.gql)(s),d=(0,f.gql)(u,p),h=function(e){function t(){return n(this,t),o(this,e.apply(this,arguments))}return i(t,e),t.prototype.list=function(e){return this.client.graphql(d,{checklistId:e}).then(function(e){return e.data.checklistTemplate.entities})},t}(l.default);t.default=h},function(e,t,r){"use strict";function n(e){return e?(e^16*Math.random()>>e/4).toString(16):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,n)}t.__esModule=!0,t.default=n},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0,t.ProofRole=t.Decision=t.Preference=t.FileCategory=t.ProofType=t.ReminderRelativeTo=t.ReminderAction=t.WorkflowUserState=t.WorkflowUserRole=t.WorkflowStepState=t.ResponseStatus=t.ProofStatus=t.ProofState=t.ImportProvider=t.FileStatus=t.FileAssignee=t.CommentState=void 0;var o=r(41),i=n(o),a=r(194),s=n(a),u=r(22),c=n(u),l=r(65),f=n(l),p=r(59),d=n(p),h=r(21),y=n(h),m=r(16),g=n(m),v=r(69),b=n(v),E=r(195),C=n(E),_=r(68),w=n(_),T=r(196),S=n(T),I=r(197),A=n(I),k=r(60),B=n(k),R=r(198),P=n(R),O=r(199),D=n(O),N=r(200),L=n(N),U=r(201),x=n(U);t.CommentState=i.default,t.FileAssignee=s.default,t.FileStatus=c.default,t.ImportProvider=f.default,t.ProofState=d.default,t.ProofStatus=y.default,t.ResponseStatus=g.default,t.WorkflowStepState=b.default,t.WorkflowUserRole=C.default,t.WorkflowUserState=w.default,t.ReminderAction=S.default,t.ReminderRelativeTo=A.default,t.ProofType=B.default,t.FileCategory=P.default,t.Preference=D.default,t.Decision=L.default,t.ProofRole=x.default},function(e,t,r){"use strict";t.__esModule=!0;var n={PROOF:"proof",ATTACHMENT:"attachment",SNAPSHOT:"snapshot"};t.default=n},function(e,t,r){"use strict";t.__esModule=!0;var n={VIEW_ONLY:"view-only",REVIEWER:"reviewer",MANDATORY:"mandatory",GATEKEEPER:"gatekeeper",APPROVER:"approver"};t.default=n},function(e,t,r){"use strict";t.__esModule=!0;var n={WORKFLOW_NUDGE_ALL:"nudge_all"};t.default=n},function(e,t,r){"use strict";t.__esModule=!0;var n={PROOF_DUE_DATE:"due_date"};t.default=n},function(e,t,r){"use strict";t.__esModule=!0;var n={STATIC:"static",VIDEO:"video",AUDIO:"audio",WEB:"web"};t.default=n},function(e,t,r){"use strict";t.__esModule=!0;var n={DEFAULT_DUE_DATE:"dueDate",DEFAULT_DUE_TIME:"dueTime",DEFAULT_MESSAGE_TO_REVIEWERS:"messageToReviewers",COLORS:"colors",DEFAULT_REMINDER:"proofReminders"};t.default=n},function(e,t,r){"use strict";t.__esModule=!0;var n={NO_DECISION:0,APPROVED:1,SEND_CHANGES:2,APPROVED_WITH_CHANGES:3};t.default=n},function(e,t,r){"use strict";t.__esModule=!0;var n={UNLISTED_REVIEWER:"unlisted-reviewer"};t.default=n},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0,t.WorkflowUser=t.WorkflowStep=t.Workflow=t.User=t.Session=t.ProofVersion=t.ProofGroup=t.Proof=t.File=t.Comment=void 0;var o=r(71),i=n(o),a=r(36),s=n(a),u=r(13),c=n(u),l=r(23),f=n(l),p=r(62),d=n(p),h=r(18),y=n(h),m=r(9),g=n(m),v=r(37),b=n(v),E=r(25),C=n(E),_=r(38),w=n(_);t.Comment=i.default,t.File=s.default,t.Proof=c.default,t.ProofGroup=f.default,t.ProofVersion=d.default,t.Session=y.default,t.User=g.default,t.Workflow=b.default,t.WorkflowStep=C.default,t.WorkflowUser=w.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){return"string"==typeof e&&(e=(0,a.default)(e)),(0,c.default)(e)}t.__esModule=!0,t.pins=t.comments=void 0;var i=r(39),a=n(i),s=r(40),u=r(75),c=n(u),l=r(204),f=n(l),p=r(205),d=n(p),h=r(73),y=r(77);t.comments={parse:a.default,serialize:s.serialize,mentions:o,text:f.default,html:d.default},t.pins={parse:h.parsePins,serialize:y.serializePins}},function(e,t,r){"use strict";function n(e){return e.blocks.map(function(e){return e.value}).map(i.default).join("\n")}t.__esModule=!0;var o=r(79),i=function(e){return e&&e.__esModule?e:{default:e}}(o);t.default=n},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){return{trusted:!0,value:e}}function i(e){return[].concat(e)}function a(e){return Object.keys(e).map(function(t){return t+": "+e[t]}).join("; ")}function s(e){var t=(0,h.default)(e);return u((0,l.default)(t,w))}function u(e){function t(e){e.forEach(function(e){e&&("string"==typeof e?r.push((0,m.default)(e)):!0===e.trusted?r.push(e.value):e.length&&t(e))})}var r=[];return t(e),r.join("")}t.__esModule=!0;var c=r(206),l=n(c),f=r(221),p=n(f),d=r(229),h=n(d),y=r(79),m=n(y),g={BOLD:{"font-weight":"bold"},ITALIC:{"font-style":"italic"},UNDERLINE:{"text-decoration":"underline"},STRIKETHROUGH:{"text-decoration":"line-through"},SUPERSCRIPT:{"font-size":"0.8em","vertical-align":"super"},SUBSCRIPT:{"font-size":"0.8em","vertical-align":"sub"}},v=function(e){var t=e.style,r=e.children;return[o('<span style="'+a(t)+'">'),i(r),o("</span>")]},b=function(e){return function(t){return[o("<"+e+">")].concat(t.map(function(e){return[o("<li>"),i(e),o("</li>")]}),[o("</"+e+">")])}},E={unstyled:function(e){return e.map(function(e){return[o("<div>"),i(e),o("<br /></div>")]})},"unordered-list-item":b("ul"),"ordered-list-item":b("ol")},C={mention:function(e,t){return[o('<span data-mention-user-id="'+t.mention.link+'">'),i(e),o("</span>")]}},_=[{strategy:p.default,component:function(e){var t=e.children;return[o('<a href="'+e.decoratedText+'" target="_blank" rel="noopener noreferrer">'),i(t),o("</a>")]}}],w={styles:(0,c.createStylesRenderer)(v,g),blocks:E,entities:C,decorators:_};t.default=s},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.CompositeDecorator=t.renderNode=t.RawParser=t.createBlockRenderer=t.createStylesRenderer=void 0;var o=r(80),i=n(o),a=r(209),s=n(a),u=r(210),c=r(82),l=n(c),f=r(220),p=n(f);t.createStylesRenderer=s.default,t.createBlockRenderer=p.default,t.RawParser=i.default,t.renderNode=u.renderNode,t.CompositeDecorator=l.default,t.default=u.render},function(e,t,r){"use strict";function n(e){return Array.isArray(e)?e:Array.from(e)}function o(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),s=r(208),u=function(e){return e&&e.__esModule?e:{default:e}}(s),c=function(){function e(t){i(this,e),this.content=t.content||[],this.start=void 0!==t.start?t.start:null,this.end=void 0!==t.end?t.end:null,this.entity=void 0!==t.entity?t.entity:null,this.decorator=void 0!==t.decorator?t.decorator:null,this.decoratorProps=t.decoratorProps||null,this.decoratedText=void 0!==t.decoratedText?t.decoratedText:null,this.contentState=t.contentState,this.style=t.style||null,this.styles=t.styles||null,this.block=t.block||{}}return a(e,[{key:"getCurrentContent",value:function(){return this.content[this.content.length-1]}},{key:"addToCurrentContent",value:function(e){this.content[this.content.length-1]=this.content[this.content.length-1]+e}},{key:"handleFlatPush",value:function(t,r){var n=this.getCurrentContent();if(n instanceof e&&(0,u.default)(r,n.styles))return void n.addToCurrentContent(t);var i=new e({styles:[].concat(o(r)),content:[t]});this.content.push(i)}},{key:"pushContent",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!r||r.length<1)return"string"==typeof t&&"string"==typeof this.getCurrentContent()?this.addToCurrentContent(t):this.content.push(t),this;if(o)return this.handleFlatPush(t,r),this;var i=n(r),a=i[0],s=i.slice(1),u=this.getCurrentContent();if(u instanceof e&&u.style===a)u.pushContent(t,s,o);else{var c=new e({style:a});c.pushContent(t,s,o),this.content.push(c)}return this}}]),e}();t.default=c},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0};t.default=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e,t){return e.map(function(e){return t[e]}).reduce(function(e,t){var r={};if(void 0!==t){var n="text-decoration"in t?"text-decoration":"textDecoration";t[n]!==e[n]&&(r[n]=[e[n],t[n]].join(" ").trim())}return Object.assign(e,t,r)},{})},o=function(e,t){return function(r,o,i){var a=n(o,t);return e(Object.assign({},{children:r},i,{style:a}))}};t.default=o},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.render=t.renderNode=void 0;var o=r(80),i=n(o),a=r(211),s=n(a),u=r(212),c=n(u),l=r(213),f=n(l),p=r(214),d=n(p),h=r(215),y=n(h),m=r(216),g=n(m),v=r(217),b=n(v),E=t.renderNode=function e(t,r,n,o,i,a,s){if(t.styles&&o)return o((0,d.default)(t.content,a),t.styles,{key:s()});var u=[],c=0;if(t.content.forEach(function(t){"string"==typeof t?u=(0,y.default)(t,u,c):(c+=1,u[c]=e(t,r,n,o,i,a,s),c+=1)}),t.style&&r[t.style])return r[t.style]((0,d.default)(u,a),{key:s()});if(null!==t.entity){var l=i[t.entity];if(l&&n[l.type])return n[l.type]((0,d.default)(u,a),l.data,{key:t.entity})}if(null!==t.decorator){var f=[t.block.key,t.start,0].join(".");return t.decorator(Object.assign({children:(0,d.default)(u,a),decoratedText:t.decoratedText,contentState:t.contentState,entityKey:t.entity,offsetKey:f,key:f},t.decoratorProps))}return u},C=function(e){var t=[],r=[],n=0,o=function(e){var o=n-e;for(r.length<o&&(o=r.length),o;o>0;o-=1){var i=t;t=r.pop(),t[t.length-1].children=i}};return e.forEach(function(e){n<e.depth?(r.push(t),t=[]):n>e.depth&&o(e.depth),n=e.depth,t.push(e)}),0!==n&&o(0),t},_=function(e,t,r,n,o){var i=n.prevType,a=n.prevDepth,s=n.prevKeys,u=n.prevData;if(0!==e.length){var c=t[i]||t[o.blockFallback];if(c){var l={depth:a,keys:s};return u&&u.some(function(e){return!!e})&&(l.data=u),void r.push(c(e,l))}r.push(e)}},w=function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},a=arguments[4],s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:{},l=Object.assign({},g.default,u),p=[],h=[],y=null,m=0,v=[],b=[],C=!1,w=new i.default({flat:!!a});return t.forEach(function(t){if((0,c.default)(t,y,l))return void(!0===l.cleanup.split&&(C=!0));var i=w.parse(t),u=E(i,r,o,a,s,l,(0,f.default)());if((y&&y!==t.type||C)&&(_(h,n,p,{prevType:y,prevDepth:m,prevKeys:v,prevData:b},l),b=[],v=[],h=[],C=!1),t.children){var d=e(t.children,r,n,o,a,s,l);u.push(d)}h.push(u),y=t.type,m=t.depth,v.push(t.key),b.push(t.data)}),_(h,n,p,{prevType:y,prevDepth:m,prevKeys:v,prevData:b},l),(0,d.default)(p,l)};t.render=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!e||!Array.isArray(e.blocks))return(0,s.default)("invalid raw object"),null;if(!e.blocks.length)return null;var n=t.inline,o=t.blocks,i=t.entities,a=t.styles,u=t.decorators,c=u?(0,b.default)(e,u,r):e.blocks,l=C(c);return w(l,n,o,i,a,e.entityMap,r)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e){};t.default=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e,t){return!!(t.trim?e.trim():e)},o=function(e,t){return!!n(e.text,t)||(!(!e.data||!Object.keys(e.data).length)||!(!e.entityRanges||!e.entityRanges.length))},i=function(e,t,r){var n=r.cleanup;return!(!n||o(e,n))&&((!n.after||"all"===n.after||-1!==n.after.indexOf(t))&&(!(!n.except||-1!==n.except.indexOf(e.type))||!(!n.types||"all"!==n.types&&-1===n.types.indexOf(e.type))))};t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){var e=0;return function(){var t=e;return e+=1,t}};t.default=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e,t){return Array.isArray(e)&&t.joinOutput?e.join(""):e};t.default=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e,t,r){var n=t;return t[r]?n[r]+=e:n[r]=e,n};t.default=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={joinOutput:!1,cleanup:{after:["atomic"],types:["unstyled"],trim:!1,split:!0},blockFallback:"unstyled"};t.default=n},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}Object.defineProperty(t,"__esModule",{value:!0});var i=r(81),a=n(i),s=r(82),u=n(s),c=r(218),l=n(c),f=r(219),p=n(f),d=function(e,t){return e.forEach(function(e){var r=t.text.substring(0,e.offset),n=t.text.substring(e.offset,e.offset+e.length);e.offset=a.default.ucs2.decode(r).length,e.length=a.default.ucs2.decode(n).length}),e},h=function(e){return"function"==typeof e.getDecorations&&"function"==typeof e.getComponentForKey&&"function"==typeof e.getPropsForKey},y=function(e){var t=new u.default(e.filter(function(e){return!h(e)})),r=e.filter(function(e){return h(e)}),n=[].concat(o(r),[t]);return new l.default(n)},m=function(e,t,r,n){var o=n.createContentBlock,i=[],a=y(t),s=o?o(e):(0,p.default)(e),u=a.getDecorations(s,r),c=0;return u.forEach(function(e,t){if(!e)return void(c+=1);var n=t+1,o=u[n];o&&o===e||(i.push({offset:c,length:n-c,component:a.getComponentForKey(e),decoratorProps:a.getPropsForKey(e)||{},contentState:r}),c=n)}),Object.assign({},e,{decoratorRanges:d(i,e)})},g=function(e,t,r){var n=r.convertFromRaw&&r.convertFromRaw(e);return e.blocks.map(function(e){return m(e,t,n,r||{})})};t.default=g},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=function(){function e(t){n(this,e),this.decorators=t}return o(e,[{key:"getDecorations",value:function(e,t){var r=new Array(e.getText().length).fill(null);return this.decorators.forEach(function(n,o){n.getDecorations(e,t).forEach(function(e,t){e&&(r[t]=o+"-"+e)})}),r}},{key:"getComponentForKey",value:function(t){return this.getDecoratorForKey(t).getComponentForKey(e.getInnerKey(t))}},{key:"getPropsForKey",value:function(t){return this.getDecoratorForKey(t).getPropsForKey(e.getInnerKey(t))}},{key:"getDecoratorForKey",value:function(e){var t=e.split("-"),r=Number(t[0]);return this.decorators[r]}}],[{key:"getInnerKey",value:function(e){return e.split("-").slice(1).join("-")}}]),e}();t.default=i},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=function(){function e(t){n(this,e),Object.assign(this,t)}return o(e,[{key:"get",value:function(e){return this[e]}},{key:"getText",value:function(){return this.text}},{key:"getType",value:function(){return this.type}},{key:"getKey",value:function(){return this.key}},{key:"getLength",value:function(){return this.text.length}},{key:"getDepth",value:function(){return this.depth}},{key:"getData",value:function(){return this.data}}]),e}(),a=function(e){return new i(e)};t.default=a},function(e,t,r){"use strict";function n(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}Object.defineProperty(t,"__esModule",{value:!0});var o=function(e,t){var r=e.keys;if(t)return t;if(r)return r.join(",")},i=function(e,t){return function(r,i,a){var s=Object.assign({},i),u=o(s,a);return delete s.depth,delete s.keys,t.apply(void 0,[e,Object.assign({},s,{key:u})].concat(n(r)))}},a=function(e,t,r){var n=r.children,o=r.props,a=r.key,s=i(t.wrapper,e),u=i(t.element,e);return s(n.map(function(e,t){return u(e,{depth:o.depth},o.keys&&o.keys[t])}),o,a)},s=function(e,t){var r={};return Object.keys(t).forEach(function(n){var o=t[n];if(o.wrapper)return void(r[n]=function(t,r,n){return a(e,o,{children:t,props:r,key:n})});r[n]=i(o.element,e)}),r};t.default=s},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var o=r(222),i=n(o),a=r(228),s=n(a),u=(0,i.default)();u.tlds(s.default).set({fuzzyEmail:!1});var c=function(e,t){var r=u.match(e.get("text"));if(void 0!==r&&null!==r)for(var n=0;n<r.length;n+=1)t(r[n].index,r[n].lastIndex)};t.default=c},function(e,t,r){"use strict";function n(e){return Array.prototype.slice.call(arguments,1).forEach(function(t){t&&Object.keys(t).forEach(function(r){e[r]=t[r]})}),e}function o(e){return Object.prototype.toString.call(e)}function i(e){return"[object String]"===o(e)}function a(e){return"[object Object]"===o(e)}function s(e){return"[object RegExp]"===o(e)}function u(e){return"[object Function]"===o(e)}function c(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function l(e){return Object.keys(e||{}).reduce(function(e,t){return e||v.hasOwnProperty(t)},!1)}function f(e){e.__index__=-1,e.__text_cache__=""}function p(e){return function(t,r){var n=t.slice(r);return e.test(n)?n.match(e)[0].length:0}}function d(){return function(e,t){t.normalize(e)}}function h(e){function t(e){return e.replace("%TLDS%",o.src_tlds)}function n(e,t){throw new Error('(LinkifyIt) Invalid schema "'+e+'": '+t)}var o=e.re=r(223)(e.__opts__),l=e.__tlds__.slice();e.onCompile(),e.__tlds_replaced__||l.push(E),l.push(o.src_xn),o.src_tlds=l.join("|"),o.email_fuzzy=RegExp(t(o.tpl_email_fuzzy),"i"),o.link_fuzzy=RegExp(t(o.tpl_link_fuzzy),"i"),o.link_no_ip_fuzzy=RegExp(t(o.tpl_link_no_ip_fuzzy),"i"),o.host_fuzzy_test=RegExp(t(o.tpl_host_fuzzy_test),"i");var h=[];e.__compiled__={},Object.keys(e.__schemas__).forEach(function(t){var r=e.__schemas__[t];if(null!==r){var o={validate:null,link:null};return e.__compiled__[t]=o,a(r)?(s(r.validate)?o.validate=p(r.validate):u(r.validate)?o.validate=r.validate:n(t,r),void(u(r.normalize)?o.normalize=r.normalize:r.normalize?n(t,r):o.normalize=d())):i(r)?void h.push(t):void n(t,r)}}),h.forEach(function(t){e.__compiled__[e.__schemas__[t]]&&(e.__compiled__[t].validate=e.__compiled__[e.__schemas__[t]].validate,e.__compiled__[t].normalize=e.__compiled__[e.__schemas__[t]].normalize)}),e.__compiled__[""]={validate:null,normalize:d()};var y=Object.keys(e.__compiled__).filter(function(t){return t.length>0&&e.__compiled__[t]}).map(c).join("|");e.re.schema_test=RegExp("(^|(?!_)(?:[><|]|"+o.src_ZPCc+"))("+y+")","i"),e.re.schema_search=RegExp("(^|(?!_)(?:[><|]|"+o.src_ZPCc+"))("+y+")","ig"),e.re.pretest=RegExp("("+e.re.schema_test.source+")|("+e.re.host_fuzzy_test.source+")|@","i"),f(e)}function y(e,t){var r=e.__index__,n=e.__last_index__,o=e.__text_cache__.slice(r,n);this.schema=e.__schema__.toLowerCase(),this.index=r+t,this.lastIndex=n+t,this.raw=o,this.text=o,this.url=o}function m(e,t){var r=new y(e,t);return e.__compiled__[r.schema].normalize(r,e),r}function g(e,t){if(!(this instanceof g))return new g(e,t);t||l(e)&&(t=e,e={}),this.__opts__=n({},v,t),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=n({},b,e),this.__compiled__={},this.__tlds__=C,this.__tlds_replaced__=!1,this.re={},h(this)}var v={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1},b={"http:":{validate:function(e,t,r){var n=e.slice(t);return r.re.http||(r.re.http=new RegExp("^\\/\\/"+r.re.src_auth+r.re.src_host_port_strict+r.re.src_path,"i")),r.re.http.test(n)?n.match(r.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(e,t,r){var n=e.slice(t);return r.re.no_http||(r.re.no_http=new RegExp("^"+r.re.src_auth+"(?:localhost|(?:(?:"+r.re.src_domain+")\\.)+"+r.re.src_domain_root+")"+r.re.src_port+r.re.src_host_terminator+r.re.src_path,"i")),r.re.no_http.test(n)?t>=3&&":"===e[t-3]?0:t>=3&&"/"===e[t-3]?0:n.match(r.re.no_http)[0].length:0}},"mailto:":{validate:function(e,t,r){var n=e.slice(t);return r.re.mailto||(r.re.mailto=new RegExp("^"+r.re.src_email_name+"@"+r.re.src_host_strict,"i")),r.re.mailto.test(n)?n.match(r.re.mailto)[0].length:0}}},E="a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]",C="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");g.prototype.add=function(e,t){return this.__schemas__[e]=t,h(this),this},g.prototype.set=function(e){return this.__opts__=n(this.__opts__,e),this},g.prototype.test=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return!1;var t,r,n,o,i,a,s,u;if(this.re.schema_test.test(e))for(s=this.re.schema_search,s.lastIndex=0;null!==(t=s.exec(e));)if(o=this.testSchemaAt(e,t[2],s.lastIndex)){this.__schema__=t[2],this.__index__=t.index+t[1].length,this.__last_index__=t.index+t[0].length+o;break}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(u=e.search(this.re.host_fuzzy_test))>=0&&(this.__index__<0||u<this.__index__)&&null!==(r=e.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy))&&(i=r.index+r[1].length,(this.__index__<0||i<this.__index__)&&(this.__schema__="",this.__index__=i,this.__last_index__=r.index+r[0].length)),this.__opts__.fuzzyEmail&&this.__compiled__["mailto:"]&&e.indexOf("@")>=0&&null!==(n=e.match(this.re.email_fuzzy))&&(i=n.index+n[1].length,a=n.index+n[0].length,(this.__index__<0||i<this.__index__||i===this.__index__&&a>this.__last_index__)&&(this.__schema__="mailto:",this.__index__=i,this.__last_index__=a)),this.__index__>=0},g.prototype.pretest=function(e){return this.re.pretest.test(e)},g.prototype.testSchemaAt=function(e,t,r){return this.__compiled__[t.toLowerCase()]?this.__compiled__[t.toLowerCase()].validate(e,r,this):0},g.prototype.match=function(e){var t=0,r=[];this.__index__>=0&&this.__text_cache__===e&&(r.push(m(this,t)),t=this.__last_index__);for(var n=t?e.slice(t):e;this.test(n);)r.push(m(this,t)),n=n.slice(this.__last_index__),t+=this.__last_index__;return r.length?r:null},g.prototype.tlds=function(e,t){return e=Array.isArray(e)?e:[e],t?(this.__tlds__=this.__tlds__.concat(e).sort().filter(function(e,t,r){return e!==r[t-1]}).reverse(),h(this),this):(this.__tlds__=e.slice(),this.__tlds_replaced__=!0,h(this),this)},g.prototype.normalize=function(e){e.schema||(e.url="http://"+e.url),"mailto:"!==e.schema||/^mailto:/i.test(e.url)||(e.url="mailto:"+e.url)},g.prototype.onCompile=function(){},e.exports=g},function(e,t,r){"use strict";e.exports=function(e){var t={};t.src_Any=r(224).source,t.src_Cc=r(225).source,t.src_Z=r(226).source,t.src_P=r(227).source,t.src_ZPCc=[t.src_Z,t.src_P,t.src_Cc].join("|"),t.src_ZCc=[t.src_Z,t.src_Cc].join("|");return t.src_pseudo_letter="(?:(?![><|]|"+t.src_ZPCc+")"+t.src_Any+")",t.src_ip4="(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)",t.src_auth="(?:(?:(?!"+t.src_ZCc+"|[@/\\[\\]()]).)+@)?",t.src_port="(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?",t.src_host_terminator="(?=$|[><|]|"+t.src_ZPCc+")(?!-|_|:\\d|\\.-|\\.(?!$|"+t.src_ZPCc+"))",t.src_path="(?:[/?#](?:(?!"+t.src_ZCc+"|[><|]|[()[\\]{}.,\"'?!\\-]).|\\[(?:(?!"+t.src_ZCc+"|\\]).)*\\]|\\((?:(?!"+t.src_ZCc+"|[)]).)*\\)|\\{(?:(?!"+t.src_ZCc+'|[}]).)*\\}|\\"(?:(?!'+t.src_ZCc+'|["]).)+\\"|\\\'(?:(?!'+t.src_ZCc+"|[']).)+\\'|\\'(?="+t.src_pseudo_letter+"|[-]).|\\.{2,3}[a-zA-Z0-9%/]|\\.(?!"+t.src_ZCc+"|[.]).|"+(e&&e["---"]?"\\-(?!--(?:[^-]|$))(?:-*)|":"\\-+|")+"\\,(?!"+t.src_ZCc+").|\\!(?!"+t.src_ZCc+"|[!]).|\\?(?!"+t.src_ZCc+"|[?]).)+|\\/)?",t.src_email_name='[\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]+',t.src_xn="xn--[a-z0-9\\-]{1,59}",t.src_domain_root="(?:"+t.src_xn+"|"+t.src_pseudo_letter+"{1,63})",t.src_domain="(?:"+t.src_xn+"|(?:"+t.src_pseudo_letter+")|(?:"+t.src_pseudo_letter+"(?:-(?!-)|"+t.src_pseudo_letter+"){0,61}"+t.src_pseudo_letter+"))",t.src_host="(?:(?:(?:(?:"+t.src_domain+")\\.)*"+t.src_domain+"))",t.tpl_host_fuzzy="(?:"+t.src_ip4+"|(?:(?:(?:"+t.src_domain+")\\.)+(?:%TLDS%)))",t.tpl_host_no_ip_fuzzy="(?:(?:(?:"+t.src_domain+")\\.)+(?:%TLDS%))",t.src_host_strict=t.src_host+t.src_host_terminator,t.tpl_host_fuzzy_strict=t.tpl_host_fuzzy+t.src_host_terminator,t.src_host_port_strict=t.src_host+t.src_port+t.src_host_terminator,t.tpl_host_port_fuzzy_strict=t.tpl_host_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_port_no_ip_fuzzy_strict=t.tpl_host_no_ip_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_fuzzy_test="localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:"+t.src_ZPCc+"|>|$))",t.tpl_email_fuzzy="(^|[><|]|\\(|"+t.src_ZCc+")("+t.src_email_name+"@"+t.tpl_host_fuzzy_strict+")",t.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+t.src_ZPCc+"))((?![$+<=>^`||])"+t.tpl_host_port_fuzzy_strict+t.src_path+")",t.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+t.src_ZPCc+"))((?![$+<=>^`||])"+t.tpl_host_port_no_ip_fuzzy_strict+t.src_path+")",t}},function(e,t){e.exports=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/},function(e,t){e.exports=/[\0-\x1F\x7F-\x9F]/},function(e,t){e.exports=/[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/},function(e,t){e.exports=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E49\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDF3C-\uDF3E]|\uD806[\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2]|\uD807[\uDC41-\uDC45\uDC70\uDC71]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/},function(e,t){e.exports=["aaa","aarp","abarth","abb","abbott","abbvie","abc","able","abogado","abudhabi","ac","academy","accenture","accountant","accountants","aco","active","actor","ad","adac","ads","adult","ae","aeg","aero","aetna","af","afamilycompany","afl","africa","ag","agakhan","agency","ai","aig","aigo","airbus","airforce","airtel","akdn","al","alfaromeo","alibaba","alipay","allfinanz","allstate","ally","alsace","alstom","am","americanexpress","americanfamily","amex","amfam","amica","amsterdam","analytics","android","anquan","anz","ao","aol","apartments","app","apple","aq","aquarelle","ar","arab","aramco","archi","army","arpa","art","arte","as","asda","asia","associates","at","athleta","attorney","au","auction","audi","audible","audio","auspost","author","auto","autos","avianca","aw","aws","ax","axa","az","azure","ba","baby","baidu","banamex","bananarepublic","band","bank","bar","barcelona","barclaycard","barclays","barefoot","bargains","baseball","basketball","bauhaus","bayern","bb","bbc","bbt","bbva","bcg","bcn","bd","be","beats","beauty","beer","bentley","berlin","best","bestbuy","bet","bf","bg","bh","bharti","bi","bible","bid","bike","bing","bingo","bio","biz","bj","black","blackfriday","blanco","blockbuster","blog","bloomberg","blue","bm","bms","bmw","bn","bnl","bnpparibas","bo","boats","boehringer","bofa","bom","bond","boo","book","booking","bosch","bostik","boston","bot","boutique","box","br","bradesco","bridgestone","broadway","broker","brother","brussels","bs","bt","budapest","bugatti","build","builders","business","buy","buzz","bv","bw","by","bz","bzh","ca","cab","cafe","cal","call","calvinklein","cam","camera","camp","cancerresearch","canon","capetown","capital","capitalone","car","caravan","cards","care","career","careers","cars","cartier","casa","case","caseih","cash","casino","cat","catering","catholic","cba","cbn","cbre","cbs","cc","cd","ceb","center","ceo","cern","cf","cfa","cfd","cg","ch","chanel","channel","chase","chat","cheap","chintai","christmas","chrome","chrysler","church","ci","cipriani","circle","cisco","citadel","citi","citic","city","cityeats","ck","cl","claims","cleaning","click","clinic","clinique","clothing","cloud","club","clubmed","cm","cn","co","coach","codes","coffee","college","cologne","com","comcast","commbank","community","company","compare","computer","comsec","condos","construction","consulting","contact","contractors","cooking","cookingchannel","cool","coop","corsica","country","coupon","coupons","courses","cr","credit","creditcard","creditunion","cricket","crown","crs","cruise","cruises","csc","cu","cuisinella","cv","cw","cx","cy","cymru","cyou","cz","dabur","dad","dance","data","date","dating","datsun","day","dclk","dds","de","deal","dealer","deals","degree","delivery","dell","deloitte","delta","democrat","dental","dentist","desi","design","dev","dhl","diamonds","diet","digital","direct","directory","discount","discover","dish","diy","dj","dk","dm","dnp","do","docs","doctor","dodge","dog","doha","domains","dot","download","drive","dtv","dubai","duck","dunlop","duns","dupont","durban","dvag","dvr","dz","earth","eat","ec","eco","edeka","edu","education","ee","eg","email","emerck","energy","engineer","engineering","enterprises","epost","epson","equipment","er","ericsson","erni","es","esq","estate","esurance","et","etisalat","eu","eurovision","eus","events","everbank","exchange","expert","exposed","express","extraspace","fage","fail","fairwinds","faith","family","fan","fans","farm","farmers","fashion","fast","fedex","feedback","ferrari","ferrero","fi","fiat","fidelity","fido","film","final","finance","financial","fire","firestone","firmdale","fish","fishing","fit","fitness","fj","fk","flickr","flights","flir","florist","flowers","fly","fm","fo","foo","food","foodnetwork","football","ford","forex","forsale","forum","foundation","fox","fr","free","fresenius","frl","frogans","frontdoor","frontier","ftr","fujitsu","fujixerox","fun","fund","furniture","futbol","fyi","ga","gal","gallery","gallo","gallup","game","games","gap","garden","gb","gbiz","gd","gdn","ge","gea","gent","genting","george","gf","gg","ggee","gh","gi","gift","gifts","gives","giving","gl","glade","glass","gle","global","globo","gm","gmail","gmbh","gmo","gmx","gn","godaddy","gold","goldpoint","golf","goo","goodhands","goodyear","goog","google","gop","got","gov","gp","gq","gr","grainger","graphics","gratis","green","gripe","grocery","group","gs","gt","gu","guardian","gucci","guge","guide","guitars","guru","gw","gy","hair","hamburg","hangout","haus","hbo","hdfc","hdfcbank","health","healthcare","help","helsinki","here","hermes","hgtv","hiphop","hisamitsu","hitachi","hiv","hk","hkt","hm","hn","hockey","holdings","holiday","homedepot","homegoods","homes","homesense","honda","honeywell","horse","hospital","host","hosting","hot","hoteles","hotels","hotmail","house","how","hr","hsbc","ht","hu","hughes","hyatt","hyundai","ibm","icbc","ice","icu","id","ie","ieee","ifm","ikano","il","im","imamat","imdb","immo","immobilien","in","industries","infiniti","info","ing","ink","institute","insurance","insure","int","intel","international","intuit","investments","io","ipiranga","iq","ir","irish","is","iselect","ismaili","ist","istanbul","it","itau","itv","iveco","iwc","jaguar","java","jcb","jcp","je","jeep","jetzt","jewelry","jio","jlc","jll","jm","jmp","jnj","jo","jobs","joburg","jot","joy","jp","jpmorgan","jprs","juegos","juniper","kaufen","kddi","ke","kerryhotels","kerrylogistics","kerryproperties","kfh","kg","kh","ki","kia","kim","kinder","kindle","kitchen","kiwi","km","kn","koeln","komatsu","kosher","kp","kpmg","kpn","kr","krd","kred","kuokgroup","kw","ky","kyoto","kz","la","lacaixa","ladbrokes","lamborghini","lamer","lancaster","lancia","lancome","land","landrover","lanxess","lasalle","lat","latino","latrobe","law","lawyer","lb","lc","lds","lease","leclerc","lefrak","legal","lego","lexus","lgbt","li","liaison","lidl","life","lifeinsurance","lifestyle","lighting","like","lilly","limited","limo","lincoln","linde","link","lipsy","live","living","lixil","lk","llc","loan","loans","locker","locus","loft","lol","london","lotte","lotto","love","lpl","lplfinancial","lr","ls","lt","ltd","ltda","lu","lundbeck","lupin","luxe","luxury","lv","ly","ma","macys","madrid","maif","maison","makeup","man","management","mango","map","market","marketing","markets","marriott","marshalls","maserati","mattel","mba","mc","mckinsey","md","me","med","media","meet","melbourne","meme","memorial","men","menu","meo","merckmsd","metlife","mg","mh","miami","microsoft","mil","mini","mint","mit","mitsubishi","mk","ml","mlb","mls","mm","mma","mn","mo","mobi","mobile","mobily","moda","moe","moi","mom","monash","money","monster","mopar","mormon","mortgage","moscow","moto","motorcycles","mov","movie","movistar","mp","mq","mr","ms","msd","mt","mtn","mtr","mu","museum","mutual","mv","mw","mx","my","mz","na","nab","nadex","nagoya","name","nationwide","natura","navy","nba","nc","ne","nec","net","netbank","netflix","network","neustar","new","newholland","news","next","nextdirect","nexus","nf","nfl","ng","ngo","nhk","ni","nico","nike","nikon","ninja","nissan","nissay","nl","no","nokia","northwesternmutual","norton","now","nowruz","nowtv","np","nr","nra","nrw","ntt","nu","nyc","nz","obi","observer","off","office","okinawa","olayan","olayangroup","oldnavy","ollo","om","omega","one","ong","onl","online","onyourside","ooo","open","oracle","orange","org","organic","origins","osaka","otsuka","ott","ovh","pa","page","panasonic","panerai","paris","pars","partners","parts","party","passagens","pay","pccw","pe","pet","pf","pfizer","pg","ph","pharmacy","phd","philips","phone","photo","photography","photos","physio","piaget","pics","pictet","pictures","pid","pin","ping","pink","pioneer","pizza","pk","pl","place","play","playstation","plumbing","plus","pm","pn","pnc","pohl","poker","politie","porn","post","pr","pramerica","praxi","press","prime","pro","prod","productions","prof","progressive","promo","properties","property","protection","pru","prudential","ps","pt","pub","pw","pwc","py","qa","qpon","quebec","quest","qvc","racing","radio","raid","re","read","realestate","realtor","realty","recipes","red","redstone","redumbrella","rehab","reise","reisen","reit","reliance","ren","rent","rentals","repair","report","republican","rest","restaurant","review","reviews","rexroth","rich","richardli","ricoh","rightathome","ril","rio","rip","rmit","ro","rocher","rocks","rodeo","rogers","room","rs","rsvp","ru","rugby","ruhr","run","rw","rwe","ryukyu","sa","saarland","safe","safety","sakura","sale","salon","samsclub","samsung","sandvik","sandvikcoromant","sanofi","sap","sapo","sarl","sas","save","saxo","sb","sbi","sbs","sc","sca","scb","schaeffler","schmidt","scholarships","school","schule","schwarz","science","scjohnson","scor","scot","sd","se","search","seat","secure","security","seek","select","sener","services","ses","seven","sew","sex","sexy","sfr","sg","sh","shangrila","sharp","shaw","shell","shia","shiksha","shoes","shop","shopping","shouji","show","showtime","shriram","si","silk","sina","singles","site","sj","sk","ski","skin","sky","skype","sl","sling","sm","smart","smile","sn","sncf","so","soccer","social","softbank","software","sohu","solar","solutions","song","sony","soy","space","spiegel","sport","spot","spreadbetting","sr","srl","srt","st","stada","staples","star","starhub","statebank","statefarm","statoil","stc","stcgroup","stockholm","storage","store","stream","studio","study","style","su","sucks","supplies","supply","support","surf","surgery","suzuki","sv","swatch","swiftcover","swiss","sx","sy","sydney","symantec","systems","sz","tab","taipei","talk","taobao","target","tatamotors","tatar","tattoo","tax","taxi","tc","tci","td","tdk","team","tech","technology","tel","telecity","telefonica","temasek","tennis","teva","tf","tg","th","thd","theater","theatre","tiaa","tickets","tienda","tiffany","tips","tires","tirol","tj","tjmaxx","tjx","tk","tkmaxx","tl","tm","tmall","tn","to","today","tokyo","tools","top","toray","toshiba","total","tours","town","toyota","toys","tr","trade","trading","training","travel","travelchannel","travelers","travelersinsurance","trust","trv","tt","tube","tui","tunes","tushu","tv","tvs","tw","tz","ua","ubank","ubs","uconnect","ug","uk","unicom","university","uno","uol","ups","us","uy","uz","va","vacations","vana","vanguard","vc","ve","vegas","ventures","verisign","versicherung","vet","vg","vi","viajes","video","vig","viking","villas","vin","vip","virgin","visa","vision","vista","vistaprint","viva","vivo","vlaanderen","vn","vodka","volkswagen","volvo","vote","voting","voto","voyage","vu","vuelos","wales","walmart","walter","wang","wanggou","warman","watch","watches","weather","weatherchannel","webcam","weber","website","wed","wedding","weibo","weir","wf","whoswho","wien","wiki","williamhill","win","windows","wine","winners","wme","wolterskluwer","woodside","work","works","world","wow","ws","wtc","wtf","xbox","xerox","xfinity","xihuan","xin","कॉम","セール","佛山","ಭಾರತ","慈善","集团","在线","한국","ଭାରତ","大众汽车","点看","คอม","ভাৰত","ভারত","八卦","موقع","বাংলা","公益","公司","香格里拉","网站","移动","我爱你","москва","қаз","католик","онлайн","сайт","联通","срб","бг","бел","קום","时尚","微博","淡马锡","ファッション","орг","नेट","ストア","삼성","சிங்கப்பூர்","商标","商店","商城","дети","мкд","ею","ポイント","新闻","工行","家電","كوم","中文网","中信","中国","中國","娱乐","谷歌","భారత్","ලංකා","電訊盈科","购物","クラウド","ભારત","通販","भारतम्","भारत","भारोत","网店","संगठन","餐厅","网络","ком","укр","香港","诺基亚","食品","飞利浦","台湾","台灣","手表","手机","мон","الجزائر","عمان","ارامكو","ایران","العليان","اتصالات","امارات","بازار","پاکستان","الاردن","موبايلي","بارت","بھارت","المغرب","ابوظبي","السعودية","ڀارت","كاثوليك","سودان","همراه","عراق","مليسيا","澳門","닷컴","政府","شبكة","بيتك","عرب","გე","机构","组织机构","健康","ไทย","سورية","招聘","рус","рф","珠宝","تونس","大拿","みんな","グーグル","ελ","世界","書籍","ഭാരതം","ਭਾਰਤ","网址","닷넷","コム","天主教","游戏","vermögensberater","vermögensberatung","企业","信息","嘉里大酒店","嘉里","مصر","قطر","广东","இலங்கை","இந்தியா","հայ","新加坡","فلسطين","政务","xperia","xxx","xyz","yachts","yahoo","yamaxun","yandex","ye","yodobashi","yoga","yokohama","you","youtube","yt","yun","za","zappos","zara","zero","zip","zippo","zm","zone","zuerich","zw"]},function(e,t,r){"use strict";function n(){return(0,s.default)(a.lower+a.upper+a.numbers,6)}function o(e){var t=0,r={},o=[];return e.blocks.forEach(function(e){var i=[],a=[];e.entities.forEach(function(n){var o=t++,i=e.value.substr(n.index,n.length);switch(n.type){case"mention":r[o]={type:"mention",mutability:"IMMUTABLE",data:{mention:{link:n.metadata.id,name:i}}};break;default:return}a.push({key:o,offset:n.index,length:n.length})}),e.styles.forEach(function(e){var t=u[e.type];t&&i.push({style:t,offset:e.index,length:e.length})}),o.push({key:n(),type:"text"===e.type?"unstyled":e.type,text:e.value,inlineStyleRanges:i,entityRanges:a,data:{},depth:0})}),{blocks:o,entityMap:r}}t.__esModule=!0;var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},a=r(76),s=function(e){return e&&e.__esModule?e:{default:e}}(a),u=function(){return Object.keys({italic:!0,bold:!0,underline:!0,strikethrough:!0,superscript:!0,subscript:!0}).reduce(function(e,t){var r;return i({},e,(r={},r[t]=t.toUpperCase(),r[t.toUpperCase()]=t,r))},{})}();t.default=o}])});
2
2
  //# sourceMappingURL=pageproof.js.map