@peculiar/certificates-viewer 2.0.0 → 2.0.1
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.
- package/dist/cjs/{download-ccba709e.js → download-cd98aa01.js} +9 -21
- package/dist/cjs/peculiar-attribute-certificate-viewer_9.cjs.entry.js +1 -1
- package/dist/cjs/peculiar-certificates-viewer.cjs.entry.js +1 -1
- package/dist/esm/{download-efafe986.js → download-1ff0a3be.js} +9 -21
- package/dist/esm/peculiar-attribute-certificate-viewer_9.entry.js +1 -1
- package/dist/esm/peculiar-certificates-viewer.entry.js +1 -1
- package/dist/esm-es5/{download-efafe986.js → download-1ff0a3be.js} +9 -21
- package/dist/esm-es5/peculiar-attribute-certificate-viewer_9.entry.js +1 -1
- package/dist/esm-es5/peculiar-certificates-viewer.entry.js +1 -1
- package/dist/peculiar/{p-60e08389.system.entry.js → p-3d339152.system.entry.js} +1 -1
- package/dist/peculiar/p-557d912f.system.js +1 -1
- package/dist/peculiar/{p-b8de1700.entry.js → p-84e8326d.entry.js} +1 -1
- package/dist/peculiar/{p-368352ac.system.js → p-94f96303.system.js} +1 -1
- package/dist/peculiar/{p-e6d55f8a.entry.js → p-dbdd61e7.entry.js} +1 -1
- package/dist/peculiar/{p-63588298.js → p-dc6b70b2.js} +5 -5
- package/dist/peculiar/{p-e652bcd4.system.entry.js → p-fc92385a.system.entry.js} +1 -1
- package/dist/peculiar/peculiar.esm.js +1 -1
- package/package.json +19 -19
|
@@ -34,7 +34,7 @@ var __extends=this&&this.__extends||function(){var e=function(t,r){e=Object.setP
|
|
|
34
34
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
35
35
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
36
36
|
*
|
|
37
|
-
*/function g(){if(typeof BigInt==="undefined"){throw new Error("BigInt is not defined. Your environment doesn't implement BigInt.")}}function S(e){var t=0;var r=0;for(var i=0;i<e.length;i++){var n=e[i];t+=n.byteLength}var o=new Uint8Array(t);for(var i=0;i<e.length;i++){var n=e[i];o.set(new Uint8Array(n),r);r+=n.byteLength}return o.buffer}function m(e,t,r,i){if(!(t instanceof Uint8Array)){e.error="Wrong parameter: inputBuffer must be 'Uint8Array'";return false}if(!t.byteLength){e.error="Wrong parameter: inputBuffer has zero length";return false}if(r<0){e.error="Wrong parameter: inputOffset less than zero";return false}if(i<0){e.error="Wrong parameter: inputLength less than zero";return false}if(t.byteLength-r-i<0){e.error="End of input reached before message was fully decoded (inconsistent offset and length values)";return false}return true}var C=function(){function e(){this.items=[]}e.prototype.write=function(e){this.items.push(e)};e.prototype.final=function(){return S(this.items)};return e}();var A=[new Uint8Array([1])];var b="0123456789";var B="name";var w="valueHexView";var E="isHexOnly";var I="idBlock";var P="tagClass";var D="tagNumber";var k="isConstructed";var x="fromBER";var _="toBER";var O="local";var T="";var N=new ArrayBuffer(0);var R=new Uint8Array(0);var M="EndOfContent";var H="OCTET STRING";var L="BIT STRING";function U(e){var t;return t=function(e){__extends(t,e);function t(){var t=[];for(var r=0;r<arguments.length;r++){t[r]=arguments[r]}var i=this;var n;i=e.apply(this,t)||this;var o=t[0]||{};i.isHexOnly=(n=o.isHexOnly)!==null&&n!==void 0?n:false;i.valueHexView=o.valueHex?s.toUint8Array(o.valueHex):R;return i}Object.defineProperty(t.prototype,"valueHex",{get:function(){return this.valueHexView.slice().buffer},set:function(e){this.valueHexView=new Uint8Array(e)},enumerable:false,configurable:true});t.prototype.fromBER=function(e,t,r){var i=e instanceof ArrayBuffer?new Uint8Array(e):e;if(!m(this,i,t,r)){return-1}var n=t+r;this.valueHexView=i.subarray(t,n);if(!this.valueHexView.length){this.warnings.push("Zero buffer length");return t}this.blockLength=r;return n};t.prototype.toBER=function(e){if(e===void 0){e=false}if(!this.isHexOnly){this.error="Flag 'isHexOnly' is not set, abort";return N}if(e){return new ArrayBuffer(this.valueHexView.byteLength)}return this.valueHexView.byteLength===this.valueHexView.buffer.byteLength?this.valueHexView.buffer:this.valueHexView.slice().buffer};t.prototype.toJSON=function(){return __assign(__assign({},e.prototype.toJSON.call(this)),{isHexOnly:this.isHexOnly,valueHex:u.ToHex(this.valueHexView)})};return t}(e),t.NAME="hexBlock",t}var V=function(){function e(e){var t=e===void 0?{}:e,r=t.blockLength,i=r===void 0?0:r,n=t.error,o=n===void 0?T:n,a=t.warnings,u=a===void 0?[]:a,c=t.valueBeforeDecode,l=c===void 0?R:c;this.blockLength=i;this.error=o;this.warnings=u;this.valueBeforeDecodeView=s.toUint8Array(l)}e.blockName=function(){return this.NAME};Object.defineProperty(e.prototype,"valueBeforeDecode",{get:function(){return this.valueBeforeDecodeView.slice().buffer},set:function(e){this.valueBeforeDecodeView=new Uint8Array(e)},enumerable:false,configurable:true});e.prototype.toJSON=function(){return{blockName:this.constructor.NAME,blockLength:this.blockLength,error:this.error,warnings:this.warnings,valueBeforeDecode:u.ToHex(this.valueBeforeDecodeView)}};return e}();V.NAME="baseBlock";var j=function(e){__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}t.prototype.fromBER=function(e,t,r){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")};t.prototype.toBER=function(e,t){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")};return t}(V);j.NAME="valueBlock";var F=function(e){__extends(t,e);function t(t){var r=(t===void 0?{}:t).idBlock,i=r===void 0?{}:r;var n=this;var o,a,u,c;n=e.call(this)||this;if(i){n.isHexOnly=(o=i.isHexOnly)!==null&&o!==void 0?o:false;n.valueHexView=i.valueHex?s.toUint8Array(i.valueHex):R;n.tagClass=(a=i.tagClass)!==null&&a!==void 0?a:-1;n.tagNumber=(u=i.tagNumber)!==null&&u!==void 0?u:-1;n.isConstructed=(c=i.isConstructed)!==null&&c!==void 0?c:false}else{n.tagClass=-1;n.tagNumber=-1;n.isConstructed=false}return n}t.prototype.toBER=function(e){if(e===void 0){e=false}var t=0;switch(this.tagClass){case 1:t|=0;break;case 2:t|=64;break;case 3:t|=128;break;case 4:t|=192;break;default:this.error="Unknown tag class";return N}if(this.isConstructed)t|=32;if(this.tagNumber<31&&!this.isHexOnly){var r=new Uint8Array(1);if(!e){var i=this.tagNumber;i&=31;t|=i;r[0]=t}return r.buffer}if(!this.isHexOnly){var n=p(this.tagNumber,7);var o=new Uint8Array(n);var a=n.byteLength;var s=new Uint8Array(a+1);s[0]=t|31;if(!e){for(var u=0;u<a-1;u++)s[u+1]=o[u]|128;s[a]=o[a-1]}return s.buffer}var c=new Uint8Array(this.valueHexView.byteLength+1);c[0]=t|31;if(!e){var l=this.valueHexView;for(var u=0;u<l.length-1;u++)c[u+1]=l[u]|128;c[this.valueHexView.byteLength]=l[l.length-1]}return c.buffer};t.prototype.fromBER=function(e,t,r){var i=s.toUint8Array(e);if(!m(this,i,t,r)){return-1}var n=i.subarray(t,t+r);if(n.length===0){this.error="Zero buffer length";return-1}var o=n[0]&192;switch(o){case 0:this.tagClass=1;break;case 64:this.tagClass=2;break;case 128:this.tagClass=3;break;case 192:this.tagClass=4;break;default:this.error="Unknown tag class";return-1}this.isConstructed=(n[0]&32)===32;this.isHexOnly=false;var a=n[0]&31;if(a!==31){this.tagNumber=a;this.blockLength=1}else{var u=1;var c=this.valueHexView=new Uint8Array(255);var p=255;while(n[u]&128){c[u-1]=n[u]&127;u++;if(u>=n.length){this.error="End of input reached before message was fully decoded";return-1}if(u===p){p+=255;var f=new Uint8Array(p);for(var v=0;v<c.length;v++)f[v]=c[v];c=this.valueHexView=new Uint8Array(p)}}this.blockLength=u+1;c[u-1]=n[u]&127;var h=new Uint8Array(u);for(var v=0;v<u;v++)h[v]=c[v];c=this.valueHexView=new Uint8Array(u);c.set(h);if(this.blockLength<=9)this.tagNumber=l(c,7);else{this.isHexOnly=true;this.warnings.push("Tag too long, represented as hex-coded")}}if(this.tagClass===1&&this.isConstructed){switch(this.tagNumber){case 1:case 2:case 5:case 6:case 9:case 13:case 14:case 23:case 24:case 31:case 32:case 33:case 34:this.error="Constructed encoding used for primitive type";return-1}}return t+this.blockLength};t.prototype.toJSON=function(){return __assign(__assign({},e.prototype.toJSON.call(this)),{tagClass:this.tagClass,tagNumber:this.tagNumber,isConstructed:this.isConstructed})};return t}(U(V));F.NAME="identificationBlock";var K=function(e){__extends(t,e);function t(t){var r=(t===void 0?{}:t).lenBlock,i=r===void 0?{}:r;var n=this;var o,a,s;n=e.call(this)||this;n.isIndefiniteForm=(o=i.isIndefiniteForm)!==null&&o!==void 0?o:false;n.longFormUsed=(a=i.longFormUsed)!==null&&a!==void 0?a:false;n.length=(s=i.length)!==null&&s!==void 0?s:0;return n}t.prototype.fromBER=function(e,t,r){var i=s.toUint8Array(e);if(!m(this,i,t,r)){return-1}var n=i.subarray(t,t+r);if(n.length===0){this.error="Zero buffer length";return-1}if(n[0]===255){this.error="Length block 0xFF is reserved by standard";return-1}this.isIndefiniteForm=n[0]===128;if(this.isIndefiniteForm){this.blockLength=1;return t+this.blockLength}this.longFormUsed=!!(n[0]&128);if(this.longFormUsed===false){this.length=n[0];this.blockLength=1;return t+this.blockLength}var o=n[0]&127;if(o>8){this.error="Too big integer";return-1}if(o+1>n.length){this.error="End of input reached before message was fully decoded";return-1}var a=t+1;var u=i.subarray(a,a+o);if(u[o-1]===0)this.warnings.push("Needlessly long encoded length");this.length=l(u,8);if(this.longFormUsed&&this.length<=127)this.warnings.push("Unnecessary usage of long length form");this.blockLength=o+1;return t+this.blockLength};t.prototype.toBER=function(e){if(e===void 0){e=false}var t;var r;if(this.length>127)this.longFormUsed=true;if(this.isIndefiniteForm){t=new ArrayBuffer(1);if(e===false){r=new Uint8Array(t);r[0]=128}return t}if(this.longFormUsed){var i=p(this.length,8);if(i.byteLength>127){this.error="Too big length";return N}t=new ArrayBuffer(i.byteLength+1);if(e)return t;var n=new Uint8Array(i);r=new Uint8Array(t);r[0]=i.byteLength|128;for(var o=0;o<i.byteLength;o++)r[o+1]=n[o];return t}t=new ArrayBuffer(1);if(e===false){r=new Uint8Array(t);r[0]=this.length}return t};t.prototype.toJSON=function(){return __assign(__assign({},e.prototype.toJSON.call(this)),{isIndefiniteForm:this.isIndefiniteForm,longFormUsed:this.longFormUsed,length:this.length})};return t}(V);K.NAME="lengthBlock";var G={};var q=function(e){__extends(t,e);function t(t,r){if(t===void 0){t={}}var i=t.name,n=i===void 0?T:i,o=t.optional,a=o===void 0?false:o,s=t.primitiveSchema,u=__rest(t,["name","optional","primitiveSchema"]);var c=e.call(this,u)||this;c.name=n;c.optional=a;if(s){c.primitiveSchema=s}c.idBlock=new F(u);c.lenBlock=new K(u);c.valueBlock=r?new r(u):new j(u);return c}t.prototype.fromBER=function(e,t,r){var i=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?r:this.lenBlock.length);if(i===-1){this.error=this.valueBlock.error;return i}if(!this.idBlock.error.length)this.blockLength+=this.idBlock.blockLength;if(!this.lenBlock.error.length)this.blockLength+=this.lenBlock.blockLength;if(!this.valueBlock.error.length)this.blockLength+=this.valueBlock.blockLength;return i};t.prototype.toBER=function(e,t){var r=t||new C;if(!t){z(this)}var i=this.idBlock.toBER(e);r.write(i);if(this.lenBlock.isIndefiniteForm){r.write(new Uint8Array([128]).buffer);this.valueBlock.toBER(e,r);r.write(new ArrayBuffer(2))}else{var n=this.valueBlock.toBER(e);this.lenBlock.length=n.byteLength;var o=this.lenBlock.toBER(e);r.write(o);r.write(n)}if(!t){return r.final()}return N};t.prototype.toJSON=function(){var t=__assign(__assign({},e.prototype.toJSON.call(this)),{idBlock:this.idBlock.toJSON(),lenBlock:this.lenBlock.toJSON(),valueBlock:this.valueBlock.toJSON(),name:this.name,optional:this.optional});if(this.primitiveSchema)t.primitiveSchema=this.primitiveSchema.toJSON();return t};t.prototype.toString=function(e){if(e===void 0){e="ascii"}if(e==="ascii"){return this.onAsciiEncoding()}return u.ToHex(this.toBER())};t.prototype.onAsciiEncoding=function(){return this.constructor.NAME+" : "+u.ToHex(this.valueBlock.valueBeforeDecodeView)};t.prototype.isEqual=function(e){if(this===e){return true}if(!(e instanceof this.constructor)){return false}var t=this.toBER();var r=e.toBER();return d(t,r)};return t}(V);q.NAME="BaseBlock";function z(e){if(e instanceof G.Constructed){for(var t=0,r=e.valueBlock.value;t<r.length;t++){var i=r[t];if(z(i)){e.lenBlock.isIndefiniteForm=true}}}return!!e.lenBlock.isIndefiniteForm}var W=function(e){__extends(t,e);function t(t,r){if(t===void 0){t={}}var i=t.value,n=i===void 0?T:i,o=__rest(t,["value"]);var a=e.call(this,o,r)||this;if(n){a.fromString(n)}return a}t.prototype.getValue=function(){return this.valueBlock.value};t.prototype.setValue=function(e){this.valueBlock.value=e};t.prototype.fromBER=function(e,t,r){var i=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?r:this.lenBlock.length);if(i===-1){this.error=this.valueBlock.error;return i}this.fromBuffer(this.valueBlock.valueHexView);if(!this.idBlock.error.length)this.blockLength+=this.idBlock.blockLength;if(!this.lenBlock.error.length)this.blockLength+=this.lenBlock.blockLength;if(!this.valueBlock.error.length)this.blockLength+=this.valueBlock.blockLength;return i};t.prototype.onAsciiEncoding=function(){return this.constructor.NAME+" : '"+this.valueBlock.value+"'"};return t}(q);W.NAME="BaseStringBlock";var Q=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=t.isHexOnly,i=r===void 0?true:r,n=__rest(t,["isHexOnly"]);var o=e.call(this,n)||this;o.isHexOnly=i;return o}return t}(U(j));Q.NAME="PrimitiveValueBlock";var J;var $=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t,Q)||this;r.idBlock.isConstructed=false;return r}return t}(q);J=$;(function(){G.Primitive=J})();$.NAME="PRIMITIVE";function Z(e,t){if(e instanceof t){return e}var r=new t;r.idBlock=e.idBlock;r.lenBlock=e.lenBlock;r.warnings=e.warnings;r.valueBeforeDecodeView=e.valueBeforeDecodeView;return r}function X(e,t,r){if(t===void 0){t=0}if(r===void 0){r=e.length}var i=t;var n=new q({},j);var o=new V;if(!m(o,e,t,r)){n.error=o.error;return{offset:-1,result:n}}var a=e.subarray(t,t+r);if(!a.length){n.error="Zero buffer length";return{offset:-1,result:n}}var s=n.idBlock.fromBER(e,t,r);if(n.idBlock.warnings.length){n.warnings.concat(n.idBlock.warnings)}if(s===-1){n.error=n.idBlock.error;return{offset:-1,result:n}}t=s;r-=n.idBlock.blockLength;s=n.lenBlock.fromBER(e,t,r);if(n.lenBlock.warnings.length){n.warnings.concat(n.lenBlock.warnings)}if(s===-1){n.error=n.lenBlock.error;return{offset:-1,result:n}}t=s;r-=n.lenBlock.blockLength;if(!n.idBlock.isConstructed&&n.lenBlock.isIndefiniteForm){n.error="Indefinite length form used for primitive encoding form";return{offset:-1,result:n}}var u=q;switch(n.idBlock.tagClass){case 1:if(n.idBlock.tagNumber>=37&&n.idBlock.isHexOnly===false){n.error="UNIVERSAL 37 and upper tags are reserved by ASN.1 standard";return{offset:-1,result:n}}switch(n.idBlock.tagNumber){case 0:if(n.idBlock.isConstructed&&n.lenBlock.length>0){n.error="Type [UNIVERSAL 0] is reserved";return{offset:-1,result:n}}u=G.EndOfContent;break;case 1:u=G.Boolean;break;case 2:u=G.Integer;break;case 3:u=G.BitString;break;case 4:u=G.OctetString;break;case 5:u=G.Null;break;case 6:u=G.ObjectIdentifier;break;case 10:u=G.Enumerated;break;case 12:u=G.Utf8String;break;case 13:u=G.RelativeObjectIdentifier;break;case 14:u=G.TIME;break;case 15:n.error="[UNIVERSAL 15] is reserved by ASN.1 standard";return{offset:-1,result:n};case 16:u=G.Sequence;break;case 17:u=G.Set;break;case 18:u=G.NumericString;break;case 19:u=G.PrintableString;break;case 20:u=G.TeletexString;break;case 21:u=G.VideotexString;break;case 22:u=G.IA5String;break;case 23:u=G.UTCTime;break;case 24:u=G.GeneralizedTime;break;case 25:u=G.GraphicString;break;case 26:u=G.VisibleString;break;case 27:u=G.GeneralString;break;case 28:u=G.UniversalString;break;case 29:u=G.CharacterString;break;case 30:u=G.BmpString;break;case 31:u=G.DATE;break;case 32:u=G.TimeOfDay;break;case 33:u=G.DateTime;break;case 34:u=G.Duration;break;default:{var c=n.idBlock.isConstructed?new G.Constructed:new G.Primitive;c.idBlock=n.idBlock;c.lenBlock=n.lenBlock;c.warnings=n.warnings;n=c}}break;case 2:case 3:case 4:default:{u=n.idBlock.isConstructed?G.Constructed:G.Primitive}}n=Z(n,u);s=n.fromBER(e,t,n.lenBlock.isIndefiniteForm?r:n.lenBlock.length);n.valueBeforeDecodeView=e.subarray(i,i+n.blockLength);return{offset:s,result:n}}function Y(e){if(!e.byteLength){var t=new q({},j);t.error="Input buffer has zero length";return{offset:-1,result:t}}return X(s.toUint8Array(e).slice(),0,e.byteLength)}function ee(e,t){if(e){return 1}return t}var te=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=t.value,i=r===void 0?[]:r,n=t.isIndefiniteForm,o=n===void 0?false:n,a=__rest(t,["value","isIndefiniteForm"]);var s=e.call(this,a)||this;s.value=i;s.isIndefiniteForm=o;return s}t.prototype.fromBER=function(e,t,r){var i=s.toUint8Array(e);if(!m(this,i,t,r)){return-1}this.valueBeforeDecodeView=i.subarray(t,t+r);if(this.valueBeforeDecodeView.length===0){this.warnings.push("Zero buffer length");return t}var n=t;while(ee(this.isIndefiniteForm,r)>0){var o=X(i,n,r);if(o.offset===-1){this.error=o.result.error;this.warnings.concat(o.result.warnings);return-1}n=o.offset;this.blockLength+=o.result.blockLength;r-=o.result.blockLength;this.value.push(o.result);if(this.isIndefiniteForm&&o.result.constructor.NAME===M){break}}if(this.isIndefiniteForm){if(this.value[this.value.length-1].constructor.NAME===M){this.value.pop()}else{this.warnings.push("No EndOfContent block encoded")}}return n};t.prototype.toBER=function(e,t){var r=t||new C;for(var i=0;i<this.value.length;i++){this.value[i].toBER(e,r)}if(!t){return r.final()}return N};t.prototype.toJSON=function(){var t=__assign(__assign({},e.prototype.toJSON.call(this)),{isIndefiniteForm:this.isIndefiniteForm,value:[]});for(var r=0,i=this.value;r<i.length;r++){var n=i[r];t.value.push(n.toJSON())}return t};return t}(j);te.NAME="ConstructedValueBlock";var re;var ie=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t,te)||this;r.idBlock.isConstructed=true;return r}t.prototype.fromBER=function(e,t,r){this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm;var i=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?r:this.lenBlock.length);if(i===-1){this.error=this.valueBlock.error;return i}if(!this.idBlock.error.length)this.blockLength+=this.idBlock.blockLength;if(!this.lenBlock.error.length)this.blockLength+=this.lenBlock.blockLength;if(!this.valueBlock.error.length)this.blockLength+=this.valueBlock.blockLength;return i};t.prototype.onAsciiEncoding=function(){var e=[];for(var t=0,r=this.valueBlock.value;t<r.length;t++){var i=r[t];e.push(i.toString("ascii").split("\n").map((function(e){return" "+e})).join("\n"))}var n=this.idBlock.tagClass===3?"["+this.idBlock.tagNumber+"]":this.constructor.NAME;return e.length?n+" :\n"+e.join("\n"):n+" :"};return t}(q);re=ie;(function(){G.Constructed=re})();ie.NAME="CONSTRUCTED";var ne=function(e){__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}t.prototype.fromBER=function(e,t,r){return t};t.prototype.toBER=function(e){return N};return t}(j);ne.override="EndOfContentValueBlock";var oe;var ae=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t,ne)||this;r.idBlock.tagClass=1;r.idBlock.tagNumber=0;return r}return t}(q);oe=ae;(function(){G.EndOfContent=oe})();ae.NAME=M;var se;var ue=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t,j)||this;r.idBlock.tagClass=1;r.idBlock.tagNumber=5;return r}t.prototype.fromBER=function(e,t,r){if(this.lenBlock.length>0)this.warnings.push("Non-zero length of value block for Null type");if(!this.idBlock.error.length)this.blockLength+=this.idBlock.blockLength;if(!this.lenBlock.error.length)this.blockLength+=this.lenBlock.blockLength;this.blockLength+=r;if(t+r>e.byteLength){this.error="End of input reached before message was fully decoded (inconsistent offset and length values)";return-1}return t+r};t.prototype.toBER=function(e,t){var r=new ArrayBuffer(2);if(!e){var i=new Uint8Array(r);i[0]=5;i[1]=0}if(t){t.write(r)}return r};t.prototype.onAsciiEncoding=function(){return""+this.constructor.NAME};return t}(q);se=ue;(function(){G.Null=se})();ue.NAME="NULL";var ce=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=t.value,i=__rest(t,["value"]);var n=e.call(this,i)||this;if(i.valueHex){n.valueHexView=s.toUint8Array(i.valueHex)}else{n.valueHexView=new Uint8Array(1)}if(r){n.value=r}return n}Object.defineProperty(t.prototype,"value",{get:function(){for(var e=0,t=this.valueHexView;e<t.length;e++){var r=t[e];if(r>0){return true}}return false},set:function(e){this.valueHexView[0]=e?255:0},enumerable:false,configurable:true});t.prototype.fromBER=function(e,t,r){var i=s.toUint8Array(e);if(!m(this,i,t,r)){return-1}this.valueHexView=i.subarray(t,t+r);if(r>1)this.warnings.push("Boolean value encoded in more then 1 octet");this.isHexOnly=true;v.call(this);this.blockLength=r;return t+r};t.prototype.toBER=function(){return this.valueHexView.slice()};t.prototype.toJSON=function(){return __assign(__assign({},e.prototype.toJSON.call(this)),{value:this.value})};return t}(U(j));ce.NAME="BooleanValueBlock";var le;var pe=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t,ce)||this;r.idBlock.tagClass=1;r.idBlock.tagNumber=1;return r}t.prototype.getValue=function(){return this.valueBlock.value};t.prototype.setValue=function(e){this.valueBlock.value=e};t.prototype.onAsciiEncoding=function(){return this.constructor.NAME+" : "+this.getValue};return t}(q);le=pe;(function(){G.Boolean=le})();pe.NAME="BOOLEAN";var fe=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=t.isConstructed,i=r===void 0?false:r,n=__rest(t,["isConstructed"]);var o=e.call(this,n)||this;o.isConstructed=i;return o}t.prototype.fromBER=function(t,r,i){var n=0;if(this.isConstructed){this.isHexOnly=false;n=te.prototype.fromBER.call(this,t,r,i);if(n===-1)return n;for(var o=0;o<this.value.length;o++){var a=this.value[o].constructor.NAME;if(a===M){if(this.isIndefiniteForm)break;else{this.error="EndOfContent is unexpected, OCTET STRING may consists of OCTET STRINGs only";return-1}}if(a!==H){this.error="OCTET STRING may consists of OCTET STRINGs only";return-1}}}else{this.isHexOnly=true;n=e.prototype.fromBER.call(this,t,r,i);this.blockLength=i}return n};t.prototype.toBER=function(e,t){if(this.isConstructed)return te.prototype.toBER.call(this,e,t);return e?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.slice().buffer};t.prototype.toJSON=function(){return __assign(__assign({},e.prototype.toJSON.call(this)),{isConstructed:this.isConstructed})};return t}(U(te));fe.NAME="OctetStringValueBlock";var ve;var he=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=t.idBlock,i=r===void 0?{}:r,n=t.lenBlock,o=n===void 0?{}:n,a=__rest(t,["idBlock","lenBlock"]);var s=this;var u,c;(u=a.isConstructed)!==null&&u!==void 0?u:a.isConstructed=!!((c=a.value)===null||c===void 0?void 0:c.length);s=e.call(this,__assign({idBlock:__assign({isConstructed:a.isConstructed},i),lenBlock:__assign(__assign({},o),{isIndefiniteForm:!!a.isIndefiniteForm})},a),fe)||this;s.idBlock.tagClass=1;s.idBlock.tagNumber=4;return s}t.prototype.fromBER=function(t,r,i){this.valueBlock.isConstructed=this.idBlock.isConstructed;this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm;if(i===0){if(this.idBlock.error.length===0)this.blockLength+=this.idBlock.blockLength;if(this.lenBlock.error.length===0)this.blockLength+=this.lenBlock.blockLength;return r}if(!this.valueBlock.isConstructed){var n=t instanceof ArrayBuffer?new Uint8Array(t):t;var o=n.subarray(r,r+i);try{if(o.byteLength){var a=X(o,0,o.byteLength);if(a.offset!==-1&&a.offset===i){this.valueBlock.value=[a.result]}}}catch(s){}}return e.prototype.fromBER.call(this,t,r,i)};t.prototype.onAsciiEncoding=function(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length){return ie.prototype.onAsciiEncoding.call(this)}return this.constructor.NAME+" : "+u.ToHex(this.valueBlock.valueHexView)};t.prototype.getValue=function(){if(!this.idBlock.isConstructed){return this.valueBlock.valueHexView.slice().buffer}var e=[];for(var r=0,i=this.valueBlock.value;r<i.length;r++){var n=i[r];if(n instanceof t){e.push(n.valueBlock.valueHexView)}}return s.concat(e)};return t}(q);ve=he;(function(){G.OctetString=ve})();he.NAME=H;var de=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=t.unusedBits,i=r===void 0?0:r,n=t.isConstructed,o=n===void 0?false:n,a=__rest(t,["unusedBits","isConstructed"]);var s=e.call(this,a)||this;s.unusedBits=i;s.isConstructed=o;s.blockLength=s.valueHexView.byteLength;return s}t.prototype.fromBER=function(e,t,r){if(!r){return t}var i=-1;if(this.isConstructed){i=te.prototype.fromBER.call(this,e,t,r);if(i===-1)return i;for(var n=0,o=this.value;n<o.length;n++){var a=o[n];var u=a.constructor.NAME;if(u===M){if(this.isIndefiniteForm)break;else{this.error="EndOfContent is unexpected, BIT STRING may consists of BIT STRINGs only";return-1}}if(u!==L){this.error="BIT STRING may consists of BIT STRINGs only";return-1}var c=a.valueBlock;if(this.unusedBits>0&&c.unusedBits>0){this.error='Using of "unused bits" inside constructive BIT STRING allowed for least one only';return-1}this.unusedBits=c.unusedBits}return i}var l=s.toUint8Array(e);if(!m(this,l,t,r)){return-1}var p=l.subarray(t,t+r);this.unusedBits=p[0];if(this.unusedBits>7){this.error="Unused bits for BitString must be in range 0-7";return-1}if(!this.unusedBits){var f=p.subarray(1);try{if(f.byteLength){var v=X(f,0,f.byteLength);if(v.offset!==-1&&v.offset===r-1){this.value=[v.result]}}}catch(h){}}this.valueHexView=p.subarray(1);this.blockLength=p.length;return t+r};t.prototype.toBER=function(e,t){if(this.isConstructed){return te.prototype.toBER.call(this,e,t)}if(e){return new ArrayBuffer(this.valueHexView.byteLength+1)}if(!this.valueHexView.byteLength){return N}var r=new Uint8Array(this.valueHexView.length+1);r[0]=this.unusedBits;r.set(this.valueHexView,1);return r.buffer};t.prototype.toJSON=function(){return __assign(__assign({},e.prototype.toJSON.call(this)),{unusedBits:this.unusedBits,isConstructed:this.isConstructed})};return t}(U(te));de.NAME="BitStringValueBlock";var ye;var ge=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=t.idBlock,i=r===void 0?{}:r,n=t.lenBlock,o=n===void 0?{}:n,a=__rest(t,["idBlock","lenBlock"]);var s=this;var u,c;(u=a.isConstructed)!==null&&u!==void 0?u:a.isConstructed=!!((c=a.value)===null||c===void 0?void 0:c.length);s=e.call(this,__assign({idBlock:__assign({isConstructed:a.isConstructed},i),lenBlock:__assign(__assign({},o),{isIndefiniteForm:!!a.isIndefiniteForm})},a),de)||this;s.idBlock.tagClass=1;s.idBlock.tagNumber=3;return s}t.prototype.fromBER=function(t,r,i){this.valueBlock.isConstructed=this.idBlock.isConstructed;this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm;return e.prototype.fromBER.call(this,t,r,i)};t.prototype.onAsciiEncoding=function(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length){return ie.prototype.onAsciiEncoding.call(this)}else{var e=[];var t=this.valueBlock.valueHexView;for(var r=0,i=t;r<i.length;r++){var n=i[r];e.push(n.toString(2).padStart(8,"0"))}var o=e.join("");return this.constructor.NAME+" : "+o.substring(0,o.length-this.valueBlock.unusedBits)}};return t}(q);ye=ge;(function(){G.BitString=ye})();ge.NAME=L;var Se;function me(e,t){var r=new Uint8Array([0]);var i=new Uint8Array(e);var n=new Uint8Array(t);var o=i.slice(0);var a=o.length-1;var s=n.slice(0);var u=s.length-1;var c=0;var l=u<a?a:u;var p=0;for(var v=l;v>=0;v--,p++){switch(true){case p<s.length:c=o[a-p]+s[u-p]+r[0];break;default:c=o[a-p]+r[0]}r[0]=c/10;switch(true){case p>=o.length:o=f(new Uint8Array([c%10]),o);break;default:o[a-p]=c%10}}if(r[0]>0)o=f(r,o);return o}function Ce(e){if(e>=A.length){for(var t=A.length;t<=e;t++){var r=new Uint8Array([0]);var i=A[t-1].slice(0);for(var n=i.length-1;n>=0;n--){var o=new Uint8Array([(i[n]<<1)+r[0]]);r[0]=o[0]/10;i[n]=o[0]%10}if(r[0]>0)i=f(r,i);A.push(i)}}return A[e]}function Ae(e,t){var r=0;var i=new Uint8Array(e);var n=new Uint8Array(t);var o=i.slice(0);var a=o.length-1;var s=n.slice(0);var u=s.length-1;var c;var l=0;for(var p=u;p>=0;p--,l++){c=o[a-l]-s[u-l]-r;switch(true){case c<0:r=1;o[a-l]=c+10;break;default:r=0;o[a-l]=c}}if(r>0){for(var p=a-u+1;p>=0;p--,l++){c=o[a-l]-r;if(c<0){r=1;o[a-l]=c+10}else{r=0;o[a-l]=c;break}}}return o.slice()}var be=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=t.value,i=__rest(t,["value"]);var n=e.call(this,i)||this;n._valueDec=0;if(i.valueHex){n.setValueHex()}if(r!==undefined){n.valueDec=r}return n}t.prototype.setValueHex=function(){if(this.valueHexView.length>=4){this.warnings.push("Too big Integer for decoding, hex only");this.isHexOnly=true;this._valueDec=0}else{this.isHexOnly=false;if(this.valueHexView.length>0){this._valueDec=v.call(this)}}};Object.defineProperty(t.prototype,"valueDec",{get:function(){return this._valueDec},set:function(e){this._valueDec=e;this.isHexOnly=false;this.valueHexView=new Uint8Array(h(e))},enumerable:false,configurable:true});t.prototype.fromDER=function(e,t,r,i){if(i===void 0){i=0}var n=this.fromBER(e,t,r);if(n===-1)return n;var o=this.valueHexView;if(o[0]===0&&(o[1]&128)!==0){this.valueHexView=o.subarray(1)}else{if(i!==0){if(o.length<i){if(i-o.length>1)i=o.length+1;this.valueHexView=o.subarray(i-o.length)}}}return n};t.prototype.toDER=function(e){if(e===void 0){e=false}var t=this.valueHexView;switch(true){case(t[0]&128)!==0:{var r=new Uint8Array(this.valueHexView.length+1);r[0]=0;r.set(t,1);this.valueHexView=r}break;case t[0]===0&&(t[1]&128)===0:{this.valueHexView=this.valueHexView.subarray(1)}break}return this.toBER(e)};t.prototype.fromBER=function(t,r,i){var n=e.prototype.fromBER.call(this,t,r,i);if(n===-1){return n}this.setValueHex();return n};t.prototype.toBER=function(e){return e?new ArrayBuffer(this.valueHexView.length):this.valueHexView.slice().buffer};t.prototype.toJSON=function(){return __assign(__assign({},e.prototype.toJSON.call(this)),{valueDec:this.valueDec})};t.prototype.toString=function(){var e=this.valueHexView.length*8-1;var t=new Uint8Array(this.valueHexView.length*8/3);var r=0;var i;var n=this.valueHexView;var o="";var a=false;for(var s=n.byteLength-1;s>=0;s--){i=n[s];for(var u=0;u<8;u++){if((i&1)===1){switch(r){case e:t=Ae(Ce(r),t);o="-";break;default:t=me(t,Ce(r))}}r++;i>>=1}}for(var u=0;u<t.length;u++){if(t[u])a=true;if(a)o+=b.charAt(t[u])}if(a===false)o+=b.charAt(0);return o};return t}(U(j));Se=be;be.NAME="IntegerValueBlock";(function(){Object.defineProperty(Se.prototype,"valueHex",{set:function(e){this.valueHexView=new Uint8Array(e);this.setValueHex()},get:function(){return this.valueHexView.slice().buffer}})})();var Be;var we=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t,be)||this;r.idBlock.tagClass=1;r.idBlock.tagNumber=2;return r}t.prototype.toBigInt=function(){g();return BigInt(this.valueBlock.toString())};t.fromBigInt=function(e){g();var r=BigInt(e);var i=new C;var n=r.toString(16).replace(/^-/,"");var o=new Uint8Array(u.FromHex(n));if(r<0){var a=new Uint8Array(o.length+(o[0]&128?1:0));a[0]|=128;var c=BigInt("0x"+u.ToHex(a));var l=c+r;var p=s.toUint8Array(u.FromHex(l.toString(16)));p[0]|=128;i.write(p)}else{if(o[0]&128){i.write(new Uint8Array([0]))}i.write(o)}var f=new t({valueHex:i.final()});return f};t.prototype.convertToDER=function(){var e=new t({valueHex:this.valueBlock.valueHexView});e.valueBlock.toDER();return e};t.prototype.convertFromDER=function(){return new t({valueHex:this.valueBlock.valueHexView[0]===0?this.valueBlock.valueHexView.subarray(1):this.valueBlock.valueHexView})};t.prototype.onAsciiEncoding=function(){return this.constructor.NAME+" : "+this.valueBlock.toString()};return t}(q);Be=we;(function(){G.Integer=Be})();we.NAME="INTEGER";var Ee;var Ie=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t)||this;r.idBlock.tagClass=1;r.idBlock.tagNumber=10;return r}return t}(we);Ee=Ie;(function(){G.Enumerated=Ee})();Ie.NAME="ENUMERATED";var Pe=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=t.valueDec,i=r===void 0?-1:r,n=t.isFirstSid,o=n===void 0?false:n,a=__rest(t,["valueDec","isFirstSid"]);var s=e.call(this,a)||this;s.valueDec=i;s.isFirstSid=o;return s}t.prototype.fromBER=function(e,t,r){if(!r){return t}var i=s.toUint8Array(e);if(!m(this,i,t,r)){return-1}var n=i.subarray(t,t+r);this.valueHexView=new Uint8Array(r);for(var o=0;o<r;o++){this.valueHexView[o]=n[o]&127;this.blockLength++;if((n[o]&128)===0)break}var a=new Uint8Array(this.blockLength);for(var o=0;o<this.blockLength;o++){a[o]=this.valueHexView[o]}this.valueHexView=a;if((n[this.blockLength-1]&128)!==0){this.error="End of input reached before message was fully decoded";return-1}if(this.valueHexView[0]===0)this.warnings.push("Needlessly long format of SID encoding");if(this.blockLength<=8)this.valueDec=l(this.valueHexView,7);else{this.isHexOnly=true;this.warnings.push("Too big SID for decoding, hex only")}return t+this.blockLength};Object.defineProperty(t.prototype,"valueBigInt",{set:function(e){g();var t=BigInt(e).toString(2);while(t.length%7){t="0"+t}var r=new Uint8Array(t.length/7);for(var i=0;i<r.length;i++){r[i]=parseInt(t.slice(i*7,i*7+7),2)+(i+1<r.length?128:0)}this.fromBER(r.buffer,0,r.length)},enumerable:false,configurable:true});t.prototype.toBER=function(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);var t=this.valueHexView;var r=new Uint8Array(this.blockLength);for(var i=0;i<this.blockLength-1;i++)r[i]=t[i]|128;r[this.blockLength-1]=t[this.blockLength-1];return r.buffer}var n=p(this.valueDec,7);if(n.byteLength===0){this.error="Error during encoding SID value";return N}var o=new Uint8Array(n.byteLength);if(!e){var a=new Uint8Array(n);var s=n.byteLength-1;for(var i=0;i<s;i++)o[i]=a[i]|128;o[s]=a[s]}return o};t.prototype.toString=function(){var e="";if(this.isHexOnly)e=u.ToHex(this.valueHexView);else{if(this.isFirstSid){var t=this.valueDec;if(this.valueDec<=39)e="0.";else{if(this.valueDec<=79){e="1.";t-=40}else{e="2.";t-=80}}e+=t.toString()}else e=this.valueDec.toString()}return e};t.prototype.toJSON=function(){return __assign(__assign({},e.prototype.toJSON.call(this)),{valueDec:this.valueDec,isFirstSid:this.isFirstSid})};return t}(U(j));Pe.NAME="sidBlock";var De=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=t.value,i=r===void 0?T:r,n=__rest(t,["value"]);var o=e.call(this,n)||this;o.value=[];if(i){o.fromString(i)}return o}t.prototype.fromBER=function(e,t,r){var i=t;while(r>0){var n=new Pe;i=n.fromBER(e,i,r);if(i===-1){this.blockLength=0;this.error=n.error;return i}if(this.value.length===0)n.isFirstSid=true;this.blockLength+=n.blockLength;r-=n.blockLength;this.value.push(n)}return i};t.prototype.toBER=function(e){var t=[];for(var r=0;r<this.value.length;r++){var i=this.value[r].toBER(e);if(i.byteLength===0){this.error=this.value[r].error;return N}t.push(i)}return S(t)};t.prototype.fromString=function(e){this.value=[];var t=0;var r=0;var i="";var n=false;do{r=e.indexOf(".",t);if(r===-1)i=e.substring(t);else i=e.substring(t,r);t=r+1;if(n){var o=this.value[0];var a=0;switch(o.valueDec){case 0:break;case 1:a=40;break;case 2:a=80;break;default:this.value=[];return}var s=parseInt(i,10);if(isNaN(s))return;o.valueDec=s+a;n=false}else{var o=new Pe;if(i>Number.MAX_SAFE_INTEGER){g();var u=BigInt(i);o.valueBigInt=u}else{o.valueDec=parseInt(i,10);if(isNaN(o.valueDec))return}if(!this.value.length){o.isFirstSid=true;n=true}this.value.push(o)}}while(r!==-1)};t.prototype.toString=function(){var e="";var t=false;for(var r=0;r<this.value.length;r++){t=this.value[r].isHexOnly;var i=this.value[r].toString();if(r!==0)e=e+".";if(t){i="{"+i+"}";if(this.value[r].isFirstSid)e="2.{"+i+" - 80}";else e+=i}else e+=i}return e};t.prototype.toJSON=function(){var t=__assign(__assign({},e.prototype.toJSON.call(this)),{value:this.toString(),sidArray:[]});for(var r=0;r<this.value.length;r++){t.sidArray.push(this.value[r].toJSON())}return t};return t}(j);De.NAME="ObjectIdentifierValueBlock";var ke;var xe=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t,De)||this;r.idBlock.tagClass=1;r.idBlock.tagNumber=6;return r}t.prototype.getValue=function(){return this.valueBlock.toString()};t.prototype.setValue=function(e){this.valueBlock.fromString(e)};t.prototype.onAsciiEncoding=function(){return this.constructor.NAME+" : "+(this.valueBlock.toString()||"empty")};t.prototype.toJSON=function(){return __assign(__assign({},e.prototype.toJSON.call(this)),{value:this.getValue()})};return t}(q);ke=xe;(function(){G.ObjectIdentifier=ke})();xe.NAME="OBJECT IDENTIFIER";var _e=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=t.valueDec,i=r===void 0?0:r,n=__rest(t,["valueDec"]);var o=e.call(this,n)||this;o.valueDec=i;return o}t.prototype.fromBER=function(e,t,r){if(r===0)return t;var i=s.toUint8Array(e);if(!m(this,i,t,r))return-1;var n=i.subarray(t,t+r);this.valueHexView=new Uint8Array(r);for(var o=0;o<r;o++){this.valueHexView[o]=n[o]&127;this.blockLength++;if((n[o]&128)===0)break}var a=new Uint8Array(this.blockLength);for(var o=0;o<this.blockLength;o++)a[o]=this.valueHexView[o];this.valueHexView=a;if((n[this.blockLength-1]&128)!==0){this.error="End of input reached before message was fully decoded";return-1}if(this.valueHexView[0]===0)this.warnings.push("Needlessly long format of SID encoding");if(this.blockLength<=8)this.valueDec=l(this.valueHexView,7);else{this.isHexOnly=true;this.warnings.push("Too big SID for decoding, hex only")}return t+this.blockLength};t.prototype.toBER=function(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);var t=this.valueHexView;var r=new Uint8Array(this.blockLength);for(var i=0;i<this.blockLength-1;i++)r[i]=t[i]|128;r[this.blockLength-1]=t[this.blockLength-1];return r.buffer}var n=p(this.valueDec,7);if(n.byteLength===0){this.error="Error during encoding SID value";return N}var o=new Uint8Array(n.byteLength);if(!e){var a=new Uint8Array(n);var s=n.byteLength-1;for(var i=0;i<s;i++)o[i]=a[i]|128;o[s]=a[s]}return o.buffer};t.prototype.toString=function(){var e="";if(this.isHexOnly)e=u.ToHex(this.valueHexView);else{e=this.valueDec.toString()}return e};t.prototype.toJSON=function(){return __assign(__assign({},e.prototype.toJSON.call(this)),{valueDec:this.valueDec})};return t}(U(V));_e.NAME="relativeSidBlock";var Oe=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=t.value,i=r===void 0?T:r,n=__rest(t,["value"]);var o=e.call(this,n)||this;o.value=[];if(i){o.fromString(i)}return o}t.prototype.fromBER=function(e,t,r){var i=t;while(r>0){var n=new _e;i=n.fromBER(e,i,r);if(i===-1){this.blockLength=0;this.error=n.error;return i}this.blockLength+=n.blockLength;r-=n.blockLength;this.value.push(n)}return i};t.prototype.toBER=function(e,t){var r=[];for(var i=0;i<this.value.length;i++){var n=this.value[i].toBER(e);if(n.byteLength===0){this.error=this.value[i].error;return N}r.push(n)}return S(r)};t.prototype.fromString=function(e){this.value=[];var t=0;var r=0;var i="";do{r=e.indexOf(".",t);if(r===-1)i=e.substring(t);else i=e.substring(t,r);t=r+1;var n=new _e;n.valueDec=parseInt(i,10);if(isNaN(n.valueDec))return true;this.value.push(n)}while(r!==-1);return true};t.prototype.toString=function(){var e="";var t=false;for(var r=0;r<this.value.length;r++){t=this.value[r].isHexOnly;var i=this.value[r].toString();if(r!==0)e=e+".";if(t){i="{"+i+"}";e+=i}else e+=i}return e};t.prototype.toJSON=function(){var t=__assign(__assign({},e.prototype.toJSON.call(this)),{value:this.toString(),sidArray:[]});for(var r=0;r<this.value.length;r++)t.sidArray.push(this.value[r].toJSON());return t};return t}(j);Oe.NAME="RelativeObjectIdentifierValueBlock";var Te;var Ne=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t,Oe)||this;r.idBlock.tagClass=1;r.idBlock.tagNumber=13;return r}t.prototype.getValue=function(){return this.valueBlock.toString()};t.prototype.setValue=function(e){this.valueBlock.fromString(e)};t.prototype.onAsciiEncoding=function(){return this.constructor.NAME+" : "+(this.valueBlock.toString()||"empty")};t.prototype.toJSON=function(){return __assign(__assign({},e.prototype.toJSON.call(this)),{value:this.getValue()})};return t}(q);Te=Ne;(function(){G.RelativeObjectIdentifier=Te})();Ne.NAME="RelativeObjectIdentifier";var Re;var Me=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t)||this;r.idBlock.tagClass=1;r.idBlock.tagNumber=16;return r}return t}(ie);Re=Me;(function(){G.Sequence=Re})();Me.NAME="SEQUENCE";var He;var Le=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t)||this;r.idBlock.tagClass=1;r.idBlock.tagNumber=17;return r}return t}(ie);He=Le;(function(){G.Set=He})();Le.NAME="SET";var Ue=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=__rest(t,[]);var i=e.call(this,r)||this;i.isHexOnly=true;i.value=T;return i}t.prototype.toJSON=function(){return __assign(__assign({},e.prototype.toJSON.call(this)),{value:this.value})};return t}(U(j));Ue.NAME="StringValueBlock";var Ve=function(e){__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(Ue);Ve.NAME="SimpleStringValueBlock";var je=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=__rest(t,[]);return e.call(this,r,Ve)||this}t.prototype.fromBuffer=function(e){this.valueBlock.value=String.fromCharCode.apply(null,s.toUint8Array(e))};t.prototype.fromString=function(e){var t=e.length;var r=this.valueBlock.valueHexView=new Uint8Array(t);for(var i=0;i<t;i++)r[i]=e.charCodeAt(i);this.valueBlock.value=e};return t}(W);je.NAME="SIMPLE STRING";var Fe=function(e){__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}t.prototype.fromBuffer=function(e){this.valueBlock.valueHexView=s.toUint8Array(e);try{this.valueBlock.value=u.ToUtf8String(e)}catch(t){this.warnings.push('Error during "decodeURIComponent": '+t+", using raw string");this.valueBlock.value=u.ToBinary(e)}};t.prototype.fromString=function(e){this.valueBlock.valueHexView=new Uint8Array(u.FromUtf8String(e));this.valueBlock.value=e};return t}(je);Fe.NAME="Utf8StringValueBlock";var Ke;var Ge=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t)||this;r.idBlock.tagClass=1;r.idBlock.tagNumber=12;return r}return t}(Fe);Ke=Ge;(function(){G.Utf8String=Ke})();Ge.NAME="UTF8String";var qe=function(e){__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}t.prototype.fromBuffer=function(e){this.valueBlock.value=u.ToUtf16String(e);this.valueBlock.valueHexView=s.toUint8Array(e)};t.prototype.fromString=function(e){this.valueBlock.value=e;this.valueBlock.valueHexView=new Uint8Array(u.FromUtf16String(e))};return t}(je);qe.NAME="BmpStringValueBlock";var ze;var We=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=__rest(t,[]);var i=e.call(this,r)||this;i.idBlock.tagClass=1;i.idBlock.tagNumber=30;return i}return t}(qe);ze=We;(function(){G.BmpString=ze})();We.NAME="BMPString";var Qe=function(e){__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}t.prototype.fromBuffer=function(e){var t=ArrayBuffer.isView(e)?e.slice().buffer:e.slice(0);var r=new Uint8Array(t);for(var i=0;i<r.length;i+=4){r[i]=r[i+3];r[i+1]=r[i+2];r[i+2]=0;r[i+3]=0}this.valueBlock.value=String.fromCharCode.apply(null,new Uint32Array(t))};t.prototype.fromString=function(e){var t=e.length;var r=this.valueBlock.valueHexView=new Uint8Array(t*4);for(var i=0;i<t;i++){var n=p(e.charCodeAt(i),8);var o=new Uint8Array(n);if(o.length>4)continue;var a=4-o.length;for(var s=o.length-1;s>=0;s--)r[i*4+s+a]=o[s]}this.valueBlock.value=e};return t}(je);Qe.NAME="UniversalStringValueBlock";var Je;var $e=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=__rest(t,[]);var i=e.call(this,r)||this;i.idBlock.tagClass=1;i.idBlock.tagNumber=28;return i}return t}(Qe);Je=$e;(function(){G.UniversalString=Je})();$e.NAME="UniversalString";var Ze;var Xe=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t)||this;r.idBlock.tagClass=1;r.idBlock.tagNumber=18;return r}return t}(je);Ze=Xe;(function(){G.NumericString=Ze})();Xe.NAME="NumericString";var Ye;var et=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t)||this;r.idBlock.tagClass=1;r.idBlock.tagNumber=19;return r}return t}(je);Ye=et;(function(){G.PrintableString=Ye})();et.NAME="PrintableString";var tt;var rt=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t)||this;r.idBlock.tagClass=1;r.idBlock.tagNumber=20;return r}return t}(je);tt=rt;(function(){G.TeletexString=tt})();rt.NAME="TeletexString";var it;var nt=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t)||this;r.idBlock.tagClass=1;r.idBlock.tagNumber=21;return r}return t}(je);it=nt;(function(){G.VideotexString=it})();nt.NAME="VideotexString";var ot;var at=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t)||this;r.idBlock.tagClass=1;r.idBlock.tagNumber=22;return r}return t}(je);ot=at;(function(){G.IA5String=ot})();at.NAME="IA5String";var st;var ut=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t)||this;r.idBlock.tagClass=1;r.idBlock.tagNumber=25;return r}return t}(je);st=ut;(function(){G.GraphicString=st})();ut.NAME="GraphicString";var ct;var lt=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t)||this;r.idBlock.tagClass=1;r.idBlock.tagNumber=26;return r}return t}(je);ct=lt;(function(){G.VisibleString=ct})();lt.NAME="VisibleString";var pt;var ft=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t)||this;r.idBlock.tagClass=1;r.idBlock.tagNumber=27;return r}return t}(je);pt=ft;(function(){G.GeneralString=pt})();ft.NAME="GeneralString";var vt;var ht=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t)||this;r.idBlock.tagClass=1;r.idBlock.tagNumber=29;return r}return t}(je);vt=ht;(function(){G.CharacterString=vt})();ht.NAME="CharacterString";var dt;var yt=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=t.value,i=t.valueDate,n=__rest(t,["value","valueDate"]);var o=e.call(this,n)||this;o.year=0;o.month=0;o.day=0;o.hour=0;o.minute=0;o.second=0;if(r){o.fromString(r);o.valueBlock.valueHexView=new Uint8Array(r.length);for(var a=0;a<r.length;a++)o.valueBlock.valueHexView[a]=r.charCodeAt(a)}if(i){o.fromDate(i);o.valueBlock.valueHexView=new Uint8Array(o.toBuffer())}o.idBlock.tagClass=1;o.idBlock.tagNumber=23;return o}t.prototype.fromBuffer=function(e){this.fromString(String.fromCharCode.apply(null,s.toUint8Array(e)))};t.prototype.toBuffer=function(){var e=this.toString();var t=new ArrayBuffer(e.length);var r=new Uint8Array(t);for(var i=0;i<e.length;i++)r[i]=e.charCodeAt(i);return t};t.prototype.fromDate=function(e){this.year=e.getUTCFullYear();this.month=e.getUTCMonth()+1;this.day=e.getUTCDate();this.hour=e.getUTCHours();this.minute=e.getUTCMinutes();this.second=e.getUTCSeconds()};t.prototype.toDate=function(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second))};t.prototype.fromString=function(e){var t=/(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})Z/gi;var r=t.exec(e);if(r===null){this.error="Wrong input string for conversion";return}var i=parseInt(r[1],10);if(i>=50)this.year=1900+i;else this.year=2e3+i;this.month=parseInt(r[2],10);this.day=parseInt(r[3],10);this.hour=parseInt(r[4],10);this.minute=parseInt(r[5],10);this.second=parseInt(r[6],10)};t.prototype.toString=function(t){if(t===void 0){t="iso"}if(t==="iso"){var r=new Array(7);r[0]=y(this.year<2e3?this.year-1900:this.year-2e3,2);r[1]=y(this.month,2);r[2]=y(this.day,2);r[3]=y(this.hour,2);r[4]=y(this.minute,2);r[5]=y(this.second,2);r[6]="Z";return r.join("")}return e.prototype.toString.call(this,t)};t.prototype.onAsciiEncoding=function(){return this.constructor.NAME+" : "+this.toDate().toISOString()};t.prototype.toJSON=function(){return __assign(__assign({},e.prototype.toJSON.call(this)),{year:this.year,month:this.month,day:this.day,hour:this.hour,minute:this.minute,second:this.second})};return t}(lt);dt=yt;(function(){G.UTCTime=dt})();yt.NAME="UTCTime";var gt;var St=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=this;var i;r=e.call(this,t)||this;(i=r.millisecond)!==null&&i!==void 0?i:r.millisecond=0;r.idBlock.tagClass=1;r.idBlock.tagNumber=24;return r}t.prototype.fromDate=function(t){e.prototype.fromDate.call(this,t);this.millisecond=t.getUTCMilliseconds()};t.prototype.toDate=function(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second,this.millisecond))};t.prototype.fromString=function(e){var t=false;var r="";var i="";var n=0;var o;var a=0;var s=0;if(e[e.length-1]==="Z"){r=e.substring(0,e.length-1);t=true}else{var u=new Number(e[e.length-1]);if(isNaN(u.valueOf()))throw new Error("Wrong input string for conversion");r=e}if(t){if(r.indexOf("+")!==-1)throw new Error("Wrong input string for conversion");if(r.indexOf("-")!==-1)throw new Error("Wrong input string for conversion")}else{var c=1;var l=r.indexOf("+");var p="";if(l===-1){l=r.indexOf("-");c=-1}if(l!==-1){p=r.substring(l+1);r=r.substring(0,l);if(p.length!==2&&p.length!==4)throw new Error("Wrong input string for conversion");var u=parseInt(p.substring(0,2),10);if(isNaN(u.valueOf()))throw new Error("Wrong input string for conversion");a=c*u;if(p.length===4){u=parseInt(p.substring(2,4),10);if(isNaN(u.valueOf()))throw new Error("Wrong input string for conversion");s=c*u}}}var f=r.indexOf(".");if(f===-1)f=r.indexOf(",");if(f!==-1){var v=new Number("0"+r.substring(f));if(isNaN(v.valueOf()))throw new Error("Wrong input string for conversion");n=v.valueOf();i=r.substring(0,f)}else i=r;switch(true){case i.length===8:o=/(\d{4})(\d{2})(\d{2})/gi;if(f!==-1)throw new Error("Wrong input string for conversion");break;case i.length===10:o=/(\d{4})(\d{2})(\d{2})(\d{2})/gi;if(f!==-1){var h=60*n;this.minute=Math.floor(h);h=60*(h-this.minute);this.second=Math.floor(h);h=1e3*(h-this.second);this.millisecond=Math.floor(h)}break;case i.length===12:o=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/gi;if(f!==-1){var h=60*n;this.second=Math.floor(h);h=1e3*(h-this.second);this.millisecond=Math.floor(h)}break;case i.length===14:o=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/gi;if(f!==-1){var h=1e3*n;this.millisecond=Math.floor(h)}break;default:throw new Error("Wrong input string for conversion")}var d=o.exec(i);if(d===null)throw new Error("Wrong input string for conversion");for(var y=1;y<d.length;y++){switch(y){case 1:this.year=parseInt(d[y],10);break;case 2:this.month=parseInt(d[y],10);break;case 3:this.day=parseInt(d[y],10);break;case 4:this.hour=parseInt(d[y],10)+a;break;case 5:this.minute=parseInt(d[y],10)+s;break;case 6:this.second=parseInt(d[y],10);break;default:throw new Error("Wrong input string for conversion")}}if(t===false){var g=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond);this.year=g.getUTCFullYear();this.month=g.getUTCMonth();this.day=g.getUTCDay();this.hour=g.getUTCHours();this.minute=g.getUTCMinutes();this.second=g.getUTCSeconds();this.millisecond=g.getUTCMilliseconds()}};t.prototype.toString=function(t){if(t===void 0){t="iso"}if(t==="iso"){var r=[];r.push(y(this.year,4));r.push(y(this.month,2));r.push(y(this.day,2));r.push(y(this.hour,2));r.push(y(this.minute,2));r.push(y(this.second,2));if(this.millisecond!==0){r.push(".");r.push(y(this.millisecond,3))}r.push("Z");return r.join("")}return e.prototype.toString.call(this,t)};t.prototype.toJSON=function(){return __assign(__assign({},e.prototype.toJSON.call(this)),{millisecond:this.millisecond})};return t}(yt);gt=St;(function(){G.GeneralizedTime=gt})();St.NAME="GeneralizedTime";var mt;var Ct=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t)||this;r.idBlock.tagClass=1;r.idBlock.tagNumber=31;return r}return t}(Ge);mt=Ct;(function(){G.DATE=mt})();Ct.NAME="DATE";var At;var bt=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t)||this;r.idBlock.tagClass=1;r.idBlock.tagNumber=32;return r}return t}(Ge);At=bt;(function(){G.TimeOfDay=At})();bt.NAME="TimeOfDay";var Bt;var wt=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t)||this;r.idBlock.tagClass=1;r.idBlock.tagNumber=33;return r}return t}(Ge);Bt=wt;(function(){G.DateTime=Bt})();wt.NAME="DateTime";var Et;var It=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t)||this;r.idBlock.tagClass=1;r.idBlock.tagNumber=34;return r}return t}(Ge);Et=It;(function(){G.Duration=Et})();It.NAME="Duration";var Pt;var Dt=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t)||this;r.idBlock.tagClass=1;r.idBlock.tagNumber=14;return r}return t}(Ge);Pt=Dt;(function(){G.TIME=Pt})();Dt.NAME="TIME";var kt=function(){function e(e){var t=e===void 0?{}:e,r=t.name,i=r===void 0?T:r,n=t.optional,o=n===void 0?false:n;this.name=i;this.optional=o}return e}();var xt=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=t.value,i=r===void 0?[]:r,n=__rest(t,["value"]);var o=e.call(this,n)||this;o.value=i;return o}return t}(kt);var _t=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=t.value,i=r===void 0?new kt:r,n=t.local,o=n===void 0?false:n,a=__rest(t,["value","local"]);var s=e.call(this,a)||this;s.value=i;s.local=o;return s}return t}(kt);var Ot=function(){function e(e){var t=(e===void 0?{}:e).data,r=t===void 0?R:t;this.dataView=s.toUint8Array(r)}Object.defineProperty(e.prototype,"data",{get:function(){return this.dataView.slice().buffer},set:function(e){this.dataView=s.toUint8Array(e)},enumerable:false,configurable:true});e.prototype.fromBER=function(e,t,r){var i=t+r;this.dataView=s.toUint8Array(e).subarray(t,i);return i};e.prototype.toBER=function(e){return this.dataView.slice().buffer};return e}();function Tt(e,t,r){if(r instanceof xt){for(var i=0;i<r.value.length;i++){var n=Tt(e,t,r.value[i]);if(n.verified){return{verified:true,result:e}}}{var o={verified:false,result:{error:"Wrong values for Choice type"}};if(r.hasOwnProperty(B))o.name=r.name;return o}}if(r instanceof kt){if(r.hasOwnProperty(B))e[r.name]=t;return{verified:true,result:e}}if(e instanceof Object===false){return{verified:false,result:{error:"Wrong root object"}}}if(t instanceof Object===false){return{verified:false,result:{error:"Wrong ASN.1 data"}}}if(r instanceof Object===false){return{verified:false,result:{error:"Wrong ASN.1 schema"}}}if(I in r===false){return{verified:false,result:{error:"Wrong ASN.1 schema"}}}if(x in r.idBlock===false){return{verified:false,result:{error:"Wrong ASN.1 schema"}}}if(_ in r.idBlock===false){return{verified:false,result:{error:"Wrong ASN.1 schema"}}}var a=r.idBlock.toBER(false);if(a.byteLength===0){return{verified:false,result:{error:"Error encoding idBlock for ASN.1 schema"}}}var s=r.idBlock.fromBER(a,0,a.byteLength);if(s===-1){return{verified:false,result:{error:"Error decoding idBlock for ASN.1 schema"}}}if(r.idBlock.hasOwnProperty(P)===false){return{verified:false,result:{error:"Wrong ASN.1 schema"}}}if(r.idBlock.tagClass!==t.idBlock.tagClass){return{verified:false,result:e}}if(r.idBlock.hasOwnProperty(D)===false){return{verified:false,result:{error:"Wrong ASN.1 schema"}}}if(r.idBlock.tagNumber!==t.idBlock.tagNumber){return{verified:false,result:e}}if(r.idBlock.hasOwnProperty(k)===false){return{verified:false,result:{error:"Wrong ASN.1 schema"}}}if(r.idBlock.isConstructed!==t.idBlock.isConstructed){return{verified:false,result:e}}if(!(E in r.idBlock)){return{verified:false,result:{error:"Wrong ASN.1 schema"}}}if(r.idBlock.isHexOnly!==t.idBlock.isHexOnly){return{verified:false,result:e}}if(r.idBlock.isHexOnly){if(w in r.idBlock===false){return{verified:false,result:{error:"Wrong ASN.1 schema"}}}var u=r.idBlock.valueHexView;var c=t.idBlock.valueHexView;if(u.length!==c.length){return{verified:false,result:e}}for(var l=0;l<u.length;l++){if(u[l]!==c[1]){return{verified:false,result:e}}}}if(r.name){r.name=r.name.replace(/^\s+|\s+$/g,T);if(r.name)e[r.name]=t}if(r instanceof G.Constructed){var p=0;var n={verified:false,result:{error:"Unknown error"}};var f=r.valueBlock.value.length;if(f>0){if(r.valueBlock.value[0]instanceof _t){f=t.valueBlock.value.length}}if(f===0){return{verified:true,result:e}}if(t.valueBlock.value.length===0&&r.valueBlock.value.length!==0){var v=true;for(var l=0;l<r.valueBlock.value.length;l++)v=v&&(r.valueBlock.value[l].optional||false);if(v){return{verified:true,result:e}}if(r.name){r.name=r.name.replace(/^\s+|\s+$/g,T);if(r.name)delete e[r.name]}e.error="Inconsistent object length";return{verified:false,result:e}}for(var l=0;l<f;l++){if(l-p>=t.valueBlock.value.length){if(r.valueBlock.value[l].optional===false){var o={verified:false,result:e};e.error="Inconsistent length between ASN.1 data and schema";if(r.name){r.name=r.name.replace(/^\s+|\s+$/g,T);if(r.name){delete e[r.name];o.name=r.name}}return o}}else{if(r.valueBlock.value[0]instanceof _t){n=Tt(e,t.valueBlock.value[l],r.valueBlock.value[0].value);if(n.verified===false){if(r.valueBlock.value[0].optional)p++;else{if(r.name){r.name=r.name.replace(/^\s+|\s+$/g,T);if(r.name)delete e[r.name]}return n}}if(B in r.valueBlock.value[0]&&r.valueBlock.value[0].name.length>0){var h={};if(O in r.valueBlock.value[0]&&r.valueBlock.value[0].local)h=t;else h=e;if(typeof h[r.valueBlock.value[0].name]==="undefined")h[r.valueBlock.value[0].name]=[];h[r.valueBlock.value[0].name].push(t.valueBlock.value[l])}}else{n=Tt(e,t.valueBlock.value[l-p],r.valueBlock.value[l]);if(n.verified===false){if(r.valueBlock.value[l].optional)p++;else{if(r.name){r.name=r.name.replace(/^\s+|\s+$/g,T);if(r.name)delete e[r.name]}return n}}}}}if(n.verified===false){var o={verified:false,result:e};if(r.name){r.name=r.name.replace(/^\s+|\s+$/g,T);if(r.name){delete e[r.name];o.name=r.name}}return o}return{verified:true,result:e}}if(r.primitiveSchema&&w in t.valueBlock){var d=X(t.valueBlock.valueHexView);if(d.offset===-1){var o={verified:false,result:d.result};if(r.name){r.name=r.name.replace(/^\s+|\s+$/g,T);if(r.name){delete e[r.name];o.name=r.name}}return o}return Tt(e,d.result,r.primitiveSchema)}return{verified:true,result:e}}function Nt(e,t){if(t instanceof Object===false){return{verified:false,result:{error:"Wrong ASN.1 schema type"}}}var r=X(s.toUint8Array(e));if(r.offset===-1){return{verified:false,result:r.result}}return Tt(r.result,r.result,t)}var Rt=Object.freeze({__proto__:null,Any:kt,BaseBlock:q,BaseStringBlock:W,BitString:ge,BmpString:We,Boolean:pe,CharacterString:ht,Choice:xt,Constructed:ie,DATE:Ct,DateTime:wt,Duration:It,EndOfContent:ae,Enumerated:Ie,GeneralString:ft,GeneralizedTime:St,GraphicString:ut,HexBlock:U,IA5String:at,Integer:we,Null:ue,NumericString:Xe,ObjectIdentifier:xe,OctetString:he,Primitive:$,PrintableString:et,RawData:Ot,RelativeObjectIdentifier:Ne,Repeated:_t,Sequence:Me,Set:Le,TIME:Dt,TeletexString:rt,TimeOfDay:bt,UTCTime:yt,UniversalString:$e,Utf8String:Ge,ValueBlock:j,VideotexString:nt,ViewWriter:C,VisibleString:lt,compareSchema:Tt,fromBER:Y,verifySchema:Nt});var Mt;(function(e){e[e["Sequence"]=0]="Sequence";e[e["Set"]=1]="Set";e[e["Choice"]=2]="Choice"})(Mt||(Mt={}));var Ht;(function(e){e[e["Any"]=1]="Any";e[e["Boolean"]=2]="Boolean";e[e["OctetString"]=3]="OctetString";e[e["BitString"]=4]="BitString";e[e["Integer"]=5]="Integer";e[e["Enumerated"]=6]="Enumerated";e[e["ObjectIdentifier"]=7]="ObjectIdentifier";e[e["Utf8String"]=8]="Utf8String";e[e["BmpString"]=9]="BmpString";e[e["UniversalString"]=10]="UniversalString";e[e["NumericString"]=11]="NumericString";e[e["PrintableString"]=12]="PrintableString";e[e["TeletexString"]=13]="TeletexString";e[e["VideotexString"]=14]="VideotexString";e[e["IA5String"]=15]="IA5String";e[e["GraphicString"]=16]="GraphicString";e[e["VisibleString"]=17]="VisibleString";e[e["GeneralString"]=18]="GeneralString";e[e["CharacterString"]=19]="CharacterString";e[e["UTCTime"]=20]="UTCTime";e[e["GeneralizedTime"]=21]="GeneralizedTime";e[e["DATE"]=22]="DATE";e[e["TimeOfDay"]=23]="TimeOfDay";e[e["DateTime"]=24]="DateTime";e[e["Duration"]=25]="Duration";e[e["TIME"]=26]="TIME";e[e["Null"]=27]="Null"})(Ht||(Ht={}));var Lt={fromASN:function(e){return e instanceof ue?null:e.valueBeforeDecode},toASN:function(e){if(e===null){return new ue}var t=Y(e);if(t.result.error){throw new Error(t.result.error)}return t.result}};var Ut={fromASN:function(e){return e.valueBlock.valueHex.byteLength>4?e.valueBlock.toString():e.valueBlock.valueDec},toASN:function(e){return new we({value:e})}};var Vt={fromASN:function(e){return e.valueBlock.valueDec},toASN:function(e){return new Ie({value:e})}};var jt=e("S",{fromASN:function(e){return e.valueBlock.valueHex},toASN:function(e){return new we({valueHex:e})}});var Ft={fromASN:function(e){return e.valueBlock.valueHex},toASN:function(e){return new ge({valueHex:e})}};var Kt={fromASN:function(e){return e.valueBlock.toString()},toASN:function(e){return new xe({value:e})}};var Gt={fromASN:function(e){return e.valueBlock.value},toASN:function(e){return new pe({value:e})}};var qt={fromASN:function(e){return e.valueBlock.valueHex},toASN:function(e){return new he({valueHex:e})}};function zt(e){return{fromASN:function(e){return e.valueBlock.value},toASN:function(t){return new e({value:t})}}}var Wt=zt(Ge);var Qt=zt(We);var Jt=zt($e);var $t=zt(Xe);var Zt=zt(et);var Xt=zt(rt);var Yt=zt(nt);var er=zt(at);var tr=zt(ut);var rr=zt(lt);var ir=zt(ft);var nr=zt(ht);var or={fromASN:function(e){return e.toDate()},toASN:function(e){return new yt({valueDate:e})}};var ar={fromASN:function(e){return e.toDate()},toASN:function(e){return new St({valueDate:e})}};var sr={fromASN:function(e){return null},toASN:function(e){return new ue}};function ur(e){switch(e){case Ht.Any:return Lt;case Ht.BitString:return Ft;case Ht.BmpString:return Qt;case Ht.Boolean:return Gt;case Ht.CharacterString:return nr;case Ht.Enumerated:return Vt;case Ht.GeneralString:return ir;case Ht.GeneralizedTime:return ar;case Ht.GraphicString:return tr;case Ht.IA5String:return er;case Ht.Integer:return Ut;case Ht.Null:return sr;case Ht.NumericString:return $t;case Ht.ObjectIdentifier:return Kt;case Ht.OctetString:return qt;case Ht.PrintableString:return Zt;case Ht.TeletexString:return Xt;case Ht.UTCTime:return or;case Ht.UniversalString:return Jt;case Ht.Utf8String:return Wt;case Ht.VideotexString:return Yt;case Ht.VisibleString:return rr;default:return null}}var cr=function(){function e(e,t){if(t===void 0){t=0}this.unusedBits=0;this.value=new ArrayBuffer(0);if(e){if(typeof e==="number"){this.fromNumber(e)}else if(s.isBufferSource(e)){this.unusedBits=t;this.value=s.toArrayBuffer(e)}else{throw TypeError("Unsupported type of 'params' argument for BitString")}}}e.prototype.fromASN=function(e){if(!(e instanceof ge)){throw new TypeError("Argument 'asn' is not instance of ASN.1 BitString")}this.unusedBits=e.valueBlock.unusedBits;this.value=e.valueBlock.valueHex;return this};e.prototype.toASN=function(){return new ge({unusedBits:this.unusedBits,valueHex:this.value})};e.prototype.toSchema=function(e){return new ge({name:e})};e.prototype.toNumber=function(){var e="";var t=new Uint8Array(this.value);for(var r=0,i=t;r<i.length;r++){var n=i[r];e+=n.toString(2).padStart(8,"0")}e=e.split("").reverse().join("");if(this.unusedBits){e=e.slice(this.unusedBits).padStart(this.unusedBits,"0")}return parseInt(e,2)};e.prototype.fromNumber=function(e){var t=e.toString(2);var r=t.length+7>>3;this.unusedBits=(r<<3)-t.length;var i=new Uint8Array(r);t=t.padStart(r<<3,"0").split("").reverse().join("");var n=0;while(n<r){i[n]=parseInt(t.slice(n<<3,(n<<3)+8),2);n++}this.value=i.buffer};return e}();var lr=function(){function e(e){if(typeof e==="number"){this.buffer=new ArrayBuffer(e)}else{if(s.isBufferSource(e)){this.buffer=s.toArrayBuffer(e)}else if(Array.isArray(e)){this.buffer=new Uint8Array(e)}else{this.buffer=new ArrayBuffer(0)}}}Object.defineProperty(e.prototype,"byteLength",{get:function(){return this.buffer.byteLength},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"byteOffset",{get:function(){return 0},enumerable:false,configurable:true});e.prototype.fromASN=function(e){if(!(e instanceof he)){throw new TypeError("Argument 'asn' is not instance of ASN.1 OctetString")}this.buffer=e.valueBlock.valueHex;return this};e.prototype.toASN=function(){return new he({valueHex:this.buffer})};e.prototype.toSchema=function(e){return new he({name:e})};return e}();function pr(e){if(e&&e.prototype){if(e.prototype.toASN&&e.prototype.fromASN){return true}else{return pr(e.prototype)}}else{return!!(e&&e.toASN&&e.fromASN)}}function fr(e){var t;if(e){var r=Object.getPrototypeOf(e);if(((t=r===null||r===void 0?void 0:r.prototype)===null||t===void 0?void 0:t.constructor)===Array){return true}return fr(r)}return false}function vr(e,t){if(!(e&&t)){return false}if(e.byteLength!==t.byteLength){return false}var r=new Uint8Array(e);var i=new Uint8Array(t);for(var n=0;n<e.byteLength;n++){if(r[n]!==i[n]){return false}}return true}var hr=function(){function e(){this.items=new WeakMap}e.prototype.has=function(e){return this.items.has(e)};e.prototype.get=function(e){var t,r,i;var n=this.items.get(e);if(!n){throw new Error("Cannot get schema for '"+((i=(r=(t=e===null||e===void 0?void 0:e.prototype)===null||t===void 0?void 0:t.constructor)===null||r===void 0?void 0:r.name)!==null&&i!==void 0?i:e)+"' target")}return n};e.prototype.cache=function(e){var t=this.get(e);if(!t.schema){t.schema=this.create(e,true)}};e.prototype.createDefault=function(e){var t={type:Mt.Sequence,items:{}};var r=this.findParentSchema(e);if(r){Object.assign(t,r);t.items=Object.assign({},t.items,r.items)}return t};e.prototype.create=function(e,t){var r=this.items.get(e)||this.createDefault(e);var i=[];for(var n in r.items){var o=r.items[n];var a=t?n:"";var s=void 0;if(typeof o.type==="number"){var u=Ht[o.type];var c=Rt[u];if(!c){throw new Error("Cannot get ASN1 class by name '"+u+"'")}s=new c({name:a})}else if(pr(o.type)){var l=new o.type;s=l.toSchema(a)}else if(o.optional){var p=this.get(o.type);if(p.type===Mt.Choice){s=new kt({name:a})}else{s=this.create(o.type,false);s.name=a}}else{s=new kt({name:a})}var f=!!o.optional||o.defaultValue!==undefined;if(o.repeated){s.name="";var v=o.repeated==="set"?Le:Me;s=new v({name:"",value:[new _t({name:a,value:s})]})}if(o.context!==null&&o.context!==undefined){if(o.implicit){if(typeof o.type==="number"||pr(o.type)){var v=o.repeated?ie:$;i.push(new v({name:a,optional:f,idBlock:{tagClass:3,tagNumber:o.context}}))}else{this.cache(o.type);var h=!!o.repeated;var d=!h?this.get(o.type).schema:s;d=d.valueBlock?d.valueBlock.value:d.value;i.push(new ie({name:!h?a:"",optional:f,idBlock:{tagClass:3,tagNumber:o.context},value:d}))}}else{i.push(new ie({optional:f,idBlock:{tagClass:3,tagNumber:o.context},value:[s]}))}}else{s.optional=f;i.push(s)}}switch(r.type){case Mt.Sequence:return new Me({value:i,name:""});case Mt.Set:return new Le({value:i,name:""});case Mt.Choice:return new xt({value:i,name:""});default:throw new Error("Unsupported ASN1 type in use")}};e.prototype.set=function(e,t){this.items.set(e,t);return this};e.prototype.findParentSchema=function(e){var t=e.__proto__;if(t){var r=this.items.get(t);return r||this.findParentSchema(t)}return null};return e}();var dr=new hr;var yr=function(e){return function(t){var r;if(!dr.has(t)){r=dr.createDefault(t);dr.set(t,r)}else{r=dr.get(t)}Object.assign(r,e)}};var gr=function(e){return function(t,r){var i;if(!dr.has(t.constructor)){i=dr.createDefault(t.constructor);dr.set(t.constructor,i)}else{i=dr.get(t.constructor)}var n=Object.assign({},e);if(typeof n.type==="number"&&!n.converter){var o=ur(e.type);if(!o){throw new Error("Cannot get default converter for property '"+r+"' of "+t.constructor.name)}n.converter=o}i.items[r]=n}};var Sr=function(e){__extends(t,e);function t(){var t=e.apply(this,arguments)||this;t.schemas=[];return t}return t}(Error);var mr=function(){function e(){}e.parse=function(e,t){var r;if(e instanceof ArrayBuffer){r=e}else if(typeof Buffer!=="undefined"&&Buffer.isBuffer(e)){r=new Uint8Array(e).buffer}else if(ArrayBuffer.isView(e)||e.buffer instanceof ArrayBuffer){r=e.buffer}else{throw new TypeError("Wrong type of 'data' argument")}var i=Y(r);if(i.result.error){throw new Error(i.result.error)}var n=this.fromASN(i.result,t);return n};e.fromASN=function(e,t){var r=this;var i;try{if(pr(t)){var n=new t;return n.fromASN(e)}var o=dr.get(t);dr.cache(t);var a=o.schema;if(e.constructor===ie&&o.type!==Mt.Choice){a=new ie({idBlock:{tagClass:3,tagNumber:e.idBlock.tagNumber},value:o.schema.valueBlock.value});for(var s in o.items){delete e[s]}}var u=Tt(e,e,a);if(!u.verified){throw new Sr("Data does not match to "+t.name+" ASN1 schema. "+u.result.error)}var c=new t;if(fr(t)){if(typeof o.itemType==="number"){var l=ur(o.itemType);if(!l){throw new Error("Cannot get default converter for array item of "+t.name+" ASN1 schema")}return t.from(e.valueBlock.value,(function(e){return l.fromASN(e)}))}else{return t.from(e.valueBlock.value,(function(e){return r.fromASN(e,o.itemType)}))}}var p=function(t){if(!e[t]){return"continue"}var n=o.items[t];if(typeof n.type==="number"||pr(n.type)){var a=(i=n.converter)!==null&&i!==void 0?i:pr(n.type)?new n.type:null;if(!a){throw new Error("Converter is empty")}if(n.repeated){if(n.implicit){var s=n.repeated==="sequence"?Me:Le;var u=new s;u.valueBlock=e[t].valueBlock;var l=Y(u.toBER(false)).result.valueBlock.value;c[t]=Array.from(l,(function(e){return a.fromASN(e)}))}else{c[t]=Array.from(e[t],(function(e){return a.fromASN(e)}))}}else{var l=e[t];if(n.implicit){var u=void 0;if(pr(n.type)){u=(new n.type).toSchema("")}else{var p=Ht[n.type];var v=Rt[p];if(!v){throw new Error("Cannot get '"+p+"' class from asn1js module")}u=new v}u.valueBlock=l.valueBlock;l=Y(u.toBER(false)).result}c[t]=a.fromASN(l)}}else{if(n.repeated){c[t]=Array.from(e[t],(function(e){return r.fromASN(e,n.type)}))}else{c[t]=f.fromASN(e[t],n.type)}}};var f=this;for(var s in o.items){p(s)}return c}catch(v){if(v instanceof Sr){v.schemas.push(t.name)}throw v}};return e}();e("c",mr);var Cr=function(){function e(){}e.serialize=function(e){if(e instanceof q){return e.toBER(false)}return this.toASN(e).toBER(false)};e.toASN=function(t){var r=this;if(t&&pr(t.constructor)){return t.toASN()}var i=t.constructor;var n=dr.get(i);dr.cache(i);var o=[];if(n.itemType){if(typeof n.itemType==="number"){var a=ur(n.itemType);if(!a){throw new Error("Cannot get default converter for array item of "+i.name+" ASN1 schema")}o=t.map((function(e){return a.toASN(e)}))}else{o=t.map((function(e){return r.toAsnItem({type:n.itemType},"[]",i,e)}))}}else{for(var s in n.items){var u=n.items[s];var c=t[s];if(c===undefined||u.defaultValue===c||typeof u.defaultValue==="object"&&typeof c==="object"&&vr(this.serialize(u.defaultValue),this.serialize(c))){continue}var l=e.toAsnItem(u,s,i,c);if(typeof u.context==="number"){if(u.implicit){if(!u.repeated&&(typeof u.type==="number"||pr(u.type))){var p={};p.valueHex=l instanceof ue?l.valueBeforeDecode:l.valueBlock.toBER();o.push(new $(__assign({optional:u.optional,idBlock:{tagClass:3,tagNumber:u.context}},p)))}else{o.push(new ie({optional:u.optional,idBlock:{tagClass:3,tagNumber:u.context},value:l.valueBlock.value}))}}else{o.push(new ie({optional:u.optional,idBlock:{tagClass:3,tagNumber:u.context},value:[l]}))}}else if(u.repeated){o=o.concat(l)}else{o.push(l)}}}var f;switch(n.type){case Mt.Sequence:f=new Me({value:o});break;case Mt.Set:f=new Le({value:o});break;case Mt.Choice:if(!o[0]){throw new Error("Schema '"+i.name+"' has wrong data. Choice cannot be empty.")}f=o[0];break}return f};e.toAsnItem=function(e,t,r,i){var n=this;var o;if(typeof e.type==="number"){var a=e.converter;if(!a){throw new Error("Property '"+t+"' doesn't have converter for type "+Ht[e.type]+" in schema '"+r.name+"'")}if(e.repeated){var s=Array.from(i,(function(e){return a.toASN(e)}));var u=e.repeated==="sequence"?Me:Le;o=new u({value:s})}else{o=a.toASN(i)}}else{if(e.repeated){var s=Array.from(i,(function(e){return n.toASN(e)}));var u=e.repeated==="sequence"?Me:Le;o=new u({value:s})}else{o=this.toASN(i)}}return o};return e}();var Ar=function(e){__extends(t,e);function t(t){if(t===void 0){t=[]}var r=this;if(typeof t==="number"){r=e.call(this,t)||this}else{r=e.call(this)||this;for(var i=0,n=t;i<n.length;i++){var o=n[i];r.push(o)}}return r}return t}(Array);var br=function(){function e(){}e.serialize=function(e){return Cr.serialize(e)};e.parse=function(e,t){return mr.parse(e,t)};e.toString=function(t){var r=s.isBufferSource(t)?s.toArrayBuffer(t):e.serialize(t);var i=Y(r);if(i.offset===-1){throw new Error("Cannot decode ASN.1 data. "+i.result.error)}return i.result.toString()};return e}();e("e",br);function Br(e,t,r,i){var n=arguments.length,o=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,r):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,t,r,i);else for(var s=e.length-1;s>=0;s--)if(a=e[s])o=(n<3?a(o):n>3?a(t,r,o):a(t,r))||o;return n>3&&o&&Object.defineProperty(t,r,o),o}var wr=t((function(e){(function(t){var r="(0?\\d+|0x[a-f0-9]+)";var i={fourOctet:new RegExp("^"+r+"\\."+r+"\\."+r+"\\."+r+"$","i"),threeOctet:new RegExp("^"+r+"\\."+r+"\\."+r+"$","i"),twoOctet:new RegExp("^"+r+"\\."+r+"$","i"),longValue:new RegExp("^"+r+"$","i")};var n=new RegExp("^0[0-7]+$","i");var o=new RegExp("^0x[a-f0-9]+$","i");var a="%[0-9a-z]{1,}";var s="(?:[0-9a-f]+::?)+";var u={zoneIndex:new RegExp(a,"i"),native:new RegExp("^(::)?("+s+")?([0-9a-f]+)?(::)?("+a+")?$","i"),deprecatedTransitional:new RegExp("^(?:::)("+r+"\\."+r+"\\."+r+"\\."+r+"("+a+")?)$","i"),transitional:new RegExp("^((?:"+s+")|(?:::)(?:"+s+")?)"+r+"\\."+r+"\\."+r+"\\."+r+"("+a+")?$","i")};function c(e,t){if(e.indexOf("::")!==e.lastIndexOf("::")){return null}var r=0;var i=-1;var n=(e.match(u.zoneIndex)||[])[0];var o,a;if(n){n=n.substring(1);e=e.replace(/%.+$/,"")}while((i=e.indexOf(":",i+1))>=0){r++}if(e.substr(0,2)==="::"){r--}if(e.substr(-2,2)==="::"){r--}if(r>t){return null}a=t-r;o=":";while(a--){o+="0:"}e=e.replace("::",o);if(e[0]===":"){e=e.slice(1)}if(e[e.length-1]===":"){e=e.slice(0,-1)}t=function(){var t=e.split(":");var r=[];for(var i=0;i<t.length;i++){r.push(parseInt(t[i],16))}return r}();return{parts:t,zoneId:n}}function l(e,t,r,i){if(e.length!==t.length){throw new Error("ipaddr: cannot match CIDR for objects with different lengths")}var n=0;var o;while(i>0){o=r-i;if(o<0){o=0}if(e[n]>>o!==t[n]>>o){return false}i-=r;n+=1}return true}function p(e){if(o.test(e)){return parseInt(e,16)}if(e[0]==="0"&&!isNaN(parseInt(e[1],10))){if(n.test(e)){return parseInt(e,8)}throw new Error("ipaddr: cannot parse "+e+" as octal")}return parseInt(e,10)}function f(e,t){while(e.length<t){e="0"+e}return e}var v={};v.IPv4=function(){function e(e){if(e.length!==4){throw new Error("ipaddr: ipv4 octet count should be 4")}var t,r;for(t=0;t<e.length;t++){r=e[t];if(!(0<=r&&r<=255)){throw new Error("ipaddr: ipv4 octet should fit in 8 bits")}}this.octets=e}e.prototype.SpecialRanges={unspecified:[[new e([0,0,0,0]),8]],broadcast:[[new e([255,255,255,255]),32]],multicast:[[new e([224,0,0,0]),4]],linkLocal:[[new e([169,254,0,0]),16]],loopback:[[new e([127,0,0,0]),8]],carrierGradeNat:[[new e([100,64,0,0]),10]],private:[[new e([10,0,0,0]),8],[new e([172,16,0,0]),12],[new e([192,168,0,0]),16]],reserved:[[new e([192,0,0,0]),24],[new e([192,0,2,0]),24],[new e([192,88,99,0]),24],[new e([198,51,100,0]),24],[new e([203,0,113,0]),24],[new e([240,0,0,0]),4]]};e.prototype.kind=function(){return"ipv4"};e.prototype.match=function(e,t){var r;if(t===undefined){r=e;e=r[0];t=r[1]}if(e.kind()!=="ipv4"){throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one")}return l(this.octets,e.octets,8,t)};e.prototype.prefixLengthFromSubnetMask=function(){var e=0;var t=false;var r={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0};var i,n,o;for(i=3;i>=0;i-=1){n=this.octets[i];if(n in r){o=r[n];if(t&&o!==0){return null}if(o!==8){t=true}e+=o}else{return null}}return 32-e};e.prototype.range=function(){return v.subnetMatch(this,this.SpecialRanges)};e.prototype.toByteArray=function(){return this.octets.slice(0)};e.prototype.toIPv4MappedAddress=function(){return v.IPv6.parse("::ffff:"+this.toString())};e.prototype.toNormalizedString=function(){return this.toString()};e.prototype.toString=function(){return this.octets.join(".")};return e}();v.IPv4.broadcastAddressFromCIDR=function(e){try{var t=this.parseCIDR(e);var r=t[0].toByteArray();var i=this.subnetMaskFromPrefixLength(t[1]).toByteArray();var n=[];var o=0;while(o<4){n.push(parseInt(r[o],10)|parseInt(i[o],10)^255);o++}return new this(n)}catch(a){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}};v.IPv4.isIPv4=function(e){return this.parser(e)!==null};v.IPv4.isValid=function(e){try{new this(this.parser(e));return true}catch(t){return false}};v.IPv4.isValidFourPartDecimal=function(e){if(v.IPv4.isValid(e)&&e.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/)){return true}else{return false}};v.IPv4.networkAddressFromCIDR=function(e){var t,r,i,n,o;try{t=this.parseCIDR(e);i=t[0].toByteArray();o=this.subnetMaskFromPrefixLength(t[1]).toByteArray();n=[];r=0;while(r<4){n.push(parseInt(i[r],10)&parseInt(o[r],10));r++}return new this(n)}catch(a){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}};v.IPv4.parse=function(e){var t=this.parser(e);if(t===null){throw new Error("ipaddr: string is not formatted like an IPv4 Address")}return new this(t)};v.IPv4.parseCIDR=function(e){var t;if(t=e.match(/^(.+)\/(\d+)$/)){var r=parseInt(t[2]);if(r>=0&&r<=32){var i=[this.parse(t[1]),r];Object.defineProperty(i,"toString",{value:function(){return this.join("/")}});return i}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")};v.IPv4.parser=function(e){var t,r,n;if(t=e.match(i.fourOctet)){return function(){var e=t.slice(1,6);var i=[];for(var n=0;n<e.length;n++){r=e[n];i.push(p(r))}return i}()}else if(t=e.match(i.longValue)){n=p(t[1]);if(n>4294967295||n<0){throw new Error("ipaddr: address outside defined range")}return function(){var e=[];var t;for(t=0;t<=24;t+=8){e.push(n>>t&255)}return e}().reverse()}else if(t=e.match(i.twoOctet)){return function(){var e=t.slice(1,4);var r=[];n=p(e[1]);if(n>16777215||n<0){throw new Error("ipaddr: address outside defined range")}r.push(p(e[0]));r.push(n>>16&255);r.push(n>>8&255);r.push(n&255);return r}()}else if(t=e.match(i.threeOctet)){return function(){var e=t.slice(1,5);var r=[];n=p(e[2]);if(n>65535||n<0){throw new Error("ipaddr: address outside defined range")}r.push(p(e[0]));r.push(p(e[1]));r.push(n>>8&255);r.push(n&255);return r}()}else{return null}};v.IPv4.subnetMaskFromPrefixLength=function(e){e=parseInt(e);if(e<0||e>32){throw new Error("ipaddr: invalid IPv4 prefix length")}var t=[0,0,0,0];var r=0;var i=Math.floor(e/8);while(r<i){t[r]=255;r++}if(i<4){t[i]=Math.pow(2,e%8)-1<<8-e%8}return new this(t)};v.IPv6=function(){function e(e,t){var r,i;if(e.length===16){this.parts=[];for(r=0;r<=14;r+=2){this.parts.push(e[r]<<8|e[r+1])}}else if(e.length===8){this.parts=e}else{throw new Error("ipaddr: ipv6 part count should be 8 or 16")}for(r=0;r<this.parts.length;r++){i=this.parts[r];if(!(0<=i&&i<=65535)){throw new Error("ipaddr: ipv6 part should fit in 16 bits")}}if(t){this.zoneId=t}}e.prototype.SpecialRanges={unspecified:[new e([0,0,0,0,0,0,0,0]),128],linkLocal:[new e([65152,0,0,0,0,0,0,0]),10],multicast:[new e([65280,0,0,0,0,0,0,0]),8],loopback:[new e([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new e([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new e([0,0,0,0,0,65535,0,0]),96],rfc6145:[new e([0,0,0,0,65535,0,0,0]),96],rfc6052:[new e([100,65435,0,0,0,0,0,0]),96],"6to4":[new e([8194,0,0,0,0,0,0,0]),16],teredo:[new e([8193,0,0,0,0,0,0,0]),32],reserved:[[new e([8193,3512,0,0,0,0,0,0]),32]]};e.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"};e.prototype.kind=function(){return"ipv6"};e.prototype.match=function(e,t){var r;if(t===undefined){r=e;e=r[0];t=r[1]}if(e.kind()!=="ipv6"){throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one")}return l(this.parts,e.parts,16,t)};e.prototype.prefixLengthFromSubnetMask=function(){var e=0;var t=false;var r={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0};var i,n;for(var o=7;o>=0;o-=1){i=this.parts[o];if(i in r){n=r[i];if(t&&n!==0){return null}if(n!==16){t=true}e+=n}else{return null}}return 128-e};e.prototype.range=function(){return v.subnetMatch(this,this.SpecialRanges)};e.prototype.toByteArray=function(){var e;var t=[];var r=this.parts;for(var i=0;i<r.length;i++){e=r[i];t.push(e>>8);t.push(e&255)}return t};e.prototype.toFixedLengthString=function(){var e=function(){var e=[];for(var t=0;t<this.parts.length;t++){e.push(f(this.parts[t].toString(16),4))}return e}.call(this).join(":");var t="";if(this.zoneId){t="%"+this.zoneId}return e+t};e.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress()){throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4")}var e=this.parts.slice(-2);var t=e[0];var r=e[1];return new v.IPv4([t>>8,t&255,r>>8,r&255])};e.prototype.toNormalizedString=function(){var e=function(){var e=[];for(var t=0;t<this.parts.length;t++){e.push(this.parts[t].toString(16))}return e}.call(this).join(":");var t="";if(this.zoneId){t="%"+this.zoneId}return e+t};e.prototype.toRFC5952String=function(){var e=/((^|:)(0(:|$)){2,})/g;var t=this.toNormalizedString();var r=0;var i=-1;var n;while(n=e.exec(t)){if(n[0].length>i){r=n.index;i=n[0].length}}if(i<0){return t}return t.substring(0,r)+"::"+t.substring(r+i)};e.prototype.toString=function(){return this.toNormalizedString().replace(/((^|:)(0(:|$))+)/,"::")};return e}();v.IPv6.broadcastAddressFromCIDR=function(e){try{var t=this.parseCIDR(e);var r=t[0].toByteArray();var i=this.subnetMaskFromPrefixLength(t[1]).toByteArray();var n=[];var o=0;while(o<16){n.push(parseInt(r[o],10)|parseInt(i[o],10)^255);o++}return new this(n)}catch(a){throw new Error("ipaddr: the address does not have IPv6 CIDR format ("+a+")")}};v.IPv6.isIPv6=function(e){return this.parser(e)!==null};v.IPv6.isValid=function(e){if(typeof e==="string"&&e.indexOf(":")===-1){return false}try{var t=this.parser(e);new this(t.parts,t.zoneId);return true}catch(r){return false}};v.IPv6.networkAddressFromCIDR=function(e){var t,r,i,n,o;try{t=this.parseCIDR(e);i=t[0].toByteArray();o=this.subnetMaskFromPrefixLength(t[1]).toByteArray();n=[];r=0;while(r<16){n.push(parseInt(i[r],10)&parseInt(o[r],10));r++}return new this(n)}catch(a){throw new Error("ipaddr: the address does not have IPv6 CIDR format ("+a+")")}};v.IPv6.parse=function(e){var t=this.parser(e);if(t.parts===null){throw new Error("ipaddr: string is not formatted like an IPv6 Address")}return new this(t.parts,t.zoneId)};v.IPv6.parseCIDR=function(e){var t,r,i;if(r=e.match(/^(.+)\/(\d+)$/)){t=parseInt(r[2]);if(t>=0&&t<=128){i=[this.parse(r[1]),t];Object.defineProperty(i,"toString",{value:function(){return this.join("/")}});return i}}throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")};v.IPv6.parser=function(e){var t,r,i,n,o,a;if(i=e.match(u.deprecatedTransitional)){return this.parser("::ffff:"+i[1])}if(u.native.test(e)){return c(e,8)}if(i=e.match(u.transitional)){a=i[6]||"";t=c(i[1].slice(0,-1)+a,6);if(t.parts){o=[parseInt(i[2]),parseInt(i[3]),parseInt(i[4]),parseInt(i[5])];for(r=0;r<o.length;r++){n=o[r];if(!(0<=n&&n<=255)){return null}}t.parts.push(o[0]<<8|o[1]);t.parts.push(o[2]<<8|o[3]);return{parts:t.parts,zoneId:t.zoneId}}}return null};v.IPv6.subnetMaskFromPrefixLength=function(e){e=parseInt(e);if(e<0||e>128){throw new Error("ipaddr: invalid IPv6 prefix length")}var t=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];var r=0;var i=Math.floor(e/8);while(r<i){t[r]=255;r++}if(i<16){t[i]=Math.pow(2,e%8)-1<<8-e%8}return new this(t)};v.fromByteArray=function(e){var t=e.length;if(t===4){return new v.IPv4(e)}else if(t===16){return new v.IPv6(e)}else{throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")}};v.isValid=function(e){return v.IPv6.isValid(e)||v.IPv4.isValid(e)};v.parse=function(e){if(v.IPv6.isValid(e)){return v.IPv6.parse(e)}else if(v.IPv4.isValid(e)){return v.IPv4.parse(e)}else{throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")}};v.parseCIDR=function(e){try{return v.IPv6.parseCIDR(e)}catch(t){try{return v.IPv4.parseCIDR(e)}catch(r){throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}};v.process=function(e){var t=this.parse(e);if(t.kind()==="ipv6"&&t.isIPv4MappedAddress()){return t.toIPv4Address()}else{return t}};v.subnetMatch=function(e,t,r){var i,n,o,a;if(r===undefined||r===null){r="unicast"}for(n in t){if(Object.prototype.hasOwnProperty.call(t,n)){o=t[n];if(o[0]&&!(o[0]instanceof Array)){o=[o]}for(i=0;i<o.length;i++){a=o[i];if(e.kind()===a[0].kind()&&e.match.apply(e,a)){return n}}}}return r};if(e.exports){e.exports=v}else{t.ipaddr=v}})(i)}));var Er=function(){function e(){}e.decodeIP=function(e){if(e.length===64&&parseInt(e,16)===0){return"::/0"}if(e.length!==16){return e}var t=parseInt(e.slice(8),16).toString(2).split("").reduce((function(e,t){return e+ +t}),0);var r=e.slice(0,8).replace(/(.{2})/g,(function(e){return parseInt(e,16)+"."}));r=r.slice(0,-1);return r+"/"+t};e.toString=function(e){if(e.byteLength===4||e.byteLength===16){var t=new Uint8Array(e);var r=wr.fromByteArray(Array.from(t));return r.toString()}return this.decodeIP(u.ToHex(e))};e.fromString=function(e){var t=wr.parse(e);return new Uint8Array(t.toByteArray()).buffer};return e}();var Ir,Pr,Dr;var kr=function(){function e(e){if(e===void 0){e={}}Object.assign(this,e)}e.prototype.toString=function(){return this.bmpString||this.printableString||this.teletexString||this.universalString||this.utf8String||""};return e}();Br([gr({type:Ht.TeletexString})],kr.prototype,"teletexString",void 0);Br([gr({type:Ht.PrintableString})],kr.prototype,"printableString",void 0);Br([gr({type:Ht.UniversalString})],kr.prototype,"universalString",void 0);Br([gr({type:Ht.Utf8String})],kr.prototype,"utf8String",void 0);Br([gr({type:Ht.BmpString})],kr.prototype,"bmpString",void 0);kr=Br([yr({type:Mt.Choice})],kr);var xr=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t)||this;Object.assign(r,t);return r}t.prototype.toString=function(){return this.ia5String||(this.anyValue?u.ToHex(this.anyValue):e.prototype.toString.call(this))};return t}(kr);Br([gr({type:Ht.IA5String})],xr.prototype,"ia5String",void 0);Br([gr({type:Ht.Any})],xr.prototype,"anyValue",void 0);xr=Br([yr({type:Mt.Choice})],xr);var _r=function(){function e(e){if(e===void 0){e={}}this.type="";this.value=new xr;Object.assign(this,e)}return e}();Br([gr({type:Ht.ObjectIdentifier})],_r.prototype,"type",void 0);Br([gr({type:xr})],_r.prototype,"value",void 0);var Or=Ir=function(e){__extends(t,e);function t(t){var r=e.call(this,t)||this;Object.setPrototypeOf(r,Ir.prototype);return r}return t}(Ar);Or=Ir=Br([yr({type:Mt.Set,itemType:_r})],Or);var Tr=Pr=function(e){__extends(t,e);function t(t){var r=e.call(this,t)||this;Object.setPrototypeOf(r,Pr.prototype);return r}return t}(Ar);Tr=Pr=Br([yr({type:Mt.Sequence,itemType:Or})],Tr);var Nr=e("J",Dr=function(e){__extends(t,e);function t(t){var r=e.call(this,t)||this;Object.setPrototypeOf(r,Dr.prototype);return r}return t}(Tr));Nr=e("J",Dr=Br([yr({type:Mt.Sequence})],Nr));var Rr={fromASN:function(e){return Er.toString(qt.fromASN(e))},toASN:function(e){return qt.toASN(Er.fromString(e))}};var Mr=function(){function e(e){if(e===void 0){e={}}this.typeId="";this.value=new ArrayBuffer(0);Object.assign(this,e)}return e}();e("K",Mr);Br([gr({type:Ht.ObjectIdentifier})],Mr.prototype,"typeId",void 0);Br([gr({type:Ht.Any,context:0})],Mr.prototype,"value",void 0);var Hr=function(){function e(e){if(e===void 0){e={}}this.partyName=new ArrayBuffer(0);Object.assign(this,e)}return e}();e("Q",Hr);Br([gr({type:kr,optional:true,context:0,implicit:true})],Hr.prototype,"nameAssigner",void 0);Br([gr({type:kr,context:1,implicit:true})],Hr.prototype,"partyName",void 0);var Lr=function(){function e(e){if(e===void 0){e={}}Object.assign(this,e)}return e}();Br([gr({type:Mr,context:0,implicit:true})],Lr.prototype,"otherName",void 0);Br([gr({type:Ht.IA5String,context:1,implicit:true})],Lr.prototype,"rfc822Name",void 0);Br([gr({type:Ht.IA5String,context:2,implicit:true})],Lr.prototype,"dNSName",void 0);Br([gr({type:Ht.Any,context:3,implicit:true})],Lr.prototype,"x400Address",void 0);Br([gr({type:Nr,context:4,implicit:false})],Lr.prototype,"directoryName",void 0);Br([gr({type:Hr,context:5})],Lr.prototype,"ediPartyName",void 0);Br([gr({type:Ht.IA5String,context:6,implicit:true})],Lr.prototype,"uniformResourceIdentifier",void 0);Br([gr({type:Ht.OctetString,context:7,implicit:true,converter:Rr})],Lr.prototype,"iPAddress",void 0);Br([gr({type:Ht.ObjectIdentifier,context:8,implicit:true})],Lr.prototype,"registeredID",void 0);Lr=Br([yr({type:Mt.Choice})],Lr);var Ur="1.3.6.1.5.5.7";var Vr=Ur+".1";var jr="2.5.29";var Fr;var Kr=Vr+".1";var Gr=function(){function e(e){if(e===void 0){e={}}this.accessMethod="";this.accessLocation=new Lr;Object.assign(this,e)}return e}();Br([gr({type:Ht.ObjectIdentifier})],Gr.prototype,"accessMethod",void 0);Br([gr({type:Lr})],Gr.prototype,"accessLocation",void 0);var qr=e("a1",Fr=function(e){__extends(t,e);function t(t){var r=e.call(this,t)||this;Object.setPrototypeOf(r,Fr.prototype);return r}return t}(Ar));qr=e("a1",Fr=Br([yr({type:Mt.Sequence,itemType:Gr})],qr));var zr=jr+".35";var Wr=function(e){__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(lr);var Qr=function(){function e(e){if(e===void 0){e={}}if(e){Object.assign(this,e)}}return e}();e("$",Qr);Br([gr({type:Wr,context:0,optional:true,implicit:true})],Qr.prototype,"keyIdentifier",void 0);Br([gr({type:Lr,context:1,optional:true,implicit:true,repeated:"sequence"})],Qr.prototype,"authorityCertIssuer",void 0);Br([gr({type:Ht.Integer,context:2,optional:true,implicit:true,converter:jt})],Qr.prototype,"authorityCertSerialNumber",void 0);var Jr=jr+".19";var $r=function(){function e(e){if(e===void 0){e={}}this.cA=false;Object.assign(this,e)}return e}();e("Y",$r);Br([gr({type:Ht.Boolean,defaultValue:false})],$r.prototype,"cA",void 0);Br([gr({type:Ht.Integer,optional:true})],$r.prototype,"pathLenConstraint",void 0);var Zr;var Xr=Zr=function(e){__extends(t,e);function t(t){var r=e.call(this,t)||this;Object.setPrototypeOf(r,Zr.prototype);return r}return t}(Ar);Xr=Zr=Br([yr({type:Mt.Sequence,itemType:Lr})],Xr);var Yr;var ei=jr+".29";var ti=Yr=function(e){__extends(t,e);function t(t){var r=e.call(this,t)||this;Object.setPrototypeOf(r,Yr.prototype);return r}return t}(Xr);ti=Yr=Br([yr({type:Mt.Sequence})],ti);var ri;var ii=jr+".32";var ni=e("L",function(){function e(e){if(e===void 0){e={}}Object.assign(this,e)}e.prototype.toString=function(){return this.ia5String||this.visibleString||this.bmpString||this.utf8String};return e}());Br([gr({type:Ht.IA5String})],ni.prototype,"ia5String",void 0);Br([gr({type:Ht.VisibleString})],ni.prototype,"visibleString",void 0);Br([gr({type:Ht.BmpString})],ni.prototype,"bmpString",void 0);Br([gr({type:Ht.Utf8String})],ni.prototype,"utf8String",void 0);ni=e("L",Br([yr({type:Mt.Choice})],ni));var oi=function(){function e(e){if(e===void 0){e={}}this.organization=new ni;this.noticeNumbers=[];Object.assign(this,e)}return e}();Br([gr({type:ni})],oi.prototype,"organization",void 0);Br([gr({type:Ht.Integer,repeated:"sequence"})],oi.prototype,"noticeNumbers",void 0);var ai=function(){function e(e){if(e===void 0){e={}}Object.assign(this,e)}return e}();e("M",ai);Br([gr({type:oi,optional:true})],ai.prototype,"noticeRef",void 0);Br([gr({type:ni,optional:true})],ai.prototype,"explicitText",void 0);var si=function(){function e(e){if(e===void 0){e={}}Object.assign(this,e)}return e}();Br([gr({type:Ht.IA5String})],si.prototype,"cPSuri",void 0);Br([gr({type:ai})],si.prototype,"userNotice",void 0);si=Br([yr({type:Mt.Choice})],si);var ui=function(){function e(e){if(e===void 0){e={}}this.policyQualifierId="";this.qualifier=new ArrayBuffer(0);Object.assign(this,e)}return e}();Br([gr({type:Ht.ObjectIdentifier})],ui.prototype,"policyQualifierId",void 0);Br([gr({type:Ht.Any})],ui.prototype,"qualifier",void 0);var ci=function(){function e(e){if(e===void 0){e={}}this.policyIdentifier="";Object.assign(this,e)}return e}();Br([gr({type:Ht.ObjectIdentifier})],ci.prototype,"policyIdentifier",void 0);Br([gr({type:ui,repeated:"sequence",optional:true})],ci.prototype,"policyQualifiers",void 0);var li=e("a4",ri=function(e){__extends(t,e);function t(t){var r=e.call(this,t)||this;Object.setPrototypeOf(r,ri.prototype);return r}return t}(Ar));li=e("a4",ri=Br([yr({type:Mt.Sequence,itemType:ci})],li));var pi=function(){function e(e){if(e===void 0){e=0}this.value=e}return e}();Br([gr({type:Ht.Integer})],pi.prototype,"value",void 0);pi=Br([yr({type:Mt.Choice})],pi);var fi=function(e){__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(pi);fi=Br([yr({type:Mt.Choice})],fi);var vi;var hi=jr+".31";var di;(function(e){e[e["unused"]=1]="unused";e[e["keyCompromise"]=2]="keyCompromise";e[e["cACompromise"]=4]="cACompromise";e[e["affiliationChanged"]=8]="affiliationChanged";e[e["superseded"]=16]="superseded";e[e["cessationOfOperation"]=32]="cessationOfOperation";e[e["certificateHold"]=64]="certificateHold";e[e["privilegeWithdrawn"]=128]="privilegeWithdrawn";e[e["aACompromise"]=256]="aACompromise"})(di||(di={}));var yi=function(e){__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}t.prototype.toJSON=function(){var e=[];var t=this.toNumber();if(t&di.aACompromise){e.push("aACompromise")}if(t&di.affiliationChanged){e.push("affiliationChanged")}if(t&di.cACompromise){e.push("cACompromise")}if(t&di.certificateHold){e.push("certificateHold")}if(t&di.cessationOfOperation){e.push("cessationOfOperation")}if(t&di.keyCompromise){e.push("keyCompromise")}if(t&di.privilegeWithdrawn){e.push("privilegeWithdrawn")}if(t&di.superseded){e.push("superseded")}if(t&di.unused){e.push("unused")}return e};t.prototype.toString=function(){return"["+this.toJSON().join(", ")+"]"};return t}(cr);var gi=function(){function e(e){if(e===void 0){e={}}Object.assign(this,e)}return e}();Br([gr({type:Lr,context:0,repeated:"sequence",implicit:true})],gi.prototype,"fullName",void 0);Br([gr({type:Or,context:1,implicit:true})],gi.prototype,"nameRelativeToCRLIssuer",void 0);gi=Br([yr({type:Mt.Choice})],gi);var Si=function(){function e(e){if(e===void 0){e={}}Object.assign(this,e)}return e}();Br([gr({type:gi,context:0,optional:true})],Si.prototype,"distributionPoint",void 0);Br([gr({type:yi,context:1,optional:true,implicit:true})],Si.prototype,"reasons",void 0);Br([gr({type:Lr,context:2,optional:true,repeated:"sequence",implicit:true})],Si.prototype,"cRLIssuer",void 0);var mi=e("a0",vi=function(e){__extends(t,e);function t(t){var r=e.call(this,t)||this;Object.setPrototypeOf(r,vi.prototype);return r}return t}(Ar));mi=e("a0",vi=Br([yr({type:Mt.Sequence,itemType:Si})],mi));var Ci;var Ai=Ci=function(e){__extends(t,e);function t(t){var r=e.call(this,t)||this;Object.setPrototypeOf(r,Ci.prototype);return r}return t}(mi);Ai=Ci=Br([yr({type:Mt.Sequence,itemType:Si})],Ai);var bi=function(){function e(t){if(t===void 0){t={}}this.onlyContainsUserCerts=e.ONLY;this.onlyContainsCACerts=e.ONLY;this.indirectCRL=e.ONLY;this.onlyContainsAttributeCerts=e.ONLY;Object.assign(this,t)}return e}();bi.ONLY=false;Br([gr({type:gi,context:0,optional:true})],bi.prototype,"distributionPoint",void 0);Br([gr({type:Ht.Boolean,context:1,defaultValue:bi.ONLY})],bi.prototype,"onlyContainsUserCerts",void 0);Br([gr({type:Ht.Boolean,context:2,defaultValue:bi.ONLY})],bi.prototype,"onlyContainsCACerts",void 0);Br([gr({type:yi,context:3,optional:true})],bi.prototype,"onlySomeReasons",void 0);Br([gr({type:Ht.Boolean,context:4,defaultValue:bi.ONLY})],bi.prototype,"indirectCRL",void 0);Br([gr({type:Ht.Boolean,context:5,defaultValue:bi.ONLY})],bi.prototype,"onlyContainsAttributeCerts",void 0);var Bi=jr+".21";var wi;(function(e){e[e["unspecified"]=0]="unspecified";e[e["keyCompromise"]=1]="keyCompromise";e[e["cACompromise"]=2]="cACompromise";e[e["affiliationChanged"]=3]="affiliationChanged";e[e["superseded"]=4]="superseded";e[e["cessationOfOperation"]=5]="cessationOfOperation";e[e["certificateHold"]=6]="certificateHold";e[e["removeFromCRL"]=8]="removeFromCRL";e[e["privilegeWithdrawn"]=9]="privilegeWithdrawn";e[e["aACompromise"]=10]="aACompromise"})(wi||(wi={}));var Ei=e("ah",function(){function e(e){if(e===void 0){e=wi.unspecified}this.reason=wi.unspecified;this.reason=e}e.prototype.toJSON=function(){return wi[this.reason]};e.prototype.toString=function(){return this.toJSON()};return e}());Br([gr({type:Ht.Enumerated})],Ei.prototype,"reason",void 0);Ei=e("ah",Br([yr({type:Mt.Choice})],Ei));var Ii;var Pi=jr+".37";var Di=e("Z",Ii=function(e){__extends(t,e);function t(t){var r=e.call(this,t)||this;Object.setPrototypeOf(r,Ii.prototype);return r}return t}(Ar));Di=e("Z",Ii=Br([yr({type:Mt.Sequence,itemType:Ht.ObjectIdentifier})],Di));var ki=jr+".54";var xi=function(){function e(e){if(e===void 0){e=new ArrayBuffer(0)}this.value=e}return e}();Br([gr({type:Ht.Integer,converter:jt})],xi.prototype,"value",void 0);xi=Br([yr({type:Mt.Choice})],xi);var _i=jr+".24";var Oi=function(){function e(e){this.value=new Date;if(e){this.value=e}}return e}();Br([gr({type:Ht.GeneralizedTime})],Oi.prototype,"value",void 0);Oi=Br([yr({type:Mt.Choice})],Oi);var Ti;var Ni=jr+".18";var Ri=Ti=function(e){__extends(t,e);function t(t){var r=e.call(this,t)||this;Object.setPrototypeOf(r,Ti.prototype);return r}return t}(Xr);Ri=Ti=Br([yr({type:Mt.Sequence})],Ri);var Mi=jr+".15";var Hi;(function(e){e[e["digitalSignature"]=1]="digitalSignature";e[e["nonRepudiation"]=2]="nonRepudiation";e[e["keyEncipherment"]=4]="keyEncipherment";e[e["dataEncipherment"]=8]="dataEncipherment";e[e["keyAgreement"]=16]="keyAgreement";e[e["keyCertSign"]=32]="keyCertSign";e[e["cRLSign"]=64]="cRLSign";e[e["encipherOnly"]=128]="encipherOnly";e[e["decipherOnly"]=256]="decipherOnly"})(Hi||(Hi={}));var Li=function(e){__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}t.prototype.toJSON=function(){var e=this.toNumber();var t=[];if(e&Hi.cRLSign){t.push("crlSign")}if(e&Hi.dataEncipherment){t.push("dataEncipherment")}if(e&Hi.decipherOnly){t.push("decipherOnly")}if(e&Hi.digitalSignature){t.push("digitalSignature")}if(e&Hi.encipherOnly){t.push("encipherOnly")}if(e&Hi.keyAgreement){t.push("keyAgreement")}if(e&Hi.keyCertSign){t.push("keyCertSign")}if(e&Hi.keyEncipherment){t.push("keyEncipherment")}if(e&Hi.nonRepudiation){t.push("nonRepudiation")}return t};t.prototype.toString=function(){return"["+this.toJSON().join(", ")+"]"};return t}(cr);e("X",Li);var Ui;var Vi=jr+".30";var ji=function(){function e(e){if(e===void 0){e={}}this.base=new Lr;this.minimum=0;Object.assign(this,e)}return e}();Br([gr({type:Lr})],ji.prototype,"base",void 0);Br([gr({type:Ht.Integer,context:0,defaultValue:0,implicit:true})],ji.prototype,"minimum",void 0);Br([gr({type:Ht.Integer,context:1,optional:true,implicit:true})],ji.prototype,"maximum",void 0);var Fi=Ui=function(e){__extends(t,e);function t(t){var r=e.call(this,t)||this;Object.setPrototypeOf(r,Ui.prototype);return r}return t}(Ar);Fi=Ui=Br([yr({type:Mt.Sequence,itemType:ji})],Fi);var Ki=function(){function e(e){if(e===void 0){e={}}Object.assign(this,e)}return e}();e("a6",Ki);Br([gr({type:Fi,context:0,optional:true,implicit:true})],Ki.prototype,"permittedSubtrees",void 0);Br([gr({type:Fi,context:1,optional:true,implicit:true})],Ki.prototype,"excludedSubtrees",void 0);var Gi=jr+".36";var qi=function(){function e(e){if(e===void 0){e={}}Object.assign(this,e)}return e}();e("ao",qi);Br([gr({type:Ht.Integer,context:0,implicit:true,optional:true,converter:jt})],qi.prototype,"requireExplicitPolicy",void 0);Br([gr({type:Ht.Integer,context:1,implicit:true,optional:true,converter:jt})],qi.prototype,"inhibitPolicyMapping",void 0);var zi;var Wi=jr+".33";var Qi=function(){function e(e){if(e===void 0){e={}}this.issuerDomainPolicy="";this.subjectDomainPolicy="";Object.assign(this,e)}return e}();Br([gr({type:Ht.ObjectIdentifier})],Qi.prototype,"issuerDomainPolicy",void 0);Br([gr({type:Ht.ObjectIdentifier})],Qi.prototype,"subjectDomainPolicy",void 0);var Ji=e("ap",zi=function(e){__extends(t,e);function t(t){var r=e.call(this,t)||this;Object.setPrototypeOf(r,zi.prototype);return r}return t}(Ar));Ji=e("ap",zi=Br([yr({type:Mt.Sequence,itemType:Qi})],Ji));var $i;var Zi=jr+".17";var Xi=e("a3",$i=function(e){__extends(t,e);function t(t){var r=e.call(this,t)||this;Object.setPrototypeOf(r,$i.prototype);return r}return t}(Xr));Xi=e("a3",$i=Br([yr({type:Mt.Sequence})],Xi));var Yi=function(){function e(e){if(e===void 0){e={}}this.type="";this.values=[];Object.assign(this,e)}return e}();e("a",Yi);Br([gr({type:Ht.ObjectIdentifier})],Yi.prototype,"type",void 0);Br([gr({type:Ht.Any,repeated:"set"})],Yi.prototype,"values",void 0);var en;var tn=jr+".9";var rn=e("ai",en=function(e){__extends(t,e);function t(t){var r=e.call(this,t)||this;Object.setPrototypeOf(r,en.prototype);return r}return t}(Ar));rn=e("ai",en=Br([yr({type:Mt.Sequence,itemType:Yi})],rn));var nn=jr+".14";var on=function(e){__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(Wr);e("_",on);var an=jr+".16";var sn=function(){function e(e){if(e===void 0){e={}}Object.assign(this,e)}return e}();e("aj",sn);Br([gr({type:Ht.GeneralizedTime,context:0,implicit:true,optional:true})],sn.prototype,"notBefore",void 0);Br([gr({type:Ht.GeneralizedTime,context:1,implicit:true,optional:true})],sn.prototype,"notAfter",void 0);var un="1.2.840.113533.7.65.0";var cn;(function(e){e[e["keyUpdateAllowed"]=1]="keyUpdateAllowed";e[e["newExtensions"]=2]="newExtensions";e[e["pKIXCertificate"]=4]="pKIXCertificate"})(cn||(cn={}));var ln=function(e){__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}t.prototype.toJSON=function(){var e=[];var t=this.toNumber();if(t&cn.pKIXCertificate){e.push("pKIXCertificate")}if(t&cn.newExtensions){e.push("newExtensions")}if(t&cn.keyUpdateAllowed){e.push("keyUpdateAllowed")}return e};t.prototype.toString=function(){return"["+this.toJSON().join(", ")+"]"};return t}(cr);var pn=function(){function e(e){if(e===void 0){e={}}this.entrustVers="";this.entrustInfoFlags=new ln;Object.assign(this,e)}return e}();e("ak",pn);Br([gr({type:Ht.GeneralString})],pn.prototype,"entrustVers",void 0);Br([gr({type:ln})],pn.prototype,"entrustInfoFlags",void 0);var fn;var vn=Vr+".11";var hn=e("a2",fn=function(e){__extends(t,e);function t(t){var r=e.call(this,t)||this;Object.setPrototypeOf(r,fn.prototype);return r}return t}(Ar));hn=e("a2",fn=Br([yr({type:Mt.Sequence,itemType:Gr})],hn));var dn=function(){function e(e){if(e===void 0){e={}}this.algorithm="";Object.assign(this,e)}e.prototype.isEqual=function(t){return t instanceof e&&t.algorithm==this.algorithm&&(t.parameters&&this.parameters&&c(t.parameters,this.parameters)||t.parameters===this.parameters)};return e}();Br([gr({type:Ht.ObjectIdentifier})],dn.prototype,"algorithm",void 0);Br([gr({type:Ht.Any,optional:true})],dn.prototype,"parameters",void 0);var yn=function(){function e(e){if(e===void 0){e={}}this.algorithm=new dn;this.subjectPublicKey=new ArrayBuffer(0);Object.assign(this,e)}return e}();Br([gr({type:dn})],yn.prototype,"algorithm",void 0);Br([gr({type:Ht.BitString})],yn.prototype,"subjectPublicKey",void 0);var gn=function(){function e(e){if(e){if(typeof e==="string"||typeof e==="number"){this.utcTime=new Date(e)}else if(e instanceof Date){this.utcTime=e}else{Object.assign(this,e)}}}e.prototype.getTime=function(){var e=this.utcTime||this.generalTime;if(!e){throw new Error("Cannot get time from CHOICE object")}return e};return e}();Br([gr({type:Ht.UTCTime})],gn.prototype,"utcTime",void 0);Br([gr({type:Ht.GeneralizedTime})],gn.prototype,"generalTime",void 0);gn=Br([yr({type:Mt.Choice})],gn);var Sn=function(){function e(e){this.notBefore=new gn(new Date);this.notAfter=new gn(new Date);if(e){this.notBefore=new gn(e.notBefore);this.notAfter=new gn(e.notAfter)}}return e}();Br([gr({type:gn})],Sn.prototype,"notBefore",void 0);Br([gr({type:gn})],Sn.prototype,"notAfter",void 0);var mn;var Cn=function(){function e(t){if(t===void 0){t={}}this.extnID="";this.critical=e.CRITICAL;this.extnValue=new lr;Object.assign(this,t)}return e}();Cn.CRITICAL=false;Br([gr({type:Ht.ObjectIdentifier})],Cn.prototype,"extnID",void 0);Br([gr({type:Ht.Boolean,defaultValue:Cn.CRITICAL})],Cn.prototype,"critical",void 0);Br([gr({type:lr})],Cn.prototype,"extnValue",void 0);var An=mn=function(e){__extends(t,e);function t(t){var r=e.call(this,t)||this;Object.setPrototypeOf(r,mn.prototype);return r}return t}(Ar);An=mn=Br([yr({type:Mt.Sequence,itemType:Cn})],An);var bn;(function(e){e[e["v1"]=0]="v1";e[e["v2"]=1]="v2";e[e["v3"]=2]="v3"})(bn||(bn={}));var Bn=function(){function e(e){if(e===void 0){e={}}this.version=bn.v1;this.serialNumber=new ArrayBuffer(0);this.signature=new dn;this.issuer=new Nr;this.validity=new Sn;this.subject=new Nr;this.subjectPublicKeyInfo=new yn;Object.assign(this,e)}return e}();Br([gr({type:Ht.Integer,context:0,defaultValue:bn.v1})],Bn.prototype,"version",void 0);Br([gr({type:Ht.Integer,converter:jt})],Bn.prototype,"serialNumber",void 0);Br([gr({type:dn})],Bn.prototype,"signature",void 0);Br([gr({type:Nr})],Bn.prototype,"issuer",void 0);Br([gr({type:Sn})],Bn.prototype,"validity",void 0);Br([gr({type:Nr})],Bn.prototype,"subject",void 0);Br([gr({type:yn})],Bn.prototype,"subjectPublicKeyInfo",void 0);Br([gr({type:Ht.BitString,context:1,implicit:true,optional:true})],Bn.prototype,"issuerUniqueID",void 0);Br([gr({type:Ht.BitString,context:2,implicit:true,optional:true})],Bn.prototype,"subjectUniqueID",void 0);Br([gr({type:An,context:3,optional:true})],Bn.prototype,"extensions",void 0);var wn=function(){function e(e){if(e===void 0){e={}}this.tbsCertificate=new Bn;this.signatureAlgorithm=new dn;this.signatureValue=new ArrayBuffer(0);Object.assign(this,e)}return e}();Br([gr({type:Bn})],wn.prototype,"tbsCertificate",void 0);Br([gr({type:dn})],wn.prototype,"signatureAlgorithm",void 0);Br([gr({type:Ht.BitString})],wn.prototype,"signatureValue",void 0);var En=function(){function e(e){if(e===void 0){e={}}this.userCertificate=new ArrayBuffer(0);this.revocationDate=new gn;Object.assign(this,e)}return e}();Br([gr({type:Ht.Integer,converter:jt})],En.prototype,"userCertificate",void 0);Br([gr({type:gn})],En.prototype,"revocationDate",void 0);Br([gr({type:Cn,optional:true,repeated:"sequence"})],En.prototype,"crlEntryExtensions",void 0);var In=function(){function e(e){if(e===void 0){e={}}this.signature=new dn;this.issuer=new Nr;this.thisUpdate=new gn;Object.assign(this,e)}return e}();Br([gr({type:Ht.Integer,optional:true})],In.prototype,"version",void 0);Br([gr({type:dn})],In.prototype,"signature",void 0);Br([gr({type:Nr})],In.prototype,"issuer",void 0);Br([gr({type:gn})],In.prototype,"thisUpdate",void 0);Br([gr({type:gn,optional:true})],In.prototype,"nextUpdate",void 0);Br([gr({type:En,repeated:"sequence",optional:true})],In.prototype,"revokedCertificates",void 0);Br([gr({type:Cn,optional:true,context:0,repeated:"sequence"})],In.prototype,"crlExtensions",void 0);var Pn=function(){function e(e){if(e===void 0){e={}}this.tbsCertList=new In;this.signatureAlgorithm=new dn;this.signature=new ArrayBuffer(0);Object.assign(this,e)}return e}();Br([gr({type:In})],Pn.prototype,"tbsCertList",void 0);Br([gr({type:dn})],Pn.prototype,"signatureAlgorithm",void 0);Br([gr({type:Ht.BitString})],Pn.prototype,"signature",void 0);var Dn=e("F","1.2.840.10045.2.1");var kn="1.2.840.10045.4.1";var xn="1.2.840.10045.4.3.1";var _n="1.2.840.10045.4.3.2";var On="1.2.840.10045.4.3.3";var Tn="1.2.840.10045.4.3.4";function Nn(e){return new dn({algorithm:e})}var Rn=Nn(kn);var Mn=Nn(xn);var Hn=Nn(_n);var Ln=Nn(On);var Un=Nn(Tn);var Vn=e("G",function(){function e(e){if(e===void 0){e={}}Object.assign(this,e)}return e}());Br([gr({type:Ht.ObjectIdentifier})],Vn.prototype,"namedCurve",void 0);Vn=e("G",Br([yr({type:Mt.Choice})],Vn));var jn=function(){function e(e){if(e===void 0){e={}}this.version=1;this.privateKey=new lr;Object.assign(this,e)}return e}();Br([gr({type:Ht.Integer})],jn.prototype,"version",void 0);Br([gr({type:lr})],jn.prototype,"privateKey",void 0);Br([gr({type:Vn,context:0,optional:true})],jn.prototype,"parameters",void 0);Br([gr({type:Ht.BitString,context:1,optional:true})],jn.prototype,"publicKey",void 0);var Fn=function(){function e(e){if(e===void 0){e={}}this.r=new ArrayBuffer(0);this.s=new ArrayBuffer(0);Object.assign(this,e)}return e}();Br([gr({type:Ht.Integer,converter:jt})],Fn.prototype,"r",void 0);Br([gr({type:Ht.Integer,converter:jt})],Fn.prototype,"s",void 0);var Kn="1.2.840.113549.1.1";var Gn=e("H",Kn+".1");var qn=Kn+".7";var zn=Kn+".9";var Wn=Kn+".10";var Qn=Kn+".2";var Jn=Kn+".4";var $n=Kn+".5";var Zn=Kn+".12";var Xn=Kn+".13";var Yn=Kn+".15";var eo=Kn+".16";var to="1.3.14.3.2.26";var ro="2.16.840.1.101.3.4.2.4";var io="2.16.840.1.101.3.4.2.1";var no="2.16.840.1.101.3.4.2.2";var oo="2.16.840.1.101.3.4.2.3";var ao="2.16.840.1.101.3.4.2.5";var so="2.16.840.1.101.3.4.2.6";var uo="1.2.840.113549.2.2";var co="1.2.840.113549.2.5";var lo=Kn+".8";function po(e){return new dn({algorithm:e,parameters:null})}var fo=po(uo);var vo=po(co);var ho=po(to);var yo=po(ro);var go=po(io);var So=po(no);var mo=po(oo);var Co=po(ao);var Ao=po(so);var bo=new dn({algorithm:lo,parameters:br.serialize(ho)});var Bo=new dn({algorithm:zn,parameters:br.serialize(qt.toASN(new Uint8Array([218,57,163,238,94,107,75,13,50,85,191,239,149,96,24,144,175,216,7,9]).buffer))});var wo=po(Gn);var Eo=po(Qn);var Io=po(Jn);var Po=po($n);var Do=po(Yn);var ko=po(eo);var xo=po(Zn);var _o=po(Xn);var Oo=po(Yn);var To=po(eo);var No=function(){function e(e){if(e===void 0){e={}}this.hashAlgorithm=new dn(ho);this.maskGenAlgorithm=new dn({algorithm:lo,parameters:br.serialize(ho)});this.pSourceAlgorithm=new dn(Bo);Object.assign(this,e)}return e}();Br([gr({type:dn,context:0,defaultValue:ho})],No.prototype,"hashAlgorithm",void 0);Br([gr({type:dn,context:1,defaultValue:bo})],No.prototype,"maskGenAlgorithm",void 0);Br([gr({type:dn,context:2,defaultValue:Bo})],No.prototype,"pSourceAlgorithm",void 0);var Ro=new dn({algorithm:qn,parameters:br.serialize(new No)});var Mo=function(){function e(e){if(e===void 0){e={}}this.hashAlgorithm=new dn(ho);this.maskGenAlgorithm=new dn({algorithm:lo,parameters:br.serialize(ho)});this.saltLength=20;this.trailerField=1;Object.assign(this,e)}return e}();Br([gr({type:dn,context:0,defaultValue:ho})],Mo.prototype,"hashAlgorithm",void 0);Br([gr({type:dn,context:1,defaultValue:bo})],Mo.prototype,"maskGenAlgorithm",void 0);Br([gr({type:Ht.Integer,context:2,defaultValue:20})],Mo.prototype,"saltLength",void 0);Br([gr({type:Ht.Integer,context:3,defaultValue:1})],Mo.prototype,"trailerField",void 0);var Ho=new dn({algorithm:Wn,parameters:br.serialize(new Mo)});var Lo=function(){function e(e){if(e===void 0){e={}}this.digestAlgorithm=new dn;this.digest=new lr;Object.assign(this,e)}return e}();Br([gr({type:dn})],Lo.prototype,"digestAlgorithm",void 0);Br([gr({type:lr})],Lo.prototype,"digest",void 0);var Uo;var Vo=function(){function e(e){if(e===void 0){e={}}this.prime=new ArrayBuffer(0);this.exponent=new ArrayBuffer(0);this.coefficient=new ArrayBuffer(0);Object.assign(this,e)}return e}();Br([gr({type:Ht.Integer,converter:jt})],Vo.prototype,"prime",void 0);Br([gr({type:Ht.Integer,converter:jt})],Vo.prototype,"exponent",void 0);Br([gr({type:Ht.Integer,converter:jt})],Vo.prototype,"coefficient",void 0);var jo=Uo=function(e){__extends(t,e);function t(t){var r=e.call(this,t)||this;Object.setPrototypeOf(r,Uo.prototype);return r}return t}(Ar);jo=Uo=Br([yr({type:Mt.Sequence,itemType:Vo})],jo);var Fo=function(){function e(e){if(e===void 0){e={}}this.version=0;this.modulus=new ArrayBuffer(0);this.publicExponent=new ArrayBuffer(0);this.privateExponent=new ArrayBuffer(0);this.prime1=new ArrayBuffer(0);this.prime2=new ArrayBuffer(0);this.exponent1=new ArrayBuffer(0);this.exponent2=new ArrayBuffer(0);this.coefficient=new ArrayBuffer(0);Object.assign(this,e)}return e}();Br([gr({type:Ht.Integer})],Fo.prototype,"version",void 0);Br([gr({type:Ht.Integer,converter:jt})],Fo.prototype,"modulus",void 0);Br([gr({type:Ht.Integer,converter:jt})],Fo.prototype,"publicExponent",void 0);Br([gr({type:Ht.Integer,converter:jt})],Fo.prototype,"privateExponent",void 0);Br([gr({type:Ht.Integer,converter:jt})],Fo.prototype,"prime1",void 0);Br([gr({type:Ht.Integer,converter:jt})],Fo.prototype,"prime2",void 0);Br([gr({type:Ht.Integer,converter:jt})],Fo.prototype,"exponent1",void 0);Br([gr({type:Ht.Integer,converter:jt})],Fo.prototype,"exponent2",void 0);Br([gr({type:Ht.Integer,converter:jt})],Fo.prototype,"coefficient",void 0);Br([gr({type:jo,optional:true})],Fo.prototype,"otherPrimeInfos",void 0);var Ko=function(){function e(e){if(e===void 0){e={}}this.modulus=new ArrayBuffer(0);this.publicExponent=new ArrayBuffer(0);Object.assign(this,e)}return e}();e("R",Ko);Br([gr({type:Ht.Integer,converter:jt})],Ko.prototype,"modulus",void 0);Br([gr({type:Ht.Integer,converter:jt})],Ko.prototype,"publicExponent",void 0);
|
|
37
|
+
*/function g(){if(typeof BigInt==="undefined"){throw new Error("BigInt is not defined. Your environment doesn't implement BigInt.")}}function S(e){var t=0;var r=0;for(var i=0;i<e.length;i++){var n=e[i];t+=n.byteLength}var o=new Uint8Array(t);for(var i=0;i<e.length;i++){var n=e[i];o.set(new Uint8Array(n),r);r+=n.byteLength}return o.buffer}function m(e,t,r,i){if(!(t instanceof Uint8Array)){e.error="Wrong parameter: inputBuffer must be 'Uint8Array'";return false}if(!t.byteLength){e.error="Wrong parameter: inputBuffer has zero length";return false}if(r<0){e.error="Wrong parameter: inputOffset less than zero";return false}if(i<0){e.error="Wrong parameter: inputLength less than zero";return false}if(t.byteLength-r-i<0){e.error="End of input reached before message was fully decoded (inconsistent offset and length values)";return false}return true}var C=function(){function e(){this.items=[]}e.prototype.write=function(e){this.items.push(e)};e.prototype.final=function(){return S(this.items)};return e}();var A=[new Uint8Array([1])];var b="0123456789";var B="name";var w="valueHexView";var E="isHexOnly";var I="idBlock";var P="tagClass";var D="tagNumber";var k="isConstructed";var x="fromBER";var _="toBER";var O="local";var T="";var N=new ArrayBuffer(0);var R=new Uint8Array(0);var M="EndOfContent";var H="OCTET STRING";var L="BIT STRING";function U(e){var t;return t=function(e){__extends(t,e);function t(){var t=[];for(var r=0;r<arguments.length;r++){t[r]=arguments[r]}var i=this;var n;i=e.apply(this,t)||this;var o=t[0]||{};i.isHexOnly=(n=o.isHexOnly)!==null&&n!==void 0?n:false;i.valueHexView=o.valueHex?s.toUint8Array(o.valueHex):R;return i}Object.defineProperty(t.prototype,"valueHex",{get:function(){return this.valueHexView.slice().buffer},set:function(e){this.valueHexView=new Uint8Array(e)},enumerable:false,configurable:true});t.prototype.fromBER=function(e,t,r){var i=e instanceof ArrayBuffer?new Uint8Array(e):e;if(!m(this,i,t,r)){return-1}var n=t+r;this.valueHexView=i.subarray(t,n);if(!this.valueHexView.length){this.warnings.push("Zero buffer length");return t}this.blockLength=r;return n};t.prototype.toBER=function(e){if(e===void 0){e=false}if(!this.isHexOnly){this.error="Flag 'isHexOnly' is not set, abort";return N}if(e){return new ArrayBuffer(this.valueHexView.byteLength)}return this.valueHexView.byteLength===this.valueHexView.buffer.byteLength?this.valueHexView.buffer:this.valueHexView.slice().buffer};t.prototype.toJSON=function(){return __assign(__assign({},e.prototype.toJSON.call(this)),{isHexOnly:this.isHexOnly,valueHex:u.ToHex(this.valueHexView)})};return t}(e),t.NAME="hexBlock",t}var V=function(){function e(e){var t=e===void 0?{}:e,r=t.blockLength,i=r===void 0?0:r,n=t.error,o=n===void 0?T:n,a=t.warnings,u=a===void 0?[]:a,c=t.valueBeforeDecode,l=c===void 0?R:c;this.blockLength=i;this.error=o;this.warnings=u;this.valueBeforeDecodeView=s.toUint8Array(l)}e.blockName=function(){return this.NAME};Object.defineProperty(e.prototype,"valueBeforeDecode",{get:function(){return this.valueBeforeDecodeView.slice().buffer},set:function(e){this.valueBeforeDecodeView=new Uint8Array(e)},enumerable:false,configurable:true});e.prototype.toJSON=function(){return{blockName:this.constructor.NAME,blockLength:this.blockLength,error:this.error,warnings:this.warnings,valueBeforeDecode:u.ToHex(this.valueBeforeDecodeView)}};return e}();V.NAME="baseBlock";var j=function(e){__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}t.prototype.fromBER=function(e,t,r){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")};t.prototype.toBER=function(e,t){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")};return t}(V);j.NAME="valueBlock";var F=function(e){__extends(t,e);function t(t){var r=(t===void 0?{}:t).idBlock,i=r===void 0?{}:r;var n=this;var o,a,u,c;n=e.call(this)||this;if(i){n.isHexOnly=(o=i.isHexOnly)!==null&&o!==void 0?o:false;n.valueHexView=i.valueHex?s.toUint8Array(i.valueHex):R;n.tagClass=(a=i.tagClass)!==null&&a!==void 0?a:-1;n.tagNumber=(u=i.tagNumber)!==null&&u!==void 0?u:-1;n.isConstructed=(c=i.isConstructed)!==null&&c!==void 0?c:false}else{n.tagClass=-1;n.tagNumber=-1;n.isConstructed=false}return n}t.prototype.toBER=function(e){if(e===void 0){e=false}var t=0;switch(this.tagClass){case 1:t|=0;break;case 2:t|=64;break;case 3:t|=128;break;case 4:t|=192;break;default:this.error="Unknown tag class";return N}if(this.isConstructed)t|=32;if(this.tagNumber<31&&!this.isHexOnly){var r=new Uint8Array(1);if(!e){var i=this.tagNumber;i&=31;t|=i;r[0]=t}return r.buffer}if(!this.isHexOnly){var n=p(this.tagNumber,7);var o=new Uint8Array(n);var a=n.byteLength;var s=new Uint8Array(a+1);s[0]=t|31;if(!e){for(var u=0;u<a-1;u++)s[u+1]=o[u]|128;s[a]=o[a-1]}return s.buffer}var c=new Uint8Array(this.valueHexView.byteLength+1);c[0]=t|31;if(!e){var l=this.valueHexView;for(var u=0;u<l.length-1;u++)c[u+1]=l[u]|128;c[this.valueHexView.byteLength]=l[l.length-1]}return c.buffer};t.prototype.fromBER=function(e,t,r){var i=s.toUint8Array(e);if(!m(this,i,t,r)){return-1}var n=i.subarray(t,t+r);if(n.length===0){this.error="Zero buffer length";return-1}var o=n[0]&192;switch(o){case 0:this.tagClass=1;break;case 64:this.tagClass=2;break;case 128:this.tagClass=3;break;case 192:this.tagClass=4;break;default:this.error="Unknown tag class";return-1}this.isConstructed=(n[0]&32)===32;this.isHexOnly=false;var a=n[0]&31;if(a!==31){this.tagNumber=a;this.blockLength=1}else{var u=1;var c=this.valueHexView=new Uint8Array(255);var p=255;while(n[u]&128){c[u-1]=n[u]&127;u++;if(u>=n.length){this.error="End of input reached before message was fully decoded";return-1}if(u===p){p+=255;var f=new Uint8Array(p);for(var v=0;v<c.length;v++)f[v]=c[v];c=this.valueHexView=new Uint8Array(p)}}this.blockLength=u+1;c[u-1]=n[u]&127;var h=new Uint8Array(u);for(var v=0;v<u;v++)h[v]=c[v];c=this.valueHexView=new Uint8Array(u);c.set(h);if(this.blockLength<=9)this.tagNumber=l(c,7);else{this.isHexOnly=true;this.warnings.push("Tag too long, represented as hex-coded")}}if(this.tagClass===1&&this.isConstructed){switch(this.tagNumber){case 1:case 2:case 5:case 6:case 9:case 13:case 14:case 23:case 24:case 31:case 32:case 33:case 34:this.error="Constructed encoding used for primitive type";return-1}}return t+this.blockLength};t.prototype.toJSON=function(){return __assign(__assign({},e.prototype.toJSON.call(this)),{tagClass:this.tagClass,tagNumber:this.tagNumber,isConstructed:this.isConstructed})};return t}(U(V));F.NAME="identificationBlock";var K=function(e){__extends(t,e);function t(t){var r=(t===void 0?{}:t).lenBlock,i=r===void 0?{}:r;var n=this;var o,a,s;n=e.call(this)||this;n.isIndefiniteForm=(o=i.isIndefiniteForm)!==null&&o!==void 0?o:false;n.longFormUsed=(a=i.longFormUsed)!==null&&a!==void 0?a:false;n.length=(s=i.length)!==null&&s!==void 0?s:0;return n}t.prototype.fromBER=function(e,t,r){var i=s.toUint8Array(e);if(!m(this,i,t,r)){return-1}var n=i.subarray(t,t+r);if(n.length===0){this.error="Zero buffer length";return-1}if(n[0]===255){this.error="Length block 0xFF is reserved by standard";return-1}this.isIndefiniteForm=n[0]===128;if(this.isIndefiniteForm){this.blockLength=1;return t+this.blockLength}this.longFormUsed=!!(n[0]&128);if(this.longFormUsed===false){this.length=n[0];this.blockLength=1;return t+this.blockLength}var o=n[0]&127;if(o>8){this.error="Too big integer";return-1}if(o+1>n.length){this.error="End of input reached before message was fully decoded";return-1}var a=t+1;var u=i.subarray(a,a+o);if(u[o-1]===0)this.warnings.push("Needlessly long encoded length");this.length=l(u,8);if(this.longFormUsed&&this.length<=127)this.warnings.push("Unnecessary usage of long length form");this.blockLength=o+1;return t+this.blockLength};t.prototype.toBER=function(e){if(e===void 0){e=false}var t;var r;if(this.length>127)this.longFormUsed=true;if(this.isIndefiniteForm){t=new ArrayBuffer(1);if(e===false){r=new Uint8Array(t);r[0]=128}return t}if(this.longFormUsed){var i=p(this.length,8);if(i.byteLength>127){this.error="Too big length";return N}t=new ArrayBuffer(i.byteLength+1);if(e)return t;var n=new Uint8Array(i);r=new Uint8Array(t);r[0]=i.byteLength|128;for(var o=0;o<i.byteLength;o++)r[o+1]=n[o];return t}t=new ArrayBuffer(1);if(e===false){r=new Uint8Array(t);r[0]=this.length}return t};t.prototype.toJSON=function(){return __assign(__assign({},e.prototype.toJSON.call(this)),{isIndefiniteForm:this.isIndefiniteForm,longFormUsed:this.longFormUsed,length:this.length})};return t}(V);K.NAME="lengthBlock";var G={};var q=function(e){__extends(t,e);function t(t,r){if(t===void 0){t={}}var i=t.name,n=i===void 0?T:i,o=t.optional,a=o===void 0?false:o,s=t.primitiveSchema,u=__rest(t,["name","optional","primitiveSchema"]);var c=e.call(this,u)||this;c.name=n;c.optional=a;if(s){c.primitiveSchema=s}c.idBlock=new F(u);c.lenBlock=new K(u);c.valueBlock=r?new r(u):new j(u);return c}t.prototype.fromBER=function(e,t,r){var i=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?r:this.lenBlock.length);if(i===-1){this.error=this.valueBlock.error;return i}if(!this.idBlock.error.length)this.blockLength+=this.idBlock.blockLength;if(!this.lenBlock.error.length)this.blockLength+=this.lenBlock.blockLength;if(!this.valueBlock.error.length)this.blockLength+=this.valueBlock.blockLength;return i};t.prototype.toBER=function(e,t){var r=t||new C;if(!t){z(this)}var i=this.idBlock.toBER(e);r.write(i);if(this.lenBlock.isIndefiniteForm){r.write(new Uint8Array([128]).buffer);this.valueBlock.toBER(e,r);r.write(new ArrayBuffer(2))}else{var n=this.valueBlock.toBER(e);this.lenBlock.length=n.byteLength;var o=this.lenBlock.toBER(e);r.write(o);r.write(n)}if(!t){return r.final()}return N};t.prototype.toJSON=function(){var t=__assign(__assign({},e.prototype.toJSON.call(this)),{idBlock:this.idBlock.toJSON(),lenBlock:this.lenBlock.toJSON(),valueBlock:this.valueBlock.toJSON(),name:this.name,optional:this.optional});if(this.primitiveSchema)t.primitiveSchema=this.primitiveSchema.toJSON();return t};t.prototype.toString=function(e){if(e===void 0){e="ascii"}if(e==="ascii"){return this.onAsciiEncoding()}return u.ToHex(this.toBER())};t.prototype.onAsciiEncoding=function(){return this.constructor.NAME+" : "+u.ToHex(this.valueBlock.valueBeforeDecodeView)};t.prototype.isEqual=function(e){if(this===e){return true}if(!(e instanceof this.constructor)){return false}var t=this.toBER();var r=e.toBER();return d(t,r)};return t}(V);q.NAME="BaseBlock";function z(e){if(e instanceof G.Constructed){for(var t=0,r=e.valueBlock.value;t<r.length;t++){var i=r[t];if(z(i)){e.lenBlock.isIndefiniteForm=true}}}return!!e.lenBlock.isIndefiniteForm}var W=function(e){__extends(t,e);function t(t,r){if(t===void 0){t={}}var i=t.value,n=i===void 0?T:i,o=__rest(t,["value"]);var a=e.call(this,o,r)||this;if(n){a.fromString(n)}return a}t.prototype.getValue=function(){return this.valueBlock.value};t.prototype.setValue=function(e){this.valueBlock.value=e};t.prototype.fromBER=function(e,t,r){var i=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?r:this.lenBlock.length);if(i===-1){this.error=this.valueBlock.error;return i}this.fromBuffer(this.valueBlock.valueHexView);if(!this.idBlock.error.length)this.blockLength+=this.idBlock.blockLength;if(!this.lenBlock.error.length)this.blockLength+=this.lenBlock.blockLength;if(!this.valueBlock.error.length)this.blockLength+=this.valueBlock.blockLength;return i};t.prototype.onAsciiEncoding=function(){return this.constructor.NAME+" : '"+this.valueBlock.value+"'"};return t}(q);W.NAME="BaseStringBlock";var Q=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=t.isHexOnly,i=r===void 0?true:r,n=__rest(t,["isHexOnly"]);var o=e.call(this,n)||this;o.isHexOnly=i;return o}return t}(U(j));Q.NAME="PrimitiveValueBlock";var J;var $=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t,Q)||this;r.idBlock.isConstructed=false;return r}return t}(q);J=$;(function(){G.Primitive=J})();$.NAME="PRIMITIVE";function Z(e,t){if(e instanceof t){return e}var r=new t;r.idBlock=e.idBlock;r.lenBlock=e.lenBlock;r.warnings=e.warnings;r.valueBeforeDecodeView=e.valueBeforeDecodeView;return r}function X(e,t,r){if(t===void 0){t=0}if(r===void 0){r=e.length}var i=t;var n=new q({},j);var o=new V;if(!m(o,e,t,r)){n.error=o.error;return{offset:-1,result:n}}var a=e.subarray(t,t+r);if(!a.length){n.error="Zero buffer length";return{offset:-1,result:n}}var s=n.idBlock.fromBER(e,t,r);if(n.idBlock.warnings.length){n.warnings.concat(n.idBlock.warnings)}if(s===-1){n.error=n.idBlock.error;return{offset:-1,result:n}}t=s;r-=n.idBlock.blockLength;s=n.lenBlock.fromBER(e,t,r);if(n.lenBlock.warnings.length){n.warnings.concat(n.lenBlock.warnings)}if(s===-1){n.error=n.lenBlock.error;return{offset:-1,result:n}}t=s;r-=n.lenBlock.blockLength;if(!n.idBlock.isConstructed&&n.lenBlock.isIndefiniteForm){n.error="Indefinite length form used for primitive encoding form";return{offset:-1,result:n}}var u=q;switch(n.idBlock.tagClass){case 1:if(n.idBlock.tagNumber>=37&&n.idBlock.isHexOnly===false){n.error="UNIVERSAL 37 and upper tags are reserved by ASN.1 standard";return{offset:-1,result:n}}switch(n.idBlock.tagNumber){case 0:if(n.idBlock.isConstructed&&n.lenBlock.length>0){n.error="Type [UNIVERSAL 0] is reserved";return{offset:-1,result:n}}u=G.EndOfContent;break;case 1:u=G.Boolean;break;case 2:u=G.Integer;break;case 3:u=G.BitString;break;case 4:u=G.OctetString;break;case 5:u=G.Null;break;case 6:u=G.ObjectIdentifier;break;case 10:u=G.Enumerated;break;case 12:u=G.Utf8String;break;case 13:u=G.RelativeObjectIdentifier;break;case 14:u=G.TIME;break;case 15:n.error="[UNIVERSAL 15] is reserved by ASN.1 standard";return{offset:-1,result:n};case 16:u=G.Sequence;break;case 17:u=G.Set;break;case 18:u=G.NumericString;break;case 19:u=G.PrintableString;break;case 20:u=G.TeletexString;break;case 21:u=G.VideotexString;break;case 22:u=G.IA5String;break;case 23:u=G.UTCTime;break;case 24:u=G.GeneralizedTime;break;case 25:u=G.GraphicString;break;case 26:u=G.VisibleString;break;case 27:u=G.GeneralString;break;case 28:u=G.UniversalString;break;case 29:u=G.CharacterString;break;case 30:u=G.BmpString;break;case 31:u=G.DATE;break;case 32:u=G.TimeOfDay;break;case 33:u=G.DateTime;break;case 34:u=G.Duration;break;default:{var c=n.idBlock.isConstructed?new G.Constructed:new G.Primitive;c.idBlock=n.idBlock;c.lenBlock=n.lenBlock;c.warnings=n.warnings;n=c}}break;case 2:case 3:case 4:default:{u=n.idBlock.isConstructed?G.Constructed:G.Primitive}}n=Z(n,u);s=n.fromBER(e,t,n.lenBlock.isIndefiniteForm?r:n.lenBlock.length);n.valueBeforeDecodeView=e.subarray(i,i+n.blockLength);return{offset:s,result:n}}function Y(e){if(!e.byteLength){var t=new q({},j);t.error="Input buffer has zero length";return{offset:-1,result:t}}return X(s.toUint8Array(e).slice(),0,e.byteLength)}function ee(e,t){if(e){return 1}return t}var te=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=t.value,i=r===void 0?[]:r,n=t.isIndefiniteForm,o=n===void 0?false:n,a=__rest(t,["value","isIndefiniteForm"]);var s=e.call(this,a)||this;s.value=i;s.isIndefiniteForm=o;return s}t.prototype.fromBER=function(e,t,r){var i=s.toUint8Array(e);if(!m(this,i,t,r)){return-1}this.valueBeforeDecodeView=i.subarray(t,t+r);if(this.valueBeforeDecodeView.length===0){this.warnings.push("Zero buffer length");return t}var n=t;while(ee(this.isIndefiniteForm,r)>0){var o=X(i,n,r);if(o.offset===-1){this.error=o.result.error;this.warnings.concat(o.result.warnings);return-1}n=o.offset;this.blockLength+=o.result.blockLength;r-=o.result.blockLength;this.value.push(o.result);if(this.isIndefiniteForm&&o.result.constructor.NAME===M){break}}if(this.isIndefiniteForm){if(this.value[this.value.length-1].constructor.NAME===M){this.value.pop()}else{this.warnings.push("No EndOfContent block encoded")}}return n};t.prototype.toBER=function(e,t){var r=t||new C;for(var i=0;i<this.value.length;i++){this.value[i].toBER(e,r)}if(!t){return r.final()}return N};t.prototype.toJSON=function(){var t=__assign(__assign({},e.prototype.toJSON.call(this)),{isIndefiniteForm:this.isIndefiniteForm,value:[]});for(var r=0,i=this.value;r<i.length;r++){var n=i[r];t.value.push(n.toJSON())}return t};return t}(j);te.NAME="ConstructedValueBlock";var re;var ie=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t,te)||this;r.idBlock.isConstructed=true;return r}t.prototype.fromBER=function(e,t,r){this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm;var i=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?r:this.lenBlock.length);if(i===-1){this.error=this.valueBlock.error;return i}if(!this.idBlock.error.length)this.blockLength+=this.idBlock.blockLength;if(!this.lenBlock.error.length)this.blockLength+=this.lenBlock.blockLength;if(!this.valueBlock.error.length)this.blockLength+=this.valueBlock.blockLength;return i};t.prototype.onAsciiEncoding=function(){var e=[];for(var t=0,r=this.valueBlock.value;t<r.length;t++){var i=r[t];e.push(i.toString("ascii").split("\n").map((function(e){return" "+e})).join("\n"))}var n=this.idBlock.tagClass===3?"["+this.idBlock.tagNumber+"]":this.constructor.NAME;return e.length?n+" :\n"+e.join("\n"):n+" :"};return t}(q);re=ie;(function(){G.Constructed=re})();ie.NAME="CONSTRUCTED";var ne=function(e){__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}t.prototype.fromBER=function(e,t,r){return t};t.prototype.toBER=function(e){return N};return t}(j);ne.override="EndOfContentValueBlock";var oe;var ae=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t,ne)||this;r.idBlock.tagClass=1;r.idBlock.tagNumber=0;return r}return t}(q);oe=ae;(function(){G.EndOfContent=oe})();ae.NAME=M;var se;var ue=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t,j)||this;r.idBlock.tagClass=1;r.idBlock.tagNumber=5;return r}t.prototype.fromBER=function(e,t,r){if(this.lenBlock.length>0)this.warnings.push("Non-zero length of value block for Null type");if(!this.idBlock.error.length)this.blockLength+=this.idBlock.blockLength;if(!this.lenBlock.error.length)this.blockLength+=this.lenBlock.blockLength;this.blockLength+=r;if(t+r>e.byteLength){this.error="End of input reached before message was fully decoded (inconsistent offset and length values)";return-1}return t+r};t.prototype.toBER=function(e,t){var r=new ArrayBuffer(2);if(!e){var i=new Uint8Array(r);i[0]=5;i[1]=0}if(t){t.write(r)}return r};t.prototype.onAsciiEncoding=function(){return""+this.constructor.NAME};return t}(q);se=ue;(function(){G.Null=se})();ue.NAME="NULL";var ce=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=t.value,i=__rest(t,["value"]);var n=e.call(this,i)||this;if(i.valueHex){n.valueHexView=s.toUint8Array(i.valueHex)}else{n.valueHexView=new Uint8Array(1)}if(r){n.value=r}return n}Object.defineProperty(t.prototype,"value",{get:function(){for(var e=0,t=this.valueHexView;e<t.length;e++){var r=t[e];if(r>0){return true}}return false},set:function(e){this.valueHexView[0]=e?255:0},enumerable:false,configurable:true});t.prototype.fromBER=function(e,t,r){var i=s.toUint8Array(e);if(!m(this,i,t,r)){return-1}this.valueHexView=i.subarray(t,t+r);if(r>1)this.warnings.push("Boolean value encoded in more then 1 octet");this.isHexOnly=true;v.call(this);this.blockLength=r;return t+r};t.prototype.toBER=function(){return this.valueHexView.slice()};t.prototype.toJSON=function(){return __assign(__assign({},e.prototype.toJSON.call(this)),{value:this.value})};return t}(U(j));ce.NAME="BooleanValueBlock";var le;var pe=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t,ce)||this;r.idBlock.tagClass=1;r.idBlock.tagNumber=1;return r}t.prototype.getValue=function(){return this.valueBlock.value};t.prototype.setValue=function(e){this.valueBlock.value=e};t.prototype.onAsciiEncoding=function(){return this.constructor.NAME+" : "+this.getValue};return t}(q);le=pe;(function(){G.Boolean=le})();pe.NAME="BOOLEAN";var fe=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=t.isConstructed,i=r===void 0?false:r,n=__rest(t,["isConstructed"]);var o=e.call(this,n)||this;o.isConstructed=i;return o}t.prototype.fromBER=function(t,r,i){var n=0;if(this.isConstructed){this.isHexOnly=false;n=te.prototype.fromBER.call(this,t,r,i);if(n===-1)return n;for(var o=0;o<this.value.length;o++){var a=this.value[o].constructor.NAME;if(a===M){if(this.isIndefiniteForm)break;else{this.error="EndOfContent is unexpected, OCTET STRING may consists of OCTET STRINGs only";return-1}}if(a!==H){this.error="OCTET STRING may consists of OCTET STRINGs only";return-1}}}else{this.isHexOnly=true;n=e.prototype.fromBER.call(this,t,r,i);this.blockLength=i}return n};t.prototype.toBER=function(e,t){if(this.isConstructed)return te.prototype.toBER.call(this,e,t);return e?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.slice().buffer};t.prototype.toJSON=function(){return __assign(__assign({},e.prototype.toJSON.call(this)),{isConstructed:this.isConstructed})};return t}(U(te));fe.NAME="OctetStringValueBlock";var ve;var he=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=t.idBlock,i=r===void 0?{}:r,n=t.lenBlock,o=n===void 0?{}:n,a=__rest(t,["idBlock","lenBlock"]);var s=this;var u,c;(u=a.isConstructed)!==null&&u!==void 0?u:a.isConstructed=!!((c=a.value)===null||c===void 0?void 0:c.length);s=e.call(this,__assign({idBlock:__assign({isConstructed:a.isConstructed},i),lenBlock:__assign(__assign({},o),{isIndefiniteForm:!!a.isIndefiniteForm})},a),fe)||this;s.idBlock.tagClass=1;s.idBlock.tagNumber=4;return s}t.prototype.fromBER=function(t,r,i){this.valueBlock.isConstructed=this.idBlock.isConstructed;this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm;if(i===0){if(this.idBlock.error.length===0)this.blockLength+=this.idBlock.blockLength;if(this.lenBlock.error.length===0)this.blockLength+=this.lenBlock.blockLength;return r}if(!this.valueBlock.isConstructed){var n=t instanceof ArrayBuffer?new Uint8Array(t):t;var o=n.subarray(r,r+i);try{if(o.byteLength){var a=X(o,0,o.byteLength);if(a.offset!==-1&&a.offset===i){this.valueBlock.value=[a.result]}}}catch(s){}}return e.prototype.fromBER.call(this,t,r,i)};t.prototype.onAsciiEncoding=function(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length){return ie.prototype.onAsciiEncoding.call(this)}return this.constructor.NAME+" : "+u.ToHex(this.valueBlock.valueHexView)};t.prototype.getValue=function(){if(!this.idBlock.isConstructed){return this.valueBlock.valueHexView.slice().buffer}var e=[];for(var r=0,i=this.valueBlock.value;r<i.length;r++){var n=i[r];if(n instanceof t){e.push(n.valueBlock.valueHexView)}}return s.concat(e)};return t}(q);ve=he;(function(){G.OctetString=ve})();he.NAME=H;var de=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=t.unusedBits,i=r===void 0?0:r,n=t.isConstructed,o=n===void 0?false:n,a=__rest(t,["unusedBits","isConstructed"]);var s=e.call(this,a)||this;s.unusedBits=i;s.isConstructed=o;s.blockLength=s.valueHexView.byteLength;return s}t.prototype.fromBER=function(e,t,r){if(!r){return t}var i=-1;if(this.isConstructed){i=te.prototype.fromBER.call(this,e,t,r);if(i===-1)return i;for(var n=0,o=this.value;n<o.length;n++){var a=o[n];var u=a.constructor.NAME;if(u===M){if(this.isIndefiniteForm)break;else{this.error="EndOfContent is unexpected, BIT STRING may consists of BIT STRINGs only";return-1}}if(u!==L){this.error="BIT STRING may consists of BIT STRINGs only";return-1}var c=a.valueBlock;if(this.unusedBits>0&&c.unusedBits>0){this.error='Using of "unused bits" inside constructive BIT STRING allowed for least one only';return-1}this.unusedBits=c.unusedBits}return i}var l=s.toUint8Array(e);if(!m(this,l,t,r)){return-1}var p=l.subarray(t,t+r);this.unusedBits=p[0];if(this.unusedBits>7){this.error="Unused bits for BitString must be in range 0-7";return-1}if(!this.unusedBits){var f=p.subarray(1);try{if(f.byteLength){var v=X(f,0,f.byteLength);if(v.offset!==-1&&v.offset===r-1){this.value=[v.result]}}}catch(h){}}this.valueHexView=p.subarray(1);this.blockLength=p.length;return t+r};t.prototype.toBER=function(e,t){if(this.isConstructed){return te.prototype.toBER.call(this,e,t)}if(e){return new ArrayBuffer(this.valueHexView.byteLength+1)}if(!this.valueHexView.byteLength){return N}var r=new Uint8Array(this.valueHexView.length+1);r[0]=this.unusedBits;r.set(this.valueHexView,1);return r.buffer};t.prototype.toJSON=function(){return __assign(__assign({},e.prototype.toJSON.call(this)),{unusedBits:this.unusedBits,isConstructed:this.isConstructed})};return t}(U(te));de.NAME="BitStringValueBlock";var ye;var ge=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=t.idBlock,i=r===void 0?{}:r,n=t.lenBlock,o=n===void 0?{}:n,a=__rest(t,["idBlock","lenBlock"]);var s=this;var u,c;(u=a.isConstructed)!==null&&u!==void 0?u:a.isConstructed=!!((c=a.value)===null||c===void 0?void 0:c.length);s=e.call(this,__assign({idBlock:__assign({isConstructed:a.isConstructed},i),lenBlock:__assign(__assign({},o),{isIndefiniteForm:!!a.isIndefiniteForm})},a),de)||this;s.idBlock.tagClass=1;s.idBlock.tagNumber=3;return s}t.prototype.fromBER=function(t,r,i){this.valueBlock.isConstructed=this.idBlock.isConstructed;this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm;return e.prototype.fromBER.call(this,t,r,i)};t.prototype.onAsciiEncoding=function(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length){return ie.prototype.onAsciiEncoding.call(this)}else{var e=[];var t=this.valueBlock.valueHexView;for(var r=0,i=t;r<i.length;r++){var n=i[r];e.push(n.toString(2).padStart(8,"0"))}var o=e.join("");return this.constructor.NAME+" : "+o.substring(0,o.length-this.valueBlock.unusedBits)}};return t}(q);ye=ge;(function(){G.BitString=ye})();ge.NAME=L;var Se;function me(e,t){var r=new Uint8Array([0]);var i=new Uint8Array(e);var n=new Uint8Array(t);var o=i.slice(0);var a=o.length-1;var s=n.slice(0);var u=s.length-1;var c=0;var l=u<a?a:u;var p=0;for(var v=l;v>=0;v--,p++){switch(true){case p<s.length:c=o[a-p]+s[u-p]+r[0];break;default:c=o[a-p]+r[0]}r[0]=c/10;switch(true){case p>=o.length:o=f(new Uint8Array([c%10]),o);break;default:o[a-p]=c%10}}if(r[0]>0)o=f(r,o);return o}function Ce(e){if(e>=A.length){for(var t=A.length;t<=e;t++){var r=new Uint8Array([0]);var i=A[t-1].slice(0);for(var n=i.length-1;n>=0;n--){var o=new Uint8Array([(i[n]<<1)+r[0]]);r[0]=o[0]/10;i[n]=o[0]%10}if(r[0]>0)i=f(r,i);A.push(i)}}return A[e]}function Ae(e,t){var r=0;var i=new Uint8Array(e);var n=new Uint8Array(t);var o=i.slice(0);var a=o.length-1;var s=n.slice(0);var u=s.length-1;var c;var l=0;for(var p=u;p>=0;p--,l++){c=o[a-l]-s[u-l]-r;switch(true){case c<0:r=1;o[a-l]=c+10;break;default:r=0;o[a-l]=c}}if(r>0){for(var p=a-u+1;p>=0;p--,l++){c=o[a-l]-r;if(c<0){r=1;o[a-l]=c+10}else{r=0;o[a-l]=c;break}}}return o.slice()}var be=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=t.value,i=__rest(t,["value"]);var n=e.call(this,i)||this;n._valueDec=0;if(i.valueHex){n.setValueHex()}if(r!==undefined){n.valueDec=r}return n}t.prototype.setValueHex=function(){if(this.valueHexView.length>=4){this.warnings.push("Too big Integer for decoding, hex only");this.isHexOnly=true;this._valueDec=0}else{this.isHexOnly=false;if(this.valueHexView.length>0){this._valueDec=v.call(this)}}};Object.defineProperty(t.prototype,"valueDec",{get:function(){return this._valueDec},set:function(e){this._valueDec=e;this.isHexOnly=false;this.valueHexView=new Uint8Array(h(e))},enumerable:false,configurable:true});t.prototype.fromDER=function(e,t,r,i){if(i===void 0){i=0}var n=this.fromBER(e,t,r);if(n===-1)return n;var o=this.valueHexView;if(o[0]===0&&(o[1]&128)!==0){this.valueHexView=o.subarray(1)}else{if(i!==0){if(o.length<i){if(i-o.length>1)i=o.length+1;this.valueHexView=o.subarray(i-o.length)}}}return n};t.prototype.toDER=function(e){if(e===void 0){e=false}var t=this.valueHexView;switch(true){case(t[0]&128)!==0:{var r=new Uint8Array(this.valueHexView.length+1);r[0]=0;r.set(t,1);this.valueHexView=r}break;case t[0]===0&&(t[1]&128)===0:{this.valueHexView=this.valueHexView.subarray(1)}break}return this.toBER(e)};t.prototype.fromBER=function(t,r,i){var n=e.prototype.fromBER.call(this,t,r,i);if(n===-1){return n}this.setValueHex();return n};t.prototype.toBER=function(e){return e?new ArrayBuffer(this.valueHexView.length):this.valueHexView.slice().buffer};t.prototype.toJSON=function(){return __assign(__assign({},e.prototype.toJSON.call(this)),{valueDec:this.valueDec})};t.prototype.toString=function(){var e=this.valueHexView.length*8-1;var t=new Uint8Array(this.valueHexView.length*8/3);var r=0;var i;var n=this.valueHexView;var o="";var a=false;for(var s=n.byteLength-1;s>=0;s--){i=n[s];for(var u=0;u<8;u++){if((i&1)===1){switch(r){case e:t=Ae(Ce(r),t);o="-";break;default:t=me(t,Ce(r))}}r++;i>>=1}}for(var u=0;u<t.length;u++){if(t[u])a=true;if(a)o+=b.charAt(t[u])}if(a===false)o+=b.charAt(0);return o};return t}(U(j));Se=be;be.NAME="IntegerValueBlock";(function(){Object.defineProperty(Se.prototype,"valueHex",{set:function(e){this.valueHexView=new Uint8Array(e);this.setValueHex()},get:function(){return this.valueHexView.slice().buffer}})})();var Be;var we=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t,be)||this;r.idBlock.tagClass=1;r.idBlock.tagNumber=2;return r}t.prototype.toBigInt=function(){g();return BigInt(this.valueBlock.toString())};t.fromBigInt=function(e){g();var r=BigInt(e);var i=new C;var n=r.toString(16).replace(/^-/,"");var o=new Uint8Array(u.FromHex(n));if(r<0){var a=new Uint8Array(o.length+(o[0]&128?1:0));a[0]|=128;var c=BigInt("0x"+u.ToHex(a));var l=c+r;var p=s.toUint8Array(u.FromHex(l.toString(16)));p[0]|=128;i.write(p)}else{if(o[0]&128){i.write(new Uint8Array([0]))}i.write(o)}var f=new t({valueHex:i.final()});return f};t.prototype.convertToDER=function(){var e=new t({valueHex:this.valueBlock.valueHexView});e.valueBlock.toDER();return e};t.prototype.convertFromDER=function(){return new t({valueHex:this.valueBlock.valueHexView[0]===0?this.valueBlock.valueHexView.subarray(1):this.valueBlock.valueHexView})};t.prototype.onAsciiEncoding=function(){return this.constructor.NAME+" : "+this.valueBlock.toString()};return t}(q);Be=we;(function(){G.Integer=Be})();we.NAME="INTEGER";var Ee;var Ie=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t)||this;r.idBlock.tagClass=1;r.idBlock.tagNumber=10;return r}return t}(we);Ee=Ie;(function(){G.Enumerated=Ee})();Ie.NAME="ENUMERATED";var Pe=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=t.valueDec,i=r===void 0?-1:r,n=t.isFirstSid,o=n===void 0?false:n,a=__rest(t,["valueDec","isFirstSid"]);var s=e.call(this,a)||this;s.valueDec=i;s.isFirstSid=o;return s}t.prototype.fromBER=function(e,t,r){if(!r){return t}var i=s.toUint8Array(e);if(!m(this,i,t,r)){return-1}var n=i.subarray(t,t+r);this.valueHexView=new Uint8Array(r);for(var o=0;o<r;o++){this.valueHexView[o]=n[o]&127;this.blockLength++;if((n[o]&128)===0)break}var a=new Uint8Array(this.blockLength);for(var o=0;o<this.blockLength;o++){a[o]=this.valueHexView[o]}this.valueHexView=a;if((n[this.blockLength-1]&128)!==0){this.error="End of input reached before message was fully decoded";return-1}if(this.valueHexView[0]===0)this.warnings.push("Needlessly long format of SID encoding");if(this.blockLength<=8)this.valueDec=l(this.valueHexView,7);else{this.isHexOnly=true;this.warnings.push("Too big SID for decoding, hex only")}return t+this.blockLength};Object.defineProperty(t.prototype,"valueBigInt",{set:function(e){g();var t=BigInt(e).toString(2);while(t.length%7){t="0"+t}var r=new Uint8Array(t.length/7);for(var i=0;i<r.length;i++){r[i]=parseInt(t.slice(i*7,i*7+7),2)+(i+1<r.length?128:0)}this.fromBER(r.buffer,0,r.length)},enumerable:false,configurable:true});t.prototype.toBER=function(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);var t=this.valueHexView;var r=new Uint8Array(this.blockLength);for(var i=0;i<this.blockLength-1;i++)r[i]=t[i]|128;r[this.blockLength-1]=t[this.blockLength-1];return r.buffer}var n=p(this.valueDec,7);if(n.byteLength===0){this.error="Error during encoding SID value";return N}var o=new Uint8Array(n.byteLength);if(!e){var a=new Uint8Array(n);var s=n.byteLength-1;for(var i=0;i<s;i++)o[i]=a[i]|128;o[s]=a[s]}return o};t.prototype.toString=function(){var e="";if(this.isHexOnly)e=u.ToHex(this.valueHexView);else{if(this.isFirstSid){var t=this.valueDec;if(this.valueDec<=39)e="0.";else{if(this.valueDec<=79){e="1.";t-=40}else{e="2.";t-=80}}e+=t.toString()}else e=this.valueDec.toString()}return e};t.prototype.toJSON=function(){return __assign(__assign({},e.prototype.toJSON.call(this)),{valueDec:this.valueDec,isFirstSid:this.isFirstSid})};return t}(U(j));Pe.NAME="sidBlock";var De=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=t.value,i=r===void 0?T:r,n=__rest(t,["value"]);var o=e.call(this,n)||this;o.value=[];if(i){o.fromString(i)}return o}t.prototype.fromBER=function(e,t,r){var i=t;while(r>0){var n=new Pe;i=n.fromBER(e,i,r);if(i===-1){this.blockLength=0;this.error=n.error;return i}if(this.value.length===0)n.isFirstSid=true;this.blockLength+=n.blockLength;r-=n.blockLength;this.value.push(n)}return i};t.prototype.toBER=function(e){var t=[];for(var r=0;r<this.value.length;r++){var i=this.value[r].toBER(e);if(i.byteLength===0){this.error=this.value[r].error;return N}t.push(i)}return S(t)};t.prototype.fromString=function(e){this.value=[];var t=0;var r=0;var i="";var n=false;do{r=e.indexOf(".",t);if(r===-1)i=e.substring(t);else i=e.substring(t,r);t=r+1;if(n){var o=this.value[0];var a=0;switch(o.valueDec){case 0:break;case 1:a=40;break;case 2:a=80;break;default:this.value=[];return}var s=parseInt(i,10);if(isNaN(s))return;o.valueDec=s+a;n=false}else{var o=new Pe;if(i>Number.MAX_SAFE_INTEGER){g();var u=BigInt(i);o.valueBigInt=u}else{o.valueDec=parseInt(i,10);if(isNaN(o.valueDec))return}if(!this.value.length){o.isFirstSid=true;n=true}this.value.push(o)}}while(r!==-1)};t.prototype.toString=function(){var e="";var t=false;for(var r=0;r<this.value.length;r++){t=this.value[r].isHexOnly;var i=this.value[r].toString();if(r!==0)e=e+".";if(t){i="{"+i+"}";if(this.value[r].isFirstSid)e="2.{"+i+" - 80}";else e+=i}else e+=i}return e};t.prototype.toJSON=function(){var t=__assign(__assign({},e.prototype.toJSON.call(this)),{value:this.toString(),sidArray:[]});for(var r=0;r<this.value.length;r++){t.sidArray.push(this.value[r].toJSON())}return t};return t}(j);De.NAME="ObjectIdentifierValueBlock";var ke;var xe=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t,De)||this;r.idBlock.tagClass=1;r.idBlock.tagNumber=6;return r}t.prototype.getValue=function(){return this.valueBlock.toString()};t.prototype.setValue=function(e){this.valueBlock.fromString(e)};t.prototype.onAsciiEncoding=function(){return this.constructor.NAME+" : "+(this.valueBlock.toString()||"empty")};t.prototype.toJSON=function(){return __assign(__assign({},e.prototype.toJSON.call(this)),{value:this.getValue()})};return t}(q);ke=xe;(function(){G.ObjectIdentifier=ke})();xe.NAME="OBJECT IDENTIFIER";var _e=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=t.valueDec,i=r===void 0?0:r,n=__rest(t,["valueDec"]);var o=e.call(this,n)||this;o.valueDec=i;return o}t.prototype.fromBER=function(e,t,r){if(r===0)return t;var i=s.toUint8Array(e);if(!m(this,i,t,r))return-1;var n=i.subarray(t,t+r);this.valueHexView=new Uint8Array(r);for(var o=0;o<r;o++){this.valueHexView[o]=n[o]&127;this.blockLength++;if((n[o]&128)===0)break}var a=new Uint8Array(this.blockLength);for(var o=0;o<this.blockLength;o++)a[o]=this.valueHexView[o];this.valueHexView=a;if((n[this.blockLength-1]&128)!==0){this.error="End of input reached before message was fully decoded";return-1}if(this.valueHexView[0]===0)this.warnings.push("Needlessly long format of SID encoding");if(this.blockLength<=8)this.valueDec=l(this.valueHexView,7);else{this.isHexOnly=true;this.warnings.push("Too big SID for decoding, hex only")}return t+this.blockLength};t.prototype.toBER=function(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);var t=this.valueHexView;var r=new Uint8Array(this.blockLength);for(var i=0;i<this.blockLength-1;i++)r[i]=t[i]|128;r[this.blockLength-1]=t[this.blockLength-1];return r.buffer}var n=p(this.valueDec,7);if(n.byteLength===0){this.error="Error during encoding SID value";return N}var o=new Uint8Array(n.byteLength);if(!e){var a=new Uint8Array(n);var s=n.byteLength-1;for(var i=0;i<s;i++)o[i]=a[i]|128;o[s]=a[s]}return o.buffer};t.prototype.toString=function(){var e="";if(this.isHexOnly)e=u.ToHex(this.valueHexView);else{e=this.valueDec.toString()}return e};t.prototype.toJSON=function(){return __assign(__assign({},e.prototype.toJSON.call(this)),{valueDec:this.valueDec})};return t}(U(V));_e.NAME="relativeSidBlock";var Oe=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=t.value,i=r===void 0?T:r,n=__rest(t,["value"]);var o=e.call(this,n)||this;o.value=[];if(i){o.fromString(i)}return o}t.prototype.fromBER=function(e,t,r){var i=t;while(r>0){var n=new _e;i=n.fromBER(e,i,r);if(i===-1){this.blockLength=0;this.error=n.error;return i}this.blockLength+=n.blockLength;r-=n.blockLength;this.value.push(n)}return i};t.prototype.toBER=function(e,t){var r=[];for(var i=0;i<this.value.length;i++){var n=this.value[i].toBER(e);if(n.byteLength===0){this.error=this.value[i].error;return N}r.push(n)}return S(r)};t.prototype.fromString=function(e){this.value=[];var t=0;var r=0;var i="";do{r=e.indexOf(".",t);if(r===-1)i=e.substring(t);else i=e.substring(t,r);t=r+1;var n=new _e;n.valueDec=parseInt(i,10);if(isNaN(n.valueDec))return true;this.value.push(n)}while(r!==-1);return true};t.prototype.toString=function(){var e="";var t=false;for(var r=0;r<this.value.length;r++){t=this.value[r].isHexOnly;var i=this.value[r].toString();if(r!==0)e=e+".";if(t){i="{"+i+"}";e+=i}else e+=i}return e};t.prototype.toJSON=function(){var t=__assign(__assign({},e.prototype.toJSON.call(this)),{value:this.toString(),sidArray:[]});for(var r=0;r<this.value.length;r++)t.sidArray.push(this.value[r].toJSON());return t};return t}(j);Oe.NAME="RelativeObjectIdentifierValueBlock";var Te;var Ne=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t,Oe)||this;r.idBlock.tagClass=1;r.idBlock.tagNumber=13;return r}t.prototype.getValue=function(){return this.valueBlock.toString()};t.prototype.setValue=function(e){this.valueBlock.fromString(e)};t.prototype.onAsciiEncoding=function(){return this.constructor.NAME+" : "+(this.valueBlock.toString()||"empty")};t.prototype.toJSON=function(){return __assign(__assign({},e.prototype.toJSON.call(this)),{value:this.getValue()})};return t}(q);Te=Ne;(function(){G.RelativeObjectIdentifier=Te})();Ne.NAME="RelativeObjectIdentifier";var Re;var Me=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t)||this;r.idBlock.tagClass=1;r.idBlock.tagNumber=16;return r}return t}(ie);Re=Me;(function(){G.Sequence=Re})();Me.NAME="SEQUENCE";var He;var Le=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t)||this;r.idBlock.tagClass=1;r.idBlock.tagNumber=17;return r}return t}(ie);He=Le;(function(){G.Set=He})();Le.NAME="SET";var Ue=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=__rest(t,[]);var i=e.call(this,r)||this;i.isHexOnly=true;i.value=T;return i}t.prototype.toJSON=function(){return __assign(__assign({},e.prototype.toJSON.call(this)),{value:this.value})};return t}(U(j));Ue.NAME="StringValueBlock";var Ve=function(e){__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(Ue);Ve.NAME="SimpleStringValueBlock";var je=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=__rest(t,[]);return e.call(this,r,Ve)||this}t.prototype.fromBuffer=function(e){this.valueBlock.value=String.fromCharCode.apply(null,s.toUint8Array(e))};t.prototype.fromString=function(e){var t=e.length;var r=this.valueBlock.valueHexView=new Uint8Array(t);for(var i=0;i<t;i++)r[i]=e.charCodeAt(i);this.valueBlock.value=e};return t}(W);je.NAME="SIMPLE STRING";var Fe=function(e){__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}t.prototype.fromBuffer=function(e){this.valueBlock.valueHexView=s.toUint8Array(e);try{this.valueBlock.value=u.ToUtf8String(e)}catch(t){this.warnings.push('Error during "decodeURIComponent": '+t+", using raw string");this.valueBlock.value=u.ToBinary(e)}};t.prototype.fromString=function(e){this.valueBlock.valueHexView=new Uint8Array(u.FromUtf8String(e));this.valueBlock.value=e};return t}(je);Fe.NAME="Utf8StringValueBlock";var Ke;var Ge=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t)||this;r.idBlock.tagClass=1;r.idBlock.tagNumber=12;return r}return t}(Fe);Ke=Ge;(function(){G.Utf8String=Ke})();Ge.NAME="UTF8String";var qe=function(e){__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}t.prototype.fromBuffer=function(e){this.valueBlock.value=u.ToUtf16String(e);this.valueBlock.valueHexView=s.toUint8Array(e)};t.prototype.fromString=function(e){this.valueBlock.value=e;this.valueBlock.valueHexView=new Uint8Array(u.FromUtf16String(e))};return t}(je);qe.NAME="BmpStringValueBlock";var ze;var We=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=__rest(t,[]);var i=e.call(this,r)||this;i.idBlock.tagClass=1;i.idBlock.tagNumber=30;return i}return t}(qe);ze=We;(function(){G.BmpString=ze})();We.NAME="BMPString";var Qe=function(e){__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}t.prototype.fromBuffer=function(e){var t=ArrayBuffer.isView(e)?e.slice().buffer:e.slice(0);var r=new Uint8Array(t);for(var i=0;i<r.length;i+=4){r[i]=r[i+3];r[i+1]=r[i+2];r[i+2]=0;r[i+3]=0}this.valueBlock.value=String.fromCharCode.apply(null,new Uint32Array(t))};t.prototype.fromString=function(e){var t=e.length;var r=this.valueBlock.valueHexView=new Uint8Array(t*4);for(var i=0;i<t;i++){var n=p(e.charCodeAt(i),8);var o=new Uint8Array(n);if(o.length>4)continue;var a=4-o.length;for(var s=o.length-1;s>=0;s--)r[i*4+s+a]=o[s]}this.valueBlock.value=e};return t}(je);Qe.NAME="UniversalStringValueBlock";var Je;var $e=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=__rest(t,[]);var i=e.call(this,r)||this;i.idBlock.tagClass=1;i.idBlock.tagNumber=28;return i}return t}(Qe);Je=$e;(function(){G.UniversalString=Je})();$e.NAME="UniversalString";var Ze;var Xe=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t)||this;r.idBlock.tagClass=1;r.idBlock.tagNumber=18;return r}return t}(je);Ze=Xe;(function(){G.NumericString=Ze})();Xe.NAME="NumericString";var Ye;var et=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t)||this;r.idBlock.tagClass=1;r.idBlock.tagNumber=19;return r}return t}(je);Ye=et;(function(){G.PrintableString=Ye})();et.NAME="PrintableString";var tt;var rt=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t)||this;r.idBlock.tagClass=1;r.idBlock.tagNumber=20;return r}return t}(je);tt=rt;(function(){G.TeletexString=tt})();rt.NAME="TeletexString";var it;var nt=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t)||this;r.idBlock.tagClass=1;r.idBlock.tagNumber=21;return r}return t}(je);it=nt;(function(){G.VideotexString=it})();nt.NAME="VideotexString";var ot;var at=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t)||this;r.idBlock.tagClass=1;r.idBlock.tagNumber=22;return r}return t}(je);ot=at;(function(){G.IA5String=ot})();at.NAME="IA5String";var st;var ut=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t)||this;r.idBlock.tagClass=1;r.idBlock.tagNumber=25;return r}return t}(je);st=ut;(function(){G.GraphicString=st})();ut.NAME="GraphicString";var ct;var lt=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t)||this;r.idBlock.tagClass=1;r.idBlock.tagNumber=26;return r}return t}(je);ct=lt;(function(){G.VisibleString=ct})();lt.NAME="VisibleString";var pt;var ft=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t)||this;r.idBlock.tagClass=1;r.idBlock.tagNumber=27;return r}return t}(je);pt=ft;(function(){G.GeneralString=pt})();ft.NAME="GeneralString";var vt;var ht=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t)||this;r.idBlock.tagClass=1;r.idBlock.tagNumber=29;return r}return t}(je);vt=ht;(function(){G.CharacterString=vt})();ht.NAME="CharacterString";var dt;var yt=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=t.value,i=t.valueDate,n=__rest(t,["value","valueDate"]);var o=e.call(this,n)||this;o.year=0;o.month=0;o.day=0;o.hour=0;o.minute=0;o.second=0;if(r){o.fromString(r);o.valueBlock.valueHexView=new Uint8Array(r.length);for(var a=0;a<r.length;a++)o.valueBlock.valueHexView[a]=r.charCodeAt(a)}if(i){o.fromDate(i);o.valueBlock.valueHexView=new Uint8Array(o.toBuffer())}o.idBlock.tagClass=1;o.idBlock.tagNumber=23;return o}t.prototype.fromBuffer=function(e){this.fromString(String.fromCharCode.apply(null,s.toUint8Array(e)))};t.prototype.toBuffer=function(){var e=this.toString();var t=new ArrayBuffer(e.length);var r=new Uint8Array(t);for(var i=0;i<e.length;i++)r[i]=e.charCodeAt(i);return t};t.prototype.fromDate=function(e){this.year=e.getUTCFullYear();this.month=e.getUTCMonth()+1;this.day=e.getUTCDate();this.hour=e.getUTCHours();this.minute=e.getUTCMinutes();this.second=e.getUTCSeconds()};t.prototype.toDate=function(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second))};t.prototype.fromString=function(e){var t=/(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})Z/gi;var r=t.exec(e);if(r===null){this.error="Wrong input string for conversion";return}var i=parseInt(r[1],10);if(i>=50)this.year=1900+i;else this.year=2e3+i;this.month=parseInt(r[2],10);this.day=parseInt(r[3],10);this.hour=parseInt(r[4],10);this.minute=parseInt(r[5],10);this.second=parseInt(r[6],10)};t.prototype.toString=function(t){if(t===void 0){t="iso"}if(t==="iso"){var r=new Array(7);r[0]=y(this.year<2e3?this.year-1900:this.year-2e3,2);r[1]=y(this.month,2);r[2]=y(this.day,2);r[3]=y(this.hour,2);r[4]=y(this.minute,2);r[5]=y(this.second,2);r[6]="Z";return r.join("")}return e.prototype.toString.call(this,t)};t.prototype.onAsciiEncoding=function(){return this.constructor.NAME+" : "+this.toDate().toISOString()};t.prototype.toJSON=function(){return __assign(__assign({},e.prototype.toJSON.call(this)),{year:this.year,month:this.month,day:this.day,hour:this.hour,minute:this.minute,second:this.second})};return t}(lt);dt=yt;(function(){G.UTCTime=dt})();yt.NAME="UTCTime";var gt;var St=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=this;var i;r=e.call(this,t)||this;(i=r.millisecond)!==null&&i!==void 0?i:r.millisecond=0;r.idBlock.tagClass=1;r.idBlock.tagNumber=24;return r}t.prototype.fromDate=function(t){e.prototype.fromDate.call(this,t);this.millisecond=t.getUTCMilliseconds()};t.prototype.toDate=function(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second,this.millisecond))};t.prototype.fromString=function(e){var t=false;var r="";var i="";var n=0;var o;var a=0;var s=0;if(e[e.length-1]==="Z"){r=e.substring(0,e.length-1);t=true}else{var u=new Number(e[e.length-1]);if(isNaN(u.valueOf()))throw new Error("Wrong input string for conversion");r=e}if(t){if(r.indexOf("+")!==-1)throw new Error("Wrong input string for conversion");if(r.indexOf("-")!==-1)throw new Error("Wrong input string for conversion")}else{var c=1;var l=r.indexOf("+");var p="";if(l===-1){l=r.indexOf("-");c=-1}if(l!==-1){p=r.substring(l+1);r=r.substring(0,l);if(p.length!==2&&p.length!==4)throw new Error("Wrong input string for conversion");var u=parseInt(p.substring(0,2),10);if(isNaN(u.valueOf()))throw new Error("Wrong input string for conversion");a=c*u;if(p.length===4){u=parseInt(p.substring(2,4),10);if(isNaN(u.valueOf()))throw new Error("Wrong input string for conversion");s=c*u}}}var f=r.indexOf(".");if(f===-1)f=r.indexOf(",");if(f!==-1){var v=new Number("0"+r.substring(f));if(isNaN(v.valueOf()))throw new Error("Wrong input string for conversion");n=v.valueOf();i=r.substring(0,f)}else i=r;switch(true){case i.length===8:o=/(\d{4})(\d{2})(\d{2})/gi;if(f!==-1)throw new Error("Wrong input string for conversion");break;case i.length===10:o=/(\d{4})(\d{2})(\d{2})(\d{2})/gi;if(f!==-1){var h=60*n;this.minute=Math.floor(h);h=60*(h-this.minute);this.second=Math.floor(h);h=1e3*(h-this.second);this.millisecond=Math.floor(h)}break;case i.length===12:o=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/gi;if(f!==-1){var h=60*n;this.second=Math.floor(h);h=1e3*(h-this.second);this.millisecond=Math.floor(h)}break;case i.length===14:o=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/gi;if(f!==-1){var h=1e3*n;this.millisecond=Math.floor(h)}break;default:throw new Error("Wrong input string for conversion")}var d=o.exec(i);if(d===null)throw new Error("Wrong input string for conversion");for(var y=1;y<d.length;y++){switch(y){case 1:this.year=parseInt(d[y],10);break;case 2:this.month=parseInt(d[y],10);break;case 3:this.day=parseInt(d[y],10);break;case 4:this.hour=parseInt(d[y],10)+a;break;case 5:this.minute=parseInt(d[y],10)+s;break;case 6:this.second=parseInt(d[y],10);break;default:throw new Error("Wrong input string for conversion")}}if(t===false){var g=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond);this.year=g.getUTCFullYear();this.month=g.getUTCMonth();this.day=g.getUTCDay();this.hour=g.getUTCHours();this.minute=g.getUTCMinutes();this.second=g.getUTCSeconds();this.millisecond=g.getUTCMilliseconds()}};t.prototype.toString=function(t){if(t===void 0){t="iso"}if(t==="iso"){var r=[];r.push(y(this.year,4));r.push(y(this.month,2));r.push(y(this.day,2));r.push(y(this.hour,2));r.push(y(this.minute,2));r.push(y(this.second,2));if(this.millisecond!==0){r.push(".");r.push(y(this.millisecond,3))}r.push("Z");return r.join("")}return e.prototype.toString.call(this,t)};t.prototype.toJSON=function(){return __assign(__assign({},e.prototype.toJSON.call(this)),{millisecond:this.millisecond})};return t}(yt);gt=St;(function(){G.GeneralizedTime=gt})();St.NAME="GeneralizedTime";var mt;var Ct=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t)||this;r.idBlock.tagClass=1;r.idBlock.tagNumber=31;return r}return t}(Ge);mt=Ct;(function(){G.DATE=mt})();Ct.NAME="DATE";var At;var bt=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t)||this;r.idBlock.tagClass=1;r.idBlock.tagNumber=32;return r}return t}(Ge);At=bt;(function(){G.TimeOfDay=At})();bt.NAME="TimeOfDay";var Bt;var wt=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t)||this;r.idBlock.tagClass=1;r.idBlock.tagNumber=33;return r}return t}(Ge);Bt=wt;(function(){G.DateTime=Bt})();wt.NAME="DateTime";var Et;var It=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t)||this;r.idBlock.tagClass=1;r.idBlock.tagNumber=34;return r}return t}(Ge);Et=It;(function(){G.Duration=Et})();It.NAME="Duration";var Pt;var Dt=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t)||this;r.idBlock.tagClass=1;r.idBlock.tagNumber=14;return r}return t}(Ge);Pt=Dt;(function(){G.TIME=Pt})();Dt.NAME="TIME";var kt=function(){function e(e){var t=e===void 0?{}:e,r=t.name,i=r===void 0?T:r,n=t.optional,o=n===void 0?false:n;this.name=i;this.optional=o}return e}();var xt=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=t.value,i=r===void 0?[]:r,n=__rest(t,["value"]);var o=e.call(this,n)||this;o.value=i;return o}return t}(kt);var _t=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=t.value,i=r===void 0?new kt:r,n=t.local,o=n===void 0?false:n,a=__rest(t,["value","local"]);var s=e.call(this,a)||this;s.value=i;s.local=o;return s}return t}(kt);var Ot=function(){function e(e){var t=(e===void 0?{}:e).data,r=t===void 0?R:t;this.dataView=s.toUint8Array(r)}Object.defineProperty(e.prototype,"data",{get:function(){return this.dataView.slice().buffer},set:function(e){this.dataView=s.toUint8Array(e)},enumerable:false,configurable:true});e.prototype.fromBER=function(e,t,r){var i=t+r;this.dataView=s.toUint8Array(e).subarray(t,i);return i};e.prototype.toBER=function(e){return this.dataView.slice().buffer};return e}();function Tt(e,t,r){if(r instanceof xt){for(var i=0;i<r.value.length;i++){var n=Tt(e,t,r.value[i]);if(n.verified){return{verified:true,result:e}}}{var o={verified:false,result:{error:"Wrong values for Choice type"}};if(r.hasOwnProperty(B))o.name=r.name;return o}}if(r instanceof kt){if(r.hasOwnProperty(B))e[r.name]=t;return{verified:true,result:e}}if(e instanceof Object===false){return{verified:false,result:{error:"Wrong root object"}}}if(t instanceof Object===false){return{verified:false,result:{error:"Wrong ASN.1 data"}}}if(r instanceof Object===false){return{verified:false,result:{error:"Wrong ASN.1 schema"}}}if(I in r===false){return{verified:false,result:{error:"Wrong ASN.1 schema"}}}if(x in r.idBlock===false){return{verified:false,result:{error:"Wrong ASN.1 schema"}}}if(_ in r.idBlock===false){return{verified:false,result:{error:"Wrong ASN.1 schema"}}}var a=r.idBlock.toBER(false);if(a.byteLength===0){return{verified:false,result:{error:"Error encoding idBlock for ASN.1 schema"}}}var s=r.idBlock.fromBER(a,0,a.byteLength);if(s===-1){return{verified:false,result:{error:"Error decoding idBlock for ASN.1 schema"}}}if(r.idBlock.hasOwnProperty(P)===false){return{verified:false,result:{error:"Wrong ASN.1 schema"}}}if(r.idBlock.tagClass!==t.idBlock.tagClass){return{verified:false,result:e}}if(r.idBlock.hasOwnProperty(D)===false){return{verified:false,result:{error:"Wrong ASN.1 schema"}}}if(r.idBlock.tagNumber!==t.idBlock.tagNumber){return{verified:false,result:e}}if(r.idBlock.hasOwnProperty(k)===false){return{verified:false,result:{error:"Wrong ASN.1 schema"}}}if(r.idBlock.isConstructed!==t.idBlock.isConstructed){return{verified:false,result:e}}if(!(E in r.idBlock)){return{verified:false,result:{error:"Wrong ASN.1 schema"}}}if(r.idBlock.isHexOnly!==t.idBlock.isHexOnly){return{verified:false,result:e}}if(r.idBlock.isHexOnly){if(w in r.idBlock===false){return{verified:false,result:{error:"Wrong ASN.1 schema"}}}var u=r.idBlock.valueHexView;var c=t.idBlock.valueHexView;if(u.length!==c.length){return{verified:false,result:e}}for(var l=0;l<u.length;l++){if(u[l]!==c[1]){return{verified:false,result:e}}}}if(r.name){r.name=r.name.replace(/^\s+|\s+$/g,T);if(r.name)e[r.name]=t}if(r instanceof G.Constructed){var p=0;var n={verified:false,result:{error:"Unknown error"}};var f=r.valueBlock.value.length;if(f>0){if(r.valueBlock.value[0]instanceof _t){f=t.valueBlock.value.length}}if(f===0){return{verified:true,result:e}}if(t.valueBlock.value.length===0&&r.valueBlock.value.length!==0){var v=true;for(var l=0;l<r.valueBlock.value.length;l++)v=v&&(r.valueBlock.value[l].optional||false);if(v){return{verified:true,result:e}}if(r.name){r.name=r.name.replace(/^\s+|\s+$/g,T);if(r.name)delete e[r.name]}e.error="Inconsistent object length";return{verified:false,result:e}}for(var l=0;l<f;l++){if(l-p>=t.valueBlock.value.length){if(r.valueBlock.value[l].optional===false){var o={verified:false,result:e};e.error="Inconsistent length between ASN.1 data and schema";if(r.name){r.name=r.name.replace(/^\s+|\s+$/g,T);if(r.name){delete e[r.name];o.name=r.name}}return o}}else{if(r.valueBlock.value[0]instanceof _t){n=Tt(e,t.valueBlock.value[l],r.valueBlock.value[0].value);if(n.verified===false){if(r.valueBlock.value[0].optional)p++;else{if(r.name){r.name=r.name.replace(/^\s+|\s+$/g,T);if(r.name)delete e[r.name]}return n}}if(B in r.valueBlock.value[0]&&r.valueBlock.value[0].name.length>0){var h={};if(O in r.valueBlock.value[0]&&r.valueBlock.value[0].local)h=t;else h=e;if(typeof h[r.valueBlock.value[0].name]==="undefined")h[r.valueBlock.value[0].name]=[];h[r.valueBlock.value[0].name].push(t.valueBlock.value[l])}}else{n=Tt(e,t.valueBlock.value[l-p],r.valueBlock.value[l]);if(n.verified===false){if(r.valueBlock.value[l].optional)p++;else{if(r.name){r.name=r.name.replace(/^\s+|\s+$/g,T);if(r.name)delete e[r.name]}return n}}}}}if(n.verified===false){var o={verified:false,result:e};if(r.name){r.name=r.name.replace(/^\s+|\s+$/g,T);if(r.name){delete e[r.name];o.name=r.name}}return o}return{verified:true,result:e}}if(r.primitiveSchema&&w in t.valueBlock){var d=X(t.valueBlock.valueHexView);if(d.offset===-1){var o={verified:false,result:d.result};if(r.name){r.name=r.name.replace(/^\s+|\s+$/g,T);if(r.name){delete e[r.name];o.name=r.name}}return o}return Tt(e,d.result,r.primitiveSchema)}return{verified:true,result:e}}function Nt(e,t){if(t instanceof Object===false){return{verified:false,result:{error:"Wrong ASN.1 schema type"}}}var r=X(s.toUint8Array(e));if(r.offset===-1){return{verified:false,result:r.result}}return Tt(r.result,r.result,t)}var Rt=Object.freeze({__proto__:null,Any:kt,BaseBlock:q,BaseStringBlock:W,BitString:ge,BmpString:We,Boolean:pe,CharacterString:ht,Choice:xt,Constructed:ie,DATE:Ct,DateTime:wt,Duration:It,EndOfContent:ae,Enumerated:Ie,GeneralString:ft,GeneralizedTime:St,GraphicString:ut,HexBlock:U,IA5String:at,Integer:we,Null:ue,NumericString:Xe,ObjectIdentifier:xe,OctetString:he,Primitive:$,PrintableString:et,RawData:Ot,RelativeObjectIdentifier:Ne,Repeated:_t,Sequence:Me,Set:Le,TIME:Dt,TeletexString:rt,TimeOfDay:bt,UTCTime:yt,UniversalString:$e,Utf8String:Ge,ValueBlock:j,VideotexString:nt,ViewWriter:C,VisibleString:lt,compareSchema:Tt,fromBER:Y,verifySchema:Nt});var Mt;(function(e){e[e["Sequence"]=0]="Sequence";e[e["Set"]=1]="Set";e[e["Choice"]=2]="Choice"})(Mt||(Mt={}));var Ht;(function(e){e[e["Any"]=1]="Any";e[e["Boolean"]=2]="Boolean";e[e["OctetString"]=3]="OctetString";e[e["BitString"]=4]="BitString";e[e["Integer"]=5]="Integer";e[e["Enumerated"]=6]="Enumerated";e[e["ObjectIdentifier"]=7]="ObjectIdentifier";e[e["Utf8String"]=8]="Utf8String";e[e["BmpString"]=9]="BmpString";e[e["UniversalString"]=10]="UniversalString";e[e["NumericString"]=11]="NumericString";e[e["PrintableString"]=12]="PrintableString";e[e["TeletexString"]=13]="TeletexString";e[e["VideotexString"]=14]="VideotexString";e[e["IA5String"]=15]="IA5String";e[e["GraphicString"]=16]="GraphicString";e[e["VisibleString"]=17]="VisibleString";e[e["GeneralString"]=18]="GeneralString";e[e["CharacterString"]=19]="CharacterString";e[e["UTCTime"]=20]="UTCTime";e[e["GeneralizedTime"]=21]="GeneralizedTime";e[e["DATE"]=22]="DATE";e[e["TimeOfDay"]=23]="TimeOfDay";e[e["DateTime"]=24]="DateTime";e[e["Duration"]=25]="Duration";e[e["TIME"]=26]="TIME";e[e["Null"]=27]="Null"})(Ht||(Ht={}));var Lt={fromASN:function(e){return e instanceof ue?null:e.valueBeforeDecode},toASN:function(e){if(e===null){return new ue}var t=Y(e);if(t.result.error){throw new Error(t.result.error)}return t.result}};var Ut={fromASN:function(e){return e.valueBlock.valueHex.byteLength>4?e.valueBlock.toString():e.valueBlock.valueDec},toASN:function(e){return new we({value:e})}};var Vt={fromASN:function(e){return e.valueBlock.valueDec},toASN:function(e){return new Ie({value:e})}};var jt=e("S",{fromASN:function(e){return e.valueBlock.valueHex},toASN:function(e){return new we({valueHex:e})}});var Ft={fromASN:function(e){return e.valueBlock.valueHex},toASN:function(e){return new ge({valueHex:e})}};var Kt={fromASN:function(e){return e.valueBlock.toString()},toASN:function(e){return new xe({value:e})}};var Gt={fromASN:function(e){return e.valueBlock.value},toASN:function(e){return new pe({value:e})}};var qt={fromASN:function(e){return e.valueBlock.valueHex},toASN:function(e){return new he({valueHex:e})}};function zt(e){return{fromASN:function(e){return e.valueBlock.value},toASN:function(t){return new e({value:t})}}}var Wt=zt(Ge);var Qt=zt(We);var Jt=zt($e);var $t=zt(Xe);var Zt=zt(et);var Xt=zt(rt);var Yt=zt(nt);var er=zt(at);var tr=zt(ut);var rr=zt(lt);var ir=zt(ft);var nr=zt(ht);var or={fromASN:function(e){return e.toDate()},toASN:function(e){return new yt({valueDate:e})}};var ar={fromASN:function(e){return e.toDate()},toASN:function(e){return new St({valueDate:e})}};var sr={fromASN:function(e){return null},toASN:function(e){return new ue}};function ur(e){switch(e){case Ht.Any:return Lt;case Ht.BitString:return Ft;case Ht.BmpString:return Qt;case Ht.Boolean:return Gt;case Ht.CharacterString:return nr;case Ht.Enumerated:return Vt;case Ht.GeneralString:return ir;case Ht.GeneralizedTime:return ar;case Ht.GraphicString:return tr;case Ht.IA5String:return er;case Ht.Integer:return Ut;case Ht.Null:return sr;case Ht.NumericString:return $t;case Ht.ObjectIdentifier:return Kt;case Ht.OctetString:return qt;case Ht.PrintableString:return Zt;case Ht.TeletexString:return Xt;case Ht.UTCTime:return or;case Ht.UniversalString:return Jt;case Ht.Utf8String:return Wt;case Ht.VideotexString:return Yt;case Ht.VisibleString:return rr;default:return null}}var cr=function(){function e(e,t){if(t===void 0){t=0}this.unusedBits=0;this.value=new ArrayBuffer(0);if(e){if(typeof e==="number"){this.fromNumber(e)}else if(s.isBufferSource(e)){this.unusedBits=t;this.value=s.toArrayBuffer(e)}else{throw TypeError("Unsupported type of 'params' argument for BitString")}}}e.prototype.fromASN=function(e){if(!(e instanceof ge)){throw new TypeError("Argument 'asn' is not instance of ASN.1 BitString")}this.unusedBits=e.valueBlock.unusedBits;this.value=e.valueBlock.valueHex;return this};e.prototype.toASN=function(){return new ge({unusedBits:this.unusedBits,valueHex:this.value})};e.prototype.toSchema=function(e){return new ge({name:e})};e.prototype.toNumber=function(){var e="";var t=new Uint8Array(this.value);for(var r=0,i=t;r<i.length;r++){var n=i[r];e+=n.toString(2).padStart(8,"0")}e=e.split("").reverse().join("");if(this.unusedBits){e=e.slice(this.unusedBits).padStart(this.unusedBits,"0")}return parseInt(e,2)};e.prototype.fromNumber=function(e){var t=e.toString(2);var r=t.length+7>>3;this.unusedBits=(r<<3)-t.length;var i=new Uint8Array(r);t=t.padStart(r<<3,"0").split("").reverse().join("");var n=0;while(n<r){i[n]=parseInt(t.slice(n<<3,(n<<3)+8),2);n++}this.value=i.buffer};return e}();var lr=function(){function e(e){if(typeof e==="number"){this.buffer=new ArrayBuffer(e)}else{if(s.isBufferSource(e)){this.buffer=s.toArrayBuffer(e)}else if(Array.isArray(e)){this.buffer=new Uint8Array(e)}else{this.buffer=new ArrayBuffer(0)}}}Object.defineProperty(e.prototype,"byteLength",{get:function(){return this.buffer.byteLength},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"byteOffset",{get:function(){return 0},enumerable:false,configurable:true});e.prototype.fromASN=function(e){if(!(e instanceof he)){throw new TypeError("Argument 'asn' is not instance of ASN.1 OctetString")}this.buffer=e.valueBlock.valueHex;return this};e.prototype.toASN=function(){return new he({valueHex:this.buffer})};e.prototype.toSchema=function(e){return new he({name:e})};return e}();function pr(e){if(e&&e.prototype){if(e.prototype.toASN&&e.prototype.fromASN){return true}else{return pr(e.prototype)}}else{return!!(e&&e.toASN&&e.fromASN)}}function fr(e){var t;if(e){var r=Object.getPrototypeOf(e);if(((t=r===null||r===void 0?void 0:r.prototype)===null||t===void 0?void 0:t.constructor)===Array){return true}return fr(r)}return false}function vr(e,t){if(!(e&&t)){return false}if(e.byteLength!==t.byteLength){return false}var r=new Uint8Array(e);var i=new Uint8Array(t);for(var n=0;n<e.byteLength;n++){if(r[n]!==i[n]){return false}}return true}var hr=function(){function e(){this.items=new WeakMap}e.prototype.has=function(e){return this.items.has(e)};e.prototype.get=function(e){var t,r,i;var n=this.items.get(e);if(!n){throw new Error("Cannot get schema for '"+((i=(r=(t=e===null||e===void 0?void 0:e.prototype)===null||t===void 0?void 0:t.constructor)===null||r===void 0?void 0:r.name)!==null&&i!==void 0?i:e)+"' target")}return n};e.prototype.cache=function(e){var t=this.get(e);if(!t.schema){t.schema=this.create(e,true)}};e.prototype.createDefault=function(e){var t={type:Mt.Sequence,items:{}};var r=this.findParentSchema(e);if(r){Object.assign(t,r);t.items=Object.assign({},t.items,r.items)}return t};e.prototype.create=function(e,t){var r=this.items.get(e)||this.createDefault(e);var i=[];for(var n in r.items){var o=r.items[n];var a=t?n:"";var s=void 0;if(typeof o.type==="number"){var u=Ht[o.type];var c=Rt[u];if(!c){throw new Error("Cannot get ASN1 class by name '"+u+"'")}s=new c({name:a})}else if(pr(o.type)){var l=new o.type;s=l.toSchema(a)}else if(o.optional){var p=this.get(o.type);if(p.type===Mt.Choice){s=new kt({name:a})}else{s=this.create(o.type,false);s.name=a}}else{s=new kt({name:a})}var f=!!o.optional||o.defaultValue!==undefined;if(o.repeated){s.name="";var v=o.repeated==="set"?Le:Me;s=new v({name:"",value:[new _t({name:a,value:s})]})}if(o.context!==null&&o.context!==undefined){if(o.implicit){if(typeof o.type==="number"||pr(o.type)){var v=o.repeated?ie:$;i.push(new v({name:a,optional:f,idBlock:{tagClass:3,tagNumber:o.context}}))}else{this.cache(o.type);var h=!!o.repeated;var d=!h?this.get(o.type).schema:s;d=d.valueBlock?d.valueBlock.value:d.value;i.push(new ie({name:!h?a:"",optional:f,idBlock:{tagClass:3,tagNumber:o.context},value:d}))}}else{i.push(new ie({optional:f,idBlock:{tagClass:3,tagNumber:o.context},value:[s]}))}}else{s.optional=f;i.push(s)}}switch(r.type){case Mt.Sequence:return new Me({value:i,name:""});case Mt.Set:return new Le({value:i,name:""});case Mt.Choice:return new xt({value:i,name:""});default:throw new Error("Unsupported ASN1 type in use")}};e.prototype.set=function(e,t){this.items.set(e,t);return this};e.prototype.findParentSchema=function(e){var t=e.__proto__;if(t){var r=this.items.get(t);return r||this.findParentSchema(t)}return null};return e}();var dr=new hr;var yr=function(e){return function(t){var r;if(!dr.has(t)){r=dr.createDefault(t);dr.set(t,r)}else{r=dr.get(t)}Object.assign(r,e)}};var gr=function(e){return function(t,r){var i;if(!dr.has(t.constructor)){i=dr.createDefault(t.constructor);dr.set(t.constructor,i)}else{i=dr.get(t.constructor)}var n=Object.assign({},e);if(typeof n.type==="number"&&!n.converter){var o=ur(e.type);if(!o){throw new Error("Cannot get default converter for property '"+r+"' of "+t.constructor.name)}n.converter=o}i.items[r]=n}};var Sr=function(e){__extends(t,e);function t(){var t=e.apply(this,arguments)||this;t.schemas=[];return t}return t}(Error);var mr=function(){function e(){}e.parse=function(e,t){var r=Y(e);if(r.result.error){throw new Error(r.result.error)}var i=this.fromASN(r.result,t);return i};e.fromASN=function(e,t){var r=this;var i;try{if(pr(t)){var n=new t;return n.fromASN(e)}var o=dr.get(t);dr.cache(t);var a=o.schema;if(e.constructor===ie&&o.type!==Mt.Choice){a=new ie({idBlock:{tagClass:3,tagNumber:e.idBlock.tagNumber},value:o.schema.valueBlock.value});for(var s in o.items){delete e[s]}}var u=Tt({},e,a);if(!u.verified){throw new Sr("Data does not match to "+t.name+" ASN1 schema. "+u.result.error)}var c=new t;if(fr(t)){if(typeof o.itemType==="number"){var l=ur(o.itemType);if(!l){throw new Error("Cannot get default converter for array item of "+t.name+" ASN1 schema")}return t.from(e.valueBlock.value,(function(e){return l.fromASN(e)}))}else{return t.from(e.valueBlock.value,(function(e){return r.fromASN(e,o.itemType)}))}}var p=function(e){var t=u.result[e];if(!t){return"continue"}var n=o.items[e];if(typeof n.type==="number"||pr(n.type)){var a=(i=n.converter)!==null&&i!==void 0?i:pr(n.type)?new n.type:null;if(!a){throw new Error("Converter is empty")}if(n.repeated){if(n.implicit){var s=n.repeated==="sequence"?Me:Le;var l=new s;l.valueBlock=t.valueBlock;var p=Y(l.toBER(false)).result.valueBlock.value;c[e]=Array.from(p,(function(e){return a.fromASN(e)}))}else{c[e]=Array.from(t,(function(e){return a.fromASN(e)}))}}else{var p=t;if(n.implicit){var l=void 0;if(pr(n.type)){l=(new n.type).toSchema("")}else{var v=Ht[n.type];var h=Rt[v];if(!h){throw new Error("Cannot get '"+v+"' class from asn1js module")}l=new h}l.valueBlock=p.valueBlock;p=Y(l.toBER(false)).result}c[e]=a.fromASN(p)}}else{if(n.repeated){c[e]=Array.from(t,(function(e){return r.fromASN(e,n.type)}))}else{c[e]=f.fromASN(t,n.type)}}};var f=this;for(var s in o.items){p(s)}return c}catch(v){if(v instanceof Sr){v.schemas.push(t.name)}throw v}};return e}();e("c",mr);var Cr=function(){function e(){}e.serialize=function(e){if(e instanceof q){return e.toBER(false)}return this.toASN(e).toBER(false)};e.toASN=function(t){var r=this;if(t&&pr(t.constructor)){return t.toASN()}var i=t.constructor;var n=dr.get(i);dr.cache(i);var o=[];if(n.itemType){if(typeof n.itemType==="number"){var a=ur(n.itemType);if(!a){throw new Error("Cannot get default converter for array item of "+i.name+" ASN1 schema")}o=t.map((function(e){return a.toASN(e)}))}else{o=t.map((function(e){return r.toAsnItem({type:n.itemType},"[]",i,e)}))}}else{for(var s in n.items){var u=n.items[s];var c=t[s];if(c===undefined||u.defaultValue===c||typeof u.defaultValue==="object"&&typeof c==="object"&&vr(this.serialize(u.defaultValue),this.serialize(c))){continue}var l=e.toAsnItem(u,s,i,c);if(typeof u.context==="number"){if(u.implicit){if(!u.repeated&&(typeof u.type==="number"||pr(u.type))){var p={};p.valueHex=l instanceof ue?l.valueBeforeDecode:l.valueBlock.toBER();o.push(new $(__assign({optional:u.optional,idBlock:{tagClass:3,tagNumber:u.context}},p)))}else{o.push(new ie({optional:u.optional,idBlock:{tagClass:3,tagNumber:u.context},value:l.valueBlock.value}))}}else{o.push(new ie({optional:u.optional,idBlock:{tagClass:3,tagNumber:u.context},value:[l]}))}}else if(u.repeated){o=o.concat(l)}else{o.push(l)}}}var f;switch(n.type){case Mt.Sequence:f=new Me({value:o});break;case Mt.Set:f=new Le({value:o});break;case Mt.Choice:if(!o[0]){throw new Error("Schema '"+i.name+"' has wrong data. Choice cannot be empty.")}f=o[0];break}return f};e.toAsnItem=function(e,t,r,i){var n=this;var o;if(typeof e.type==="number"){var a=e.converter;if(!a){throw new Error("Property '"+t+"' doesn't have converter for type "+Ht[e.type]+" in schema '"+r.name+"'")}if(e.repeated){var s=Array.from(i,(function(e){return a.toASN(e)}));var u=e.repeated==="sequence"?Me:Le;o=new u({value:s})}else{o=a.toASN(i)}}else{if(e.repeated){var s=Array.from(i,(function(e){return n.toASN(e)}));var u=e.repeated==="sequence"?Me:Le;o=new u({value:s})}else{o=this.toASN(i)}}return o};return e}();var Ar=function(e){__extends(t,e);function t(t){if(t===void 0){t=[]}var r=this;if(typeof t==="number"){r=e.call(this,t)||this}else{r=e.call(this)||this;for(var i=0,n=t;i<n.length;i++){var o=n[i];r.push(o)}}return r}return t}(Array);var br=function(){function e(){}e.serialize=function(e){return Cr.serialize(e)};e.parse=function(e,t){return mr.parse(e,t)};e.toString=function(t){var r=s.isBufferSource(t)?s.toArrayBuffer(t):e.serialize(t);var i=Y(r);if(i.offset===-1){throw new Error("Cannot decode ASN.1 data. "+i.result.error)}return i.result.toString()};return e}();e("e",br);function Br(e,t,r,i){var n=arguments.length,o=n<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,r):i,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,t,r,i);else for(var s=e.length-1;s>=0;s--)if(a=e[s])o=(n<3?a(o):n>3?a(t,r,o):a(t,r))||o;return n>3&&o&&Object.defineProperty(t,r,o),o}var wr=t((function(e){(function(t){var r="(0?\\d+|0x[a-f0-9]+)";var i={fourOctet:new RegExp("^"+r+"\\."+r+"\\."+r+"\\."+r+"$","i"),threeOctet:new RegExp("^"+r+"\\."+r+"\\."+r+"$","i"),twoOctet:new RegExp("^"+r+"\\."+r+"$","i"),longValue:new RegExp("^"+r+"$","i")};var n=new RegExp("^0[0-7]+$","i");var o=new RegExp("^0x[a-f0-9]+$","i");var a="%[0-9a-z]{1,}";var s="(?:[0-9a-f]+::?)+";var u={zoneIndex:new RegExp(a,"i"),native:new RegExp("^(::)?("+s+")?([0-9a-f]+)?(::)?("+a+")?$","i"),deprecatedTransitional:new RegExp("^(?:::)("+r+"\\."+r+"\\."+r+"\\."+r+"("+a+")?)$","i"),transitional:new RegExp("^((?:"+s+")|(?:::)(?:"+s+")?)"+r+"\\."+r+"\\."+r+"\\."+r+"("+a+")?$","i")};function c(e,t){if(e.indexOf("::")!==e.lastIndexOf("::")){return null}var r=0;var i=-1;var n=(e.match(u.zoneIndex)||[])[0];var o,a;if(n){n=n.substring(1);e=e.replace(/%.+$/,"")}while((i=e.indexOf(":",i+1))>=0){r++}if(e.substr(0,2)==="::"){r--}if(e.substr(-2,2)==="::"){r--}if(r>t){return null}a=t-r;o=":";while(a--){o+="0:"}e=e.replace("::",o);if(e[0]===":"){e=e.slice(1)}if(e[e.length-1]===":"){e=e.slice(0,-1)}t=function(){var t=e.split(":");var r=[];for(var i=0;i<t.length;i++){r.push(parseInt(t[i],16))}return r}();return{parts:t,zoneId:n}}function l(e,t,r,i){if(e.length!==t.length){throw new Error("ipaddr: cannot match CIDR for objects with different lengths")}var n=0;var o;while(i>0){o=r-i;if(o<0){o=0}if(e[n]>>o!==t[n]>>o){return false}i-=r;n+=1}return true}function p(e){if(o.test(e)){return parseInt(e,16)}if(e[0]==="0"&&!isNaN(parseInt(e[1],10))){if(n.test(e)){return parseInt(e,8)}throw new Error("ipaddr: cannot parse "+e+" as octal")}return parseInt(e,10)}function f(e,t){while(e.length<t){e="0"+e}return e}var v={};v.IPv4=function(){function e(e){if(e.length!==4){throw new Error("ipaddr: ipv4 octet count should be 4")}var t,r;for(t=0;t<e.length;t++){r=e[t];if(!(0<=r&&r<=255)){throw new Error("ipaddr: ipv4 octet should fit in 8 bits")}}this.octets=e}e.prototype.SpecialRanges={unspecified:[[new e([0,0,0,0]),8]],broadcast:[[new e([255,255,255,255]),32]],multicast:[[new e([224,0,0,0]),4]],linkLocal:[[new e([169,254,0,0]),16]],loopback:[[new e([127,0,0,0]),8]],carrierGradeNat:[[new e([100,64,0,0]),10]],private:[[new e([10,0,0,0]),8],[new e([172,16,0,0]),12],[new e([192,168,0,0]),16]],reserved:[[new e([192,0,0,0]),24],[new e([192,0,2,0]),24],[new e([192,88,99,0]),24],[new e([198,51,100,0]),24],[new e([203,0,113,0]),24],[new e([240,0,0,0]),4]]};e.prototype.kind=function(){return"ipv4"};e.prototype.match=function(e,t){var r;if(t===undefined){r=e;e=r[0];t=r[1]}if(e.kind()!=="ipv4"){throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one")}return l(this.octets,e.octets,8,t)};e.prototype.prefixLengthFromSubnetMask=function(){var e=0;var t=false;var r={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0};var i,n,o;for(i=3;i>=0;i-=1){n=this.octets[i];if(n in r){o=r[n];if(t&&o!==0){return null}if(o!==8){t=true}e+=o}else{return null}}return 32-e};e.prototype.range=function(){return v.subnetMatch(this,this.SpecialRanges)};e.prototype.toByteArray=function(){return this.octets.slice(0)};e.prototype.toIPv4MappedAddress=function(){return v.IPv6.parse("::ffff:"+this.toString())};e.prototype.toNormalizedString=function(){return this.toString()};e.prototype.toString=function(){return this.octets.join(".")};return e}();v.IPv4.broadcastAddressFromCIDR=function(e){try{var t=this.parseCIDR(e);var r=t[0].toByteArray();var i=this.subnetMaskFromPrefixLength(t[1]).toByteArray();var n=[];var o=0;while(o<4){n.push(parseInt(r[o],10)|parseInt(i[o],10)^255);o++}return new this(n)}catch(a){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}};v.IPv4.isIPv4=function(e){return this.parser(e)!==null};v.IPv4.isValid=function(e){try{new this(this.parser(e));return true}catch(t){return false}};v.IPv4.isValidFourPartDecimal=function(e){if(v.IPv4.isValid(e)&&e.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/)){return true}else{return false}};v.IPv4.networkAddressFromCIDR=function(e){var t,r,i,n,o;try{t=this.parseCIDR(e);i=t[0].toByteArray();o=this.subnetMaskFromPrefixLength(t[1]).toByteArray();n=[];r=0;while(r<4){n.push(parseInt(i[r],10)&parseInt(o[r],10));r++}return new this(n)}catch(a){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}};v.IPv4.parse=function(e){var t=this.parser(e);if(t===null){throw new Error("ipaddr: string is not formatted like an IPv4 Address")}return new this(t)};v.IPv4.parseCIDR=function(e){var t;if(t=e.match(/^(.+)\/(\d+)$/)){var r=parseInt(t[2]);if(r>=0&&r<=32){var i=[this.parse(t[1]),r];Object.defineProperty(i,"toString",{value:function(){return this.join("/")}});return i}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")};v.IPv4.parser=function(e){var t,r,n;if(t=e.match(i.fourOctet)){return function(){var e=t.slice(1,6);var i=[];for(var n=0;n<e.length;n++){r=e[n];i.push(p(r))}return i}()}else if(t=e.match(i.longValue)){n=p(t[1]);if(n>4294967295||n<0){throw new Error("ipaddr: address outside defined range")}return function(){var e=[];var t;for(t=0;t<=24;t+=8){e.push(n>>t&255)}return e}().reverse()}else if(t=e.match(i.twoOctet)){return function(){var e=t.slice(1,4);var r=[];n=p(e[1]);if(n>16777215||n<0){throw new Error("ipaddr: address outside defined range")}r.push(p(e[0]));r.push(n>>16&255);r.push(n>>8&255);r.push(n&255);return r}()}else if(t=e.match(i.threeOctet)){return function(){var e=t.slice(1,5);var r=[];n=p(e[2]);if(n>65535||n<0){throw new Error("ipaddr: address outside defined range")}r.push(p(e[0]));r.push(p(e[1]));r.push(n>>8&255);r.push(n&255);return r}()}else{return null}};v.IPv4.subnetMaskFromPrefixLength=function(e){e=parseInt(e);if(e<0||e>32){throw new Error("ipaddr: invalid IPv4 prefix length")}var t=[0,0,0,0];var r=0;var i=Math.floor(e/8);while(r<i){t[r]=255;r++}if(i<4){t[i]=Math.pow(2,e%8)-1<<8-e%8}return new this(t)};v.IPv6=function(){function e(e,t){var r,i;if(e.length===16){this.parts=[];for(r=0;r<=14;r+=2){this.parts.push(e[r]<<8|e[r+1])}}else if(e.length===8){this.parts=e}else{throw new Error("ipaddr: ipv6 part count should be 8 or 16")}for(r=0;r<this.parts.length;r++){i=this.parts[r];if(!(0<=i&&i<=65535)){throw new Error("ipaddr: ipv6 part should fit in 16 bits")}}if(t){this.zoneId=t}}e.prototype.SpecialRanges={unspecified:[new e([0,0,0,0,0,0,0,0]),128],linkLocal:[new e([65152,0,0,0,0,0,0,0]),10],multicast:[new e([65280,0,0,0,0,0,0,0]),8],loopback:[new e([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new e([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new e([0,0,0,0,0,65535,0,0]),96],rfc6145:[new e([0,0,0,0,65535,0,0,0]),96],rfc6052:[new e([100,65435,0,0,0,0,0,0]),96],"6to4":[new e([8194,0,0,0,0,0,0,0]),16],teredo:[new e([8193,0,0,0,0,0,0,0]),32],reserved:[[new e([8193,3512,0,0,0,0,0,0]),32]]};e.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"};e.prototype.kind=function(){return"ipv6"};e.prototype.match=function(e,t){var r;if(t===undefined){r=e;e=r[0];t=r[1]}if(e.kind()!=="ipv6"){throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one")}return l(this.parts,e.parts,16,t)};e.prototype.prefixLengthFromSubnetMask=function(){var e=0;var t=false;var r={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0};var i,n;for(var o=7;o>=0;o-=1){i=this.parts[o];if(i in r){n=r[i];if(t&&n!==0){return null}if(n!==16){t=true}e+=n}else{return null}}return 128-e};e.prototype.range=function(){return v.subnetMatch(this,this.SpecialRanges)};e.prototype.toByteArray=function(){var e;var t=[];var r=this.parts;for(var i=0;i<r.length;i++){e=r[i];t.push(e>>8);t.push(e&255)}return t};e.prototype.toFixedLengthString=function(){var e=function(){var e=[];for(var t=0;t<this.parts.length;t++){e.push(f(this.parts[t].toString(16),4))}return e}.call(this).join(":");var t="";if(this.zoneId){t="%"+this.zoneId}return e+t};e.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress()){throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4")}var e=this.parts.slice(-2);var t=e[0];var r=e[1];return new v.IPv4([t>>8,t&255,r>>8,r&255])};e.prototype.toNormalizedString=function(){var e=function(){var e=[];for(var t=0;t<this.parts.length;t++){e.push(this.parts[t].toString(16))}return e}.call(this).join(":");var t="";if(this.zoneId){t="%"+this.zoneId}return e+t};e.prototype.toRFC5952String=function(){var e=/((^|:)(0(:|$)){2,})/g;var t=this.toNormalizedString();var r=0;var i=-1;var n;while(n=e.exec(t)){if(n[0].length>i){r=n.index;i=n[0].length}}if(i<0){return t}return t.substring(0,r)+"::"+t.substring(r+i)};e.prototype.toString=function(){return this.toNormalizedString().replace(/((^|:)(0(:|$))+)/,"::")};return e}();v.IPv6.broadcastAddressFromCIDR=function(e){try{var t=this.parseCIDR(e);var r=t[0].toByteArray();var i=this.subnetMaskFromPrefixLength(t[1]).toByteArray();var n=[];var o=0;while(o<16){n.push(parseInt(r[o],10)|parseInt(i[o],10)^255);o++}return new this(n)}catch(a){throw new Error("ipaddr: the address does not have IPv6 CIDR format ("+a+")")}};v.IPv6.isIPv6=function(e){return this.parser(e)!==null};v.IPv6.isValid=function(e){if(typeof e==="string"&&e.indexOf(":")===-1){return false}try{var t=this.parser(e);new this(t.parts,t.zoneId);return true}catch(r){return false}};v.IPv6.networkAddressFromCIDR=function(e){var t,r,i,n,o;try{t=this.parseCIDR(e);i=t[0].toByteArray();o=this.subnetMaskFromPrefixLength(t[1]).toByteArray();n=[];r=0;while(r<16){n.push(parseInt(i[r],10)&parseInt(o[r],10));r++}return new this(n)}catch(a){throw new Error("ipaddr: the address does not have IPv6 CIDR format ("+a+")")}};v.IPv6.parse=function(e){var t=this.parser(e);if(t.parts===null){throw new Error("ipaddr: string is not formatted like an IPv6 Address")}return new this(t.parts,t.zoneId)};v.IPv6.parseCIDR=function(e){var t,r,i;if(r=e.match(/^(.+)\/(\d+)$/)){t=parseInt(r[2]);if(t>=0&&t<=128){i=[this.parse(r[1]),t];Object.defineProperty(i,"toString",{value:function(){return this.join("/")}});return i}}throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")};v.IPv6.parser=function(e){var t,r,i,n,o,a;if(i=e.match(u.deprecatedTransitional)){return this.parser("::ffff:"+i[1])}if(u.native.test(e)){return c(e,8)}if(i=e.match(u.transitional)){a=i[6]||"";t=c(i[1].slice(0,-1)+a,6);if(t.parts){o=[parseInt(i[2]),parseInt(i[3]),parseInt(i[4]),parseInt(i[5])];for(r=0;r<o.length;r++){n=o[r];if(!(0<=n&&n<=255)){return null}}t.parts.push(o[0]<<8|o[1]);t.parts.push(o[2]<<8|o[3]);return{parts:t.parts,zoneId:t.zoneId}}}return null};v.IPv6.subnetMaskFromPrefixLength=function(e){e=parseInt(e);if(e<0||e>128){throw new Error("ipaddr: invalid IPv6 prefix length")}var t=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];var r=0;var i=Math.floor(e/8);while(r<i){t[r]=255;r++}if(i<16){t[i]=Math.pow(2,e%8)-1<<8-e%8}return new this(t)};v.fromByteArray=function(e){var t=e.length;if(t===4){return new v.IPv4(e)}else if(t===16){return new v.IPv6(e)}else{throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")}};v.isValid=function(e){return v.IPv6.isValid(e)||v.IPv4.isValid(e)};v.parse=function(e){if(v.IPv6.isValid(e)){return v.IPv6.parse(e)}else if(v.IPv4.isValid(e)){return v.IPv4.parse(e)}else{throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")}};v.parseCIDR=function(e){try{return v.IPv6.parseCIDR(e)}catch(t){try{return v.IPv4.parseCIDR(e)}catch(r){throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}};v.process=function(e){var t=this.parse(e);if(t.kind()==="ipv6"&&t.isIPv4MappedAddress()){return t.toIPv4Address()}else{return t}};v.subnetMatch=function(e,t,r){var i,n,o,a;if(r===undefined||r===null){r="unicast"}for(n in t){if(Object.prototype.hasOwnProperty.call(t,n)){o=t[n];if(o[0]&&!(o[0]instanceof Array)){o=[o]}for(i=0;i<o.length;i++){a=o[i];if(e.kind()===a[0].kind()&&e.match.apply(e,a)){return n}}}}return r};if(e.exports){e.exports=v}else{t.ipaddr=v}})(i)}));var Er=function(){function e(){}e.decodeIP=function(e){if(e.length===64&&parseInt(e,16)===0){return"::/0"}if(e.length!==16){return e}var t=parseInt(e.slice(8),16).toString(2).split("").reduce((function(e,t){return e+ +t}),0);var r=e.slice(0,8).replace(/(.{2})/g,(function(e){return parseInt(e,16)+"."}));r=r.slice(0,-1);return r+"/"+t};e.toString=function(e){if(e.byteLength===4||e.byteLength===16){var t=new Uint8Array(e);var r=wr.fromByteArray(Array.from(t));return r.toString()}return this.decodeIP(u.ToHex(e))};e.fromString=function(e){var t=wr.parse(e);return new Uint8Array(t.toByteArray()).buffer};return e}();var Ir,Pr,Dr;var kr=function(){function e(e){if(e===void 0){e={}}Object.assign(this,e)}e.prototype.toString=function(){return this.bmpString||this.printableString||this.teletexString||this.universalString||this.utf8String||""};return e}();Br([gr({type:Ht.TeletexString})],kr.prototype,"teletexString",void 0);Br([gr({type:Ht.PrintableString})],kr.prototype,"printableString",void 0);Br([gr({type:Ht.UniversalString})],kr.prototype,"universalString",void 0);Br([gr({type:Ht.Utf8String})],kr.prototype,"utf8String",void 0);Br([gr({type:Ht.BmpString})],kr.prototype,"bmpString",void 0);kr=Br([yr({type:Mt.Choice})],kr);var xr=function(e){__extends(t,e);function t(t){if(t===void 0){t={}}var r=e.call(this,t)||this;Object.assign(r,t);return r}t.prototype.toString=function(){return this.ia5String||(this.anyValue?u.ToHex(this.anyValue):e.prototype.toString.call(this))};return t}(kr);Br([gr({type:Ht.IA5String})],xr.prototype,"ia5String",void 0);Br([gr({type:Ht.Any})],xr.prototype,"anyValue",void 0);xr=Br([yr({type:Mt.Choice})],xr);var _r=function(){function e(e){if(e===void 0){e={}}this.type="";this.value=new xr;Object.assign(this,e)}return e}();Br([gr({type:Ht.ObjectIdentifier})],_r.prototype,"type",void 0);Br([gr({type:xr})],_r.prototype,"value",void 0);var Or=Ir=function(e){__extends(t,e);function t(t){var r=e.call(this,t)||this;Object.setPrototypeOf(r,Ir.prototype);return r}return t}(Ar);Or=Ir=Br([yr({type:Mt.Set,itemType:_r})],Or);var Tr=Pr=function(e){__extends(t,e);function t(t){var r=e.call(this,t)||this;Object.setPrototypeOf(r,Pr.prototype);return r}return t}(Ar);Tr=Pr=Br([yr({type:Mt.Sequence,itemType:Or})],Tr);var Nr=e("J",Dr=function(e){__extends(t,e);function t(t){var r=e.call(this,t)||this;Object.setPrototypeOf(r,Dr.prototype);return r}return t}(Tr));Nr=e("J",Dr=Br([yr({type:Mt.Sequence})],Nr));var Rr={fromASN:function(e){return Er.toString(qt.fromASN(e))},toASN:function(e){return qt.toASN(Er.fromString(e))}};var Mr=function(){function e(e){if(e===void 0){e={}}this.typeId="";this.value=new ArrayBuffer(0);Object.assign(this,e)}return e}();e("K",Mr);Br([gr({type:Ht.ObjectIdentifier})],Mr.prototype,"typeId",void 0);Br([gr({type:Ht.Any,context:0})],Mr.prototype,"value",void 0);var Hr=function(){function e(e){if(e===void 0){e={}}this.partyName=new ArrayBuffer(0);Object.assign(this,e)}return e}();e("Q",Hr);Br([gr({type:kr,optional:true,context:0,implicit:true})],Hr.prototype,"nameAssigner",void 0);Br([gr({type:kr,context:1,implicit:true})],Hr.prototype,"partyName",void 0);var Lr=function(){function e(e){if(e===void 0){e={}}Object.assign(this,e)}return e}();Br([gr({type:Mr,context:0,implicit:true})],Lr.prototype,"otherName",void 0);Br([gr({type:Ht.IA5String,context:1,implicit:true})],Lr.prototype,"rfc822Name",void 0);Br([gr({type:Ht.IA5String,context:2,implicit:true})],Lr.prototype,"dNSName",void 0);Br([gr({type:Ht.Any,context:3,implicit:true})],Lr.prototype,"x400Address",void 0);Br([gr({type:Nr,context:4,implicit:false})],Lr.prototype,"directoryName",void 0);Br([gr({type:Hr,context:5})],Lr.prototype,"ediPartyName",void 0);Br([gr({type:Ht.IA5String,context:6,implicit:true})],Lr.prototype,"uniformResourceIdentifier",void 0);Br([gr({type:Ht.OctetString,context:7,implicit:true,converter:Rr})],Lr.prototype,"iPAddress",void 0);Br([gr({type:Ht.ObjectIdentifier,context:8,implicit:true})],Lr.prototype,"registeredID",void 0);Lr=Br([yr({type:Mt.Choice})],Lr);var Ur="1.3.6.1.5.5.7";var Vr=Ur+".1";var jr="2.5.29";var Fr;var Kr=Vr+".1";var Gr=function(){function e(e){if(e===void 0){e={}}this.accessMethod="";this.accessLocation=new Lr;Object.assign(this,e)}return e}();Br([gr({type:Ht.ObjectIdentifier})],Gr.prototype,"accessMethod",void 0);Br([gr({type:Lr})],Gr.prototype,"accessLocation",void 0);var qr=e("a1",Fr=function(e){__extends(t,e);function t(t){var r=e.call(this,t)||this;Object.setPrototypeOf(r,Fr.prototype);return r}return t}(Ar));qr=e("a1",Fr=Br([yr({type:Mt.Sequence,itemType:Gr})],qr));var zr=jr+".35";var Wr=function(e){__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(lr);var Qr=function(){function e(e){if(e===void 0){e={}}if(e){Object.assign(this,e)}}return e}();e("$",Qr);Br([gr({type:Wr,context:0,optional:true,implicit:true})],Qr.prototype,"keyIdentifier",void 0);Br([gr({type:Lr,context:1,optional:true,implicit:true,repeated:"sequence"})],Qr.prototype,"authorityCertIssuer",void 0);Br([gr({type:Ht.Integer,context:2,optional:true,implicit:true,converter:jt})],Qr.prototype,"authorityCertSerialNumber",void 0);var Jr=jr+".19";var $r=function(){function e(e){if(e===void 0){e={}}this.cA=false;Object.assign(this,e)}return e}();e("Y",$r);Br([gr({type:Ht.Boolean,defaultValue:false})],$r.prototype,"cA",void 0);Br([gr({type:Ht.Integer,optional:true})],$r.prototype,"pathLenConstraint",void 0);var Zr;var Xr=Zr=function(e){__extends(t,e);function t(t){var r=e.call(this,t)||this;Object.setPrototypeOf(r,Zr.prototype);return r}return t}(Ar);Xr=Zr=Br([yr({type:Mt.Sequence,itemType:Lr})],Xr);var Yr;var ei=jr+".29";var ti=Yr=function(e){__extends(t,e);function t(t){var r=e.call(this,t)||this;Object.setPrototypeOf(r,Yr.prototype);return r}return t}(Xr);ti=Yr=Br([yr({type:Mt.Sequence})],ti);var ri;var ii=jr+".32";var ni=e("L",function(){function e(e){if(e===void 0){e={}}Object.assign(this,e)}e.prototype.toString=function(){return this.ia5String||this.visibleString||this.bmpString||this.utf8String};return e}());Br([gr({type:Ht.IA5String})],ni.prototype,"ia5String",void 0);Br([gr({type:Ht.VisibleString})],ni.prototype,"visibleString",void 0);Br([gr({type:Ht.BmpString})],ni.prototype,"bmpString",void 0);Br([gr({type:Ht.Utf8String})],ni.prototype,"utf8String",void 0);ni=e("L",Br([yr({type:Mt.Choice})],ni));var oi=function(){function e(e){if(e===void 0){e={}}this.organization=new ni;this.noticeNumbers=[];Object.assign(this,e)}return e}();Br([gr({type:ni})],oi.prototype,"organization",void 0);Br([gr({type:Ht.Integer,repeated:"sequence"})],oi.prototype,"noticeNumbers",void 0);var ai=function(){function e(e){if(e===void 0){e={}}Object.assign(this,e)}return e}();e("M",ai);Br([gr({type:oi,optional:true})],ai.prototype,"noticeRef",void 0);Br([gr({type:ni,optional:true})],ai.prototype,"explicitText",void 0);var si=function(){function e(e){if(e===void 0){e={}}Object.assign(this,e)}return e}();Br([gr({type:Ht.IA5String})],si.prototype,"cPSuri",void 0);Br([gr({type:ai})],si.prototype,"userNotice",void 0);si=Br([yr({type:Mt.Choice})],si);var ui=function(){function e(e){if(e===void 0){e={}}this.policyQualifierId="";this.qualifier=new ArrayBuffer(0);Object.assign(this,e)}return e}();Br([gr({type:Ht.ObjectIdentifier})],ui.prototype,"policyQualifierId",void 0);Br([gr({type:Ht.Any})],ui.prototype,"qualifier",void 0);var ci=function(){function e(e){if(e===void 0){e={}}this.policyIdentifier="";Object.assign(this,e)}return e}();Br([gr({type:Ht.ObjectIdentifier})],ci.prototype,"policyIdentifier",void 0);Br([gr({type:ui,repeated:"sequence",optional:true})],ci.prototype,"policyQualifiers",void 0);var li=e("a4",ri=function(e){__extends(t,e);function t(t){var r=e.call(this,t)||this;Object.setPrototypeOf(r,ri.prototype);return r}return t}(Ar));li=e("a4",ri=Br([yr({type:Mt.Sequence,itemType:ci})],li));var pi=function(){function e(e){if(e===void 0){e=0}this.value=e}return e}();Br([gr({type:Ht.Integer})],pi.prototype,"value",void 0);pi=Br([yr({type:Mt.Choice})],pi);var fi=function(e){__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(pi);fi=Br([yr({type:Mt.Choice})],fi);var vi;var hi=jr+".31";var di;(function(e){e[e["unused"]=1]="unused";e[e["keyCompromise"]=2]="keyCompromise";e[e["cACompromise"]=4]="cACompromise";e[e["affiliationChanged"]=8]="affiliationChanged";e[e["superseded"]=16]="superseded";e[e["cessationOfOperation"]=32]="cessationOfOperation";e[e["certificateHold"]=64]="certificateHold";e[e["privilegeWithdrawn"]=128]="privilegeWithdrawn";e[e["aACompromise"]=256]="aACompromise"})(di||(di={}));var yi=function(e){__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}t.prototype.toJSON=function(){var e=[];var t=this.toNumber();if(t&di.aACompromise){e.push("aACompromise")}if(t&di.affiliationChanged){e.push("affiliationChanged")}if(t&di.cACompromise){e.push("cACompromise")}if(t&di.certificateHold){e.push("certificateHold")}if(t&di.cessationOfOperation){e.push("cessationOfOperation")}if(t&di.keyCompromise){e.push("keyCompromise")}if(t&di.privilegeWithdrawn){e.push("privilegeWithdrawn")}if(t&di.superseded){e.push("superseded")}if(t&di.unused){e.push("unused")}return e};t.prototype.toString=function(){return"["+this.toJSON().join(", ")+"]"};return t}(cr);var gi=function(){function e(e){if(e===void 0){e={}}Object.assign(this,e)}return e}();Br([gr({type:Lr,context:0,repeated:"sequence",implicit:true})],gi.prototype,"fullName",void 0);Br([gr({type:Or,context:1,implicit:true})],gi.prototype,"nameRelativeToCRLIssuer",void 0);gi=Br([yr({type:Mt.Choice})],gi);var Si=function(){function e(e){if(e===void 0){e={}}Object.assign(this,e)}return e}();Br([gr({type:gi,context:0,optional:true})],Si.prototype,"distributionPoint",void 0);Br([gr({type:yi,context:1,optional:true,implicit:true})],Si.prototype,"reasons",void 0);Br([gr({type:Lr,context:2,optional:true,repeated:"sequence",implicit:true})],Si.prototype,"cRLIssuer",void 0);var mi=e("a0",vi=function(e){__extends(t,e);function t(t){var r=e.call(this,t)||this;Object.setPrototypeOf(r,vi.prototype);return r}return t}(Ar));mi=e("a0",vi=Br([yr({type:Mt.Sequence,itemType:Si})],mi));var Ci;var Ai=Ci=function(e){__extends(t,e);function t(t){var r=e.call(this,t)||this;Object.setPrototypeOf(r,Ci.prototype);return r}return t}(mi);Ai=Ci=Br([yr({type:Mt.Sequence,itemType:Si})],Ai);var bi=function(){function e(t){if(t===void 0){t={}}this.onlyContainsUserCerts=e.ONLY;this.onlyContainsCACerts=e.ONLY;this.indirectCRL=e.ONLY;this.onlyContainsAttributeCerts=e.ONLY;Object.assign(this,t)}return e}();bi.ONLY=false;Br([gr({type:gi,context:0,optional:true})],bi.prototype,"distributionPoint",void 0);Br([gr({type:Ht.Boolean,context:1,defaultValue:bi.ONLY})],bi.prototype,"onlyContainsUserCerts",void 0);Br([gr({type:Ht.Boolean,context:2,defaultValue:bi.ONLY})],bi.prototype,"onlyContainsCACerts",void 0);Br([gr({type:yi,context:3,optional:true})],bi.prototype,"onlySomeReasons",void 0);Br([gr({type:Ht.Boolean,context:4,defaultValue:bi.ONLY})],bi.prototype,"indirectCRL",void 0);Br([gr({type:Ht.Boolean,context:5,defaultValue:bi.ONLY})],bi.prototype,"onlyContainsAttributeCerts",void 0);var Bi=jr+".21";var wi;(function(e){e[e["unspecified"]=0]="unspecified";e[e["keyCompromise"]=1]="keyCompromise";e[e["cACompromise"]=2]="cACompromise";e[e["affiliationChanged"]=3]="affiliationChanged";e[e["superseded"]=4]="superseded";e[e["cessationOfOperation"]=5]="cessationOfOperation";e[e["certificateHold"]=6]="certificateHold";e[e["removeFromCRL"]=8]="removeFromCRL";e[e["privilegeWithdrawn"]=9]="privilegeWithdrawn";e[e["aACompromise"]=10]="aACompromise"})(wi||(wi={}));var Ei=e("ah",function(){function e(e){if(e===void 0){e=wi.unspecified}this.reason=wi.unspecified;this.reason=e}e.prototype.toJSON=function(){return wi[this.reason]};e.prototype.toString=function(){return this.toJSON()};return e}());Br([gr({type:Ht.Enumerated})],Ei.prototype,"reason",void 0);Ei=e("ah",Br([yr({type:Mt.Choice})],Ei));var Ii;var Pi=jr+".37";var Di=e("Z",Ii=function(e){__extends(t,e);function t(t){var r=e.call(this,t)||this;Object.setPrototypeOf(r,Ii.prototype);return r}return t}(Ar));Di=e("Z",Ii=Br([yr({type:Mt.Sequence,itemType:Ht.ObjectIdentifier})],Di));var ki=jr+".54";var xi=function(){function e(e){if(e===void 0){e=new ArrayBuffer(0)}this.value=e}return e}();Br([gr({type:Ht.Integer,converter:jt})],xi.prototype,"value",void 0);xi=Br([yr({type:Mt.Choice})],xi);var _i=jr+".24";var Oi=function(){function e(e){this.value=new Date;if(e){this.value=e}}return e}();Br([gr({type:Ht.GeneralizedTime})],Oi.prototype,"value",void 0);Oi=Br([yr({type:Mt.Choice})],Oi);var Ti;var Ni=jr+".18";var Ri=Ti=function(e){__extends(t,e);function t(t){var r=e.call(this,t)||this;Object.setPrototypeOf(r,Ti.prototype);return r}return t}(Xr);Ri=Ti=Br([yr({type:Mt.Sequence})],Ri);var Mi=jr+".15";var Hi;(function(e){e[e["digitalSignature"]=1]="digitalSignature";e[e["nonRepudiation"]=2]="nonRepudiation";e[e["keyEncipherment"]=4]="keyEncipherment";e[e["dataEncipherment"]=8]="dataEncipherment";e[e["keyAgreement"]=16]="keyAgreement";e[e["keyCertSign"]=32]="keyCertSign";e[e["cRLSign"]=64]="cRLSign";e[e["encipherOnly"]=128]="encipherOnly";e[e["decipherOnly"]=256]="decipherOnly"})(Hi||(Hi={}));var Li=function(e){__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}t.prototype.toJSON=function(){var e=this.toNumber();var t=[];if(e&Hi.cRLSign){t.push("crlSign")}if(e&Hi.dataEncipherment){t.push("dataEncipherment")}if(e&Hi.decipherOnly){t.push("decipherOnly")}if(e&Hi.digitalSignature){t.push("digitalSignature")}if(e&Hi.encipherOnly){t.push("encipherOnly")}if(e&Hi.keyAgreement){t.push("keyAgreement")}if(e&Hi.keyCertSign){t.push("keyCertSign")}if(e&Hi.keyEncipherment){t.push("keyEncipherment")}if(e&Hi.nonRepudiation){t.push("nonRepudiation")}return t};t.prototype.toString=function(){return"["+this.toJSON().join(", ")+"]"};return t}(cr);e("X",Li);var Ui;var Vi=jr+".30";var ji=function(){function e(e){if(e===void 0){e={}}this.base=new Lr;this.minimum=0;Object.assign(this,e)}return e}();Br([gr({type:Lr})],ji.prototype,"base",void 0);Br([gr({type:Ht.Integer,context:0,defaultValue:0,implicit:true})],ji.prototype,"minimum",void 0);Br([gr({type:Ht.Integer,context:1,optional:true,implicit:true})],ji.prototype,"maximum",void 0);var Fi=Ui=function(e){__extends(t,e);function t(t){var r=e.call(this,t)||this;Object.setPrototypeOf(r,Ui.prototype);return r}return t}(Ar);Fi=Ui=Br([yr({type:Mt.Sequence,itemType:ji})],Fi);var Ki=function(){function e(e){if(e===void 0){e={}}Object.assign(this,e)}return e}();e("a6",Ki);Br([gr({type:Fi,context:0,optional:true,implicit:true})],Ki.prototype,"permittedSubtrees",void 0);Br([gr({type:Fi,context:1,optional:true,implicit:true})],Ki.prototype,"excludedSubtrees",void 0);var Gi=jr+".36";var qi=function(){function e(e){if(e===void 0){e={}}Object.assign(this,e)}return e}();e("ao",qi);Br([gr({type:Ht.Integer,context:0,implicit:true,optional:true,converter:jt})],qi.prototype,"requireExplicitPolicy",void 0);Br([gr({type:Ht.Integer,context:1,implicit:true,optional:true,converter:jt})],qi.prototype,"inhibitPolicyMapping",void 0);var zi;var Wi=jr+".33";var Qi=function(){function e(e){if(e===void 0){e={}}this.issuerDomainPolicy="";this.subjectDomainPolicy="";Object.assign(this,e)}return e}();Br([gr({type:Ht.ObjectIdentifier})],Qi.prototype,"issuerDomainPolicy",void 0);Br([gr({type:Ht.ObjectIdentifier})],Qi.prototype,"subjectDomainPolicy",void 0);var Ji=e("ap",zi=function(e){__extends(t,e);function t(t){var r=e.call(this,t)||this;Object.setPrototypeOf(r,zi.prototype);return r}return t}(Ar));Ji=e("ap",zi=Br([yr({type:Mt.Sequence,itemType:Qi})],Ji));var $i;var Zi=jr+".17";var Xi=e("a3",$i=function(e){__extends(t,e);function t(t){var r=e.call(this,t)||this;Object.setPrototypeOf(r,$i.prototype);return r}return t}(Xr));Xi=e("a3",$i=Br([yr({type:Mt.Sequence})],Xi));var Yi=function(){function e(e){if(e===void 0){e={}}this.type="";this.values=[];Object.assign(this,e)}return e}();e("a",Yi);Br([gr({type:Ht.ObjectIdentifier})],Yi.prototype,"type",void 0);Br([gr({type:Ht.Any,repeated:"set"})],Yi.prototype,"values",void 0);var en;var tn=jr+".9";var rn=e("ai",en=function(e){__extends(t,e);function t(t){var r=e.call(this,t)||this;Object.setPrototypeOf(r,en.prototype);return r}return t}(Ar));rn=e("ai",en=Br([yr({type:Mt.Sequence,itemType:Yi})],rn));var nn=jr+".14";var on=function(e){__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(Wr);e("_",on);var an=jr+".16";var sn=function(){function e(e){if(e===void 0){e={}}Object.assign(this,e)}return e}();e("aj",sn);Br([gr({type:Ht.GeneralizedTime,context:0,implicit:true,optional:true})],sn.prototype,"notBefore",void 0);Br([gr({type:Ht.GeneralizedTime,context:1,implicit:true,optional:true})],sn.prototype,"notAfter",void 0);var un="1.2.840.113533.7.65.0";var cn;(function(e){e[e["keyUpdateAllowed"]=1]="keyUpdateAllowed";e[e["newExtensions"]=2]="newExtensions";e[e["pKIXCertificate"]=4]="pKIXCertificate"})(cn||(cn={}));var ln=function(e){__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}t.prototype.toJSON=function(){var e=[];var t=this.toNumber();if(t&cn.pKIXCertificate){e.push("pKIXCertificate")}if(t&cn.newExtensions){e.push("newExtensions")}if(t&cn.keyUpdateAllowed){e.push("keyUpdateAllowed")}return e};t.prototype.toString=function(){return"["+this.toJSON().join(", ")+"]"};return t}(cr);var pn=function(){function e(e){if(e===void 0){e={}}this.entrustVers="";this.entrustInfoFlags=new ln;Object.assign(this,e)}return e}();e("ak",pn);Br([gr({type:Ht.GeneralString})],pn.prototype,"entrustVers",void 0);Br([gr({type:ln})],pn.prototype,"entrustInfoFlags",void 0);var fn;var vn=Vr+".11";var hn=e("a2",fn=function(e){__extends(t,e);function t(t){var r=e.call(this,t)||this;Object.setPrototypeOf(r,fn.prototype);return r}return t}(Ar));hn=e("a2",fn=Br([yr({type:Mt.Sequence,itemType:Gr})],hn));var dn=function(){function e(e){if(e===void 0){e={}}this.algorithm="";Object.assign(this,e)}e.prototype.isEqual=function(t){return t instanceof e&&t.algorithm==this.algorithm&&(t.parameters&&this.parameters&&c(t.parameters,this.parameters)||t.parameters===this.parameters)};return e}();Br([gr({type:Ht.ObjectIdentifier})],dn.prototype,"algorithm",void 0);Br([gr({type:Ht.Any,optional:true})],dn.prototype,"parameters",void 0);var yn=function(){function e(e){if(e===void 0){e={}}this.algorithm=new dn;this.subjectPublicKey=new ArrayBuffer(0);Object.assign(this,e)}return e}();Br([gr({type:dn})],yn.prototype,"algorithm",void 0);Br([gr({type:Ht.BitString})],yn.prototype,"subjectPublicKey",void 0);var gn=function(){function e(e){if(e){if(typeof e==="string"||typeof e==="number"){this.utcTime=new Date(e)}else if(e instanceof Date){this.utcTime=e}else{Object.assign(this,e)}}}e.prototype.getTime=function(){var e=this.utcTime||this.generalTime;if(!e){throw new Error("Cannot get time from CHOICE object")}return e};return e}();Br([gr({type:Ht.UTCTime})],gn.prototype,"utcTime",void 0);Br([gr({type:Ht.GeneralizedTime})],gn.prototype,"generalTime",void 0);gn=Br([yr({type:Mt.Choice})],gn);var Sn=function(){function e(e){this.notBefore=new gn(new Date);this.notAfter=new gn(new Date);if(e){this.notBefore=new gn(e.notBefore);this.notAfter=new gn(e.notAfter)}}return e}();Br([gr({type:gn})],Sn.prototype,"notBefore",void 0);Br([gr({type:gn})],Sn.prototype,"notAfter",void 0);var mn;var Cn=function(){function e(t){if(t===void 0){t={}}this.extnID="";this.critical=e.CRITICAL;this.extnValue=new lr;Object.assign(this,t)}return e}();Cn.CRITICAL=false;Br([gr({type:Ht.ObjectIdentifier})],Cn.prototype,"extnID",void 0);Br([gr({type:Ht.Boolean,defaultValue:Cn.CRITICAL})],Cn.prototype,"critical",void 0);Br([gr({type:lr})],Cn.prototype,"extnValue",void 0);var An=mn=function(e){__extends(t,e);function t(t){var r=e.call(this,t)||this;Object.setPrototypeOf(r,mn.prototype);return r}return t}(Ar);An=mn=Br([yr({type:Mt.Sequence,itemType:Cn})],An);var bn;(function(e){e[e["v1"]=0]="v1";e[e["v2"]=1]="v2";e[e["v3"]=2]="v3"})(bn||(bn={}));var Bn=function(){function e(e){if(e===void 0){e={}}this.version=bn.v1;this.serialNumber=new ArrayBuffer(0);this.signature=new dn;this.issuer=new Nr;this.validity=new Sn;this.subject=new Nr;this.subjectPublicKeyInfo=new yn;Object.assign(this,e)}return e}();Br([gr({type:Ht.Integer,context:0,defaultValue:bn.v1})],Bn.prototype,"version",void 0);Br([gr({type:Ht.Integer,converter:jt})],Bn.prototype,"serialNumber",void 0);Br([gr({type:dn})],Bn.prototype,"signature",void 0);Br([gr({type:Nr})],Bn.prototype,"issuer",void 0);Br([gr({type:Sn})],Bn.prototype,"validity",void 0);Br([gr({type:Nr})],Bn.prototype,"subject",void 0);Br([gr({type:yn})],Bn.prototype,"subjectPublicKeyInfo",void 0);Br([gr({type:Ht.BitString,context:1,implicit:true,optional:true})],Bn.prototype,"issuerUniqueID",void 0);Br([gr({type:Ht.BitString,context:2,implicit:true,optional:true})],Bn.prototype,"subjectUniqueID",void 0);Br([gr({type:An,context:3,optional:true})],Bn.prototype,"extensions",void 0);var wn=function(){function e(e){if(e===void 0){e={}}this.tbsCertificate=new Bn;this.signatureAlgorithm=new dn;this.signatureValue=new ArrayBuffer(0);Object.assign(this,e)}return e}();Br([gr({type:Bn})],wn.prototype,"tbsCertificate",void 0);Br([gr({type:dn})],wn.prototype,"signatureAlgorithm",void 0);Br([gr({type:Ht.BitString})],wn.prototype,"signatureValue",void 0);var En=function(){function e(e){if(e===void 0){e={}}this.userCertificate=new ArrayBuffer(0);this.revocationDate=new gn;Object.assign(this,e)}return e}();Br([gr({type:Ht.Integer,converter:jt})],En.prototype,"userCertificate",void 0);Br([gr({type:gn})],En.prototype,"revocationDate",void 0);Br([gr({type:Cn,optional:true,repeated:"sequence"})],En.prototype,"crlEntryExtensions",void 0);var In=function(){function e(e){if(e===void 0){e={}}this.signature=new dn;this.issuer=new Nr;this.thisUpdate=new gn;Object.assign(this,e)}return e}();Br([gr({type:Ht.Integer,optional:true})],In.prototype,"version",void 0);Br([gr({type:dn})],In.prototype,"signature",void 0);Br([gr({type:Nr})],In.prototype,"issuer",void 0);Br([gr({type:gn})],In.prototype,"thisUpdate",void 0);Br([gr({type:gn,optional:true})],In.prototype,"nextUpdate",void 0);Br([gr({type:En,repeated:"sequence",optional:true})],In.prototype,"revokedCertificates",void 0);Br([gr({type:Cn,optional:true,context:0,repeated:"sequence"})],In.prototype,"crlExtensions",void 0);var Pn=function(){function e(e){if(e===void 0){e={}}this.tbsCertList=new In;this.signatureAlgorithm=new dn;this.signature=new ArrayBuffer(0);Object.assign(this,e)}return e}();Br([gr({type:In})],Pn.prototype,"tbsCertList",void 0);Br([gr({type:dn})],Pn.prototype,"signatureAlgorithm",void 0);Br([gr({type:Ht.BitString})],Pn.prototype,"signature",void 0);var Dn=e("F","1.2.840.10045.2.1");var kn="1.2.840.10045.4.1";var xn="1.2.840.10045.4.3.1";var _n="1.2.840.10045.4.3.2";var On="1.2.840.10045.4.3.3";var Tn="1.2.840.10045.4.3.4";function Nn(e){return new dn({algorithm:e})}var Rn=Nn(kn);var Mn=Nn(xn);var Hn=Nn(_n);var Ln=Nn(On);var Un=Nn(Tn);var Vn=e("G",function(){function e(e){if(e===void 0){e={}}Object.assign(this,e)}return e}());Br([gr({type:Ht.ObjectIdentifier})],Vn.prototype,"namedCurve",void 0);Vn=e("G",Br([yr({type:Mt.Choice})],Vn));var jn=function(){function e(e){if(e===void 0){e={}}this.version=1;this.privateKey=new lr;Object.assign(this,e)}return e}();Br([gr({type:Ht.Integer})],jn.prototype,"version",void 0);Br([gr({type:lr})],jn.prototype,"privateKey",void 0);Br([gr({type:Vn,context:0,optional:true})],jn.prototype,"parameters",void 0);Br([gr({type:Ht.BitString,context:1,optional:true})],jn.prototype,"publicKey",void 0);var Fn=function(){function e(e){if(e===void 0){e={}}this.r=new ArrayBuffer(0);this.s=new ArrayBuffer(0);Object.assign(this,e)}return e}();Br([gr({type:Ht.Integer,converter:jt})],Fn.prototype,"r",void 0);Br([gr({type:Ht.Integer,converter:jt})],Fn.prototype,"s",void 0);var Kn="1.2.840.113549.1.1";var Gn=e("H",Kn+".1");var qn=Kn+".7";var zn=Kn+".9";var Wn=Kn+".10";var Qn=Kn+".2";var Jn=Kn+".4";var $n=Kn+".5";var Zn=Kn+".12";var Xn=Kn+".13";var Yn=Kn+".15";var eo=Kn+".16";var to="1.3.14.3.2.26";var ro="2.16.840.1.101.3.4.2.4";var io="2.16.840.1.101.3.4.2.1";var no="2.16.840.1.101.3.4.2.2";var oo="2.16.840.1.101.3.4.2.3";var ao="2.16.840.1.101.3.4.2.5";var so="2.16.840.1.101.3.4.2.6";var uo="1.2.840.113549.2.2";var co="1.2.840.113549.2.5";var lo=Kn+".8";function po(e){return new dn({algorithm:e,parameters:null})}var fo=po(uo);var vo=po(co);var ho=po(to);var yo=po(ro);var go=po(io);var So=po(no);var mo=po(oo);var Co=po(ao);var Ao=po(so);var bo=new dn({algorithm:lo,parameters:br.serialize(ho)});var Bo=new dn({algorithm:zn,parameters:br.serialize(qt.toASN(new Uint8Array([218,57,163,238,94,107,75,13,50,85,191,239,149,96,24,144,175,216,7,9]).buffer))});var wo=po(Gn);var Eo=po(Qn);var Io=po(Jn);var Po=po($n);var Do=po(Yn);var ko=po(eo);var xo=po(Zn);var _o=po(Xn);var Oo=po(Yn);var To=po(eo);var No=function(){function e(e){if(e===void 0){e={}}this.hashAlgorithm=new dn(ho);this.maskGenAlgorithm=new dn({algorithm:lo,parameters:br.serialize(ho)});this.pSourceAlgorithm=new dn(Bo);Object.assign(this,e)}return e}();Br([gr({type:dn,context:0,defaultValue:ho})],No.prototype,"hashAlgorithm",void 0);Br([gr({type:dn,context:1,defaultValue:bo})],No.prototype,"maskGenAlgorithm",void 0);Br([gr({type:dn,context:2,defaultValue:Bo})],No.prototype,"pSourceAlgorithm",void 0);var Ro=new dn({algorithm:qn,parameters:br.serialize(new No)});var Mo=function(){function e(e){if(e===void 0){e={}}this.hashAlgorithm=new dn(ho);this.maskGenAlgorithm=new dn({algorithm:lo,parameters:br.serialize(ho)});this.saltLength=20;this.trailerField=1;Object.assign(this,e)}return e}();Br([gr({type:dn,context:0,defaultValue:ho})],Mo.prototype,"hashAlgorithm",void 0);Br([gr({type:dn,context:1,defaultValue:bo})],Mo.prototype,"maskGenAlgorithm",void 0);Br([gr({type:Ht.Integer,context:2,defaultValue:20})],Mo.prototype,"saltLength",void 0);Br([gr({type:Ht.Integer,context:3,defaultValue:1})],Mo.prototype,"trailerField",void 0);var Ho=new dn({algorithm:Wn,parameters:br.serialize(new Mo)});var Lo=function(){function e(e){if(e===void 0){e={}}this.digestAlgorithm=new dn;this.digest=new lr;Object.assign(this,e)}return e}();Br([gr({type:dn})],Lo.prototype,"digestAlgorithm",void 0);Br([gr({type:lr})],Lo.prototype,"digest",void 0);var Uo;var Vo=function(){function e(e){if(e===void 0){e={}}this.prime=new ArrayBuffer(0);this.exponent=new ArrayBuffer(0);this.coefficient=new ArrayBuffer(0);Object.assign(this,e)}return e}();Br([gr({type:Ht.Integer,converter:jt})],Vo.prototype,"prime",void 0);Br([gr({type:Ht.Integer,converter:jt})],Vo.prototype,"exponent",void 0);Br([gr({type:Ht.Integer,converter:jt})],Vo.prototype,"coefficient",void 0);var jo=Uo=function(e){__extends(t,e);function t(t){var r=e.call(this,t)||this;Object.setPrototypeOf(r,Uo.prototype);return r}return t}(Ar);jo=Uo=Br([yr({type:Mt.Sequence,itemType:Vo})],jo);var Fo=function(){function e(e){if(e===void 0){e={}}this.version=0;this.modulus=new ArrayBuffer(0);this.publicExponent=new ArrayBuffer(0);this.privateExponent=new ArrayBuffer(0);this.prime1=new ArrayBuffer(0);this.prime2=new ArrayBuffer(0);this.exponent1=new ArrayBuffer(0);this.exponent2=new ArrayBuffer(0);this.coefficient=new ArrayBuffer(0);Object.assign(this,e)}return e}();Br([gr({type:Ht.Integer})],Fo.prototype,"version",void 0);Br([gr({type:Ht.Integer,converter:jt})],Fo.prototype,"modulus",void 0);Br([gr({type:Ht.Integer,converter:jt})],Fo.prototype,"publicExponent",void 0);Br([gr({type:Ht.Integer,converter:jt})],Fo.prototype,"privateExponent",void 0);Br([gr({type:Ht.Integer,converter:jt})],Fo.prototype,"prime1",void 0);Br([gr({type:Ht.Integer,converter:jt})],Fo.prototype,"prime2",void 0);Br([gr({type:Ht.Integer,converter:jt})],Fo.prototype,"exponent1",void 0);Br([gr({type:Ht.Integer,converter:jt})],Fo.prototype,"exponent2",void 0);Br([gr({type:Ht.Integer,converter:jt})],Fo.prototype,"coefficient",void 0);Br([gr({type:jo,optional:true})],Fo.prototype,"otherPrimeInfos",void 0);var Ko=function(){function e(e){if(e===void 0){e={}}this.modulus=new ArrayBuffer(0);this.publicExponent=new ArrayBuffer(0);Object.assign(this,e)}return e}();e("R",Ko);Br([gr({type:Ht.Integer,converter:jt})],Ko.prototype,"modulus",void 0);Br([gr({type:Ht.Integer,converter:jt})],Ko.prototype,"publicExponent",void 0);
|
|
38
38
|
/**
|
|
39
39
|
* @license
|
|
40
40
|
* Copyright (c) Peculiar Ventures, LLC.
|