"use strict";var R=Object.defineProperty;var Z=Object.getOwnPropertyDescriptor;var F=Object.getOwnPropertyNames;var G=Object.prototype.hasOwnProperty;var X=(r,t)=>{for(var e in t)R(r,e,{get:t[e],enumerable:!0})},W=(r,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of F(t))!G.call(r,s)&&s!==e&&R(r,s,{get:()=>t[s],enumerable:!(o=Z(t,s))||o.enumerable});return r};var q=r=>W(R({},"__esModule",{value:!0}),r);var At={};X(At,{ASN1_CLASS_APPLICATION_:()=>j,ASN1_CLASS_CONTEXT_SPECIFIC_:()=>k,ASN1_CLASS_PRIVATE_:()=>z,ASN1_CLASS_UNIVERSAL_:()=>i,Asn1AnyRaw:()=>d,Asn1Application:()=>x,Asn1Base:()=>f,Asn1BitString:()=>S,Asn1Boolean:()=>h,Asn1Constructed:()=>c,Asn1ContextSpecific:()=>y,Asn1GeneralizedTime:()=>I,Asn1IA5String:()=>N,Asn1Integer:()=>w,Asn1Null:()=>T,Asn1NumericString:()=>C,Asn1Object:()=>b,Asn1OctetString:()=>v,Asn1Primitive:()=>n,Asn1PrintableString:()=>E,Asn1Private:()=>B,Asn1Sequence:()=>P,Asn1Set:()=>g,Asn1Time:()=>L,Asn1Universal:()=>O,Asn1UtcTime:()=>l,Asn1Utf8String:()=>U});module.exports=q(At);var H=r=>ArrayBuffer.isView(r)?new Uint8Array(r.buffer).subarray(r.byteOffset,r.byteOffset+r.byteLength):new Uint8Array(r),_=H;var J=r=>{let t=6;do t++,r>>>=1;while(r>0);return t/7>>>0},p=J;var Q=r=>{let t=0,e=!1;for(let o=0;o>>6,this.primitive_=!!(~e[0]&32);let o=(e[0]&31)===31?e[0]&31:V(e.subarray(1));this.tag_=o;let s=o<31?1:1+p(o),D=e[s]<128?1:1+(e[s]&15);this.data_=e,this.dataStart_=s+D}rawContents_(){return this.data_.subarray(this.dataStart_)}derEncode(){return this.data_}};var Y=(...r)=>{let t=new Uint8Array(r.reduce((e,o)=>e+o.byteLength,0));return r.reduce((e,o)=>{let s=_(o);return t.set(s,e),e+o.byteLength},0),t.buffer},m=Y;var K=r=>{let t=new Uint8Array(p(r)),e=t.byteLength-1,o=e;do{let s=r&127;r>>>=7,o!==e&&(s|=128),t[o--]=s}while(r>0);return t},A=K;var u=128,tt=r=>(r>=128?2:1)+((Math.log2(r)|0)>>3),et=(r,t,e,o)=>{if(e<0)throw new RangeError("Invalid negative tag");if(o>4294967295)throw new RangeError("Data too long");let s=e<31?1:1+p(e),D=s+tt(o),a=new Uint8Array(D);if(e<31)a[0]=e;else{a[0]=31;let M=A(e);a.set(M,1)}return a[0]=(r&3)<<6|(t?0:1)<<5|a[0]&31,o<128?a[s]=o:o<=255?(a[s]=u|1,a[s+1]=o>>>0&255):o<=65535?(a[s]=u|2,a[s+1]=o>>>8&255,a[s+2]=o>>>0&255):o<=16777215?(a[s]=u|3,a[s+1]=o>>>16&255,a[s+2]=o>>>8&255,a[s+3]=o>>>0&255):o<=4294967295&&(a[s]=u|4,a[s+1]=o>>>24&255,a[s+2]=o>>>16&255,a[s+3]=o>>>8&255,a[s+4]=o>>>0&255),a},$=et;var f=class{constructor(t,e,o){this.tag_=o,this.primitive_=e,this.class_=t}rawContents_(){throw new Error("Method not implemented.")}derEncode(){if(!this.derEncoded__){let t=this.rawContents_();if(!t)return $(this.class_,this.primitive_,this.tag_,0);let e=$(this.class_,this.primitive_,this.tag_,t.byteLength);this.derEncoded__=m(e,t)}return this.derEncoded__}};var i=0,j=1,k=2,z=3;var x=class extends f{constructor(t,e,o){super(1,!o&&!!(e!=null&&e.primitive_),t),this.data_=e,this.explicit_=!!o}rawContents_(){if(this.data_)return this.explicit_?this.data_.derEncode():this.data_.rawContents_()}};var n=class extends f{constructor(t,e,o){super(t,!0,e),this.data_=o}rawContents_(){return this.data_}};var S=class extends n{constructor(t,e){let o=m(new Uint8Array([e]),t);super(0,3,o)}};var h=class extends n{constructor(t){super(0,1,new Uint8Array([t?255:0]))}};var c=class extends f{constructor(t,e){super(t,!1,e)}};var y=class extends f{constructor(t,e,o){super(2,!o&&!!(e!=null&&e.primitive_),t),this.data_=e,this.explicit_=!!o}rawContents_(){if(this.data_)return this.explicit_?this.data_.derEncode():this.data_.rawContents_()}};var rt=/^[0-9]{2}(?:0[1-9]|1[0-2])(?:0[1-9]|[12][0-9]|3[01])(?:[01][0-9]|2[0-3])(?:[0-5][0-9]){1,2}(?:Z|[+-](?:[01][0-9]|2[0-3])(?:[0-5][0-9]))$/,l=class extends n{constructor(t){if(typeof t!="string"||t.length<11||t.length>17||!rt.test(t))throw new TypeError("Invalid date or date format");let e=new Uint8Array(t.split("").map(o=>o.codePointAt(0)));super(0,23,e)}};var ot=/^[0-9]{4}(?:0[1-9]|1[0-2])(?:0[1-9]|[12][0-9]|3[01])(?:[01][0-9]|2[0-3])(?:[0-5][0-9](?:[0-5][0-9](?:\.[0-9]{3})?)?)?(?:|Z|[+-](?:[01][0-9]|2[0-3])(?:[0-5][0-9]))$/,st=/^(?:19[5-9]|20[0-4])[0-9](?:0[1-9]|1[0-2])(?:0[1-9]|[12][0-9]|3[01])(?:[01][0-9]|2[0-3])(?:[0-5][0-9](?:[0-5][0-9](?:\.0{3})?)?)(?:Z|[+-](?:[01][0-9]|2[0-3])(?:[0-5][0-9]))$/,I=class extends n{constructor(t,e){if(typeof t!="string"||t.length<10||t.length>23||!ot.test(t))throw new TypeError("Invalid date or date format");if(e&&st.test(t))return new l(t.slice(2).replace(".000",""));let o=new Uint8Array(t.split("").map(s=>s.codePointAt(0)));super(0,24,o)}};var N=class extends n{constructor(t){let e=new Uint8Array(t.split("").map(o=>{let s=o.codePointAt(0);if(s==null||s&128)throw new Error("Invalid character");return s}));super(0,22,e)}};var it=r=>{let t=1;for(r>=BigInt(1))!=BigInt(0);)t++;return t},nt=r=>{let t=1;for(r<0&&(r=-r);(r>>=1)!=0;)t++;return t};function at(r){if(typeof r=="bigint"){let t=r=0;s--,r>>BigInt(8))o[s]=Number(r&BigInt(255));return o.buffer}else if(typeof r=="number"){let t=r<0,e=Math.ceil(nt(t?-r:r+128)/8),o=new Uint8Array(e);for(let s=e-1;s>=0;s--,r>>=8)o[s]=r&255;return o.buffer}else return r}var w=class extends n{constructor(t){super(0,2,at(t))}};var T=class extends n{constructor(){super(0,5)}};var ft=/^[0-9 ]*$/,C=class extends n{constructor(t){if(!ft.test(t))throw new Error("Invalid data");let e=new Uint8Array(t.split("").map(o=>{let s=o.codePointAt(0);if(s==null)throw new Error("Invalid character");return s}));super(0,18,e)}};var mt=/^[012](\.[0-9]+)+$/,ct=r=>{if(!mt.test(r))throw new Error("Invalid OID");let t=r.split(".").map(o=>Number(o)),e=[A(40*t[0]+t[1])];for(let o=2;o{let s=o.codePointAt(0);if(s==null)throw new Error("Invalid character");return s}));super(0,19,e)}};var B=class extends f{constructor(t,e,o){super(3,!o&&!!(e!=null&&e.primitive_),t),this.data_=e,this.explicit_=!!o}rawContents_(){if(this.data_)return this.explicit_?this.data_.derEncode():this.data_.rawContents_()}};var P=class extends c{constructor(t){super(0,16),this.data_=t}rawContents_(){if(!this.data_)return;let t=this.data_.map(e=>e.derEncode());return m(...t)}};var g=class extends c{constructor(t){super(0,17),this.data_=t}rawContents_(){if(!this.data_)return;let t=this.data_.map(e=>e.derEncode());return m(...t)}};var lt=/^[0-9 'WwZT()+,\-./:?]+$/,L=class extends n{constructor(t){if(!lt.test(t))throw new Error("Invalid data");let e=new Uint8Array(t.split("").map(o=>{let s=o.codePointAt(0);if(s==null)throw new Error("Invalid character");return s}));super(0,14,e)}};var O=class extends f{constructor(t,e,o){super(0,!o&&!!(e!=null&&e.primitive_),t),this.data_=e,this.explicit_=!!o}rawContents_(){if(this.data_)return this.explicit_?this.data_.derEncode():this.data_.rawContents_()}};var U=class extends n{constructor(t){let o=new TextEncoder().encode(t);super(0,12,o)}};0&&(module.exports={ASN1_CLASS_APPLICATION_,ASN1_CLASS_CONTEXT_SPECIFIC_,ASN1_CLASS_PRIVATE_,ASN1_CLASS_UNIVERSAL_,Asn1AnyRaw,Asn1Application,Asn1Base,Asn1BitString,Asn1Boolean,Asn1Constructed,Asn1ContextSpecific,Asn1GeneralizedTime,Asn1IA5String,Asn1Integer,Asn1Null,Asn1NumericString,Asn1Object,Asn1OctetString,Asn1Primitive,Asn1PrintableString,Asn1Private,Asn1Sequence,Asn1Set,Asn1Time,Asn1Universal,Asn1UtcTime,Asn1Utf8String});