@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.
@@ -35,7 +35,7 @@ function c(t,e){let i=0;if(1===t.length)return t[0];for(let r=t.length-1;r>=0;r-
35
35
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36
36
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37
37
  *
38
- */function d(){if("undefined"==typeof BigInt)throw new Error("BigInt is not defined. Your environment doesn't implement BigInt.")}function f(t){let e=0,i=0;for(let s=0;s<t.length;s++)e+=t[s].byteLength;const r=new Uint8Array(e);for(let s=0;s<t.length;s++){const e=t[s];r.set(new Uint8Array(e),i),i+=e.byteLength}return r.buffer}function y(t,e,i,r){return e instanceof Uint8Array?e.byteLength?i<0?(t.error="Wrong parameter: inputOffset less than zero",!1):r<0?(t.error="Wrong parameter: inputLength less than zero",!1):!(e.byteLength-i-r<0&&(t.error="End of input reached before message was fully decoded (inconsistent offset and length values)",1)):(t.error="Wrong parameter: inputBuffer has zero length",!1):(t.error="Wrong parameter: inputBuffer must be 'Uint8Array'",!1)}class S{constructor(){this.items=[]}write(t){this.items.push(t)}final(){return f(this.items)}}const C=[new Uint8Array([1])],A=new ArrayBuffer(0),m=new Uint8Array(0);function g(t){var e;return(e=class extends t{constructor(...t){var e;super(...t);const i=t[0]||{};this.isHexOnly=null!==(e=i.isHexOnly)&&void 0!==e&&e,this.valueHexView=i.valueHex?n.toUint8Array(i.valueHex):m}get valueHex(){return this.valueHexView.slice().buffer}set valueHex(t){this.valueHexView=new Uint8Array(t)}fromBER(t,e,i){const r=t instanceof ArrayBuffer?new Uint8Array(t):t;if(!y(this,r,e,i))return-1;const s=e+i;return this.valueHexView=r.subarray(e,s),this.valueHexView.length?(this.blockLength=i,s):(this.warnings.push("Zero buffer length"),e)}toBER(t=!1){return this.isHexOnly?t?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.byteLength===this.valueHexView.buffer.byteLength?this.valueHexView.buffer:this.valueHexView.slice().buffer:(this.error="Flag 'isHexOnly' is not set, abort",A)}toJSON(){return{...super.toJSON(),isHexOnly:this.isHexOnly,valueHex:o.ToHex(this.valueHexView)}}}).NAME="hexBlock",e}class v{constructor({blockLength:t=0,error:e="",warnings:i=[],valueBeforeDecode:r=m}={}){this.blockLength=t,this.error=e,this.warnings=i,this.valueBeforeDecodeView=n.toUint8Array(r)}static blockName(){return this.NAME}get valueBeforeDecode(){return this.valueBeforeDecodeView.slice().buffer}set valueBeforeDecode(t){this.valueBeforeDecodeView=new Uint8Array(t)}toJSON(){return{blockName:this.constructor.NAME,blockLength:this.blockLength,error:this.error,warnings:this.warnings,valueBeforeDecode:o.ToHex(this.valueBeforeDecodeView)}}}v.NAME="baseBlock";class E extends v{fromBER(t,e,i){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}toBER(t,e){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}}E.NAME="valueBlock";class w extends(g(v)){constructor({idBlock:t={}}={}){var e,i,r,s;super(),t?(this.isHexOnly=null!==(e=t.isHexOnly)&&void 0!==e&&e,this.valueHexView=t.valueHex?n.toUint8Array(t.valueHex):m,this.tagClass=null!==(i=t.tagClass)&&void 0!==i?i:-1,this.tagNumber=null!==(r=t.tagNumber)&&void 0!==r?r:-1,this.isConstructed=null!==(s=t.isConstructed)&&void 0!==s&&s):(this.tagClass=-1,this.tagNumber=-1,this.isConstructed=!1)}toBER(t=!1){let e=0;switch(this.tagClass){case 1:e|=0;break;case 2:e|=64;break;case 3:e|=128;break;case 4:e|=192;break;default:return this.error="Unknown tag class",A}if(this.isConstructed&&(e|=32),this.tagNumber<31&&!this.isHexOnly){const i=new Uint8Array(1);if(!t){let t=this.tagNumber;t&=31,e|=t,i[0]=e}return i.buffer}if(!this.isHexOnly){const i=l(this.tagNumber,7),r=new Uint8Array(i),s=i.byteLength,n=new Uint8Array(s+1);if(n[0]=31|e,!t){for(let t=0;t<s-1;t++)n[t+1]=128|r[t];n[s]=r[s-1]}return n.buffer}const i=new Uint8Array(this.valueHexView.byteLength+1);if(i[0]=31|e,!t){const t=this.valueHexView;for(let e=0;e<t.length-1;e++)i[e+1]=128|t[e];i[this.valueHexView.byteLength]=t[t.length-1]}return i.buffer}fromBER(t,e,i){const r=n.toUint8Array(t);if(!y(this,r,e,i))return-1;const s=r.subarray(e,e+i);if(0===s.length)return this.error="Zero buffer length",-1;switch(192&s[0]){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:return this.error="Unknown tag class",-1}this.isConstructed=32==(32&s[0]),this.isHexOnly=!1;const o=31&s[0];if(31!==o)this.tagNumber=o,this.blockLength=1;else{let t=1,e=this.valueHexView=new Uint8Array(255),i=255;for(;128&s[t];){if(e[t-1]=127&s[t],t++,t>=s.length)return this.error="End of input reached before message was fully decoded",-1;if(t===i){i+=255;const t=new Uint8Array(i);for(let i=0;i<e.length;i++)t[i]=e[i];e=this.valueHexView=new Uint8Array(i)}}this.blockLength=t+1,e[t-1]=127&s[t];const r=new Uint8Array(t);for(let s=0;s<t;s++)r[s]=e[s];e=this.valueHexView=new Uint8Array(t),e.set(r),this.blockLength<=9?this.tagNumber=c(e,7):(this.isHexOnly=!0,this.warnings.push("Tag too long, represented as hex-coded"))}if(1===this.tagClass&&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:return this.error="Constructed encoding used for primitive type",-1}return e+this.blockLength}toJSON(){return{...super.toJSON(),tagClass:this.tagClass,tagNumber:this.tagNumber,isConstructed:this.isConstructed}}}w.NAME="identificationBlock";class P extends v{constructor({lenBlock:t={}}={}){var e,i,r;super(),this.isIndefiniteForm=null!==(e=t.isIndefiniteForm)&&void 0!==e&&e,this.longFormUsed=null!==(i=t.longFormUsed)&&void 0!==i&&i,this.length=null!==(r=t.length)&&void 0!==r?r:0}fromBER(t,e,i){const r=n.toUint8Array(t);if(!y(this,r,e,i))return-1;const s=r.subarray(e,e+i);if(0===s.length)return this.error="Zero buffer length",-1;if(255===s[0])return this.error="Length block 0xFF is reserved by standard",-1;if(this.isIndefiniteForm=128===s[0],this.isIndefiniteForm)return this.blockLength=1,e+this.blockLength;if(this.longFormUsed=!!(128&s[0]),!1===this.longFormUsed)return this.length=s[0],this.blockLength=1,e+this.blockLength;const o=127&s[0];if(o>8)return this.error="Too big integer",-1;if(o+1>s.length)return this.error="End of input reached before message was fully decoded",-1;const a=e+1,l=r.subarray(a,a+o);return 0===l[o-1]&&this.warnings.push("Needlessly long encoded length"),this.length=c(l,8),this.longFormUsed&&this.length<=127&&this.warnings.push("Unnecessary usage of long length form"),this.blockLength=o+1,e+this.blockLength}toBER(t=!1){let e,i;if(this.length>127&&(this.longFormUsed=!0),this.isIndefiniteForm)return e=new ArrayBuffer(1),!1===t&&(i=new Uint8Array(e),i[0]=128),e;if(this.longFormUsed){const r=l(this.length,8);if(r.byteLength>127)return this.error="Too big length",A;if(e=new ArrayBuffer(r.byteLength+1),t)return e;const s=new Uint8Array(r);i=new Uint8Array(e),i[0]=128|r.byteLength;for(let t=0;t<r.byteLength;t++)i[t+1]=s[t];return e}return e=new ArrayBuffer(1),!1===t&&(i=new Uint8Array(e),i[0]=this.length),e}toJSON(){return{...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,longFormUsed:this.longFormUsed,length:this.length}}}P.NAME="lengthBlock";const D={};class B extends v{constructor({name:t="",optional:e=!1,primitiveSchema:i,...r}={},s){super(r),this.name=t,this.optional=e,i&&(this.primitiveSchema=i),this.idBlock=new w(r),this.lenBlock=new P(r),this.valueBlock=s?new s(r):new E(r)}fromBER(t,e,i){const r=this.valueBlock.fromBER(t,e,this.lenBlock.isIndefiniteForm?i:this.lenBlock.length);return-1===r?(this.error=this.valueBlock.error,r):(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),r)}toBER(t,e){const i=e||new S;e||function t(e){if(e instanceof D.Constructed)for(const i of e.valueBlock.value)t(i)&&(e.lenBlock.isIndefiniteForm=!0);return!!e.lenBlock.isIndefiniteForm}(this);const r=this.idBlock.toBER(t);if(i.write(r),this.lenBlock.isIndefiniteForm)i.write(new Uint8Array([128]).buffer),this.valueBlock.toBER(t,i),i.write(new ArrayBuffer(2));else{const e=this.valueBlock.toBER(t);this.lenBlock.length=e.byteLength;const r=this.lenBlock.toBER(t);i.write(r),i.write(e)}return e?A:i.final()}toJSON(){const t={...super.toJSON(),idBlock:this.idBlock.toJSON(),lenBlock:this.lenBlock.toJSON(),valueBlock:this.valueBlock.toJSON(),name:this.name,optional:this.optional};return this.primitiveSchema&&(t.primitiveSchema=this.primitiveSchema.toJSON()),t}toString(t="ascii"){return"ascii"===t?this.onAsciiEncoding():o.ToHex(this.toBER())}onAsciiEncoding(){return`${this.constructor.NAME} : ${o.ToHex(this.valueBlock.valueBeforeDecodeView)}`}isEqual(t){return this===t||t instanceof this.constructor&&function(t,e){if(t.byteLength!==e.byteLength)return!1;const i=new Uint8Array(t),r=new Uint8Array(e);for(let s=0;s<i.length;s++)if(i[s]!==r[s])return!1;return!0}(this.toBER(),t.toBER())}}B.NAME="BaseBlock";class b extends B{constructor({value:t="",...e}={},i){super(e,i),t&&this.fromString(t)}getValue(){return this.valueBlock.value}setValue(t){this.valueBlock.value=t}fromBER(t,e,i){const r=this.valueBlock.fromBER(t,e,this.lenBlock.isIndefiniteForm?i:this.lenBlock.length);return-1===r?(this.error=this.valueBlock.error,r):(this.fromBuffer(this.valueBlock.valueHexView),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),r)}onAsciiEncoding(){return`${this.constructor.NAME} : '${this.valueBlock.value}'`}}b.NAME="BaseStringBlock";class I extends(g(E)){constructor({isHexOnly:t=!0,...e}={}){super(e),this.isHexOnly=t}}var T;I.NAME="PrimitiveValueBlock";class x extends B{constructor(t={}){super(t,I),this.idBlock.isConstructed=!1}}function R(t,e=0,i=t.length){const r=e;let s=new B({},E);const n=new v;if(!y(n,t,e,i))return s.error=n.error,{offset:-1,result:s};if(!t.subarray(e,e+i).length)return s.error="Zero buffer length",{offset:-1,result:s};let o=s.idBlock.fromBER(t,e,i);if(s.idBlock.warnings.length&&s.warnings.concat(s.idBlock.warnings),-1===o)return s.error=s.idBlock.error,{offset:-1,result:s};if(o=s.lenBlock.fromBER(t,e=o,i-=s.idBlock.blockLength),s.lenBlock.warnings.length&&s.warnings.concat(s.lenBlock.warnings),-1===o)return s.error=s.lenBlock.error,{offset:-1,result:s};if(e=o,i-=s.lenBlock.blockLength,!s.idBlock.isConstructed&&s.lenBlock.isIndefiniteForm)return s.error="Indefinite length form used for primitive encoding form",{offset:-1,result:s};let a=B;switch(s.idBlock.tagClass){case 1:if(s.idBlock.tagNumber>=37&&!1===s.idBlock.isHexOnly)return s.error="UNIVERSAL 37 and upper tags are reserved by ASN.1 standard",{offset:-1,result:s};switch(s.idBlock.tagNumber){case 0:if(s.idBlock.isConstructed&&s.lenBlock.length>0)return s.error="Type [UNIVERSAL 0] is reserved",{offset:-1,result:s};a=D.EndOfContent;break;case 1:a=D.Boolean;break;case 2:a=D.Integer;break;case 3:a=D.BitString;break;case 4:a=D.OctetString;break;case 5:a=D.Null;break;case 6:a=D.ObjectIdentifier;break;case 10:a=D.Enumerated;break;case 12:a=D.Utf8String;break;case 13:a=D.RelativeObjectIdentifier;break;case 14:a=D.TIME;break;case 15:return s.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:s};case 16:a=D.Sequence;break;case 17:a=D.Set;break;case 18:a=D.NumericString;break;case 19:a=D.PrintableString;break;case 20:a=D.TeletexString;break;case 21:a=D.VideotexString;break;case 22:a=D.IA5String;break;case 23:a=D.UTCTime;break;case 24:a=D.GeneralizedTime;break;case 25:a=D.GraphicString;break;case 26:a=D.VisibleString;break;case 27:a=D.GeneralString;break;case 28:a=D.UniversalString;break;case 29:a=D.CharacterString;break;case 30:a=D.BmpString;break;case 31:a=D.DATE;break;case 32:a=D.TimeOfDay;break;case 33:a=D.DateTime;break;case 34:a=D.Duration;break;default:{const t=s.idBlock.isConstructed?new D.Constructed:new D.Primitive;t.idBlock=s.idBlock,t.lenBlock=s.lenBlock,t.warnings=s.warnings,s=t}}break;case 2:case 3:case 4:default:a=s.idBlock.isConstructed?D.Constructed:D.Primitive}return s=function(t,e){if(t instanceof e)return t;const i=new e;return i.idBlock=t.idBlock,i.lenBlock=t.lenBlock,i.warnings=t.warnings,i.valueBeforeDecodeView=t.valueBeforeDecodeView,i}(s,a),o=s.fromBER(t,e,s.lenBlock.isIndefiniteForm?i:s.lenBlock.length),s.valueBeforeDecodeView=t.subarray(r,r+s.blockLength),{offset:o,result:s}}function O(t){if(!t.byteLength){const t=new B({},E);return t.error="Input buffer has zero length",{offset:-1,result:t}}return R(n.toUint8Array(t).slice(),0,t.byteLength)}D.Primitive=x,x.NAME="PRIMITIVE";class N extends E{constructor({value:t=[],isIndefiniteForm:e=!1,...i}={}){super(i),this.value=t,this.isIndefiniteForm=e}fromBER(t,e,i){const r=n.toUint8Array(t);if(!y(this,r,e,i))return-1;if(this.valueBeforeDecodeView=r.subarray(e,e+i),0===this.valueBeforeDecodeView.length)return this.warnings.push("Zero buffer length"),e;let s=e;for(;(this.isIndefiniteForm?1:i)>0;){const t=R(r,s,i);if(-1===t.offset)return this.error=t.result.error,this.warnings.concat(t.result.warnings),-1;if(s=t.offset,this.blockLength+=t.result.blockLength,i-=t.result.blockLength,this.value.push(t.result),this.isIndefiniteForm&&"EndOfContent"===t.result.constructor.NAME)break}return this.isIndefiniteForm&&("EndOfContent"===this.value[this.value.length-1].constructor.NAME?this.value.pop():this.warnings.push("No EndOfContent block encoded")),s}toBER(t,e){const i=e||new S;for(let r=0;r<this.value.length;r++)this.value[r].toBER(t,i);return e?A:i.final()}toJSON(){const t={...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,value:[]};for(const e of this.value)t.value.push(e.toJSON());return t}}N.NAME="ConstructedValueBlock";class k extends B{constructor(t={}){super(t,N),this.idBlock.isConstructed=!0}fromBER(t,e,i){this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm;const r=this.valueBlock.fromBER(t,e,this.lenBlock.isIndefiniteForm?i:this.lenBlock.length);return-1===r?(this.error=this.valueBlock.error,r):(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),r)}onAsciiEncoding(){const t=[];for(const i of this.valueBlock.value)t.push(i.toString("ascii").split("\n").map(t=>" "+t).join("\n"));const e=3===this.idBlock.tagClass?`[${this.idBlock.tagNumber}]`:this.constructor.NAME;return t.length?`${e} :\n${t.join("\n")}`:e+" :"}}D.Constructed=k,k.NAME="CONSTRUCTED";class M extends E{fromBER(t,e,i){return e}toBER(t){return A}}M.override="EndOfContentValueBlock";class K extends B{constructor(t={}){super(t,M),this.idBlock.tagClass=1,this.idBlock.tagNumber=0}}D.EndOfContent=K,K.NAME="EndOfContent";class H extends B{constructor(t={}){super(t,E),this.idBlock.tagClass=1,this.idBlock.tagNumber=5}fromBER(t,e,i){return this.lenBlock.length>0&&this.warnings.push("Non-zero length of value block for Null type"),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.blockLength+=i,e+i>t.byteLength?(this.error="End of input reached before message was fully decoded (inconsistent offset and length values)",-1):e+i}toBER(t,e){const i=new ArrayBuffer(2);if(!t){const t=new Uint8Array(i);t[0]=5,t[1]=0}return e&&e.write(i),i}onAsciiEncoding(){return""+this.constructor.NAME}}D.Null=H,H.NAME="NULL";class U extends(g(E)){constructor({value:t,...e}={}){super(e),this.valueHexView=e.valueHex?n.toUint8Array(e.valueHex):new Uint8Array(1),t&&(this.value=t)}get value(){for(const t of this.valueHexView)if(t>0)return!0;return!1}set value(t){this.valueHexView[0]=t?255:0}fromBER(t,e,i){const r=n.toUint8Array(t);return y(this,r,e,i)?(this.valueHexView=r.subarray(e,e+i),i>1&&this.warnings.push("Boolean value encoded in more then 1 octet"),this.isHexOnly=!0,h.call(this),this.blockLength=i,e+i):-1}toBER(){return this.valueHexView.slice()}toJSON(){return{...super.toJSON(),value:this.value}}}U.NAME="BooleanValueBlock";class _ extends B{constructor(t={}){super(t,U),this.idBlock.tagClass=1,this.idBlock.tagNumber=1}getValue(){return this.valueBlock.value}setValue(t){this.valueBlock.value=t}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.getValue}`}}D.Boolean=_,_.NAME="BOOLEAN";class j extends(g(N)){constructor({isConstructed:t=!1,...e}={}){super(e),this.isConstructed=t}fromBER(t,e,i){let r=0;if(this.isConstructed){if(this.isHexOnly=!1,r=N.prototype.fromBER.call(this,t,e,i),-1===r)return r;for(let t=0;t<this.value.length;t++){const e=this.value[t].constructor.NAME;if("EndOfContent"===e){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, OCTET STRING may consists of OCTET STRINGs only",-1}if("OCTET STRING"!==e)return this.error="OCTET STRING may consists of OCTET STRINGs only",-1}}else this.isHexOnly=!0,r=super.fromBER(t,e,i),this.blockLength=i;return r}toBER(t,e){return this.isConstructed?N.prototype.toBER.call(this,t,e):t?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),isConstructed:this.isConstructed}}}j.NAME="OctetStringValueBlock";class F extends B{constructor({idBlock:t={},lenBlock:e={},...i}={}){var r,s;null!==(r=i.isConstructed)&&void 0!==r||(i.isConstructed=!!(null===(s=i.value)||void 0===s?void 0:s.length)),super({idBlock:{isConstructed:i.isConstructed,...t},lenBlock:{...e,isIndefiniteForm:!!i.isIndefiniteForm},...i},j),this.idBlock.tagClass=1,this.idBlock.tagNumber=4}fromBER(t,e,i){if(this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,0===i)return 0===this.idBlock.error.length&&(this.blockLength+=this.idBlock.blockLength),0===this.lenBlock.error.length&&(this.blockLength+=this.lenBlock.blockLength),e;if(!this.valueBlock.isConstructed){const s=(t instanceof ArrayBuffer?new Uint8Array(t):t).subarray(e,e+i);try{if(s.byteLength){const t=R(s,0,s.byteLength);-1!==t.offset&&t.offset===i&&(this.valueBlock.value=[t.result])}}catch(r){}}return super.fromBER(t,e,i)}onAsciiEncoding(){return this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length?k.prototype.onAsciiEncoding.call(this):`${this.constructor.NAME} : ${o.ToHex(this.valueBlock.valueHexView)}`}getValue(){if(!this.idBlock.isConstructed)return this.valueBlock.valueHexView.slice().buffer;const t=[];for(const e of this.valueBlock.value)e instanceof F&&t.push(e.valueBlock.valueHexView);return n.concat(t)}}D.OctetString=F,F.NAME="OCTET STRING";class V extends(g(N)){constructor({unusedBits:t=0,isConstructed:e=!1,...i}={}){super(i),this.unusedBits=t,this.isConstructed=e,this.blockLength=this.valueHexView.byteLength}fromBER(t,e,i){if(!i)return e;let r=-1;if(this.isConstructed){if(r=N.prototype.fromBER.call(this,t,e,i),-1===r)return r;for(const t of this.value){const e=t.constructor.NAME;if("EndOfContent"===e){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, BIT STRING may consists of BIT STRINGs only",-1}if("BIT STRING"!==e)return this.error="BIT STRING may consists of BIT STRINGs only",-1;const i=t.valueBlock;if(this.unusedBits>0&&i.unusedBits>0)return this.error='Using of "unused bits" inside constructive BIT STRING allowed for least one only',-1;this.unusedBits=i.unusedBits}return r}const s=n.toUint8Array(t);if(!y(this,s,e,i))return-1;const o=s.subarray(e,e+i);if(this.unusedBits=o[0],this.unusedBits>7)return this.error="Unused bits for BitString must be in range 0-7",-1;if(!this.unusedBits){const t=o.subarray(1);try{if(t.byteLength){const e=R(t,0,t.byteLength);-1!==e.offset&&e.offset===i-1&&(this.value=[e.result])}}catch(a){}}return this.valueHexView=o.subarray(1),this.blockLength=o.length,e+i}toBER(t,e){if(this.isConstructed)return N.prototype.toBER.call(this,t,e);if(t)return new ArrayBuffer(this.valueHexView.byteLength+1);if(!this.valueHexView.byteLength)return A;const i=new Uint8Array(this.valueHexView.length+1);return i[0]=this.unusedBits,i.set(this.valueHexView,1),i.buffer}toJSON(){return{...super.toJSON(),unusedBits:this.unusedBits,isConstructed:this.isConstructed}}}V.NAME="BitStringValueBlock";class L extends B{constructor({idBlock:t={},lenBlock:e={},...i}={}){var r,s;null!==(r=i.isConstructed)&&void 0!==r||(i.isConstructed=!!(null===(s=i.value)||void 0===s?void 0:s.length)),super({idBlock:{isConstructed:i.isConstructed,...t},lenBlock:{...e,isIndefiniteForm:!!i.isIndefiniteForm},...i},V),this.idBlock.tagClass=1,this.idBlock.tagNumber=3}fromBER(t,e,i){return this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,super.fromBER(t,e,i)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return k.prototype.onAsciiEncoding.call(this);{const t=[],e=this.valueBlock.valueHexView;for(const r of e)t.push(r.toString(2).padStart(8,"0"));const i=t.join("");return`${this.constructor.NAME} : ${i.substring(0,i.length-this.valueBlock.unusedBits)}`}}}function G(t,e){const i=new Uint8Array([0]),r=new Uint8Array(t),s=new Uint8Array(e);let n=r.slice(0);const o=n.length-1,a=s.slice(0),c=a.length-1;let l=0,h=0;for(let p=c<o?o:c;p>=0;p--,h++){switch(!0){case h<a.length:l=n[o-h]+a[c-h]+i[0];break;default:l=n[o-h]+i[0]}switch(i[0]=l/10,!0){case h>=n.length:n=u(new Uint8Array([l%10]),n);break;default:n[o-h]=l%10}}return i[0]>0&&(n=u(i,n)),n}function $(t){if(t>=C.length)for(let e=C.length;e<=t;e++){const t=new Uint8Array([0]);let i=C[e-1].slice(0);for(let e=i.length-1;e>=0;e--){const r=new Uint8Array([(i[e]<<1)+t[0]]);t[0]=r[0]/10,i[e]=r[0]%10}t[0]>0&&(i=u(t,i)),C.push(i)}return C[t]}function Q(t,e){let i=0;const r=new Uint8Array(t),s=new Uint8Array(e),n=r.slice(0),o=n.length-1,a=s.slice(0),c=a.length-1;let l,u=0;for(let h=c;h>=0;h--,u++)switch(l=n[o-u]-a[c-u]-i,!0){case l<0:i=1,n[o-u]=l+10;break;default:i=0,n[o-u]=l}if(i>0)for(let h=o-c+1;h>=0;h--,u++){if(l=n[o-u]-i,!(l<0)){i=0,n[o-u]=l;break}i=1,n[o-u]=l+10}return n.slice()}D.BitString=L,L.NAME="BIT STRING";class W extends(g(E)){constructor({value:t,...e}={}){super(e),this._valueDec=0,e.valueHex&&this.setValueHex(),void 0!==t&&(this.valueDec=t)}setValueHex(){this.valueHexView.length>=4?(this.warnings.push("Too big Integer for decoding, hex only"),this.isHexOnly=!0,this._valueDec=0):(this.isHexOnly=!1,this.valueHexView.length>0&&(this._valueDec=h.call(this)))}set valueDec(t){this._valueDec=t,this.isHexOnly=!1,this.valueHexView=new Uint8Array(function(t){const e=t<0?-1*t:t;let i=128;for(let r=1;r<8;r++){if(e<=i){if(t<0){const t=l(i-e,8,r);return new Uint8Array(t)[0]|=128,t}let s=l(e,8,r),n=new Uint8Array(s);if(128&n[0]){const t=s.slice(0),e=new Uint8Array(t);s=new ArrayBuffer(s.byteLength+1),n=new Uint8Array(s);for(let i=0;i<t.byteLength;i++)n[i+1]=e[i];n[0]=0}return s}i*=Math.pow(2,8)}return new ArrayBuffer(0)}(t))}get valueDec(){return this._valueDec}fromDER(t,e,i,r=0){const s=this.fromBER(t,e,i);if(-1===s)return s;const n=this.valueHexView;return 0===n[0]&&0!=(128&n[1])?this.valueHexView=n.subarray(1):0!==r&&n.length<r&&(r-n.length>1&&(r=n.length+1),this.valueHexView=n.subarray(r-n.length)),s}toDER(t=!1){const e=this.valueHexView;switch(!0){case 0!=(128&e[0]):{const t=new Uint8Array(this.valueHexView.length+1);t[0]=0,t.set(e,1),this.valueHexView=t}break;case 0===e[0]&&0==(128&e[1]):this.valueHexView=this.valueHexView.subarray(1)}return this.toBER(t)}fromBER(t,e,i){const r=super.fromBER(t,e,i);return-1===r||this.setValueHex(),r}toBER(t){return t?new ArrayBuffer(this.valueHexView.length):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}toString(){const t=8*this.valueHexView.length-1;let e,i=new Uint8Array(8*this.valueHexView.length/3),r=0;const s=this.valueHexView;let n="",o=!1;for(let a=s.byteLength-1;a>=0;a--){e=s[a];for(let s=0;s<8;s++){if(1==(1&e))switch(r){case t:i=Q($(r),i),n="-";break;default:i=G(i,$(r))}r++,e>>=1}}for(let a=0;a<i.length;a++)i[a]&&(o=!0),o&&(n+="0123456789".charAt(i[a]));return!1===o&&(n+="0123456789".charAt(0)),n}}T=W,W.NAME="IntegerValueBlock",Object.defineProperty(T.prototype,"valueHex",{set:function(t){this.valueHexView=new Uint8Array(t),this.setValueHex()},get:function(){return this.valueHexView.slice().buffer}});class z extends B{constructor(t={}){super(t,W),this.idBlock.tagClass=1,this.idBlock.tagNumber=2}toBigInt(){return d(),BigInt(this.valueBlock.toString())}static fromBigInt(t){d();const e=BigInt(t),i=new S,r=e.toString(16).replace(/^-/,""),s=new Uint8Array(o.FromHex(r));if(e<0){const t=new Uint8Array(s.length+(128&s[0]?1:0));t[0]|=128;const r=BigInt("0x"+o.ToHex(t)),a=n.toUint8Array(o.FromHex((r+e).toString(16)));a[0]|=128,i.write(a)}else 128&s[0]&&i.write(new Uint8Array([0])),i.write(s);return new z({valueHex:i.final()})}convertToDER(){const t=new z({valueHex:this.valueBlock.valueHexView});return t.valueBlock.toDER(),t}convertFromDER(){return new z({valueHex:0===this.valueBlock.valueHexView[0]?this.valueBlock.valueHexView.subarray(1):this.valueBlock.valueHexView})}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()}`}}D.Integer=z,z.NAME="INTEGER";class q extends z{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=10}}D.Enumerated=q,q.NAME="ENUMERATED";class J extends(g(E)){constructor({valueDec:t=-1,isFirstSid:e=!1,...i}={}){super(i),this.valueDec=t,this.isFirstSid=e}fromBER(t,e,i){if(!i)return e;const r=n.toUint8Array(t);if(!y(this,r,e,i))return-1;const s=r.subarray(e,e+i);this.valueHexView=new Uint8Array(i);for(let n=0;n<i&&(this.valueHexView[n]=127&s[n],this.blockLength++,0!=(128&s[n]));n++);const o=new Uint8Array(this.blockLength);for(let n=0;n<this.blockLength;n++)o[n]=this.valueHexView[n];return this.valueHexView=o,0!=(128&s[this.blockLength-1])?(this.error="End of input reached before message was fully decoded",-1):(0===this.valueHexView[0]&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=c(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),e+this.blockLength)}set valueBigInt(t){d();let e=BigInt(t).toString(2);for(;e.length%7;)e="0"+e;const i=new Uint8Array(e.length/7);for(let r=0;r<i.length;r++)i[r]=parseInt(e.slice(7*r,7*r+7),2)+(r+1<i.length?128:0);this.fromBER(i.buffer,0,i.length)}toBER(t){if(this.isHexOnly){if(t)return new ArrayBuffer(this.valueHexView.byteLength);const e=this.valueHexView,i=new Uint8Array(this.blockLength);for(let t=0;t<this.blockLength-1;t++)i[t]=128|e[t];return i[this.blockLength-1]=e[this.blockLength-1],i.buffer}const e=l(this.valueDec,7);if(0===e.byteLength)return this.error="Error during encoding SID value",A;const i=new Uint8Array(e.byteLength);if(!t){const t=new Uint8Array(e),r=e.byteLength-1;for(let e=0;e<r;e++)i[e]=128|t[e];i[r]=t[r]}return i}toString(){let t="";if(this.isHexOnly)t=o.ToHex(this.valueHexView);else if(this.isFirstSid){let e=this.valueDec;this.valueDec<=39?t="0.":this.valueDec<=79?(t="1.",e-=40):(t="2.",e-=80),t+=e.toString()}else t=this.valueDec.toString();return t}toJSON(){return{...super.toJSON(),valueDec:this.valueDec,isFirstSid:this.isFirstSid}}}J.NAME="sidBlock";class Z extends E{constructor({value:t="",...e}={}){super(e),this.value=[],t&&this.fromString(t)}fromBER(t,e,i){let r=e;for(;i>0;){const e=new J;if(r=e.fromBER(t,r,i),-1===r)return this.blockLength=0,this.error=e.error,r;0===this.value.length&&(e.isFirstSid=!0),this.blockLength+=e.blockLength,i-=e.blockLength,this.value.push(e)}return r}toBER(t){const e=[];for(let i=0;i<this.value.length;i++){const r=this.value[i].toBER(t);if(0===r.byteLength)return this.error=this.value[i].error,A;e.push(r)}return f(e)}fromString(t){this.value=[];let e=0,i=0,r="",s=!1;do{if(i=t.indexOf(".",e),r=-1===i?t.substring(e):t.substring(e,i),e=i+1,s){const t=this.value[0];let e=0;switch(t.valueDec){case 0:break;case 1:e=40;break;case 2:e=80;break;default:return void(this.value=[])}const i=parseInt(r,10);if(isNaN(i))return;t.valueDec=i+e,s=!1}else{const t=new J;if(r>Number.MAX_SAFE_INTEGER){d();const e=BigInt(r);t.valueBigInt=e}else if(t.valueDec=parseInt(r,10),isNaN(t.valueDec))return;this.value.length||(t.isFirstSid=!0,s=!0),this.value.push(t)}}while(-1!==i)}toString(){let t="",e=!1;for(let i=0;i<this.value.length;i++){e=this.value[i].isHexOnly;let r=this.value[i].toString();0!==i&&(t+="."),e?(r=`{${r}}`,this.value[i].isFirstSid?t=`2.{${r} - 80}`:t+=r):t+=r}return t}toJSON(){const t={...super.toJSON(),value:this.toString(),sidArray:[]};for(let e=0;e<this.value.length;e++)t.sidArray.push(this.value[e].toJSON());return t}}Z.NAME="ObjectIdentifierValueBlock";class X extends B{constructor(t={}){super(t,Z),this.idBlock.tagClass=1,this.idBlock.tagNumber=6}getValue(){return this.valueBlock.toString()}setValue(t){this.valueBlock.fromString(t)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}}D.ObjectIdentifier=X,X.NAME="OBJECT IDENTIFIER";class Y extends(g(v)){constructor({valueDec:t=0,...e}={}){super(e),this.valueDec=t}fromBER(t,e,i){if(0===i)return e;const r=n.toUint8Array(t);if(!y(this,r,e,i))return-1;const s=r.subarray(e,e+i);this.valueHexView=new Uint8Array(i);for(let n=0;n<i&&(this.valueHexView[n]=127&s[n],this.blockLength++,0!=(128&s[n]));n++);const o=new Uint8Array(this.blockLength);for(let n=0;n<this.blockLength;n++)o[n]=this.valueHexView[n];return this.valueHexView=o,0!=(128&s[this.blockLength-1])?(this.error="End of input reached before message was fully decoded",-1):(0===this.valueHexView[0]&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=c(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),e+this.blockLength)}toBER(t){if(this.isHexOnly){if(t)return new ArrayBuffer(this.valueHexView.byteLength);const e=this.valueHexView,i=new Uint8Array(this.blockLength);for(let t=0;t<this.blockLength-1;t++)i[t]=128|e[t];return i[this.blockLength-1]=e[this.blockLength-1],i.buffer}const e=l(this.valueDec,7);if(0===e.byteLength)return this.error="Error during encoding SID value",A;const i=new Uint8Array(e.byteLength);if(!t){const t=new Uint8Array(e),r=e.byteLength-1;for(let e=0;e<r;e++)i[e]=128|t[e];i[r]=t[r]}return i.buffer}toString(){let t="";return t=this.isHexOnly?o.ToHex(this.valueHexView):this.valueDec.toString(),t}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}}Y.NAME="relativeSidBlock";class tt extends E{constructor({value:t="",...e}={}){super(e),this.value=[],t&&this.fromString(t)}fromBER(t,e,i){let r=e;for(;i>0;){const e=new Y;if(r=e.fromBER(t,r,i),-1===r)return this.blockLength=0,this.error=e.error,r;this.blockLength+=e.blockLength,i-=e.blockLength,this.value.push(e)}return r}toBER(t,e){const i=[];for(let r=0;r<this.value.length;r++){const e=this.value[r].toBER(t);if(0===e.byteLength)return this.error=this.value[r].error,A;i.push(e)}return f(i)}fromString(t){this.value=[];let e=0,i=0,r="";do{i=t.indexOf(".",e),r=-1===i?t.substring(e):t.substring(e,i),e=i+1;const s=new Y;if(s.valueDec=parseInt(r,10),isNaN(s.valueDec))return!0;this.value.push(s)}while(-1!==i);return!0}toString(){let t="",e=!1;for(let i=0;i<this.value.length;i++){e=this.value[i].isHexOnly;let r=this.value[i].toString();0!==i&&(t+="."),e?(r=`{${r}}`,t+=r):t+=r}return t}toJSON(){const t={...super.toJSON(),value:this.toString(),sidArray:[]};for(let e=0;e<this.value.length;e++)t.sidArray.push(this.value[e].toJSON());return t}}tt.NAME="RelativeObjectIdentifierValueBlock";class et extends B{constructor(t={}){super(t,tt),this.idBlock.tagClass=1,this.idBlock.tagNumber=13}getValue(){return this.valueBlock.toString()}setValue(t){this.valueBlock.fromString(t)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}}D.RelativeObjectIdentifier=et,et.NAME="RelativeObjectIdentifier";class it extends k{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=16}}D.Sequence=it,it.NAME="SEQUENCE";class rt extends k{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=17}}D.Set=rt,rt.NAME="SET";class st extends(g(E)){constructor({...t}={}){super(t),this.isHexOnly=!0,this.value=""}toJSON(){return{...super.toJSON(),value:this.value}}}st.NAME="StringValueBlock";class nt extends st{}nt.NAME="SimpleStringValueBlock";class ot extends b{constructor({...t}={}){super(t,nt)}fromBuffer(t){this.valueBlock.value=String.fromCharCode.apply(null,n.toUint8Array(t))}fromString(t){const e=t.length,i=this.valueBlock.valueHexView=new Uint8Array(e);for(let r=0;r<e;r++)i[r]=t.charCodeAt(r);this.valueBlock.value=t}}ot.NAME="SIMPLE STRING";class at extends ot{fromBuffer(t){this.valueBlock.valueHexView=n.toUint8Array(t);try{this.valueBlock.value=o.ToUtf8String(t)}catch(e){this.warnings.push(`Error during "decodeURIComponent": ${e}, using raw string`),this.valueBlock.value=o.ToBinary(t)}}fromString(t){this.valueBlock.valueHexView=new Uint8Array(o.FromUtf8String(t)),this.valueBlock.value=t}}at.NAME="Utf8StringValueBlock";class ct extends at{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=12}}D.Utf8String=ct,ct.NAME="UTF8String";class lt extends ot{fromBuffer(t){this.valueBlock.value=o.ToUtf16String(t),this.valueBlock.valueHexView=n.toUint8Array(t)}fromString(t){this.valueBlock.value=t,this.valueBlock.valueHexView=new Uint8Array(o.FromUtf16String(t))}}lt.NAME="BmpStringValueBlock";class ut extends lt{constructor({...t}={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=30}}D.BmpString=ut,ut.NAME="BMPString";class ht extends ot{fromBuffer(t){const e=ArrayBuffer.isView(t)?t.slice().buffer:t.slice(0),i=new Uint8Array(e);for(let r=0;r<i.length;r+=4)i[r]=i[r+3],i[r+1]=i[r+2],i[r+2]=0,i[r+3]=0;this.valueBlock.value=String.fromCharCode.apply(null,new Uint32Array(e))}fromString(t){const e=t.length,i=this.valueBlock.valueHexView=new Uint8Array(4*e);for(let r=0;r<e;r++){const e=l(t.charCodeAt(r),8),s=new Uint8Array(e);if(s.length>4)continue;const n=4-s.length;for(let t=s.length-1;t>=0;t--)i[4*r+t+n]=s[t]}this.valueBlock.value=t}}ht.NAME="UniversalStringValueBlock";class pt extends ht{constructor({...t}={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=28}}D.UniversalString=pt,pt.NAME="UniversalString";class dt extends ot{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=18}}D.NumericString=dt,dt.NAME="NumericString";class ft extends ot{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=19}}D.PrintableString=ft,ft.NAME="PrintableString";class yt extends ot{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=20}}D.TeletexString=yt,yt.NAME="TeletexString";class St extends ot{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=21}}D.VideotexString=St,St.NAME="VideotexString";class Ct extends ot{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=22}}D.IA5String=Ct,Ct.NAME="IA5String";class At extends ot{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=25}}D.GraphicString=At,At.NAME="GraphicString";class mt extends ot{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=26}}D.VisibleString=mt,mt.NAME="VisibleString";class gt extends ot{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=27}}D.GeneralString=gt,gt.NAME="GeneralString";class vt extends ot{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=29}}D.CharacterString=vt,vt.NAME="CharacterString";class Et extends mt{constructor({value:t,valueDate:e,...i}={}){if(super(i),this.year=0,this.month=0,this.day=0,this.hour=0,this.minute=0,this.second=0,t){this.fromString(t),this.valueBlock.valueHexView=new Uint8Array(t.length);for(let e=0;e<t.length;e++)this.valueBlock.valueHexView[e]=t.charCodeAt(e)}e&&(this.fromDate(e),this.valueBlock.valueHexView=new Uint8Array(this.toBuffer())),this.idBlock.tagClass=1,this.idBlock.tagNumber=23}fromBuffer(t){this.fromString(String.fromCharCode.apply(null,n.toUint8Array(t)))}toBuffer(){const t=this.toString(),e=new ArrayBuffer(t.length),i=new Uint8Array(e);for(let r=0;r<t.length;r++)i[r]=t.charCodeAt(r);return e}fromDate(t){this.year=t.getUTCFullYear(),this.month=t.getUTCMonth()+1,this.day=t.getUTCDate(),this.hour=t.getUTCHours(),this.minute=t.getUTCMinutes(),this.second=t.getUTCSeconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second))}fromString(t){const e=/(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})Z/gi.exec(t);if(null===e)return void(this.error="Wrong input string for conversion");const i=parseInt(e[1],10);this.year=i>=50?1900+i:2e3+i,this.month=parseInt(e[2],10),this.day=parseInt(e[3],10),this.hour=parseInt(e[4],10),this.minute=parseInt(e[5],10),this.second=parseInt(e[6],10)}toString(t="iso"){if("iso"===t){const t=new Array(7);return t[0]=p(this.year<2e3?this.year-1900:this.year-2e3,2),t[1]=p(this.month,2),t[2]=p(this.day,2),t[3]=p(this.hour,2),t[4]=p(this.minute,2),t[5]=p(this.second,2),t[6]="Z",t.join("")}return super.toString(t)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.toDate().toISOString()}`}toJSON(){return{...super.toJSON(),year:this.year,month:this.month,day:this.day,hour:this.hour,minute:this.minute,second:this.second}}}D.UTCTime=Et,Et.NAME="UTCTime";class wt extends Et{constructor(t={}){var e;super(t),null!==(e=this.millisecond)&&void 0!==e||(this.millisecond=0),this.idBlock.tagClass=1,this.idBlock.tagNumber=24}fromDate(t){super.fromDate(t),this.millisecond=t.getUTCMilliseconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second,this.millisecond))}fromString(t){let e,i=!1,r="",s="",n=0,o=0,a=0;if("Z"===t[t.length-1])r=t.substring(0,t.length-1),i=!0;else{const e=new Number(t[t.length-1]);if(isNaN(e.valueOf()))throw new Error("Wrong input string for conversion");r=t}if(i){if(-1!==r.indexOf("+"))throw new Error("Wrong input string for conversion");if(-1!==r.indexOf("-"))throw new Error("Wrong input string for conversion")}else{let t=1,e=r.indexOf("+"),i="";if(-1===e&&(e=r.indexOf("-"),t=-1),-1!==e){if(i=r.substring(e+1),r=r.substring(0,e),2!==i.length&&4!==i.length)throw new Error("Wrong input string for conversion");let s=parseInt(i.substring(0,2),10);if(isNaN(s.valueOf()))throw new Error("Wrong input string for conversion");if(o=t*s,4===i.length){if(s=parseInt(i.substring(2,4),10),isNaN(s.valueOf()))throw new Error("Wrong input string for conversion");a=t*s}}}let c=r.indexOf(".");if(-1===c&&(c=r.indexOf(",")),-1!==c){const t=new Number("0"+r.substring(c));if(isNaN(t.valueOf()))throw new Error("Wrong input string for conversion");n=t.valueOf(),s=r.substring(0,c)}else s=r;switch(!0){case 8===s.length:if(e=/(\d{4})(\d{2})(\d{2})/gi,-1!==c)throw new Error("Wrong input string for conversion");break;case 10===s.length:if(e=/(\d{4})(\d{2})(\d{2})(\d{2})/gi,-1!==c){let t=60*n;this.minute=Math.floor(t),t=60*(t-this.minute),this.second=Math.floor(t),t=1e3*(t-this.second),this.millisecond=Math.floor(t)}break;case 12===s.length:if(e=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/gi,-1!==c){let t=60*n;this.second=Math.floor(t),t=1e3*(t-this.second),this.millisecond=Math.floor(t)}break;case 14===s.length:e=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/gi,-1!==c&&(this.millisecond=Math.floor(1e3*n));break;default:throw new Error("Wrong input string for conversion")}const l=e.exec(s);if(null===l)throw new Error("Wrong input string for conversion");for(let u=1;u<l.length;u++)switch(u){case 1:this.year=parseInt(l[u],10);break;case 2:this.month=parseInt(l[u],10);break;case 3:this.day=parseInt(l[u],10);break;case 4:this.hour=parseInt(l[u],10)+o;break;case 5:this.minute=parseInt(l[u],10)+a;break;case 6:this.second=parseInt(l[u],10);break;default:throw new Error("Wrong input string for conversion")}if(!1===i){const t=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond);this.year=t.getUTCFullYear(),this.month=t.getUTCMonth(),this.day=t.getUTCDay(),this.hour=t.getUTCHours(),this.minute=t.getUTCMinutes(),this.second=t.getUTCSeconds(),this.millisecond=t.getUTCMilliseconds()}}toString(t="iso"){if("iso"===t){const t=[];return t.push(p(this.year,4)),t.push(p(this.month,2)),t.push(p(this.day,2)),t.push(p(this.hour,2)),t.push(p(this.minute,2)),t.push(p(this.second,2)),0!==this.millisecond&&(t.push("."),t.push(p(this.millisecond,3))),t.push("Z"),t.join("")}return super.toString(t)}toJSON(){return{...super.toJSON(),millisecond:this.millisecond}}}D.GeneralizedTime=wt,wt.NAME="GeneralizedTime";class Pt extends ct{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=31}}D.DATE=Pt,Pt.NAME="DATE";class Dt extends ct{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=32}}D.TimeOfDay=Dt,Dt.NAME="TimeOfDay";class Bt extends ct{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=33}}D.DateTime=Bt,Bt.NAME="DateTime";class bt extends ct{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=34}}D.Duration=bt,bt.NAME="Duration";class It extends ct{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=14}}D.TIME=It,It.NAME="TIME";class Tt{constructor({name:t="",optional:e=!1}={}){this.name=t,this.optional=e}}class xt extends Tt{constructor({value:t=[],...e}={}){super(e),this.value=t}}class Rt extends Tt{constructor({value:t=new Tt,local:e=!1,...i}={}){super(i),this.value=t,this.local=e}}function Ot(t,e,i){if(i instanceof xt){for(let r=0;r<i.value.length;r++)if(Ot(t,e,i.value[r]).verified)return{verified:!0,result:t};{const t={verified:!1,result:{error:"Wrong values for Choice type"}};return i.hasOwnProperty("name")&&(t.name=i.name),t}}if(i instanceof Tt)return i.hasOwnProperty("name")&&(t[i.name]=e),{verified:!0,result:t};if(t instanceof Object==0)return{verified:!1,result:{error:"Wrong root object"}};if(e instanceof Object==0)return{verified:!1,result:{error:"Wrong ASN.1 data"}};if(i instanceof Object==0)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if("idBlock"in i==0)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if("fromBER"in i.idBlock==0)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if("toBER"in i.idBlock==0)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};const r=i.idBlock.toBER(!1);if(0===r.byteLength)return{verified:!1,result:{error:"Error encoding idBlock for ASN.1 schema"}};if(-1===i.idBlock.fromBER(r,0,r.byteLength))return{verified:!1,result:{error:"Error decoding idBlock for ASN.1 schema"}};if(!1===i.idBlock.hasOwnProperty("tagClass"))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(i.idBlock.tagClass!==e.idBlock.tagClass)return{verified:!1,result:t};if(!1===i.idBlock.hasOwnProperty("tagNumber"))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(i.idBlock.tagNumber!==e.idBlock.tagNumber)return{verified:!1,result:t};if(!1===i.idBlock.hasOwnProperty("isConstructed"))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(i.idBlock.isConstructed!==e.idBlock.isConstructed)return{verified:!1,result:t};if(!("isHexOnly"in i.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(i.idBlock.isHexOnly!==e.idBlock.isHexOnly)return{verified:!1,result:t};if(i.idBlock.isHexOnly){if("valueHexView"in i.idBlock==0)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};const r=i.idBlock.valueHexView,s=e.idBlock.valueHexView;if(r.length!==s.length)return{verified:!1,result:t};for(let e=0;e<r.length;e++)if(r[e]!==s[1])return{verified:!1,result:t}}if(i.name&&(i.name=i.name.replace(/^\s+|\s+$/g,""),i.name&&(t[i.name]=e)),i instanceof D.Constructed){let r=0,s={verified:!1,result:{error:"Unknown error"}},n=i.valueBlock.value.length;if(n>0&&i.valueBlock.value[0]instanceof Rt&&(n=e.valueBlock.value.length),0===n)return{verified:!0,result:t};if(0===e.valueBlock.value.length&&0!==i.valueBlock.value.length){let e=!0;for(let t=0;t<i.valueBlock.value.length;t++)e=e&&(i.valueBlock.value[t].optional||!1);return e?{verified:!0,result:t}:(i.name&&(i.name=i.name.replace(/^\s+|\s+$/g,""),i.name&&delete t[i.name]),t.error="Inconsistent object length",{verified:!1,result:t})}for(let o=0;o<n;o++)if(o-r>=e.valueBlock.value.length){if(!1===i.valueBlock.value[o].optional){const e={verified:!1,result:t};return t.error="Inconsistent length between ASN.1 data and schema",i.name&&(i.name=i.name.replace(/^\s+|\s+$/g,""),i.name&&(delete t[i.name],e.name=i.name)),e}}else if(i.valueBlock.value[0]instanceof Rt){if(s=Ot(t,e.valueBlock.value[o],i.valueBlock.value[0].value),!1===s.verified){if(!i.valueBlock.value[0].optional)return i.name&&(i.name=i.name.replace(/^\s+|\s+$/g,""),i.name&&delete t[i.name]),s;r++}if("name"in i.valueBlock.value[0]&&i.valueBlock.value[0].name.length>0){let r={};r="local"in i.valueBlock.value[0]&&i.valueBlock.value[0].local?e:t,void 0===r[i.valueBlock.value[0].name]&&(r[i.valueBlock.value[0].name]=[]),r[i.valueBlock.value[0].name].push(e.valueBlock.value[o])}}else if(s=Ot(t,e.valueBlock.value[o-r],i.valueBlock.value[o]),!1===s.verified){if(!i.valueBlock.value[o].optional)return i.name&&(i.name=i.name.replace(/^\s+|\s+$/g,""),i.name&&delete t[i.name]),s;r++}if(!1===s.verified){const e={verified:!1,result:t};return i.name&&(i.name=i.name.replace(/^\s+|\s+$/g,""),i.name&&(delete t[i.name],e.name=i.name)),e}return{verified:!0,result:t}}if(i.primitiveSchema&&"valueHexView"in e.valueBlock){const r=R(e.valueBlock.valueHexView);if(-1===r.offset){const e={verified:!1,result:r.result};return i.name&&(i.name=i.name.replace(/^\s+|\s+$/g,""),i.name&&(delete t[i.name],e.name=i.name)),e}return Ot(t,r.result,i.primitiveSchema)}return{verified:!0,result:t}}const Nt=Object.freeze({__proto__:null,Any:Tt,BaseBlock:B,BaseStringBlock:b,BitString:L,BmpString:ut,Boolean:_,CharacterString:vt,Choice:xt,Constructed:k,DATE:Pt,DateTime:Bt,Duration:bt,EndOfContent:K,Enumerated:q,GeneralString:gt,GeneralizedTime:wt,GraphicString:At,HexBlock:g,IA5String:Ct,Integer:z,Null:H,NumericString:dt,ObjectIdentifier:X,OctetString:F,Primitive:x,PrintableString:ft,RawData:class{constructor({data:t=m}={}){this.dataView=n.toUint8Array(t)}get data(){return this.dataView.slice().buffer}set data(t){this.dataView=n.toUint8Array(t)}fromBER(t,e,i){const r=e+i;return this.dataView=n.toUint8Array(t).subarray(e,r),r}toBER(t){return this.dataView.slice().buffer}},RelativeObjectIdentifier:et,Repeated:Rt,Sequence:it,Set:rt,TIME:It,TeletexString:yt,TimeOfDay:Dt,UTCTime:Et,UniversalString:pt,Utf8String:ct,ValueBlock:E,VideotexString:St,ViewWriter:S,VisibleString:mt,compareSchema:Ot,fromBER:O,verifySchema:function(t,e){if(e instanceof Object==0)return{verified:!1,result:{error:"Wrong ASN.1 schema type"}};const i=R(n.toUint8Array(t));return-1===i.offset?{verified:!1,result:i.result}:Ot(i.result,i.result,e)}});var kt,Mt;!function(t){t[t.Sequence=0]="Sequence",t[t.Set=1]="Set",t[t.Choice=2]="Choice"}(kt||(kt={})),function(t){t[t.Any=1]="Any",t[t.Boolean=2]="Boolean",t[t.OctetString=3]="OctetString",t[t.BitString=4]="BitString",t[t.Integer=5]="Integer",t[t.Enumerated=6]="Enumerated",t[t.ObjectIdentifier=7]="ObjectIdentifier",t[t.Utf8String=8]="Utf8String",t[t.BmpString=9]="BmpString",t[t.UniversalString=10]="UniversalString",t[t.NumericString=11]="NumericString",t[t.PrintableString=12]="PrintableString",t[t.TeletexString=13]="TeletexString",t[t.VideotexString=14]="VideotexString",t[t.IA5String=15]="IA5String",t[t.GraphicString=16]="GraphicString",t[t.VisibleString=17]="VisibleString",t[t.GeneralString=18]="GeneralString",t[t.CharacterString=19]="CharacterString",t[t.UTCTime=20]="UTCTime",t[t.GeneralizedTime=21]="GeneralizedTime",t[t.DATE=22]="DATE",t[t.TimeOfDay=23]="TimeOfDay",t[t.DateTime=24]="DateTime",t[t.Duration=25]="Duration",t[t.TIME=26]="TIME",t[t.Null=27]="Null"}(Mt||(Mt={}));const Kt={fromASN:t=>t instanceof H?null:t.valueBeforeDecode,toASN:t=>{if(null===t)return new H;const e=O(t);if(e.result.error)throw new Error(e.result.error);return e.result}},Ht={fromASN:t=>t.valueBlock.valueHex.byteLength>4?t.valueBlock.toString():t.valueBlock.valueDec,toASN:t=>new z({value:t})},Ut={fromASN:t=>t.valueBlock.valueDec,toASN:t=>new q({value:t})},_t={fromASN:t=>t.valueBlock.valueHex,toASN:t=>new z({valueHex:t})},jt={fromASN:t=>t.valueBlock.valueHex,toASN:t=>new L({valueHex:t})},Ft={fromASN:t=>t.valueBlock.toString(),toASN:t=>new X({value:t})},Vt={fromASN:t=>t.valueBlock.value,toASN:t=>new _({value:t})},Lt={fromASN:t=>t.valueBlock.valueHex,toASN:t=>new F({valueHex:t})};function Gt(t){return{fromASN:t=>t.valueBlock.value,toASN:e=>new t({value:e})}}const $t=Gt(ct),Qt=Gt(ut),Wt=Gt(pt),zt=Gt(dt),qt=Gt(ft),Jt=Gt(yt),Zt=Gt(St),Xt=Gt(Ct),Yt=Gt(At),te=Gt(mt),ee=Gt(gt),ie=Gt(vt),re={fromASN:t=>t.toDate(),toASN:t=>new Et({valueDate:t})},se={fromASN:t=>t.toDate(),toASN:t=>new wt({valueDate:t})},ne={fromASN:()=>null,toASN:()=>new H};function oe(t){switch(t){case Mt.Any:return Kt;case Mt.BitString:return jt;case Mt.BmpString:return Qt;case Mt.Boolean:return Vt;case Mt.CharacterString:return ie;case Mt.Enumerated:return Ut;case Mt.GeneralString:return ee;case Mt.GeneralizedTime:return se;case Mt.GraphicString:return Yt;case Mt.IA5String:return Xt;case Mt.Integer:return Ht;case Mt.Null:return ne;case Mt.NumericString:return zt;case Mt.ObjectIdentifier:return Ft;case Mt.OctetString:return Lt;case Mt.PrintableString:return qt;case Mt.TeletexString:return Jt;case Mt.UTCTime:return re;case Mt.UniversalString:return Wt;case Mt.Utf8String:return $t;case Mt.VideotexString:return Zt;case Mt.VisibleString:return te;default:return null}}class ae{constructor(t,e=0){if(this.unusedBits=0,this.value=new ArrayBuffer(0),t)if("number"==typeof t)this.fromNumber(t);else{if(!n.isBufferSource(t))throw TypeError("Unsupported type of 'params' argument for BitString");this.unusedBits=e,this.value=n.toArrayBuffer(t)}}fromASN(t){if(!(t instanceof L))throw new TypeError("Argument 'asn' is not instance of ASN.1 BitString");return this.unusedBits=t.valueBlock.unusedBits,this.value=t.valueBlock.valueHex,this}toASN(){return new L({unusedBits:this.unusedBits,valueHex:this.value})}toSchema(t){return new L({name:t})}toNumber(){let t="";const e=new Uint8Array(this.value);for(const i of e)t+=i.toString(2).padStart(8,"0");return t=t.split("").reverse().join(""),this.unusedBits&&(t=t.slice(this.unusedBits).padStart(this.unusedBits,"0")),parseInt(t,2)}fromNumber(t){let e=t.toString(2);const i=e.length+7>>3;this.unusedBits=(i<<3)-e.length;const r=new Uint8Array(i);e=e.padStart(i<<3,"0").split("").reverse().join("");let s=0;for(;s<i;)r[s]=parseInt(e.slice(s<<3,8+(s<<3)),2),s++;this.value=r.buffer}}class ce{constructor(t){this.buffer="number"==typeof t?new ArrayBuffer(t):n.isBufferSource(t)?n.toArrayBuffer(t):Array.isArray(t)?new Uint8Array(t):new ArrayBuffer(0)}get byteLength(){return this.buffer.byteLength}get byteOffset(){return 0}fromASN(t){if(!(t instanceof F))throw new TypeError("Argument 'asn' is not instance of ASN.1 OctetString");return this.buffer=t.valueBlock.valueHex,this}toASN(){return new F({valueHex:this.buffer})}toSchema(t){return new F({name:t})}}function le(t){return t&&t.prototype?!(!t.prototype.toASN||!t.prototype.fromASN)||le(t.prototype):!!(t&&t.toASN&&t.fromASN)}function ue(t,e){if(!t||!e)return!1;if(t.byteLength!==e.byteLength)return!1;const i=new Uint8Array(t),r=new Uint8Array(e);for(let s=0;s<t.byteLength;s++)if(i[s]!==r[s])return!1;return!0}const he=new class{constructor(){this.items=new WeakMap}has(t){return this.items.has(t)}get(t){var e,i,r;const s=this.items.get(t);if(!s)throw new Error(`Cannot get schema for '${null!==(r=null===(i=null===(e=null==t?void 0:t.prototype)||void 0===e?void 0:e.constructor)||void 0===i?void 0:i.name)&&void 0!==r?r:t}' target`);return s}cache(t){const e=this.get(t);e.schema||(e.schema=this.create(t,!0))}createDefault(t){const e={type:kt.Sequence,items:{}},i=this.findParentSchema(t);return i&&(Object.assign(e,i),e.items=Object.assign({},e.items,i.items)),e}create(t,e){const i=this.items.get(t)||this.createDefault(t),r=[];for(const s in i.items){const t=i.items[s],n=e?s:"";let o;if("number"==typeof t.type){const e=Mt[t.type],i=Nt[e];if(!i)throw new Error(`Cannot get ASN1 class by name '${e}'`);o=new i({name:n})}else le(t.type)?o=(new t.type).toSchema(n):t.optional?this.get(t.type).type===kt.Choice?o=new Tt({name:n}):(o=this.create(t.type,!1),o.name=n):o=new Tt({name:n});const a=!!t.optional||void 0!==t.defaultValue;if(t.repeated&&(o.name="",o=new("set"===t.repeated?rt:it)({name:"",value:[new Rt({name:n,value:o})]})),null!=t.context)if(t.implicit)if("number"==typeof t.type||le(t.type))r.push(new(t.repeated?k:x)({name:n,optional:a,idBlock:{tagClass:3,tagNumber:t.context}}));else{this.cache(t.type);const e=!!t.repeated;let i=e?o:this.get(t.type).schema;i=i.valueBlock?i.valueBlock.value:i.value,r.push(new k({name:e?"":n,optional:a,idBlock:{tagClass:3,tagNumber:t.context},value:i}))}else r.push(new k({optional:a,idBlock:{tagClass:3,tagNumber:t.context},value:[o]}));else o.optional=a,r.push(o)}switch(i.type){case kt.Sequence:return new it({value:r,name:""});case kt.Set:return new rt({value:r,name:""});case kt.Choice:return new xt({value:r,name:""});default:throw new Error("Unsupported ASN1 type in use")}}set(t,e){return this.items.set(t,e),this}findParentSchema(t){const e=t.__proto__;return e?this.items.get(e)||this.findParentSchema(e):null}},pe=t=>e=>{let i;he.has(e)?i=he.get(e):(i=he.createDefault(e),he.set(e,i)),Object.assign(i,t)},de=t=>(e,i)=>{let r;he.has(e.constructor)?r=he.get(e.constructor):(r=he.createDefault(e.constructor),he.set(e.constructor,r));const s=Object.assign({},t);if("number"==typeof s.type&&!s.converter){const r=oe(t.type);if(!r)throw new Error(`Cannot get default converter for property '${i}' of ${e.constructor.name}`);s.converter=r}r.items[i]=s};class fe extends Error{constructor(){super(...arguments),this.schemas=[]}}class ye{static parse(t,e){let i;if(t instanceof ArrayBuffer)i=t;else if("undefined"!=typeof Buffer&&Buffer.isBuffer(t))i=new Uint8Array(t).buffer;else{if(!(ArrayBuffer.isView(t)||t.buffer instanceof ArrayBuffer))throw new TypeError("Wrong type of 'data' argument");i=t.buffer}const r=O(i);if(r.result.error)throw new Error(r.result.error);return this.fromASN(r.result,e)}static fromASN(t,e){var i;try{if(le(e))return(new e).fromASN(t);const r=he.get(e);he.cache(e);let s=r.schema;if(t.constructor===k&&r.type!==kt.Choice){s=new k({idBlock:{tagClass:3,tagNumber:t.idBlock.tagNumber},value:r.schema.valueBlock.value});for(const e in r.items)delete t[e]}const n=Ot(t,t,s);if(!n.verified)throw new fe(`Data does not match to ${e.name} ASN1 schema. ${n.result.error}`);const o=new e;if(function t(e){var i;if(e){const r=Object.getPrototypeOf(e);return(null===(i=null==r?void 0:r.prototype)||void 0===i?void 0:i.constructor)===Array||t(r)}return!1}(e)){if("number"==typeof r.itemType){const i=oe(r.itemType);if(!i)throw new Error(`Cannot get default converter for array item of ${e.name} ASN1 schema`);return e.from(t.valueBlock.value,t=>i.fromASN(t))}return e.from(t.valueBlock.value,t=>this.fromASN(t,r.itemType))}for(const e in r.items){if(!t[e])continue;const s=r.items[e];if("number"==typeof s.type||le(s.type)){const r=null!==(i=s.converter)&&void 0!==i?i:le(s.type)?new s.type:null;if(!r)throw new Error("Converter is empty");if(s.repeated)if(s.implicit){const i=new("sequence"===s.repeated?it:rt);i.valueBlock=t[e].valueBlock;const n=O(i.toBER(!1)).result.valueBlock.value;o[e]=Array.from(n,t=>r.fromASN(t))}else o[e]=Array.from(t[e],t=>r.fromASN(t));else{let i=t[e];if(s.implicit){let t;if(le(s.type))t=(new s.type).toSchema("");else{const e=Mt[s.type],i=Nt[e];if(!i)throw new Error(`Cannot get '${e}' class from asn1js module`);t=new i}t.valueBlock=i.valueBlock,i=O(t.toBER(!1)).result}o[e]=r.fromASN(i)}}else o[e]=s.repeated?Array.from(t[e],t=>this.fromASN(t,s.type)):this.fromASN(t[e],s.type)}return o}catch(r){throw r instanceof fe&&r.schemas.push(e.name),r}}}class Se{static serialize(t){return t instanceof B?t.toBER(!1):this.toASN(t).toBER(!1)}static toASN(t){if(t&&le(t.constructor))return t.toASN();const e=t.constructor,i=he.get(e);he.cache(e);let r,s=[];if(i.itemType)if("number"==typeof i.itemType){const r=oe(i.itemType);if(!r)throw new Error(`Cannot get default converter for array item of ${e.name} ASN1 schema`);s=t.map(t=>r.toASN(t))}else s=t.map(t=>this.toAsnItem({type:i.itemType},"[]",e,t));else for(const n in i.items){const r=i.items[n],o=t[n];if(void 0===o||r.defaultValue===o||"object"==typeof r.defaultValue&&"object"==typeof o&&ue(this.serialize(r.defaultValue),this.serialize(o)))continue;let a=Se.toAsnItem(r,n,e,o);if("number"==typeof r.context)if(r.implicit)if(r.repeated||"number"!=typeof r.type&&!le(r.type))s.push(new k({optional:r.optional,idBlock:{tagClass:3,tagNumber:r.context},value:a.valueBlock.value}));else{const t={};t.valueHex=a instanceof H?a.valueBeforeDecode:a.valueBlock.toBER(),s.push(new x({optional:r.optional,idBlock:{tagClass:3,tagNumber:r.context},...t}))}else s.push(new k({optional:r.optional,idBlock:{tagClass:3,tagNumber:r.context},value:[a]}));else r.repeated?s=s.concat(a):s.push(a)}switch(i.type){case kt.Sequence:r=new it({value:s});break;case kt.Set:r=new rt({value:s});break;case kt.Choice:if(!s[0])throw new Error(`Schema '${e.name}' has wrong data. Choice cannot be empty.`);r=s[0]}return r}static toAsnItem(t,e,i,r){let s;if("number"==typeof t.type){const n=t.converter;if(!n)throw new Error(`Property '${e}' doesn't have converter for type ${Mt[t.type]} in schema '${i.name}'`);if(t.repeated){const e=Array.from(r,t=>n.toASN(t));s=new("sequence"===t.repeated?it:rt)({value:e})}else s=n.toASN(r)}else if(t.repeated){const e=Array.from(r,t=>this.toASN(t));s=new("sequence"===t.repeated?it:rt)({value:e})}else s=this.toASN(r);return s}}class Ce extends Array{constructor(t=[]){if("number"==typeof t)super(t);else{super();for(const e of t)this.push(e)}}}class Ae{static serialize(t){return Se.serialize(t)}static parse(t,e){return ye.parse(t,e)}static toString(t){const e=O(n.isBufferSource(t)?n.toArrayBuffer(t):Ae.serialize(t));if(-1===e.offset)throw new Error("Cannot decode ASN.1 data. "+e.result.error);return e.result.toString()}}function me(t,e,i,r){var s,n=arguments.length,o=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(n<3?s(o):n>3?s(e,i,o):s(e,i))||o);return n>3&&o&&Object.defineProperty(e,i,o),o}var ge,ve,Ee,we=t((function(t){!function(e){const i="(0?\\d+|0x[a-f0-9]+)",r={fourOctet:new RegExp(`^${i}\\.${i}\\.${i}\\.${i}$`,"i"),threeOctet:new RegExp(`^${i}\\.${i}\\.${i}$`,"i"),twoOctet:new RegExp(`^${i}\\.${i}$`,"i"),longValue:new RegExp(`^${i}$`,"i")},s=new RegExp("^0[0-7]+$","i"),n=new RegExp("^0x[a-f0-9]+$","i"),o="(?:[0-9a-f]+::?)+",a={zoneIndex:new RegExp("%[0-9a-z]{1,}","i"),native:new RegExp(`^(::)?(${o})?([0-9a-f]+)?(::)?(%[0-9a-z]{1,})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${i}\\.${i}\\.${i}\\.${i}(%[0-9a-z]{1,})?)$`,"i"),transitional:new RegExp(`^((?:${o})|(?:::)(?:${o})?)${i}\\.${i}\\.${i}\\.${i}(%[0-9a-z]{1,})?$`,"i")};function c(t,e){if(t.indexOf("::")!==t.lastIndexOf("::"))return null;let i,r,s=0,n=-1,o=(t.match(a.zoneIndex)||[])[0];for(o&&(o=o.substring(1),t=t.replace(/%.+$/,""));(n=t.indexOf(":",n+1))>=0;)s++;if("::"===t.substr(0,2)&&s--,"::"===t.substr(-2,2)&&s--,s>e)return null;for(r=e-s,i=":";r--;)i+="0:";return":"===(t=t.replace("::",i))[0]&&(t=t.slice(1)),":"===t[t.length-1]&&(t=t.slice(0,-1)),{parts:e=function(){const e=t.split(":"),i=[];for(let t=0;t<e.length;t++)i.push(parseInt(e[t],16));return i}(),zoneId:o}}function l(t,e,i,r){if(t.length!==e.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let s,n=0;for(;r>0;){if(s=i-r,s<0&&(s=0),t[n]>>s!=e[n]>>s)return!1;r-=i,n+=1}return!0}function u(t){if(n.test(t))return parseInt(t,16);if("0"===t[0]&&!isNaN(parseInt(t[1],10))){if(s.test(t))return parseInt(t,8);throw new Error(`ipaddr: cannot parse ${t} as octal`)}return parseInt(t,10)}function h(t,e){for(;t.length<e;)t="0"+t;return t}const p={};p.IPv4=function(){function t(t){if(4!==t.length)throw new Error("ipaddr: ipv4 octet count should be 4");let e,i;for(e=0;e<t.length;e++)if(i=t[e],!(0<=i&&i<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=t}return t.prototype.SpecialRanges={unspecified:[[new t([0,0,0,0]),8]],broadcast:[[new t([255,255,255,255]),32]],multicast:[[new t([224,0,0,0]),4]],linkLocal:[[new t([169,254,0,0]),16]],loopback:[[new t([127,0,0,0]),8]],carrierGradeNat:[[new t([100,64,0,0]),10]],private:[[new t([10,0,0,0]),8],[new t([172,16,0,0]),12],[new t([192,168,0,0]),16]],reserved:[[new t([192,0,0,0]),24],[new t([192,0,2,0]),24],[new t([192,88,99,0]),24],[new t([198,51,100,0]),24],[new t([203,0,113,0]),24],[new t([240,0,0,0]),4]]},t.prototype.kind=function(){return"ipv4"},t.prototype.match=function(t,e){let i;if(void 0===e&&(i=t,t=i[0],e=i[1]),"ipv4"!==t.kind())throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return l(this.octets,t.octets,8,e)},t.prototype.prefixLengthFromSubnetMask=function(){let t=0,e=!1;const i={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0};let r,s,n;for(r=3;r>=0;r-=1){if(s=this.octets[r],!(s in i))return null;if(n=i[s],e&&0!==n)return null;8!==n&&(e=!0),t+=n}return 32-t},t.prototype.range=function(){return p.subnetMatch(this,this.SpecialRanges)},t.prototype.toByteArray=function(){return this.octets.slice(0)},t.prototype.toIPv4MappedAddress=function(){return p.IPv6.parse("::ffff:"+this.toString())},t.prototype.toNormalizedString=function(){return this.toString()},t.prototype.toString=function(){return this.octets.join(".")},t}(),p.IPv4.broadcastAddressFromCIDR=function(t){try{const e=this.parseCIDR(t),i=e[0].toByteArray(),r=this.subnetMaskFromPrefixLength(e[1]).toByteArray(),s=[];let n=0;for(;n<4;)s.push(parseInt(i[n],10)|255^parseInt(r[n],10)),n++;return new this(s)}catch(e){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},p.IPv4.isIPv4=function(t){return null!==this.parser(t)},p.IPv4.isValid=function(t){try{return new this(this.parser(t)),!0}catch(e){return!1}},p.IPv4.isValidFourPartDecimal=function(t){return!(!p.IPv4.isValid(t)||!t.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},p.IPv4.networkAddressFromCIDR=function(t){let e,i,r,s,n;try{for(e=this.parseCIDR(t),r=e[0].toByteArray(),n=this.subnetMaskFromPrefixLength(e[1]).toByteArray(),s=[],i=0;i<4;)s.push(parseInt(r[i],10)&parseInt(n[i],10)),i++;return new this(s)}catch(o){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},p.IPv4.parse=function(t){const e=this.parser(t);if(null===e)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(e)},p.IPv4.parseCIDR=function(t){let e;if(e=t.match(/^(.+)\/(\d+)$/)){const t=parseInt(e[2]);if(t>=0&&t<=32){const i=[this.parse(e[1]),t];return Object.defineProperty(i,"toString",{value:function(){return this.join("/")}}),i}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},p.IPv4.parser=function(t){let e,i,s;if(e=t.match(r.fourOctet))return function(){const t=e.slice(1,6),r=[];for(let e=0;e<t.length;e++)i=t[e],r.push(u(i));return r}();if(e=t.match(r.longValue)){if(s=u(e[1]),s>4294967295||s<0)throw new Error("ipaddr: address outside defined range");return function(){const t=[];let e;for(e=0;e<=24;e+=8)t.push(s>>e&255);return t}().reverse()}return(e=t.match(r.twoOctet))?function(){const t=e.slice(1,4),i=[];if(s=u(t[1]),s>16777215||s<0)throw new Error("ipaddr: address outside defined range");return i.push(u(t[0])),i.push(s>>16&255),i.push(s>>8&255),i.push(255&s),i}():(e=t.match(r.threeOctet))?function(){const t=e.slice(1,5),i=[];if(s=u(t[2]),s>65535||s<0)throw new Error("ipaddr: address outside defined range");return i.push(u(t[0])),i.push(u(t[1])),i.push(s>>8&255),i.push(255&s),i}():null},p.IPv4.subnetMaskFromPrefixLength=function(t){if((t=parseInt(t))<0||t>32)throw new Error("ipaddr: invalid IPv4 prefix length");const e=[0,0,0,0];let i=0;const r=Math.floor(t/8);for(;i<r;)e[i]=255,i++;return r<4&&(e[r]=Math.pow(2,t%8)-1<<8-t%8),new this(e)},p.IPv6=function(){function t(t,e){let i,r;if(16===t.length)for(this.parts=[],i=0;i<=14;i+=2)this.parts.push(t[i]<<8|t[i+1]);else{if(8!==t.length)throw new Error("ipaddr: ipv6 part count should be 8 or 16");this.parts=t}for(i=0;i<this.parts.length;i++)if(r=this.parts[i],!(0<=r&&r<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");e&&(this.zoneId=e)}return t.prototype.SpecialRanges={unspecified:[new t([0,0,0,0,0,0,0,0]),128],linkLocal:[new t([65152,0,0,0,0,0,0,0]),10],multicast:[new t([65280,0,0,0,0,0,0,0]),8],loopback:[new t([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new t([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new t([0,0,0,0,0,65535,0,0]),96],rfc6145:[new t([0,0,0,0,65535,0,0,0]),96],rfc6052:[new t([100,65435,0,0,0,0,0,0]),96],"6to4":[new t([8194,0,0,0,0,0,0,0]),16],teredo:[new t([8193,0,0,0,0,0,0,0]),32],reserved:[[new t([8193,3512,0,0,0,0,0,0]),32]]},t.prototype.isIPv4MappedAddress=function(){return"ipv4Mapped"===this.range()},t.prototype.kind=function(){return"ipv6"},t.prototype.match=function(t,e){let i;if(void 0===e&&(i=t,t=i[0],e=i[1]),"ipv6"!==t.kind())throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return l(this.parts,t.parts,16,e)},t.prototype.prefixLengthFromSubnetMask=function(){let t=0,e=!1;const i={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};let r,s;for(let n=7;n>=0;n-=1){if(r=this.parts[n],!(r in i))return null;if(s=i[r],e&&0!==s)return null;16!==s&&(e=!0),t+=s}return 128-t},t.prototype.range=function(){return p.subnetMatch(this,this.SpecialRanges)},t.prototype.toByteArray=function(){let t;const e=[],i=this.parts;for(let r=0;r<i.length;r++)t=i[r],e.push(t>>8),e.push(255&t);return e},t.prototype.toFixedLengthString=function(){const t=function(){const t=[];for(let e=0;e<this.parts.length;e++)t.push(h(this.parts[e].toString(16),4));return t}.call(this).join(":");let e="";return this.zoneId&&(e="%"+this.zoneId),t+e},t.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");const t=this.parts.slice(-2),e=t[0],i=t[1];return new p.IPv4([e>>8,255&e,i>>8,255&i])},t.prototype.toNormalizedString=function(){const t=function(){const t=[];for(let e=0;e<this.parts.length;e++)t.push(this.parts[e].toString(16));return t}.call(this).join(":");let e="";return this.zoneId&&(e="%"+this.zoneId),t+e},t.prototype.toRFC5952String=function(){const t=/((^|:)(0(:|$)){2,})/g,e=this.toNormalizedString();let i,r=0,s=-1;for(;i=t.exec(e);)i[0].length>s&&(r=i.index,s=i[0].length);return s<0?e:`${e.substring(0,r)}::${e.substring(r+s)}`},t.prototype.toString=function(){return this.toNormalizedString().replace(/((^|:)(0(:|$))+)/,"::")},t}(),p.IPv6.broadcastAddressFromCIDR=function(t){try{const e=this.parseCIDR(t),i=e[0].toByteArray(),r=this.subnetMaskFromPrefixLength(e[1]).toByteArray(),s=[];let n=0;for(;n<16;)s.push(parseInt(i[n],10)|255^parseInt(r[n],10)),n++;return new this(s)}catch(e){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${e})`)}},p.IPv6.isIPv6=function(t){return null!==this.parser(t)},p.IPv6.isValid=function(t){if("string"==typeof t&&-1===t.indexOf(":"))return!1;try{const e=this.parser(t);return new this(e.parts,e.zoneId),!0}catch(e){return!1}},p.IPv6.networkAddressFromCIDR=function(t){let e,i,r,s,n;try{for(e=this.parseCIDR(t),r=e[0].toByteArray(),n=this.subnetMaskFromPrefixLength(e[1]).toByteArray(),s=[],i=0;i<16;)s.push(parseInt(r[i],10)&parseInt(n[i],10)),i++;return new this(s)}catch(o){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${o})`)}},p.IPv6.parse=function(t){const e=this.parser(t);if(null===e.parts)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(e.parts,e.zoneId)},p.IPv6.parseCIDR=function(t){let e,i,r;if((i=t.match(/^(.+)\/(\d+)$/))&&(e=parseInt(i[2]),e>=0&&e<=128))return r=[this.parse(i[1]),e],Object.defineProperty(r,"toString",{value:function(){return this.join("/")}}),r;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},p.IPv6.parser=function(t){let e,i,r,s,n,o;if(r=t.match(a.deprecatedTransitional))return this.parser("::ffff:"+r[1]);if(a.native.test(t))return c(t,8);if((r=t.match(a.transitional))&&(o=r[6]||"",e=c(r[1].slice(0,-1)+o,6),e.parts)){for(n=[parseInt(r[2]),parseInt(r[3]),parseInt(r[4]),parseInt(r[5])],i=0;i<n.length;i++)if(s=n[i],!(0<=s&&s<=255))return null;return e.parts.push(n[0]<<8|n[1]),e.parts.push(n[2]<<8|n[3]),{parts:e.parts,zoneId:e.zoneId}}return null},p.IPv6.subnetMaskFromPrefixLength=function(t){if((t=parseInt(t))<0||t>128)throw new Error("ipaddr: invalid IPv6 prefix length");const e=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];let i=0;const r=Math.floor(t/8);for(;i<r;)e[i]=255,i++;return r<16&&(e[r]=Math.pow(2,t%8)-1<<8-t%8),new this(e)},p.fromByteArray=function(t){const e=t.length;if(4===e)return new p.IPv4(t);if(16===e)return new p.IPv6(t);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},p.isValid=function(t){return p.IPv6.isValid(t)||p.IPv4.isValid(t)},p.parse=function(t){if(p.IPv6.isValid(t))return p.IPv6.parse(t);if(p.IPv4.isValid(t))return p.IPv4.parse(t);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},p.parseCIDR=function(t){try{return p.IPv6.parseCIDR(t)}catch(e){try{return p.IPv4.parseCIDR(t)}catch(i){throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},p.process=function(t){const e=this.parse(t);return"ipv6"===e.kind()&&e.isIPv4MappedAddress()?e.toIPv4Address():e},p.subnetMatch=function(t,e,i){let r,s,n,o;for(s in null==i&&(i="unicast"),e)if(Object.prototype.hasOwnProperty.call(e,s))for(n=e[s],!n[0]||n[0]instanceof Array||(n=[n]),r=0;r<n.length;r++)if(o=n[r],t.kind()===o[0].kind()&&t.match.apply(t,o))return s;return i},t.exports?t.exports=p:e.ipaddr=p}(i)}));class Pe{static decodeIP(t){if(64===t.length&&0===parseInt(t,16))return"::/0";if(16!==t.length)return t;const e=parseInt(t.slice(8),16).toString(2).split("").reduce((t,e)=>t+ +e,0);let i=t.slice(0,8).replace(/(.{2})/g,t=>parseInt(t,16)+".");return i=i.slice(0,-1),`${i}/${e}`}static toString(t){if(4===t.byteLength||16===t.byteLength){const e=new Uint8Array(t);return we.fromByteArray(Array.from(e)).toString()}return this.decodeIP(o.ToHex(t))}static fromString(t){const e=we.parse(t);return new Uint8Array(e.toByteArray()).buffer}}let De=class{constructor(t={}){Object.assign(this,t)}toString(){return this.bmpString||this.printableString||this.teletexString||this.universalString||this.utf8String||""}};me([de({type:Mt.TeletexString})],De.prototype,"teletexString",void 0),me([de({type:Mt.PrintableString})],De.prototype,"printableString",void 0),me([de({type:Mt.UniversalString})],De.prototype,"universalString",void 0),me([de({type:Mt.Utf8String})],De.prototype,"utf8String",void 0),me([de({type:Mt.BmpString})],De.prototype,"bmpString",void 0),De=me([pe({type:kt.Choice})],De);let Be=class extends De{constructor(t={}){super(t),Object.assign(this,t)}toString(){return this.ia5String||(this.anyValue?o.ToHex(this.anyValue):super.toString())}};me([de({type:Mt.IA5String})],Be.prototype,"ia5String",void 0),me([de({type:Mt.Any})],Be.prototype,"anyValue",void 0),Be=me([pe({type:kt.Choice})],Be);class be{constructor(t={}){this.type="",this.value=new Be,Object.assign(this,t)}}me([de({type:Mt.ObjectIdentifier})],be.prototype,"type",void 0),me([de({type:Be})],be.prototype,"value",void 0);let Ie=ge=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,ge.prototype)}};Ie=ge=me([pe({type:kt.Set,itemType:be})],Ie);let Te=ve=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,ve.prototype)}};Te=ve=me([pe({type:kt.Sequence,itemType:Ie})],Te);let xe=Ee=class extends Te{constructor(t){super(t),Object.setPrototypeOf(this,Ee.prototype)}};xe=Ee=me([pe({type:kt.Sequence})],xe);const Re={fromASN:t=>Pe.toString(Lt.fromASN(t)),toASN:t=>Lt.toASN(Pe.fromString(t))};class Oe{constructor(t={}){this.typeId="",this.value=new ArrayBuffer(0),Object.assign(this,t)}}me([de({type:Mt.ObjectIdentifier})],Oe.prototype,"typeId",void 0),me([de({type:Mt.Any,context:0})],Oe.prototype,"value",void 0);class Ne{constructor(t={}){this.partyName=new ArrayBuffer(0),Object.assign(this,t)}}me([de({type:De,optional:!0,context:0,implicit:!0})],Ne.prototype,"nameAssigner",void 0),me([de({type:De,context:1,implicit:!0})],Ne.prototype,"partyName",void 0);let ke=class{constructor(t={}){Object.assign(this,t)}};var Me;me([de({type:Oe,context:0,implicit:!0})],ke.prototype,"otherName",void 0),me([de({type:Mt.IA5String,context:1,implicit:!0})],ke.prototype,"rfc822Name",void 0),me([de({type:Mt.IA5String,context:2,implicit:!0})],ke.prototype,"dNSName",void 0),me([de({type:Mt.Any,context:3,implicit:!0})],ke.prototype,"x400Address",void 0),me([de({type:xe,context:4,implicit:!1})],ke.prototype,"directoryName",void 0),me([de({type:Ne,context:5})],ke.prototype,"ediPartyName",void 0),me([de({type:Mt.IA5String,context:6,implicit:!0})],ke.prototype,"uniformResourceIdentifier",void 0),me([de({type:Mt.OctetString,context:7,implicit:!0,converter:Re})],ke.prototype,"iPAddress",void 0),me([de({type:Mt.ObjectIdentifier,context:8,implicit:!0})],ke.prototype,"registeredID",void 0),ke=me([pe({type:kt.Choice})],ke);class Ke{constructor(t={}){this.accessMethod="",this.accessLocation=new ke,Object.assign(this,t)}}me([de({type:Mt.ObjectIdentifier})],Ke.prototype,"accessMethod",void 0),me([de({type:ke})],Ke.prototype,"accessLocation",void 0);let He=Me=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,Me.prototype)}};He=Me=me([pe({type:kt.Sequence,itemType:Ke})],He);class Ue extends ce{}class _e{constructor(t={}){t&&Object.assign(this,t)}}me([de({type:Ue,context:0,optional:!0,implicit:!0})],_e.prototype,"keyIdentifier",void 0),me([de({type:ke,context:1,optional:!0,implicit:!0,repeated:"sequence"})],_e.prototype,"authorityCertIssuer",void 0),me([de({type:Mt.Integer,context:2,optional:!0,implicit:!0,converter:_t})],_e.prototype,"authorityCertSerialNumber",void 0);class je{constructor(t={}){this.cA=!1,Object.assign(this,t)}}var Fe;me([de({type:Mt.Boolean,defaultValue:!1})],je.prototype,"cA",void 0),me([de({type:Mt.Integer,optional:!0})],je.prototype,"pathLenConstraint",void 0);let Ve=Fe=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,Fe.prototype)}};var Le;Ve=Fe=me([pe({type:kt.Sequence,itemType:ke})],Ve);let Ge=Le=class extends Ve{constructor(t){super(t),Object.setPrototypeOf(this,Le.prototype)}};var $e;Ge=Le=me([pe({type:kt.Sequence})],Ge);let Qe=class{constructor(t={}){Object.assign(this,t)}toString(){return this.ia5String||this.visibleString||this.bmpString||this.utf8String}};me([de({type:Mt.IA5String})],Qe.prototype,"ia5String",void 0),me([de({type:Mt.VisibleString})],Qe.prototype,"visibleString",void 0),me([de({type:Mt.BmpString})],Qe.prototype,"bmpString",void 0),me([de({type:Mt.Utf8String})],Qe.prototype,"utf8String",void 0),Qe=me([pe({type:kt.Choice})],Qe);class We{constructor(t={}){this.organization=new Qe,this.noticeNumbers=[],Object.assign(this,t)}}me([de({type:Qe})],We.prototype,"organization",void 0),me([de({type:Mt.Integer,repeated:"sequence"})],We.prototype,"noticeNumbers",void 0);class ze{constructor(t={}){Object.assign(this,t)}}me([de({type:We,optional:!0})],ze.prototype,"noticeRef",void 0),me([de({type:Qe,optional:!0})],ze.prototype,"explicitText",void 0);let qe=class{constructor(t={}){Object.assign(this,t)}};me([de({type:Mt.IA5String})],qe.prototype,"cPSuri",void 0),me([de({type:ze})],qe.prototype,"userNotice",void 0),qe=me([pe({type:kt.Choice})],qe);class Je{constructor(t={}){this.policyQualifierId="",this.qualifier=new ArrayBuffer(0),Object.assign(this,t)}}me([de({type:Mt.ObjectIdentifier})],Je.prototype,"policyQualifierId",void 0),me([de({type:Mt.Any})],Je.prototype,"qualifier",void 0);class Ze{constructor(t={}){this.policyIdentifier="",Object.assign(this,t)}}me([de({type:Mt.ObjectIdentifier})],Ze.prototype,"policyIdentifier",void 0),me([de({type:Je,repeated:"sequence",optional:!0})],Ze.prototype,"policyQualifiers",void 0);let Xe=$e=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,$e.prototype)}};Xe=$e=me([pe({type:kt.Sequence,itemType:Ze})],Xe);let Ye=class{constructor(t=0){this.value=t}};me([de({type:Mt.Integer})],Ye.prototype,"value",void 0),Ye=me([pe({type:kt.Choice})],Ye);let ti=class extends Ye{};var ei,ii;ti=me([pe({type:kt.Choice})],ti),function(t){t[t.unused=1]="unused",t[t.keyCompromise=2]="keyCompromise",t[t.cACompromise=4]="cACompromise",t[t.affiliationChanged=8]="affiliationChanged",t[t.superseded=16]="superseded",t[t.cessationOfOperation=32]="cessationOfOperation",t[t.certificateHold=64]="certificateHold",t[t.privilegeWithdrawn=128]="privilegeWithdrawn",t[t.aACompromise=256]="aACompromise"}(ii||(ii={}));class ri extends ae{toJSON(){const t=[],e=this.toNumber();return e&ii.aACompromise&&t.push("aACompromise"),e&ii.affiliationChanged&&t.push("affiliationChanged"),e&ii.cACompromise&&t.push("cACompromise"),e&ii.certificateHold&&t.push("certificateHold"),e&ii.cessationOfOperation&&t.push("cessationOfOperation"),e&ii.keyCompromise&&t.push("keyCompromise"),e&ii.privilegeWithdrawn&&t.push("privilegeWithdrawn"),e&ii.superseded&&t.push("superseded"),e&ii.unused&&t.push("unused"),t}toString(){return`[${this.toJSON().join(", ")}]`}}let si=class{constructor(t={}){Object.assign(this,t)}};me([de({type:ke,context:0,repeated:"sequence",implicit:!0})],si.prototype,"fullName",void 0),me([de({type:Ie,context:1,implicit:!0})],si.prototype,"nameRelativeToCRLIssuer",void 0),si=me([pe({type:kt.Choice})],si);class ni{constructor(t={}){Object.assign(this,t)}}me([de({type:si,context:0,optional:!0})],ni.prototype,"distributionPoint",void 0),me([de({type:ri,context:1,optional:!0,implicit:!0})],ni.prototype,"reasons",void 0),me([de({type:ke,context:2,optional:!0,repeated:"sequence",implicit:!0})],ni.prototype,"cRLIssuer",void 0);let oi=ei=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,ei.prototype)}};var ai;oi=ei=me([pe({type:kt.Sequence,itemType:ni})],oi);let ci=ai=class extends oi{constructor(t){super(t),Object.setPrototypeOf(this,ai.prototype)}};ci=ai=me([pe({type:kt.Sequence,itemType:ni})],ci);class li{constructor(t={}){this.onlyContainsUserCerts=li.ONLY,this.onlyContainsCACerts=li.ONLY,this.indirectCRL=li.ONLY,this.onlyContainsAttributeCerts=li.ONLY,Object.assign(this,t)}}var ui;li.ONLY=!1,me([de({type:si,context:0,optional:!0})],li.prototype,"distributionPoint",void 0),me([de({type:Mt.Boolean,context:1,defaultValue:li.ONLY})],li.prototype,"onlyContainsUserCerts",void 0),me([de({type:Mt.Boolean,context:2,defaultValue:li.ONLY})],li.prototype,"onlyContainsCACerts",void 0),me([de({type:ri,context:3,optional:!0})],li.prototype,"onlySomeReasons",void 0),me([de({type:Mt.Boolean,context:4,defaultValue:li.ONLY})],li.prototype,"indirectCRL",void 0),me([de({type:Mt.Boolean,context:5,defaultValue:li.ONLY})],li.prototype,"onlyContainsAttributeCerts",void 0),function(t){t[t.unspecified=0]="unspecified",t[t.keyCompromise=1]="keyCompromise",t[t.cACompromise=2]="cACompromise",t[t.affiliationChanged=3]="affiliationChanged",t[t.superseded=4]="superseded",t[t.cessationOfOperation=5]="cessationOfOperation",t[t.certificateHold=6]="certificateHold",t[t.removeFromCRL=8]="removeFromCRL",t[t.privilegeWithdrawn=9]="privilegeWithdrawn",t[t.aACompromise=10]="aACompromise"}(ui||(ui={}));let hi=class{constructor(t=ui.unspecified){this.reason=ui.unspecified,this.reason=t}toJSON(){return ui[this.reason]}toString(){return this.toJSON()}};var pi;me([de({type:Mt.Enumerated})],hi.prototype,"reason",void 0),hi=me([pe({type:kt.Choice})],hi);let di=pi=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,pi.prototype)}};di=pi=me([pe({type:kt.Sequence,itemType:Mt.ObjectIdentifier})],di);let fi=class{constructor(t=new ArrayBuffer(0)){this.value=t}};me([de({type:Mt.Integer,converter:_t})],fi.prototype,"value",void 0),fi=me([pe({type:kt.Choice})],fi);let yi=class{constructor(t){this.value=new Date,t&&(this.value=t)}};var Si;me([de({type:Mt.GeneralizedTime})],yi.prototype,"value",void 0),yi=me([pe({type:kt.Choice})],yi);let Ci=Si=class extends Ve{constructor(t){super(t),Object.setPrototypeOf(this,Si.prototype)}};var Ai,mi;Ci=Si=me([pe({type:kt.Sequence})],Ci),function(t){t[t.digitalSignature=1]="digitalSignature",t[t.nonRepudiation=2]="nonRepudiation",t[t.keyEncipherment=4]="keyEncipherment",t[t.dataEncipherment=8]="dataEncipherment",t[t.keyAgreement=16]="keyAgreement",t[t.keyCertSign=32]="keyCertSign",t[t.cRLSign=64]="cRLSign",t[t.encipherOnly=128]="encipherOnly",t[t.decipherOnly=256]="decipherOnly"}(Ai||(Ai={}));class gi extends ae{toJSON(){const t=this.toNumber(),e=[];return t&Ai.cRLSign&&e.push("crlSign"),t&Ai.dataEncipherment&&e.push("dataEncipherment"),t&Ai.decipherOnly&&e.push("decipherOnly"),t&Ai.digitalSignature&&e.push("digitalSignature"),t&Ai.encipherOnly&&e.push("encipherOnly"),t&Ai.keyAgreement&&e.push("keyAgreement"),t&Ai.keyCertSign&&e.push("keyCertSign"),t&Ai.keyEncipherment&&e.push("keyEncipherment"),t&Ai.nonRepudiation&&e.push("nonRepudiation"),e}toString(){return`[${this.toJSON().join(", ")}]`}}class vi{constructor(t={}){this.base=new ke,this.minimum=0,Object.assign(this,t)}}me([de({type:ke})],vi.prototype,"base",void 0),me([de({type:Mt.Integer,context:0,defaultValue:0,implicit:!0})],vi.prototype,"minimum",void 0),me([de({type:Mt.Integer,context:1,optional:!0,implicit:!0})],vi.prototype,"maximum",void 0);let Ei=mi=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,mi.prototype)}};Ei=mi=me([pe({type:kt.Sequence,itemType:vi})],Ei);class wi{constructor(t={}){Object.assign(this,t)}}me([de({type:Ei,context:0,optional:!0,implicit:!0})],wi.prototype,"permittedSubtrees",void 0),me([de({type:Ei,context:1,optional:!0,implicit:!0})],wi.prototype,"excludedSubtrees",void 0);class Pi{constructor(t={}){Object.assign(this,t)}}var Di;me([de({type:Mt.Integer,context:0,implicit:!0,optional:!0,converter:_t})],Pi.prototype,"requireExplicitPolicy",void 0),me([de({type:Mt.Integer,context:1,implicit:!0,optional:!0,converter:_t})],Pi.prototype,"inhibitPolicyMapping",void 0);class Bi{constructor(t={}){this.issuerDomainPolicy="",this.subjectDomainPolicy="",Object.assign(this,t)}}me([de({type:Mt.ObjectIdentifier})],Bi.prototype,"issuerDomainPolicy",void 0),me([de({type:Mt.ObjectIdentifier})],Bi.prototype,"subjectDomainPolicy",void 0);let bi=Di=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,Di.prototype)}};var Ii;bi=Di=me([pe({type:kt.Sequence,itemType:Bi})],bi);let Ti=Ii=class extends Ve{constructor(t){super(t),Object.setPrototypeOf(this,Ii.prototype)}};Ti=Ii=me([pe({type:kt.Sequence})],Ti);class xi{constructor(t={}){this.type="",this.values=[],Object.assign(this,t)}}var Ri;me([de({type:Mt.ObjectIdentifier})],xi.prototype,"type",void 0),me([de({type:Mt.Any,repeated:"set"})],xi.prototype,"values",void 0);let Oi=Ri=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,Ri.prototype)}};Oi=Ri=me([pe({type:kt.Sequence,itemType:xi})],Oi);class Ni extends Ue{}class ki{constructor(t={}){Object.assign(this,t)}}var Mi,Ki;me([de({type:Mt.GeneralizedTime,context:0,implicit:!0,optional:!0})],ki.prototype,"notBefore",void 0),me([de({type:Mt.GeneralizedTime,context:1,implicit:!0,optional:!0})],ki.prototype,"notAfter",void 0),function(t){t[t.keyUpdateAllowed=1]="keyUpdateAllowed",t[t.newExtensions=2]="newExtensions",t[t.pKIXCertificate=4]="pKIXCertificate"}(Mi||(Mi={}));class Hi extends ae{toJSON(){const t=[],e=this.toNumber();return e&Mi.pKIXCertificate&&t.push("pKIXCertificate"),e&Mi.newExtensions&&t.push("newExtensions"),e&Mi.keyUpdateAllowed&&t.push("keyUpdateAllowed"),t}toString(){return`[${this.toJSON().join(", ")}]`}}class Ui{constructor(t={}){this.entrustVers="",this.entrustInfoFlags=new Hi,Object.assign(this,t)}}me([de({type:Mt.GeneralString})],Ui.prototype,"entrustVers",void 0),me([de({type:Hi})],Ui.prototype,"entrustInfoFlags",void 0);let _i=Ki=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,Ki.prototype)}};_i=Ki=me([pe({type:kt.Sequence,itemType:Ke})],_i);class ji{constructor(t={}){this.algorithm="",Object.assign(this,t)}isEqual(t){return t instanceof ji&&t.algorithm==this.algorithm&&(t.parameters&&this.parameters&&a(t.parameters,this.parameters)||t.parameters===this.parameters)}}me([de({type:Mt.ObjectIdentifier})],ji.prototype,"algorithm",void 0),me([de({type:Mt.Any,optional:!0})],ji.prototype,"parameters",void 0);class Fi{constructor(t={}){this.algorithm=new ji,this.subjectPublicKey=new ArrayBuffer(0),Object.assign(this,t)}}me([de({type:ji})],Fi.prototype,"algorithm",void 0),me([de({type:Mt.BitString})],Fi.prototype,"subjectPublicKey",void 0);let Vi=class{constructor(t){t&&("string"==typeof t||"number"==typeof t?this.utcTime=new Date(t):t instanceof Date?this.utcTime=t:Object.assign(this,t))}getTime(){const t=this.utcTime||this.generalTime;if(!t)throw new Error("Cannot get time from CHOICE object");return t}};me([de({type:Mt.UTCTime})],Vi.prototype,"utcTime",void 0),me([de({type:Mt.GeneralizedTime})],Vi.prototype,"generalTime",void 0),Vi=me([pe({type:kt.Choice})],Vi);class Li{constructor(t){this.notBefore=new Vi(new Date),this.notAfter=new Vi(new Date),t&&(this.notBefore=new Vi(t.notBefore),this.notAfter=new Vi(t.notAfter))}}var Gi;me([de({type:Vi})],Li.prototype,"notBefore",void 0),me([de({type:Vi})],Li.prototype,"notAfter",void 0);class $i{constructor(t={}){this.extnID="",this.critical=$i.CRITICAL,this.extnValue=new ce,Object.assign(this,t)}}$i.CRITICAL=!1,me([de({type:Mt.ObjectIdentifier})],$i.prototype,"extnID",void 0),me([de({type:Mt.Boolean,defaultValue:$i.CRITICAL})],$i.prototype,"critical",void 0),me([de({type:ce})],$i.prototype,"extnValue",void 0);let Qi=Gi=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,Gi.prototype)}};var Wi;Qi=Gi=me([pe({type:kt.Sequence,itemType:$i})],Qi),function(t){t[t.v1=0]="v1",t[t.v2=1]="v2",t[t.v3=2]="v3"}(Wi||(Wi={}));class zi{constructor(t={}){this.version=Wi.v1,this.serialNumber=new ArrayBuffer(0),this.signature=new ji,this.issuer=new xe,this.validity=new Li,this.subject=new xe,this.subjectPublicKeyInfo=new Fi,Object.assign(this,t)}}me([de({type:Mt.Integer,context:0,defaultValue:Wi.v1})],zi.prototype,"version",void 0),me([de({type:Mt.Integer,converter:_t})],zi.prototype,"serialNumber",void 0),me([de({type:ji})],zi.prototype,"signature",void 0),me([de({type:xe})],zi.prototype,"issuer",void 0),me([de({type:Li})],zi.prototype,"validity",void 0),me([de({type:xe})],zi.prototype,"subject",void 0),me([de({type:Fi})],zi.prototype,"subjectPublicKeyInfo",void 0),me([de({type:Mt.BitString,context:1,implicit:!0,optional:!0})],zi.prototype,"issuerUniqueID",void 0),me([de({type:Mt.BitString,context:2,implicit:!0,optional:!0})],zi.prototype,"subjectUniqueID",void 0),me([de({type:Qi,context:3,optional:!0})],zi.prototype,"extensions",void 0);class qi{constructor(t={}){this.tbsCertificate=new zi,this.signatureAlgorithm=new ji,this.signatureValue=new ArrayBuffer(0),Object.assign(this,t)}}me([de({type:zi})],qi.prototype,"tbsCertificate",void 0),me([de({type:ji})],qi.prototype,"signatureAlgorithm",void 0),me([de({type:Mt.BitString})],qi.prototype,"signatureValue",void 0);class Ji{constructor(t={}){this.userCertificate=new ArrayBuffer(0),this.revocationDate=new Vi,Object.assign(this,t)}}me([de({type:Mt.Integer,converter:_t})],Ji.prototype,"userCertificate",void 0),me([de({type:Vi})],Ji.prototype,"revocationDate",void 0),me([de({type:$i,optional:!0,repeated:"sequence"})],Ji.prototype,"crlEntryExtensions",void 0);class Zi{constructor(t={}){this.signature=new ji,this.issuer=new xe,this.thisUpdate=new Vi,Object.assign(this,t)}}me([de({type:Mt.Integer,optional:!0})],Zi.prototype,"version",void 0),me([de({type:ji})],Zi.prototype,"signature",void 0),me([de({type:xe})],Zi.prototype,"issuer",void 0),me([de({type:Vi})],Zi.prototype,"thisUpdate",void 0),me([de({type:Vi,optional:!0})],Zi.prototype,"nextUpdate",void 0),me([de({type:Ji,repeated:"sequence",optional:!0})],Zi.prototype,"revokedCertificates",void 0),me([de({type:$i,optional:!0,context:0,repeated:"sequence"})],Zi.prototype,"crlExtensions",void 0);class Xi{constructor(t={}){this.tbsCertList=new Zi,this.signatureAlgorithm=new ji,this.signature=new ArrayBuffer(0),Object.assign(this,t)}}me([de({type:Zi})],Xi.prototype,"tbsCertList",void 0),me([de({type:ji})],Xi.prototype,"signatureAlgorithm",void 0),me([de({type:Mt.BitString})],Xi.prototype,"signature",void 0);const Yi="1.2.840.10045.2.1";function tr(t){return new ji({algorithm:t})}tr("1.2.840.10045.4.1"),tr("1.2.840.10045.4.3.1"),tr("1.2.840.10045.4.3.2"),tr("1.2.840.10045.4.3.3"),tr("1.2.840.10045.4.3.4");let er=class{constructor(t={}){Object.assign(this,t)}};me([de({type:Mt.ObjectIdentifier})],er.prototype,"namedCurve",void 0),er=me([pe({type:kt.Choice})],er);class ir{constructor(t={}){this.version=1,this.privateKey=new ce,Object.assign(this,t)}}me([de({type:Mt.Integer})],ir.prototype,"version",void 0),me([de({type:ce})],ir.prototype,"privateKey",void 0),me([de({type:er,context:0,optional:!0})],ir.prototype,"parameters",void 0),me([de({type:Mt.BitString,context:1,optional:!0})],ir.prototype,"publicKey",void 0);class rr{constructor(t={}){this.r=new ArrayBuffer(0),this.s=new ArrayBuffer(0),Object.assign(this,t)}}me([de({type:Mt.Integer,converter:_t})],rr.prototype,"r",void 0),me([de({type:Mt.Integer,converter:_t})],rr.prototype,"s",void 0);const sr="1.2.840.113549.1.1.1",nr="1.2.840.113549.1.1.8";function or(t){return new ji({algorithm:t,parameters:null})}or("1.2.840.113549.2.2"),or("1.2.840.113549.2.5");const ar=or("1.3.14.3.2.26"),cr=(or("2.16.840.1.101.3.4.2.4"),or("2.16.840.1.101.3.4.2.1"),or("2.16.840.1.101.3.4.2.2"),or("2.16.840.1.101.3.4.2.3"),or("2.16.840.1.101.3.4.2.5"),or("2.16.840.1.101.3.4.2.6"),new ji({algorithm:nr,parameters:Ae.serialize(ar)})),lr=new ji({algorithm:"1.2.840.113549.1.1.9",parameters:Ae.serialize(Lt.toASN(new Uint8Array([218,57,163,238,94,107,75,13,50,85,191,239,149,96,24,144,175,216,7,9]).buffer))});or("1.2.840.113549.1.1.1"),or("1.2.840.113549.1.1.2"),or("1.2.840.113549.1.1.4"),or("1.2.840.113549.1.1.5"),or("1.2.840.113549.1.1.15"),or("1.2.840.113549.1.1.16"),or("1.2.840.113549.1.1.12"),or("1.2.840.113549.1.1.13"),or("1.2.840.113549.1.1.15"),or("1.2.840.113549.1.1.16");class ur{constructor(t={}){this.hashAlgorithm=new ji(ar),this.maskGenAlgorithm=new ji({algorithm:nr,parameters:Ae.serialize(ar)}),this.pSourceAlgorithm=new ji(lr),Object.assign(this,t)}}me([de({type:ji,context:0,defaultValue:ar})],ur.prototype,"hashAlgorithm",void 0),me([de({type:ji,context:1,defaultValue:cr})],ur.prototype,"maskGenAlgorithm",void 0),me([de({type:ji,context:2,defaultValue:lr})],ur.prototype,"pSourceAlgorithm",void 0),new ji({algorithm:"1.2.840.113549.1.1.7",parameters:Ae.serialize(new ur)});class hr{constructor(t={}){this.hashAlgorithm=new ji(ar),this.maskGenAlgorithm=new ji({algorithm:nr,parameters:Ae.serialize(ar)}),this.saltLength=20,this.trailerField=1,Object.assign(this,t)}}me([de({type:ji,context:0,defaultValue:ar})],hr.prototype,"hashAlgorithm",void 0),me([de({type:ji,context:1,defaultValue:cr})],hr.prototype,"maskGenAlgorithm",void 0),me([de({type:Mt.Integer,context:2,defaultValue:20})],hr.prototype,"saltLength",void 0),me([de({type:Mt.Integer,context:3,defaultValue:1})],hr.prototype,"trailerField",void 0),new ji({algorithm:"1.2.840.113549.1.1.10",parameters:Ae.serialize(new hr)});class pr{constructor(t={}){this.digestAlgorithm=new ji,this.digest=new ce,Object.assign(this,t)}}var dr;me([de({type:ji})],pr.prototype,"digestAlgorithm",void 0),me([de({type:ce})],pr.prototype,"digest",void 0);class fr{constructor(t={}){this.prime=new ArrayBuffer(0),this.exponent=new ArrayBuffer(0),this.coefficient=new ArrayBuffer(0),Object.assign(this,t)}}me([de({type:Mt.Integer,converter:_t})],fr.prototype,"prime",void 0),me([de({type:Mt.Integer,converter:_t})],fr.prototype,"exponent",void 0),me([de({type:Mt.Integer,converter:_t})],fr.prototype,"coefficient",void 0);let yr=dr=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,dr.prototype)}};yr=dr=me([pe({type:kt.Sequence,itemType:fr})],yr);class Sr{constructor(t={}){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,t)}}me([de({type:Mt.Integer})],Sr.prototype,"version",void 0),me([de({type:Mt.Integer,converter:_t})],Sr.prototype,"modulus",void 0),me([de({type:Mt.Integer,converter:_t})],Sr.prototype,"publicExponent",void 0),me([de({type:Mt.Integer,converter:_t})],Sr.prototype,"privateExponent",void 0),me([de({type:Mt.Integer,converter:_t})],Sr.prototype,"prime1",void 0),me([de({type:Mt.Integer,converter:_t})],Sr.prototype,"prime2",void 0),me([de({type:Mt.Integer,converter:_t})],Sr.prototype,"exponent1",void 0),me([de({type:Mt.Integer,converter:_t})],Sr.prototype,"exponent2",void 0),me([de({type:Mt.Integer,converter:_t})],Sr.prototype,"coefficient",void 0),me([de({type:yr,optional:!0})],Sr.prototype,"otherPrimeInfos",void 0);class Cr{constructor(t={}){this.modulus=new ArrayBuffer(0),this.publicExponent=new ArrayBuffer(0),Object.assign(this,t)}}me([de({type:Mt.Integer,converter:_t})],Cr.prototype,"modulus",void 0),me([de({type:Mt.Integer,converter:_t})],Cr.prototype,"publicExponent",void 0);
38
+ */function d(){if("undefined"==typeof BigInt)throw new Error("BigInt is not defined. Your environment doesn't implement BigInt.")}function f(t){let e=0,i=0;for(let s=0;s<t.length;s++)e+=t[s].byteLength;const r=new Uint8Array(e);for(let s=0;s<t.length;s++){const e=t[s];r.set(new Uint8Array(e),i),i+=e.byteLength}return r.buffer}function y(t,e,i,r){return e instanceof Uint8Array?e.byteLength?i<0?(t.error="Wrong parameter: inputOffset less than zero",!1):r<0?(t.error="Wrong parameter: inputLength less than zero",!1):!(e.byteLength-i-r<0&&(t.error="End of input reached before message was fully decoded (inconsistent offset and length values)",1)):(t.error="Wrong parameter: inputBuffer has zero length",!1):(t.error="Wrong parameter: inputBuffer must be 'Uint8Array'",!1)}class S{constructor(){this.items=[]}write(t){this.items.push(t)}final(){return f(this.items)}}const C=[new Uint8Array([1])],A=new ArrayBuffer(0),m=new Uint8Array(0);function g(t){var e;return(e=class extends t{constructor(...t){var e;super(...t);const i=t[0]||{};this.isHexOnly=null!==(e=i.isHexOnly)&&void 0!==e&&e,this.valueHexView=i.valueHex?n.toUint8Array(i.valueHex):m}get valueHex(){return this.valueHexView.slice().buffer}set valueHex(t){this.valueHexView=new Uint8Array(t)}fromBER(t,e,i){const r=t instanceof ArrayBuffer?new Uint8Array(t):t;if(!y(this,r,e,i))return-1;const s=e+i;return this.valueHexView=r.subarray(e,s),this.valueHexView.length?(this.blockLength=i,s):(this.warnings.push("Zero buffer length"),e)}toBER(t=!1){return this.isHexOnly?t?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.byteLength===this.valueHexView.buffer.byteLength?this.valueHexView.buffer:this.valueHexView.slice().buffer:(this.error="Flag 'isHexOnly' is not set, abort",A)}toJSON(){return{...super.toJSON(),isHexOnly:this.isHexOnly,valueHex:o.ToHex(this.valueHexView)}}}).NAME="hexBlock",e}class v{constructor({blockLength:t=0,error:e="",warnings:i=[],valueBeforeDecode:r=m}={}){this.blockLength=t,this.error=e,this.warnings=i,this.valueBeforeDecodeView=n.toUint8Array(r)}static blockName(){return this.NAME}get valueBeforeDecode(){return this.valueBeforeDecodeView.slice().buffer}set valueBeforeDecode(t){this.valueBeforeDecodeView=new Uint8Array(t)}toJSON(){return{blockName:this.constructor.NAME,blockLength:this.blockLength,error:this.error,warnings:this.warnings,valueBeforeDecode:o.ToHex(this.valueBeforeDecodeView)}}}v.NAME="baseBlock";class E extends v{fromBER(t,e,i){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}toBER(t,e){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}}E.NAME="valueBlock";class w extends(g(v)){constructor({idBlock:t={}}={}){var e,i,r,s;super(),t?(this.isHexOnly=null!==(e=t.isHexOnly)&&void 0!==e&&e,this.valueHexView=t.valueHex?n.toUint8Array(t.valueHex):m,this.tagClass=null!==(i=t.tagClass)&&void 0!==i?i:-1,this.tagNumber=null!==(r=t.tagNumber)&&void 0!==r?r:-1,this.isConstructed=null!==(s=t.isConstructed)&&void 0!==s&&s):(this.tagClass=-1,this.tagNumber=-1,this.isConstructed=!1)}toBER(t=!1){let e=0;switch(this.tagClass){case 1:e|=0;break;case 2:e|=64;break;case 3:e|=128;break;case 4:e|=192;break;default:return this.error="Unknown tag class",A}if(this.isConstructed&&(e|=32),this.tagNumber<31&&!this.isHexOnly){const i=new Uint8Array(1);if(!t){let t=this.tagNumber;t&=31,e|=t,i[0]=e}return i.buffer}if(!this.isHexOnly){const i=l(this.tagNumber,7),r=new Uint8Array(i),s=i.byteLength,n=new Uint8Array(s+1);if(n[0]=31|e,!t){for(let t=0;t<s-1;t++)n[t+1]=128|r[t];n[s]=r[s-1]}return n.buffer}const i=new Uint8Array(this.valueHexView.byteLength+1);if(i[0]=31|e,!t){const t=this.valueHexView;for(let e=0;e<t.length-1;e++)i[e+1]=128|t[e];i[this.valueHexView.byteLength]=t[t.length-1]}return i.buffer}fromBER(t,e,i){const r=n.toUint8Array(t);if(!y(this,r,e,i))return-1;const s=r.subarray(e,e+i);if(0===s.length)return this.error="Zero buffer length",-1;switch(192&s[0]){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:return this.error="Unknown tag class",-1}this.isConstructed=32==(32&s[0]),this.isHexOnly=!1;const o=31&s[0];if(31!==o)this.tagNumber=o,this.blockLength=1;else{let t=1,e=this.valueHexView=new Uint8Array(255),i=255;for(;128&s[t];){if(e[t-1]=127&s[t],t++,t>=s.length)return this.error="End of input reached before message was fully decoded",-1;if(t===i){i+=255;const t=new Uint8Array(i);for(let i=0;i<e.length;i++)t[i]=e[i];e=this.valueHexView=new Uint8Array(i)}}this.blockLength=t+1,e[t-1]=127&s[t];const r=new Uint8Array(t);for(let s=0;s<t;s++)r[s]=e[s];e=this.valueHexView=new Uint8Array(t),e.set(r),this.blockLength<=9?this.tagNumber=c(e,7):(this.isHexOnly=!0,this.warnings.push("Tag too long, represented as hex-coded"))}if(1===this.tagClass&&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:return this.error="Constructed encoding used for primitive type",-1}return e+this.blockLength}toJSON(){return{...super.toJSON(),tagClass:this.tagClass,tagNumber:this.tagNumber,isConstructed:this.isConstructed}}}w.NAME="identificationBlock";class P extends v{constructor({lenBlock:t={}}={}){var e,i,r;super(),this.isIndefiniteForm=null!==(e=t.isIndefiniteForm)&&void 0!==e&&e,this.longFormUsed=null!==(i=t.longFormUsed)&&void 0!==i&&i,this.length=null!==(r=t.length)&&void 0!==r?r:0}fromBER(t,e,i){const r=n.toUint8Array(t);if(!y(this,r,e,i))return-1;const s=r.subarray(e,e+i);if(0===s.length)return this.error="Zero buffer length",-1;if(255===s[0])return this.error="Length block 0xFF is reserved by standard",-1;if(this.isIndefiniteForm=128===s[0],this.isIndefiniteForm)return this.blockLength=1,e+this.blockLength;if(this.longFormUsed=!!(128&s[0]),!1===this.longFormUsed)return this.length=s[0],this.blockLength=1,e+this.blockLength;const o=127&s[0];if(o>8)return this.error="Too big integer",-1;if(o+1>s.length)return this.error="End of input reached before message was fully decoded",-1;const a=e+1,l=r.subarray(a,a+o);return 0===l[o-1]&&this.warnings.push("Needlessly long encoded length"),this.length=c(l,8),this.longFormUsed&&this.length<=127&&this.warnings.push("Unnecessary usage of long length form"),this.blockLength=o+1,e+this.blockLength}toBER(t=!1){let e,i;if(this.length>127&&(this.longFormUsed=!0),this.isIndefiniteForm)return e=new ArrayBuffer(1),!1===t&&(i=new Uint8Array(e),i[0]=128),e;if(this.longFormUsed){const r=l(this.length,8);if(r.byteLength>127)return this.error="Too big length",A;if(e=new ArrayBuffer(r.byteLength+1),t)return e;const s=new Uint8Array(r);i=new Uint8Array(e),i[0]=128|r.byteLength;for(let t=0;t<r.byteLength;t++)i[t+1]=s[t];return e}return e=new ArrayBuffer(1),!1===t&&(i=new Uint8Array(e),i[0]=this.length),e}toJSON(){return{...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,longFormUsed:this.longFormUsed,length:this.length}}}P.NAME="lengthBlock";const D={};class b extends v{constructor({name:t="",optional:e=!1,primitiveSchema:i,...r}={},s){super(r),this.name=t,this.optional=e,i&&(this.primitiveSchema=i),this.idBlock=new w(r),this.lenBlock=new P(r),this.valueBlock=s?new s(r):new E(r)}fromBER(t,e,i){const r=this.valueBlock.fromBER(t,e,this.lenBlock.isIndefiniteForm?i:this.lenBlock.length);return-1===r?(this.error=this.valueBlock.error,r):(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),r)}toBER(t,e){const i=e||new S;e||function t(e){if(e instanceof D.Constructed)for(const i of e.valueBlock.value)t(i)&&(e.lenBlock.isIndefiniteForm=!0);return!!e.lenBlock.isIndefiniteForm}(this);const r=this.idBlock.toBER(t);if(i.write(r),this.lenBlock.isIndefiniteForm)i.write(new Uint8Array([128]).buffer),this.valueBlock.toBER(t,i),i.write(new ArrayBuffer(2));else{const e=this.valueBlock.toBER(t);this.lenBlock.length=e.byteLength;const r=this.lenBlock.toBER(t);i.write(r),i.write(e)}return e?A:i.final()}toJSON(){const t={...super.toJSON(),idBlock:this.idBlock.toJSON(),lenBlock:this.lenBlock.toJSON(),valueBlock:this.valueBlock.toJSON(),name:this.name,optional:this.optional};return this.primitiveSchema&&(t.primitiveSchema=this.primitiveSchema.toJSON()),t}toString(t="ascii"){return"ascii"===t?this.onAsciiEncoding():o.ToHex(this.toBER())}onAsciiEncoding(){return`${this.constructor.NAME} : ${o.ToHex(this.valueBlock.valueBeforeDecodeView)}`}isEqual(t){return this===t||t instanceof this.constructor&&function(t,e){if(t.byteLength!==e.byteLength)return!1;const i=new Uint8Array(t),r=new Uint8Array(e);for(let s=0;s<i.length;s++)if(i[s]!==r[s])return!1;return!0}(this.toBER(),t.toBER())}}b.NAME="BaseBlock";class B extends b{constructor({value:t="",...e}={},i){super(e,i),t&&this.fromString(t)}getValue(){return this.valueBlock.value}setValue(t){this.valueBlock.value=t}fromBER(t,e,i){const r=this.valueBlock.fromBER(t,e,this.lenBlock.isIndefiniteForm?i:this.lenBlock.length);return-1===r?(this.error=this.valueBlock.error,r):(this.fromBuffer(this.valueBlock.valueHexView),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),r)}onAsciiEncoding(){return`${this.constructor.NAME} : '${this.valueBlock.value}'`}}B.NAME="BaseStringBlock";class I extends(g(E)){constructor({isHexOnly:t=!0,...e}={}){super(e),this.isHexOnly=t}}var T;I.NAME="PrimitiveValueBlock";class x extends b{constructor(t={}){super(t,I),this.idBlock.isConstructed=!1}}function R(t,e=0,i=t.length){const r=e;let s=new b({},E);const n=new v;if(!y(n,t,e,i))return s.error=n.error,{offset:-1,result:s};if(!t.subarray(e,e+i).length)return s.error="Zero buffer length",{offset:-1,result:s};let o=s.idBlock.fromBER(t,e,i);if(s.idBlock.warnings.length&&s.warnings.concat(s.idBlock.warnings),-1===o)return s.error=s.idBlock.error,{offset:-1,result:s};if(o=s.lenBlock.fromBER(t,e=o,i-=s.idBlock.blockLength),s.lenBlock.warnings.length&&s.warnings.concat(s.lenBlock.warnings),-1===o)return s.error=s.lenBlock.error,{offset:-1,result:s};if(e=o,i-=s.lenBlock.blockLength,!s.idBlock.isConstructed&&s.lenBlock.isIndefiniteForm)return s.error="Indefinite length form used for primitive encoding form",{offset:-1,result:s};let a=b;switch(s.idBlock.tagClass){case 1:if(s.idBlock.tagNumber>=37&&!1===s.idBlock.isHexOnly)return s.error="UNIVERSAL 37 and upper tags are reserved by ASN.1 standard",{offset:-1,result:s};switch(s.idBlock.tagNumber){case 0:if(s.idBlock.isConstructed&&s.lenBlock.length>0)return s.error="Type [UNIVERSAL 0] is reserved",{offset:-1,result:s};a=D.EndOfContent;break;case 1:a=D.Boolean;break;case 2:a=D.Integer;break;case 3:a=D.BitString;break;case 4:a=D.OctetString;break;case 5:a=D.Null;break;case 6:a=D.ObjectIdentifier;break;case 10:a=D.Enumerated;break;case 12:a=D.Utf8String;break;case 13:a=D.RelativeObjectIdentifier;break;case 14:a=D.TIME;break;case 15:return s.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:s};case 16:a=D.Sequence;break;case 17:a=D.Set;break;case 18:a=D.NumericString;break;case 19:a=D.PrintableString;break;case 20:a=D.TeletexString;break;case 21:a=D.VideotexString;break;case 22:a=D.IA5String;break;case 23:a=D.UTCTime;break;case 24:a=D.GeneralizedTime;break;case 25:a=D.GraphicString;break;case 26:a=D.VisibleString;break;case 27:a=D.GeneralString;break;case 28:a=D.UniversalString;break;case 29:a=D.CharacterString;break;case 30:a=D.BmpString;break;case 31:a=D.DATE;break;case 32:a=D.TimeOfDay;break;case 33:a=D.DateTime;break;case 34:a=D.Duration;break;default:{const t=s.idBlock.isConstructed?new D.Constructed:new D.Primitive;t.idBlock=s.idBlock,t.lenBlock=s.lenBlock,t.warnings=s.warnings,s=t}}break;case 2:case 3:case 4:default:a=s.idBlock.isConstructed?D.Constructed:D.Primitive}return s=function(t,e){if(t instanceof e)return t;const i=new e;return i.idBlock=t.idBlock,i.lenBlock=t.lenBlock,i.warnings=t.warnings,i.valueBeforeDecodeView=t.valueBeforeDecodeView,i}(s,a),o=s.fromBER(t,e,s.lenBlock.isIndefiniteForm?i:s.lenBlock.length),s.valueBeforeDecodeView=t.subarray(r,r+s.blockLength),{offset:o,result:s}}function O(t){if(!t.byteLength){const t=new b({},E);return t.error="Input buffer has zero length",{offset:-1,result:t}}return R(n.toUint8Array(t).slice(),0,t.byteLength)}D.Primitive=x,x.NAME="PRIMITIVE";class N extends E{constructor({value:t=[],isIndefiniteForm:e=!1,...i}={}){super(i),this.value=t,this.isIndefiniteForm=e}fromBER(t,e,i){const r=n.toUint8Array(t);if(!y(this,r,e,i))return-1;if(this.valueBeforeDecodeView=r.subarray(e,e+i),0===this.valueBeforeDecodeView.length)return this.warnings.push("Zero buffer length"),e;let s=e;for(;(this.isIndefiniteForm?1:i)>0;){const t=R(r,s,i);if(-1===t.offset)return this.error=t.result.error,this.warnings.concat(t.result.warnings),-1;if(s=t.offset,this.blockLength+=t.result.blockLength,i-=t.result.blockLength,this.value.push(t.result),this.isIndefiniteForm&&"EndOfContent"===t.result.constructor.NAME)break}return this.isIndefiniteForm&&("EndOfContent"===this.value[this.value.length-1].constructor.NAME?this.value.pop():this.warnings.push("No EndOfContent block encoded")),s}toBER(t,e){const i=e||new S;for(let r=0;r<this.value.length;r++)this.value[r].toBER(t,i);return e?A:i.final()}toJSON(){const t={...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,value:[]};for(const e of this.value)t.value.push(e.toJSON());return t}}N.NAME="ConstructedValueBlock";class k extends b{constructor(t={}){super(t,N),this.idBlock.isConstructed=!0}fromBER(t,e,i){this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm;const r=this.valueBlock.fromBER(t,e,this.lenBlock.isIndefiniteForm?i:this.lenBlock.length);return-1===r?(this.error=this.valueBlock.error,r):(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),r)}onAsciiEncoding(){const t=[];for(const i of this.valueBlock.value)t.push(i.toString("ascii").split("\n").map(t=>" "+t).join("\n"));const e=3===this.idBlock.tagClass?`[${this.idBlock.tagNumber}]`:this.constructor.NAME;return t.length?`${e} :\n${t.join("\n")}`:e+" :"}}D.Constructed=k,k.NAME="CONSTRUCTED";class M extends E{fromBER(t,e,i){return e}toBER(t){return A}}M.override="EndOfContentValueBlock";class K extends b{constructor(t={}){super(t,M),this.idBlock.tagClass=1,this.idBlock.tagNumber=0}}D.EndOfContent=K,K.NAME="EndOfContent";class H extends b{constructor(t={}){super(t,E),this.idBlock.tagClass=1,this.idBlock.tagNumber=5}fromBER(t,e,i){return this.lenBlock.length>0&&this.warnings.push("Non-zero length of value block for Null type"),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.blockLength+=i,e+i>t.byteLength?(this.error="End of input reached before message was fully decoded (inconsistent offset and length values)",-1):e+i}toBER(t,e){const i=new ArrayBuffer(2);if(!t){const t=new Uint8Array(i);t[0]=5,t[1]=0}return e&&e.write(i),i}onAsciiEncoding(){return""+this.constructor.NAME}}D.Null=H,H.NAME="NULL";class U extends(g(E)){constructor({value:t,...e}={}){super(e),this.valueHexView=e.valueHex?n.toUint8Array(e.valueHex):new Uint8Array(1),t&&(this.value=t)}get value(){for(const t of this.valueHexView)if(t>0)return!0;return!1}set value(t){this.valueHexView[0]=t?255:0}fromBER(t,e,i){const r=n.toUint8Array(t);return y(this,r,e,i)?(this.valueHexView=r.subarray(e,e+i),i>1&&this.warnings.push("Boolean value encoded in more then 1 octet"),this.isHexOnly=!0,h.call(this),this.blockLength=i,e+i):-1}toBER(){return this.valueHexView.slice()}toJSON(){return{...super.toJSON(),value:this.value}}}U.NAME="BooleanValueBlock";class _ extends b{constructor(t={}){super(t,U),this.idBlock.tagClass=1,this.idBlock.tagNumber=1}getValue(){return this.valueBlock.value}setValue(t){this.valueBlock.value=t}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.getValue}`}}D.Boolean=_,_.NAME="BOOLEAN";class j extends(g(N)){constructor({isConstructed:t=!1,...e}={}){super(e),this.isConstructed=t}fromBER(t,e,i){let r=0;if(this.isConstructed){if(this.isHexOnly=!1,r=N.prototype.fromBER.call(this,t,e,i),-1===r)return r;for(let t=0;t<this.value.length;t++){const e=this.value[t].constructor.NAME;if("EndOfContent"===e){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, OCTET STRING may consists of OCTET STRINGs only",-1}if("OCTET STRING"!==e)return this.error="OCTET STRING may consists of OCTET STRINGs only",-1}}else this.isHexOnly=!0,r=super.fromBER(t,e,i),this.blockLength=i;return r}toBER(t,e){return this.isConstructed?N.prototype.toBER.call(this,t,e):t?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),isConstructed:this.isConstructed}}}j.NAME="OctetStringValueBlock";class F extends b{constructor({idBlock:t={},lenBlock:e={},...i}={}){var r,s;null!==(r=i.isConstructed)&&void 0!==r||(i.isConstructed=!!(null===(s=i.value)||void 0===s?void 0:s.length)),super({idBlock:{isConstructed:i.isConstructed,...t},lenBlock:{...e,isIndefiniteForm:!!i.isIndefiniteForm},...i},j),this.idBlock.tagClass=1,this.idBlock.tagNumber=4}fromBER(t,e,i){if(this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,0===i)return 0===this.idBlock.error.length&&(this.blockLength+=this.idBlock.blockLength),0===this.lenBlock.error.length&&(this.blockLength+=this.lenBlock.blockLength),e;if(!this.valueBlock.isConstructed){const s=(t instanceof ArrayBuffer?new Uint8Array(t):t).subarray(e,e+i);try{if(s.byteLength){const t=R(s,0,s.byteLength);-1!==t.offset&&t.offset===i&&(this.valueBlock.value=[t.result])}}catch(r){}}return super.fromBER(t,e,i)}onAsciiEncoding(){return this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length?k.prototype.onAsciiEncoding.call(this):`${this.constructor.NAME} : ${o.ToHex(this.valueBlock.valueHexView)}`}getValue(){if(!this.idBlock.isConstructed)return this.valueBlock.valueHexView.slice().buffer;const t=[];for(const e of this.valueBlock.value)e instanceof F&&t.push(e.valueBlock.valueHexView);return n.concat(t)}}D.OctetString=F,F.NAME="OCTET STRING";class V extends(g(N)){constructor({unusedBits:t=0,isConstructed:e=!1,...i}={}){super(i),this.unusedBits=t,this.isConstructed=e,this.blockLength=this.valueHexView.byteLength}fromBER(t,e,i){if(!i)return e;let r=-1;if(this.isConstructed){if(r=N.prototype.fromBER.call(this,t,e,i),-1===r)return r;for(const t of this.value){const e=t.constructor.NAME;if("EndOfContent"===e){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, BIT STRING may consists of BIT STRINGs only",-1}if("BIT STRING"!==e)return this.error="BIT STRING may consists of BIT STRINGs only",-1;const i=t.valueBlock;if(this.unusedBits>0&&i.unusedBits>0)return this.error='Using of "unused bits" inside constructive BIT STRING allowed for least one only',-1;this.unusedBits=i.unusedBits}return r}const s=n.toUint8Array(t);if(!y(this,s,e,i))return-1;const o=s.subarray(e,e+i);if(this.unusedBits=o[0],this.unusedBits>7)return this.error="Unused bits for BitString must be in range 0-7",-1;if(!this.unusedBits){const t=o.subarray(1);try{if(t.byteLength){const e=R(t,0,t.byteLength);-1!==e.offset&&e.offset===i-1&&(this.value=[e.result])}}catch(a){}}return this.valueHexView=o.subarray(1),this.blockLength=o.length,e+i}toBER(t,e){if(this.isConstructed)return N.prototype.toBER.call(this,t,e);if(t)return new ArrayBuffer(this.valueHexView.byteLength+1);if(!this.valueHexView.byteLength)return A;const i=new Uint8Array(this.valueHexView.length+1);return i[0]=this.unusedBits,i.set(this.valueHexView,1),i.buffer}toJSON(){return{...super.toJSON(),unusedBits:this.unusedBits,isConstructed:this.isConstructed}}}V.NAME="BitStringValueBlock";class L extends b{constructor({idBlock:t={},lenBlock:e={},...i}={}){var r,s;null!==(r=i.isConstructed)&&void 0!==r||(i.isConstructed=!!(null===(s=i.value)||void 0===s?void 0:s.length)),super({idBlock:{isConstructed:i.isConstructed,...t},lenBlock:{...e,isIndefiniteForm:!!i.isIndefiniteForm},...i},V),this.idBlock.tagClass=1,this.idBlock.tagNumber=3}fromBER(t,e,i){return this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,super.fromBER(t,e,i)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return k.prototype.onAsciiEncoding.call(this);{const t=[],e=this.valueBlock.valueHexView;for(const r of e)t.push(r.toString(2).padStart(8,"0"));const i=t.join("");return`${this.constructor.NAME} : ${i.substring(0,i.length-this.valueBlock.unusedBits)}`}}}function G(t,e){const i=new Uint8Array([0]),r=new Uint8Array(t),s=new Uint8Array(e);let n=r.slice(0);const o=n.length-1,a=s.slice(0),c=a.length-1;let l=0,h=0;for(let p=c<o?o:c;p>=0;p--,h++){switch(!0){case h<a.length:l=n[o-h]+a[c-h]+i[0];break;default:l=n[o-h]+i[0]}switch(i[0]=l/10,!0){case h>=n.length:n=u(new Uint8Array([l%10]),n);break;default:n[o-h]=l%10}}return i[0]>0&&(n=u(i,n)),n}function $(t){if(t>=C.length)for(let e=C.length;e<=t;e++){const t=new Uint8Array([0]);let i=C[e-1].slice(0);for(let e=i.length-1;e>=0;e--){const r=new Uint8Array([(i[e]<<1)+t[0]]);t[0]=r[0]/10,i[e]=r[0]%10}t[0]>0&&(i=u(t,i)),C.push(i)}return C[t]}function Q(t,e){let i=0;const r=new Uint8Array(t),s=new Uint8Array(e),n=r.slice(0),o=n.length-1,a=s.slice(0),c=a.length-1;let l,u=0;for(let h=c;h>=0;h--,u++)switch(l=n[o-u]-a[c-u]-i,!0){case l<0:i=1,n[o-u]=l+10;break;default:i=0,n[o-u]=l}if(i>0)for(let h=o-c+1;h>=0;h--,u++){if(l=n[o-u]-i,!(l<0)){i=0,n[o-u]=l;break}i=1,n[o-u]=l+10}return n.slice()}D.BitString=L,L.NAME="BIT STRING";class W extends(g(E)){constructor({value:t,...e}={}){super(e),this._valueDec=0,e.valueHex&&this.setValueHex(),void 0!==t&&(this.valueDec=t)}setValueHex(){this.valueHexView.length>=4?(this.warnings.push("Too big Integer for decoding, hex only"),this.isHexOnly=!0,this._valueDec=0):(this.isHexOnly=!1,this.valueHexView.length>0&&(this._valueDec=h.call(this)))}set valueDec(t){this._valueDec=t,this.isHexOnly=!1,this.valueHexView=new Uint8Array(function(t){const e=t<0?-1*t:t;let i=128;for(let r=1;r<8;r++){if(e<=i){if(t<0){const t=l(i-e,8,r);return new Uint8Array(t)[0]|=128,t}let s=l(e,8,r),n=new Uint8Array(s);if(128&n[0]){const t=s.slice(0),e=new Uint8Array(t);s=new ArrayBuffer(s.byteLength+1),n=new Uint8Array(s);for(let i=0;i<t.byteLength;i++)n[i+1]=e[i];n[0]=0}return s}i*=Math.pow(2,8)}return new ArrayBuffer(0)}(t))}get valueDec(){return this._valueDec}fromDER(t,e,i,r=0){const s=this.fromBER(t,e,i);if(-1===s)return s;const n=this.valueHexView;return 0===n[0]&&0!=(128&n[1])?this.valueHexView=n.subarray(1):0!==r&&n.length<r&&(r-n.length>1&&(r=n.length+1),this.valueHexView=n.subarray(r-n.length)),s}toDER(t=!1){const e=this.valueHexView;switch(!0){case 0!=(128&e[0]):{const t=new Uint8Array(this.valueHexView.length+1);t[0]=0,t.set(e,1),this.valueHexView=t}break;case 0===e[0]&&0==(128&e[1]):this.valueHexView=this.valueHexView.subarray(1)}return this.toBER(t)}fromBER(t,e,i){const r=super.fromBER(t,e,i);return-1===r||this.setValueHex(),r}toBER(t){return t?new ArrayBuffer(this.valueHexView.length):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}toString(){const t=8*this.valueHexView.length-1;let e,i=new Uint8Array(8*this.valueHexView.length/3),r=0;const s=this.valueHexView;let n="",o=!1;for(let a=s.byteLength-1;a>=0;a--){e=s[a];for(let s=0;s<8;s++){if(1==(1&e))switch(r){case t:i=Q($(r),i),n="-";break;default:i=G(i,$(r))}r++,e>>=1}}for(let a=0;a<i.length;a++)i[a]&&(o=!0),o&&(n+="0123456789".charAt(i[a]));return!1===o&&(n+="0123456789".charAt(0)),n}}T=W,W.NAME="IntegerValueBlock",Object.defineProperty(T.prototype,"valueHex",{set:function(t){this.valueHexView=new Uint8Array(t),this.setValueHex()},get:function(){return this.valueHexView.slice().buffer}});class z extends b{constructor(t={}){super(t,W),this.idBlock.tagClass=1,this.idBlock.tagNumber=2}toBigInt(){return d(),BigInt(this.valueBlock.toString())}static fromBigInt(t){d();const e=BigInt(t),i=new S,r=e.toString(16).replace(/^-/,""),s=new Uint8Array(o.FromHex(r));if(e<0){const t=new Uint8Array(s.length+(128&s[0]?1:0));t[0]|=128;const r=BigInt("0x"+o.ToHex(t)),a=n.toUint8Array(o.FromHex((r+e).toString(16)));a[0]|=128,i.write(a)}else 128&s[0]&&i.write(new Uint8Array([0])),i.write(s);return new z({valueHex:i.final()})}convertToDER(){const t=new z({valueHex:this.valueBlock.valueHexView});return t.valueBlock.toDER(),t}convertFromDER(){return new z({valueHex:0===this.valueBlock.valueHexView[0]?this.valueBlock.valueHexView.subarray(1):this.valueBlock.valueHexView})}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()}`}}D.Integer=z,z.NAME="INTEGER";class q extends z{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=10}}D.Enumerated=q,q.NAME="ENUMERATED";class J extends(g(E)){constructor({valueDec:t=-1,isFirstSid:e=!1,...i}={}){super(i),this.valueDec=t,this.isFirstSid=e}fromBER(t,e,i){if(!i)return e;const r=n.toUint8Array(t);if(!y(this,r,e,i))return-1;const s=r.subarray(e,e+i);this.valueHexView=new Uint8Array(i);for(let n=0;n<i&&(this.valueHexView[n]=127&s[n],this.blockLength++,0!=(128&s[n]));n++);const o=new Uint8Array(this.blockLength);for(let n=0;n<this.blockLength;n++)o[n]=this.valueHexView[n];return this.valueHexView=o,0!=(128&s[this.blockLength-1])?(this.error="End of input reached before message was fully decoded",-1):(0===this.valueHexView[0]&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=c(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),e+this.blockLength)}set valueBigInt(t){d();let e=BigInt(t).toString(2);for(;e.length%7;)e="0"+e;const i=new Uint8Array(e.length/7);for(let r=0;r<i.length;r++)i[r]=parseInt(e.slice(7*r,7*r+7),2)+(r+1<i.length?128:0);this.fromBER(i.buffer,0,i.length)}toBER(t){if(this.isHexOnly){if(t)return new ArrayBuffer(this.valueHexView.byteLength);const e=this.valueHexView,i=new Uint8Array(this.blockLength);for(let t=0;t<this.blockLength-1;t++)i[t]=128|e[t];return i[this.blockLength-1]=e[this.blockLength-1],i.buffer}const e=l(this.valueDec,7);if(0===e.byteLength)return this.error="Error during encoding SID value",A;const i=new Uint8Array(e.byteLength);if(!t){const t=new Uint8Array(e),r=e.byteLength-1;for(let e=0;e<r;e++)i[e]=128|t[e];i[r]=t[r]}return i}toString(){let t="";if(this.isHexOnly)t=o.ToHex(this.valueHexView);else if(this.isFirstSid){let e=this.valueDec;this.valueDec<=39?t="0.":this.valueDec<=79?(t="1.",e-=40):(t="2.",e-=80),t+=e.toString()}else t=this.valueDec.toString();return t}toJSON(){return{...super.toJSON(),valueDec:this.valueDec,isFirstSid:this.isFirstSid}}}J.NAME="sidBlock";class Z extends E{constructor({value:t="",...e}={}){super(e),this.value=[],t&&this.fromString(t)}fromBER(t,e,i){let r=e;for(;i>0;){const e=new J;if(r=e.fromBER(t,r,i),-1===r)return this.blockLength=0,this.error=e.error,r;0===this.value.length&&(e.isFirstSid=!0),this.blockLength+=e.blockLength,i-=e.blockLength,this.value.push(e)}return r}toBER(t){const e=[];for(let i=0;i<this.value.length;i++){const r=this.value[i].toBER(t);if(0===r.byteLength)return this.error=this.value[i].error,A;e.push(r)}return f(e)}fromString(t){this.value=[];let e=0,i=0,r="",s=!1;do{if(i=t.indexOf(".",e),r=-1===i?t.substring(e):t.substring(e,i),e=i+1,s){const t=this.value[0];let e=0;switch(t.valueDec){case 0:break;case 1:e=40;break;case 2:e=80;break;default:return void(this.value=[])}const i=parseInt(r,10);if(isNaN(i))return;t.valueDec=i+e,s=!1}else{const t=new J;if(r>Number.MAX_SAFE_INTEGER){d();const e=BigInt(r);t.valueBigInt=e}else if(t.valueDec=parseInt(r,10),isNaN(t.valueDec))return;this.value.length||(t.isFirstSid=!0,s=!0),this.value.push(t)}}while(-1!==i)}toString(){let t="",e=!1;for(let i=0;i<this.value.length;i++){e=this.value[i].isHexOnly;let r=this.value[i].toString();0!==i&&(t+="."),e?(r=`{${r}}`,this.value[i].isFirstSid?t=`2.{${r} - 80}`:t+=r):t+=r}return t}toJSON(){const t={...super.toJSON(),value:this.toString(),sidArray:[]};for(let e=0;e<this.value.length;e++)t.sidArray.push(this.value[e].toJSON());return t}}Z.NAME="ObjectIdentifierValueBlock";class X extends b{constructor(t={}){super(t,Z),this.idBlock.tagClass=1,this.idBlock.tagNumber=6}getValue(){return this.valueBlock.toString()}setValue(t){this.valueBlock.fromString(t)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}}D.ObjectIdentifier=X,X.NAME="OBJECT IDENTIFIER";class Y extends(g(v)){constructor({valueDec:t=0,...e}={}){super(e),this.valueDec=t}fromBER(t,e,i){if(0===i)return e;const r=n.toUint8Array(t);if(!y(this,r,e,i))return-1;const s=r.subarray(e,e+i);this.valueHexView=new Uint8Array(i);for(let n=0;n<i&&(this.valueHexView[n]=127&s[n],this.blockLength++,0!=(128&s[n]));n++);const o=new Uint8Array(this.blockLength);for(let n=0;n<this.blockLength;n++)o[n]=this.valueHexView[n];return this.valueHexView=o,0!=(128&s[this.blockLength-1])?(this.error="End of input reached before message was fully decoded",-1):(0===this.valueHexView[0]&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=c(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),e+this.blockLength)}toBER(t){if(this.isHexOnly){if(t)return new ArrayBuffer(this.valueHexView.byteLength);const e=this.valueHexView,i=new Uint8Array(this.blockLength);for(let t=0;t<this.blockLength-1;t++)i[t]=128|e[t];return i[this.blockLength-1]=e[this.blockLength-1],i.buffer}const e=l(this.valueDec,7);if(0===e.byteLength)return this.error="Error during encoding SID value",A;const i=new Uint8Array(e.byteLength);if(!t){const t=new Uint8Array(e),r=e.byteLength-1;for(let e=0;e<r;e++)i[e]=128|t[e];i[r]=t[r]}return i.buffer}toString(){let t="";return t=this.isHexOnly?o.ToHex(this.valueHexView):this.valueDec.toString(),t}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}}Y.NAME="relativeSidBlock";class tt extends E{constructor({value:t="",...e}={}){super(e),this.value=[],t&&this.fromString(t)}fromBER(t,e,i){let r=e;for(;i>0;){const e=new Y;if(r=e.fromBER(t,r,i),-1===r)return this.blockLength=0,this.error=e.error,r;this.blockLength+=e.blockLength,i-=e.blockLength,this.value.push(e)}return r}toBER(t,e){const i=[];for(let r=0;r<this.value.length;r++){const e=this.value[r].toBER(t);if(0===e.byteLength)return this.error=this.value[r].error,A;i.push(e)}return f(i)}fromString(t){this.value=[];let e=0,i=0,r="";do{i=t.indexOf(".",e),r=-1===i?t.substring(e):t.substring(e,i),e=i+1;const s=new Y;if(s.valueDec=parseInt(r,10),isNaN(s.valueDec))return!0;this.value.push(s)}while(-1!==i);return!0}toString(){let t="",e=!1;for(let i=0;i<this.value.length;i++){e=this.value[i].isHexOnly;let r=this.value[i].toString();0!==i&&(t+="."),e?(r=`{${r}}`,t+=r):t+=r}return t}toJSON(){const t={...super.toJSON(),value:this.toString(),sidArray:[]};for(let e=0;e<this.value.length;e++)t.sidArray.push(this.value[e].toJSON());return t}}tt.NAME="RelativeObjectIdentifierValueBlock";class et extends b{constructor(t={}){super(t,tt),this.idBlock.tagClass=1,this.idBlock.tagNumber=13}getValue(){return this.valueBlock.toString()}setValue(t){this.valueBlock.fromString(t)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}}D.RelativeObjectIdentifier=et,et.NAME="RelativeObjectIdentifier";class it extends k{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=16}}D.Sequence=it,it.NAME="SEQUENCE";class rt extends k{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=17}}D.Set=rt,rt.NAME="SET";class st extends(g(E)){constructor({...t}={}){super(t),this.isHexOnly=!0,this.value=""}toJSON(){return{...super.toJSON(),value:this.value}}}st.NAME="StringValueBlock";class nt extends st{}nt.NAME="SimpleStringValueBlock";class ot extends B{constructor({...t}={}){super(t,nt)}fromBuffer(t){this.valueBlock.value=String.fromCharCode.apply(null,n.toUint8Array(t))}fromString(t){const e=t.length,i=this.valueBlock.valueHexView=new Uint8Array(e);for(let r=0;r<e;r++)i[r]=t.charCodeAt(r);this.valueBlock.value=t}}ot.NAME="SIMPLE STRING";class at extends ot{fromBuffer(t){this.valueBlock.valueHexView=n.toUint8Array(t);try{this.valueBlock.value=o.ToUtf8String(t)}catch(e){this.warnings.push(`Error during "decodeURIComponent": ${e}, using raw string`),this.valueBlock.value=o.ToBinary(t)}}fromString(t){this.valueBlock.valueHexView=new Uint8Array(o.FromUtf8String(t)),this.valueBlock.value=t}}at.NAME="Utf8StringValueBlock";class ct extends at{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=12}}D.Utf8String=ct,ct.NAME="UTF8String";class lt extends ot{fromBuffer(t){this.valueBlock.value=o.ToUtf16String(t),this.valueBlock.valueHexView=n.toUint8Array(t)}fromString(t){this.valueBlock.value=t,this.valueBlock.valueHexView=new Uint8Array(o.FromUtf16String(t))}}lt.NAME="BmpStringValueBlock";class ut extends lt{constructor({...t}={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=30}}D.BmpString=ut,ut.NAME="BMPString";class ht extends ot{fromBuffer(t){const e=ArrayBuffer.isView(t)?t.slice().buffer:t.slice(0),i=new Uint8Array(e);for(let r=0;r<i.length;r+=4)i[r]=i[r+3],i[r+1]=i[r+2],i[r+2]=0,i[r+3]=0;this.valueBlock.value=String.fromCharCode.apply(null,new Uint32Array(e))}fromString(t){const e=t.length,i=this.valueBlock.valueHexView=new Uint8Array(4*e);for(let r=0;r<e;r++){const e=l(t.charCodeAt(r),8),s=new Uint8Array(e);if(s.length>4)continue;const n=4-s.length;for(let t=s.length-1;t>=0;t--)i[4*r+t+n]=s[t]}this.valueBlock.value=t}}ht.NAME="UniversalStringValueBlock";class pt extends ht{constructor({...t}={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=28}}D.UniversalString=pt,pt.NAME="UniversalString";class dt extends ot{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=18}}D.NumericString=dt,dt.NAME="NumericString";class ft extends ot{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=19}}D.PrintableString=ft,ft.NAME="PrintableString";class yt extends ot{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=20}}D.TeletexString=yt,yt.NAME="TeletexString";class St extends ot{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=21}}D.VideotexString=St,St.NAME="VideotexString";class Ct extends ot{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=22}}D.IA5String=Ct,Ct.NAME="IA5String";class At extends ot{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=25}}D.GraphicString=At,At.NAME="GraphicString";class mt extends ot{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=26}}D.VisibleString=mt,mt.NAME="VisibleString";class gt extends ot{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=27}}D.GeneralString=gt,gt.NAME="GeneralString";class vt extends ot{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=29}}D.CharacterString=vt,vt.NAME="CharacterString";class Et extends mt{constructor({value:t,valueDate:e,...i}={}){if(super(i),this.year=0,this.month=0,this.day=0,this.hour=0,this.minute=0,this.second=0,t){this.fromString(t),this.valueBlock.valueHexView=new Uint8Array(t.length);for(let e=0;e<t.length;e++)this.valueBlock.valueHexView[e]=t.charCodeAt(e)}e&&(this.fromDate(e),this.valueBlock.valueHexView=new Uint8Array(this.toBuffer())),this.idBlock.tagClass=1,this.idBlock.tagNumber=23}fromBuffer(t){this.fromString(String.fromCharCode.apply(null,n.toUint8Array(t)))}toBuffer(){const t=this.toString(),e=new ArrayBuffer(t.length),i=new Uint8Array(e);for(let r=0;r<t.length;r++)i[r]=t.charCodeAt(r);return e}fromDate(t){this.year=t.getUTCFullYear(),this.month=t.getUTCMonth()+1,this.day=t.getUTCDate(),this.hour=t.getUTCHours(),this.minute=t.getUTCMinutes(),this.second=t.getUTCSeconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second))}fromString(t){const e=/(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})Z/gi.exec(t);if(null===e)return void(this.error="Wrong input string for conversion");const i=parseInt(e[1],10);this.year=i>=50?1900+i:2e3+i,this.month=parseInt(e[2],10),this.day=parseInt(e[3],10),this.hour=parseInt(e[4],10),this.minute=parseInt(e[5],10),this.second=parseInt(e[6],10)}toString(t="iso"){if("iso"===t){const t=new Array(7);return t[0]=p(this.year<2e3?this.year-1900:this.year-2e3,2),t[1]=p(this.month,2),t[2]=p(this.day,2),t[3]=p(this.hour,2),t[4]=p(this.minute,2),t[5]=p(this.second,2),t[6]="Z",t.join("")}return super.toString(t)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.toDate().toISOString()}`}toJSON(){return{...super.toJSON(),year:this.year,month:this.month,day:this.day,hour:this.hour,minute:this.minute,second:this.second}}}D.UTCTime=Et,Et.NAME="UTCTime";class wt extends Et{constructor(t={}){var e;super(t),null!==(e=this.millisecond)&&void 0!==e||(this.millisecond=0),this.idBlock.tagClass=1,this.idBlock.tagNumber=24}fromDate(t){super.fromDate(t),this.millisecond=t.getUTCMilliseconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second,this.millisecond))}fromString(t){let e,i=!1,r="",s="",n=0,o=0,a=0;if("Z"===t[t.length-1])r=t.substring(0,t.length-1),i=!0;else{const e=new Number(t[t.length-1]);if(isNaN(e.valueOf()))throw new Error("Wrong input string for conversion");r=t}if(i){if(-1!==r.indexOf("+"))throw new Error("Wrong input string for conversion");if(-1!==r.indexOf("-"))throw new Error("Wrong input string for conversion")}else{let t=1,e=r.indexOf("+"),i="";if(-1===e&&(e=r.indexOf("-"),t=-1),-1!==e){if(i=r.substring(e+1),r=r.substring(0,e),2!==i.length&&4!==i.length)throw new Error("Wrong input string for conversion");let s=parseInt(i.substring(0,2),10);if(isNaN(s.valueOf()))throw new Error("Wrong input string for conversion");if(o=t*s,4===i.length){if(s=parseInt(i.substring(2,4),10),isNaN(s.valueOf()))throw new Error("Wrong input string for conversion");a=t*s}}}let c=r.indexOf(".");if(-1===c&&(c=r.indexOf(",")),-1!==c){const t=new Number("0"+r.substring(c));if(isNaN(t.valueOf()))throw new Error("Wrong input string for conversion");n=t.valueOf(),s=r.substring(0,c)}else s=r;switch(!0){case 8===s.length:if(e=/(\d{4})(\d{2})(\d{2})/gi,-1!==c)throw new Error("Wrong input string for conversion");break;case 10===s.length:if(e=/(\d{4})(\d{2})(\d{2})(\d{2})/gi,-1!==c){let t=60*n;this.minute=Math.floor(t),t=60*(t-this.minute),this.second=Math.floor(t),t=1e3*(t-this.second),this.millisecond=Math.floor(t)}break;case 12===s.length:if(e=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/gi,-1!==c){let t=60*n;this.second=Math.floor(t),t=1e3*(t-this.second),this.millisecond=Math.floor(t)}break;case 14===s.length:e=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/gi,-1!==c&&(this.millisecond=Math.floor(1e3*n));break;default:throw new Error("Wrong input string for conversion")}const l=e.exec(s);if(null===l)throw new Error("Wrong input string for conversion");for(let u=1;u<l.length;u++)switch(u){case 1:this.year=parseInt(l[u],10);break;case 2:this.month=parseInt(l[u],10);break;case 3:this.day=parseInt(l[u],10);break;case 4:this.hour=parseInt(l[u],10)+o;break;case 5:this.minute=parseInt(l[u],10)+a;break;case 6:this.second=parseInt(l[u],10);break;default:throw new Error("Wrong input string for conversion")}if(!1===i){const t=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond);this.year=t.getUTCFullYear(),this.month=t.getUTCMonth(),this.day=t.getUTCDay(),this.hour=t.getUTCHours(),this.minute=t.getUTCMinutes(),this.second=t.getUTCSeconds(),this.millisecond=t.getUTCMilliseconds()}}toString(t="iso"){if("iso"===t){const t=[];return t.push(p(this.year,4)),t.push(p(this.month,2)),t.push(p(this.day,2)),t.push(p(this.hour,2)),t.push(p(this.minute,2)),t.push(p(this.second,2)),0!==this.millisecond&&(t.push("."),t.push(p(this.millisecond,3))),t.push("Z"),t.join("")}return super.toString(t)}toJSON(){return{...super.toJSON(),millisecond:this.millisecond}}}D.GeneralizedTime=wt,wt.NAME="GeneralizedTime";class Pt extends ct{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=31}}D.DATE=Pt,Pt.NAME="DATE";class Dt extends ct{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=32}}D.TimeOfDay=Dt,Dt.NAME="TimeOfDay";class bt extends ct{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=33}}D.DateTime=bt,bt.NAME="DateTime";class Bt extends ct{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=34}}D.Duration=Bt,Bt.NAME="Duration";class It extends ct{constructor(t={}){super(t),this.idBlock.tagClass=1,this.idBlock.tagNumber=14}}D.TIME=It,It.NAME="TIME";class Tt{constructor({name:t="",optional:e=!1}={}){this.name=t,this.optional=e}}class xt extends Tt{constructor({value:t=[],...e}={}){super(e),this.value=t}}class Rt extends Tt{constructor({value:t=new Tt,local:e=!1,...i}={}){super(i),this.value=t,this.local=e}}function Ot(t,e,i){if(i instanceof xt){for(let r=0;r<i.value.length;r++)if(Ot(t,e,i.value[r]).verified)return{verified:!0,result:t};{const t={verified:!1,result:{error:"Wrong values for Choice type"}};return i.hasOwnProperty("name")&&(t.name=i.name),t}}if(i instanceof Tt)return i.hasOwnProperty("name")&&(t[i.name]=e),{verified:!0,result:t};if(t instanceof Object==0)return{verified:!1,result:{error:"Wrong root object"}};if(e instanceof Object==0)return{verified:!1,result:{error:"Wrong ASN.1 data"}};if(i instanceof Object==0)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if("idBlock"in i==0)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if("fromBER"in i.idBlock==0)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if("toBER"in i.idBlock==0)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};const r=i.idBlock.toBER(!1);if(0===r.byteLength)return{verified:!1,result:{error:"Error encoding idBlock for ASN.1 schema"}};if(-1===i.idBlock.fromBER(r,0,r.byteLength))return{verified:!1,result:{error:"Error decoding idBlock for ASN.1 schema"}};if(!1===i.idBlock.hasOwnProperty("tagClass"))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(i.idBlock.tagClass!==e.idBlock.tagClass)return{verified:!1,result:t};if(!1===i.idBlock.hasOwnProperty("tagNumber"))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(i.idBlock.tagNumber!==e.idBlock.tagNumber)return{verified:!1,result:t};if(!1===i.idBlock.hasOwnProperty("isConstructed"))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(i.idBlock.isConstructed!==e.idBlock.isConstructed)return{verified:!1,result:t};if(!("isHexOnly"in i.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(i.idBlock.isHexOnly!==e.idBlock.isHexOnly)return{verified:!1,result:t};if(i.idBlock.isHexOnly){if("valueHexView"in i.idBlock==0)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};const r=i.idBlock.valueHexView,s=e.idBlock.valueHexView;if(r.length!==s.length)return{verified:!1,result:t};for(let e=0;e<r.length;e++)if(r[e]!==s[1])return{verified:!1,result:t}}if(i.name&&(i.name=i.name.replace(/^\s+|\s+$/g,""),i.name&&(t[i.name]=e)),i instanceof D.Constructed){let r=0,s={verified:!1,result:{error:"Unknown error"}},n=i.valueBlock.value.length;if(n>0&&i.valueBlock.value[0]instanceof Rt&&(n=e.valueBlock.value.length),0===n)return{verified:!0,result:t};if(0===e.valueBlock.value.length&&0!==i.valueBlock.value.length){let e=!0;for(let t=0;t<i.valueBlock.value.length;t++)e=e&&(i.valueBlock.value[t].optional||!1);return e?{verified:!0,result:t}:(i.name&&(i.name=i.name.replace(/^\s+|\s+$/g,""),i.name&&delete t[i.name]),t.error="Inconsistent object length",{verified:!1,result:t})}for(let o=0;o<n;o++)if(o-r>=e.valueBlock.value.length){if(!1===i.valueBlock.value[o].optional){const e={verified:!1,result:t};return t.error="Inconsistent length between ASN.1 data and schema",i.name&&(i.name=i.name.replace(/^\s+|\s+$/g,""),i.name&&(delete t[i.name],e.name=i.name)),e}}else if(i.valueBlock.value[0]instanceof Rt){if(s=Ot(t,e.valueBlock.value[o],i.valueBlock.value[0].value),!1===s.verified){if(!i.valueBlock.value[0].optional)return i.name&&(i.name=i.name.replace(/^\s+|\s+$/g,""),i.name&&delete t[i.name]),s;r++}if("name"in i.valueBlock.value[0]&&i.valueBlock.value[0].name.length>0){let r={};r="local"in i.valueBlock.value[0]&&i.valueBlock.value[0].local?e:t,void 0===r[i.valueBlock.value[0].name]&&(r[i.valueBlock.value[0].name]=[]),r[i.valueBlock.value[0].name].push(e.valueBlock.value[o])}}else if(s=Ot(t,e.valueBlock.value[o-r],i.valueBlock.value[o]),!1===s.verified){if(!i.valueBlock.value[o].optional)return i.name&&(i.name=i.name.replace(/^\s+|\s+$/g,""),i.name&&delete t[i.name]),s;r++}if(!1===s.verified){const e={verified:!1,result:t};return i.name&&(i.name=i.name.replace(/^\s+|\s+$/g,""),i.name&&(delete t[i.name],e.name=i.name)),e}return{verified:!0,result:t}}if(i.primitiveSchema&&"valueHexView"in e.valueBlock){const r=R(e.valueBlock.valueHexView);if(-1===r.offset){const e={verified:!1,result:r.result};return i.name&&(i.name=i.name.replace(/^\s+|\s+$/g,""),i.name&&(delete t[i.name],e.name=i.name)),e}return Ot(t,r.result,i.primitiveSchema)}return{verified:!0,result:t}}const Nt=Object.freeze({__proto__:null,Any:Tt,BaseBlock:b,BaseStringBlock:B,BitString:L,BmpString:ut,Boolean:_,CharacterString:vt,Choice:xt,Constructed:k,DATE:Pt,DateTime:bt,Duration:Bt,EndOfContent:K,Enumerated:q,GeneralString:gt,GeneralizedTime:wt,GraphicString:At,HexBlock:g,IA5String:Ct,Integer:z,Null:H,NumericString:dt,ObjectIdentifier:X,OctetString:F,Primitive:x,PrintableString:ft,RawData:class{constructor({data:t=m}={}){this.dataView=n.toUint8Array(t)}get data(){return this.dataView.slice().buffer}set data(t){this.dataView=n.toUint8Array(t)}fromBER(t,e,i){const r=e+i;return this.dataView=n.toUint8Array(t).subarray(e,r),r}toBER(t){return this.dataView.slice().buffer}},RelativeObjectIdentifier:et,Repeated:Rt,Sequence:it,Set:rt,TIME:It,TeletexString:yt,TimeOfDay:Dt,UTCTime:Et,UniversalString:pt,Utf8String:ct,ValueBlock:E,VideotexString:St,ViewWriter:S,VisibleString:mt,compareSchema:Ot,fromBER:O,verifySchema:function(t,e){if(e instanceof Object==0)return{verified:!1,result:{error:"Wrong ASN.1 schema type"}};const i=R(n.toUint8Array(t));return-1===i.offset?{verified:!1,result:i.result}:Ot(i.result,i.result,e)}});var kt,Mt;!function(t){t[t.Sequence=0]="Sequence",t[t.Set=1]="Set",t[t.Choice=2]="Choice"}(kt||(kt={})),function(t){t[t.Any=1]="Any",t[t.Boolean=2]="Boolean",t[t.OctetString=3]="OctetString",t[t.BitString=4]="BitString",t[t.Integer=5]="Integer",t[t.Enumerated=6]="Enumerated",t[t.ObjectIdentifier=7]="ObjectIdentifier",t[t.Utf8String=8]="Utf8String",t[t.BmpString=9]="BmpString",t[t.UniversalString=10]="UniversalString",t[t.NumericString=11]="NumericString",t[t.PrintableString=12]="PrintableString",t[t.TeletexString=13]="TeletexString",t[t.VideotexString=14]="VideotexString",t[t.IA5String=15]="IA5String",t[t.GraphicString=16]="GraphicString",t[t.VisibleString=17]="VisibleString",t[t.GeneralString=18]="GeneralString",t[t.CharacterString=19]="CharacterString",t[t.UTCTime=20]="UTCTime",t[t.GeneralizedTime=21]="GeneralizedTime",t[t.DATE=22]="DATE",t[t.TimeOfDay=23]="TimeOfDay",t[t.DateTime=24]="DateTime",t[t.Duration=25]="Duration",t[t.TIME=26]="TIME",t[t.Null=27]="Null"}(Mt||(Mt={}));const Kt={fromASN:t=>t instanceof H?null:t.valueBeforeDecode,toASN:t=>{if(null===t)return new H;const e=O(t);if(e.result.error)throw new Error(e.result.error);return e.result}},Ht={fromASN:t=>t.valueBlock.valueHex.byteLength>4?t.valueBlock.toString():t.valueBlock.valueDec,toASN:t=>new z({value:t})},Ut={fromASN:t=>t.valueBlock.valueDec,toASN:t=>new q({value:t})},_t={fromASN:t=>t.valueBlock.valueHex,toASN:t=>new z({valueHex:t})},jt={fromASN:t=>t.valueBlock.valueHex,toASN:t=>new L({valueHex:t})},Ft={fromASN:t=>t.valueBlock.toString(),toASN:t=>new X({value:t})},Vt={fromASN:t=>t.valueBlock.value,toASN:t=>new _({value:t})},Lt={fromASN:t=>t.valueBlock.valueHex,toASN:t=>new F({valueHex:t})};function Gt(t){return{fromASN:t=>t.valueBlock.value,toASN:e=>new t({value:e})}}const $t=Gt(ct),Qt=Gt(ut),Wt=Gt(pt),zt=Gt(dt),qt=Gt(ft),Jt=Gt(yt),Zt=Gt(St),Xt=Gt(Ct),Yt=Gt(At),te=Gt(mt),ee=Gt(gt),ie=Gt(vt),re={fromASN:t=>t.toDate(),toASN:t=>new Et({valueDate:t})},se={fromASN:t=>t.toDate(),toASN:t=>new wt({valueDate:t})},ne={fromASN:()=>null,toASN:()=>new H};function oe(t){switch(t){case Mt.Any:return Kt;case Mt.BitString:return jt;case Mt.BmpString:return Qt;case Mt.Boolean:return Vt;case Mt.CharacterString:return ie;case Mt.Enumerated:return Ut;case Mt.GeneralString:return ee;case Mt.GeneralizedTime:return se;case Mt.GraphicString:return Yt;case Mt.IA5String:return Xt;case Mt.Integer:return Ht;case Mt.Null:return ne;case Mt.NumericString:return zt;case Mt.ObjectIdentifier:return Ft;case Mt.OctetString:return Lt;case Mt.PrintableString:return qt;case Mt.TeletexString:return Jt;case Mt.UTCTime:return re;case Mt.UniversalString:return Wt;case Mt.Utf8String:return $t;case Mt.VideotexString:return Zt;case Mt.VisibleString:return te;default:return null}}class ae{constructor(t,e=0){if(this.unusedBits=0,this.value=new ArrayBuffer(0),t)if("number"==typeof t)this.fromNumber(t);else{if(!n.isBufferSource(t))throw TypeError("Unsupported type of 'params' argument for BitString");this.unusedBits=e,this.value=n.toArrayBuffer(t)}}fromASN(t){if(!(t instanceof L))throw new TypeError("Argument 'asn' is not instance of ASN.1 BitString");return this.unusedBits=t.valueBlock.unusedBits,this.value=t.valueBlock.valueHex,this}toASN(){return new L({unusedBits:this.unusedBits,valueHex:this.value})}toSchema(t){return new L({name:t})}toNumber(){let t="";const e=new Uint8Array(this.value);for(const i of e)t+=i.toString(2).padStart(8,"0");return t=t.split("").reverse().join(""),this.unusedBits&&(t=t.slice(this.unusedBits).padStart(this.unusedBits,"0")),parseInt(t,2)}fromNumber(t){let e=t.toString(2);const i=e.length+7>>3;this.unusedBits=(i<<3)-e.length;const r=new Uint8Array(i);e=e.padStart(i<<3,"0").split("").reverse().join("");let s=0;for(;s<i;)r[s]=parseInt(e.slice(s<<3,8+(s<<3)),2),s++;this.value=r.buffer}}class ce{constructor(t){this.buffer="number"==typeof t?new ArrayBuffer(t):n.isBufferSource(t)?n.toArrayBuffer(t):Array.isArray(t)?new Uint8Array(t):new ArrayBuffer(0)}get byteLength(){return this.buffer.byteLength}get byteOffset(){return 0}fromASN(t){if(!(t instanceof F))throw new TypeError("Argument 'asn' is not instance of ASN.1 OctetString");return this.buffer=t.valueBlock.valueHex,this}toASN(){return new F({valueHex:this.buffer})}toSchema(t){return new F({name:t})}}function le(t){return t&&t.prototype?!(!t.prototype.toASN||!t.prototype.fromASN)||le(t.prototype):!!(t&&t.toASN&&t.fromASN)}function ue(t,e){if(!t||!e)return!1;if(t.byteLength!==e.byteLength)return!1;const i=new Uint8Array(t),r=new Uint8Array(e);for(let s=0;s<t.byteLength;s++)if(i[s]!==r[s])return!1;return!0}const he=new class{constructor(){this.items=new WeakMap}has(t){return this.items.has(t)}get(t){var e,i,r;const s=this.items.get(t);if(!s)throw new Error(`Cannot get schema for '${null!==(r=null===(i=null===(e=null==t?void 0:t.prototype)||void 0===e?void 0:e.constructor)||void 0===i?void 0:i.name)&&void 0!==r?r:t}' target`);return s}cache(t){const e=this.get(t);e.schema||(e.schema=this.create(t,!0))}createDefault(t){const e={type:kt.Sequence,items:{}},i=this.findParentSchema(t);return i&&(Object.assign(e,i),e.items=Object.assign({},e.items,i.items)),e}create(t,e){const i=this.items.get(t)||this.createDefault(t),r=[];for(const s in i.items){const t=i.items[s],n=e?s:"";let o;if("number"==typeof t.type){const e=Mt[t.type],i=Nt[e];if(!i)throw new Error(`Cannot get ASN1 class by name '${e}'`);o=new i({name:n})}else le(t.type)?o=(new t.type).toSchema(n):t.optional?this.get(t.type).type===kt.Choice?o=new Tt({name:n}):(o=this.create(t.type,!1),o.name=n):o=new Tt({name:n});const a=!!t.optional||void 0!==t.defaultValue;if(t.repeated&&(o.name="",o=new("set"===t.repeated?rt:it)({name:"",value:[new Rt({name:n,value:o})]})),null!=t.context)if(t.implicit)if("number"==typeof t.type||le(t.type))r.push(new(t.repeated?k:x)({name:n,optional:a,idBlock:{tagClass:3,tagNumber:t.context}}));else{this.cache(t.type);const e=!!t.repeated;let i=e?o:this.get(t.type).schema;i=i.valueBlock?i.valueBlock.value:i.value,r.push(new k({name:e?"":n,optional:a,idBlock:{tagClass:3,tagNumber:t.context},value:i}))}else r.push(new k({optional:a,idBlock:{tagClass:3,tagNumber:t.context},value:[o]}));else o.optional=a,r.push(o)}switch(i.type){case kt.Sequence:return new it({value:r,name:""});case kt.Set:return new rt({value:r,name:""});case kt.Choice:return new xt({value:r,name:""});default:throw new Error("Unsupported ASN1 type in use")}}set(t,e){return this.items.set(t,e),this}findParentSchema(t){const e=t.__proto__;return e?this.items.get(e)||this.findParentSchema(e):null}},pe=t=>e=>{let i;he.has(e)?i=he.get(e):(i=he.createDefault(e),he.set(e,i)),Object.assign(i,t)},de=t=>(e,i)=>{let r;he.has(e.constructor)?r=he.get(e.constructor):(r=he.createDefault(e.constructor),he.set(e.constructor,r));const s=Object.assign({},t);if("number"==typeof s.type&&!s.converter){const r=oe(t.type);if(!r)throw new Error(`Cannot get default converter for property '${i}' of ${e.constructor.name}`);s.converter=r}r.items[i]=s};class fe extends Error{constructor(){super(...arguments),this.schemas=[]}}class ye{static parse(t,e){const i=O(t);if(i.result.error)throw new Error(i.result.error);return this.fromASN(i.result,e)}static fromASN(t,e){var i;try{if(le(e))return(new e).fromASN(t);const r=he.get(e);he.cache(e);let s=r.schema;if(t.constructor===k&&r.type!==kt.Choice){s=new k({idBlock:{tagClass:3,tagNumber:t.idBlock.tagNumber},value:r.schema.valueBlock.value});for(const e in r.items)delete t[e]}const n=Ot({},t,s);if(!n.verified)throw new fe(`Data does not match to ${e.name} ASN1 schema. ${n.result.error}`);const o=new e;if(function t(e){var i;if(e){const r=Object.getPrototypeOf(e);return(null===(i=null==r?void 0:r.prototype)||void 0===i?void 0:i.constructor)===Array||t(r)}return!1}(e)){if("number"==typeof r.itemType){const i=oe(r.itemType);if(!i)throw new Error(`Cannot get default converter for array item of ${e.name} ASN1 schema`);return e.from(t.valueBlock.value,t=>i.fromASN(t))}return e.from(t.valueBlock.value,t=>this.fromASN(t,r.itemType))}for(const t in r.items){const e=n.result[t];if(!e)continue;const s=r.items[t];if("number"==typeof s.type||le(s.type)){const r=null!==(i=s.converter)&&void 0!==i?i:le(s.type)?new s.type:null;if(!r)throw new Error("Converter is empty");if(s.repeated)if(s.implicit){const i=new("sequence"===s.repeated?it:rt);i.valueBlock=e.valueBlock;const n=O(i.toBER(!1)).result.valueBlock.value;o[t]=Array.from(n,t=>r.fromASN(t))}else o[t]=Array.from(e,t=>r.fromASN(t));else{let i=e;if(s.implicit){let t;if(le(s.type))t=(new s.type).toSchema("");else{const e=Mt[s.type],i=Nt[e];if(!i)throw new Error(`Cannot get '${e}' class from asn1js module`);t=new i}t.valueBlock=i.valueBlock,i=O(t.toBER(!1)).result}o[t]=r.fromASN(i)}}else o[t]=s.repeated?Array.from(e,t=>this.fromASN(t,s.type)):this.fromASN(e,s.type)}return o}catch(r){throw r instanceof fe&&r.schemas.push(e.name),r}}}class Se{static serialize(t){return t instanceof b?t.toBER(!1):this.toASN(t).toBER(!1)}static toASN(t){if(t&&le(t.constructor))return t.toASN();const e=t.constructor,i=he.get(e);he.cache(e);let r,s=[];if(i.itemType)if("number"==typeof i.itemType){const r=oe(i.itemType);if(!r)throw new Error(`Cannot get default converter for array item of ${e.name} ASN1 schema`);s=t.map(t=>r.toASN(t))}else s=t.map(t=>this.toAsnItem({type:i.itemType},"[]",e,t));else for(const n in i.items){const r=i.items[n],o=t[n];if(void 0===o||r.defaultValue===o||"object"==typeof r.defaultValue&&"object"==typeof o&&ue(this.serialize(r.defaultValue),this.serialize(o)))continue;let a=Se.toAsnItem(r,n,e,o);if("number"==typeof r.context)if(r.implicit)if(r.repeated||"number"!=typeof r.type&&!le(r.type))s.push(new k({optional:r.optional,idBlock:{tagClass:3,tagNumber:r.context},value:a.valueBlock.value}));else{const t={};t.valueHex=a instanceof H?a.valueBeforeDecode:a.valueBlock.toBER(),s.push(new x({optional:r.optional,idBlock:{tagClass:3,tagNumber:r.context},...t}))}else s.push(new k({optional:r.optional,idBlock:{tagClass:3,tagNumber:r.context},value:[a]}));else r.repeated?s=s.concat(a):s.push(a)}switch(i.type){case kt.Sequence:r=new it({value:s});break;case kt.Set:r=new rt({value:s});break;case kt.Choice:if(!s[0])throw new Error(`Schema '${e.name}' has wrong data. Choice cannot be empty.`);r=s[0]}return r}static toAsnItem(t,e,i,r){let s;if("number"==typeof t.type){const n=t.converter;if(!n)throw new Error(`Property '${e}' doesn't have converter for type ${Mt[t.type]} in schema '${i.name}'`);if(t.repeated){const e=Array.from(r,t=>n.toASN(t));s=new("sequence"===t.repeated?it:rt)({value:e})}else s=n.toASN(r)}else if(t.repeated){const e=Array.from(r,t=>this.toASN(t));s=new("sequence"===t.repeated?it:rt)({value:e})}else s=this.toASN(r);return s}}class Ce extends Array{constructor(t=[]){if("number"==typeof t)super(t);else{super();for(const e of t)this.push(e)}}}class Ae{static serialize(t){return Se.serialize(t)}static parse(t,e){return ye.parse(t,e)}static toString(t){const e=O(n.isBufferSource(t)?n.toArrayBuffer(t):Ae.serialize(t));if(-1===e.offset)throw new Error("Cannot decode ASN.1 data. "+e.result.error);return e.result.toString()}}function me(t,e,i,r){var s,n=arguments.length,o=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(n<3?s(o):n>3?s(e,i,o):s(e,i))||o);return n>3&&o&&Object.defineProperty(e,i,o),o}var ge,ve,Ee,we=t((function(t){!function(e){const i="(0?\\d+|0x[a-f0-9]+)",r={fourOctet:new RegExp(`^${i}\\.${i}\\.${i}\\.${i}$`,"i"),threeOctet:new RegExp(`^${i}\\.${i}\\.${i}$`,"i"),twoOctet:new RegExp(`^${i}\\.${i}$`,"i"),longValue:new RegExp(`^${i}$`,"i")},s=new RegExp("^0[0-7]+$","i"),n=new RegExp("^0x[a-f0-9]+$","i"),o="(?:[0-9a-f]+::?)+",a={zoneIndex:new RegExp("%[0-9a-z]{1,}","i"),native:new RegExp(`^(::)?(${o})?([0-9a-f]+)?(::)?(%[0-9a-z]{1,})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${i}\\.${i}\\.${i}\\.${i}(%[0-9a-z]{1,})?)$`,"i"),transitional:new RegExp(`^((?:${o})|(?:::)(?:${o})?)${i}\\.${i}\\.${i}\\.${i}(%[0-9a-z]{1,})?$`,"i")};function c(t,e){if(t.indexOf("::")!==t.lastIndexOf("::"))return null;let i,r,s=0,n=-1,o=(t.match(a.zoneIndex)||[])[0];for(o&&(o=o.substring(1),t=t.replace(/%.+$/,""));(n=t.indexOf(":",n+1))>=0;)s++;if("::"===t.substr(0,2)&&s--,"::"===t.substr(-2,2)&&s--,s>e)return null;for(r=e-s,i=":";r--;)i+="0:";return":"===(t=t.replace("::",i))[0]&&(t=t.slice(1)),":"===t[t.length-1]&&(t=t.slice(0,-1)),{parts:e=function(){const e=t.split(":"),i=[];for(let t=0;t<e.length;t++)i.push(parseInt(e[t],16));return i}(),zoneId:o}}function l(t,e,i,r){if(t.length!==e.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let s,n=0;for(;r>0;){if(s=i-r,s<0&&(s=0),t[n]>>s!=e[n]>>s)return!1;r-=i,n+=1}return!0}function u(t){if(n.test(t))return parseInt(t,16);if("0"===t[0]&&!isNaN(parseInt(t[1],10))){if(s.test(t))return parseInt(t,8);throw new Error(`ipaddr: cannot parse ${t} as octal`)}return parseInt(t,10)}function h(t,e){for(;t.length<e;)t="0"+t;return t}const p={};p.IPv4=function(){function t(t){if(4!==t.length)throw new Error("ipaddr: ipv4 octet count should be 4");let e,i;for(e=0;e<t.length;e++)if(i=t[e],!(0<=i&&i<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=t}return t.prototype.SpecialRanges={unspecified:[[new t([0,0,0,0]),8]],broadcast:[[new t([255,255,255,255]),32]],multicast:[[new t([224,0,0,0]),4]],linkLocal:[[new t([169,254,0,0]),16]],loopback:[[new t([127,0,0,0]),8]],carrierGradeNat:[[new t([100,64,0,0]),10]],private:[[new t([10,0,0,0]),8],[new t([172,16,0,0]),12],[new t([192,168,0,0]),16]],reserved:[[new t([192,0,0,0]),24],[new t([192,0,2,0]),24],[new t([192,88,99,0]),24],[new t([198,51,100,0]),24],[new t([203,0,113,0]),24],[new t([240,0,0,0]),4]]},t.prototype.kind=function(){return"ipv4"},t.prototype.match=function(t,e){let i;if(void 0===e&&(i=t,t=i[0],e=i[1]),"ipv4"!==t.kind())throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return l(this.octets,t.octets,8,e)},t.prototype.prefixLengthFromSubnetMask=function(){let t=0,e=!1;const i={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0};let r,s,n;for(r=3;r>=0;r-=1){if(s=this.octets[r],!(s in i))return null;if(n=i[s],e&&0!==n)return null;8!==n&&(e=!0),t+=n}return 32-t},t.prototype.range=function(){return p.subnetMatch(this,this.SpecialRanges)},t.prototype.toByteArray=function(){return this.octets.slice(0)},t.prototype.toIPv4MappedAddress=function(){return p.IPv6.parse("::ffff:"+this.toString())},t.prototype.toNormalizedString=function(){return this.toString()},t.prototype.toString=function(){return this.octets.join(".")},t}(),p.IPv4.broadcastAddressFromCIDR=function(t){try{const e=this.parseCIDR(t),i=e[0].toByteArray(),r=this.subnetMaskFromPrefixLength(e[1]).toByteArray(),s=[];let n=0;for(;n<4;)s.push(parseInt(i[n],10)|255^parseInt(r[n],10)),n++;return new this(s)}catch(e){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},p.IPv4.isIPv4=function(t){return null!==this.parser(t)},p.IPv4.isValid=function(t){try{return new this(this.parser(t)),!0}catch(e){return!1}},p.IPv4.isValidFourPartDecimal=function(t){return!(!p.IPv4.isValid(t)||!t.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},p.IPv4.networkAddressFromCIDR=function(t){let e,i,r,s,n;try{for(e=this.parseCIDR(t),r=e[0].toByteArray(),n=this.subnetMaskFromPrefixLength(e[1]).toByteArray(),s=[],i=0;i<4;)s.push(parseInt(r[i],10)&parseInt(n[i],10)),i++;return new this(s)}catch(o){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},p.IPv4.parse=function(t){const e=this.parser(t);if(null===e)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(e)},p.IPv4.parseCIDR=function(t){let e;if(e=t.match(/^(.+)\/(\d+)$/)){const t=parseInt(e[2]);if(t>=0&&t<=32){const i=[this.parse(e[1]),t];return Object.defineProperty(i,"toString",{value:function(){return this.join("/")}}),i}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},p.IPv4.parser=function(t){let e,i,s;if(e=t.match(r.fourOctet))return function(){const t=e.slice(1,6),r=[];for(let e=0;e<t.length;e++)i=t[e],r.push(u(i));return r}();if(e=t.match(r.longValue)){if(s=u(e[1]),s>4294967295||s<0)throw new Error("ipaddr: address outside defined range");return function(){const t=[];let e;for(e=0;e<=24;e+=8)t.push(s>>e&255);return t}().reverse()}return(e=t.match(r.twoOctet))?function(){const t=e.slice(1,4),i=[];if(s=u(t[1]),s>16777215||s<0)throw new Error("ipaddr: address outside defined range");return i.push(u(t[0])),i.push(s>>16&255),i.push(s>>8&255),i.push(255&s),i}():(e=t.match(r.threeOctet))?function(){const t=e.slice(1,5),i=[];if(s=u(t[2]),s>65535||s<0)throw new Error("ipaddr: address outside defined range");return i.push(u(t[0])),i.push(u(t[1])),i.push(s>>8&255),i.push(255&s),i}():null},p.IPv4.subnetMaskFromPrefixLength=function(t){if((t=parseInt(t))<0||t>32)throw new Error("ipaddr: invalid IPv4 prefix length");const e=[0,0,0,0];let i=0;const r=Math.floor(t/8);for(;i<r;)e[i]=255,i++;return r<4&&(e[r]=Math.pow(2,t%8)-1<<8-t%8),new this(e)},p.IPv6=function(){function t(t,e){let i,r;if(16===t.length)for(this.parts=[],i=0;i<=14;i+=2)this.parts.push(t[i]<<8|t[i+1]);else{if(8!==t.length)throw new Error("ipaddr: ipv6 part count should be 8 or 16");this.parts=t}for(i=0;i<this.parts.length;i++)if(r=this.parts[i],!(0<=r&&r<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");e&&(this.zoneId=e)}return t.prototype.SpecialRanges={unspecified:[new t([0,0,0,0,0,0,0,0]),128],linkLocal:[new t([65152,0,0,0,0,0,0,0]),10],multicast:[new t([65280,0,0,0,0,0,0,0]),8],loopback:[new t([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new t([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new t([0,0,0,0,0,65535,0,0]),96],rfc6145:[new t([0,0,0,0,65535,0,0,0]),96],rfc6052:[new t([100,65435,0,0,0,0,0,0]),96],"6to4":[new t([8194,0,0,0,0,0,0,0]),16],teredo:[new t([8193,0,0,0,0,0,0,0]),32],reserved:[[new t([8193,3512,0,0,0,0,0,0]),32]]},t.prototype.isIPv4MappedAddress=function(){return"ipv4Mapped"===this.range()},t.prototype.kind=function(){return"ipv6"},t.prototype.match=function(t,e){let i;if(void 0===e&&(i=t,t=i[0],e=i[1]),"ipv6"!==t.kind())throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return l(this.parts,t.parts,16,e)},t.prototype.prefixLengthFromSubnetMask=function(){let t=0,e=!1;const i={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};let r,s;for(let n=7;n>=0;n-=1){if(r=this.parts[n],!(r in i))return null;if(s=i[r],e&&0!==s)return null;16!==s&&(e=!0),t+=s}return 128-t},t.prototype.range=function(){return p.subnetMatch(this,this.SpecialRanges)},t.prototype.toByteArray=function(){let t;const e=[],i=this.parts;for(let r=0;r<i.length;r++)t=i[r],e.push(t>>8),e.push(255&t);return e},t.prototype.toFixedLengthString=function(){const t=function(){const t=[];for(let e=0;e<this.parts.length;e++)t.push(h(this.parts[e].toString(16),4));return t}.call(this).join(":");let e="";return this.zoneId&&(e="%"+this.zoneId),t+e},t.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");const t=this.parts.slice(-2),e=t[0],i=t[1];return new p.IPv4([e>>8,255&e,i>>8,255&i])},t.prototype.toNormalizedString=function(){const t=function(){const t=[];for(let e=0;e<this.parts.length;e++)t.push(this.parts[e].toString(16));return t}.call(this).join(":");let e="";return this.zoneId&&(e="%"+this.zoneId),t+e},t.prototype.toRFC5952String=function(){const t=/((^|:)(0(:|$)){2,})/g,e=this.toNormalizedString();let i,r=0,s=-1;for(;i=t.exec(e);)i[0].length>s&&(r=i.index,s=i[0].length);return s<0?e:`${e.substring(0,r)}::${e.substring(r+s)}`},t.prototype.toString=function(){return this.toNormalizedString().replace(/((^|:)(0(:|$))+)/,"::")},t}(),p.IPv6.broadcastAddressFromCIDR=function(t){try{const e=this.parseCIDR(t),i=e[0].toByteArray(),r=this.subnetMaskFromPrefixLength(e[1]).toByteArray(),s=[];let n=0;for(;n<16;)s.push(parseInt(i[n],10)|255^parseInt(r[n],10)),n++;return new this(s)}catch(e){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${e})`)}},p.IPv6.isIPv6=function(t){return null!==this.parser(t)},p.IPv6.isValid=function(t){if("string"==typeof t&&-1===t.indexOf(":"))return!1;try{const e=this.parser(t);return new this(e.parts,e.zoneId),!0}catch(e){return!1}},p.IPv6.networkAddressFromCIDR=function(t){let e,i,r,s,n;try{for(e=this.parseCIDR(t),r=e[0].toByteArray(),n=this.subnetMaskFromPrefixLength(e[1]).toByteArray(),s=[],i=0;i<16;)s.push(parseInt(r[i],10)&parseInt(n[i],10)),i++;return new this(s)}catch(o){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${o})`)}},p.IPv6.parse=function(t){const e=this.parser(t);if(null===e.parts)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(e.parts,e.zoneId)},p.IPv6.parseCIDR=function(t){let e,i,r;if((i=t.match(/^(.+)\/(\d+)$/))&&(e=parseInt(i[2]),e>=0&&e<=128))return r=[this.parse(i[1]),e],Object.defineProperty(r,"toString",{value:function(){return this.join("/")}}),r;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},p.IPv6.parser=function(t){let e,i,r,s,n,o;if(r=t.match(a.deprecatedTransitional))return this.parser("::ffff:"+r[1]);if(a.native.test(t))return c(t,8);if((r=t.match(a.transitional))&&(o=r[6]||"",e=c(r[1].slice(0,-1)+o,6),e.parts)){for(n=[parseInt(r[2]),parseInt(r[3]),parseInt(r[4]),parseInt(r[5])],i=0;i<n.length;i++)if(s=n[i],!(0<=s&&s<=255))return null;return e.parts.push(n[0]<<8|n[1]),e.parts.push(n[2]<<8|n[3]),{parts:e.parts,zoneId:e.zoneId}}return null},p.IPv6.subnetMaskFromPrefixLength=function(t){if((t=parseInt(t))<0||t>128)throw new Error("ipaddr: invalid IPv6 prefix length");const e=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];let i=0;const r=Math.floor(t/8);for(;i<r;)e[i]=255,i++;return r<16&&(e[r]=Math.pow(2,t%8)-1<<8-t%8),new this(e)},p.fromByteArray=function(t){const e=t.length;if(4===e)return new p.IPv4(t);if(16===e)return new p.IPv6(t);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},p.isValid=function(t){return p.IPv6.isValid(t)||p.IPv4.isValid(t)},p.parse=function(t){if(p.IPv6.isValid(t))return p.IPv6.parse(t);if(p.IPv4.isValid(t))return p.IPv4.parse(t);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},p.parseCIDR=function(t){try{return p.IPv6.parseCIDR(t)}catch(e){try{return p.IPv4.parseCIDR(t)}catch(i){throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},p.process=function(t){const e=this.parse(t);return"ipv6"===e.kind()&&e.isIPv4MappedAddress()?e.toIPv4Address():e},p.subnetMatch=function(t,e,i){let r,s,n,o;for(s in null==i&&(i="unicast"),e)if(Object.prototype.hasOwnProperty.call(e,s))for(n=e[s],!n[0]||n[0]instanceof Array||(n=[n]),r=0;r<n.length;r++)if(o=n[r],t.kind()===o[0].kind()&&t.match.apply(t,o))return s;return i},t.exports?t.exports=p:e.ipaddr=p}(i)}));class Pe{static decodeIP(t){if(64===t.length&&0===parseInt(t,16))return"::/0";if(16!==t.length)return t;const e=parseInt(t.slice(8),16).toString(2).split("").reduce((t,e)=>t+ +e,0);let i=t.slice(0,8).replace(/(.{2})/g,t=>parseInt(t,16)+".");return i=i.slice(0,-1),`${i}/${e}`}static toString(t){if(4===t.byteLength||16===t.byteLength){const e=new Uint8Array(t);return we.fromByteArray(Array.from(e)).toString()}return this.decodeIP(o.ToHex(t))}static fromString(t){const e=we.parse(t);return new Uint8Array(e.toByteArray()).buffer}}let De=class{constructor(t={}){Object.assign(this,t)}toString(){return this.bmpString||this.printableString||this.teletexString||this.universalString||this.utf8String||""}};me([de({type:Mt.TeletexString})],De.prototype,"teletexString",void 0),me([de({type:Mt.PrintableString})],De.prototype,"printableString",void 0),me([de({type:Mt.UniversalString})],De.prototype,"universalString",void 0),me([de({type:Mt.Utf8String})],De.prototype,"utf8String",void 0),me([de({type:Mt.BmpString})],De.prototype,"bmpString",void 0),De=me([pe({type:kt.Choice})],De);let be=class extends De{constructor(t={}){super(t),Object.assign(this,t)}toString(){return this.ia5String||(this.anyValue?o.ToHex(this.anyValue):super.toString())}};me([de({type:Mt.IA5String})],be.prototype,"ia5String",void 0),me([de({type:Mt.Any})],be.prototype,"anyValue",void 0),be=me([pe({type:kt.Choice})],be);class Be{constructor(t={}){this.type="",this.value=new be,Object.assign(this,t)}}me([de({type:Mt.ObjectIdentifier})],Be.prototype,"type",void 0),me([de({type:be})],Be.prototype,"value",void 0);let Ie=ge=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,ge.prototype)}};Ie=ge=me([pe({type:kt.Set,itemType:Be})],Ie);let Te=ve=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,ve.prototype)}};Te=ve=me([pe({type:kt.Sequence,itemType:Ie})],Te);let xe=Ee=class extends Te{constructor(t){super(t),Object.setPrototypeOf(this,Ee.prototype)}};xe=Ee=me([pe({type:kt.Sequence})],xe);const Re={fromASN:t=>Pe.toString(Lt.fromASN(t)),toASN:t=>Lt.toASN(Pe.fromString(t))};class Oe{constructor(t={}){this.typeId="",this.value=new ArrayBuffer(0),Object.assign(this,t)}}me([de({type:Mt.ObjectIdentifier})],Oe.prototype,"typeId",void 0),me([de({type:Mt.Any,context:0})],Oe.prototype,"value",void 0);class Ne{constructor(t={}){this.partyName=new ArrayBuffer(0),Object.assign(this,t)}}me([de({type:De,optional:!0,context:0,implicit:!0})],Ne.prototype,"nameAssigner",void 0),me([de({type:De,context:1,implicit:!0})],Ne.prototype,"partyName",void 0);let ke=class{constructor(t={}){Object.assign(this,t)}};var Me;me([de({type:Oe,context:0,implicit:!0})],ke.prototype,"otherName",void 0),me([de({type:Mt.IA5String,context:1,implicit:!0})],ke.prototype,"rfc822Name",void 0),me([de({type:Mt.IA5String,context:2,implicit:!0})],ke.prototype,"dNSName",void 0),me([de({type:Mt.Any,context:3,implicit:!0})],ke.prototype,"x400Address",void 0),me([de({type:xe,context:4,implicit:!1})],ke.prototype,"directoryName",void 0),me([de({type:Ne,context:5})],ke.prototype,"ediPartyName",void 0),me([de({type:Mt.IA5String,context:6,implicit:!0})],ke.prototype,"uniformResourceIdentifier",void 0),me([de({type:Mt.OctetString,context:7,implicit:!0,converter:Re})],ke.prototype,"iPAddress",void 0),me([de({type:Mt.ObjectIdentifier,context:8,implicit:!0})],ke.prototype,"registeredID",void 0),ke=me([pe({type:kt.Choice})],ke);class Ke{constructor(t={}){this.accessMethod="",this.accessLocation=new ke,Object.assign(this,t)}}me([de({type:Mt.ObjectIdentifier})],Ke.prototype,"accessMethod",void 0),me([de({type:ke})],Ke.prototype,"accessLocation",void 0);let He=Me=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,Me.prototype)}};He=Me=me([pe({type:kt.Sequence,itemType:Ke})],He);class Ue extends ce{}class _e{constructor(t={}){t&&Object.assign(this,t)}}me([de({type:Ue,context:0,optional:!0,implicit:!0})],_e.prototype,"keyIdentifier",void 0),me([de({type:ke,context:1,optional:!0,implicit:!0,repeated:"sequence"})],_e.prototype,"authorityCertIssuer",void 0),me([de({type:Mt.Integer,context:2,optional:!0,implicit:!0,converter:_t})],_e.prototype,"authorityCertSerialNumber",void 0);class je{constructor(t={}){this.cA=!1,Object.assign(this,t)}}var Fe;me([de({type:Mt.Boolean,defaultValue:!1})],je.prototype,"cA",void 0),me([de({type:Mt.Integer,optional:!0})],je.prototype,"pathLenConstraint",void 0);let Ve=Fe=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,Fe.prototype)}};var Le;Ve=Fe=me([pe({type:kt.Sequence,itemType:ke})],Ve);let Ge=Le=class extends Ve{constructor(t){super(t),Object.setPrototypeOf(this,Le.prototype)}};var $e;Ge=Le=me([pe({type:kt.Sequence})],Ge);let Qe=class{constructor(t={}){Object.assign(this,t)}toString(){return this.ia5String||this.visibleString||this.bmpString||this.utf8String}};me([de({type:Mt.IA5String})],Qe.prototype,"ia5String",void 0),me([de({type:Mt.VisibleString})],Qe.prototype,"visibleString",void 0),me([de({type:Mt.BmpString})],Qe.prototype,"bmpString",void 0),me([de({type:Mt.Utf8String})],Qe.prototype,"utf8String",void 0),Qe=me([pe({type:kt.Choice})],Qe);class We{constructor(t={}){this.organization=new Qe,this.noticeNumbers=[],Object.assign(this,t)}}me([de({type:Qe})],We.prototype,"organization",void 0),me([de({type:Mt.Integer,repeated:"sequence"})],We.prototype,"noticeNumbers",void 0);class ze{constructor(t={}){Object.assign(this,t)}}me([de({type:We,optional:!0})],ze.prototype,"noticeRef",void 0),me([de({type:Qe,optional:!0})],ze.prototype,"explicitText",void 0);let qe=class{constructor(t={}){Object.assign(this,t)}};me([de({type:Mt.IA5String})],qe.prototype,"cPSuri",void 0),me([de({type:ze})],qe.prototype,"userNotice",void 0),qe=me([pe({type:kt.Choice})],qe);class Je{constructor(t={}){this.policyQualifierId="",this.qualifier=new ArrayBuffer(0),Object.assign(this,t)}}me([de({type:Mt.ObjectIdentifier})],Je.prototype,"policyQualifierId",void 0),me([de({type:Mt.Any})],Je.prototype,"qualifier",void 0);class Ze{constructor(t={}){this.policyIdentifier="",Object.assign(this,t)}}me([de({type:Mt.ObjectIdentifier})],Ze.prototype,"policyIdentifier",void 0),me([de({type:Je,repeated:"sequence",optional:!0})],Ze.prototype,"policyQualifiers",void 0);let Xe=$e=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,$e.prototype)}};Xe=$e=me([pe({type:kt.Sequence,itemType:Ze})],Xe);let Ye=class{constructor(t=0){this.value=t}};me([de({type:Mt.Integer})],Ye.prototype,"value",void 0),Ye=me([pe({type:kt.Choice})],Ye);let ti=class extends Ye{};var ei,ii;ti=me([pe({type:kt.Choice})],ti),function(t){t[t.unused=1]="unused",t[t.keyCompromise=2]="keyCompromise",t[t.cACompromise=4]="cACompromise",t[t.affiliationChanged=8]="affiliationChanged",t[t.superseded=16]="superseded",t[t.cessationOfOperation=32]="cessationOfOperation",t[t.certificateHold=64]="certificateHold",t[t.privilegeWithdrawn=128]="privilegeWithdrawn",t[t.aACompromise=256]="aACompromise"}(ii||(ii={}));class ri extends ae{toJSON(){const t=[],e=this.toNumber();return e&ii.aACompromise&&t.push("aACompromise"),e&ii.affiliationChanged&&t.push("affiliationChanged"),e&ii.cACompromise&&t.push("cACompromise"),e&ii.certificateHold&&t.push("certificateHold"),e&ii.cessationOfOperation&&t.push("cessationOfOperation"),e&ii.keyCompromise&&t.push("keyCompromise"),e&ii.privilegeWithdrawn&&t.push("privilegeWithdrawn"),e&ii.superseded&&t.push("superseded"),e&ii.unused&&t.push("unused"),t}toString(){return`[${this.toJSON().join(", ")}]`}}let si=class{constructor(t={}){Object.assign(this,t)}};me([de({type:ke,context:0,repeated:"sequence",implicit:!0})],si.prototype,"fullName",void 0),me([de({type:Ie,context:1,implicit:!0})],si.prototype,"nameRelativeToCRLIssuer",void 0),si=me([pe({type:kt.Choice})],si);class ni{constructor(t={}){Object.assign(this,t)}}me([de({type:si,context:0,optional:!0})],ni.prototype,"distributionPoint",void 0),me([de({type:ri,context:1,optional:!0,implicit:!0})],ni.prototype,"reasons",void 0),me([de({type:ke,context:2,optional:!0,repeated:"sequence",implicit:!0})],ni.prototype,"cRLIssuer",void 0);let oi=ei=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,ei.prototype)}};var ai;oi=ei=me([pe({type:kt.Sequence,itemType:ni})],oi);let ci=ai=class extends oi{constructor(t){super(t),Object.setPrototypeOf(this,ai.prototype)}};ci=ai=me([pe({type:kt.Sequence,itemType:ni})],ci);class li{constructor(t={}){this.onlyContainsUserCerts=li.ONLY,this.onlyContainsCACerts=li.ONLY,this.indirectCRL=li.ONLY,this.onlyContainsAttributeCerts=li.ONLY,Object.assign(this,t)}}var ui;li.ONLY=!1,me([de({type:si,context:0,optional:!0})],li.prototype,"distributionPoint",void 0),me([de({type:Mt.Boolean,context:1,defaultValue:li.ONLY})],li.prototype,"onlyContainsUserCerts",void 0),me([de({type:Mt.Boolean,context:2,defaultValue:li.ONLY})],li.prototype,"onlyContainsCACerts",void 0),me([de({type:ri,context:3,optional:!0})],li.prototype,"onlySomeReasons",void 0),me([de({type:Mt.Boolean,context:4,defaultValue:li.ONLY})],li.prototype,"indirectCRL",void 0),me([de({type:Mt.Boolean,context:5,defaultValue:li.ONLY})],li.prototype,"onlyContainsAttributeCerts",void 0),function(t){t[t.unspecified=0]="unspecified",t[t.keyCompromise=1]="keyCompromise",t[t.cACompromise=2]="cACompromise",t[t.affiliationChanged=3]="affiliationChanged",t[t.superseded=4]="superseded",t[t.cessationOfOperation=5]="cessationOfOperation",t[t.certificateHold=6]="certificateHold",t[t.removeFromCRL=8]="removeFromCRL",t[t.privilegeWithdrawn=9]="privilegeWithdrawn",t[t.aACompromise=10]="aACompromise"}(ui||(ui={}));let hi=class{constructor(t=ui.unspecified){this.reason=ui.unspecified,this.reason=t}toJSON(){return ui[this.reason]}toString(){return this.toJSON()}};var pi;me([de({type:Mt.Enumerated})],hi.prototype,"reason",void 0),hi=me([pe({type:kt.Choice})],hi);let di=pi=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,pi.prototype)}};di=pi=me([pe({type:kt.Sequence,itemType:Mt.ObjectIdentifier})],di);let fi=class{constructor(t=new ArrayBuffer(0)){this.value=t}};me([de({type:Mt.Integer,converter:_t})],fi.prototype,"value",void 0),fi=me([pe({type:kt.Choice})],fi);let yi=class{constructor(t){this.value=new Date,t&&(this.value=t)}};var Si;me([de({type:Mt.GeneralizedTime})],yi.prototype,"value",void 0),yi=me([pe({type:kt.Choice})],yi);let Ci=Si=class extends Ve{constructor(t){super(t),Object.setPrototypeOf(this,Si.prototype)}};var Ai,mi;Ci=Si=me([pe({type:kt.Sequence})],Ci),function(t){t[t.digitalSignature=1]="digitalSignature",t[t.nonRepudiation=2]="nonRepudiation",t[t.keyEncipherment=4]="keyEncipherment",t[t.dataEncipherment=8]="dataEncipherment",t[t.keyAgreement=16]="keyAgreement",t[t.keyCertSign=32]="keyCertSign",t[t.cRLSign=64]="cRLSign",t[t.encipherOnly=128]="encipherOnly",t[t.decipherOnly=256]="decipherOnly"}(Ai||(Ai={}));class gi extends ae{toJSON(){const t=this.toNumber(),e=[];return t&Ai.cRLSign&&e.push("crlSign"),t&Ai.dataEncipherment&&e.push("dataEncipherment"),t&Ai.decipherOnly&&e.push("decipherOnly"),t&Ai.digitalSignature&&e.push("digitalSignature"),t&Ai.encipherOnly&&e.push("encipherOnly"),t&Ai.keyAgreement&&e.push("keyAgreement"),t&Ai.keyCertSign&&e.push("keyCertSign"),t&Ai.keyEncipherment&&e.push("keyEncipherment"),t&Ai.nonRepudiation&&e.push("nonRepudiation"),e}toString(){return`[${this.toJSON().join(", ")}]`}}class vi{constructor(t={}){this.base=new ke,this.minimum=0,Object.assign(this,t)}}me([de({type:ke})],vi.prototype,"base",void 0),me([de({type:Mt.Integer,context:0,defaultValue:0,implicit:!0})],vi.prototype,"minimum",void 0),me([de({type:Mt.Integer,context:1,optional:!0,implicit:!0})],vi.prototype,"maximum",void 0);let Ei=mi=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,mi.prototype)}};Ei=mi=me([pe({type:kt.Sequence,itemType:vi})],Ei);class wi{constructor(t={}){Object.assign(this,t)}}me([de({type:Ei,context:0,optional:!0,implicit:!0})],wi.prototype,"permittedSubtrees",void 0),me([de({type:Ei,context:1,optional:!0,implicit:!0})],wi.prototype,"excludedSubtrees",void 0);class Pi{constructor(t={}){Object.assign(this,t)}}var Di;me([de({type:Mt.Integer,context:0,implicit:!0,optional:!0,converter:_t})],Pi.prototype,"requireExplicitPolicy",void 0),me([de({type:Mt.Integer,context:1,implicit:!0,optional:!0,converter:_t})],Pi.prototype,"inhibitPolicyMapping",void 0);class bi{constructor(t={}){this.issuerDomainPolicy="",this.subjectDomainPolicy="",Object.assign(this,t)}}me([de({type:Mt.ObjectIdentifier})],bi.prototype,"issuerDomainPolicy",void 0),me([de({type:Mt.ObjectIdentifier})],bi.prototype,"subjectDomainPolicy",void 0);let Bi=Di=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,Di.prototype)}};var Ii;Bi=Di=me([pe({type:kt.Sequence,itemType:bi})],Bi);let Ti=Ii=class extends Ve{constructor(t){super(t),Object.setPrototypeOf(this,Ii.prototype)}};Ti=Ii=me([pe({type:kt.Sequence})],Ti);class xi{constructor(t={}){this.type="",this.values=[],Object.assign(this,t)}}var Ri;me([de({type:Mt.ObjectIdentifier})],xi.prototype,"type",void 0),me([de({type:Mt.Any,repeated:"set"})],xi.prototype,"values",void 0);let Oi=Ri=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,Ri.prototype)}};Oi=Ri=me([pe({type:kt.Sequence,itemType:xi})],Oi);class Ni extends Ue{}class ki{constructor(t={}){Object.assign(this,t)}}var Mi,Ki;me([de({type:Mt.GeneralizedTime,context:0,implicit:!0,optional:!0})],ki.prototype,"notBefore",void 0),me([de({type:Mt.GeneralizedTime,context:1,implicit:!0,optional:!0})],ki.prototype,"notAfter",void 0),function(t){t[t.keyUpdateAllowed=1]="keyUpdateAllowed",t[t.newExtensions=2]="newExtensions",t[t.pKIXCertificate=4]="pKIXCertificate"}(Mi||(Mi={}));class Hi extends ae{toJSON(){const t=[],e=this.toNumber();return e&Mi.pKIXCertificate&&t.push("pKIXCertificate"),e&Mi.newExtensions&&t.push("newExtensions"),e&Mi.keyUpdateAllowed&&t.push("keyUpdateAllowed"),t}toString(){return`[${this.toJSON().join(", ")}]`}}class Ui{constructor(t={}){this.entrustVers="",this.entrustInfoFlags=new Hi,Object.assign(this,t)}}me([de({type:Mt.GeneralString})],Ui.prototype,"entrustVers",void 0),me([de({type:Hi})],Ui.prototype,"entrustInfoFlags",void 0);let _i=Ki=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,Ki.prototype)}};_i=Ki=me([pe({type:kt.Sequence,itemType:Ke})],_i);class ji{constructor(t={}){this.algorithm="",Object.assign(this,t)}isEqual(t){return t instanceof ji&&t.algorithm==this.algorithm&&(t.parameters&&this.parameters&&a(t.parameters,this.parameters)||t.parameters===this.parameters)}}me([de({type:Mt.ObjectIdentifier})],ji.prototype,"algorithm",void 0),me([de({type:Mt.Any,optional:!0})],ji.prototype,"parameters",void 0);class Fi{constructor(t={}){this.algorithm=new ji,this.subjectPublicKey=new ArrayBuffer(0),Object.assign(this,t)}}me([de({type:ji})],Fi.prototype,"algorithm",void 0),me([de({type:Mt.BitString})],Fi.prototype,"subjectPublicKey",void 0);let Vi=class{constructor(t){t&&("string"==typeof t||"number"==typeof t?this.utcTime=new Date(t):t instanceof Date?this.utcTime=t:Object.assign(this,t))}getTime(){const t=this.utcTime||this.generalTime;if(!t)throw new Error("Cannot get time from CHOICE object");return t}};me([de({type:Mt.UTCTime})],Vi.prototype,"utcTime",void 0),me([de({type:Mt.GeneralizedTime})],Vi.prototype,"generalTime",void 0),Vi=me([pe({type:kt.Choice})],Vi);class Li{constructor(t){this.notBefore=new Vi(new Date),this.notAfter=new Vi(new Date),t&&(this.notBefore=new Vi(t.notBefore),this.notAfter=new Vi(t.notAfter))}}var Gi;me([de({type:Vi})],Li.prototype,"notBefore",void 0),me([de({type:Vi})],Li.prototype,"notAfter",void 0);class $i{constructor(t={}){this.extnID="",this.critical=$i.CRITICAL,this.extnValue=new ce,Object.assign(this,t)}}$i.CRITICAL=!1,me([de({type:Mt.ObjectIdentifier})],$i.prototype,"extnID",void 0),me([de({type:Mt.Boolean,defaultValue:$i.CRITICAL})],$i.prototype,"critical",void 0),me([de({type:ce})],$i.prototype,"extnValue",void 0);let Qi=Gi=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,Gi.prototype)}};var Wi;Qi=Gi=me([pe({type:kt.Sequence,itemType:$i})],Qi),function(t){t[t.v1=0]="v1",t[t.v2=1]="v2",t[t.v3=2]="v3"}(Wi||(Wi={}));class zi{constructor(t={}){this.version=Wi.v1,this.serialNumber=new ArrayBuffer(0),this.signature=new ji,this.issuer=new xe,this.validity=new Li,this.subject=new xe,this.subjectPublicKeyInfo=new Fi,Object.assign(this,t)}}me([de({type:Mt.Integer,context:0,defaultValue:Wi.v1})],zi.prototype,"version",void 0),me([de({type:Mt.Integer,converter:_t})],zi.prototype,"serialNumber",void 0),me([de({type:ji})],zi.prototype,"signature",void 0),me([de({type:xe})],zi.prototype,"issuer",void 0),me([de({type:Li})],zi.prototype,"validity",void 0),me([de({type:xe})],zi.prototype,"subject",void 0),me([de({type:Fi})],zi.prototype,"subjectPublicKeyInfo",void 0),me([de({type:Mt.BitString,context:1,implicit:!0,optional:!0})],zi.prototype,"issuerUniqueID",void 0),me([de({type:Mt.BitString,context:2,implicit:!0,optional:!0})],zi.prototype,"subjectUniqueID",void 0),me([de({type:Qi,context:3,optional:!0})],zi.prototype,"extensions",void 0);class qi{constructor(t={}){this.tbsCertificate=new zi,this.signatureAlgorithm=new ji,this.signatureValue=new ArrayBuffer(0),Object.assign(this,t)}}me([de({type:zi})],qi.prototype,"tbsCertificate",void 0),me([de({type:ji})],qi.prototype,"signatureAlgorithm",void 0),me([de({type:Mt.BitString})],qi.prototype,"signatureValue",void 0);class Ji{constructor(t={}){this.userCertificate=new ArrayBuffer(0),this.revocationDate=new Vi,Object.assign(this,t)}}me([de({type:Mt.Integer,converter:_t})],Ji.prototype,"userCertificate",void 0),me([de({type:Vi})],Ji.prototype,"revocationDate",void 0),me([de({type:$i,optional:!0,repeated:"sequence"})],Ji.prototype,"crlEntryExtensions",void 0);class Zi{constructor(t={}){this.signature=new ji,this.issuer=new xe,this.thisUpdate=new Vi,Object.assign(this,t)}}me([de({type:Mt.Integer,optional:!0})],Zi.prototype,"version",void 0),me([de({type:ji})],Zi.prototype,"signature",void 0),me([de({type:xe})],Zi.prototype,"issuer",void 0),me([de({type:Vi})],Zi.prototype,"thisUpdate",void 0),me([de({type:Vi,optional:!0})],Zi.prototype,"nextUpdate",void 0),me([de({type:Ji,repeated:"sequence",optional:!0})],Zi.prototype,"revokedCertificates",void 0),me([de({type:$i,optional:!0,context:0,repeated:"sequence"})],Zi.prototype,"crlExtensions",void 0);class Xi{constructor(t={}){this.tbsCertList=new Zi,this.signatureAlgorithm=new ji,this.signature=new ArrayBuffer(0),Object.assign(this,t)}}me([de({type:Zi})],Xi.prototype,"tbsCertList",void 0),me([de({type:ji})],Xi.prototype,"signatureAlgorithm",void 0),me([de({type:Mt.BitString})],Xi.prototype,"signature",void 0);const Yi="1.2.840.10045.2.1";function tr(t){return new ji({algorithm:t})}tr("1.2.840.10045.4.1"),tr("1.2.840.10045.4.3.1"),tr("1.2.840.10045.4.3.2"),tr("1.2.840.10045.4.3.3"),tr("1.2.840.10045.4.3.4");let er=class{constructor(t={}){Object.assign(this,t)}};me([de({type:Mt.ObjectIdentifier})],er.prototype,"namedCurve",void 0),er=me([pe({type:kt.Choice})],er);class ir{constructor(t={}){this.version=1,this.privateKey=new ce,Object.assign(this,t)}}me([de({type:Mt.Integer})],ir.prototype,"version",void 0),me([de({type:ce})],ir.prototype,"privateKey",void 0),me([de({type:er,context:0,optional:!0})],ir.prototype,"parameters",void 0),me([de({type:Mt.BitString,context:1,optional:!0})],ir.prototype,"publicKey",void 0);class rr{constructor(t={}){this.r=new ArrayBuffer(0),this.s=new ArrayBuffer(0),Object.assign(this,t)}}me([de({type:Mt.Integer,converter:_t})],rr.prototype,"r",void 0),me([de({type:Mt.Integer,converter:_t})],rr.prototype,"s",void 0);const sr="1.2.840.113549.1.1.1",nr="1.2.840.113549.1.1.8";function or(t){return new ji({algorithm:t,parameters:null})}or("1.2.840.113549.2.2"),or("1.2.840.113549.2.5");const ar=or("1.3.14.3.2.26"),cr=(or("2.16.840.1.101.3.4.2.4"),or("2.16.840.1.101.3.4.2.1"),or("2.16.840.1.101.3.4.2.2"),or("2.16.840.1.101.3.4.2.3"),or("2.16.840.1.101.3.4.2.5"),or("2.16.840.1.101.3.4.2.6"),new ji({algorithm:nr,parameters:Ae.serialize(ar)})),lr=new ji({algorithm:"1.2.840.113549.1.1.9",parameters:Ae.serialize(Lt.toASN(new Uint8Array([218,57,163,238,94,107,75,13,50,85,191,239,149,96,24,144,175,216,7,9]).buffer))});or("1.2.840.113549.1.1.1"),or("1.2.840.113549.1.1.2"),or("1.2.840.113549.1.1.4"),or("1.2.840.113549.1.1.5"),or("1.2.840.113549.1.1.15"),or("1.2.840.113549.1.1.16"),or("1.2.840.113549.1.1.12"),or("1.2.840.113549.1.1.13"),or("1.2.840.113549.1.1.15"),or("1.2.840.113549.1.1.16");class ur{constructor(t={}){this.hashAlgorithm=new ji(ar),this.maskGenAlgorithm=new ji({algorithm:nr,parameters:Ae.serialize(ar)}),this.pSourceAlgorithm=new ji(lr),Object.assign(this,t)}}me([de({type:ji,context:0,defaultValue:ar})],ur.prototype,"hashAlgorithm",void 0),me([de({type:ji,context:1,defaultValue:cr})],ur.prototype,"maskGenAlgorithm",void 0),me([de({type:ji,context:2,defaultValue:lr})],ur.prototype,"pSourceAlgorithm",void 0),new ji({algorithm:"1.2.840.113549.1.1.7",parameters:Ae.serialize(new ur)});class hr{constructor(t={}){this.hashAlgorithm=new ji(ar),this.maskGenAlgorithm=new ji({algorithm:nr,parameters:Ae.serialize(ar)}),this.saltLength=20,this.trailerField=1,Object.assign(this,t)}}me([de({type:ji,context:0,defaultValue:ar})],hr.prototype,"hashAlgorithm",void 0),me([de({type:ji,context:1,defaultValue:cr})],hr.prototype,"maskGenAlgorithm",void 0),me([de({type:Mt.Integer,context:2,defaultValue:20})],hr.prototype,"saltLength",void 0),me([de({type:Mt.Integer,context:3,defaultValue:1})],hr.prototype,"trailerField",void 0),new ji({algorithm:"1.2.840.113549.1.1.10",parameters:Ae.serialize(new hr)});class pr{constructor(t={}){this.digestAlgorithm=new ji,this.digest=new ce,Object.assign(this,t)}}var dr;me([de({type:ji})],pr.prototype,"digestAlgorithm",void 0),me([de({type:ce})],pr.prototype,"digest",void 0);class fr{constructor(t={}){this.prime=new ArrayBuffer(0),this.exponent=new ArrayBuffer(0),this.coefficient=new ArrayBuffer(0),Object.assign(this,t)}}me([de({type:Mt.Integer,converter:_t})],fr.prototype,"prime",void 0),me([de({type:Mt.Integer,converter:_t})],fr.prototype,"exponent",void 0),me([de({type:Mt.Integer,converter:_t})],fr.prototype,"coefficient",void 0);let yr=dr=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,dr.prototype)}};yr=dr=me([pe({type:kt.Sequence,itemType:fr})],yr);class Sr{constructor(t={}){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,t)}}me([de({type:Mt.Integer})],Sr.prototype,"version",void 0),me([de({type:Mt.Integer,converter:_t})],Sr.prototype,"modulus",void 0),me([de({type:Mt.Integer,converter:_t})],Sr.prototype,"publicExponent",void 0),me([de({type:Mt.Integer,converter:_t})],Sr.prototype,"privateExponent",void 0),me([de({type:Mt.Integer,converter:_t})],Sr.prototype,"prime1",void 0),me([de({type:Mt.Integer,converter:_t})],Sr.prototype,"prime2",void 0),me([de({type:Mt.Integer,converter:_t})],Sr.prototype,"exponent1",void 0),me([de({type:Mt.Integer,converter:_t})],Sr.prototype,"exponent2",void 0),me([de({type:Mt.Integer,converter:_t})],Sr.prototype,"coefficient",void 0),me([de({type:yr,optional:!0})],Sr.prototype,"otherPrimeInfos",void 0);class Cr{constructor(t={}){this.modulus=new ArrayBuffer(0),this.publicExponent=new ArrayBuffer(0),Object.assign(this,t)}}me([de({type:Mt.Integer,converter:_t})],Cr.prototype,"modulus",void 0),me([de({type:Mt.Integer,converter:_t})],Cr.prototype,"publicExponent",void 0);
39
39
  /**
40
40
  * @license
41
41
  * Copyright (c) Peculiar Ventures, LLC.
@@ -51,7 +51,7 @@ const Ar=t=>/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-
51
51
  * This source code is licensed under the MIT license found in the
52
52
  * LICENSE file in the root directory of this source tree.
53
53
  */
54
- var Pr,Dr,Br,br=function(t,e,i){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,i),i};class Ir{constructor(t){Pr.set(this,new xe),n.isBufferSource(t)?br(this,Pr,ye.parse(t,xe)):br(this,Pr,t)}toJSON(){const t=[];return function(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}(this,Pr).forEach(e=>e.forEach(e=>{t.push({type:e.type,name:wr[e.type],shortName:Er[e.type],value:e.value.toString()})})),t}}Pr=new WeakMap,function(t){t[t.picture=0]="picture",t[t.handwrittenSignature=1]="handwrittenSignature"}(Br||(Br={}));let Tr=class{constructor(t={}){Object.assign(this,t)}};me([de({type:Mt.Integer})],Tr.prototype,"predefinedBiometricType",void 0),me([de({type:Mt.ObjectIdentifier})],Tr.prototype,"biometricDataOid",void 0),Tr=me([pe({type:kt.Choice})],Tr);class xr{constructor(t={}){this.typeOfBiometricData=new Tr,this.hashAlgorithm=new ji,this.biometricDataHash=new ce,Object.assign(this,t)}}me([de({type:Tr})],xr.prototype,"typeOfBiometricData",void 0),me([de({type:ji})],xr.prototype,"hashAlgorithm",void 0),me([de({type:ce})],xr.prototype,"biometricDataHash",void 0),me([de({type:Mt.IA5String,optional:!0})],xr.prototype,"sourceDataUri",void 0);let Rr=Dr=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,Dr.prototype)}};var Or,Nr;Rr=Dr=me([pe({type:kt.Sequence,itemType:xr})],Rr);class kr{constructor(){this.statementId="",this.statementInfo=new ArrayBuffer(0)}}me([de({type:Mt.ObjectIdentifier})],kr.prototype,"statementId",void 0),me([de({type:Mt.Any,optional:!0})],kr.prototype,"statementInfo",void 0);let Mr=Or=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,Or.prototype)}};Mr=Or=me([pe({type:kt.Sequence,itemType:ke})],Mr);class Kr{constructor(t={}){Object.assign(this,t)}}me([de({type:Mt.ObjectIdentifier,optional:!0})],Kr.prototype,"semanticsIdentifier",void 0),me([de({type:Mr,optional:!0})],Kr.prototype,"nameRegistrationAuthorities",void 0);let Hr=Nr=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,Nr.prototype)}};Hr=Nr=me([pe({type:kt.Sequence,itemType:kr})],Hr);let Ur=class extends De{};var _r,jr;Ur=me([pe({type:kt.Choice})],Ur),function(t){t.M="M",t.F="F",t.m="m",t.f="f"}(_r||(_r={}));let Fr=jr=class extends Xe{constructor(t){super(t),Object.setPrototypeOf(this,jr.prototype)}};Fr=jr=me([pe({type:kt.Sequence})],Fr);class Vr{constructor(t={}){this.templateID="",this.templateMajorVersion=0,this.templateMinorVersion=0,Object.assign(this,t)}}me([de({type:Mt.ObjectIdentifier})],Vr.prototype,"templateID",void 0),me([de({type:Mt.Integer})],Vr.prototype,"templateMajorVersion",void 0),me([de({type:Mt.Integer})],Vr.prototype,"templateMinorVersion",void 0);class Lr{constructor(t={}){this.name="",Object.assign(this,t)}}me([de({type:Mt.Utf8String})],Lr.prototype,"name",void 0);let Gr=class{constructor(t={}){Object.assign(this,t)}toString(){var t,e;return(null===(t=this.name)||void 0===t?void 0:t.toString())||(null===(e=this.spec)||void 0===e?void 0:e.name)||""}};me([de({type:De})],Gr.prototype,"name",void 0),me([de({type:Lr})],Gr.prototype,"spec",void 0),Gr=me([pe({type:kt.Choice})],Gr);let $r=class{constructor(){this.value=new ArrayBuffer(0)}toString(){const t=this.getVersion();return`V${t.certificateIndex}.${t.keyIndex}`}getVersion(){let t=new Uint8Array(this.value);return this.value.byteLength<4&&(t=new Uint8Array(4),t.set(new Uint8Array(this.value),4-this.value.byteLength)),{keyIndex:parseInt(o.ToHex(t.slice(0,2)),16),certificateIndex:parseInt(o.ToHex(t.slice(2)),16)}}};me([de({type:Mt.Integer,converter:_t})],$r.prototype,"value",void 0),$r=me([pe({type:kt.Choice})],$r);let Qr=class{constructor(t={}){Object.assign(this,t)}};me([de({type:Mt.NumericString})],Qr.prototype,"numericString",void 0),me([de({type:Mt.PrintableString})],Qr.prototype,"printableString",void 0),me([de({type:Mt.TeletexString})],Qr.prototype,"teletexString",void 0),me([de({type:Mt.VideotexString})],Qr.prototype,"videotexString",void 0),me([de({type:Mt.IA5String})],Qr.prototype,"ia5String",void 0),me([de({type:Mt.GraphicString})],Qr.prototype,"graphicString",void 0),me([de({type:Mt.VisibleString})],Qr.prototype,"visibleString",void 0),me([de({type:Mt.GeneralString})],Qr.prototype,"generalString",void 0),me([de({type:Mt.UniversalString})],Qr.prototype,"universalString",void 0),me([de({type:Mt.BmpString})],Qr.prototype,"bmpString",void 0),Qr=me([pe({type:kt.Choice})],Qr);let Wr=class{constructor(t=new ArrayBuffer(0)){this.value=t}};var zr;me([de({type:Mt.Any})],Wr.prototype,"value",void 0),Wr=me([pe({type:kt.Choice})],Wr);let qr=zr=class extends Qi{constructor(t){super(t),Object.setPrototypeOf(this,zr.prototype)}};qr=zr=me([pe({type:kt.Sequence})],qr);class Jr{constructor(t={}){this.keySpec=0,this.cspName="",this.signature=new ArrayBuffer(0),Object.assign(this,t)}}var Zr;me([de({type:Mt.Integer})],Jr.prototype,"keySpec",void 0),me([de({type:Mt.BmpString})],Jr.prototype,"cspName",void 0),me([de({type:Mt.BitString})],Jr.prototype,"signature",void 0);let Xr=Zr=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,Zr.prototype)}};var Yr;Xr=Zr=me([pe({type:kt.Sequence,itemType:Mt.Any})],Xr);let ts=Yr=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,Yr.prototype)}};var es;ts=Yr=me([pe({type:kt.Sequence,itemType:Mt.Any})],ts);class is{constructor(t={}){this.name="",this.value="",Object.assign(this,t)}}me([de({type:Mt.BmpString})],is.prototype,"name",void 0),me([de({type:Mt.BmpString})],is.prototype,"value",void 0);let rs=es=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,es.prototype)}};rs=es=me([pe({type:kt.Sequence,itemType:is})],rs);let ss=class extends Oe{};ss=me([pe({type:kt.Sequence})],ss);let ns=class extends Oe{};ns=me([pe({type:kt.Sequence})],ns);let os=class extends qi{};os=me([pe({type:kt.Sequence})],os);class as{constructor(t={}){this.clientId=0,this.machineName="",this.userName="",this.processName="",Object.assign(this,t)}}me([de({type:Mt.Integer})],as.prototype,"clientId",void 0),me([de({type:Mt.Utf8String})],as.prototype,"machineName",void 0),me([de({type:Mt.Utf8String})],as.prototype,"userName",void 0),me([de({type:Mt.Utf8String})],as.prototype,"processName",void 0);let cs=class{constructor(t){this.value="",t&&(this.value=t)}};me([de({type:Mt.IA5String})],cs.prototype,"value",void 0),cs=me([pe({type:kt.Choice})],cs);let ls=class{constructor(t){this.value="",t&&(this.value=t)}};me([de({type:Mt.IA5String})],ls.prototype,"value",void 0),ls=me([pe({type:kt.Choice})],ls);let us=class{constructor(t){this.value="",t&&(this.value=t)}};me([de({type:Mt.IA5String})],us.prototype,"value",void 0),us=me([pe({type:kt.Choice})],us);let hs=class{constructor(t){this.value="",t&&(this.value=t)}};var ps;me([de({type:Mt.IA5String})],hs.prototype,"value",void 0),hs=me([pe({type:kt.Choice})],hs),function(t){t[t.sslClient=1]="sslClient",t[t.sslServer=2]="sslServer",t[t.sMime=4]="sMime",t[t.objectSigning=8]="objectSigning",t[t.sslCa=32]="sslCa",t[t.sMimeCa=64]="sMimeCa",t[t.objectSigningCa=128]="objectSigningCa"}(ps||(ps={}));class ds extends ae{toJSON(){const t=this.toNumber(),e=[];return t&ps.objectSigning&&e.push("objectSigning"),t&ps.objectSigningCa&&e.push("objectSigningCa"),t&ps.sMime&&e.push("sMime"),t&ps.sMimeCa&&e.push("sMimeCa"),t&ps.sslCa&&e.push("sslCa"),t&ps.sslClient&&e.push("sslClient"),t&ps.sslServer&&e.push("sslServer"),e}toString(){return`[${this.toJSON().join(", ")}]`}}let fs=class{constructor(t){this.value="",t&&(this.value=t)}};me([de({type:Mt.IA5String})],fs.prototype,"value",void 0),fs=me([pe({type:kt.Choice})],fs);let ys=class{constructor(t){this.value="",t&&(this.value=t)}};me([de({type:Mt.IA5String})],ys.prototype,"value",void 0),ys=me([pe({type:kt.Choice})],ys);let Ss=class{constructor(t){this.value="",t&&(this.value=t)}};me([de({type:Mt.IA5String})],Ss.prototype,"value",void 0),Ss=me([pe({type:kt.Choice})],Ss);let Cs=class{constructor(t={}){this.leiCode="",Object.assign(this,t)}};me([de({type:ft})],Cs.prototype,"leiCode",void 0),me([de({type:ft,context:0,optional:!0})],Cs.prototype,"leiRole",void 0),Cs=me([pe({type:kt.Sequence})],Cs);let As=class{constructor(t){t&&(this.text=t)}get text(){return void 0!==this.bmpString?this.bmpString:void 0!==this.ia5String?this.ia5String:void 0!==this.printableString?this.printableString:void 0!==this.utf8String?this.utf8String:void 0!==this.visibleString?this.visibleString:void 0}set text(t){this.printableString=t}};me([de({type:Mt.IA5String})],As.prototype,"ia5String",void 0),me([de({type:Mt.VisibleString})],As.prototype,"visibleString",void 0),me([de({type:Mt.BmpString})],As.prototype,"bmpString",void 0),me([de({type:Mt.Utf8String})],As.prototype,"utf8String",void 0),me([de({type:Mt.PrintableString})],As.prototype,"printableString",void 0),As=me([pe({type:kt.Choice})],As);let ms=class extends As{constructor(t){super(),"string"==typeof t?this.text=t:t instanceof Cs&&(this.struct=t)}};me([de({type:Cs})],ms.prototype,"struct",void 0),ms=me([pe({type:kt.Choice})],ms);let gs=class extends As{};gs=me([pe({type:kt.Choice})],gs);class vs{constructor(t){this.offset=0,this.view=n.toUint8Array(t)}get position(){return this.offset}read(t=1){const e=this.view.slice(this.offset,this.offset+t);return this.offset=this.offset+e.length,e}readByte(){const t=this.read();if(!t.length)throw new Error("End of stream");return t[0]}readNumber(t){const e=this.read(t),i=o.ToHex(e);return parseInt(i,16)}readEnd(){return this.read(this.view.length-this.offset)}reset(){this.offset=0}}var Es,ws,Ps,Ds,Bs;!function(t){t[t.certificateTimestamp=0]="certificateTimestamp",t[t.treeHash=1]="treeHash"}(Es||(Es={})),function(t){t[t.none=0]="none",t[t.md5=1]="md5",t[t.sha1=2]="sha1",t[t.sha224=3]="sha224",t[t.sha256=4]="sha256",t[t.sha384=5]="sha384",t[t.sha512=6]="sha512"}(ws||(ws={})),function(t){t[t.anonymous=0]="anonymous",t[t.rsa=1]="rsa",t[t.dsa=2]="dsa",t[t.ecdsa=3]="ecdsa"}(Ps||(Ps={}));class bs extends class{static createStream(t){const e=n.toUint8Array(t);return new vs(e)}}{constructor(t){super(),this.version=0,this.logId=new ArrayBuffer(32),this.timestamp=new Date,this.extensions=new ArrayBuffer(0),this.hashAlgorithm=0,this.signatureAlgorithm=0,this.signature=new ArrayBuffer(0),t&&this.parse(t)}parse(t){this.version=t.readByte(),t.read(2),this.logId=n.toArrayBuffer(t.read(32)),this.timestamp=new Date(t.readNumber(8));const e=t.readNumber(2);this.extensions=t.read(e).buffer,this.hashAlgorithm=t.readByte(),this.signatureAlgorithm=t.readByte(),this.signature=t.read(t.readNumber(2)).buffer}toJSON(){return{version:this.version,logId:o.ToHex(this.logId),timestamp:this.timestamp,extensions:o.ToBase64(this.extensions),hashAlgorithm:ws[this.hashAlgorithm]||"undefined",signatureAlgorithm:Ps[this.signatureAlgorithm]||"undefined",signature:o.ToBase64(this.signature)}}}class Is extends ce{constructor(){super(...arguments),this.items=[]}fromASN(t){super.fromASN(t);const e=new vs(this.buffer),i=e.readNumber(2);for(this.items=[];e.position<i;)this.items.push(new bs(e));return this}toJSON(){return this.items.map(t=>t.toJSON())}}!function(t){t[t.v1=1]="v1"}(Ds||(Ds={}));class Ts{constructor(t={}){this.version=Ds.v1,Object.assign(this,t)}}me([de({type:Mt.Integer})],Ts.prototype,"version",void 0);class xs{constructor(t={}){this.version=Ds.v1,this.location=new ke,this.requiresAuth=!1,Object.assign(this,t)}}me([de({type:Mt.Integer})],xs.prototype,"version",void 0),me([de({type:ke})],xs.prototype,"location",void 0),me([de({type:Mt.Boolean,defaultValue:!1,optional:!0})],xs.prototype,"requiresAuth",void 0);class Rs{constructor(t={}){this.hashAlg=new ji,this.hashValue=new ce,Object.assign(this,t)}}me([de({type:ji})],Rs.prototype,"hashAlg",void 0),me([de({type:ce})],Rs.prototype,"hashValue",void 0);class Os{constructor(t={}){this.mediaType="",this.logotypeHash=[],this.logotypeURI=[],Object.assign(this,t)}}me([de({type:Mt.IA5String})],Os.prototype,"mediaType",void 0),me([de({type:Rs,repeated:"sequence"})],Os.prototype,"logotypeHash",void 0),me([de({type:Mt.IA5String,repeated:"sequence"})],Os.prototype,"logotypeURI",void 0),function(t){t[t.mono=1]="mono",t[t.stereo=2]="stereo",t[t.quad=4]="quad"}(Bs||(Bs={}));class Ns{constructor(t={}){this.fileSize=0,this.playTime=0,this.channels=Bs.mono,Object.assign(this,t)}}me([de({type:Mt.Integer})],Ns.prototype,"fileSize",void 0),me([de({type:Mt.Integer})],Ns.prototype,"playTime",void 0),me([de({type:Mt.Integer})],Ns.prototype,"channels",void 0),me([de({type:Mt.Integer,implicit:!0,context:3,optional:!0})],Ns.prototype,"sampleRate",void 0),me([de({type:Mt.IA5String,implicit:!0,context:4,optional:!0})],Ns.prototype,"language",void 0);class ks{constructor(t={}){this.audioDetails=new Os,Object.assign(this,t)}}me([de({type:Os})],ks.prototype,"audioDetails",void 0),me([de({type:Ns,optional:!0})],ks.prototype,"audioInfo",void 0);let Ms=class{constructor(t={}){Object.assign(this,t)}};var Ks;me([de({type:Mt.Integer,context:1,implicit:!0})],Ms.prototype,"numBits",void 0),me([de({type:Mt.Integer,context:2,implicit:!0})],Ms.prototype,"tableSize",void 0),Ms=me([pe({type:kt.Choice})],Ms),function(t){t[t.grayScale=0]="grayScale",t[t.color=1]="color"}(Ks||(Ks={}));class Hs{constructor(t={}){this.type=Ks.color,this.fileSize=0,this.xSize=0,this.ySize=0,Object.assign(this,t)}}me([de({type:Mt.Integer,context:0,implicit:!0,defaultValue:Ks.color})],Hs.prototype,"type",void 0),me([de({type:Mt.Integer})],Hs.prototype,"fileSize",void 0),me([de({type:Mt.Integer})],Hs.prototype,"xSize",void 0),me([de({type:Mt.Integer})],Hs.prototype,"ySize",void 0),me([de({type:Ms})],Hs.prototype,"resolution",void 0),me([de({type:Mt.IA5String,context:4,implicit:!0,optional:!0})],Hs.prototype,"language",void 0);class Us{constructor(t={}){this.imageDetails=new Os,Object.assign(this,t)}}me([de({type:Os})],Us.prototype,"imageDetails",void 0),me([de({type:Hs,optional:!0})],Us.prototype,"imageInfo",void 0);class _s{constructor(t={}){Object.assign(this,t)}}me([de({type:Us,repeated:"sequence",optional:!0})],_s.prototype,"image",void 0),me([de({type:ks,repeated:"sequence",context:1,optional:!0})],_s.prototype,"audio",void 0);class js{constructor(t={}){this.refStructHash=[],this.refStructURI=[],Object.assign(this,t)}}me([de({type:Rs,repeated:"sequence"})],js.prototype,"refStructHash",void 0),me([de({type:Mt.IA5String,repeated:"sequence"})],js.prototype,"refStructURI",void 0);let Fs=class{constructor(t={}){Object.assign(this,t)}};me([de({type:_s,implicit:!0,context:0})],Fs.prototype,"direct",void 0),me([de({type:js,implicit:!0,context:1})],Fs.prototype,"indirect",void 0),Fs=me([pe({type:kt.Choice})],Fs);class Vs{constructor(t={}){this.logotypeType="",this.info=new Fs,Object.assign(this,t)}}me([de({type:Mt.ObjectIdentifier})],Vs.prototype,"logotypeType",void 0),me([de({type:Fs})],Vs.prototype,"info",void 0);class Ls{constructor(t={}){Object.assign(this,t)}}var Gs,$s,Qs;me([de({type:Fs,context:0,repeated:"sequence",optional:!0})],Ls.prototype,"communityLogos",void 0),me([de({type:Fs,context:1,optional:!0})],Ls.prototype,"issuerLogo",void 0),me([de({type:Fs,context:2,optional:!0})],Ls.prototype,"subjectLogo",void 0),me([de({type:Vs,context:3,repeated:"sequence",optional:!0})],Ls.prototype,"otherLogos",void 0);let Ws=Gs=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,Gs.prototype)}};Ws=Gs=me([pe({type:kt.Sequence,itemType:Mt.IA5String})],Ws);class zs{constructor(t={}){this.claim="",this.permitted=[],Object.assign(this,t)}}me([de({type:Mt.IA5String})],zs.prototype,"claim",void 0),me([de({type:Mt.Utf8String,repeated:"sequence"})],zs.prototype,"permitted",void 0);let qs=$s=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,$s.prototype)}};qs=$s=me([pe({type:kt.Sequence,itemType:zs})],qs);class Js{constructor(t={}){Object.assign(this,t)}}me([de({type:Ws,optional:!0,context:0})],Js.prototype,"mustInclude",void 0),me([de({type:qs,optional:!0,context:1})],Js.prototype,"permittedValues",void 0);class Zs{constructor(){this.start="",this.count=2}}me([de({type:Mt.IA5String})],Zs.prototype,"start",void 0),me([de({type:Mt.Integer})],Zs.prototype,"count",void 0);let Xs=class{constructor(t={}){Object.assign(this,t)}};me([de({type:Mt.IA5String,context:0})],Xs.prototype,"spc",void 0),me([de({type:Zs,context:1})],Xs.prototype,"range",void 0),me([de({type:Mt.IA5String,context:2})],Xs.prototype,"one",void 0),Xs=me([pe({type:kt.Choice})],Xs);let Ys=Qs=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,Qs.prototype)}};Ys=Qs=me([pe({type:kt.Sequence,itemType:Xs})],Ys);
54
+ var Pr,Dr,br,Br=function(t,e,i){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,i),i};class Ir{constructor(t){Pr.set(this,new xe),n.isBufferSource(t)?Br(this,Pr,ye.parse(t,xe)):Br(this,Pr,t)}toJSON(){const t=[];return function(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}(this,Pr).forEach(e=>e.forEach(e=>{t.push({type:e.type,name:wr[e.type],shortName:Er[e.type],value:e.value.toString()})})),t}}Pr=new WeakMap,function(t){t[t.picture=0]="picture",t[t.handwrittenSignature=1]="handwrittenSignature"}(br||(br={}));let Tr=class{constructor(t={}){Object.assign(this,t)}};me([de({type:Mt.Integer})],Tr.prototype,"predefinedBiometricType",void 0),me([de({type:Mt.ObjectIdentifier})],Tr.prototype,"biometricDataOid",void 0),Tr=me([pe({type:kt.Choice})],Tr);class xr{constructor(t={}){this.typeOfBiometricData=new Tr,this.hashAlgorithm=new ji,this.biometricDataHash=new ce,Object.assign(this,t)}}me([de({type:Tr})],xr.prototype,"typeOfBiometricData",void 0),me([de({type:ji})],xr.prototype,"hashAlgorithm",void 0),me([de({type:ce})],xr.prototype,"biometricDataHash",void 0),me([de({type:Mt.IA5String,optional:!0})],xr.prototype,"sourceDataUri",void 0);let Rr=Dr=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,Dr.prototype)}};var Or,Nr;Rr=Dr=me([pe({type:kt.Sequence,itemType:xr})],Rr);class kr{constructor(){this.statementId="",this.statementInfo=new ArrayBuffer(0)}}me([de({type:Mt.ObjectIdentifier})],kr.prototype,"statementId",void 0),me([de({type:Mt.Any,optional:!0})],kr.prototype,"statementInfo",void 0);let Mr=Or=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,Or.prototype)}};Mr=Or=me([pe({type:kt.Sequence,itemType:ke})],Mr);class Kr{constructor(t={}){Object.assign(this,t)}}me([de({type:Mt.ObjectIdentifier,optional:!0})],Kr.prototype,"semanticsIdentifier",void 0),me([de({type:Mr,optional:!0})],Kr.prototype,"nameRegistrationAuthorities",void 0);let Hr=Nr=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,Nr.prototype)}};Hr=Nr=me([pe({type:kt.Sequence,itemType:kr})],Hr);let Ur=class extends De{};var _r,jr;Ur=me([pe({type:kt.Choice})],Ur),function(t){t.M="M",t.F="F",t.m="m",t.f="f"}(_r||(_r={}));let Fr=jr=class extends Xe{constructor(t){super(t),Object.setPrototypeOf(this,jr.prototype)}};Fr=jr=me([pe({type:kt.Sequence})],Fr);class Vr{constructor(t={}){this.templateID="",this.templateMajorVersion=0,this.templateMinorVersion=0,Object.assign(this,t)}}me([de({type:Mt.ObjectIdentifier})],Vr.prototype,"templateID",void 0),me([de({type:Mt.Integer})],Vr.prototype,"templateMajorVersion",void 0),me([de({type:Mt.Integer})],Vr.prototype,"templateMinorVersion",void 0);class Lr{constructor(t={}){this.name="",Object.assign(this,t)}}me([de({type:Mt.Utf8String})],Lr.prototype,"name",void 0);let Gr=class{constructor(t={}){Object.assign(this,t)}toString(){var t,e;return(null===(t=this.name)||void 0===t?void 0:t.toString())||(null===(e=this.spec)||void 0===e?void 0:e.name)||""}};me([de({type:De})],Gr.prototype,"name",void 0),me([de({type:Lr})],Gr.prototype,"spec",void 0),Gr=me([pe({type:kt.Choice})],Gr);let $r=class{constructor(){this.value=new ArrayBuffer(0)}toString(){const t=this.getVersion();return`V${t.certificateIndex}.${t.keyIndex}`}getVersion(){let t=new Uint8Array(this.value);return this.value.byteLength<4&&(t=new Uint8Array(4),t.set(new Uint8Array(this.value),4-this.value.byteLength)),{keyIndex:parseInt(o.ToHex(t.slice(0,2)),16),certificateIndex:parseInt(o.ToHex(t.slice(2)),16)}}};me([de({type:Mt.Integer,converter:_t})],$r.prototype,"value",void 0),$r=me([pe({type:kt.Choice})],$r);let Qr=class{constructor(t={}){Object.assign(this,t)}};me([de({type:Mt.NumericString})],Qr.prototype,"numericString",void 0),me([de({type:Mt.PrintableString})],Qr.prototype,"printableString",void 0),me([de({type:Mt.TeletexString})],Qr.prototype,"teletexString",void 0),me([de({type:Mt.VideotexString})],Qr.prototype,"videotexString",void 0),me([de({type:Mt.IA5String})],Qr.prototype,"ia5String",void 0),me([de({type:Mt.GraphicString})],Qr.prototype,"graphicString",void 0),me([de({type:Mt.VisibleString})],Qr.prototype,"visibleString",void 0),me([de({type:Mt.GeneralString})],Qr.prototype,"generalString",void 0),me([de({type:Mt.UniversalString})],Qr.prototype,"universalString",void 0),me([de({type:Mt.BmpString})],Qr.prototype,"bmpString",void 0),Qr=me([pe({type:kt.Choice})],Qr);let Wr=class{constructor(t=new ArrayBuffer(0)){this.value=t}};var zr;me([de({type:Mt.Any})],Wr.prototype,"value",void 0),Wr=me([pe({type:kt.Choice})],Wr);let qr=zr=class extends Qi{constructor(t){super(t),Object.setPrototypeOf(this,zr.prototype)}};qr=zr=me([pe({type:kt.Sequence})],qr);class Jr{constructor(t={}){this.keySpec=0,this.cspName="",this.signature=new ArrayBuffer(0),Object.assign(this,t)}}var Zr;me([de({type:Mt.Integer})],Jr.prototype,"keySpec",void 0),me([de({type:Mt.BmpString})],Jr.prototype,"cspName",void 0),me([de({type:Mt.BitString})],Jr.prototype,"signature",void 0);let Xr=Zr=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,Zr.prototype)}};var Yr;Xr=Zr=me([pe({type:kt.Sequence,itemType:Mt.Any})],Xr);let ts=Yr=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,Yr.prototype)}};var es;ts=Yr=me([pe({type:kt.Sequence,itemType:Mt.Any})],ts);class is{constructor(t={}){this.name="",this.value="",Object.assign(this,t)}}me([de({type:Mt.BmpString})],is.prototype,"name",void 0),me([de({type:Mt.BmpString})],is.prototype,"value",void 0);let rs=es=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,es.prototype)}};rs=es=me([pe({type:kt.Sequence,itemType:is})],rs);let ss=class extends Oe{};ss=me([pe({type:kt.Sequence})],ss);let ns=class extends Oe{};ns=me([pe({type:kt.Sequence})],ns);let os=class extends qi{};os=me([pe({type:kt.Sequence})],os);class as{constructor(t={}){this.clientId=0,this.machineName="",this.userName="",this.processName="",Object.assign(this,t)}}me([de({type:Mt.Integer})],as.prototype,"clientId",void 0),me([de({type:Mt.Utf8String})],as.prototype,"machineName",void 0),me([de({type:Mt.Utf8String})],as.prototype,"userName",void 0),me([de({type:Mt.Utf8String})],as.prototype,"processName",void 0);let cs=class{constructor(t){this.value="",t&&(this.value=t)}};me([de({type:Mt.IA5String})],cs.prototype,"value",void 0),cs=me([pe({type:kt.Choice})],cs);let ls=class{constructor(t){this.value="",t&&(this.value=t)}};me([de({type:Mt.IA5String})],ls.prototype,"value",void 0),ls=me([pe({type:kt.Choice})],ls);let us=class{constructor(t){this.value="",t&&(this.value=t)}};me([de({type:Mt.IA5String})],us.prototype,"value",void 0),us=me([pe({type:kt.Choice})],us);let hs=class{constructor(t){this.value="",t&&(this.value=t)}};var ps;me([de({type:Mt.IA5String})],hs.prototype,"value",void 0),hs=me([pe({type:kt.Choice})],hs),function(t){t[t.sslClient=1]="sslClient",t[t.sslServer=2]="sslServer",t[t.sMime=4]="sMime",t[t.objectSigning=8]="objectSigning",t[t.sslCa=32]="sslCa",t[t.sMimeCa=64]="sMimeCa",t[t.objectSigningCa=128]="objectSigningCa"}(ps||(ps={}));class ds extends ae{toJSON(){const t=this.toNumber(),e=[];return t&ps.objectSigning&&e.push("objectSigning"),t&ps.objectSigningCa&&e.push("objectSigningCa"),t&ps.sMime&&e.push("sMime"),t&ps.sMimeCa&&e.push("sMimeCa"),t&ps.sslCa&&e.push("sslCa"),t&ps.sslClient&&e.push("sslClient"),t&ps.sslServer&&e.push("sslServer"),e}toString(){return`[${this.toJSON().join(", ")}]`}}let fs=class{constructor(t){this.value="",t&&(this.value=t)}};me([de({type:Mt.IA5String})],fs.prototype,"value",void 0),fs=me([pe({type:kt.Choice})],fs);let ys=class{constructor(t){this.value="",t&&(this.value=t)}};me([de({type:Mt.IA5String})],ys.prototype,"value",void 0),ys=me([pe({type:kt.Choice})],ys);let Ss=class{constructor(t){this.value="",t&&(this.value=t)}};me([de({type:Mt.IA5String})],Ss.prototype,"value",void 0),Ss=me([pe({type:kt.Choice})],Ss);let Cs=class{constructor(t={}){this.leiCode="",Object.assign(this,t)}};me([de({type:ft})],Cs.prototype,"leiCode",void 0),me([de({type:ft,context:0,optional:!0})],Cs.prototype,"leiRole",void 0),Cs=me([pe({type:kt.Sequence})],Cs);let As=class{constructor(t){t&&(this.text=t)}get text(){return void 0!==this.bmpString?this.bmpString:void 0!==this.ia5String?this.ia5String:void 0!==this.printableString?this.printableString:void 0!==this.utf8String?this.utf8String:void 0!==this.visibleString?this.visibleString:void 0}set text(t){this.printableString=t}};me([de({type:Mt.IA5String})],As.prototype,"ia5String",void 0),me([de({type:Mt.VisibleString})],As.prototype,"visibleString",void 0),me([de({type:Mt.BmpString})],As.prototype,"bmpString",void 0),me([de({type:Mt.Utf8String})],As.prototype,"utf8String",void 0),me([de({type:Mt.PrintableString})],As.prototype,"printableString",void 0),As=me([pe({type:kt.Choice})],As);let ms=class extends As{constructor(t){super(),"string"==typeof t?this.text=t:t instanceof Cs&&(this.struct=t)}};me([de({type:Cs})],ms.prototype,"struct",void 0),ms=me([pe({type:kt.Choice})],ms);let gs=class extends As{};gs=me([pe({type:kt.Choice})],gs);class vs{constructor(t){this.offset=0,this.view=n.toUint8Array(t)}get position(){return this.offset}read(t=1){const e=this.view.slice(this.offset,this.offset+t);return this.offset=this.offset+e.length,e}readByte(){const t=this.read();if(!t.length)throw new Error("End of stream");return t[0]}readNumber(t){const e=this.read(t),i=o.ToHex(e);return parseInt(i,16)}readEnd(){return this.read(this.view.length-this.offset)}reset(){this.offset=0}}var Es,ws,Ps,Ds,bs;!function(t){t[t.certificateTimestamp=0]="certificateTimestamp",t[t.treeHash=1]="treeHash"}(Es||(Es={})),function(t){t[t.none=0]="none",t[t.md5=1]="md5",t[t.sha1=2]="sha1",t[t.sha224=3]="sha224",t[t.sha256=4]="sha256",t[t.sha384=5]="sha384",t[t.sha512=6]="sha512"}(ws||(ws={})),function(t){t[t.anonymous=0]="anonymous",t[t.rsa=1]="rsa",t[t.dsa=2]="dsa",t[t.ecdsa=3]="ecdsa"}(Ps||(Ps={}));class Bs extends class{static createStream(t){const e=n.toUint8Array(t);return new vs(e)}}{constructor(t){super(),this.version=0,this.logId=new ArrayBuffer(32),this.timestamp=new Date,this.extensions=new ArrayBuffer(0),this.hashAlgorithm=0,this.signatureAlgorithm=0,this.signature=new ArrayBuffer(0),t&&this.parse(t)}parse(t){this.version=t.readByte(),t.read(2),this.logId=n.toArrayBuffer(t.read(32)),this.timestamp=new Date(t.readNumber(8));const e=t.readNumber(2);this.extensions=t.read(e).buffer,this.hashAlgorithm=t.readByte(),this.signatureAlgorithm=t.readByte(),this.signature=t.read(t.readNumber(2)).buffer}toJSON(){return{version:this.version,logId:o.ToHex(this.logId),timestamp:this.timestamp,extensions:o.ToBase64(this.extensions),hashAlgorithm:ws[this.hashAlgorithm]||"undefined",signatureAlgorithm:Ps[this.signatureAlgorithm]||"undefined",signature:o.ToBase64(this.signature)}}}class Is extends ce{constructor(){super(...arguments),this.items=[]}fromASN(t){super.fromASN(t);const e=new vs(this.buffer),i=e.readNumber(2);for(this.items=[];e.position<i;)this.items.push(new Bs(e));return this}toJSON(){return this.items.map(t=>t.toJSON())}}!function(t){t[t.v1=1]="v1"}(Ds||(Ds={}));class Ts{constructor(t={}){this.version=Ds.v1,Object.assign(this,t)}}me([de({type:Mt.Integer})],Ts.prototype,"version",void 0);class xs{constructor(t={}){this.version=Ds.v1,this.location=new ke,this.requiresAuth=!1,Object.assign(this,t)}}me([de({type:Mt.Integer})],xs.prototype,"version",void 0),me([de({type:ke})],xs.prototype,"location",void 0),me([de({type:Mt.Boolean,defaultValue:!1,optional:!0})],xs.prototype,"requiresAuth",void 0);class Rs{constructor(t={}){this.hashAlg=new ji,this.hashValue=new ce,Object.assign(this,t)}}me([de({type:ji})],Rs.prototype,"hashAlg",void 0),me([de({type:ce})],Rs.prototype,"hashValue",void 0);class Os{constructor(t={}){this.mediaType="",this.logotypeHash=[],this.logotypeURI=[],Object.assign(this,t)}}me([de({type:Mt.IA5String})],Os.prototype,"mediaType",void 0),me([de({type:Rs,repeated:"sequence"})],Os.prototype,"logotypeHash",void 0),me([de({type:Mt.IA5String,repeated:"sequence"})],Os.prototype,"logotypeURI",void 0),function(t){t[t.mono=1]="mono",t[t.stereo=2]="stereo",t[t.quad=4]="quad"}(bs||(bs={}));class Ns{constructor(t={}){this.fileSize=0,this.playTime=0,this.channels=bs.mono,Object.assign(this,t)}}me([de({type:Mt.Integer})],Ns.prototype,"fileSize",void 0),me([de({type:Mt.Integer})],Ns.prototype,"playTime",void 0),me([de({type:Mt.Integer})],Ns.prototype,"channels",void 0),me([de({type:Mt.Integer,implicit:!0,context:3,optional:!0})],Ns.prototype,"sampleRate",void 0),me([de({type:Mt.IA5String,implicit:!0,context:4,optional:!0})],Ns.prototype,"language",void 0);class ks{constructor(t={}){this.audioDetails=new Os,Object.assign(this,t)}}me([de({type:Os})],ks.prototype,"audioDetails",void 0),me([de({type:Ns,optional:!0})],ks.prototype,"audioInfo",void 0);let Ms=class{constructor(t={}){Object.assign(this,t)}};var Ks;me([de({type:Mt.Integer,context:1,implicit:!0})],Ms.prototype,"numBits",void 0),me([de({type:Mt.Integer,context:2,implicit:!0})],Ms.prototype,"tableSize",void 0),Ms=me([pe({type:kt.Choice})],Ms),function(t){t[t.grayScale=0]="grayScale",t[t.color=1]="color"}(Ks||(Ks={}));class Hs{constructor(t={}){this.type=Ks.color,this.fileSize=0,this.xSize=0,this.ySize=0,Object.assign(this,t)}}me([de({type:Mt.Integer,context:0,implicit:!0,defaultValue:Ks.color})],Hs.prototype,"type",void 0),me([de({type:Mt.Integer})],Hs.prototype,"fileSize",void 0),me([de({type:Mt.Integer})],Hs.prototype,"xSize",void 0),me([de({type:Mt.Integer})],Hs.prototype,"ySize",void 0),me([de({type:Ms})],Hs.prototype,"resolution",void 0),me([de({type:Mt.IA5String,context:4,implicit:!0,optional:!0})],Hs.prototype,"language",void 0);class Us{constructor(t={}){this.imageDetails=new Os,Object.assign(this,t)}}me([de({type:Os})],Us.prototype,"imageDetails",void 0),me([de({type:Hs,optional:!0})],Us.prototype,"imageInfo",void 0);class _s{constructor(t={}){Object.assign(this,t)}}me([de({type:Us,repeated:"sequence",optional:!0})],_s.prototype,"image",void 0),me([de({type:ks,repeated:"sequence",context:1,optional:!0})],_s.prototype,"audio",void 0);class js{constructor(t={}){this.refStructHash=[],this.refStructURI=[],Object.assign(this,t)}}me([de({type:Rs,repeated:"sequence"})],js.prototype,"refStructHash",void 0),me([de({type:Mt.IA5String,repeated:"sequence"})],js.prototype,"refStructURI",void 0);let Fs=class{constructor(t={}){Object.assign(this,t)}};me([de({type:_s,implicit:!0,context:0})],Fs.prototype,"direct",void 0),me([de({type:js,implicit:!0,context:1})],Fs.prototype,"indirect",void 0),Fs=me([pe({type:kt.Choice})],Fs);class Vs{constructor(t={}){this.logotypeType="",this.info=new Fs,Object.assign(this,t)}}me([de({type:Mt.ObjectIdentifier})],Vs.prototype,"logotypeType",void 0),me([de({type:Fs})],Vs.prototype,"info",void 0);class Ls{constructor(t={}){Object.assign(this,t)}}var Gs,$s,Qs;me([de({type:Fs,context:0,repeated:"sequence",optional:!0})],Ls.prototype,"communityLogos",void 0),me([de({type:Fs,context:1,optional:!0})],Ls.prototype,"issuerLogo",void 0),me([de({type:Fs,context:2,optional:!0})],Ls.prototype,"subjectLogo",void 0),me([de({type:Vs,context:3,repeated:"sequence",optional:!0})],Ls.prototype,"otherLogos",void 0);let Ws=Gs=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,Gs.prototype)}};Ws=Gs=me([pe({type:kt.Sequence,itemType:Mt.IA5String})],Ws);class zs{constructor(t={}){this.claim="",this.permitted=[],Object.assign(this,t)}}me([de({type:Mt.IA5String})],zs.prototype,"claim",void 0),me([de({type:Mt.Utf8String,repeated:"sequence"})],zs.prototype,"permitted",void 0);let qs=$s=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,$s.prototype)}};qs=$s=me([pe({type:kt.Sequence,itemType:zs})],qs);class Js{constructor(t={}){Object.assign(this,t)}}me([de({type:Ws,optional:!0,context:0})],Js.prototype,"mustInclude",void 0),me([de({type:qs,optional:!0,context:1})],Js.prototype,"permittedValues",void 0);class Zs{constructor(){this.start="",this.count=2}}me([de({type:Mt.IA5String})],Zs.prototype,"start",void 0),me([de({type:Mt.Integer})],Zs.prototype,"count",void 0);let Xs=class{constructor(t={}){Object.assign(this,t)}};me([de({type:Mt.IA5String,context:0})],Xs.prototype,"spc",void 0),me([de({type:Zs,context:1})],Xs.prototype,"range",void 0),me([de({type:Mt.IA5String,context:2})],Xs.prototype,"one",void 0),Xs=me([pe({type:kt.Choice})],Xs);let Ys=Qs=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,Qs.prototype)}};Ys=Qs=me([pe({type:kt.Sequence,itemType:Xs})],Ys);
55
55
  /**
56
56
  * @license
57
57
  * Copyright (c) Peculiar Ventures, LLC.
@@ -67,7 +67,7 @@ var tn,en,rn=function(t,e,i){if(!e.has(t))throw new TypeError("attempted to set
67
67
  * This source code is licensed under the MIT license found in the
68
68
  * LICENSE file in the root directory of this source tree.
69
69
  */
70
- class on extends nn{constructor(t){super(t,$i);const e=this.getAsnExtnValue();try{switch(this.asn.extnID){case"1.3.6.1.5.5.7.1.1":this.value=ye.parse(e,He);break;case"2.5.29.35":this.value=ye.parse(e,_e);break;case"2.5.29.19":this.value=ye.parse(e,je);break;case"2.5.29.29":this.value=ye.parse(e,Ge);break;case"2.5.29.32":this.value=ye.parse(e,Xe);break;case"2.5.29.31":case"2.5.29.46":this.value=ye.parse(e,oi);break;case"2.5.29.21":this.value=ye.parse(e,hi);break;case"2.5.29.37":this.value=ye.parse(e,di);break;case"2.5.29.54":this.value=ye.parse(e,fi);break;case"2.5.29.24":this.value=ye.parse(e,yi);break;case"2.5.29.18":this.value=ye.parse(e,Ci);break;case"2.5.29.15":this.value=ye.parse(e,gi);break;case"2.5.29.30":this.value=ye.parse(e,wi);break;case"2.5.29.36":this.value=ye.parse(e,Pi);break;case"2.5.29.33":this.value=ye.parse(e,bi);break;case"2.5.29.17":this.value=ye.parse(e,Ti);break;case"2.5.29.9":this.value=ye.parse(e,Oi);break;case"2.5.29.14":this.value=ye.parse(e,Ni);break;case"1.3.6.1.5.5.7.1.3":this.value=ye.parse(e,Hr);break;case"1.3.6.1.4.1.311.21.7":this.value=ye.parse(e,Vr);break;case"1.3.6.1.4.1.311.20.2":this.value=ye.parse(e,Gr);break;case"2.16.840.1.113730.1.13":this.value=ye.parse(e,fs);break;case"2.16.840.1.113730.1.1":this.value=ye.parse(e,ds);break;case"1.3.6.1.4.1.311.21.1":this.value=ye.parse(e,$r);break;case"1.3.6.1.4.1.11129.2.4.2":this.value=ye.parse(e,Is);break;case"1.3.6.1.4.1.52266.1":this.value=ye.parse(e,ms);break;case"1.3.6.1.4.1.52266.2":this.value=ye.parse(e,gs);break;case"1.2.840.113583.1.1.9.1":this.value=ye.parse(e,xs);break;case"1.2.840.113583.1.1.9.2":this.value=ye.parse(e,Ts);break;case"2.5.29.16":this.value=ye.parse(e,ki);break;case"1.2.840.113533.7.65.0":this.value=ye.parse(e,Ui);break;case"2.16.724.1.2.2.4.1":case"1.3.6.1.5.5.7.1.2":this.value=ye.parse(e,Rr);break;case"1.3.6.1.5.5.7.1.12":this.value=ye.parse(e,Ls);break;case"1.3.6.1.5.5.7.1.26":this.value=ye.parse(e,Ys);break;case"1.3.6.1.5.5.7.1.11":this.value=ye.parse(e,_i);break;default:console.warn(`Didn't detect parser for "${this.asn.extnID}" extension.`),this.value=o.ToHex(e)}}catch(i){console.error(`Error parse "${this.asn.extnID}" extension:`,i.message),this.value=o.ToHex(e)}}getAsnExtnValue(){return this.asn.extnValue.buffer}}
70
+ class on extends nn{constructor(t){super(t,$i);const e=this.getAsnExtnValue();try{switch(this.asn.extnID){case"1.3.6.1.5.5.7.1.1":this.value=ye.parse(e,He);break;case"2.5.29.35":this.value=ye.parse(e,_e);break;case"2.5.29.19":this.value=ye.parse(e,je);break;case"2.5.29.29":this.value=ye.parse(e,Ge);break;case"2.5.29.32":this.value=ye.parse(e,Xe);break;case"2.5.29.31":case"2.5.29.46":this.value=ye.parse(e,oi);break;case"2.5.29.21":this.value=ye.parse(e,hi);break;case"2.5.29.37":this.value=ye.parse(e,di);break;case"2.5.29.54":this.value=ye.parse(e,fi);break;case"2.5.29.24":this.value=ye.parse(e,yi);break;case"2.5.29.18":this.value=ye.parse(e,Ci);break;case"2.5.29.15":this.value=ye.parse(e,gi);break;case"2.5.29.30":this.value=ye.parse(e,wi);break;case"2.5.29.36":this.value=ye.parse(e,Pi);break;case"2.5.29.33":this.value=ye.parse(e,Bi);break;case"2.5.29.17":this.value=ye.parse(e,Ti);break;case"2.5.29.9":this.value=ye.parse(e,Oi);break;case"2.5.29.14":this.value=ye.parse(e,Ni);break;case"1.3.6.1.5.5.7.1.3":this.value=ye.parse(e,Hr);break;case"1.3.6.1.4.1.311.21.7":this.value=ye.parse(e,Vr);break;case"1.3.6.1.4.1.311.20.2":this.value=ye.parse(e,Gr);break;case"2.16.840.1.113730.1.13":this.value=ye.parse(e,fs);break;case"2.16.840.1.113730.1.1":this.value=ye.parse(e,ds);break;case"1.3.6.1.4.1.311.21.1":this.value=ye.parse(e,$r);break;case"1.3.6.1.4.1.11129.2.4.2":this.value=ye.parse(e,Is);break;case"1.3.6.1.4.1.52266.1":this.value=ye.parse(e,ms);break;case"1.3.6.1.4.1.52266.2":this.value=ye.parse(e,gs);break;case"1.2.840.113583.1.1.9.1":this.value=ye.parse(e,xs);break;case"1.2.840.113583.1.1.9.2":this.value=ye.parse(e,Ts);break;case"2.5.29.16":this.value=ye.parse(e,ki);break;case"1.2.840.113533.7.65.0":this.value=ye.parse(e,Ui);break;case"2.16.724.1.2.2.4.1":case"1.3.6.1.5.5.7.1.2":this.value=ye.parse(e,Rr);break;case"1.3.6.1.5.5.7.1.12":this.value=ye.parse(e,Ls);break;case"1.3.6.1.5.5.7.1.26":this.value=ye.parse(e,Ys);break;case"1.3.6.1.5.5.7.1.11":this.value=ye.parse(e,_i);break;default:console.warn(`Didn't detect parser for "${this.asn.extnID}" extension.`),this.value=o.ToHex(e)}}catch(i){console.error(`Error parse "${this.asn.extnID}" extension:`,i.message),this.value=o.ToHex(e)}}getAsnExtnValue(){return this.asn.extnValue.buffer}}
71
71
  /**
72
72
  * @license
73
73
  * Copyright (c) Peculiar Ventures, LLC.
@@ -82,7 +82,7 @@ class on extends nn{constructor(t){super(t,$i);const e=this.getAsnExtnValue();tr
82
82
  * This source code is licensed under the MIT license found in the
83
83
  * LICENSE file in the root directory of this source tree.
84
84
  */
85
- class dn extends nn{constructor(t){super(hn(t),qi),this.thumbprints={},this.type="X.509 Certificate";const{tbsCertificate:e}=this.asn;this.serialNumber=o.ToHex(e.serialNumber),this.subject=new Ir(e.subject).toJSON(),this.issuer=new Ir(e.issuer).toJSON(),this.version=e.version+1;const i=e.validity.notBefore.utcTime||e.validity.notBefore.generalTime;if(!i)throw new Error("Cannot get 'notBefore' value");this.notBefore=i;const s=e.validity.notAfter.utcTime||e.validity.notAfter.generalTime;if(!s)throw new Error("Cannot get 'notAfter' value");this.notAfter=s,this.validity=r(this.notBefore,this.notAfter)}parseExtensions(){const{tbsCertificate:t}=this.asn;t.extensions&&(this.extensions=t.extensions.map(t=>new on(Ae.serialize(t))))}get publicKey(){const{subjectPublicKey:t,algorithm:e}=this.asn.tbsCertificate.subjectPublicKeyInfo;let i;return"1.2.840.10045.2.1"===e.algorithm&&e.parameters&&(i=Ae.parse(e.parameters,er)),"1.2.840.113549.1.1.1"===e.algorithm&&(i=Ae.parse(t,Cr)),{params:i,value:Ae.serialize(this.asn.tbsCertificate.subjectPublicKeyInfo),algorithm:e.algorithm}}get signature(){const{signatureValue:t,signatureAlgorithm:e}=this.asn;return{value:t,algorithm:e.algorithm}}exportAsBase64(){return o.ToBase64(this.raw)}exportAsHexFormatted(){return ln(o.ToHex(this.raw))}exportAsPemFormatted(){return`-----BEGIN CERTIFICATE-----\n${un(this.exportAsBase64())}\n-----END CERTIFICATE-----`}async getThumbprint(t="SHA-1"){try{const e=await pn(t,this.raw);this.thumbprints[t.name||t]=o.ToHex(e)}catch(e){console.error("Error thumbprint get:",e)}}get commonName(){if(!this.subject)return"";for(let t=0;t<this.subject.length;t+=1){const e=this.subject[t];if("CN"===e.shortName||"E"===e.shortName||"O"===e.shortName)return e.value}return""}get issuerCommonName(){if(!this.issuer)return"";for(let t=0;t<this.issuer.length;t+=1){const e=this.issuer[t];if("CN"===e.shortName)return e.value;if("E"===e.shortName)return e.value}return""}get isRoot(){return JSON.stringify(this.issuer)===JSON.stringify(this.subject)}subjectToString(){return this.subject?this.subject.map(t=>`${t.shortName}=${t.value}`).join(", "):""}issuerToString(){return this.issuer?this.issuer.map(t=>`${t.shortName}=${t.value}`).join(", "):""}}class fn{constructor(t={}){this.acIssuer=new ke,this.acSerial=0,this.attrs=[],Object.assign(this,t)}}var yn;me([de({type:ke})],fn.prototype,"acIssuer",void 0),me([de({type:Mt.Integer})],fn.prototype,"acSerial",void 0),me([de({type:xi,repeated:"sequence"})],fn.prototype,"attrs",void 0);let Sn=yn=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,yn.prototype)}};Sn=yn=me([pe({type:kt.Sequence,itemType:Mt.ObjectIdentifier})],Sn);class Cn{constructor(t={}){this.permitUnSpecified=!0,Object.assign(this,t)}}me([de({type:Mt.Integer,optional:!0})],Cn.prototype,"pathLenConstraint",void 0),me([de({type:Sn,implicit:!0,context:0,optional:!0})],Cn.prototype,"permittedAttrs",void 0),me([de({type:Sn,implicit:!0,context:1,optional:!0})],Cn.prototype,"excludedAttrs",void 0),me([de({type:Mt.Boolean,defaultValue:!0})],Cn.prototype,"permitUnSpecified",void 0);class An{constructor(t={}){this.issuer=new Ve,this.serial=new ArrayBuffer(0),this.issuerUID=new ArrayBuffer(0),Object.assign(this,t)}}var mn;me([de({type:Ve})],An.prototype,"issuer",void 0),me([de({type:Mt.Integer,converter:_t})],An.prototype,"serial",void 0),me([de({type:Mt.BitString,optional:!0})],An.prototype,"issuerUID",void 0),function(t){t[t.publicKey=0]="publicKey",t[t.publicKeyCert=1]="publicKeyCert",t[t.otherObjectTypes=2]="otherObjectTypes"}(mn||(mn={}));class gn{constructor(t={}){this.digestedObjectType=mn.publicKey,this.digestAlgorithm=new ji,this.objectDigest=new ArrayBuffer(0),Object.assign(this,t)}}me([de({type:Mt.Enumerated})],gn.prototype,"digestedObjectType",void 0),me([de({type:Mt.ObjectIdentifier,optional:!0})],gn.prototype,"otherObjectTypeID",void 0),me([de({type:ji})],gn.prototype,"digestAlgorithm",void 0),me([de({type:Mt.BitString})],gn.prototype,"objectDigest",void 0);class vn{constructor(t={}){Object.assign(this,t)}}me([de({type:Ve,optional:!0})],vn.prototype,"issuerName",void 0),me([de({type:An,context:0,implicit:!0,optional:!0})],vn.prototype,"baseCertificateID",void 0),me([de({type:gn,context:1,implicit:!0,optional:!0})],vn.prototype,"objectDigestInfo",void 0);let En=class{constructor(t={}){Object.assign(this,t)}};me([de({type:ke,repeated:"sequence"})],En.prototype,"v1Form",void 0),me([de({type:vn,context:0,implicit:!0})],En.prototype,"v2Form",void 0),En=me([pe({type:kt.Choice})],En);class wn{constructor(t={}){this.notBeforeTime=new Date,this.notAfterTime=new Date,Object.assign(this,t)}}me([de({type:Mt.GeneralizedTime})],wn.prototype,"notBeforeTime",void 0),me([de({type:Mt.GeneralizedTime})],wn.prototype,"notAfterTime",void 0);class Pn{constructor(t={}){Object.assign(this,t)}}var Dn,Bn,bn;me([de({type:An,implicit:!0,context:0,optional:!0})],Pn.prototype,"baseCertificateID",void 0),me([de({type:Ve,implicit:!0,context:1,optional:!0})],Pn.prototype,"entityName",void 0),me([de({type:gn,implicit:!0,context:2,optional:!0})],Pn.prototype,"objectDigestInfo",void 0),function(t){t[t.v2=1]="v2"}(Dn||(Dn={}));class In{constructor(t={}){this.version=Dn.v2,this.holder=new Pn,this.issuer=new En,this.signature=new ji,this.serialNumber=new ArrayBuffer(0),this.attrCertValidityPeriod=new wn,this.attributes=[],Object.assign(this,t)}}me([de({type:Mt.Integer})],In.prototype,"version",void 0),me([de({type:Pn})],In.prototype,"holder",void 0),me([de({type:En})],In.prototype,"issuer",void 0),me([de({type:ji})],In.prototype,"signature",void 0),me([de({type:Mt.Integer,converter:_t})],In.prototype,"serialNumber",void 0),me([de({type:wn})],In.prototype,"attrCertValidityPeriod",void 0),me([de({type:xi,repeated:"sequence"})],In.prototype,"attributes",void 0),me([de({type:Mt.BitString,optional:!0})],In.prototype,"issuerUniqueID",void 0),me([de({type:Qi,optional:!0})],In.prototype,"extensions",void 0);class Tn{constructor(t={}){this.acinfo=new In,this.signatureAlgorithm=new ji,this.signatureValue=new ArrayBuffer(0),Object.assign(this,t)}}me([de({type:In})],Tn.prototype,"acinfo",void 0),me([de({type:ji})],Tn.prototype,"signatureAlgorithm",void 0),me([de({type:Mt.BitString})],Tn.prototype,"signatureValue",void 0),function(t){t[t.unmarked=1]="unmarked",t[t.unclassified=2]="unclassified",t[t.restricted=4]="restricted",t[t.confidential=8]="confidential",t[t.secret=16]="secret",t[t.topSecret=32]="topSecret"}(Bn||(Bn={}));class xn extends ae{}class Rn{constructor(t={}){this.type="",this.value=new ArrayBuffer(0),Object.assign(this,t)}}me([de({type:Mt.ObjectIdentifier,implicit:!0,context:0})],Rn.prototype,"type",void 0),me([de({type:Mt.Any,implicit:!0,context:1})],Rn.prototype,"value",void 0);class On{constructor(t={}){this.policyId="",this.classList=new xn(Bn.unclassified),Object.assign(this,t)}}me([de({type:Mt.ObjectIdentifier})],On.prototype,"policyId",void 0),me([de({type:xn,defaultValue:new xn(Bn.unclassified)})],On.prototype,"classList",void 0),me([de({type:Rn,repeated:"set"})],On.prototype,"securityCategories",void 0);class Nn{constructor(t={}){Object.assign(this,t)}}me([de({type:ce})],Nn.prototype,"cotets",void 0),me([de({type:Mt.ObjectIdentifier})],Nn.prototype,"oid",void 0),me([de({type:Mt.Utf8String})],Nn.prototype,"string",void 0);class kn{constructor(t={}){this.values=[],Object.assign(this,t)}}me([de({type:Ve,implicit:!0,context:0,optional:!0})],kn.prototype,"policyAuthority",void 0),me([de({type:Nn,repeated:"sequence"})],kn.prototype,"values",void 0);class Mn{constructor(t={}){this.targetCertificate=new An,Object.assign(this,t)}}me([de({type:An})],Mn.prototype,"targetCertificate",void 0),me([de({type:ke,optional:!0})],Mn.prototype,"targetName",void 0),me([de({type:gn,optional:!0})],Mn.prototype,"certDigestInfo",void 0);let Kn=class{constructor(t={}){Object.assign(this,t)}};me([de({type:ke,context:0,implicit:!0})],Kn.prototype,"targetName",void 0),me([de({type:ke,context:1,implicit:!0})],Kn.prototype,"targetGroup",void 0),me([de({type:Mn,context:2,implicit:!0})],Kn.prototype,"targetCert",void 0),Kn=me([pe({type:kt.Choice})],Kn);let Hn=bn=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,bn.prototype)}};var Un;Hn=bn=me([pe({type:kt.Sequence,itemType:Kn})],Hn);let _n=Un=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,Un.prototype)}};_n=Un=me([pe({type:kt.Sequence,itemType:Hn})],_n);class jn{constructor(t={}){Object.assign(this,t)}}me([de({type:Ve,implicit:!0,context:0,optional:!0})],jn.prototype,"roleAuthority",void 0),me([de({type:ke,implicit:!0,context:1})],jn.prototype,"roleName",void 0);class Fn{constructor(t={}){this.service=new ke,this.ident=new ke,Object.assign(this,t)}}me([de({type:ke})],Fn.prototype,"service",void 0),me([de({type:ke})],Fn.prototype,"ident",void 0),me([de({type:ce,optional:!0})],Fn.prototype,"authInfo",void 0);const Vn="0.4.0.9496.6";let Ln=class{constructor(t={}){this.codeAuthority=new ke,this.codeId=new ke,this.shortName="",this.shortDescription="",Object.assign(this,t)}};me([de({type:ke,context:0})],Ln.prototype,"codeAuthority",void 0),me([de({type:ke,context:1})],Ln.prototype,"codeId",void 0),me([de({type:Mt.Utf8String,context:2})],Ln.prototype,"shortName",void 0),me([de({type:Mt.Utf8String,context:3})],Ln.prototype,"shortDescription",void 0),Ln=me([pe({type:kt.Sequence})],Ln);let Gn=class extends xe{constructor(t){super(t),Object.setPrototypeOf(this,xe.prototype)}};Gn=me([pe({type:kt.Sequence})],Gn);const $n="0.4.0.9496.1";let Qn=class extends Gn{constructor(t){super(t),Object.setPrototypeOf(this,xe.prototype)}};Qn=me([pe({type:kt.Sequence})],Qn);const Wn="0.4.0.9496.2";let zn=class extends Gn{constructor(t){super(t),Object.setPrototypeOf(this,xe.prototype)}};zn=me([pe({type:kt.Sequence})],zn);const qn="0.4.0.9496.3";let Jn=class extends Gn{constructor(t){super(t),Object.setPrototypeOf(this,xe.prototype)}};Jn=me([pe({type:kt.Sequence})],Jn);const Zn="0.4.0.9496.4";let Xn=class extends Gn{constructor(t){super(t),Object.setPrototypeOf(this,xe.prototype)}};Xn=me([pe({type:kt.Sequence})],Xn);const Yn="0.4.0.9496.8";let to=class{constructor(t={}){this.location="",this.base=0,this.degree=0,Object.assign(this,t)}toString(){return`${this.base} x 10^${this.degree} ${this.location}`}};me([de({type:Mt.PrintableString})],to.prototype,"location",void 0),me([de({type:Mt.Integer})],to.prototype,"base",void 0),me([de({type:Mt.Integer})],to.prototype,"degree",void 0),to=me([pe({type:kt.Sequence})],to);const eo="0.4.0.9496.9";let io=class{constructor(t={}){this.stars5=0,this.stars4=0,this.stars3=0,this.stars2=0,this.stars1=0,Object.assign(this,t)}};me([de({type:Mt.Integer})],io.prototype,"stars5",void 0),me([de({type:Mt.Integer})],io.prototype,"stars4",void 0),me([de({type:Mt.Integer})],io.prototype,"stars3",void 0),me([de({type:Mt.Integer})],io.prototype,"stars2",void 0),me([de({type:Mt.Integer})],io.prototype,"stars1",void 0),io=me([pe({type:kt.Sequence})],io);const ro="0.4.0.9496.5";let so=class{constructor(t={}){this.DNBvsDNO=new ae(0),this.DNBvsDNT=new ae(0),this.DNOvsDNT=new ae(0),Object.assign(this,t)}};me([de({type:ae,context:0})],so.prototype,"DNBvsDNO",void 0),me([de({type:ae,context:1})],so.prototype,"DNBvsDNT",void 0),me([de({type:ae,context:2})],so.prototype,"DNOvsDNT",void 0),so=me([pe({type:kt.Sequence})],so);const no="0.4.0.9496.7";let oo=class{constructor(t={}){this.assessmentAuthority=new ke,this.assessmentRef=new ke,this.assessmentLocation=new ke,this.dataStorageTerritory="",this.description="",Object.assign(this,t)}};me([de({type:ke,context:0})],oo.prototype,"assessmentAuthority",void 0),me([de({type:ke,context:1})],oo.prototype,"assessmentRef",void 0),me([de({type:ke,context:2})],oo.prototype,"assessmentLocation",void 0),me([de({type:Mt.PrintableString,context:3})],oo.prototype,"dataStorageTerritory",void 0),me([de({type:Mt.Utf8String,context:4})],oo.prototype,"description",void 0),oo=me([pe({type:kt.Sequence})],oo);class ao{constructor(t={}){this.attrType="",this.attrValues=[],Object.assign(this,t)}}var co;me([de({type:Mt.ObjectIdentifier})],ao.prototype,"attrType",void 0),me([de({type:Mt.Any,repeated:"set"})],ao.prototype,"attrValues",void 0);class lo{constructor(t={}){this.otherCertFormat="",this.otherCert=new ArrayBuffer(0),Object.assign(this,t)}}me([de({type:Mt.ObjectIdentifier})],lo.prototype,"otherCertFormat",void 0),me([de({type:Mt.Any})],lo.prototype,"otherCert",void 0);let uo=class{constructor(t={}){Object.assign(this,t)}};me([de({type:qi})],uo.prototype,"certificate",void 0),me([de({type:Tn,context:2,implicit:!0})],uo.prototype,"v2AttrCert",void 0),me([de({type:lo,context:3,implicit:!0})],uo.prototype,"other",void 0),uo=me([pe({type:kt.Choice})],uo);let ho=co=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,co.prototype)}};ho=co=me([pe({type:kt.Set,itemType:uo})],ho);class po{constructor(t={}){this.contentType="",this.content=new ArrayBuffer(0),Object.assign(this,t)}}me([de({type:Mt.ObjectIdentifier})],po.prototype,"contentType",void 0),me([de({type:Mt.Any,context:0})],po.prototype,"content",void 0);let fo=class{constructor(t={}){Object.assign(this,t)}};me([de({type:ce})],fo.prototype,"single",void 0),me([de({type:Mt.Any})],fo.prototype,"any",void 0),fo=me([pe({type:kt.Choice})],fo);class yo{constructor(t={}){this.eContentType="",Object.assign(this,t)}}me([de({type:Mt.ObjectIdentifier})],yo.prototype,"eContentType",void 0),me([de({type:fo,context:0,optional:!0})],yo.prototype,"eContent",void 0);class So{constructor(t={}){this.issuer=new xe,this.serialNumber=new ArrayBuffer(0),Object.assign(this,t)}}var Co;me([de({type:xe})],So.prototype,"issuer",void 0),me([de({type:Mt.Integer,converter:_t})],So.prototype,"serialNumber",void 0);class Ao{constructor(t={}){this.otherRevInfoFormat="",this.otherRevInfo=new ArrayBuffer(0),Object.assign(this,t)}}me([de({type:Mt.ObjectIdentifier})],Ao.prototype,"otherRevInfoFormat",void 0),me([de({type:Mt.Any})],Ao.prototype,"otherRevInfo",void 0);let mo=class{constructor(t={}){this.other=new Ao,Object.assign(this,t)}};me([de({type:Ao,context:1,implicit:!0})],mo.prototype,"other",void 0),mo=me([pe({type:kt.Choice})],mo);let go=Co=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,Co.prototype)}};var vo;go=Co=me([pe({type:kt.Set,itemType:mo})],go),function(t){t[t.v0=0]="v0",t[t.v1=1]="v1",t[t.v2=2]="v2",t[t.v3=3]="v3",t[t.v4=4]="v4",t[t.v5=5]="v5"}(vo||(vo={}));let Eo=class extends ji{};Eo=me([pe({type:kt.Sequence})],Eo);let wo=class extends ji{};wo=me([pe({type:kt.Sequence})],wo);let Po=class{constructor(t={}){Object.assign(this,t)}};var Do;me([de({type:Ni,context:0,implicit:!0})],Po.prototype,"subjectKeyIdentifier",void 0),me([de({type:So})],Po.prototype,"issuerAndSerialNumber",void 0),Po=me([pe({type:kt.Choice})],Po);class Bo{constructor(t={}){this.version=vo.v0,this.sid=new Po,this.digestAlgorithm=new Eo,this.signatureAlgorithm=new wo,this.signature=new ce,Object.assign(this,t)}}me([de({type:Mt.Integer})],Bo.prototype,"version",void 0),me([de({type:Po})],Bo.prototype,"sid",void 0),me([de({type:Eo})],Bo.prototype,"digestAlgorithm",void 0),me([de({type:ao,repeated:"set",context:0,implicit:!0,optional:!0})],Bo.prototype,"signedAttrs",void 0),me([de({type:wo})],Bo.prototype,"signatureAlgorithm",void 0),me([de({type:ce})],Bo.prototype,"signature",void 0),me([de({type:ao,repeated:"set",context:1,implicit:!0,optional:!0})],Bo.prototype,"unsignedAttrs",void 0);let bo=Do=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,Do.prototype)}};var Io;bo=Do=me([pe({type:kt.Set,itemType:Bo})],bo);let To=Io=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,Io.prototype)}};To=Io=me([pe({type:kt.Set,itemType:Eo})],To);class xo{constructor(t={}){this.version=vo.v0,this.digestAlgorithms=new To,this.encapContentInfo=new yo,this.signerInfos=new bo,Object.assign(this,t)}}var Ro;me([de({type:Mt.Integer})],xo.prototype,"version",void 0),me([de({type:To})],xo.prototype,"digestAlgorithms",void 0),me([de({type:yo})],xo.prototype,"encapContentInfo",void 0),me([de({type:ho,context:0,implicit:!0,optional:!0})],xo.prototype,"certificates",void 0),me([de({type:mo,context:1,implicit:!0,optional:!0})],xo.prototype,"crls",void 0),me([de({type:bo})],xo.prototype,"signerInfos",void 0);class Oo{constructor(t={}){this.attrId="",this.attrValues=[],Object.assign(t)}}me([de({type:Mt.ObjectIdentifier})],Oo.prototype,"attrId",void 0),me([de({type:Mt.Any,repeated:"set"})],Oo.prototype,"attrValues",void 0);let No=Ro=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,Ro.prototype)}};var ko;No=Ro=me([pe({type:kt.Sequence,itemType:Oo})],No);let Mo=ko=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,ko.prototype)}};Mo=ko=me([pe({type:kt.Sequence,itemType:po})],Mo);class Ko{constructor(t={}){this.certId="",this.certValue=new ArrayBuffer(0),Object.assign(this,t)}}me([de({type:Mt.ObjectIdentifier})],Ko.prototype,"certId",void 0),me([de({type:Mt.Any,context:0})],Ko.prototype,"certValue",void 0);class Ho{constructor(t={}){this.crlId="",this.crltValue=new ArrayBuffer(0),Object.assign(this,t)}}me([de({type:Mt.ObjectIdentifier})],Ho.prototype,"crlId",void 0),me([de({type:Mt.Any,context:0})],Ho.prototype,"crltValue",void 0);class Uo extends ce{}class _o{constructor(t={}){this.encryptionAlgorithm=new ji,this.encryptedData=new Uo,Object.assign(this,t)}}var jo,Fo;me([de({type:ji})],_o.prototype,"encryptionAlgorithm",void 0),me([de({type:Uo})],_o.prototype,"encryptedData",void 0),function(t){t[t.v1=0]="v1"}(Fo||(Fo={}));class Vo extends ce{}let Lo=jo=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,jo.prototype)}};Lo=jo=me([pe({type:kt.Sequence,itemType:xi})],Lo);class Go{constructor(t={}){this.version=Fo.v1,this.privateKeyAlgorithm=new ji,this.privateKey=new Vo,Object.assign(this,t)}}me([de({type:Mt.Integer})],Go.prototype,"version",void 0),me([de({type:ji})],Go.prototype,"privateKeyAlgorithm",void 0),me([de({type:Vo})],Go.prototype,"privateKey",void 0),me([de({type:Lo,implicit:!0,context:0,optional:!0})],Go.prototype,"attributes",void 0);let $o=class extends Go{};$o=me([pe({type:kt.Sequence})],$o);let Qo=class extends _o{};Qo=me([pe({type:kt.Sequence})],Qo);class Wo{constructor(t={}){this.secretTypeId="",this.secretValue=new ArrayBuffer(0),Object.assign(this,t)}}me([de({type:Mt.ObjectIdentifier})],Wo.prototype,"secretTypeId",void 0),me([de({type:Mt.Any,context:0})],Wo.prototype,"secretValue",void 0);class zo{constructor(t={}){this.mac=new pr,this.macSalt=new ce,this.iterations=1,Object.assign(this,t)}}me([de({type:pr})],zo.prototype,"mac",void 0),me([de({type:ce})],zo.prototype,"macSalt",void 0),me([de({type:Mt.Integer,defaultValue:1})],zo.prototype,"iterations",void 0);class qo{constructor(t={}){this.version=3,this.authSafe=new po,this.macData=new zo,Object.assign(this,t)}}var Jo;me([de({type:Mt.Integer})],qo.prototype,"version",void 0),me([de({type:po})],qo.prototype,"authSafe",void 0),me([de({type:zo,optional:!0})],qo.prototype,"macData",void 0);class Zo{constructor(t={}){this.bagId="",this.bagValue=new ArrayBuffer(0),Object.assign(this,t)}}me([de({type:Mt.ObjectIdentifier})],Zo.prototype,"bagId",void 0),me([de({type:Mt.Any,context:0})],Zo.prototype,"bagValue",void 0),me([de({type:Oo,repeated:"set",optional:!0})],Zo.prototype,"bagAttributes",void 0);let Xo=Jo=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,Jo.prototype)}};var Yo,ta,ea;Xo=Jo=me([pe({type:kt.Sequence,itemType:Zo})],Xo);const ia="1.2.840.113549.1.9",ra=ia+".2",sa=ia+".7",na=ia+".14";let oa=class extends De{constructor(t={}){super(t)}toString(){return{}.toString(),this.ia5String||super.toString()}};me([de({type:Mt.IA5String})],oa.prototype,"ia5String",void 0),oa=me([pe({type:kt.Choice})],oa);let aa=class extends po{};aa=me([pe({type:kt.Sequence})],aa);let ca=class extends qo{};ca=me([pe({type:kt.Sequence})],ca);let la=class extends _o{};la=me([pe({type:kt.Sequence})],la);let ua=class{constructor(t=""){this.value=t}toString(){return this.value}};me([de({type:Mt.IA5String})],ua.prototype,"value",void 0),ua=me([pe({type:kt.Choice})],ua);let ha=class extends oa{};ha=me([pe({type:kt.Choice})],ha);let pa=class extends De{};pa=me([pe({type:kt.Choice})],pa);let da=class{constructor(t=new Date){this.value=t}};me([de({type:Mt.GeneralizedTime})],da.prototype,"value",void 0),da=me([pe({type:kt.Choice})],da);let fa=class extends De{};fa=me([pe({type:kt.Choice})],fa);let ya=class{constructor(t="M"){this.value=t}toString(){return this.value}};me([de({type:Mt.PrintableString})],ya.prototype,"value",void 0),ya=me([pe({type:kt.Choice})],ya);let Sa=class{constructor(t=""){this.value=t}toString(){return this.value}};me([de({type:Mt.PrintableString})],Sa.prototype,"value",void 0),Sa=me([pe({type:kt.Choice})],Sa);let Ca=class extends Sa{};Ca=me([pe({type:kt.Choice})],Ca);let Aa=class extends De{};Aa=me([pe({type:kt.Choice})],Aa);let ma=class{constructor(t=""){this.value=t}toString(){return this.value}};me([de({type:Mt.ObjectIdentifier})],ma.prototype,"value",void 0),ma=me([pe({type:kt.Choice})],ma);let ga=class extends Vi{};ga=me([pe({type:kt.Choice})],ga);let va=class{constructor(t=0){this.value=t}toString(){return this.value.toString()}};me([de({type:Mt.Integer})],va.prototype,"value",void 0),va=me([pe({type:kt.Choice})],va);let Ea=class extends Bo{};Ea=me([pe({type:kt.Sequence})],Ea);let wa=class extends De{};wa=me([pe({type:kt.Choice})],wa);let Pa=Yo=class extends Qi{constructor(t){super(t),Object.setPrototypeOf(this,Yo.prototype)}};Pa=Yo=me([pe({type:kt.Sequence})],Pa);let Da=ta=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,ta.prototype)}};Da=ta=me([pe({type:kt.Set,itemType:ao})],Da);let Ba=class{constructor(t=""){this.value=t}toString(){return this.value}};me([de({type:Mt.BmpString})],Ba.prototype,"value",void 0),Ba=me([pe({type:kt.Choice})],Ba);let ba=class extends ji{};ba=me([pe({type:kt.Sequence})],ba);let Ia=ea=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,ea.prototype)}};var Ta;Ia=ea=me([pe({type:kt.Sequence,itemType:ba})],Ia);let xa=Ta=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,Ta.prototype)}};xa=Ta=me([pe({type:kt.Sequence,itemType:xi})],xa);class Ra{constructor(t={}){this.version=0,this.subject=new xe,this.subjectPKInfo=new Fi,this.attributes=new xa,Object.assign(this,t)}}me([de({type:Mt.Integer})],Ra.prototype,"version",void 0),me([de({type:xe})],Ra.prototype,"subject",void 0),me([de({type:Fi})],Ra.prototype,"subjectPKInfo",void 0),me([de({type:xa,implicit:!0,context:0})],Ra.prototype,"attributes",void 0);class Oa{constructor(t={}){this.certificationRequestInfo=new Ra,this.signatureAlgorithm=new ji,this.signature=new ArrayBuffer(0),Object.assign(this,t)}}
85
+ class dn extends nn{constructor(t){super(hn(t),qi),this.thumbprints={},this.type="X.509 Certificate";const{tbsCertificate:e}=this.asn;this.serialNumber=o.ToHex(e.serialNumber),this.subject=new Ir(e.subject).toJSON(),this.issuer=new Ir(e.issuer).toJSON(),this.version=e.version+1;const i=e.validity.notBefore.utcTime||e.validity.notBefore.generalTime;if(!i)throw new Error("Cannot get 'notBefore' value");this.notBefore=i;const s=e.validity.notAfter.utcTime||e.validity.notAfter.generalTime;if(!s)throw new Error("Cannot get 'notAfter' value");this.notAfter=s,this.validity=r(this.notBefore,this.notAfter)}parseExtensions(){const{tbsCertificate:t}=this.asn;t.extensions&&(this.extensions=t.extensions.map(t=>new on(Ae.serialize(t))))}get publicKey(){const{subjectPublicKey:t,algorithm:e}=this.asn.tbsCertificate.subjectPublicKeyInfo;let i;return"1.2.840.10045.2.1"===e.algorithm&&e.parameters&&(i=Ae.parse(e.parameters,er)),"1.2.840.113549.1.1.1"===e.algorithm&&(i=Ae.parse(t,Cr)),{params:i,value:Ae.serialize(this.asn.tbsCertificate.subjectPublicKeyInfo),algorithm:e.algorithm}}get signature(){const{signatureValue:t,signatureAlgorithm:e}=this.asn;return{value:t,algorithm:e.algorithm}}exportAsBase64(){return o.ToBase64(this.raw)}exportAsHexFormatted(){return ln(o.ToHex(this.raw))}exportAsPemFormatted(){return`-----BEGIN CERTIFICATE-----\n${un(this.exportAsBase64())}\n-----END CERTIFICATE-----`}async getThumbprint(t="SHA-1"){try{const e=await pn(t,this.raw);this.thumbprints[t.name||t]=o.ToHex(e)}catch(e){console.error("Error thumbprint get:",e)}}get commonName(){if(!this.subject)return"";for(let t=0;t<this.subject.length;t+=1){const e=this.subject[t];if("CN"===e.shortName||"E"===e.shortName||"O"===e.shortName)return e.value}return""}get issuerCommonName(){if(!this.issuer)return"";for(let t=0;t<this.issuer.length;t+=1){const e=this.issuer[t];if("CN"===e.shortName)return e.value;if("E"===e.shortName)return e.value}return""}get isRoot(){return JSON.stringify(this.issuer)===JSON.stringify(this.subject)}subjectToString(){return this.subject?this.subject.map(t=>`${t.shortName}=${t.value}`).join(", "):""}issuerToString(){return this.issuer?this.issuer.map(t=>`${t.shortName}=${t.value}`).join(", "):""}}class fn{constructor(t={}){this.acIssuer=new ke,this.acSerial=0,this.attrs=[],Object.assign(this,t)}}var yn;me([de({type:ke})],fn.prototype,"acIssuer",void 0),me([de({type:Mt.Integer})],fn.prototype,"acSerial",void 0),me([de({type:xi,repeated:"sequence"})],fn.prototype,"attrs",void 0);let Sn=yn=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,yn.prototype)}};Sn=yn=me([pe({type:kt.Sequence,itemType:Mt.ObjectIdentifier})],Sn);class Cn{constructor(t={}){this.permitUnSpecified=!0,Object.assign(this,t)}}me([de({type:Mt.Integer,optional:!0})],Cn.prototype,"pathLenConstraint",void 0),me([de({type:Sn,implicit:!0,context:0,optional:!0})],Cn.prototype,"permittedAttrs",void 0),me([de({type:Sn,implicit:!0,context:1,optional:!0})],Cn.prototype,"excludedAttrs",void 0),me([de({type:Mt.Boolean,defaultValue:!0})],Cn.prototype,"permitUnSpecified",void 0);class An{constructor(t={}){this.issuer=new Ve,this.serial=new ArrayBuffer(0),this.issuerUID=new ArrayBuffer(0),Object.assign(this,t)}}var mn;me([de({type:Ve})],An.prototype,"issuer",void 0),me([de({type:Mt.Integer,converter:_t})],An.prototype,"serial",void 0),me([de({type:Mt.BitString,optional:!0})],An.prototype,"issuerUID",void 0),function(t){t[t.publicKey=0]="publicKey",t[t.publicKeyCert=1]="publicKeyCert",t[t.otherObjectTypes=2]="otherObjectTypes"}(mn||(mn={}));class gn{constructor(t={}){this.digestedObjectType=mn.publicKey,this.digestAlgorithm=new ji,this.objectDigest=new ArrayBuffer(0),Object.assign(this,t)}}me([de({type:Mt.Enumerated})],gn.prototype,"digestedObjectType",void 0),me([de({type:Mt.ObjectIdentifier,optional:!0})],gn.prototype,"otherObjectTypeID",void 0),me([de({type:ji})],gn.prototype,"digestAlgorithm",void 0),me([de({type:Mt.BitString})],gn.prototype,"objectDigest",void 0);class vn{constructor(t={}){Object.assign(this,t)}}me([de({type:Ve,optional:!0})],vn.prototype,"issuerName",void 0),me([de({type:An,context:0,implicit:!0,optional:!0})],vn.prototype,"baseCertificateID",void 0),me([de({type:gn,context:1,implicit:!0,optional:!0})],vn.prototype,"objectDigestInfo",void 0);let En=class{constructor(t={}){Object.assign(this,t)}};me([de({type:ke,repeated:"sequence"})],En.prototype,"v1Form",void 0),me([de({type:vn,context:0,implicit:!0})],En.prototype,"v2Form",void 0),En=me([pe({type:kt.Choice})],En);class wn{constructor(t={}){this.notBeforeTime=new Date,this.notAfterTime=new Date,Object.assign(this,t)}}me([de({type:Mt.GeneralizedTime})],wn.prototype,"notBeforeTime",void 0),me([de({type:Mt.GeneralizedTime})],wn.prototype,"notAfterTime",void 0);class Pn{constructor(t={}){Object.assign(this,t)}}var Dn,bn,Bn;me([de({type:An,implicit:!0,context:0,optional:!0})],Pn.prototype,"baseCertificateID",void 0),me([de({type:Ve,implicit:!0,context:1,optional:!0})],Pn.prototype,"entityName",void 0),me([de({type:gn,implicit:!0,context:2,optional:!0})],Pn.prototype,"objectDigestInfo",void 0),function(t){t[t.v2=1]="v2"}(Dn||(Dn={}));class In{constructor(t={}){this.version=Dn.v2,this.holder=new Pn,this.issuer=new En,this.signature=new ji,this.serialNumber=new ArrayBuffer(0),this.attrCertValidityPeriod=new wn,this.attributes=[],Object.assign(this,t)}}me([de({type:Mt.Integer})],In.prototype,"version",void 0),me([de({type:Pn})],In.prototype,"holder",void 0),me([de({type:En})],In.prototype,"issuer",void 0),me([de({type:ji})],In.prototype,"signature",void 0),me([de({type:Mt.Integer,converter:_t})],In.prototype,"serialNumber",void 0),me([de({type:wn})],In.prototype,"attrCertValidityPeriod",void 0),me([de({type:xi,repeated:"sequence"})],In.prototype,"attributes",void 0),me([de({type:Mt.BitString,optional:!0})],In.prototype,"issuerUniqueID",void 0),me([de({type:Qi,optional:!0})],In.prototype,"extensions",void 0);class Tn{constructor(t={}){this.acinfo=new In,this.signatureAlgorithm=new ji,this.signatureValue=new ArrayBuffer(0),Object.assign(this,t)}}me([de({type:In})],Tn.prototype,"acinfo",void 0),me([de({type:ji})],Tn.prototype,"signatureAlgorithm",void 0),me([de({type:Mt.BitString})],Tn.prototype,"signatureValue",void 0),function(t){t[t.unmarked=1]="unmarked",t[t.unclassified=2]="unclassified",t[t.restricted=4]="restricted",t[t.confidential=8]="confidential",t[t.secret=16]="secret",t[t.topSecret=32]="topSecret"}(bn||(bn={}));class xn extends ae{}class Rn{constructor(t={}){this.type="",this.value=new ArrayBuffer(0),Object.assign(this,t)}}me([de({type:Mt.ObjectIdentifier,implicit:!0,context:0})],Rn.prototype,"type",void 0),me([de({type:Mt.Any,implicit:!0,context:1})],Rn.prototype,"value",void 0);class On{constructor(t={}){this.policyId="",this.classList=new xn(bn.unclassified),Object.assign(this,t)}}me([de({type:Mt.ObjectIdentifier})],On.prototype,"policyId",void 0),me([de({type:xn,defaultValue:new xn(bn.unclassified)})],On.prototype,"classList",void 0),me([de({type:Rn,repeated:"set"})],On.prototype,"securityCategories",void 0);class Nn{constructor(t={}){Object.assign(this,t)}}me([de({type:ce})],Nn.prototype,"cotets",void 0),me([de({type:Mt.ObjectIdentifier})],Nn.prototype,"oid",void 0),me([de({type:Mt.Utf8String})],Nn.prototype,"string",void 0);class kn{constructor(t={}){this.values=[],Object.assign(this,t)}}me([de({type:Ve,implicit:!0,context:0,optional:!0})],kn.prototype,"policyAuthority",void 0),me([de({type:Nn,repeated:"sequence"})],kn.prototype,"values",void 0);class Mn{constructor(t={}){this.targetCertificate=new An,Object.assign(this,t)}}me([de({type:An})],Mn.prototype,"targetCertificate",void 0),me([de({type:ke,optional:!0})],Mn.prototype,"targetName",void 0),me([de({type:gn,optional:!0})],Mn.prototype,"certDigestInfo",void 0);let Kn=class{constructor(t={}){Object.assign(this,t)}};me([de({type:ke,context:0,implicit:!0})],Kn.prototype,"targetName",void 0),me([de({type:ke,context:1,implicit:!0})],Kn.prototype,"targetGroup",void 0),me([de({type:Mn,context:2,implicit:!0})],Kn.prototype,"targetCert",void 0),Kn=me([pe({type:kt.Choice})],Kn);let Hn=Bn=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,Bn.prototype)}};var Un;Hn=Bn=me([pe({type:kt.Sequence,itemType:Kn})],Hn);let _n=Un=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,Un.prototype)}};_n=Un=me([pe({type:kt.Sequence,itemType:Hn})],_n);class jn{constructor(t={}){Object.assign(this,t)}}me([de({type:Ve,implicit:!0,context:0,optional:!0})],jn.prototype,"roleAuthority",void 0),me([de({type:ke,implicit:!0,context:1})],jn.prototype,"roleName",void 0);class Fn{constructor(t={}){this.service=new ke,this.ident=new ke,Object.assign(this,t)}}me([de({type:ke})],Fn.prototype,"service",void 0),me([de({type:ke})],Fn.prototype,"ident",void 0),me([de({type:ce,optional:!0})],Fn.prototype,"authInfo",void 0);const Vn="0.4.0.9496.6";let Ln=class{constructor(t={}){this.codeAuthority=new ke,this.codeId=new ke,this.shortName="",this.shortDescription="",Object.assign(this,t)}};me([de({type:ke,context:0})],Ln.prototype,"codeAuthority",void 0),me([de({type:ke,context:1})],Ln.prototype,"codeId",void 0),me([de({type:Mt.Utf8String,context:2})],Ln.prototype,"shortName",void 0),me([de({type:Mt.Utf8String,context:3})],Ln.prototype,"shortDescription",void 0),Ln=me([pe({type:kt.Sequence})],Ln);let Gn=class extends xe{constructor(t){super(t),Object.setPrototypeOf(this,xe.prototype)}};Gn=me([pe({type:kt.Sequence})],Gn);const $n="0.4.0.9496.1";let Qn=class extends Gn{constructor(t){super(t),Object.setPrototypeOf(this,xe.prototype)}};Qn=me([pe({type:kt.Sequence})],Qn);const Wn="0.4.0.9496.2";let zn=class extends Gn{constructor(t){super(t),Object.setPrototypeOf(this,xe.prototype)}};zn=me([pe({type:kt.Sequence})],zn);const qn="0.4.0.9496.3";let Jn=class extends Gn{constructor(t){super(t),Object.setPrototypeOf(this,xe.prototype)}};Jn=me([pe({type:kt.Sequence})],Jn);const Zn="0.4.0.9496.4";let Xn=class extends Gn{constructor(t){super(t),Object.setPrototypeOf(this,xe.prototype)}};Xn=me([pe({type:kt.Sequence})],Xn);const Yn="0.4.0.9496.8";let to=class{constructor(t={}){this.location="",this.base=0,this.degree=0,Object.assign(this,t)}toString(){return`${this.base} x 10^${this.degree} ${this.location}`}};me([de({type:Mt.PrintableString})],to.prototype,"location",void 0),me([de({type:Mt.Integer})],to.prototype,"base",void 0),me([de({type:Mt.Integer})],to.prototype,"degree",void 0),to=me([pe({type:kt.Sequence})],to);const eo="0.4.0.9496.9";let io=class{constructor(t={}){this.stars5=0,this.stars4=0,this.stars3=0,this.stars2=0,this.stars1=0,Object.assign(this,t)}};me([de({type:Mt.Integer})],io.prototype,"stars5",void 0),me([de({type:Mt.Integer})],io.prototype,"stars4",void 0),me([de({type:Mt.Integer})],io.prototype,"stars3",void 0),me([de({type:Mt.Integer})],io.prototype,"stars2",void 0),me([de({type:Mt.Integer})],io.prototype,"stars1",void 0),io=me([pe({type:kt.Sequence})],io);const ro="0.4.0.9496.5";let so=class{constructor(t={}){this.DNBvsDNO=new ae(0),this.DNBvsDNT=new ae(0),this.DNOvsDNT=new ae(0),Object.assign(this,t)}};me([de({type:ae,context:0})],so.prototype,"DNBvsDNO",void 0),me([de({type:ae,context:1})],so.prototype,"DNBvsDNT",void 0),me([de({type:ae,context:2})],so.prototype,"DNOvsDNT",void 0),so=me([pe({type:kt.Sequence})],so);const no="0.4.0.9496.7";let oo=class{constructor(t={}){this.assessmentAuthority=new ke,this.assessmentRef=new ke,this.assessmentLocation=new ke,this.dataStorageTerritory="",this.description="",Object.assign(this,t)}};me([de({type:ke,context:0})],oo.prototype,"assessmentAuthority",void 0),me([de({type:ke,context:1})],oo.prototype,"assessmentRef",void 0),me([de({type:ke,context:2})],oo.prototype,"assessmentLocation",void 0),me([de({type:Mt.PrintableString,context:3})],oo.prototype,"dataStorageTerritory",void 0),me([de({type:Mt.Utf8String,context:4})],oo.prototype,"description",void 0),oo=me([pe({type:kt.Sequence})],oo);class ao{constructor(t={}){this.attrType="",this.attrValues=[],Object.assign(this,t)}}var co;me([de({type:Mt.ObjectIdentifier})],ao.prototype,"attrType",void 0),me([de({type:Mt.Any,repeated:"set"})],ao.prototype,"attrValues",void 0);class lo{constructor(t={}){this.otherCertFormat="",this.otherCert=new ArrayBuffer(0),Object.assign(this,t)}}me([de({type:Mt.ObjectIdentifier})],lo.prototype,"otherCertFormat",void 0),me([de({type:Mt.Any})],lo.prototype,"otherCert",void 0);let uo=class{constructor(t={}){Object.assign(this,t)}};me([de({type:qi})],uo.prototype,"certificate",void 0),me([de({type:Tn,context:2,implicit:!0})],uo.prototype,"v2AttrCert",void 0),me([de({type:lo,context:3,implicit:!0})],uo.prototype,"other",void 0),uo=me([pe({type:kt.Choice})],uo);let ho=co=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,co.prototype)}};ho=co=me([pe({type:kt.Set,itemType:uo})],ho);class po{constructor(t={}){this.contentType="",this.content=new ArrayBuffer(0),Object.assign(this,t)}}me([de({type:Mt.ObjectIdentifier})],po.prototype,"contentType",void 0),me([de({type:Mt.Any,context:0})],po.prototype,"content",void 0);let fo=class{constructor(t={}){Object.assign(this,t)}};me([de({type:ce})],fo.prototype,"single",void 0),me([de({type:Mt.Any})],fo.prototype,"any",void 0),fo=me([pe({type:kt.Choice})],fo);class yo{constructor(t={}){this.eContentType="",Object.assign(this,t)}}me([de({type:Mt.ObjectIdentifier})],yo.prototype,"eContentType",void 0),me([de({type:fo,context:0,optional:!0})],yo.prototype,"eContent",void 0);class So{constructor(t={}){this.issuer=new xe,this.serialNumber=new ArrayBuffer(0),Object.assign(this,t)}}var Co;me([de({type:xe})],So.prototype,"issuer",void 0),me([de({type:Mt.Integer,converter:_t})],So.prototype,"serialNumber",void 0);class Ao{constructor(t={}){this.otherRevInfoFormat="",this.otherRevInfo=new ArrayBuffer(0),Object.assign(this,t)}}me([de({type:Mt.ObjectIdentifier})],Ao.prototype,"otherRevInfoFormat",void 0),me([de({type:Mt.Any})],Ao.prototype,"otherRevInfo",void 0);let mo=class{constructor(t={}){this.other=new Ao,Object.assign(this,t)}};me([de({type:Ao,context:1,implicit:!0})],mo.prototype,"other",void 0),mo=me([pe({type:kt.Choice})],mo);let go=Co=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,Co.prototype)}};var vo;go=Co=me([pe({type:kt.Set,itemType:mo})],go),function(t){t[t.v0=0]="v0",t[t.v1=1]="v1",t[t.v2=2]="v2",t[t.v3=3]="v3",t[t.v4=4]="v4",t[t.v5=5]="v5"}(vo||(vo={}));let Eo=class extends ji{};Eo=me([pe({type:kt.Sequence})],Eo);let wo=class extends ji{};wo=me([pe({type:kt.Sequence})],wo);let Po=class{constructor(t={}){Object.assign(this,t)}};var Do;me([de({type:Ni,context:0,implicit:!0})],Po.prototype,"subjectKeyIdentifier",void 0),me([de({type:So})],Po.prototype,"issuerAndSerialNumber",void 0),Po=me([pe({type:kt.Choice})],Po);class bo{constructor(t={}){this.version=vo.v0,this.sid=new Po,this.digestAlgorithm=new Eo,this.signatureAlgorithm=new wo,this.signature=new ce,Object.assign(this,t)}}me([de({type:Mt.Integer})],bo.prototype,"version",void 0),me([de({type:Po})],bo.prototype,"sid",void 0),me([de({type:Eo})],bo.prototype,"digestAlgorithm",void 0),me([de({type:ao,repeated:"set",context:0,implicit:!0,optional:!0})],bo.prototype,"signedAttrs",void 0),me([de({type:wo})],bo.prototype,"signatureAlgorithm",void 0),me([de({type:ce})],bo.prototype,"signature",void 0),me([de({type:ao,repeated:"set",context:1,implicit:!0,optional:!0})],bo.prototype,"unsignedAttrs",void 0);let Bo=Do=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,Do.prototype)}};var Io;Bo=Do=me([pe({type:kt.Set,itemType:bo})],Bo);let To=Io=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,Io.prototype)}};To=Io=me([pe({type:kt.Set,itemType:Eo})],To);class xo{constructor(t={}){this.version=vo.v0,this.digestAlgorithms=new To,this.encapContentInfo=new yo,this.signerInfos=new Bo,Object.assign(this,t)}}var Ro;me([de({type:Mt.Integer})],xo.prototype,"version",void 0),me([de({type:To})],xo.prototype,"digestAlgorithms",void 0),me([de({type:yo})],xo.prototype,"encapContentInfo",void 0),me([de({type:ho,context:0,implicit:!0,optional:!0})],xo.prototype,"certificates",void 0),me([de({type:mo,context:1,implicit:!0,optional:!0})],xo.prototype,"crls",void 0),me([de({type:Bo})],xo.prototype,"signerInfos",void 0);class Oo{constructor(t={}){this.attrId="",this.attrValues=[],Object.assign(t)}}me([de({type:Mt.ObjectIdentifier})],Oo.prototype,"attrId",void 0),me([de({type:Mt.Any,repeated:"set"})],Oo.prototype,"attrValues",void 0);let No=Ro=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,Ro.prototype)}};var ko;No=Ro=me([pe({type:kt.Sequence,itemType:Oo})],No);let Mo=ko=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,ko.prototype)}};Mo=ko=me([pe({type:kt.Sequence,itemType:po})],Mo);class Ko{constructor(t={}){this.certId="",this.certValue=new ArrayBuffer(0),Object.assign(this,t)}}me([de({type:Mt.ObjectIdentifier})],Ko.prototype,"certId",void 0),me([de({type:Mt.Any,context:0})],Ko.prototype,"certValue",void 0);class Ho{constructor(t={}){this.crlId="",this.crltValue=new ArrayBuffer(0),Object.assign(this,t)}}me([de({type:Mt.ObjectIdentifier})],Ho.prototype,"crlId",void 0),me([de({type:Mt.Any,context:0})],Ho.prototype,"crltValue",void 0);class Uo extends ce{}class _o{constructor(t={}){this.encryptionAlgorithm=new ji,this.encryptedData=new Uo,Object.assign(this,t)}}var jo,Fo;me([de({type:ji})],_o.prototype,"encryptionAlgorithm",void 0),me([de({type:Uo})],_o.prototype,"encryptedData",void 0),function(t){t[t.v1=0]="v1"}(Fo||(Fo={}));class Vo extends ce{}let Lo=jo=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,jo.prototype)}};Lo=jo=me([pe({type:kt.Sequence,itemType:xi})],Lo);class Go{constructor(t={}){this.version=Fo.v1,this.privateKeyAlgorithm=new ji,this.privateKey=new Vo,Object.assign(this,t)}}me([de({type:Mt.Integer})],Go.prototype,"version",void 0),me([de({type:ji})],Go.prototype,"privateKeyAlgorithm",void 0),me([de({type:Vo})],Go.prototype,"privateKey",void 0),me([de({type:Lo,implicit:!0,context:0,optional:!0})],Go.prototype,"attributes",void 0);let $o=class extends Go{};$o=me([pe({type:kt.Sequence})],$o);let Qo=class extends _o{};Qo=me([pe({type:kt.Sequence})],Qo);class Wo{constructor(t={}){this.secretTypeId="",this.secretValue=new ArrayBuffer(0),Object.assign(this,t)}}me([de({type:Mt.ObjectIdentifier})],Wo.prototype,"secretTypeId",void 0),me([de({type:Mt.Any,context:0})],Wo.prototype,"secretValue",void 0);class zo{constructor(t={}){this.mac=new pr,this.macSalt=new ce,this.iterations=1,Object.assign(this,t)}}me([de({type:pr})],zo.prototype,"mac",void 0),me([de({type:ce})],zo.prototype,"macSalt",void 0),me([de({type:Mt.Integer,defaultValue:1})],zo.prototype,"iterations",void 0);class qo{constructor(t={}){this.version=3,this.authSafe=new po,this.macData=new zo,Object.assign(this,t)}}var Jo;me([de({type:Mt.Integer})],qo.prototype,"version",void 0),me([de({type:po})],qo.prototype,"authSafe",void 0),me([de({type:zo,optional:!0})],qo.prototype,"macData",void 0);class Zo{constructor(t={}){this.bagId="",this.bagValue=new ArrayBuffer(0),Object.assign(this,t)}}me([de({type:Mt.ObjectIdentifier})],Zo.prototype,"bagId",void 0),me([de({type:Mt.Any,context:0})],Zo.prototype,"bagValue",void 0),me([de({type:Oo,repeated:"set",optional:!0})],Zo.prototype,"bagAttributes",void 0);let Xo=Jo=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,Jo.prototype)}};var Yo,ta,ea;Xo=Jo=me([pe({type:kt.Sequence,itemType:Zo})],Xo);const ia="1.2.840.113549.1.9",ra=ia+".2",sa=ia+".7",na=ia+".14";let oa=class extends De{constructor(t={}){super(t)}toString(){return{}.toString(),this.ia5String||super.toString()}};me([de({type:Mt.IA5String})],oa.prototype,"ia5String",void 0),oa=me([pe({type:kt.Choice})],oa);let aa=class extends po{};aa=me([pe({type:kt.Sequence})],aa);let ca=class extends qo{};ca=me([pe({type:kt.Sequence})],ca);let la=class extends _o{};la=me([pe({type:kt.Sequence})],la);let ua=class{constructor(t=""){this.value=t}toString(){return this.value}};me([de({type:Mt.IA5String})],ua.prototype,"value",void 0),ua=me([pe({type:kt.Choice})],ua);let ha=class extends oa{};ha=me([pe({type:kt.Choice})],ha);let pa=class extends De{};pa=me([pe({type:kt.Choice})],pa);let da=class{constructor(t=new Date){this.value=t}};me([de({type:Mt.GeneralizedTime})],da.prototype,"value",void 0),da=me([pe({type:kt.Choice})],da);let fa=class extends De{};fa=me([pe({type:kt.Choice})],fa);let ya=class{constructor(t="M"){this.value=t}toString(){return this.value}};me([de({type:Mt.PrintableString})],ya.prototype,"value",void 0),ya=me([pe({type:kt.Choice})],ya);let Sa=class{constructor(t=""){this.value=t}toString(){return this.value}};me([de({type:Mt.PrintableString})],Sa.prototype,"value",void 0),Sa=me([pe({type:kt.Choice})],Sa);let Ca=class extends Sa{};Ca=me([pe({type:kt.Choice})],Ca);let Aa=class extends De{};Aa=me([pe({type:kt.Choice})],Aa);let ma=class{constructor(t=""){this.value=t}toString(){return this.value}};me([de({type:Mt.ObjectIdentifier})],ma.prototype,"value",void 0),ma=me([pe({type:kt.Choice})],ma);let ga=class extends Vi{};ga=me([pe({type:kt.Choice})],ga);let va=class{constructor(t=0){this.value=t}toString(){return this.value.toString()}};me([de({type:Mt.Integer})],va.prototype,"value",void 0),va=me([pe({type:kt.Choice})],va);let Ea=class extends bo{};Ea=me([pe({type:kt.Sequence})],Ea);let wa=class extends De{};wa=me([pe({type:kt.Choice})],wa);let Pa=Yo=class extends Qi{constructor(t){super(t),Object.setPrototypeOf(this,Yo.prototype)}};Pa=Yo=me([pe({type:kt.Sequence})],Pa);let Da=ta=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,ta.prototype)}};Da=ta=me([pe({type:kt.Set,itemType:ao})],Da);let ba=class{constructor(t=""){this.value=t}toString(){return this.value}};me([de({type:Mt.BmpString})],ba.prototype,"value",void 0),ba=me([pe({type:kt.Choice})],ba);let Ba=class extends ji{};Ba=me([pe({type:kt.Sequence})],Ba);let Ia=ea=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,ea.prototype)}};var Ta;Ia=ea=me([pe({type:kt.Sequence,itemType:Ba})],Ia);let xa=Ta=class extends Ce{constructor(t){super(t),Object.setPrototypeOf(this,Ta.prototype)}};xa=Ta=me([pe({type:kt.Sequence,itemType:xi})],xa);class Ra{constructor(t={}){this.version=0,this.subject=new xe,this.subjectPKInfo=new Fi,this.attributes=new xa,Object.assign(this,t)}}me([de({type:Mt.Integer})],Ra.prototype,"version",void 0),me([de({type:xe})],Ra.prototype,"subject",void 0),me([de({type:Fi})],Ra.prototype,"subjectPKInfo",void 0),me([de({type:xa,implicit:!0,context:0})],Ra.prototype,"attributes",void 0);class Oa{constructor(t={}){this.certificationRequestInfo=new Ra,this.signatureAlgorithm=new ji,this.signature=new ArrayBuffer(0),Object.assign(this,t)}}
86
86
  /**
87
87
  * @license
88
88
  * Copyright (c) Peculiar Ventures, LLC.
@@ -97,4 +97,4 @@ function Na(t,e="application/octet-stream",i,r){const s=new Blob([t],{type:e});i
97
97
  *
98
98
  * This source code is licensed under the MIT license found in the
99
99
  * LICENSE file in the root directory of this source tree.
100
- */me([de({type:Ra})],Oa.prototype,"certificationRequestInfo",void 0),me([de({type:ji})],Oa.prototype,"signatureAlgorithm",void 0),me([de({type:Mt.BitString})],Oa.prototype,"signature",void 0);class ka{}ka.certificate={asPEM:(t,e)=>{Na(o.FromString(t),"application/pkix-cert",e,"cer")},asDER:(t,e)=>{Na(o.FromString(t),"application/pkix-cert",e,"cer")}},ka.certificateRequest={asPEM:(t,e)=>{Na(o.FromString(t),"application/pkcs10",e,"csr")},asDER:(t,e)=>{Na(o.FromString(t),"application/pkcs10",e,"csr")}};export{_e as $,nn as A,Oa as B,wa as C,Xn as D,Pa as E,Yi as F,er as G,sr as H,to as I,xe as J,Oe as K,Qe as L,ze as M,Ir as N,wr as O,n as P,Ne as Q,Cr as R,_t as S,so as T,ha as U,io as V,oo as W,gi as X,je as Y,di as Z,Ni as _,xi as a,oi as a0,He as a1,_i as a2,Ti as a3,Xe as a4,Is as a5,wi as a6,Vr as a7,Gr as a8,$r as a9,Hr as aa,fs as ab,ds as ac,gs as ad,ms as ae,xs as af,Ts as ag,hi as ah,Oi as ai,ki as aj,Ui as ak,Rr as al,Ls as am,Ys as an,Pi as ao,bi as ap,ka as aq,Ar as ar,mr as as,gr as at,vr as au,dn as av,o as b,ye as c,on as d,Ae as e,ra as f,sa as g,eo as h,na as i,Yn as j,no as k,Vn as l,Ln as m,ro as n,Zn as o,qn as p,Jn as q,Wn as r,zn as s,$n as t,Qn as u,hn as v,Tn as w,pn as x,ln as y,un as z}
100
+ */me([de({type:Ra})],Oa.prototype,"certificationRequestInfo",void 0),me([de({type:ji})],Oa.prototype,"signatureAlgorithm",void 0),me([de({type:Mt.BitString})],Oa.prototype,"signature",void 0);class ka{}ka.certificate={asPEM:(t,e)=>{Na(o.FromString(t),"application/pkix-cert",e,"cer")},asDER:(t,e)=>{Na(o.FromString(t),"application/pkix-cert",e,"cer")}},ka.certificateRequest={asPEM:(t,e)=>{Na(o.FromString(t),"application/pkcs10",e,"csr")},asDER:(t,e)=>{Na(o.FromString(t),"application/pkcs10",e,"csr")}};export{_e as $,nn as A,Oa as B,wa as C,Xn as D,Pa as E,Yi as F,er as G,sr as H,to as I,xe as J,Oe as K,Qe as L,ze as M,Ir as N,wr as O,n as P,Ne as Q,Cr as R,_t as S,so as T,ha as U,io as V,oo as W,gi as X,je as Y,di as Z,Ni as _,xi as a,oi as a0,He as a1,_i as a2,Ti as a3,Xe as a4,Is as a5,wi as a6,Vr as a7,Gr as a8,$r as a9,Hr as aa,fs as ab,ds as ac,gs as ad,ms as ae,xs as af,Ts as ag,hi as ah,Oi as ai,ki as aj,Ui as ak,Rr as al,Ls as am,Ys as an,Pi as ao,Bi as ap,ka as aq,Ar as ar,mr as as,gr as at,vr as au,dn as av,o as b,ye as c,on as d,Ae as e,ra as f,sa as g,eo as h,na as i,Yn as j,no as k,Vn as l,Ln as m,ro as n,Zn as o,qn as p,Jn as q,Wn as r,zn as s,$n as t,Qn as u,hn as v,Tn as w,pn as x,ln as y,un as z}