nfets 0.0.114 → 0.0.115
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/index.cjs +12 -12
- package/dist/core/index.mjs +9 -9
- package/dist/nfe/index.cjs +23 -23
- package/dist/nfe/index.d.cts +121 -314
- package/dist/nfe/index.d.ts +121 -314
- package/dist/nfe/index.mjs +15 -15
- package/package.json +1 -1
package/dist/core/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";var HK=Object.create;var v0=Object.defineProperty;var KK=Object.getOwnPropertyDescriptor;var $K=Object.getOwnPropertyNames;var XK=Object.getPrototypeOf,GK=Object.prototype.hasOwnProperty;var o=(r,e)=>v0(r,"name",{value:e,configurable:!0});var Mn=(r,e)=>()=>(r&&(e=r(r=0)),e);var X=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),Bx=(r,e)=>{for(var t in e)v0(r,t,{get:e[t],enumerable:!0})},WO=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of $K(e))!GK.call(r,s)&&s!==t&&v0(r,s,{get:()=>e[s],enumerable:!(n=KK(e,s))||n.enumerable});return r};var Rt=(r,e,t)=>(t=r!=null?HK(XK(r)):{},WO(e||!r||!r.__esModule?v0(t,"default",{value:r,enumerable:!0}):t,r)),zK=r=>WO(v0({},"__esModule",{value:!0}),r);var It=X((Ome,d3)=>{"use strict";d3.exports={options:{usePureJavaScript:!1}}});var y3=X((Pme,g3)=>{"use strict";var wC={};g3.exports=wC;var m3={};wC.encode=function(r,e,t){if(typeof e!="string")throw new TypeError('"alphabet" must be a string.');if(t!==void 0&&typeof t!="number")throw new TypeError('"maxline" must be a number.');var n="";if(!(r instanceof Uint8Array))n=G$(r,e);else{var s=0,i=e.length,a=e.charAt(0),u=[0];for(s=0;s<r.length;++s){for(var c=0,l=r[s];c<u.length;++c)l+=u[c]<<8,u[c]=l%i,l=l/i|0;for(;l>0;)u.push(l%i),l=l/i|0}for(s=0;r[s]===0&&s<r.length-1;++s)n+=a;for(s=u.length-1;s>=0;--s)n+=e[u[s]]}if(t){var f=new RegExp(".{1,"+t+"}","g");n=n.match(f).join(`\r
|
|
2
2
|
`)}return n};wC.decode=function(r,e){if(typeof r!="string")throw new TypeError('"input" must be a string.');if(typeof e!="string")throw new TypeError('"alphabet" must be a string.');var t=m3[e];if(!t){t=m3[e]=[];for(var n=0;n<e.length;++n)t[e.charCodeAt(n)]=n}r=r.replace(/\s/g,"");for(var s=e.length,i=e.charAt(0),a=[0],n=0;n<r.length;n++){var u=t[r.charCodeAt(n)];if(u===void 0)return;for(var c=0,l=u;c<a.length;++c)l+=a[c]*s,a[c]=l&255,l>>=8;for(;l>0;)a.push(l&255),l>>=8}for(var f=0;r[f]===i&&f<r.length-1;++f)a.push(0);return typeof Buffer<"u"?Buffer.from(a.reverse()):new Uint8Array(a.reverse())};function G$(r,e){var t=0,n=e.length,s=e.charAt(0),i=[0];for(t=0;t<r.length();++t){for(var a=0,u=r.at(t);a<i.length;++a)u+=i[a]<<8,i[a]=u%n,u=u/n|0;for(;u>0;)i.push(u%n),u=u/n|0}var c="";for(t=0;r.at(t)===0&&t<r.length()-1;++t)c+=s;for(t=i.length-1;t>=0;--t)c+=e[i[t]];return c}o(G$,"_encodeWithByteBuffer")});var zt=X((Lme,w3)=>{"use strict";var v3=It(),x3=y3(),re=w3.exports=v3.util=v3.util||{};(function(){if(typeof process<"u"&&process.nextTick&&!process.browser){re.nextTick=process.nextTick,typeof setImmediate=="function"?re.setImmediate=setImmediate:re.setImmediate=re.nextTick;return}if(typeof setImmediate=="function"){re.setImmediate=function(){return setImmediate.apply(void 0,arguments)},re.nextTick=function(u){return setImmediate(u)};return}if(re.setImmediate=function(u){setTimeout(u,0)},typeof window<"u"&&typeof window.postMessage=="function"){let u=function(c){if(c.source===window&&c.data===r){c.stopPropagation();var l=e.slice();e.length=0,l.forEach(function(f){f()})}};var a=u;o(u,"handler");var r="forge.setImmediate",e=[];re.setImmediate=function(c){e.push(c),e.length===1&&window.postMessage(r,"*")},window.addEventListener("message",u,!0)}if(typeof MutationObserver<"u"){var t=Date.now(),n=!0,s=document.createElement("div"),e=[];new MutationObserver(function(){var c=e.slice();e.length=0,c.forEach(function(l){l()})}).observe(s,{attributes:!0});var i=re.setImmediate;re.setImmediate=function(c){Date.now()-t>15?(t=Date.now(),i(c)):(e.push(c),e.length===1&&s.setAttribute("a",n=!n))}}re.nextTick=re.setImmediate})();re.isNodejs=typeof process<"u"&&process.versions&&process.versions.node;re.globalScope=(function(){return re.isNodejs?global:typeof self>"u"?window:self})();re.isArray=Array.isArray||function(r){return Object.prototype.toString.call(r)==="[object Array]"};re.isArrayBuffer=function(r){return typeof ArrayBuffer<"u"&&r instanceof ArrayBuffer};re.isArrayBufferView=function(r){return r&&re.isArrayBuffer(r.buffer)&&r.byteLength!==void 0};function A0(r){if(!(r===8||r===16||r===24||r===32))throw new Error("Only 8, 16, 24, or 32 bits supported: "+r)}o(A0,"_checkBitsParam");re.ByteBuffer=bC;function bC(r){if(this.data="",this.read=0,typeof r=="string")this.data=r;else if(re.isArrayBuffer(r)||re.isArrayBufferView(r))if(typeof Buffer<"u"&&r instanceof Buffer)this.data=r.toString("binary");else{var e=new Uint8Array(r);try{this.data=String.fromCharCode.apply(null,e)}catch{for(var t=0;t<e.length;++t)this.putByte(e[t])}}else(r instanceof bC||typeof r=="object"&&typeof r.data=="string"&&typeof r.read=="number")&&(this.data=r.data,this.read=r.read);this._constructedStringLength=0}o(bC,"ByteStringBuffer");re.ByteStringBuffer=bC;var z$=4096;re.ByteStringBuffer.prototype._optimizeConstructedString=function(r){this._constructedStringLength+=r,this._constructedStringLength>z$&&(this.data.substr(0,1),this._constructedStringLength=0)};re.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read};re.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0};re.ByteStringBuffer.prototype.putByte=function(r){return this.putBytes(String.fromCharCode(r))};re.ByteStringBuffer.prototype.fillWithByte=function(r,e){r=String.fromCharCode(r);for(var t=this.data;e>0;)e&1&&(t+=r),e>>>=1,e>0&&(r+=r);return this.data=t,this._optimizeConstructedString(e),this};re.ByteStringBuffer.prototype.putBytes=function(r){return this.data+=r,this._optimizeConstructedString(r.length),this};re.ByteStringBuffer.prototype.putString=function(r){return this.putBytes(re.encodeUtf8(r))};re.ByteStringBuffer.prototype.putInt16=function(r){return this.putBytes(String.fromCharCode(r>>8&255)+String.fromCharCode(r&255))};re.ByteStringBuffer.prototype.putInt24=function(r){return this.putBytes(String.fromCharCode(r>>16&255)+String.fromCharCode(r>>8&255)+String.fromCharCode(r&255))};re.ByteStringBuffer.prototype.putInt32=function(r){return this.putBytes(String.fromCharCode(r>>24&255)+String.fromCharCode(r>>16&255)+String.fromCharCode(r>>8&255)+String.fromCharCode(r&255))};re.ByteStringBuffer.prototype.putInt16Le=function(r){return this.putBytes(String.fromCharCode(r&255)+String.fromCharCode(r>>8&255))};re.ByteStringBuffer.prototype.putInt24Le=function(r){return this.putBytes(String.fromCharCode(r&255)+String.fromCharCode(r>>8&255)+String.fromCharCode(r>>16&255))};re.ByteStringBuffer.prototype.putInt32Le=function(r){return this.putBytes(String.fromCharCode(r&255)+String.fromCharCode(r>>8&255)+String.fromCharCode(r>>16&255)+String.fromCharCode(r>>24&255))};re.ByteStringBuffer.prototype.putInt=function(r,e){A0(e);var t="";do e-=8,t+=String.fromCharCode(r>>e&255);while(e>0);return this.putBytes(t)};re.ByteStringBuffer.prototype.putSignedInt=function(r,e){return r<0&&(r+=2<<e-1),this.putInt(r,e)};re.ByteStringBuffer.prototype.putBuffer=function(r){return this.putBytes(r.getBytes())};re.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)};re.ByteStringBuffer.prototype.getInt16=function(){var r=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,r};re.ByteStringBuffer.prototype.getInt24=function(){var r=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,r};re.ByteStringBuffer.prototype.getInt32=function(){var r=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+3);return this.read+=4,r};re.ByteStringBuffer.prototype.getInt16Le=function(){var r=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,r};re.ByteStringBuffer.prototype.getInt24Le=function(){var r=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,r};re.ByteStringBuffer.prototype.getInt32Le=function(){var r=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16^this.data.charCodeAt(this.read+3)<<24;return this.read+=4,r};re.ByteStringBuffer.prototype.getInt=function(r){A0(r);var e=0;do e=(e<<8)+this.data.charCodeAt(this.read++),r-=8;while(r>0);return e};re.ByteStringBuffer.prototype.getSignedInt=function(r){var e=this.getInt(r),t=2<<r-2;return e>=t&&(e-=t<<1),e};re.ByteStringBuffer.prototype.getBytes=function(r){var e;return r?(r=Math.min(this.length(),r),e=this.data.slice(this.read,this.read+r),this.read+=r):r===0?e="":(e=this.read===0?this.data:this.data.slice(this.read),this.clear()),e};re.ByteStringBuffer.prototype.bytes=function(r){return typeof r>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+r)};re.ByteStringBuffer.prototype.at=function(r){return this.data.charCodeAt(this.read+r)};re.ByteStringBuffer.prototype.setAt=function(r,e){return this.data=this.data.substr(0,this.read+r)+String.fromCharCode(e)+this.data.substr(this.read+r+1),this};re.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)};re.ByteStringBuffer.prototype.copy=function(){var r=re.createBuffer(this.data);return r.read=this.read,r};re.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this};re.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this};re.ByteStringBuffer.prototype.truncate=function(r){var e=Math.max(0,this.length()-r);return this.data=this.data.substr(this.read,e),this.read=0,this};re.ByteStringBuffer.prototype.toHex=function(){for(var r="",e=this.read;e<this.data.length;++e){var t=this.data.charCodeAt(e);t<16&&(r+="0"),r+=t.toString(16)}return r};re.ByteStringBuffer.prototype.toString=function(){return re.decodeUtf8(this.bytes())};function W$(r,e){e=e||{},this.read=e.readOffset||0,this.growSize=e.growSize||1024;var t=re.isArrayBuffer(r),n=re.isArrayBufferView(r);if(t||n){t?this.data=new DataView(r):this.data=new DataView(r.buffer,r.byteOffset,r.byteLength),this.write="writeOffset"in e?e.writeOffset:this.data.byteLength;return}this.data=new DataView(new ArrayBuffer(0)),this.write=0,r!=null&&this.putBytes(r),"writeOffset"in e&&(this.write=e.writeOffset)}o(W$,"DataBuffer");re.DataBuffer=W$;re.DataBuffer.prototype.length=function(){return this.write-this.read};re.DataBuffer.prototype.isEmpty=function(){return this.length()<=0};re.DataBuffer.prototype.accommodate=function(r,e){if(this.length()>=r)return this;e=Math.max(e||this.growSize,r);var t=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),n=new Uint8Array(this.length()+e);return n.set(t),this.data=new DataView(n.buffer),this};re.DataBuffer.prototype.putByte=function(r){return this.accommodate(1),this.data.setUint8(this.write++,r),this};re.DataBuffer.prototype.fillWithByte=function(r,e){this.accommodate(e);for(var t=0;t<e;++t)this.data.setUint8(r);return this};re.DataBuffer.prototype.putBytes=function(r,e){if(re.isArrayBufferView(r)){var t=new Uint8Array(r.buffer,r.byteOffset,r.byteLength),n=t.byteLength-t.byteOffset;this.accommodate(n);var s=new Uint8Array(this.data.buffer,this.write);return s.set(t),this.write+=n,this}if(re.isArrayBuffer(r)){var t=new Uint8Array(r);this.accommodate(t.byteLength);var s=new Uint8Array(this.data.buffer);return s.set(t,this.write),this.write+=t.byteLength,this}if(r instanceof re.DataBuffer||typeof r=="object"&&typeof r.read=="number"&&typeof r.write=="number"&&re.isArrayBufferView(r.data)){var t=new Uint8Array(r.data.byteLength,r.read,r.length());this.accommodate(t.byteLength);var s=new Uint8Array(r.data.byteLength,this.write);return s.set(t),this.write+=t.byteLength,this}if(r instanceof re.ByteStringBuffer&&(r=r.data,e="binary"),e=e||"binary",typeof r=="string"){var i;if(e==="hex")return this.accommodate(Math.ceil(r.length/2)),i=new Uint8Array(this.data.buffer,this.write),this.write+=re.binary.hex.decode(r,i,this.write),this;if(e==="base64")return this.accommodate(Math.ceil(r.length/4)*3),i=new Uint8Array(this.data.buffer,this.write),this.write+=re.binary.base64.decode(r,i,this.write),this;if(e==="utf8"&&(r=re.encodeUtf8(r),e="binary"),e==="binary"||e==="raw")return this.accommodate(r.length),i=new Uint8Array(this.data.buffer,this.write),this.write+=re.binary.raw.decode(i),this;if(e==="utf16")return this.accommodate(r.length*2),i=new Uint16Array(this.data.buffer,this.write),this.write+=re.text.utf16.encode(i),this;throw new Error("Invalid encoding: "+e)}throw Error("Invalid parameter: "+r)};re.DataBuffer.prototype.putBuffer=function(r){return this.putBytes(r),r.clear(),this};re.DataBuffer.prototype.putString=function(r){return this.putBytes(r,"utf16")};re.DataBuffer.prototype.putInt16=function(r){return this.accommodate(2),this.data.setInt16(this.write,r),this.write+=2,this};re.DataBuffer.prototype.putInt24=function(r){return this.accommodate(3),this.data.setInt16(this.write,r>>8&65535),this.data.setInt8(this.write,r>>16&255),this.write+=3,this};re.DataBuffer.prototype.putInt32=function(r){return this.accommodate(4),this.data.setInt32(this.write,r),this.write+=4,this};re.DataBuffer.prototype.putInt16Le=function(r){return this.accommodate(2),this.data.setInt16(this.write,r,!0),this.write+=2,this};re.DataBuffer.prototype.putInt24Le=function(r){return this.accommodate(3),this.data.setInt8(this.write,r>>16&255),this.data.setInt16(this.write,r>>8&65535,!0),this.write+=3,this};re.DataBuffer.prototype.putInt32Le=function(r){return this.accommodate(4),this.data.setInt32(this.write,r,!0),this.write+=4,this};re.DataBuffer.prototype.putInt=function(r,e){A0(e),this.accommodate(e/8);do e-=8,this.data.setInt8(this.write++,r>>e&255);while(e>0);return this};re.DataBuffer.prototype.putSignedInt=function(r,e){return A0(e),this.accommodate(e/8),r<0&&(r+=2<<e-1),this.putInt(r,e)};re.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)};re.DataBuffer.prototype.getInt16=function(){var r=this.data.getInt16(this.read);return this.read+=2,r};re.DataBuffer.prototype.getInt24=function(){var r=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,r};re.DataBuffer.prototype.getInt32=function(){var r=this.data.getInt32(this.read);return this.read+=4,r};re.DataBuffer.prototype.getInt16Le=function(){var r=this.data.getInt16(this.read,!0);return this.read+=2,r};re.DataBuffer.prototype.getInt24Le=function(){var r=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,r};re.DataBuffer.prototype.getInt32Le=function(){var r=this.data.getInt32(this.read,!0);return this.read+=4,r};re.DataBuffer.prototype.getInt=function(r){A0(r);var e=0;do e=(e<<8)+this.data.getInt8(this.read++),r-=8;while(r>0);return e};re.DataBuffer.prototype.getSignedInt=function(r){var e=this.getInt(r),t=2<<r-2;return e>=t&&(e-=t<<1),e};re.DataBuffer.prototype.getBytes=function(r){var e;return r?(r=Math.min(this.length(),r),e=this.data.slice(this.read,this.read+r),this.read+=r):r===0?e="":(e=this.read===0?this.data:this.data.slice(this.read),this.clear()),e};re.DataBuffer.prototype.bytes=function(r){return typeof r>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+r)};re.DataBuffer.prototype.at=function(r){return this.data.getUint8(this.read+r)};re.DataBuffer.prototype.setAt=function(r,e){return this.data.setUint8(r,e),this};re.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)};re.DataBuffer.prototype.copy=function(){return new re.DataBuffer(this)};re.DataBuffer.prototype.compact=function(){if(this.read>0){var r=new Uint8Array(this.data.buffer,this.read),e=new Uint8Array(r.byteLength);e.set(r),this.data=new DataView(e),this.write-=this.read,this.read=0}return this};re.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this};re.DataBuffer.prototype.truncate=function(r){return this.write=Math.max(0,this.length()-r),this.read=Math.min(this.read,this.write),this};re.DataBuffer.prototype.toHex=function(){for(var r="",e=this.read;e<this.data.byteLength;++e){var t=this.data.getUint8(e);t<16&&(r+="0"),r+=t.toString(16)}return r};re.DataBuffer.prototype.toString=function(r){var e=new Uint8Array(this.data,this.read,this.length());if(r=r||"utf8",r==="binary"||r==="raw")return re.binary.raw.encode(e);if(r==="hex")return re.binary.hex.encode(e);if(r==="base64")return re.binary.base64.encode(e);if(r==="utf8")return re.text.utf8.decode(e);if(r==="utf16")return re.text.utf16.decode(e);throw new Error("Invalid encoding: "+r)};re.createBuffer=function(r,e){return e=e||"raw",r!==void 0&&e==="utf8"&&(r=re.encodeUtf8(r)),new re.ByteBuffer(r)};re.fillString=function(r,e){for(var t="";e>0;)e&1&&(t+=r),e>>>=1,e>0&&(r+=r);return t};re.xorBytes=function(r,e,t){for(var n="",s="",i="",a=0,u=0;t>0;--t,++a)s=r.charCodeAt(a)^e.charCodeAt(a),u>=10&&(n+=i,i="",u=0),i+=String.fromCharCode(s),++u;return n+=i,n};re.hexToBytes=function(r){var e="",t=0;for(r.length&!0&&(t=1,e+=String.fromCharCode(parseInt(r[0],16)));t<r.length;t+=2)e+=String.fromCharCode(parseInt(r.substr(t,2),16));return e};re.bytesToHex=function(r){return re.createBuffer(r).toHex()};re.int32ToBytes=function(r){return String.fromCharCode(r>>24&255)+String.fromCharCode(r>>16&255)+String.fromCharCode(r>>8&255)+String.fromCharCode(r&255)};var Xo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Go=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],E3="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";re.encode64=function(r,e){for(var t="",n="",s,i,a,u=0;u<r.length;)s=r.charCodeAt(u++),i=r.charCodeAt(u++),a=r.charCodeAt(u++),t+=Xo.charAt(s>>2),t+=Xo.charAt((s&3)<<4|i>>4),isNaN(i)?t+="==":(t+=Xo.charAt((i&15)<<2|a>>6),t+=isNaN(a)?"=":Xo.charAt(a&63)),e&&t.length>e&&(n+=t.substr(0,e)+`\r
|
|
3
3
|
`,t=t.substr(e));return n+=t,n};re.decode64=function(r){r=r.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var e="",t,n,s,i,a=0;a<r.length;)t=Go[r.charCodeAt(a++)-43],n=Go[r.charCodeAt(a++)-43],s=Go[r.charCodeAt(a++)-43],i=Go[r.charCodeAt(a++)-43],e+=String.fromCharCode(t<<2|n>>4),s!==64&&(e+=String.fromCharCode((n&15)<<4|s>>2),i!==64&&(e+=String.fromCharCode((s&3)<<6|i)));return e};re.encodeUtf8=function(r){return unescape(encodeURIComponent(r))};re.decodeUtf8=function(r){return decodeURIComponent(escape(r))};re.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:x3.encode,decode:x3.decode}};re.binary.raw.encode=function(r){return String.fromCharCode.apply(null,r)};re.binary.raw.decode=function(r,e,t){var n=e;n||(n=new Uint8Array(r.length)),t=t||0;for(var s=t,i=0;i<r.length;++i)n[s++]=r.charCodeAt(i);return e?s-t:n};re.binary.hex.encode=re.bytesToHex;re.binary.hex.decode=function(r,e,t){var n=e;n||(n=new Uint8Array(Math.ceil(r.length/2))),t=t||0;var s=0,i=t;for(r.length&1&&(s=1,n[i++]=parseInt(r[0],16));s<r.length;s+=2)n[i++]=parseInt(r.substr(s,2),16);return e?i-t:n};re.binary.base64.encode=function(r,e){for(var t="",n="",s,i,a,u=0;u<r.byteLength;)s=r[u++],i=r[u++],a=r[u++],t+=Xo.charAt(s>>2),t+=Xo.charAt((s&3)<<4|i>>4),isNaN(i)?t+="==":(t+=Xo.charAt((i&15)<<2|a>>6),t+=isNaN(a)?"=":Xo.charAt(a&63)),e&&t.length>e&&(n+=t.substr(0,e)+`\r
|
|
4
|
-
`,t=t.substr(e));return n+=t,n};re.binary.base64.decode=function(r,e,t){var n=e;n||(n=new Uint8Array(Math.ceil(r.length/4)*3)),r=r.replace(/[^A-Za-z0-9\+\/\=]/g,""),t=t||0;for(var s,i,a,u,c=0,l=t;c<r.length;)s=Go[r.charCodeAt(c++)-43],i=Go[r.charCodeAt(c++)-43],a=Go[r.charCodeAt(c++)-43],u=Go[r.charCodeAt(c++)-43],n[l++]=s<<2|i>>4,a!==64&&(n[l++]=(i&15)<<4|a>>2,u!==64&&(n[l++]=(a&3)<<6|u));return e?l-t:n.subarray(0,l)};re.binary.base58.encode=function(r,e){return re.binary.baseN.encode(r,E3,e)};re.binary.base58.decode=function(r,e){return re.binary.baseN.decode(r,E3,e)};re.text={utf8:{},utf16:{}};re.text.utf8.encode=function(r,e,t){r=re.encodeUtf8(r);var n=e;n||(n=new Uint8Array(r.length)),t=t||0;for(var s=t,i=0;i<r.length;++i)n[s++]=r.charCodeAt(i);return e?s-t:n};re.text.utf8.decode=function(r){return re.decodeUtf8(String.fromCharCode.apply(null,r))};re.text.utf16.encode=function(r,e,t){var n=e;n||(n=new Uint8Array(r.length*2));var s=new Uint16Array(n.buffer);t=t||0;for(var i=t,a=t,u=0;u<r.length;++u)s[a++]=r.charCodeAt(u),i+=2;return e?i-t:n};re.text.utf16.decode=function(r){return String.fromCharCode.apply(null,new Uint16Array(r.buffer))};re.deflate=function(r,e,t){if(e=re.decode64(r.deflate(re.encode64(e)).rval),t){var n=2,s=e.charCodeAt(1);s&32&&(n=6),e=e.substring(n,e.length-4)}return e};re.inflate=function(r,e,t){var n=r.inflate(re.encode64(e)).rval;return n===null?null:re.decode64(n)};var SC=o(function(r,e,t){if(!r)throw new Error("WebStorage not available.");var n;if(t===null?n=r.removeItem(e):(t=re.encode64(JSON.stringify(t)),n=r.setItem(e,t)),typeof n<"u"&&n.rval!==!0){var s=new Error(n.error.message);throw s.id=n.error.id,s.name=n.error.name,s}},"_setStorageObject"),AC=o(function(r,e){if(!r)throw new Error("WebStorage not available.");var t=r.getItem(e);if(r.init)if(t.rval===null){if(t.error){var n=new Error(t.error.message);throw n.id=t.error.id,n.name=t.error.name,n}t=null}else t=t.rval;return t!==null&&(t=JSON.parse(re.decode64(t))),t},"_getStorageObject"),J$=o(function(r,e,t,n){var s=AC(r,e);s===null&&(s={}),s[t]=n,SC(r,e,s)},"_setItem"),Y$=o(function(r,e,t){var n=AC(r,e);return n!==null&&(n=t in n?n[t]:null),n},"_getItem"),Q$=o(function(r,e,t){var n=AC(r,e);if(n!==null&&t in n){delete n[t];var s=!0;for(var i in n){s=!1;break}s&&(n=null),SC(r,e,n)}},"_removeItem"),Z$=o(function(r,e){SC(r,e,null)},"_clearItems"),Kx=o(function(r,e,t){var n=null;typeof t>"u"&&(t=["web","flash"]);var s,i=!1,a=null;for(var u in t){s=t[u];try{if(s==="flash"||s==="both"){if(e[0]===null)throw new Error("Flash local storage not available.");n=r.apply(this,e),i=s==="flash"}(s==="web"||s==="both")&&(e[0]=localStorage,n=r.apply(this,e),i=!0)}catch(c){a=c}if(i)break}if(!i)throw a;return n},"_callStorageFunction");re.setItem=function(r,e,t,n,s){Kx(J$,arguments,s)};re.getItem=function(r,e,t,n){return Kx(Y$,arguments,n)};re.removeItem=function(r,e,t,n){Kx(Q$,arguments,n)};re.clearItems=function(r,e,t){Kx(Z$,arguments,t)};re.isEmpty=function(r){for(var e in r)if(r.hasOwnProperty(e))return!1;return!0};re.format=function(r){for(var e=/%./g,t,n,s=0,i=[],a=0;t=e.exec(r);){n=r.substring(a,e.lastIndex-2),n.length>0&&i.push(n),a=e.lastIndex;var u=t[0][1];switch(u){case"s":case"o":s<arguments.length?i.push(arguments[s+++1]):i.push("<?>");break;case"%":i.push("%");break;default:i.push("<%"+u+"?>")}}return i.push(r.substring(a)),i.join("")};re.formatNumber=function(r,e,t,n){var s=r,i=isNaN(e=Math.abs(e))?2:e,a=t===void 0?",":t,u=n===void 0?".":n,c=s<0?"-":"",l=parseInt(s=Math.abs(+s||0).toFixed(i),10)+"",f=l.length>3?l.length%3:0;return c+(f?l.substr(0,f)+u:"")+l.substr(f).replace(/(\d{3})(?=\d)/g,"$1"+u)+(i?a+Math.abs(s-l).toFixed(i).slice(2):"")};re.formatSize=function(r){return r>=1073741824?r=re.formatNumber(r/1073741824,2,".","")+" GiB":r>=1048576?r=re.formatNumber(r/1048576,2,".","")+" MiB":r>=1024?r=re.formatNumber(r/1024,0)+" KiB":r=re.formatNumber(r,0)+" bytes",r};re.bytesFromIP=function(r){return r.indexOf(".")!==-1?re.bytesFromIPv4(r):r.indexOf(":")!==-1?re.bytesFromIPv6(r):null};re.bytesFromIPv4=function(r){if(r=r.split("."),r.length!==4)return null;for(var e=re.createBuffer(),t=0;t<r.length;++t){var n=parseInt(r[t],10);if(isNaN(n))return null;e.putByte(n)}return e.getBytes()};re.bytesFromIPv6=function(r){var e=0;r=r.split(":").filter(function(a){return a.length===0&&++e,!0});for(var t=(8-r.length+e)*2,n=re.createBuffer(),s=0;s<8;++s){if(!r[s]||r[s].length===0){n.fillWithByte(0,t),t=0;continue}var i=re.hexToBytes(r[s]);i.length<2&&n.putByte(0),n.putBytes(i)}return n.getBytes()};re.bytesToIP=function(r){return r.length===4?re.bytesToIPv4(r):r.length===16?re.bytesToIPv6(r):null};re.bytesToIPv4=function(r){if(r.length!==4)return null;for(var e=[],t=0;t<r.length;++t)e.push(r.charCodeAt(t));return e.join(".")};re.bytesToIPv6=function(r){if(r.length!==16)return null;for(var e=[],t=[],n=0,s=0;s<r.length;s+=2){for(var i=re.bytesToHex(r[s]+r[s+1]);i[0]==="0"&&i!=="0";)i=i.substr(1);if(i==="0"){var a=t[t.length-1],u=e.length;!a||u!==a.end+1?t.push({start:u,end:u}):(a.end=u,a.end-a.start>t[n].end-t[n].start&&(n=t.length-1))}e.push(i)}if(t.length>0){var c=t[n];c.end-c.start>0&&(e.splice(c.start,c.end-c.start+1,""),c.start===0&&e.unshift(""),c.end===7&&e.push(""))}return e.join(":")};re.estimateCores=function(r,e){if(typeof r=="function"&&(e=r,r={}),r=r||{},"cores"in re&&!r.update)return e(null,re.cores);if(typeof navigator<"u"&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return re.cores=navigator.hardwareConcurrency,e(null,re.cores);if(typeof Worker>"u")return re.cores=1,e(null,re.cores);if(typeof Blob>"u")return re.cores=2,e(null,re.cores);var t=URL.createObjectURL(new Blob(["(",(function(){self.addEventListener("message",function(a){for(var u=Date.now(),c=u+4;Date.now()<c;);self.postMessage({st:u,et:c})})}).toString(),")()"],{type:"application/javascript"}));n([],5,16);function n(a,u,c){if(u===0){var l=Math.floor(a.reduce(function(f,h){return f+h},0)/a.length);return re.cores=Math.max(1,l),URL.revokeObjectURL(t),e(null,re.cores)}s(c,function(f,h){a.push(i(c,h)),n(a,u-1,c)})}o(n,"sample");function s(a,u){for(var c=[],l=[],f=0;f<a;++f){var h=new Worker(t);h.addEventListener("message",function(d){if(l.push(d.data),l.length===a){for(var g=0;g<a;++g)c[g].terminate();u(null,l)}}),c.push(h)}for(var f=0;f<a;++f)c[f].postMessage(f)}o(s,"map");function i(a,u){for(var c=[],l=0;l<a;++l)for(var f=u[l],h=c[l]=[],d=0;d<a;++d)if(l!==d){var g=u[d];(f.st>g.st&&f.st<g.et||g.st>f.st&&g.st<f.et)&&h.push(d)}return c.reduce(function(m,v){return Math.max(m,v.length)},0)}o(i,"reduce")}});var $x=X((Ume,b3)=>{"use strict";var pn=It();zt();b3.exports=pn.cipher=pn.cipher||{};pn.cipher.algorithms=pn.cipher.algorithms||{};pn.cipher.createCipher=function(r,e){var t=r;if(typeof t=="string"&&(t=pn.cipher.getAlgorithm(t),t&&(t=t())),!t)throw new Error("Unsupported algorithm: "+r);return new pn.cipher.BlockCipher({algorithm:t,key:e,decrypt:!1})};pn.cipher.createDecipher=function(r,e){var t=r;if(typeof t=="string"&&(t=pn.cipher.getAlgorithm(t),t&&(t=t())),!t)throw new Error("Unsupported algorithm: "+r);return new pn.cipher.BlockCipher({algorithm:t,key:e,decrypt:!0})};pn.cipher.registerAlgorithm=function(r,e){r=r.toUpperCase(),pn.cipher.algorithms[r]=e};pn.cipher.getAlgorithm=function(r){return r=r.toUpperCase(),r in pn.cipher.algorithms?pn.cipher.algorithms[r]:null};var CC=pn.cipher.BlockCipher=function(r){this.algorithm=r.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=r.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=r.decrypt,this.algorithm.initialize(r)};CC.prototype.start=function(r){r=r||{};var e={};for(var t in r)e[t]=r[t];e.decrypt=this._decrypt,this._finish=!1,this._input=pn.util.createBuffer(),this.output=r.output||pn.util.createBuffer(),this.mode.start(e)};CC.prototype.update=function(r){for(r&&this._input.putBuffer(r);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()};CC.prototype.finish=function(r){r&&(this.mode.name==="ECB"||this.mode.name==="CBC")&&(this.mode.pad=function(t){return r(this.blockSize,t,!1)},this.mode.unpad=function(t){return r(this.blockSize,t,!0)});var e={};return e.decrypt=this._decrypt,e.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,e)||(this._finish=!0,this.update(),this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,e))||this.mode.afterFinish&&!this.mode.afterFinish(this.output,e))}});var TC=X((Vme,S3)=>{"use strict";var dn=It();zt();dn.cipher=dn.cipher||{};var _t=S3.exports=dn.cipher.modes=dn.cipher.modes||{};_t.ecb=function(r){r=r||{},this.name="ECB",this.cipher=r.cipher,this.blockSize=r.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)};_t.ecb.prototype.start=function(r){};_t.ecb.prototype.encrypt=function(r,e,t){if(r.length()<this.blockSize&&!(t&&r.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=r.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var n=0;n<this._ints;++n)e.putInt32(this._outBlock[n])};_t.ecb.prototype.decrypt=function(r,e,t){if(r.length()<this.blockSize&&!(t&&r.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=r.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var n=0;n<this._ints;++n)e.putInt32(this._outBlock[n])};_t.ecb.prototype.pad=function(r,e){var t=r.length()===this.blockSize?this.blockSize:this.blockSize-r.length();return r.fillWithByte(t,t),!0};_t.ecb.prototype.unpad=function(r,e){if(e.overflow>0)return!1;var t=r.length(),n=r.at(t-1);return n>this.blockSize<<2?!1:(r.truncate(n),!0)};_t.cbc=function(r){r=r||{},this.name="CBC",this.cipher=r.cipher,this.blockSize=r.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)};_t.cbc.prototype.start=function(r){if(r.iv===null){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else if("iv"in r)this._iv=Xx(r.iv,this.blockSize),this._prev=this._iv.slice(0);else throw new Error("Invalid IV parameter.")};_t.cbc.prototype.encrypt=function(r,e,t){if(r.length()<this.blockSize&&!(t&&r.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=this._prev[n]^r.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var n=0;n<this._ints;++n)e.putInt32(this._outBlock[n]);this._prev=this._outBlock};_t.cbc.prototype.decrypt=function(r,e,t){if(r.length()<this.blockSize&&!(t&&r.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=r.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var n=0;n<this._ints;++n)e.putInt32(this._prev[n]^this._outBlock[n]);this._prev=this._inBlock.slice(0)};_t.cbc.prototype.pad=function(r,e){var t=r.length()===this.blockSize?this.blockSize:this.blockSize-r.length();return r.fillWithByte(t,t),!0};_t.cbc.prototype.unpad=function(r,e){if(e.overflow>0)return!1;var t=r.length(),n=r.at(t-1);return n>this.blockSize<<2?!1:(r.truncate(n),!0)};_t.cfb=function(r){r=r||{},this.name="CFB",this.cipher=r.cipher,this.blockSize=r.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=dn.util.createBuffer(),this._partialBytes=0};_t.cfb.prototype.start=function(r){if(!("iv"in r))throw new Error("Invalid IV parameter.");this._iv=Xx(r.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};_t.cfb.prototype.encrypt=function(r,e,t){var n=r.length();if(n===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&n>=this.blockSize){for(var s=0;s<this._ints;++s)this._inBlock[s]=r.getInt32()^this._outBlock[s],e.putInt32(this._inBlock[s]);return}var i=(this.blockSize-n)%this.blockSize;i>0&&(i=this.blockSize-i),this._partialOutput.clear();for(var s=0;s<this._ints;++s)this._partialBlock[s]=r.getInt32()^this._outBlock[s],this._partialOutput.putInt32(this._partialBlock[s]);if(i>0)r.read-=this.blockSize;else for(var s=0;s<this._ints;++s)this._inBlock[s]=this._partialBlock[s];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!t)return e.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0};_t.cfb.prototype.decrypt=function(r,e,t){var n=r.length();if(n===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&n>=this.blockSize){for(var s=0;s<this._ints;++s)this._inBlock[s]=r.getInt32(),e.putInt32(this._inBlock[s]^this._outBlock[s]);return}var i=(this.blockSize-n)%this.blockSize;i>0&&(i=this.blockSize-i),this._partialOutput.clear();for(var s=0;s<this._ints;++s)this._partialBlock[s]=r.getInt32(),this._partialOutput.putInt32(this._partialBlock[s]^this._outBlock[s]);if(i>0)r.read-=this.blockSize;else for(var s=0;s<this._ints;++s)this._inBlock[s]=this._partialBlock[s];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!t)return e.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0};_t.ofb=function(r){r=r||{},this.name="OFB",this.cipher=r.cipher,this.blockSize=r.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=dn.util.createBuffer(),this._partialBytes=0};_t.ofb.prototype.start=function(r){if(!("iv"in r))throw new Error("Invalid IV parameter.");this._iv=Xx(r.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};_t.ofb.prototype.encrypt=function(r,e,t){var n=r.length();if(r.length()===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&n>=this.blockSize){for(var s=0;s<this._ints;++s)e.putInt32(r.getInt32()^this._outBlock[s]),this._inBlock[s]=this._outBlock[s];return}var i=(this.blockSize-n)%this.blockSize;i>0&&(i=this.blockSize-i),this._partialOutput.clear();for(var s=0;s<this._ints;++s)this._partialOutput.putInt32(r.getInt32()^this._outBlock[s]);if(i>0)r.read-=this.blockSize;else for(var s=0;s<this._ints;++s)this._inBlock[s]=this._outBlock[s];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!t)return e.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0};_t.ofb.prototype.decrypt=_t.ofb.prototype.encrypt;_t.ctr=function(r){r=r||{},this.name="CTR",this.cipher=r.cipher,this.blockSize=r.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=dn.util.createBuffer(),this._partialBytes=0};_t.ctr.prototype.start=function(r){if(!("iv"in r))throw new Error("Invalid IV parameter.");this._iv=Xx(r.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};_t.ctr.prototype.encrypt=function(r,e,t){var n=r.length();if(n===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&n>=this.blockSize)for(var s=0;s<this._ints;++s)e.putInt32(r.getInt32()^this._outBlock[s]);else{var i=(this.blockSize-n)%this.blockSize;i>0&&(i=this.blockSize-i),this._partialOutput.clear();for(var s=0;s<this._ints;++s)this._partialOutput.putInt32(r.getInt32()^this._outBlock[s]);if(i>0&&(r.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!t)return e.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}Gx(this._inBlock)};_t.ctr.prototype.decrypt=_t.ctr.prototype.encrypt;_t.gcm=function(r){r=r||{},this.name="GCM",this.cipher=r.cipher,this.blockSize=r.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=dn.util.createBuffer(),this._partialBytes=0,this._R=3774873600};_t.gcm.prototype.start=function(r){if(!("iv"in r))throw new Error("Invalid IV parameter.");var e=dn.util.createBuffer(r.iv);this._cipherLength=0;var t;if("additionalData"in r?t=dn.util.createBuffer(r.additionalData):t=dn.util.createBuffer(),"tagLength"in r?this._tagLength=r.tagLength:this._tagLength=128,this._tag=null,r.decrypt&&(this._tag=dn.util.createBuffer(r.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var n=e.length();if(n===12)this._j0=[e.getInt32(),e.getInt32(),e.getInt32(),1];else{for(this._j0=[0,0,0,0];e.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[e.getInt32(),e.getInt32(),e.getInt32(),e.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(NC(n*8)))}this._inBlock=this._j0.slice(0),Gx(this._inBlock),this._partialBytes=0,t=dn.util.createBuffer(t),this._aDataLength=NC(t.length()*8);var s=t.length()%this.blockSize;for(s&&t.fillWithByte(0,this.blockSize-s),this._s=[0,0,0,0];t.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()])};_t.gcm.prototype.encrypt=function(r,e,t){var n=r.length();if(n===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&n>=this.blockSize){for(var s=0;s<this._ints;++s)e.putInt32(this._outBlock[s]^=r.getInt32());this._cipherLength+=this.blockSize}else{var i=(this.blockSize-n)%this.blockSize;i>0&&(i=this.blockSize-i),this._partialOutput.clear();for(var s=0;s<this._ints;++s)this._partialOutput.putInt32(r.getInt32()^this._outBlock[s]);if(i<=0||t){if(t){var a=n%this.blockSize;this._cipherLength+=a,this._partialOutput.truncate(this.blockSize-a)}else this._cipherLength+=this.blockSize;for(var s=0;s<this._ints;++s)this._outBlock[s]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!t)return r.read-=this.blockSize,e.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),Gx(this._inBlock)};_t.gcm.prototype.decrypt=function(r,e,t){var n=r.length();if(n<this.blockSize&&!(t&&n>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),Gx(this._inBlock),this._hashBlock[0]=r.getInt32(),this._hashBlock[1]=r.getInt32(),this._hashBlock[2]=r.getInt32(),this._hashBlock[3]=r.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var s=0;s<this._ints;++s)e.putInt32(this._outBlock[s]^this._hashBlock[s]);n<this.blockSize?this._cipherLength+=n%this.blockSize:this._cipherLength+=this.blockSize};_t.gcm.prototype.afterFinish=function(r,e){var t=!0;e.decrypt&&e.overflow&&r.truncate(this.blockSize-e.overflow),this.tag=dn.util.createBuffer();var n=this._aDataLength.concat(NC(this._cipherLength*8));this._s=this.ghash(this._hashSubkey,this._s,n);var s=[];this.cipher.encrypt(this._j0,s);for(var i=0;i<this._ints;++i)this.tag.putInt32(this._s[i]^s[i]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),e.decrypt&&this.tag.bytes()!==this._tag&&(t=!1),t};_t.gcm.prototype.multiply=function(r,e){for(var t=[0,0,0,0],n=e.slice(0),s=0;s<128;++s){var i=r[s/32|0]&1<<31-s%32;i&&(t[0]^=n[0],t[1]^=n[1],t[2]^=n[2],t[3]^=n[3]),this.pow(n,n)}return t};_t.gcm.prototype.pow=function(r,e){for(var t=r[3]&1,n=3;n>0;--n)e[n]=r[n]>>>1|(r[n-1]&1)<<31;e[0]=r[0]>>>1,t&&(e[0]^=this._R)};_t.gcm.prototype.tableMultiply=function(r){for(var e=[0,0,0,0],t=0;t<32;++t){var n=t/8|0,s=r[n]>>>(7-t%8)*4&15,i=this._m[t][s];e[0]^=i[0],e[1]^=i[1],e[2]^=i[2],e[3]^=i[3]}return e};_t.gcm.prototype.ghash=function(r,e,t){return e[0]^=t[0],e[1]^=t[1],e[2]^=t[2],e[3]^=t[3],this.tableMultiply(e)};_t.gcm.prototype.generateHashTable=function(r,e){for(var t=8/e,n=4*t,s=16*t,i=new Array(s),a=0;a<s;++a){var u=[0,0,0,0],c=a/n|0,l=(n-1-a%n)*e;u[c]=1<<e-1<<l,i[a]=this.generateSubHashTable(this.multiply(u,r),e)}return i};_t.gcm.prototype.generateSubHashTable=function(r,e){var t=1<<e,n=t>>>1,s=new Array(t);s[n]=r.slice(0);for(var i=n>>>1;i>0;)this.pow(s[2*i],s[i]=[]),i>>=1;for(i=2;i<n;){for(var a=1;a<i;++a){var u=s[i],c=s[a];s[i+a]=[u[0]^c[0],u[1]^c[1],u[2]^c[2],u[3]^c[3]]}i*=2}for(s[0]=[0,0,0,0],i=n+1;i<t;++i){var l=s[i^n];s[i]=[r[0]^l[0],r[1]^l[1],r[2]^l[2],r[3]^l[3]]}return s};function Xx(r,e){if(typeof r=="string"&&(r=dn.util.createBuffer(r)),dn.util.isArray(r)&&r.length>4){var t=r;r=dn.util.createBuffer();for(var n=0;n<t.length;++n)r.putByte(t[n])}if(r.length()<e)throw new Error("Invalid IV length; got "+r.length()+" bytes and expected "+e+" bytes.");if(!dn.util.isArray(r)){for(var s=[],i=e/4,n=0;n<i;++n)s.push(r.getInt32());r=s}return r}o(Xx,"transformIV");function Gx(r){r[r.length-1]=r[r.length-1]+1&4294967295}o(Gx,"inc32");function NC(r){return[r/4294967296|0,r&4294967295]}o(NC,"from64To32")});var zo=X((jme,T3)=>{"use strict";var vr=It();$x();TC();zt();T3.exports=vr.aes=vr.aes||{};vr.aes.startEncrypting=function(r,e,t,n){var s=zx({key:r,output:t,decrypt:!1,mode:n});return s.start(e),s};vr.aes.createEncryptionCipher=function(r,e){return zx({key:r,output:null,decrypt:!1,mode:e})};vr.aes.startDecrypting=function(r,e,t,n){var s=zx({key:r,output:t,decrypt:!0,mode:n});return s.start(e),s};vr.aes.createDecryptionCipher=function(r,e){return zx({key:r,output:null,decrypt:!0,mode:e})};vr.aes.Algorithm=function(r,e){BC||C3();var t=this;t.name=r,t.mode=new e({blockSize:16,cipher:{encrypt:o(function(n,s){return DC(t._w,n,s,!1)},"encrypt"),decrypt:o(function(n,s){return DC(t._w,n,s,!0)},"decrypt")}}),t._init=!1};vr.aes.Algorithm.prototype.initialize=function(r){if(!this._init){var e=r.key,t;if(typeof e=="string"&&(e.length===16||e.length===24||e.length===32))e=vr.util.createBuffer(e);else if(vr.util.isArray(e)&&(e.length===16||e.length===24||e.length===32)){t=e,e=vr.util.createBuffer();for(var n=0;n<t.length;++n)e.putByte(t[n])}if(!vr.util.isArray(e)){t=e,e=[];var s=t.length();if(s===16||s===24||s===32){s=s>>>2;for(var n=0;n<s;++n)e.push(t.getInt32())}}if(!vr.util.isArray(e)||!(e.length===4||e.length===6||e.length===8))throw new Error("Invalid key parameter.");var i=this.mode.name,a=["CFB","OFB","CTR","GCM"].indexOf(i)!==-1;this._w=N3(e,r.decrypt&&!a),this._init=!0}};vr.aes._expandKey=function(r,e){return BC||C3(),N3(r,e)};vr.aes._updateBlock=DC;bh("AES-ECB",vr.cipher.modes.ecb);bh("AES-CBC",vr.cipher.modes.cbc);bh("AES-CFB",vr.cipher.modes.cfb);bh("AES-OFB",vr.cipher.modes.ofb);bh("AES-CTR",vr.cipher.modes.ctr);bh("AES-GCM",vr.cipher.modes.gcm);function bh(r,e){var t=o(function(){return new vr.aes.Algorithm(r,e)},"factory");vr.cipher.registerAlgorithm(r,t)}o(bh,"registerAlgorithm");var BC=!1,wh=4,Jn,IC,A3,$c,Ai;function C3(){BC=!0,A3=[0,1,2,4,8,16,32,64,128,27,54];for(var r=new Array(256),e=0;e<128;++e)r[e]=e<<1,r[e+128]=e+128<<1^283;Jn=new Array(256),IC=new Array(256),$c=new Array(4),Ai=new Array(4);for(var e=0;e<4;++e)$c[e]=new Array(256),Ai[e]=new Array(256);for(var t=0,n=0,s,i,a,u,c,l,f,e=0;e<256;++e){u=n^n<<1^n<<2^n<<3^n<<4,u=u>>8^u&255^99,Jn[t]=u,IC[u]=t,c=r[u],s=r[t],i=r[s],a=r[i],l=c<<24^u<<16^u<<8^(u^c),f=(s^i^a)<<24^(t^a)<<16^(t^i^a)<<8^(t^s^a);for(var h=0;h<4;++h)$c[h][t]=l,Ai[h][u]=f,l=l<<24|l>>>8,f=f<<24|f>>>8;t===0?t=n=1:(t=s^r[r[r[s^a]]],n^=r[r[n]])}}o(C3,"initialize");function N3(r,e){for(var t=r.slice(0),n,s=1,i=t.length,a=i+6+1,u=wh*a,c=i;c<u;++c)n=t[c-1],c%i===0?(n=Jn[n>>>16&255]<<24^Jn[n>>>8&255]<<16^Jn[n&255]<<8^Jn[n>>>24]^A3[s]<<24,s++):i>6&&c%i===4&&(n=Jn[n>>>24]<<24^Jn[n>>>16&255]<<16^Jn[n>>>8&255]<<8^Jn[n&255]),t[c]=t[c-i]^n;if(e){var l,f=Ai[0],h=Ai[1],d=Ai[2],g=Ai[3],m=t.slice(0);u=t.length;for(var c=0,v=u-wh;c<u;c+=wh,v-=wh)if(c===0||c===u-wh)m[c]=t[v],m[c+1]=t[v+3],m[c+2]=t[v+2],m[c+3]=t[v+1];else for(var y=0;y<wh;++y)l=t[v+y],m[c+(3&-y)]=f[Jn[l>>>24]]^h[Jn[l>>>16&255]]^d[Jn[l>>>8&255]]^g[Jn[l&255]];t=m}return t}o(N3,"_expandKey");function DC(r,e,t,n){var s=r.length/4-1,i,a,u,c,l;n?(i=Ai[0],a=Ai[1],u=Ai[2],c=Ai[3],l=IC):(i=$c[0],a=$c[1],u=$c[2],c=$c[3],l=Jn);var f,h,d,g,m,v,y;f=e[0]^r[0],h=e[n?3:1]^r[1],d=e[2]^r[2],g=e[n?1:3]^r[3];for(var w=3,S=1;S<s;++S)m=i[f>>>24]^a[h>>>16&255]^u[d>>>8&255]^c[g&255]^r[++w],v=i[h>>>24]^a[d>>>16&255]^u[g>>>8&255]^c[f&255]^r[++w],y=i[d>>>24]^a[g>>>16&255]^u[f>>>8&255]^c[h&255]^r[++w],g=i[g>>>24]^a[f>>>16&255]^u[h>>>8&255]^c[d&255]^r[++w],f=m,h=v,d=y;t[0]=l[f>>>24]<<24^l[h>>>16&255]<<16^l[d>>>8&255]<<8^l[g&255]^r[++w],t[n?3:1]=l[h>>>24]<<24^l[d>>>16&255]<<16^l[g>>>8&255]<<8^l[f&255]^r[++w],t[2]=l[d>>>24]<<24^l[g>>>16&255]<<16^l[f>>>8&255]<<8^l[h&255]^r[++w],t[n?1:3]=l[g>>>24]<<24^l[f>>>16&255]<<16^l[h>>>8&255]<<8^l[d&255]^r[++w]}o(DC,"_updateBlock");function zx(r){r=r||{};var e=(r.mode||"CBC").toUpperCase(),t="AES-"+e,n;r.decrypt?n=vr.cipher.createDecipher(t,r.key):n=vr.cipher.createCipher(t,r.key);var s=n.start;return n.start=function(i,a){var u=null;a instanceof vr.util.ByteBuffer&&(u=a,a={}),a=a||{},a.output=u,a.iv=i,s.call(n,a)},n}o(zx,"_createCipher")});var Wo=X((Hme,I3)=>{"use strict";var C0=It();C0.pki=C0.pki||{};var RC=I3.exports=C0.pki.oids=C0.oids=C0.oids||{};function Re(r,e){RC[r]=e,RC[e]=r}o(Re,"_IN");function nr(r,e){RC[r]=e}o(nr,"_I_");Re("1.2.840.113549.1.1.1","rsaEncryption");Re("1.2.840.113549.1.1.4","md5WithRSAEncryption");Re("1.2.840.113549.1.1.5","sha1WithRSAEncryption");Re("1.2.840.113549.1.1.7","RSAES-OAEP");Re("1.2.840.113549.1.1.8","mgf1");Re("1.2.840.113549.1.1.9","pSpecified");Re("1.2.840.113549.1.1.10","RSASSA-PSS");Re("1.2.840.113549.1.1.11","sha256WithRSAEncryption");Re("1.2.840.113549.1.1.12","sha384WithRSAEncryption");Re("1.2.840.113549.1.1.13","sha512WithRSAEncryption");Re("1.3.101.112","EdDSA25519");Re("1.2.840.10040.4.3","dsa-with-sha1");Re("1.3.14.3.2.7","desCBC");Re("1.3.14.3.2.26","sha1");Re("1.3.14.3.2.29","sha1WithRSASignature");Re("2.16.840.1.101.3.4.2.1","sha256");Re("2.16.840.1.101.3.4.2.2","sha384");Re("2.16.840.1.101.3.4.2.3","sha512");Re("2.16.840.1.101.3.4.2.4","sha224");Re("2.16.840.1.101.3.4.2.5","sha512-224");Re("2.16.840.1.101.3.4.2.6","sha512-256");Re("1.2.840.113549.2.2","md2");Re("1.2.840.113549.2.5","md5");Re("1.2.840.113549.1.7.1","data");Re("1.2.840.113549.1.7.2","signedData");Re("1.2.840.113549.1.7.3","envelopedData");Re("1.2.840.113549.1.7.4","signedAndEnvelopedData");Re("1.2.840.113549.1.7.5","digestedData");Re("1.2.840.113549.1.7.6","encryptedData");Re("1.2.840.113549.1.9.1","emailAddress");Re("1.2.840.113549.1.9.2","unstructuredName");Re("1.2.840.113549.1.9.3","contentType");Re("1.2.840.113549.1.9.4","messageDigest");Re("1.2.840.113549.1.9.5","signingTime");Re("1.2.840.113549.1.9.6","counterSignature");Re("1.2.840.113549.1.9.7","challengePassword");Re("1.2.840.113549.1.9.8","unstructuredAddress");Re("1.2.840.113549.1.9.14","extensionRequest");Re("1.2.840.113549.1.9.20","friendlyName");Re("1.2.840.113549.1.9.21","localKeyId");Re("1.2.840.113549.1.9.22.1","x509Certificate");Re("1.2.840.113549.1.12.10.1.1","keyBag");Re("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag");Re("1.2.840.113549.1.12.10.1.3","certBag");Re("1.2.840.113549.1.12.10.1.4","crlBag");Re("1.2.840.113549.1.12.10.1.5","secretBag");Re("1.2.840.113549.1.12.10.1.6","safeContentsBag");Re("1.2.840.113549.1.5.13","pkcs5PBES2");Re("1.2.840.113549.1.5.12","pkcs5PBKDF2");Re("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4");Re("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4");Re("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC");Re("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC");Re("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC");Re("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC");Re("1.2.840.113549.2.7","hmacWithSHA1");Re("1.2.840.113549.2.8","hmacWithSHA224");Re("1.2.840.113549.2.9","hmacWithSHA256");Re("1.2.840.113549.2.10","hmacWithSHA384");Re("1.2.840.113549.2.11","hmacWithSHA512");Re("1.2.840.113549.3.7","des-EDE3-CBC");Re("2.16.840.1.101.3.4.1.2","aes128-CBC");Re("2.16.840.1.101.3.4.1.22","aes192-CBC");Re("2.16.840.1.101.3.4.1.42","aes256-CBC");Re("2.5.4.3","commonName");Re("2.5.4.4","surname");Re("2.5.4.5","serialNumber");Re("2.5.4.6","countryName");Re("2.5.4.7","localityName");Re("2.5.4.8","stateOrProvinceName");Re("2.5.4.9","streetAddress");Re("2.5.4.10","organizationName");Re("2.5.4.11","organizationalUnitName");Re("2.5.4.12","title");Re("2.5.4.13","description");Re("2.5.4.15","businessCategory");Re("2.5.4.17","postalCode");Re("2.5.4.42","givenName");Re("2.5.4.65","pseudonym");Re("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName");Re("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName");Re("2.16.840.1.113730.1.1","nsCertType");Re("2.16.840.1.113730.1.13","nsComment");nr("2.5.29.1","authorityKeyIdentifier");nr("2.5.29.2","keyAttributes");nr("2.5.29.3","certificatePolicies");nr("2.5.29.4","keyUsageRestriction");nr("2.5.29.5","policyMapping");nr("2.5.29.6","subtreesConstraint");nr("2.5.29.7","subjectAltName");nr("2.5.29.8","issuerAltName");nr("2.5.29.9","subjectDirectoryAttributes");nr("2.5.29.10","basicConstraints");nr("2.5.29.11","nameConstraints");nr("2.5.29.12","policyConstraints");nr("2.5.29.13","basicConstraints");Re("2.5.29.14","subjectKeyIdentifier");Re("2.5.29.15","keyUsage");nr("2.5.29.16","privateKeyUsagePeriod");Re("2.5.29.17","subjectAltName");Re("2.5.29.18","issuerAltName");Re("2.5.29.19","basicConstraints");nr("2.5.29.20","cRLNumber");nr("2.5.29.21","cRLReason");nr("2.5.29.22","expirationDate");nr("2.5.29.23","instructionCode");nr("2.5.29.24","invalidityDate");nr("2.5.29.25","cRLDistributionPoints");nr("2.5.29.26","issuingDistributionPoint");nr("2.5.29.27","deltaCRLIndicator");nr("2.5.29.28","issuingDistributionPoint");nr("2.5.29.29","certificateIssuer");nr("2.5.29.30","nameConstraints");Re("2.5.29.31","cRLDistributionPoints");Re("2.5.29.32","certificatePolicies");nr("2.5.29.33","policyMappings");nr("2.5.29.34","policyConstraints");Re("2.5.29.35","authorityKeyIdentifier");nr("2.5.29.36","policyConstraints");Re("2.5.29.37","extKeyUsage");nr("2.5.29.46","freshestCRL");nr("2.5.29.54","inhibitAnyPolicy");Re("1.3.6.1.4.1.11129.2.4.2","timestampList");Re("1.3.6.1.5.5.7.1.1","authorityInfoAccess");Re("1.3.6.1.5.5.7.3.1","serverAuth");Re("1.3.6.1.5.5.7.3.2","clientAuth");Re("1.3.6.1.5.5.7.3.3","codeSigning");Re("1.3.6.1.5.5.7.3.4","emailProtection");Re("1.3.6.1.5.5.7.3.8","timeStamping")});var Ci=X(($me,B3)=>{"use strict";var Cr=It();zt();Wo();var je=B3.exports=Cr.asn1=Cr.asn1||{};je.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192};je.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30};je.maxDepth=256;je.create=function(r,e,t,n,s){if(Cr.util.isArray(n)){for(var i=[],a=0;a<n.length;++a)n[a]!==void 0&&i.push(n[a]);n=i}var u={tagClass:r,type:e,constructed:t,composed:t||Cr.util.isArray(n),value:n};return s&&"bitStringContents"in s&&(u.bitStringContents=s.bitStringContents,u.original=je.copy(u)),u};je.copy=function(r,e){var t;if(Cr.util.isArray(r)){t=[];for(var n=0;n<r.length;++n)t.push(je.copy(r[n],e));return t}return typeof r=="string"?r:(t={tagClass:r.tagClass,type:r.type,constructed:r.constructed,composed:r.composed,value:je.copy(r.value,e)},e&&!e.excludeBitStringContents&&(t.bitStringContents=r.bitStringContents),t)};je.equals=function(r,e,t){if(Cr.util.isArray(r)){if(!Cr.util.isArray(e)||r.length!==e.length)return!1;for(var n=0;n<r.length;++n)if(!je.equals(r[n],e[n]))return!1;return!0}if(typeof r!=typeof e)return!1;if(typeof r=="string")return r===e;var s=r.tagClass===e.tagClass&&r.type===e.type&&r.constructed===e.constructed&&r.composed===e.composed&&je.equals(r.value,e.value);return t&&t.includeBitStringContents&&(s=s&&r.bitStringContents===e.bitStringContents),s};je.getBerValueLength=function(r){var e=r.getByte();if(e!==128){var t,n=e&128;return n?t=r.getInt((e&127)<<3):t=e,t}};function N0(r,e,t){if(t>e){var n=new Error("Too few bytes to parse DER.");throw n.available=r.length(),n.remaining=e,n.requested=t,n}}o(N0,"_checkBufferLength");var eX=o(function(r,e){var t=r.getByte();if(e--,t!==128){var n,s=t&128;if(!s)n=t;else{var i=t&127;N0(r,e,i),n=r.getInt(i<<3)}if(n<0)throw new Error("Negative length: "+n);return n}},"_getValueLength");je.fromDer=function(r,e){e===void 0&&(e={strict:!0,parseAllBytes:!0,decodeBitStrings:!0}),typeof e=="boolean"&&(e={strict:e,parseAllBytes:!0,decodeBitStrings:!0}),"strict"in e||(e.strict=!0),"parseAllBytes"in e||(e.parseAllBytes=!0),"decodeBitStrings"in e||(e.decodeBitStrings=!0),"maxDepth"in e||(e.maxDepth=je.maxDepth),typeof r=="string"&&(r=Cr.util.createBuffer(r));var t=r.length(),n=Wx(r,r.length(),0,e);if(e.parseAllBytes&&r.length()!==0){var s=new Error("Unparsed DER bytes remain after ASN.1 parsing.");throw s.byteCount=t,s.remaining=r.length(),s}return n};function Wx(r,e,t,n){if(t>=n.maxDepth)throw new Error("ASN.1 parsing error: Max depth exceeded.");var s;N0(r,e,2);var i=r.getByte();e--;var a=i&192,u=i&31;s=r.length();var c=eX(r,e);if(e-=s-r.length(),c!==void 0&&c>e){if(n.strict){var l=new Error("Too few bytes to read ASN.1 value.");throw l.available=r.length(),l.remaining=e,l.requested=c,l}c=e}var f,h,d=(i&32)===32;if(d)if(f=[],c===void 0)for(;;){if(N0(r,e,2),r.bytes(2)==="\0\0"){r.getBytes(2),e-=2;break}s=r.length(),f.push(Wx(r,e,t+1,n)),e-=s-r.length()}else for(;c>0;)s=r.length(),f.push(Wx(r,c,t+1,n)),e-=s-r.length(),c-=s-r.length();if(f===void 0&&a===je.Class.UNIVERSAL&&u===je.Type.BITSTRING&&(h=r.bytes(c)),f===void 0&&n.decodeBitStrings&&a===je.Class.UNIVERSAL&&u===je.Type.BITSTRING&&c>1){var g=r.read,m=e,v=0;if(u===je.Type.BITSTRING&&(N0(r,e,1),v=r.getByte(),e--),v===0)try{s=r.length();var y={strict:!0,decodeBitStrings:!0},w=Wx(r,e,t+1,y),S=s-r.length();e-=S,u==je.Type.BITSTRING&&S++;var E=w.tagClass;S===c&&(E===je.Class.UNIVERSAL||E===je.Class.CONTEXT_SPECIFIC)&&(f=[w])}catch{}f===void 0&&(r.read=g,e=m)}if(f===void 0){if(c===void 0){if(n.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");c=e}if(u===je.Type.BMPSTRING)for(f="";c>0;c-=2)N0(r,e,2),f+=String.fromCharCode(r.getInt16()),e-=2;else f=r.getBytes(c),e-=c}var x=h===void 0?null:{bitStringContents:h};return je.create(a,u,d,f,x)}o(Wx,"_fromDer");je.toDer=function(r){var e=Cr.util.createBuffer(),t=r.tagClass|r.type,n=Cr.util.createBuffer(),s=!1;if("bitStringContents"in r&&(s=!0,r.original&&(s=je.equals(r,r.original))),s)n.putBytes(r.bitStringContents);else if(r.composed){r.constructed?t|=32:n.putByte(0);for(var i=0;i<r.value.length;++i)r.value[i]!==void 0&&n.putBuffer(je.toDer(r.value[i]))}else if(r.type===je.Type.BMPSTRING)for(var i=0;i<r.value.length;++i)n.putInt16(r.value.charCodeAt(i));else r.type===je.Type.INTEGER&&r.value.length>1&&(r.value.charCodeAt(0)===0&&(r.value.charCodeAt(1)&128)===0||r.value.charCodeAt(0)===255&&(r.value.charCodeAt(1)&128)===128)?n.putBytes(r.value.substr(1)):n.putBytes(r.value);if(e.putByte(t),n.length()<=127)e.putByte(n.length()&127);else{var a=n.length(),u="";do u+=String.fromCharCode(a&255),a=a>>>8;while(a>0);e.putByte(u.length|128);for(var i=u.length-1;i>=0;--i)e.putByte(u.charCodeAt(i))}return e.putBuffer(n),e};je.oidToDer=function(r){var e=r.split("."),t=Cr.util.createBuffer();t.putByte(40*parseInt(e[0],10)+parseInt(e[1],10));for(var n,s,i,a,u=2;u<e.length;++u){if(n=!0,s=[],i=parseInt(e[u],10),i>4294967295)throw new Error("OID value too large; max is 32-bits.");do a=i&127,i=i>>>7,n||(a|=128),s.push(a),n=!1;while(i>0);for(var c=s.length-1;c>=0;--c)t.putByte(s[c])}return t};je.derToOid=function(r){var e;typeof r=="string"&&(r=Cr.util.createBuffer(r));var t=r.getByte();e=Math.floor(t/40)+"."+t%40;for(var n=0;r.length()>0;){if(n>70368744177663)throw new Error("OID value too large; max is 53-bits.");t=r.getByte(),n=n*128,t&128?n+=t&127:(e+="."+(n+t),n=0)}return e};je.utcTimeToDate=function(r){var e=new Date,t=parseInt(r.substr(0,2),10);t=t>=50?1900+t:2e3+t;var n=parseInt(r.substr(2,2),10)-1,s=parseInt(r.substr(4,2),10),i=parseInt(r.substr(6,2),10),a=parseInt(r.substr(8,2),10),u=0;if(r.length>11){var c=r.charAt(10),l=10;c!=="+"&&c!=="-"&&(u=parseInt(r.substr(10,2),10),l+=2)}if(e.setUTCFullYear(t,n,s),e.setUTCHours(i,a,u,0),l&&(c=r.charAt(l),c==="+"||c==="-")){var f=parseInt(r.substr(l+1,2),10),h=parseInt(r.substr(l+4,2),10),d=f*60+h;d*=6e4,c==="+"?e.setTime(+e-d):e.setTime(+e+d)}return e};je.generalizedTimeToDate=function(r){var e=new Date,t=parseInt(r.substr(0,4),10),n=parseInt(r.substr(4,2),10)-1,s=parseInt(r.substr(6,2),10),i=parseInt(r.substr(8,2),10),a=parseInt(r.substr(10,2),10),u=parseInt(r.substr(12,2),10),c=0,l=0,f=!1;r.charAt(r.length-1)==="Z"&&(f=!0);var h=r.length-5,d=r.charAt(h);if(d==="+"||d==="-"){var g=parseInt(r.substr(h+1,2),10),m=parseInt(r.substr(h+4,2),10);l=g*60+m,l*=6e4,d==="+"&&(l*=-1),f=!0}return r.charAt(14)==="."&&(c=parseFloat(r.substr(14),10)*1e3),f?(e.setUTCFullYear(t,n,s),e.setUTCHours(i,a,u,c),e.setTime(+e+l)):(e.setFullYear(t,n,s),e.setHours(i,a,u,c)),e};je.dateToUtcTime=function(r){if(typeof r=="string")return r;var e="",t=[];t.push((""+r.getUTCFullYear()).substr(2)),t.push(""+(r.getUTCMonth()+1)),t.push(""+r.getUTCDate()),t.push(""+r.getUTCHours()),t.push(""+r.getUTCMinutes()),t.push(""+r.getUTCSeconds());for(var n=0;n<t.length;++n)t[n].length<2&&(e+="0"),e+=t[n];return e+="Z",e};je.dateToGeneralizedTime=function(r){if(typeof r=="string")return r;var e="",t=[];t.push(""+r.getUTCFullYear()),t.push(""+(r.getUTCMonth()+1)),t.push(""+r.getUTCDate()),t.push(""+r.getUTCHours()),t.push(""+r.getUTCMinutes()),t.push(""+r.getUTCSeconds());for(var n=0;n<t.length;++n)t[n].length<2&&(e+="0"),e+=t[n];return e+="Z",e};je.integerToDer=function(r){var e=Cr.util.createBuffer();if(r>=-128&&r<128)return e.putSignedInt(r,8);if(r>=-32768&&r<32768)return e.putSignedInt(r,16);if(r>=-8388608&&r<8388608)return e.putSignedInt(r,24);if(r>=-2147483648&&r<2147483648)return e.putSignedInt(r,32);var t=new Error("Integer too large; max is 32-bits.");throw t.integer=r,t};je.derToInteger=function(r){typeof r=="string"&&(r=Cr.util.createBuffer(r));var e=r.length()*8;if(e>32)throw new Error("Integer too large; max is 32-bits.");return r.getSignedInt(e)};je.validate=function(r,e,t,n){var s=!1;if((r.tagClass===e.tagClass||typeof e.tagClass>"u")&&(r.type===e.type||typeof e.type>"u"))if(r.constructed===e.constructed||typeof e.constructed>"u"){if(s=!0,e.value&&Cr.util.isArray(e.value))for(var i=0,a=0;s&&a<e.value.length;++a){var u=e.value[a];s=!!u.optional;var c=r.value[i];if(!c){u.optional||(s=!1,n&&n.push("["+e.name+'] Missing required element. Expected tag class "'+u.tagClass+'", type "'+u.type+'"'));continue}var l=typeof u.tagClass<"u"&&typeof u.type<"u";if(l&&(c.tagClass!==u.tagClass||c.type!==u.type))if(u.optional){s=!0;continue}else{s=!1,n&&n.push("["+e.name+"] Tag mismatch. Expected ("+u.tagClass+","+u.type+"), got ("+c.tagClass+","+c.type+")");break}var f=je.validate(c,u,t,n);if(f)++i,s=!0;else if(u.optional)s=!0;else{s=!1;break}}if(s&&t&&(e.capture&&(t[e.capture]=r.value),e.captureAsn1&&(t[e.captureAsn1]=r),e.captureBitStringContents&&"bitStringContents"in r&&(t[e.captureBitStringContents]=r.bitStringContents),e.captureBitStringValue&&"bitStringContents"in r)){var h;if(r.bitStringContents.length<2)t[e.captureBitStringValue]="";else{var d=r.bitStringContents.charCodeAt(0);if(d!==0)throw new Error("captureBitStringValue only supported for zero unused bits");t[e.captureBitStringValue]=r.bitStringContents.slice(1)}}}else n&&n.push("["+e.name+'] Expected constructed "'+e.constructed+'", got "'+r.constructed+'"');else n&&(r.tagClass!==e.tagClass&&n.push("["+e.name+'] Expected tag class "'+e.tagClass+'", got "'+r.tagClass+'"'),r.type!==e.type&&n.push("["+e.name+'] Expected type "'+e.type+'", got "'+r.type+'"'));return s};var D3=/[^\\u0000-\\u00ff]/;je.prettyPrint=function(r,e,t){var n="";e=e||0,t=t||2,e>0&&(n+=`
|
|
4
|
+
`,t=t.substr(e));return n+=t,n};re.binary.base64.decode=function(r,e,t){var n=e;n||(n=new Uint8Array(Math.ceil(r.length/4)*3)),r=r.replace(/[^A-Za-z0-9\+\/\=]/g,""),t=t||0;for(var s,i,a,u,c=0,l=t;c<r.length;)s=Go[r.charCodeAt(c++)-43],i=Go[r.charCodeAt(c++)-43],a=Go[r.charCodeAt(c++)-43],u=Go[r.charCodeAt(c++)-43],n[l++]=s<<2|i>>4,a!==64&&(n[l++]=(i&15)<<4|a>>2,u!==64&&(n[l++]=(a&3)<<6|u));return e?l-t:n.subarray(0,l)};re.binary.base58.encode=function(r,e){return re.binary.baseN.encode(r,E3,e)};re.binary.base58.decode=function(r,e){return re.binary.baseN.decode(r,E3,e)};re.text={utf8:{},utf16:{}};re.text.utf8.encode=function(r,e,t){r=re.encodeUtf8(r);var n=e;n||(n=new Uint8Array(r.length)),t=t||0;for(var s=t,i=0;i<r.length;++i)n[s++]=r.charCodeAt(i);return e?s-t:n};re.text.utf8.decode=function(r){return re.decodeUtf8(String.fromCharCode.apply(null,r))};re.text.utf16.encode=function(r,e,t){var n=e;n||(n=new Uint8Array(r.length*2));var s=new Uint16Array(n.buffer);t=t||0;for(var i=t,a=t,u=0;u<r.length;++u)s[a++]=r.charCodeAt(u),i+=2;return e?i-t:n};re.text.utf16.decode=function(r){return String.fromCharCode.apply(null,new Uint16Array(r.buffer))};re.deflate=function(r,e,t){if(e=re.decode64(r.deflate(re.encode64(e)).rval),t){var n=2,s=e.charCodeAt(1);s&32&&(n=6),e=e.substring(n,e.length-4)}return e};re.inflate=function(r,e,t){var n=r.inflate(re.encode64(e)).rval;return n===null?null:re.decode64(n)};var SC=o(function(r,e,t){if(!r)throw new Error("WebStorage not available.");var n;if(t===null?n=r.removeItem(e):(t=re.encode64(JSON.stringify(t)),n=r.setItem(e,t)),typeof n<"u"&&n.rval!==!0){var s=new Error(n.error.message);throw s.id=n.error.id,s.name=n.error.name,s}},"_setStorageObject"),AC=o(function(r,e){if(!r)throw new Error("WebStorage not available.");var t=r.getItem(e);if(r.init)if(t.rval===null){if(t.error){var n=new Error(t.error.message);throw n.id=t.error.id,n.name=t.error.name,n}t=null}else t=t.rval;return t!==null&&(t=JSON.parse(re.decode64(t))),t},"_getStorageObject"),J$=o(function(r,e,t,n){var s=AC(r,e);s===null&&(s={}),s[t]=n,SC(r,e,s)},"_setItem"),Y$=o(function(r,e,t){var n=AC(r,e);return n!==null&&(n=t in n?n[t]:null),n},"_getItem"),Q$=o(function(r,e,t){var n=AC(r,e);if(n!==null&&t in n){delete n[t];var s=!0;for(var i in n){s=!1;break}s&&(n=null),SC(r,e,n)}},"_removeItem"),Z$=o(function(r,e){SC(r,e,null)},"_clearItems"),Kx=o(function(r,e,t){var n=null;typeof t>"u"&&(t=["web","flash"]);var s,i=!1,a=null;for(var u in t){s=t[u];try{if(s==="flash"||s==="both"){if(e[0]===null)throw new Error("Flash local storage not available.");n=r.apply(this,e),i=s==="flash"}(s==="web"||s==="both")&&(e[0]=localStorage,n=r.apply(this,e),i=!0)}catch(c){a=c}if(i)break}if(!i)throw a;return n},"_callStorageFunction");re.setItem=function(r,e,t,n,s){Kx(J$,arguments,s)};re.getItem=function(r,e,t,n){return Kx(Y$,arguments,n)};re.removeItem=function(r,e,t,n){Kx(Q$,arguments,n)};re.clearItems=function(r,e,t){Kx(Z$,arguments,t)};re.isEmpty=function(r){for(var e in r)if(r.hasOwnProperty(e))return!1;return!0};re.format=function(r){for(var e=/%./g,t,n,s=0,i=[],a=0;t=e.exec(r);){n=r.substring(a,e.lastIndex-2),n.length>0&&i.push(n),a=e.lastIndex;var u=t[0][1];switch(u){case"s":case"o":s<arguments.length?i.push(arguments[s+++1]):i.push("<?>");break;case"%":i.push("%");break;default:i.push("<%"+u+"?>")}}return i.push(r.substring(a)),i.join("")};re.formatNumber=function(r,e,t,n){var s=r,i=isNaN(e=Math.abs(e))?2:e,a=t===void 0?",":t,u=n===void 0?".":n,c=s<0?"-":"",l=parseInt(s=Math.abs(+s||0).toFixed(i),10)+"",f=l.length>3?l.length%3:0;return c+(f?l.substr(0,f)+u:"")+l.substr(f).replace(/(\d{3})(?=\d)/g,"$1"+u)+(i?a+Math.abs(s-l).toFixed(i).slice(2):"")};re.formatSize=function(r){return r>=1073741824?r=re.formatNumber(r/1073741824,2,".","")+" GiB":r>=1048576?r=re.formatNumber(r/1048576,2,".","")+" MiB":r>=1024?r=re.formatNumber(r/1024,0)+" KiB":r=re.formatNumber(r,0)+" bytes",r};re.bytesFromIP=function(r){return r.indexOf(".")!==-1?re.bytesFromIPv4(r):r.indexOf(":")!==-1?re.bytesFromIPv6(r):null};re.bytesFromIPv4=function(r){if(r=r.split("."),r.length!==4)return null;for(var e=re.createBuffer(),t=0;t<r.length;++t){var n=parseInt(r[t],10);if(isNaN(n))return null;e.putByte(n)}return e.getBytes()};re.bytesFromIPv6=function(r){var e=0;r=r.split(":").filter(function(a){return a.length===0&&++e,!0});for(var t=(8-r.length+e)*2,n=re.createBuffer(),s=0;s<8;++s){if(!r[s]||r[s].length===0){n.fillWithByte(0,t),t=0;continue}var i=re.hexToBytes(r[s]);i.length<2&&n.putByte(0),n.putBytes(i)}return n.getBytes()};re.bytesToIP=function(r){return r.length===4?re.bytesToIPv4(r):r.length===16?re.bytesToIPv6(r):null};re.bytesToIPv4=function(r){if(r.length!==4)return null;for(var e=[],t=0;t<r.length;++t)e.push(r.charCodeAt(t));return e.join(".")};re.bytesToIPv6=function(r){if(r.length!==16)return null;for(var e=[],t=[],n=0,s=0;s<r.length;s+=2){for(var i=re.bytesToHex(r[s]+r[s+1]);i[0]==="0"&&i!=="0";)i=i.substr(1);if(i==="0"){var a=t[t.length-1],u=e.length;!a||u!==a.end+1?t.push({start:u,end:u}):(a.end=u,a.end-a.start>t[n].end-t[n].start&&(n=t.length-1))}e.push(i)}if(t.length>0){var c=t[n];c.end-c.start>0&&(e.splice(c.start,c.end-c.start+1,""),c.start===0&&e.unshift(""),c.end===7&&e.push(""))}return e.join(":")};re.estimateCores=function(r,e){if(typeof r=="function"&&(e=r,r={}),r=r||{},"cores"in re&&!r.update)return e(null,re.cores);if(typeof navigator<"u"&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return re.cores=navigator.hardwareConcurrency,e(null,re.cores);if(typeof Worker>"u")return re.cores=1,e(null,re.cores);if(typeof Blob>"u")return re.cores=2,e(null,re.cores);var t=URL.createObjectURL(new Blob(["(",(function(){self.addEventListener("message",function(a){for(var u=Date.now(),c=u+4;Date.now()<c;);self.postMessage({st:u,et:c})})}).toString(),")()"],{type:"application/javascript"}));n([],5,16);function n(a,u,c){if(u===0){var l=Math.floor(a.reduce(function(f,h){return f+h},0)/a.length);return re.cores=Math.max(1,l),URL.revokeObjectURL(t),e(null,re.cores)}s(c,function(f,h){a.push(i(c,h)),n(a,u-1,c)})}o(n,"sample");function s(a,u){for(var c=[],l=[],f=0;f<a;++f){var h=new Worker(t);h.addEventListener("message",function(d){if(l.push(d.data),l.length===a){for(var g=0;g<a;++g)c[g].terminate();u(null,l)}}),c.push(h)}for(var f=0;f<a;++f)c[f].postMessage(f)}o(s,"map");function i(a,u){for(var c=[],l=0;l<a;++l)for(var f=u[l],h=c[l]=[],d=0;d<a;++d)if(l!==d){var g=u[d];(f.st>g.st&&f.st<g.et||g.st>f.st&&g.st<f.et)&&h.push(d)}return c.reduce(function(m,v){return Math.max(m,v.length)},0)}o(i,"reduce")}});var $x=X((Ume,b3)=>{"use strict";var pn=It();zt();b3.exports=pn.cipher=pn.cipher||{};pn.cipher.algorithms=pn.cipher.algorithms||{};pn.cipher.createCipher=function(r,e){var t=r;if(typeof t=="string"&&(t=pn.cipher.getAlgorithm(t),t&&(t=t())),!t)throw new Error("Unsupported algorithm: "+r);return new pn.cipher.BlockCipher({algorithm:t,key:e,decrypt:!1})};pn.cipher.createDecipher=function(r,e){var t=r;if(typeof t=="string"&&(t=pn.cipher.getAlgorithm(t),t&&(t=t())),!t)throw new Error("Unsupported algorithm: "+r);return new pn.cipher.BlockCipher({algorithm:t,key:e,decrypt:!0})};pn.cipher.registerAlgorithm=function(r,e){r=r.toUpperCase(),pn.cipher.algorithms[r]=e};pn.cipher.getAlgorithm=function(r){return r=r.toUpperCase(),r in pn.cipher.algorithms?pn.cipher.algorithms[r]:null};var CC=pn.cipher.BlockCipher=function(r){this.algorithm=r.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=r.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=r.decrypt,this.algorithm.initialize(r)};CC.prototype.start=function(r){r=r||{};var e={};for(var t in r)e[t]=r[t];e.decrypt=this._decrypt,this._finish=!1,this._input=pn.util.createBuffer(),this.output=r.output||pn.util.createBuffer(),this.mode.start(e)};CC.prototype.update=function(r){for(r&&this._input.putBuffer(r);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()};CC.prototype.finish=function(r){r&&(this.mode.name==="ECB"||this.mode.name==="CBC")&&(this.mode.pad=function(t){return r(this.blockSize,t,!1)},this.mode.unpad=function(t){return r(this.blockSize,t,!0)});var e={};return e.decrypt=this._decrypt,e.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,e)||(this._finish=!0,this.update(),this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,e))||this.mode.afterFinish&&!this.mode.afterFinish(this.output,e))}});var TC=X((Vme,S3)=>{"use strict";var dn=It();zt();dn.cipher=dn.cipher||{};var _t=S3.exports=dn.cipher.modes=dn.cipher.modes||{};_t.ecb=function(r){r=r||{},this.name="ECB",this.cipher=r.cipher,this.blockSize=r.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)};_t.ecb.prototype.start=function(r){};_t.ecb.prototype.encrypt=function(r,e,t){if(r.length()<this.blockSize&&!(t&&r.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=r.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var n=0;n<this._ints;++n)e.putInt32(this._outBlock[n])};_t.ecb.prototype.decrypt=function(r,e,t){if(r.length()<this.blockSize&&!(t&&r.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=r.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var n=0;n<this._ints;++n)e.putInt32(this._outBlock[n])};_t.ecb.prototype.pad=function(r,e){var t=r.length()===this.blockSize?this.blockSize:this.blockSize-r.length();return r.fillWithByte(t,t),!0};_t.ecb.prototype.unpad=function(r,e){if(e.overflow>0)return!1;var t=r.length(),n=r.at(t-1);return n>this.blockSize<<2?!1:(r.truncate(n),!0)};_t.cbc=function(r){r=r||{},this.name="CBC",this.cipher=r.cipher,this.blockSize=r.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)};_t.cbc.prototype.start=function(r){if(r.iv===null){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else if("iv"in r)this._iv=Xx(r.iv,this.blockSize),this._prev=this._iv.slice(0);else throw new Error("Invalid IV parameter.")};_t.cbc.prototype.encrypt=function(r,e,t){if(r.length()<this.blockSize&&!(t&&r.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=this._prev[n]^r.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var n=0;n<this._ints;++n)e.putInt32(this._outBlock[n]);this._prev=this._outBlock};_t.cbc.prototype.decrypt=function(r,e,t){if(r.length()<this.blockSize&&!(t&&r.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=r.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var n=0;n<this._ints;++n)e.putInt32(this._prev[n]^this._outBlock[n]);this._prev=this._inBlock.slice(0)};_t.cbc.prototype.pad=function(r,e){var t=r.length()===this.blockSize?this.blockSize:this.blockSize-r.length();return r.fillWithByte(t,t),!0};_t.cbc.prototype.unpad=function(r,e){if(e.overflow>0)return!1;var t=r.length(),n=r.at(t-1);return n>this.blockSize<<2?!1:(r.truncate(n),!0)};_t.cfb=function(r){r=r||{},this.name="CFB",this.cipher=r.cipher,this.blockSize=r.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=dn.util.createBuffer(),this._partialBytes=0};_t.cfb.prototype.start=function(r){if(!("iv"in r))throw new Error("Invalid IV parameter.");this._iv=Xx(r.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};_t.cfb.prototype.encrypt=function(r,e,t){var n=r.length();if(n===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&n>=this.blockSize){for(var s=0;s<this._ints;++s)this._inBlock[s]=r.getInt32()^this._outBlock[s],e.putInt32(this._inBlock[s]);return}var i=(this.blockSize-n)%this.blockSize;i>0&&(i=this.blockSize-i),this._partialOutput.clear();for(var s=0;s<this._ints;++s)this._partialBlock[s]=r.getInt32()^this._outBlock[s],this._partialOutput.putInt32(this._partialBlock[s]);if(i>0)r.read-=this.blockSize;else for(var s=0;s<this._ints;++s)this._inBlock[s]=this._partialBlock[s];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!t)return e.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0};_t.cfb.prototype.decrypt=function(r,e,t){var n=r.length();if(n===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&n>=this.blockSize){for(var s=0;s<this._ints;++s)this._inBlock[s]=r.getInt32(),e.putInt32(this._inBlock[s]^this._outBlock[s]);return}var i=(this.blockSize-n)%this.blockSize;i>0&&(i=this.blockSize-i),this._partialOutput.clear();for(var s=0;s<this._ints;++s)this._partialBlock[s]=r.getInt32(),this._partialOutput.putInt32(this._partialBlock[s]^this._outBlock[s]);if(i>0)r.read-=this.blockSize;else for(var s=0;s<this._ints;++s)this._inBlock[s]=this._partialBlock[s];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!t)return e.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0};_t.ofb=function(r){r=r||{},this.name="OFB",this.cipher=r.cipher,this.blockSize=r.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=dn.util.createBuffer(),this._partialBytes=0};_t.ofb.prototype.start=function(r){if(!("iv"in r))throw new Error("Invalid IV parameter.");this._iv=Xx(r.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};_t.ofb.prototype.encrypt=function(r,e,t){var n=r.length();if(r.length()===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&n>=this.blockSize){for(var s=0;s<this._ints;++s)e.putInt32(r.getInt32()^this._outBlock[s]),this._inBlock[s]=this._outBlock[s];return}var i=(this.blockSize-n)%this.blockSize;i>0&&(i=this.blockSize-i),this._partialOutput.clear();for(var s=0;s<this._ints;++s)this._partialOutput.putInt32(r.getInt32()^this._outBlock[s]);if(i>0)r.read-=this.blockSize;else for(var s=0;s<this._ints;++s)this._inBlock[s]=this._outBlock[s];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!t)return e.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0};_t.ofb.prototype.decrypt=_t.ofb.prototype.encrypt;_t.ctr=function(r){r=r||{},this.name="CTR",this.cipher=r.cipher,this.blockSize=r.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=dn.util.createBuffer(),this._partialBytes=0};_t.ctr.prototype.start=function(r){if(!("iv"in r))throw new Error("Invalid IV parameter.");this._iv=Xx(r.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};_t.ctr.prototype.encrypt=function(r,e,t){var n=r.length();if(n===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&n>=this.blockSize)for(var s=0;s<this._ints;++s)e.putInt32(r.getInt32()^this._outBlock[s]);else{var i=(this.blockSize-n)%this.blockSize;i>0&&(i=this.blockSize-i),this._partialOutput.clear();for(var s=0;s<this._ints;++s)this._partialOutput.putInt32(r.getInt32()^this._outBlock[s]);if(i>0&&(r.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!t)return e.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}Gx(this._inBlock)};_t.ctr.prototype.decrypt=_t.ctr.prototype.encrypt;_t.gcm=function(r){r=r||{},this.name="GCM",this.cipher=r.cipher,this.blockSize=r.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=dn.util.createBuffer(),this._partialBytes=0,this._R=3774873600};_t.gcm.prototype.start=function(r){if(!("iv"in r))throw new Error("Invalid IV parameter.");var e=dn.util.createBuffer(r.iv);this._cipherLength=0;var t;if("additionalData"in r?t=dn.util.createBuffer(r.additionalData):t=dn.util.createBuffer(),"tagLength"in r?this._tagLength=r.tagLength:this._tagLength=128,this._tag=null,r.decrypt&&(this._tag=dn.util.createBuffer(r.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var n=e.length();if(n===12)this._j0=[e.getInt32(),e.getInt32(),e.getInt32(),1];else{for(this._j0=[0,0,0,0];e.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[e.getInt32(),e.getInt32(),e.getInt32(),e.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(NC(n*8)))}this._inBlock=this._j0.slice(0),Gx(this._inBlock),this._partialBytes=0,t=dn.util.createBuffer(t),this._aDataLength=NC(t.length()*8);var s=t.length()%this.blockSize;for(s&&t.fillWithByte(0,this.blockSize-s),this._s=[0,0,0,0];t.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()])};_t.gcm.prototype.encrypt=function(r,e,t){var n=r.length();if(n===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&n>=this.blockSize){for(var s=0;s<this._ints;++s)e.putInt32(this._outBlock[s]^=r.getInt32());this._cipherLength+=this.blockSize}else{var i=(this.blockSize-n)%this.blockSize;i>0&&(i=this.blockSize-i),this._partialOutput.clear();for(var s=0;s<this._ints;++s)this._partialOutput.putInt32(r.getInt32()^this._outBlock[s]);if(i<=0||t){if(t){var a=n%this.blockSize;this._cipherLength+=a,this._partialOutput.truncate(this.blockSize-a)}else this._cipherLength+=this.blockSize;for(var s=0;s<this._ints;++s)this._outBlock[s]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!t)return r.read-=this.blockSize,e.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),Gx(this._inBlock)};_t.gcm.prototype.decrypt=function(r,e,t){var n=r.length();if(n<this.blockSize&&!(t&&n>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),Gx(this._inBlock),this._hashBlock[0]=r.getInt32(),this._hashBlock[1]=r.getInt32(),this._hashBlock[2]=r.getInt32(),this._hashBlock[3]=r.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var s=0;s<this._ints;++s)e.putInt32(this._outBlock[s]^this._hashBlock[s]);n<this.blockSize?this._cipherLength+=n%this.blockSize:this._cipherLength+=this.blockSize};_t.gcm.prototype.afterFinish=function(r,e){var t=!0;e.decrypt&&e.overflow&&r.truncate(this.blockSize-e.overflow),this.tag=dn.util.createBuffer();var n=this._aDataLength.concat(NC(this._cipherLength*8));this._s=this.ghash(this._hashSubkey,this._s,n);var s=[];this.cipher.encrypt(this._j0,s);for(var i=0;i<this._ints;++i)this.tag.putInt32(this._s[i]^s[i]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),e.decrypt&&this.tag.bytes()!==this._tag&&(t=!1),t};_t.gcm.prototype.multiply=function(r,e){for(var t=[0,0,0,0],n=e.slice(0),s=0;s<128;++s){var i=r[s/32|0]&1<<31-s%32;i&&(t[0]^=n[0],t[1]^=n[1],t[2]^=n[2],t[3]^=n[3]),this.pow(n,n)}return t};_t.gcm.prototype.pow=function(r,e){for(var t=r[3]&1,n=3;n>0;--n)e[n]=r[n]>>>1|(r[n-1]&1)<<31;e[0]=r[0]>>>1,t&&(e[0]^=this._R)};_t.gcm.prototype.tableMultiply=function(r){for(var e=[0,0,0,0],t=0;t<32;++t){var n=t/8|0,s=r[n]>>>(7-t%8)*4&15,i=this._m[t][s];e[0]^=i[0],e[1]^=i[1],e[2]^=i[2],e[3]^=i[3]}return e};_t.gcm.prototype.ghash=function(r,e,t){return e[0]^=t[0],e[1]^=t[1],e[2]^=t[2],e[3]^=t[3],this.tableMultiply(e)};_t.gcm.prototype.generateHashTable=function(r,e){for(var t=8/e,n=4*t,s=16*t,i=new Array(s),a=0;a<s;++a){var u=[0,0,0,0],c=a/n|0,l=(n-1-a%n)*e;u[c]=1<<e-1<<l,i[a]=this.generateSubHashTable(this.multiply(u,r),e)}return i};_t.gcm.prototype.generateSubHashTable=function(r,e){var t=1<<e,n=t>>>1,s=new Array(t);s[n]=r.slice(0);for(var i=n>>>1;i>0;)this.pow(s[2*i],s[i]=[]),i>>=1;for(i=2;i<n;){for(var a=1;a<i;++a){var u=s[i],c=s[a];s[i+a]=[u[0]^c[0],u[1]^c[1],u[2]^c[2],u[3]^c[3]]}i*=2}for(s[0]=[0,0,0,0],i=n+1;i<t;++i){var l=s[i^n];s[i]=[r[0]^l[0],r[1]^l[1],r[2]^l[2],r[3]^l[3]]}return s};function Xx(r,e){if(typeof r=="string"&&(r=dn.util.createBuffer(r)),dn.util.isArray(r)&&r.length>4){var t=r;r=dn.util.createBuffer();for(var n=0;n<t.length;++n)r.putByte(t[n])}if(r.length()<e)throw new Error("Invalid IV length; got "+r.length()+" bytes and expected "+e+" bytes.");if(!dn.util.isArray(r)){for(var s=[],i=e/4,n=0;n<i;++n)s.push(r.getInt32());r=s}return r}o(Xx,"transformIV");function Gx(r){r[r.length-1]=r[r.length-1]+1&4294967295}o(Gx,"inc32");function NC(r){return[r/4294967296|0,r&4294967295]}o(NC,"from64To32")});var zo=X((jme,T3)=>{"use strict";var vr=It();$x();TC();zt();T3.exports=vr.aes=vr.aes||{};vr.aes.startEncrypting=function(r,e,t,n){var s=zx({key:r,output:t,decrypt:!1,mode:n});return s.start(e),s};vr.aes.createEncryptionCipher=function(r,e){return zx({key:r,output:null,decrypt:!1,mode:e})};vr.aes.startDecrypting=function(r,e,t,n){var s=zx({key:r,output:t,decrypt:!0,mode:n});return s.start(e),s};vr.aes.createDecryptionCipher=function(r,e){return zx({key:r,output:null,decrypt:!0,mode:e})};vr.aes.Algorithm=function(r,e){BC||C3();var t=this;t.name=r,t.mode=new e({blockSize:16,cipher:{encrypt:o(function(n,s){return DC(t._w,n,s,!1)},"encrypt"),decrypt:o(function(n,s){return DC(t._w,n,s,!0)},"decrypt")}}),t._init=!1};vr.aes.Algorithm.prototype.initialize=function(r){if(!this._init){var e=r.key,t;if(typeof e=="string"&&(e.length===16||e.length===24||e.length===32))e=vr.util.createBuffer(e);else if(vr.util.isArray(e)&&(e.length===16||e.length===24||e.length===32)){t=e,e=vr.util.createBuffer();for(var n=0;n<t.length;++n)e.putByte(t[n])}if(!vr.util.isArray(e)){t=e,e=[];var s=t.length();if(s===16||s===24||s===32){s=s>>>2;for(var n=0;n<s;++n)e.push(t.getInt32())}}if(!vr.util.isArray(e)||!(e.length===4||e.length===6||e.length===8))throw new Error("Invalid key parameter.");var i=this.mode.name,a=["CFB","OFB","CTR","GCM"].indexOf(i)!==-1;this._w=N3(e,r.decrypt&&!a),this._init=!0}};vr.aes._expandKey=function(r,e){return BC||C3(),N3(r,e)};vr.aes._updateBlock=DC;bh("AES-ECB",vr.cipher.modes.ecb);bh("AES-CBC",vr.cipher.modes.cbc);bh("AES-CFB",vr.cipher.modes.cfb);bh("AES-OFB",vr.cipher.modes.ofb);bh("AES-CTR",vr.cipher.modes.ctr);bh("AES-GCM",vr.cipher.modes.gcm);function bh(r,e){var t=o(function(){return new vr.aes.Algorithm(r,e)},"factory");vr.cipher.registerAlgorithm(r,t)}o(bh,"registerAlgorithm");var BC=!1,wh=4,Jn,IC,A3,$c,Ai;function C3(){BC=!0,A3=[0,1,2,4,8,16,32,64,128,27,54];for(var r=new Array(256),e=0;e<128;++e)r[e]=e<<1,r[e+128]=e+128<<1^283;Jn=new Array(256),IC=new Array(256),$c=new Array(4),Ai=new Array(4);for(var e=0;e<4;++e)$c[e]=new Array(256),Ai[e]=new Array(256);for(var t=0,n=0,s,i,a,u,c,l,f,e=0;e<256;++e){u=n^n<<1^n<<2^n<<3^n<<4,u=u>>8^u&255^99,Jn[t]=u,IC[u]=t,c=r[u],s=r[t],i=r[s],a=r[i],l=c<<24^u<<16^u<<8^(u^c),f=(s^i^a)<<24^(t^a)<<16^(t^i^a)<<8^(t^s^a);for(var h=0;h<4;++h)$c[h][t]=l,Ai[h][u]=f,l=l<<24|l>>>8,f=f<<24|f>>>8;t===0?t=n=1:(t=s^r[r[r[s^a]]],n^=r[r[n]])}}o(C3,"initialize");function N3(r,e){for(var t=r.slice(0),n,s=1,i=t.length,a=i+6+1,u=wh*a,c=i;c<u;++c)n=t[c-1],c%i===0?(n=Jn[n>>>16&255]<<24^Jn[n>>>8&255]<<16^Jn[n&255]<<8^Jn[n>>>24]^A3[s]<<24,s++):i>6&&c%i===4&&(n=Jn[n>>>24]<<24^Jn[n>>>16&255]<<16^Jn[n>>>8&255]<<8^Jn[n&255]),t[c]=t[c-i]^n;if(e){var l,f=Ai[0],h=Ai[1],d=Ai[2],g=Ai[3],m=t.slice(0);u=t.length;for(var c=0,v=u-wh;c<u;c+=wh,v-=wh)if(c===0||c===u-wh)m[c]=t[v],m[c+1]=t[v+3],m[c+2]=t[v+2],m[c+3]=t[v+1];else for(var y=0;y<wh;++y)l=t[v+y],m[c+(3&-y)]=f[Jn[l>>>24]]^h[Jn[l>>>16&255]]^d[Jn[l>>>8&255]]^g[Jn[l&255]];t=m}return t}o(N3,"_expandKey");function DC(r,e,t,n){var s=r.length/4-1,i,a,u,c,l;n?(i=Ai[0],a=Ai[1],u=Ai[2],c=Ai[3],l=IC):(i=$c[0],a=$c[1],u=$c[2],c=$c[3],l=Jn);var f,h,d,g,m,v,y;f=e[0]^r[0],h=e[n?3:1]^r[1],d=e[2]^r[2],g=e[n?1:3]^r[3];for(var w=3,S=1;S<s;++S)m=i[f>>>24]^a[h>>>16&255]^u[d>>>8&255]^c[g&255]^r[++w],v=i[h>>>24]^a[d>>>16&255]^u[g>>>8&255]^c[f&255]^r[++w],y=i[d>>>24]^a[g>>>16&255]^u[f>>>8&255]^c[h&255]^r[++w],g=i[g>>>24]^a[f>>>16&255]^u[h>>>8&255]^c[d&255]^r[++w],f=m,h=v,d=y;t[0]=l[f>>>24]<<24^l[h>>>16&255]<<16^l[d>>>8&255]<<8^l[g&255]^r[++w],t[n?3:1]=l[h>>>24]<<24^l[d>>>16&255]<<16^l[g>>>8&255]<<8^l[f&255]^r[++w],t[2]=l[d>>>24]<<24^l[g>>>16&255]<<16^l[f>>>8&255]<<8^l[h&255]^r[++w],t[n?1:3]=l[g>>>24]<<24^l[f>>>16&255]<<16^l[h>>>8&255]<<8^l[d&255]^r[++w]}o(DC,"_updateBlock");function zx(r){r=r||{};var e=(r.mode||"CBC").toUpperCase(),t="AES-"+e,n;r.decrypt?n=vr.cipher.createDecipher(t,r.key):n=vr.cipher.createCipher(t,r.key);var s=n.start;return n.start=function(i,a){var u=null;a instanceof vr.util.ByteBuffer&&(u=a,a={}),a=a||{},a.output=u,a.iv=i,s.call(n,a)},n}o(zx,"_createCipher")});var Wo=X((Hme,I3)=>{"use strict";var C0=It();C0.pki=C0.pki||{};var RC=I3.exports=C0.pki.oids=C0.oids=C0.oids||{};function Re(r,e){RC[r]=e,RC[e]=r}o(Re,"_IN");function sr(r,e){RC[r]=e}o(sr,"_I_");Re("1.2.840.113549.1.1.1","rsaEncryption");Re("1.2.840.113549.1.1.4","md5WithRSAEncryption");Re("1.2.840.113549.1.1.5","sha1WithRSAEncryption");Re("1.2.840.113549.1.1.7","RSAES-OAEP");Re("1.2.840.113549.1.1.8","mgf1");Re("1.2.840.113549.1.1.9","pSpecified");Re("1.2.840.113549.1.1.10","RSASSA-PSS");Re("1.2.840.113549.1.1.11","sha256WithRSAEncryption");Re("1.2.840.113549.1.1.12","sha384WithRSAEncryption");Re("1.2.840.113549.1.1.13","sha512WithRSAEncryption");Re("1.3.101.112","EdDSA25519");Re("1.2.840.10040.4.3","dsa-with-sha1");Re("1.3.14.3.2.7","desCBC");Re("1.3.14.3.2.26","sha1");Re("1.3.14.3.2.29","sha1WithRSASignature");Re("2.16.840.1.101.3.4.2.1","sha256");Re("2.16.840.1.101.3.4.2.2","sha384");Re("2.16.840.1.101.3.4.2.3","sha512");Re("2.16.840.1.101.3.4.2.4","sha224");Re("2.16.840.1.101.3.4.2.5","sha512-224");Re("2.16.840.1.101.3.4.2.6","sha512-256");Re("1.2.840.113549.2.2","md2");Re("1.2.840.113549.2.5","md5");Re("1.2.840.113549.1.7.1","data");Re("1.2.840.113549.1.7.2","signedData");Re("1.2.840.113549.1.7.3","envelopedData");Re("1.2.840.113549.1.7.4","signedAndEnvelopedData");Re("1.2.840.113549.1.7.5","digestedData");Re("1.2.840.113549.1.7.6","encryptedData");Re("1.2.840.113549.1.9.1","emailAddress");Re("1.2.840.113549.1.9.2","unstructuredName");Re("1.2.840.113549.1.9.3","contentType");Re("1.2.840.113549.1.9.4","messageDigest");Re("1.2.840.113549.1.9.5","signingTime");Re("1.2.840.113549.1.9.6","counterSignature");Re("1.2.840.113549.1.9.7","challengePassword");Re("1.2.840.113549.1.9.8","unstructuredAddress");Re("1.2.840.113549.1.9.14","extensionRequest");Re("1.2.840.113549.1.9.20","friendlyName");Re("1.2.840.113549.1.9.21","localKeyId");Re("1.2.840.113549.1.9.22.1","x509Certificate");Re("1.2.840.113549.1.12.10.1.1","keyBag");Re("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag");Re("1.2.840.113549.1.12.10.1.3","certBag");Re("1.2.840.113549.1.12.10.1.4","crlBag");Re("1.2.840.113549.1.12.10.1.5","secretBag");Re("1.2.840.113549.1.12.10.1.6","safeContentsBag");Re("1.2.840.113549.1.5.13","pkcs5PBES2");Re("1.2.840.113549.1.5.12","pkcs5PBKDF2");Re("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4");Re("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4");Re("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC");Re("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC");Re("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC");Re("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC");Re("1.2.840.113549.2.7","hmacWithSHA1");Re("1.2.840.113549.2.8","hmacWithSHA224");Re("1.2.840.113549.2.9","hmacWithSHA256");Re("1.2.840.113549.2.10","hmacWithSHA384");Re("1.2.840.113549.2.11","hmacWithSHA512");Re("1.2.840.113549.3.7","des-EDE3-CBC");Re("2.16.840.1.101.3.4.1.2","aes128-CBC");Re("2.16.840.1.101.3.4.1.22","aes192-CBC");Re("2.16.840.1.101.3.4.1.42","aes256-CBC");Re("2.5.4.3","commonName");Re("2.5.4.4","surname");Re("2.5.4.5","serialNumber");Re("2.5.4.6","countryName");Re("2.5.4.7","localityName");Re("2.5.4.8","stateOrProvinceName");Re("2.5.4.9","streetAddress");Re("2.5.4.10","organizationName");Re("2.5.4.11","organizationalUnitName");Re("2.5.4.12","title");Re("2.5.4.13","description");Re("2.5.4.15","businessCategory");Re("2.5.4.17","postalCode");Re("2.5.4.42","givenName");Re("2.5.4.65","pseudonym");Re("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName");Re("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName");Re("2.16.840.1.113730.1.1","nsCertType");Re("2.16.840.1.113730.1.13","nsComment");sr("2.5.29.1","authorityKeyIdentifier");sr("2.5.29.2","keyAttributes");sr("2.5.29.3","certificatePolicies");sr("2.5.29.4","keyUsageRestriction");sr("2.5.29.5","policyMapping");sr("2.5.29.6","subtreesConstraint");sr("2.5.29.7","subjectAltName");sr("2.5.29.8","issuerAltName");sr("2.5.29.9","subjectDirectoryAttributes");sr("2.5.29.10","basicConstraints");sr("2.5.29.11","nameConstraints");sr("2.5.29.12","policyConstraints");sr("2.5.29.13","basicConstraints");Re("2.5.29.14","subjectKeyIdentifier");Re("2.5.29.15","keyUsage");sr("2.5.29.16","privateKeyUsagePeriod");Re("2.5.29.17","subjectAltName");Re("2.5.29.18","issuerAltName");Re("2.5.29.19","basicConstraints");sr("2.5.29.20","cRLNumber");sr("2.5.29.21","cRLReason");sr("2.5.29.22","expirationDate");sr("2.5.29.23","instructionCode");sr("2.5.29.24","invalidityDate");sr("2.5.29.25","cRLDistributionPoints");sr("2.5.29.26","issuingDistributionPoint");sr("2.5.29.27","deltaCRLIndicator");sr("2.5.29.28","issuingDistributionPoint");sr("2.5.29.29","certificateIssuer");sr("2.5.29.30","nameConstraints");Re("2.5.29.31","cRLDistributionPoints");Re("2.5.29.32","certificatePolicies");sr("2.5.29.33","policyMappings");sr("2.5.29.34","policyConstraints");Re("2.5.29.35","authorityKeyIdentifier");sr("2.5.29.36","policyConstraints");Re("2.5.29.37","extKeyUsage");sr("2.5.29.46","freshestCRL");sr("2.5.29.54","inhibitAnyPolicy");Re("1.3.6.1.4.1.11129.2.4.2","timestampList");Re("1.3.6.1.5.5.7.1.1","authorityInfoAccess");Re("1.3.6.1.5.5.7.3.1","serverAuth");Re("1.3.6.1.5.5.7.3.2","clientAuth");Re("1.3.6.1.5.5.7.3.3","codeSigning");Re("1.3.6.1.5.5.7.3.4","emailProtection");Re("1.3.6.1.5.5.7.3.8","timeStamping")});var Ci=X(($me,B3)=>{"use strict";var Cr=It();zt();Wo();var je=B3.exports=Cr.asn1=Cr.asn1||{};je.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192};je.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30};je.maxDepth=256;je.create=function(r,e,t,n,s){if(Cr.util.isArray(n)){for(var i=[],a=0;a<n.length;++a)n[a]!==void 0&&i.push(n[a]);n=i}var u={tagClass:r,type:e,constructed:t,composed:t||Cr.util.isArray(n),value:n};return s&&"bitStringContents"in s&&(u.bitStringContents=s.bitStringContents,u.original=je.copy(u)),u};je.copy=function(r,e){var t;if(Cr.util.isArray(r)){t=[];for(var n=0;n<r.length;++n)t.push(je.copy(r[n],e));return t}return typeof r=="string"?r:(t={tagClass:r.tagClass,type:r.type,constructed:r.constructed,composed:r.composed,value:je.copy(r.value,e)},e&&!e.excludeBitStringContents&&(t.bitStringContents=r.bitStringContents),t)};je.equals=function(r,e,t){if(Cr.util.isArray(r)){if(!Cr.util.isArray(e)||r.length!==e.length)return!1;for(var n=0;n<r.length;++n)if(!je.equals(r[n],e[n]))return!1;return!0}if(typeof r!=typeof e)return!1;if(typeof r=="string")return r===e;var s=r.tagClass===e.tagClass&&r.type===e.type&&r.constructed===e.constructed&&r.composed===e.composed&&je.equals(r.value,e.value);return t&&t.includeBitStringContents&&(s=s&&r.bitStringContents===e.bitStringContents),s};je.getBerValueLength=function(r){var e=r.getByte();if(e!==128){var t,n=e&128;return n?t=r.getInt((e&127)<<3):t=e,t}};function N0(r,e,t){if(t>e){var n=new Error("Too few bytes to parse DER.");throw n.available=r.length(),n.remaining=e,n.requested=t,n}}o(N0,"_checkBufferLength");var eX=o(function(r,e){var t=r.getByte();if(e--,t!==128){var n,s=t&128;if(!s)n=t;else{var i=t&127;N0(r,e,i),n=r.getInt(i<<3)}if(n<0)throw new Error("Negative length: "+n);return n}},"_getValueLength");je.fromDer=function(r,e){e===void 0&&(e={strict:!0,parseAllBytes:!0,decodeBitStrings:!0}),typeof e=="boolean"&&(e={strict:e,parseAllBytes:!0,decodeBitStrings:!0}),"strict"in e||(e.strict=!0),"parseAllBytes"in e||(e.parseAllBytes=!0),"decodeBitStrings"in e||(e.decodeBitStrings=!0),"maxDepth"in e||(e.maxDepth=je.maxDepth),typeof r=="string"&&(r=Cr.util.createBuffer(r));var t=r.length(),n=Wx(r,r.length(),0,e);if(e.parseAllBytes&&r.length()!==0){var s=new Error("Unparsed DER bytes remain after ASN.1 parsing.");throw s.byteCount=t,s.remaining=r.length(),s}return n};function Wx(r,e,t,n){if(t>=n.maxDepth)throw new Error("ASN.1 parsing error: Max depth exceeded.");var s;N0(r,e,2);var i=r.getByte();e--;var a=i&192,u=i&31;s=r.length();var c=eX(r,e);if(e-=s-r.length(),c!==void 0&&c>e){if(n.strict){var l=new Error("Too few bytes to read ASN.1 value.");throw l.available=r.length(),l.remaining=e,l.requested=c,l}c=e}var f,h,d=(i&32)===32;if(d)if(f=[],c===void 0)for(;;){if(N0(r,e,2),r.bytes(2)==="\0\0"){r.getBytes(2),e-=2;break}s=r.length(),f.push(Wx(r,e,t+1,n)),e-=s-r.length()}else for(;c>0;)s=r.length(),f.push(Wx(r,c,t+1,n)),e-=s-r.length(),c-=s-r.length();if(f===void 0&&a===je.Class.UNIVERSAL&&u===je.Type.BITSTRING&&(h=r.bytes(c)),f===void 0&&n.decodeBitStrings&&a===je.Class.UNIVERSAL&&u===je.Type.BITSTRING&&c>1){var g=r.read,m=e,v=0;if(u===je.Type.BITSTRING&&(N0(r,e,1),v=r.getByte(),e--),v===0)try{s=r.length();var y={strict:!0,decodeBitStrings:!0},w=Wx(r,e,t+1,y),S=s-r.length();e-=S,u==je.Type.BITSTRING&&S++;var E=w.tagClass;S===c&&(E===je.Class.UNIVERSAL||E===je.Class.CONTEXT_SPECIFIC)&&(f=[w])}catch{}f===void 0&&(r.read=g,e=m)}if(f===void 0){if(c===void 0){if(n.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");c=e}if(u===je.Type.BMPSTRING)for(f="";c>0;c-=2)N0(r,e,2),f+=String.fromCharCode(r.getInt16()),e-=2;else f=r.getBytes(c),e-=c}var x=h===void 0?null:{bitStringContents:h};return je.create(a,u,d,f,x)}o(Wx,"_fromDer");je.toDer=function(r){var e=Cr.util.createBuffer(),t=r.tagClass|r.type,n=Cr.util.createBuffer(),s=!1;if("bitStringContents"in r&&(s=!0,r.original&&(s=je.equals(r,r.original))),s)n.putBytes(r.bitStringContents);else if(r.composed){r.constructed?t|=32:n.putByte(0);for(var i=0;i<r.value.length;++i)r.value[i]!==void 0&&n.putBuffer(je.toDer(r.value[i]))}else if(r.type===je.Type.BMPSTRING)for(var i=0;i<r.value.length;++i)n.putInt16(r.value.charCodeAt(i));else r.type===je.Type.INTEGER&&r.value.length>1&&(r.value.charCodeAt(0)===0&&(r.value.charCodeAt(1)&128)===0||r.value.charCodeAt(0)===255&&(r.value.charCodeAt(1)&128)===128)?n.putBytes(r.value.substr(1)):n.putBytes(r.value);if(e.putByte(t),n.length()<=127)e.putByte(n.length()&127);else{var a=n.length(),u="";do u+=String.fromCharCode(a&255),a=a>>>8;while(a>0);e.putByte(u.length|128);for(var i=u.length-1;i>=0;--i)e.putByte(u.charCodeAt(i))}return e.putBuffer(n),e};je.oidToDer=function(r){var e=r.split("."),t=Cr.util.createBuffer();t.putByte(40*parseInt(e[0],10)+parseInt(e[1],10));for(var n,s,i,a,u=2;u<e.length;++u){if(n=!0,s=[],i=parseInt(e[u],10),i>4294967295)throw new Error("OID value too large; max is 32-bits.");do a=i&127,i=i>>>7,n||(a|=128),s.push(a),n=!1;while(i>0);for(var c=s.length-1;c>=0;--c)t.putByte(s[c])}return t};je.derToOid=function(r){var e;typeof r=="string"&&(r=Cr.util.createBuffer(r));var t=r.getByte();e=Math.floor(t/40)+"."+t%40;for(var n=0;r.length()>0;){if(n>70368744177663)throw new Error("OID value too large; max is 53-bits.");t=r.getByte(),n=n*128,t&128?n+=t&127:(e+="."+(n+t),n=0)}return e};je.utcTimeToDate=function(r){var e=new Date,t=parseInt(r.substr(0,2),10);t=t>=50?1900+t:2e3+t;var n=parseInt(r.substr(2,2),10)-1,s=parseInt(r.substr(4,2),10),i=parseInt(r.substr(6,2),10),a=parseInt(r.substr(8,2),10),u=0;if(r.length>11){var c=r.charAt(10),l=10;c!=="+"&&c!=="-"&&(u=parseInt(r.substr(10,2),10),l+=2)}if(e.setUTCFullYear(t,n,s),e.setUTCHours(i,a,u,0),l&&(c=r.charAt(l),c==="+"||c==="-")){var f=parseInt(r.substr(l+1,2),10),h=parseInt(r.substr(l+4,2),10),d=f*60+h;d*=6e4,c==="+"?e.setTime(+e-d):e.setTime(+e+d)}return e};je.generalizedTimeToDate=function(r){var e=new Date,t=parseInt(r.substr(0,4),10),n=parseInt(r.substr(4,2),10)-1,s=parseInt(r.substr(6,2),10),i=parseInt(r.substr(8,2),10),a=parseInt(r.substr(10,2),10),u=parseInt(r.substr(12,2),10),c=0,l=0,f=!1;r.charAt(r.length-1)==="Z"&&(f=!0);var h=r.length-5,d=r.charAt(h);if(d==="+"||d==="-"){var g=parseInt(r.substr(h+1,2),10),m=parseInt(r.substr(h+4,2),10);l=g*60+m,l*=6e4,d==="+"&&(l*=-1),f=!0}return r.charAt(14)==="."&&(c=parseFloat(r.substr(14),10)*1e3),f?(e.setUTCFullYear(t,n,s),e.setUTCHours(i,a,u,c),e.setTime(+e+l)):(e.setFullYear(t,n,s),e.setHours(i,a,u,c)),e};je.dateToUtcTime=function(r){if(typeof r=="string")return r;var e="",t=[];t.push((""+r.getUTCFullYear()).substr(2)),t.push(""+(r.getUTCMonth()+1)),t.push(""+r.getUTCDate()),t.push(""+r.getUTCHours()),t.push(""+r.getUTCMinutes()),t.push(""+r.getUTCSeconds());for(var n=0;n<t.length;++n)t[n].length<2&&(e+="0"),e+=t[n];return e+="Z",e};je.dateToGeneralizedTime=function(r){if(typeof r=="string")return r;var e="",t=[];t.push(""+r.getUTCFullYear()),t.push(""+(r.getUTCMonth()+1)),t.push(""+r.getUTCDate()),t.push(""+r.getUTCHours()),t.push(""+r.getUTCMinutes()),t.push(""+r.getUTCSeconds());for(var n=0;n<t.length;++n)t[n].length<2&&(e+="0"),e+=t[n];return e+="Z",e};je.integerToDer=function(r){var e=Cr.util.createBuffer();if(r>=-128&&r<128)return e.putSignedInt(r,8);if(r>=-32768&&r<32768)return e.putSignedInt(r,16);if(r>=-8388608&&r<8388608)return e.putSignedInt(r,24);if(r>=-2147483648&&r<2147483648)return e.putSignedInt(r,32);var t=new Error("Integer too large; max is 32-bits.");throw t.integer=r,t};je.derToInteger=function(r){typeof r=="string"&&(r=Cr.util.createBuffer(r));var e=r.length()*8;if(e>32)throw new Error("Integer too large; max is 32-bits.");return r.getSignedInt(e)};je.validate=function(r,e,t,n){var s=!1;if((r.tagClass===e.tagClass||typeof e.tagClass>"u")&&(r.type===e.type||typeof e.type>"u"))if(r.constructed===e.constructed||typeof e.constructed>"u"){if(s=!0,e.value&&Cr.util.isArray(e.value))for(var i=0,a=0;s&&a<e.value.length;++a){var u=e.value[a];s=!!u.optional;var c=r.value[i];if(!c){u.optional||(s=!1,n&&n.push("["+e.name+'] Missing required element. Expected tag class "'+u.tagClass+'", type "'+u.type+'"'));continue}var l=typeof u.tagClass<"u"&&typeof u.type<"u";if(l&&(c.tagClass!==u.tagClass||c.type!==u.type))if(u.optional){s=!0;continue}else{s=!1,n&&n.push("["+e.name+"] Tag mismatch. Expected ("+u.tagClass+","+u.type+"), got ("+c.tagClass+","+c.type+")");break}var f=je.validate(c,u,t,n);if(f)++i,s=!0;else if(u.optional)s=!0;else{s=!1;break}}if(s&&t&&(e.capture&&(t[e.capture]=r.value),e.captureAsn1&&(t[e.captureAsn1]=r),e.captureBitStringContents&&"bitStringContents"in r&&(t[e.captureBitStringContents]=r.bitStringContents),e.captureBitStringValue&&"bitStringContents"in r)){var h;if(r.bitStringContents.length<2)t[e.captureBitStringValue]="";else{var d=r.bitStringContents.charCodeAt(0);if(d!==0)throw new Error("captureBitStringValue only supported for zero unused bits");t[e.captureBitStringValue]=r.bitStringContents.slice(1)}}}else n&&n.push("["+e.name+'] Expected constructed "'+e.constructed+'", got "'+r.constructed+'"');else n&&(r.tagClass!==e.tagClass&&n.push("["+e.name+'] Expected tag class "'+e.tagClass+'", got "'+r.tagClass+'"'),r.type!==e.type&&n.push("["+e.name+'] Expected type "'+e.type+'", got "'+r.type+'"'));return s};var D3=/[^\\u0000-\\u00ff]/;je.prettyPrint=function(r,e,t){var n="";e=e||0,t=t||2,e>0&&(n+=`
|
|
5
5
|
`);for(var s="",i=0;i<e*t;++i)s+=" ";switch(n+=s+"Tag: ",r.tagClass){case je.Class.UNIVERSAL:n+="Universal:";break;case je.Class.APPLICATION:n+="Application:";break;case je.Class.CONTEXT_SPECIFIC:n+="Context-Specific:";break;case je.Class.PRIVATE:n+="Private:";break}if(r.tagClass===je.Class.UNIVERSAL)switch(n+=r.type,r.type){case je.Type.NONE:n+=" (None)";break;case je.Type.BOOLEAN:n+=" (Boolean)";break;case je.Type.INTEGER:n+=" (Integer)";break;case je.Type.BITSTRING:n+=" (Bit string)";break;case je.Type.OCTETSTRING:n+=" (Octet string)";break;case je.Type.NULL:n+=" (Null)";break;case je.Type.OID:n+=" (Object Identifier)";break;case je.Type.ODESC:n+=" (Object Descriptor)";break;case je.Type.EXTERNAL:n+=" (External or Instance of)";break;case je.Type.REAL:n+=" (Real)";break;case je.Type.ENUMERATED:n+=" (Enumerated)";break;case je.Type.EMBEDDED:n+=" (Embedded PDV)";break;case je.Type.UTF8:n+=" (UTF8)";break;case je.Type.ROID:n+=" (Relative Object Identifier)";break;case je.Type.SEQUENCE:n+=" (Sequence)";break;case je.Type.SET:n+=" (Set)";break;case je.Type.PRINTABLESTRING:n+=" (Printable String)";break;case je.Type.IA5String:n+=" (IA5String (ASCII))";break;case je.Type.UTCTIME:n+=" (UTC time)";break;case je.Type.GENERALIZEDTIME:n+=" (Generalized time)";break;case je.Type.BMPSTRING:n+=" (BMP String)";break}else n+=r.type;if(n+=`
|
|
6
6
|
`,n+=s+"Constructed: "+r.constructed+`
|
|
7
7
|
`,r.composed){for(var a=0,u="",i=0;i<r.value.length;++i)r.value[i]!==void 0&&(a+=1,u+=je.prettyPrint(r.value[i],e+1,t),i+1<r.value.length&&(u+=","));n+=s+"Sub values: "+a+u}else{if(n+=s+"Value: ",r.type===je.Type.OID){var c=je.derToOid(r.value);n+=c,Cr.pki&&Cr.pki.oids&&c in Cr.pki.oids&&(n+=" ("+Cr.pki.oids[c]+") ")}if(r.type===je.Type.INTEGER)try{n+=je.derToInteger(r.value)}catch{n+="0x"+Cr.util.bytesToHex(r.value)}else if(r.type===je.Type.BITSTRING){if(r.value.length>1?n+="0x"+Cr.util.bytesToHex(r.value.slice(1)):n+="(none)",r.value.length>0){var l=r.value.charCodeAt(0);l==1?n+=" (1 unused bit shown)":l>1&&(n+=" ("+l+" unused bits shown)")}}else if(r.type===je.Type.OCTETSTRING)D3.test(r.value)||(n+="("+r.value+") "),n+="0x"+Cr.util.bytesToHex(r.value);else if(r.type===je.Type.UTF8)try{n+=Cr.util.decodeUtf8(r.value)}catch(f){if(f.message==="URI malformed")n+="0x"+Cr.util.bytesToHex(r.value)+" (malformed UTF8)";else throw f}else r.type===je.Type.PRINTABLESTRING||r.type===je.Type.IA5String?n+=r.value:D3.test(r.value)?n+="0x"+Cr.util.bytesToHex(r.value):r.value.length===0?n+="[null]":n+=r.value}return n}});var Wi=X((Gme,R3)=>{"use strict";var Jx=It();R3.exports=Jx.md=Jx.md||{};Jx.md.algorithms=Jx.md.algorithms||{}});var Sh=X((zme,_3)=>{"use strict";var Ma=It();Wi();zt();var tX=_3.exports=Ma.hmac=Ma.hmac||{};tX.create=function(){var r=null,e=null,t=null,n=null,s={};return s.start=function(i,a){if(i!==null)if(typeof i=="string")if(i=i.toLowerCase(),i in Ma.md.algorithms)e=Ma.md.algorithms[i].create();else throw new Error('Unknown hash algorithm "'+i+'"');else e=i;if(a===null)a=r;else{if(typeof a=="string")a=Ma.util.createBuffer(a);else if(Ma.util.isArray(a)){var u=a;a=Ma.util.createBuffer();for(var c=0;c<u.length;++c)a.putByte(u[c])}var l=a.length();l>e.blockLength&&(e.start(),e.update(a.bytes()),a=e.digest()),t=Ma.util.createBuffer(),n=Ma.util.createBuffer(),l=a.length();for(var c=0;c<l;++c){var u=a.at(c);t.putByte(54^u),n.putByte(92^u)}if(l<e.blockLength)for(var u=e.blockLength-l,c=0;c<u;++c)t.putByte(54),n.putByte(92);r=a,t=t.bytes(),n=n.bytes()}e.start(),e.update(t)},s.update=function(i){e.update(i)},s.getMac=function(){var i=e.digest().bytes();return e.start(),e.update(n),e.update(i),e.digest()},s.digest=s.getMac,s}});var Qx=X((Wme,L3)=>{"use strict";var Ji=It();Wi();zt();var P3=L3.exports=Ji.md5=Ji.md5||{};Ji.md.md5=Ji.md.algorithms.md5=P3;P3.create=function(){k3||rX();var r=null,e=Ji.util.createBuffer(),t=new Array(16),n={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8};return n.start=function(){n.messageLength=0,n.fullMessageLength=n.messageLength64=[];for(var s=n.messageLengthSize/4,i=0;i<s;++i)n.fullMessageLength.push(0);return e=Ji.util.createBuffer(),r={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878},n},n.start(),n.update=function(s,i){i==="utf8"&&(s=Ji.util.encodeUtf8(s));var a=s.length;n.messageLength+=a,a=[a/4294967296>>>0,a>>>0];for(var u=n.fullMessageLength.length-1;u>=0;--u)n.fullMessageLength[u]+=a[1],a[1]=a[0]+(n.fullMessageLength[u]/4294967296>>>0),n.fullMessageLength[u]=n.fullMessageLength[u]>>>0,a[0]=a[1]/4294967296>>>0;return e.putBytes(s),O3(r,t,e),(e.read>2048||e.length()===0)&&e.compact(),n},n.digest=function(){var s=Ji.util.createBuffer();s.putBytes(e.bytes());var i=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize,a=i&n.blockLength-1;s.putBytes(_C.substr(0,n.blockLength-a));for(var u,c=0,l=n.fullMessageLength.length-1;l>=0;--l)u=n.fullMessageLength[l]*8+c,c=u/4294967296>>>0,s.putInt32Le(u>>>0);var f={h0:r.h0,h1:r.h1,h2:r.h2,h3:r.h3};O3(f,t,s);var h=Ji.util.createBuffer();return h.putInt32Le(f.h0),h.putInt32Le(f.h1),h.putInt32Le(f.h2),h.putInt32Le(f.h3),h},n};var _C=null,Yx=null,T0=null,Ah=null,k3=!1;function rX(){_C="\x80",_C+=Ji.util.fillString("\0",64),Yx=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],T0=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],Ah=new Array(64);for(var r=0;r<64;++r)Ah[r]=Math.floor(Math.abs(Math.sin(r+1))*4294967296);k3=!0}o(rX,"_init");function O3(r,e,t){for(var n,s,i,a,u,c,l,f,h=t.length();h>=64;){for(s=r.h0,i=r.h1,a=r.h2,u=r.h3,f=0;f<16;++f)e[f]=t.getInt32Le(),c=u^i&(a^u),n=s+c+Ah[f]+e[f],l=T0[f],s=u,u=a,a=i,i+=n<<l|n>>>32-l;for(;f<32;++f)c=a^u&(i^a),n=s+c+Ah[f]+e[Yx[f]],l=T0[f],s=u,u=a,a=i,i+=n<<l|n>>>32-l;for(;f<48;++f)c=i^a^u,n=s+c+Ah[f]+e[Yx[f]],l=T0[f],s=u,u=a,a=i,i+=n<<l|n>>>32-l;for(;f<64;++f)c=a^(i|~u),n=s+c+Ah[f]+e[Yx[f]],l=T0[f],s=u,u=a,a=i,i+=n<<l|n>>>32-l;r.h0=r.h0+s|0,r.h1=r.h1+i|0,r.h2=r.h2+a|0,r.h3=r.h3+u|0,h-=64}}o(O3,"_update")});var Xc=X((Yme,U3)=>{"use strict";var e2=It();zt();var F3=U3.exports=e2.pem=e2.pem||{};F3.encode=function(r,e){e=e||{};var t="-----BEGIN "+r.type+`-----\r
|
|
@@ -41,7 +41,7 @@ Private-MAC: `+S.digest().toHex()+`\r
|
|
|
41
41
|
`),Buffer.from(x.body),Buffer.from(`\r
|
|
42
42
|
--${w}${E===S.length-1?"--":""}\r
|
|
43
43
|
`)),E++}),m.data=Buffer.concat(m.data)}else m.data=t;s.forceGzip&&(m.decompress=!0,m.data=(0,fne.gzipSync)(m.data),m.headers["Accept-Encoding"]="gzip,deflate",m.headers["Content-Encoding"]="gzip");for(let v in d)if(f.indexOf(v)!==-1)for(let y in s[v])m[v][y]=s[v][y];else m[v]=s[v];return q6("Http request: %j",m),m}handleResponse(e,t,n){if(q6("Http response body: %j",n),typeof n=="string"){let s=/(?:<\?[^?]*\?>[\s]*)?<([^:]*):Envelope([\S\s]*)<\/\1:Envelope>/i,i=n.replace(/<!--[\s\S]*?-->/,"").match(s);i&&(n=i[0])}return n}request(e,t,n,s,i){let a=this.buildRequest(e,t,s,i),u;i!==void 0&&i.ntlm?u=(0,une.NtlmClient)({username:i.username,password:i.password,workstation:i.workstation||"",domain:i.domain||""},a)(a):(this.options.parseReponseAttachments&&(a.responseType="arraybuffer",a.responseEncoding="binary"),u=this._request(a));let c=this;return u.then(l=>{let f=o(h=>(l.data=this.handleResponse(u,l,h||l.data),n(null,l,l.data),l),"handleBody");if(c.options.parseReponseAttachments)if(l.headers["content-type"]&&l.headers["content-type"].toLowerCase().indexOf("multipart/related")>-1){let d,g=new lne.MIMEType(l.headers["content-type"]);return g&&(d=g.parameters.get("boundary")),d?(0,hne.parseMTOMResp)(l.data,d,(m,v)=>{if(m)return n(m);let y=v.parts.shift();return!y||!y.body?n(new Error("Cannot parse multipart response")):(l.mtomResponseAttachments=v,f(y.body.toString(c.options.encoding||"utf8")))}):n(new Error("Missing boundary from content-type"))}else return f(l.data.toString(c.options.encoding||"utf8"));else return f()},l=>n(l)),u}requestStream(e,t,n,s){let i=this.buildRequest(e,t,n,s);i.responseType="stream";let a=this._request(i).then(u=>(u.data=this.handleResponse(a,u,u.data),u));return a}};ti.HttpClient=mne});var RI=X(ri=>{"use strict";var gne=ri&&ri.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:o(function(){return e[t]},"get")}),Object.defineProperty(r,n,s)}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),yne=ri&&ri.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),vne=ri&&ri.__importStar||(function(){var r=o(function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(n[n.length]=s);return n},r(e)},"ownKeys");return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),s=0;s<n.length;s++)n[s]!=="default"&&gne(t,e,n[s]);return yne(t,e),t}})(),xne=ri&&ri.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(ri,"__esModule",{value:!0});ri.Client=void 0;var H6=vne(require("assert")),Ene=require("crypto"),wne=xne(qh()),bne=require("events"),Sne=AE(),CE=ds(),Ane=(0,wne.default)("node-soap"),K6=/[^a-z$_0-9]/i,Cne=class extends bne.EventEmitter{static{o(this,"Client")}constructor(e,t,n){super(),n=n||{},this.wsdl=e,this._initializeOptions(n),this._initializeServices(t),this.httpClient=n.httpClient||new Sne.HttpClient(n)}addSoapHeader(e,t,n,s){return this.soapHeaders||(this.soapHeaders=[]),e=this._processSoapHeader(e,t,n,s),this.soapHeaders.push(e)-1}changeSoapHeader(e,t,n,s,i){this.soapHeaders||(this.soapHeaders=[]),t=this._processSoapHeader(t,n,s,i),this.soapHeaders[e]=t}getSoapHeaders(){return this.soapHeaders}clearSoapHeaders(){this.soapHeaders=null}addHttpHeader(e,t){this.httpHeaders||(this.httpHeaders={}),this.httpHeaders[e]=t}getHttpHeaders(){return this.httpHeaders}clearHttpHeaders(){this.httpHeaders=null}addBodyAttribute(e){if(this.bodyAttributes||(this.bodyAttributes=[]),typeof e=="object"){let t="";Object.getOwnPropertyNames(e).forEach(n=>{t+=" "+n+'="'+e[n]+'"'}),e=t}e.substr(0,1)!==" "&&(e=" "+e),this.bodyAttributes.push(e)}getBodyAttributes(){return this.bodyAttributes}clearBodyAttributes(){this.bodyAttributes=null}setEndpoint(e){this.endpoint=e,this._initializeServices(e)}describe(){return this.wsdl.describeServices()}setSecurity(e){this.security=e}setSOAPAction(e){this.SOAPAction=e}_initializeServices(e){let n=this.wsdl.definitions.services;for(let s in n)this[s]=this._defineService(n[s],e)}_initializeOptions(e){this.streamAllowed=e.stream,this.returnSaxStream=e.returnSaxStream,this.normalizeNames=e.normalizeNames,this.overridePromiseSuffix=e.overridePromiseSuffix||"Async",this.wsdl.options.attributesKey=e.attributesKey||"attributes",this.wsdl.options.envelopeKey=e.envelopeKey||"soap",this.wsdl.options.envelopeSoapUrl=e.envelopeSoapUrl||"http://schemas.xmlsoap.org/soap/envelope/",this.wsdl.options.preserveWhitespace=!!e.preserveWhitespace,this.wsdl.options.forceUseSchemaXmlns=!!e.forceUseSchemaXmlns;let t=e.ignoredNamespaces;t!==void 0&&typeof t=="object"&&"override"in t&&t.override===!0&&t.namespaces!==void 0&&(this.wsdl.options.ignoredNamespaces=t.namespaces),e.overrideElementKey!==void 0&&(this.wsdl.options.overrideElementKey=e.overrideElementKey),e.overrideRootElement!==void 0&&(this.wsdl.options.overrideRootElement=e.overrideRootElement),this.wsdl.options.forceSoap12Headers=!!e.forceSoap12Headers}_defineService(e,t){let n=e.ports,s={};for(let i in n)s[i]=this._definePort(n[i],t||n[i].location);return s}_definePort(e,t){let n=t,i=e.binding.methods,a={};for(let u in i){a[u]=this._defineMethod(i[u],n);let c=this.normalizeNames?u.replace(K6,"_"):u;if(this[c]=a[u],!K6.test(c)){let l=this.overridePromiseSuffix;this[c+l]=this._promisifyMethod(a[u])}}return a}_promisifyMethod(e){return(t,n,s)=>new Promise((i,a)=>{e(t,o((c,l,f,h,d,g)=>{c?a(c):i([l,f,h,d,g])},"callback"),n,s)})}_defineMethod(e,t){let n;return(s,i,a,u)=>{typeof s=="function"?(i=s,s={}):typeof a=="function"?(n=i,i=a,a=n):typeof u=="function"&&(n=i,i=u,u=a,a=n),this._invoke(e,s,t,(c,l,f,h,d,g)=>{i(c,l,f,h,d,g)},a,u)}}_processSoapHeader(e,t,n,s){switch(typeof e){case"object":return this.wsdl.objectToXML(e,t,n,s,!0);case"function":{let i=this;return(...a)=>{let u=e.apply(null,[...a]);return typeof u=="object"?i.wsdl.objectToXML(u,t,n,s,!0):u}}default:return e}}_invoke(e,t,n,s,i,a){let u=e.$name,c=e.input,l=e.output,f=e.style,h=this.wsdl.definitions,d=this.wsdl.options.envelopeKey,g=this.wsdl.options.envelopeSoapUrl,m=h.$targetNamespace,v="",y="",w=null,S,E=(0,CE.findPrefix)(h.xmlns,m),x={"Content-Type":"text/xml; charset=utf-8"},b="xmlns:"+d+'="'+g+'"',A=o((M,ie,Z)=>{let ue;if(!l)return s(null,null,ie,M.Header,w,Z.mtomResponseAttachments);if(!M.html&&!M.Body){if(Z.status>=400){let $=new Error("Error http status codes");return $.response=Z,$.body=ie,this.emit("soapError",$,T),s($,M,ie,M.Header)}return s(null,M,ie,M.Header)}if(typeof M.Body!="object"){let $=new Error("Cannot parse response");return $.response=Z,$.body=ie,s($,M,ie,void 0,w)}ue=M.Body[l.$name],ue||(ue=M.Body[l.$name.replace(/(?:Out(?:put)?|Response)$/,"")]),ue||["Response","Out","Output"].forEach($=>{if(Object.hasOwnProperty.call(M.Body,u+$))return ue=M.Body[u+$]}),s(null,ue,ie,M.Header,w,Z.mtomResponseAttachments)},"finish"),k=o((M,ie)=>{let Z;try{Z=this.wsdl.xmlToObject(M)}catch(ue){if(!l||!l.$lookupTypes){Ane("Response element is not present. Unable to convert response xml to json.");let $=(0,CE.isObject)(M)?M:V(M);if($)return s(null,ie,$,void 0,w)}return ue.response=ie,ue.body=M,this.emit("soapError",ue,T),s(ue,ie,M,void 0,w,ie.mtomResponseAttachments)}return A(Z,M,ie)},"parseSync");this.SOAPAction?S=this.SOAPAction:e.soapAction!==void 0&&e.soapAction!==null?S=e.soapAction:S=(m.lastIndexOf("/")!==m.length-1?m+"/":m)+u,this.wsdl.options.forceSoap12Headers?(x["Content-Type"]=`application/soap+xml; charset=utf-8; action="${S}"`,b="xmlns:"+d+'="http://www.w3.org/2003/05/soap-envelope"'):x.SOAPAction='"'+S+'"',i=i||{},this.security&&this.security.addHeaders&&this.security.addHeaders(x),this.security&&this.security.addOptions&&this.security.addOptions(i),this.security&&typeof this.security?.toXML!="function"&&(this.security.toXML=()=>""),f==="rpc"&&(c.parts||c.name==="element"||t===null)?(H6.ok(!f||f==="rpc","invalid message definition for document style binding"),y=this.wsdl.objectToRpcXML(u,t,E,m,c.name!=="element"),e.inputSoap==="encoded"&&(v='soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" ')):(H6.ok(!f||f==="document","invalid message definition for rpc style binding"),y=this.wsdl.objectToDocumentXML(c.$name,t,c.targetNSAlias,c.targetNamespace,c.$type||c.$lookupType));let I;this.soapHeaders&&(I=this.soapHeaders.map(M=>typeof M=="function"?M(e,n,S,t):M).join(" ")),w='<?xml version="1.0" encoding="utf-8"?><'+d+":Envelope "+b+' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" '+v+this.wsdl.xmlnsInEnvelope+">"+(I||this.security&&this.security.toXML()?"<"+d+":Header"+(this.wsdl.xmlnsInHeader?" "+this.wsdl.xmlnsInHeader:"")+">"+(I||"")+(this.security&&!this.security.postProcess?this.security.toXML():"")+"</"+d+":Header>":"")+"<"+d+":Body"+(this.bodyAttributes?this.bodyAttributes.join(" "):"")+">"+y+"</"+d+":Body></"+d+":Envelope>",this.security&&this.security.postProcess&&(w=this.security.postProcess(w,d)),i&&i.postProcess&&(w=i.postProcess(w)),this.lastMessage=y,this.lastRequest=w,this.lastEndpoint=n;let T=i.exchangeId||(0,Ene.randomUUID)();if(this.emit("message",y,T),this.emit("request",w,T),this.httpHeaders===null)x={};else{for(let M in this.httpHeaders)x[M]=this.httpHeaders[M];for(let M in a)x[M]=a[M]}let V=o(M=>{try{return JSON.parse(M)}catch{return}},"tryJSONparse");if(this.streamAllowed&&typeof this.httpClient.requestStream=="function"){s=(0,CE.once)(s);let M=Date.now(),ie=o(Z=>{this.lastResponse=null,this.lastResponseHeaders=null,this.lastElapsedTime=null,this.lastRequestHeaders=Z.config&&Z.config.headers,this.emit("response",null,null,T),this.returnSaxStream||!Z.response||!Z.response.data?s(Z,void 0,void 0,void 0,w):(Z.response.data.on("close",()=>{s(Z,void 0,void 0,void 0,w)}),Z.response.data.on("data",ue=>{Z.response.data=ue.toString()}))},"onError");this.httpClient.requestStream(n,w,x,i,this).then(Z=>{if(this.lastRequestHeaders=Z.headers,Z.data.on&&Z.data.on("error",ue=>ie(ue)),Z.status!==200||!l||!l.$lookupTypes){(0,CE.streamToText)(Z.data).then(ue=>(this.lastResponse=ue,this.lastElapsedTime=Date.now()-M,this.lastResponseHeaders=Z&&Z.headers,this.lastRequestHeaders=Z.config&&Z.config.headers||Z.headers,this.emit("response",ue,Z,T),k(ue,Z)));return}if(this.returnSaxStream){let ue=this.wsdl.getSaxStream(Z.data);return A({saxStream:ue},"<stream>",Z.data)}else this.wsdl.xmlToObject(Z.data,(ue,$)=>(this.lastResponse=Z,this.lastElapsedTime=Date.now()-M,this.lastResponseHeaders=Z&&Z.headers,this.lastRequestHeaders=Z.config.headers,this.emit("response","<stream>",Z.data,T),ue?(ue.response=Z,ue.body="<stream>",this.emit("soapError",ue,T),s(ue,Z,void 0,void 0,w)):A($,"<stream>",Z)))},ie);return}let U=Date.now();return this.httpClient.request(n,w,(M,ie,Z)=>{if(this.lastResponse=Z,ie&&(this.lastResponseHeaders=ie.headers,this.lastElapsedTime=Date.now()-U,this.lastResponseAttachments=ie.mtomResponseAttachments,this.lastRequestHeaders=ie.config&&ie.config.headers),this.emit("response",Z,ie,T),M){this.lastRequestHeaders=M.config&&M.config.headers;try{M.response&&M.response.data&&this.wsdl.xmlToObject(M.response.data)}catch(ue){M.root=ue.root||ue}s(M,void 0,void 0,void 0,w)}else return k(Z,ie)},x,i,this)}};ri.Client=Cne});var X6=X(NE=>{"use strict";Object.defineProperty(NE,"__esModule",{value:!0});NE.BasicAuthSecurity=void 0;var $6=ds(),Nne=class{static{o(this,"BasicAuthSecurity")}constructor(e,t,n){this._username=e,this._password=t,this.defaults={},(0,$6.merge)(this.defaults,n)}addHeaders(e){e.Authorization="Basic "+Buffer.from(this._username+":"+this._password||"").toString("base64")}toXML(){return""}addOptions(e){(0,$6.merge)(e,this.defaults)}};NE.BasicAuthSecurity=Nne});var z6=X(TE=>{"use strict";Object.defineProperty(TE,"__esModule",{value:!0});TE.BearerSecurity=void 0;var G6=ds(),Tne=class{static{o(this,"BearerSecurity")}constructor(e,t){this._token=e,this.defaults={},(0,G6.merge)(this.defaults,t)}addHeaders(e){e.Authorization="Bearer "+this._token}toXML(){return""}addOptions(e){(0,G6.merge)(e,this.defaults)}};TE.BearerSecurity=Tne});var Q6=X(ca=>{"use strict";var Ine=ca&&ca.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:o(function(){return e[t]},"get")}),Object.defineProperty(r,n,s)}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),Dne=ca&&ca.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),Y6=ca&&ca.__importStar||(function(){var r=o(function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(n[n.length]=s);return n},r(e)},"ownKeys");return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),s=0;s<n.length;s++)n[s]!=="default"&&Ine(t,e,n[s]);return Dne(t,e),t}})();Object.defineProperty(ca,"__esModule",{value:!0});ca.ClientSSLSecurity=void 0;var _I=Y6(require("fs")),W6=Y6(require("https")),J6=ds(),Bne=class{static{o(this,"ClientSSLSecurity")}constructor(e,t,n,s){if(e)if(Buffer.isBuffer(e))this.key=e;else if(typeof e=="string")this.key=_I.readFileSync(e);else throw new Error("key should be a buffer or a string!");if(t)if(Buffer.isBuffer(t))this.cert=t;else if(typeof t=="string")this.cert=_I.readFileSync(t);else throw new Error("cert should be a buffer or a string!");n&&(Buffer.isBuffer(n)||Array.isArray(n)?this.ca=n:typeof n=="string"?this.ca=_I.readFileSync(n):(s=n,this.ca=null)),this.defaults={},(0,J6.merge)(this.defaults,s),this.agent=null}toXML(){return""}addOptions(e){let t=null;e.key=this.key,e.cert=this.cert,e.ca=this.ca,(0,J6.merge)(e,this.defaults),e.forever?(this.agent||(e.keepAlive=!0,this.agent=new W6.Agent(e)),t=this.agent):t=new W6.Agent(e),e.httpsAgent=t}};ca.ClientSSLSecurity=Bne});var tU=X(la=>{"use strict";var Rne=la&&la.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:o(function(){return e[t]},"get")}),Object.defineProperty(r,n,s)}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),_ne=la&&la.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),eU=la&&la.__importStar||(function(){var r=o(function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(n[n.length]=s);return n},r(e)},"ownKeys");return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),s=0;s<n.length;s++)n[s]!=="default"&&Rne(t,e,n[s]);return _ne(t,e),t}})();Object.defineProperty(la,"__esModule",{value:!0});la.ClientSSLSecurityPFX=void 0;var One=eU(require("fs")),Pne=eU(require("https")),Z6=ds(),kne=class{static{o(this,"ClientSSLSecurityPFX")}constructor(e,t,n){if(typeof t=="object"&&(n=t),e)if(Buffer.isBuffer(e))this.pfx=e;else if(typeof e=="string")this.pfx=One.readFileSync(e);else throw new Error("supplied pfx file should be a buffer or a file location");t&&typeof t=="string"&&(this.passphrase=t),this.defaults={},(0,Z6.merge)(this.defaults,n)}toXML(){return""}addOptions(e){e.pfx=this.pfx,this.passphrase&&(e.passphrase=this.passphrase),(0,Z6.merge)(e,this.defaults),e.httpsAgent=new Pne.Agent(e)}};la.ClientSSLSecurityPFX=kne});var rU=X(IE=>{"use strict";Object.defineProperty(IE,"__esModule",{value:!0});IE.NTLMSecurity=void 0;var Lne=ds(),Fne=class{static{o(this,"NTLMSecurity")}constructor(e,t,n,s){typeof e=="object"?(this.defaults=e,this.defaults.ntlm=!0):this.defaults={ntlm:!0,username:e,password:t,domain:n,workstation:s}}addHeaders(e){e.Connection="keep-alive"}toXML(){return""}addOptions(e){(0,Lne.merge)(e,this.defaults)}};IE.NTLMSecurity=Fne});var nU=X(fa=>{"use strict";var Une=fa&&fa.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:o(function(){return e[t]},"get")}),Object.defineProperty(r,n,s)}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),Vne=fa&&fa.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),Mne=fa&&fa.__importStar||(function(){var r=o(function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(n[n.length]=s);return n},r(e)},"ownKeys");return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),s=0;s<n.length;s++)n[s]!=="default"&&Une(t,e,n[s]);return Vne(t,e),t}})();Object.defineProperty(fa,"__esModule",{value:!0});fa.WSSecurity=void 0;var jne=Mne(require("crypto")),OI=ds(),qne=["PasswordDigest","PasswordText"],Hne=class{static{o(this,"WSSecurity")}constructor(e,t,n){n=n||{},this._username=e,this._password=t,this._envelopeKey="soap",this._appendElement="",typeof n=="string"?(this._passwordType=n||"PasswordText",n={}):this._passwordType=n.passwordType?n.passwordType:"PasswordText",qne.indexOf(this._passwordType)===-1&&(this._passwordType="PasswordText"),this._hasTimeStamp=n.hasTimeStamp||typeof n.hasTimeStamp=="boolean"?!!n.hasTimeStamp:!0,n.hasNonce!=null&&(this._hasNonce=!!n.hasNonce),this._hasTokenCreated=n.hasTokenCreated||typeof n.hasTokenCreated=="boolean"?!!n.hasTokenCreated:!0,n.actor!=null&&(this._actor=n.actor),n.mustUnderstand!=null&&(this._mustUnderstand=!!n.mustUnderstand),n.envelopeKey&&(this._envelopeKey=n.envelopeKey),n.appendElement&&(this._appendElement=n.appendElement)}toXML(){function e(u){function c(l){return l<10?"0"+l:l}return o(c,"pad"),u.getUTCFullYear()+"-"+c(u.getUTCMonth()+1)+"-"+c(u.getUTCDate())+"T"+c(u.getUTCHours())+":"+c(u.getUTCMinutes())+":"+c(u.getUTCSeconds())+"Z"}o(e,"getDate");let t=new Date,n=e(t),s="";if(this._hasTimeStamp){let u=e(new Date(t.getTime()+6e5));s='<wsu:Timestamp wsu:Id="Timestamp-'+n+'"><wsu:Created>'+n+"</wsu:Created><wsu:Expires>"+u+"</wsu:Expires></wsu:Timestamp>"}let i,a;if(this._hasNonce||this._passwordType!=="PasswordText"){let u=jne.createHash("sha1");u.update(n+Math.random()),a=u.digest("base64")}return this._passwordType==="PasswordText"?(i='<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">'+(0,OI.xmlEscape)(this._password)+"</wsse:Password>",a&&(i+='<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">'+a+"</wsse:Nonce>")):i='<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">'+(0,OI.passwordDigest)(a,n,this._password)+'</wsse:Password><wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">'+a+"</wsse:Nonce>","<wsse:Security "+(this._actor?`${this._envelopeKey}:actor="${this._actor}" `:"")+(this._mustUnderstand?`${this._envelopeKey}:mustUnderstand="1" `:"")+'xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">'+s+'<wsse:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="SecurityToken-'+n+'"><wsse:Username>'+(0,OI.xmlEscape)(this._username)+"</wsse:Username>"+i+(this._hasTokenCreated?"<wsu:Created>"+n+"</wsu:Created>":"")+"</wsse:UsernameToken>"+this._appendElement+"</wsse:Security>"}};fa.WSSecurity=Hne});var DE=X(PI=>{"use strict";var Kne=typeof PI>"u"?{}:PI;(function(r){"use strict";function e(p){var C=Array.prototype.slice,j=p.length,ne=o(function(H,Ge){return function(){return Ge.apply(this,H.concat(C.call(arguments)))}},"partial"),oe=o(function(){var H=C.call(arguments);return H.length<j?ne(H,oe):p.apply(this,C.apply(arguments,[0,j]))},"fn1");return oe}o(e,"curry");var t=o(function(p,C){for(var j=0;j<C.length;j+=1)p(C[j],j,C)},"forEach"),n=o(function(p,C,j){var ne=C;return t(function(oe,H){ne=p(ne,oe,H)},j),ne},"reduce"),s=o(function(p,C){var j=new Array(C.length);return t(function(ne,oe){j[oe]=p(ne)},C),j},"map"),i=o(function(p,C){var j=[];return t(function(ne,oe){p(ne,oe)&&j.push(ne)},C),j},"filter"),a=o(function(p,C){for(var j=0;j<p.length;j+=1)if(p[j]===C)return!0;return!1},"includes");function u(p){return function(){return p}}o(u,"always");function c(p){return p.toString()}o(c,"toString");var l=o(function(p,C){return C.join(p)},"join"),f=o(function(p,C,j){return p+j+C},"wrap"),h=Array.prototype.concat,d=32767;function g(p){for(var C=[],j=0;j<p.length;j+=d){var ne=p.slice(j,j+d);C=h.apply(C,ne)}return C}o(g,"flatten");function m(p,C){for(var j=Object(p),ne=1;ne<arguments.length;ne++){var oe=arguments[ne];if(oe!=null)for(var H in oe)Object.prototype.hasOwnProperty.call(oe,H)&&(j[H]=oe[H])}return j}o(m,"assign");var v={ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11};y.prototype=new Object,y.prototype.constructor=y,y.superclass=Object.prototype;function y(){this.init()}o(y,"XPathParser"),y.prototype.init=function(){this.reduceActions=[],this.reduceActions[3]=function(p){return new k(p[0],p[2])},this.reduceActions[5]=function(p){return new I(p[0],p[2])},this.reduceActions[7]=function(p){return new T(p[0],p[2])},this.reduceActions[8]=function(p){return new V(p[0],p[2])},this.reduceActions[10]=function(p){return new U(p[0],p[2])},this.reduceActions[11]=function(p){return new M(p[0],p[2])},this.reduceActions[12]=function(p){return new ie(p[0],p[2])},this.reduceActions[13]=function(p){return new Z(p[0],p[2])},this.reduceActions[15]=function(p){return new ue(p[0],p[2])},this.reduceActions[16]=function(p){return new $(p[0],p[2])},this.reduceActions[18]=function(p){return new de(p[0],p[2])},this.reduceActions[19]=function(p){return new xe(p[0],p[2])},this.reduceActions[20]=function(p){return new ve(p[0],p[2])},this.reduceActions[22]=function(p){return new b(p[1])},this.reduceActions[24]=function(p){return new me(p[0],p[2])},this.reduceActions[25]=function(p){return new z(void 0,void 0,p[0])},this.reduceActions[27]=function(p){return p[0].locationPath=p[2],p[0]},this.reduceActions[28]=function(p){return p[0].locationPath=p[2],p[0].locationPath.steps.unshift(new _(_.DESCENDANTORSELF,D.nodeTest,[])),p[0]},this.reduceActions[29]=function(p){return new z(p[0],[],void 0)},this.reduceActions[30]=function(p){return Ke.instance_of(p[0],z)?(p[0].filterPredicates==null&&(p[0].filterPredicates=[]),p[0].filterPredicates.push(p[1]),p[0]):new z(p[0],[p[1]],void 0)},this.reduceActions[32]=function(p){return p[1]},this.reduceActions[33]=function(p){return new R(p[0])},this.reduceActions[34]=function(p){return new N(p[0])},this.reduceActions[36]=function(p){return new q(p[0],[])},this.reduceActions[37]=function(p){return new q(p[0],p[2])},this.reduceActions[38]=function(p){return[p[0]]},this.reduceActions[39]=function(p){return p[2].unshift(p[0]),p[2]},this.reduceActions[43]=function(p){return new Ie(!0,[])},this.reduceActions[44]=function(p){return p[1].absolute=!0,p[1]},this.reduceActions[46]=function(p){return new Ie(!1,[p[0]])},this.reduceActions[47]=function(p){return p[0].steps.push(p[2]),p[0]},this.reduceActions[49]=function(p){return new _(p[0],p[1],[])},this.reduceActions[50]=function(p){return new _(_.CHILD,p[0],[])},this.reduceActions[51]=function(p){return new _(p[0],p[1],p[2])},this.reduceActions[52]=function(p){return new _(_.CHILD,p[0],p[1])},this.reduceActions[54]=function(p){return[p[0]]},this.reduceActions[55]=function(p){return p[1].unshift(p[0]),p[1]},this.reduceActions[56]=function(p){return p[0]=="ancestor"?_.ANCESTOR:p[0]=="ancestor-or-self"?_.ANCESTORORSELF:p[0]=="attribute"?_.ATTRIBUTE:p[0]=="child"?_.CHILD:p[0]=="descendant"?_.DESCENDANT:p[0]=="descendant-or-self"?_.DESCENDANTORSELF:p[0]=="following"?_.FOLLOWING:p[0]=="following-sibling"?_.FOLLOWINGSIBLING:p[0]=="namespace"?_.NAMESPACE:p[0]=="parent"?_.PARENT:p[0]=="preceding"?_.PRECEDING:p[0]=="preceding-sibling"?_.PRECEDINGSIBLING:p[0]=="self"?_.SELF:-1},this.reduceActions[57]=function(p){return _.ATTRIBUTE},this.reduceActions[59]=function(p){return p[0]=="comment"?D.commentTest:p[0]=="text"?D.textTest:p[0]=="processing-instruction"?D.anyPiTest:p[0]=="node"?D.nodeTest:new D(-1,void 0)},this.reduceActions[60]=function(p){return new D.PITest(p[2])},this.reduceActions[61]=function(p){return p[1]},this.reduceActions[63]=function(p){return p[1].absolute=!0,p[1].steps.unshift(new _(_.DESCENDANTORSELF,D.nodeTest,[])),p[1]},this.reduceActions[64]=function(p){return p[0].steps.push(new _(_.DESCENDANTORSELF,D.nodeTest,[])),p[0].steps.push(p[2]),p[0]},this.reduceActions[65]=function(p){return new _(_.SELF,D.nodeTest,[])},this.reduceActions[66]=function(p){return new _(_.PARENT,D.nodeTest,[])},this.reduceActions[67]=function(p){return new Y(p[1])},this.reduceActions[68]=function(p){return D.nameTestAny},this.reduceActions[69]=function(p){return new D.NameTestPrefixAny(p[0].split(":")[0])},this.reduceActions[70]=function(p){return new D.NameTestQName(p[0])}},y.actionTable=[" s s sssssssss s ss s ss"," s ","r rrrrrrrrr rrrrrrr rr r "," rrrrr "," s s sssssssss s ss s ss","rs rrrrrrrr s sssssrrrrrr rrs rs "," s s sssssssss s ss s ss"," s "," s ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr "," s "," s "," s s sssss s s ","r rrrrrrrrr rrrrrrr rr r ","a ","r s rr r ","r sr rr r ","r s rr s rr r ","r rssrr rss rr r ","r rrrrr rrrss rr r ","r rrrrrsss rrrrr rr r ","r rrrrrrrr rrrrr rr r ","r rrrrrrrr rrrrrs rr r ","r rrrrrrrr rrrrrr rr r ","r rrrrrrrr rrrrrr rr r ","r srrrrrrrr rrrrrrs rr sr ","r srrrrrrrr rrrrrrs rr r ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrr rrrrrr rr r ","r rrrrrrrr rrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r "," sssss ","r rrrrrrrrr rrrrrrr rr sr ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr "," s ","r srrrrrrrr rrrrrrs rr r ","r rrrrrrrr rrrrr rr r "," s "," s "," rrrrr "," s s sssssssss s sss s ss","r srrrrrrrr rrrrrrs rr r "," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss ss s ss"," s s sssssssss s ss s ss"," s s sssss s s "," s s sssss s s ","r rrrrrrrrr rrrrrrr rr rr "," s s sssss s s "," s s sssss s s ","r rrrrrrrrr rrrrrrr rr sr ","r rrrrrrrrr rrrrrrr rr sr ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr rr "," s ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr "," rr "," s "," rs ","r sr rr r ","r s rr s rr r ","r rssrr rss rr r ","r rssrr rss rr r ","r rrrrr rrrss rr r ","r rrrrr rrrss rr r ","r rrrrr rrrss rr r ","r rrrrr rrrss rr r ","r rrrrrsss rrrrr rr r ","r rrrrrsss rrrrr rr r ","r rrrrrrrr rrrrr rr r ","r rrrrrrrr rrrrr rr r ","r rrrrrrrr rrrrr rr r ","r rrrrrrrr rrrrrr rr r "," r "," s ","r srrrrrrrr rrrrrrs rr r ","r srrrrrrrr rrrrrrs rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr "," s s sssssssss s ss s ss","r rrrrrrrrr rrrrrrr rr rr "," r "],y.actionTableNumber=[` 1 0 /.-,+*)(' & %$ # "!`," J ","a aaaaaaaaa aaaaaaa aa a "," YYYYY ",` 1 0 /.-,+*)(' & %$ # "!`,`K1 KKKKKKKK . +*)('KKKKKK KK# K" `,` 1 0 /.-,+*)(' & %$ # "!`," N "," O ","e eeeeeeeee eeeeeee ee ee ","f fffffffff fffffff ff ff ","d ddddddddd ddddddd dd dd ","B BBBBBBBBB BBBBBBB BB BB ","A AAAAAAAAA AAAAAAA AA AA "," P "," Q ",` 1 . +*)(' # " `,"b bbbbbbbbb bbbbbbb bb b "," ","! S !! ! ",'" T" "" " ',"$ V $$ U $$ $ ","& &ZY&& &XW && & ",") ))))) )))\\[ )) ) ",". ....._^] ..... .. . ","1 11111111 11111 11 1 ","5 55555555 55555` 55 5 ","7 77777777 777777 77 7 ","9 99999999 999999 99 9 ",": c:::::::: ::::::b :: a: ","I fIIIIIIII IIIIIIe II I ","= ========= ======= == == ","? ????????? ??????? ?? ?? ","C CCCCCCCCC CCCCCCC CC CC ","J JJJJJJJJ JJJJJJ JJ J ","M MMMMMMMM MMMMMM MM M ","N NNNNNNNNN NNNNNNN NN N ","P PPPPPPPPP PPPPPPP PP P "," +*)(' ","R RRRRRRRRR RRRRRRR RR aR ","U UUUUUUUUU UUUUUUU UU U ","Z ZZZZZZZZZ ZZZZZZZ ZZ ZZ ","c ccccccccc ccccccc cc cc "," j ","L fLLLLLLLL LLLLLLe LL L ","6 66666666 66666 66 6 "," k "," l "," XXXXX ",` 1 0 /.-,+*)(' & %$m # "!`,"_ f________ ______e __ _ ",` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 . +*)(' # " `,` 1 . +*)(' # " `,"> >>>>>>>>> >>>>>>> >> >> ",` 1 . +*)(' # " `,` 1 . +*)(' # " `,"Q QQQQQQQQQ QQQQQQQ QQ aQ ","V VVVVVVVVV VVVVVVV VV aV ","T TTTTTTTTT TTTTTTT TT T ","@ @@@@@@@@@ @@@@@@@ @@ @@ "," \x87 ","[ [[[[[[[[[ [[[[[[[ [[ [[ ","D DDDDDDDDD DDDDDDD DD DD "," HH "," \x88 "," F\x89 ","# T# ## # ","% V %% U %% % ","' 'ZY'' 'XW '' ' ","( (ZY(( (XW (( ( ","+ +++++ +++\\[ ++ + ","* ***** ***\\[ ** * ","- ----- ---\\[ -- - ",", ,,,,, ,,,\\[ ,, , ","0 00000_^] 00000 00 0 ","/ /////_^] ///// // / ","2 22222222 22222 22 2 ","3 33333333 33333 33 3 ","4 44444444 44444 44 4 ","8 88888888 888888 88 8 "," ^ "," \x8A ","; f;;;;;;;; ;;;;;;e ;; ; ","< f<<<<<<<< <<<<<<e << < ","O OOOOOOOOO OOOOOOO OO O ","` ````````` ``````` `` ` ","S SSSSSSSSS SSSSSSS SS S ","W WWWWWWWWW WWWWWWW WW W ","\\ \\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\ \\\\ \\\\ ","E EEEEEEEEE EEEEEEE EE EE ",` 1 0 /.-,+*)(' & %$ # "!`,"] ]]]]]]]]] ]]]]]]] ]] ]] "," G "],y.gotoTable=["3456789:;<=>?@ AB CDEFGH IJ "," "," "," ","L456789:;<=>?@ AB CDEFGH IJ "," M EFGH IJ "," N;<=>?@ AB CDEFGH IJ "," "," "," "," "," "," "," "," "," "," S EFGH IJ "," "," "," "," "," "," "," "," "," "," "," "," "," e "," "," "," "," "," "," "," "," "," h J "," i j "," "," "," "," "," "," "," "," "," ","o456789:;<=>?@ ABpqCDEFGH IJ "," "," r6789:;<=>?@ AB CDEFGH IJ "," s789:;<=>?@ AB CDEFGH IJ "," t89:;<=>?@ AB CDEFGH IJ "," u89:;<=>?@ AB CDEFGH IJ "," v9:;<=>?@ AB CDEFGH IJ "," w9:;<=>?@ AB CDEFGH IJ "," x9:;<=>?@ AB CDEFGH IJ "," y9:;<=>?@ AB CDEFGH IJ "," z:;<=>?@ AB CDEFGH IJ "," {:;<=>?@ AB CDEFGH IJ "," |;<=>?@ AB CDEFGH IJ "," };<=>?@ AB CDEFGH IJ "," ~;<=>?@ AB CDEFGH IJ "," \x7F=>?@ AB CDEFGH IJ ","\x80456789:;<=>?@ AB CDEFGH IJ\x81"," \x82 EFGH IJ "," \x83 EFGH IJ "," "," \x84 GH IJ "," \x85 GH IJ "," i \x86 "," i \x87 "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","o456789:;<=>?@ AB\x8CqCDEFGH IJ "," "," "],y.productions=[[1,1,2],[2,1,3],[3,1,4],[3,3,3,-9,4],[4,1,5],[4,3,4,-8,5],[5,1,6],[5,3,5,-22,6],[5,3,5,-5,6],[6,1,7],[6,3,6,-23,7],[6,3,6,-24,7],[6,3,6,-6,7],[6,3,6,-7,7],[7,1,8],[7,3,7,-25,8],[7,3,7,-26,8],[8,1,9],[8,3,8,-12,9],[8,3,8,-11,9],[8,3,8,-10,9],[9,1,10],[9,2,-26,9],[10,1,11],[10,3,10,-27,11],[11,1,12],[11,1,13],[11,3,13,-28,14],[11,3,13,-4,14],[13,1,15],[13,2,13,16],[15,1,17],[15,3,-29,2,-30],[15,1,-15],[15,1,-16],[15,1,18],[18,3,-13,-29,-30],[18,4,-13,-29,19,-30],[19,1,20],[19,3,20,-31,19],[20,1,2],[12,1,14],[12,1,21],[21,1,-28],[21,2,-28,14],[21,1,22],[14,1,23],[14,3,14,-28,23],[14,1,24],[23,2,25,26],[23,1,26],[23,3,25,26,27],[23,2,26,27],[23,1,28],[27,1,16],[27,2,16,27],[25,2,-14,-3],[25,1,-32],[26,1,29],[26,3,-20,-29,-30],[26,4,-21,-29,-15,-30],[16,3,-33,30,-34],[30,1,2],[22,2,-4,14],[24,3,14,-4,23],[28,1,-35],[28,1,-2],[17,2,-36,-18],[29,1,-17],[29,1,-19],[29,1,-18]],y.DOUBLEDOT=2,y.DOUBLECOLON=3,y.DOUBLESLASH=4,y.NOTEQUAL=5,y.LESSTHANOREQUAL=6,y.GREATERTHANOREQUAL=7,y.AND=8,y.OR=9,y.MOD=10,y.DIV=11,y.MULTIPLYOPERATOR=12,y.FUNCTIONNAME=13,y.AXISNAME=14,y.LITERAL=15,y.NUMBER=16,y.ASTERISKNAMETEST=17,y.QNAME=18,y.NCNAMECOLONASTERISK=19,y.NODETYPE=20,y.PROCESSINGINSTRUCTIONWITHLITERAL=21,y.EQUALS=22,y.LESSTHAN=23,y.GREATERTHAN=24,y.PLUS=25,y.MINUS=26,y.BAR=27,y.SLASH=28,y.LEFTPARENTHESIS=29,y.RIGHTPARENTHESIS=30,y.COMMA=31,y.AT=32,y.LEFTBRACKET=33,y.RIGHTBRACKET=34,y.DOT=35,y.DOLLAR=36,y.prototype.tokenize=function(p){for(var C=[],j=[],ne=p+"\0",oe=0,H=ne.charAt(oe++);;){for(;H==" "||H==" "||H=="\r"||H==`
|
|
44
|
-
`;)H=ne.charAt(oe++);if(H=="\0"||oe>=ne.length)break;if(H=="("){C.push(y.LEFTPARENTHESIS),j.push(H),H=ne.charAt(oe++);continue}if(H==")"){C.push(y.RIGHTPARENTHESIS),j.push(H),H=ne.charAt(oe++);continue}if(H=="["){C.push(y.LEFTBRACKET),j.push(H),H=ne.charAt(oe++);continue}if(H=="]"){C.push(y.RIGHTBRACKET),j.push(H),H=ne.charAt(oe++);continue}if(H=="@"){C.push(y.AT),j.push(H),H=ne.charAt(oe++);continue}if(H==","){C.push(y.COMMA),j.push(H),H=ne.charAt(oe++);continue}if(H=="|"){C.push(y.BAR),j.push(H),H=ne.charAt(oe++);continue}if(H=="+"){C.push(y.PLUS),j.push(H),H=ne.charAt(oe++);continue}if(H=="-"){C.push(y.MINUS),j.push(H),H=ne.charAt(oe++);continue}if(H=="="){C.push(y.EQUALS),j.push(H),H=ne.charAt(oe++);continue}if(H=="$"){C.push(y.DOLLAR),j.push(H),H=ne.charAt(oe++);continue}if(H=="."){if(H=ne.charAt(oe++),H=="."){C.push(y.DOUBLEDOT),j.push(".."),H=ne.charAt(oe++);continue}if(H>="0"&&H<="9"){var Ge="."+H;for(H=ne.charAt(oe++);H>="0"&&H<="9";)Ge+=H,H=ne.charAt(oe++);C.push(y.NUMBER),j.push(Ge);continue}C.push(y.DOT),j.push(".");continue}if(H=="'"||H=='"'){for(var St=H,Ut="";oe<ne.length&&(H=ne.charAt(oe))!==St;)Ut+=H,oe+=1;if(H!==St)throw Rs.fromMessage("Unterminated string literal: "+St+Ut);oe+=1,C.push(y.LITERAL),j.push(Ut),H=ne.charAt(oe++);continue}if(H>="0"&&H<="9"){var Ge=H;for(H=ne.charAt(oe++);H>="0"&&H<="9";)Ge+=H,H=ne.charAt(oe++);if(H=="."&&ne.charAt(oe)>="0"&&ne.charAt(oe)<="9")for(Ge+=H,Ge+=ne.charAt(oe++),H=ne.charAt(oe++);H>="0"&&H<="9";)Ge+=H,H=ne.charAt(oe++);C.push(y.NUMBER),j.push(Ge);continue}if(H=="*"){if(C.length>0){var $e=C[C.length-1];if($e!=y.AT&&$e!=y.DOUBLECOLON&&$e!=y.LEFTPARENTHESIS&&$e!=y.LEFTBRACKET&&$e!=y.AND&&$e!=y.OR&&$e!=y.MOD&&$e!=y.DIV&&$e!=y.MULTIPLYOPERATOR&&$e!=y.SLASH&&$e!=y.DOUBLESLASH&&$e!=y.BAR&&$e!=y.PLUS&&$e!=y.MINUS&&$e!=y.EQUALS&&$e!=y.NOTEQUAL&&$e!=y.LESSTHAN&&$e!=y.LESSTHANOREQUAL&&$e!=y.GREATERTHAN&&$e!=y.GREATERTHANOREQUAL){C.push(y.MULTIPLYOPERATOR),j.push(H),H=ne.charAt(oe++);continue}}C.push(y.ASTERISKNAMETEST),j.push(H),H=ne.charAt(oe++);continue}if(H==":"&&ne.charAt(oe)==":"){C.push(y.DOUBLECOLON),j.push("::"),oe++,H=ne.charAt(oe++);continue}if(H=="/"){if(H=ne.charAt(oe++),H=="/"){C.push(y.DOUBLESLASH),j.push("//"),H=ne.charAt(oe++);continue}C.push(y.SLASH),j.push("/");continue}if(H=="!"&&ne.charAt(oe)=="="){C.push(y.NOTEQUAL),j.push("!="),oe++,H=ne.charAt(oe++);continue}if(H=="<"){if(ne.charAt(oe)=="="){C.push(y.LESSTHANOREQUAL),j.push("<="),oe++,H=ne.charAt(oe++);continue}C.push(y.LESSTHAN),j.push("<"),H=ne.charAt(oe++);continue}if(H==">"){if(ne.charAt(oe)=="="){C.push(y.GREATERTHANOREQUAL),j.push(">="),oe++,H=ne.charAt(oe++);continue}C.push(y.GREATERTHAN),j.push(">"),H=ne.charAt(oe++);continue}if(H=="_"||Ke.isLetter(H.charCodeAt(0))){var yt=H;for(H=ne.charAt(oe++);Ke.isNCNameChar(H.charCodeAt(0));)yt+=H,H=ne.charAt(oe++);if(C.length>0){var $e=C[C.length-1];if($e!=y.AT&&$e!=y.DOUBLECOLON&&$e!=y.LEFTPARENTHESIS&&$e!=y.LEFTBRACKET&&$e!=y.AND&&$e!=y.OR&&$e!=y.MOD&&$e!=y.DIV&&$e!=y.MULTIPLYOPERATOR&&$e!=y.SLASH&&$e!=y.DOUBLESLASH&&$e!=y.BAR&&$e!=y.PLUS&&$e!=y.MINUS&&$e!=y.EQUALS&&$e!=y.NOTEQUAL&&$e!=y.LESSTHAN&&$e!=y.LESSTHANOREQUAL&&$e!=y.GREATERTHAN&&$e!=y.GREATERTHANOREQUAL){if(yt=="and"){C.push(y.AND),j.push(yt);continue}if(yt=="or"){C.push(y.OR),j.push(yt);continue}if(yt=="mod"){C.push(y.MOD),j.push(yt);continue}if(yt=="div"){C.push(y.DIV),j.push(yt);continue}}}if(H==":"){if(ne.charAt(oe)=="*"){C.push(y.NCNAMECOLONASTERISK),j.push(yt+":*"),oe++,H=ne.charAt(oe++);continue}if(ne.charAt(oe)=="_"||Ke.isLetter(ne.charCodeAt(oe))){for(yt+=":",H=ne.charAt(oe++);Ke.isNCNameChar(H.charCodeAt(0));)yt+=H,H=ne.charAt(oe++);if(H=="("){C.push(y.FUNCTIONNAME),j.push(yt);continue}C.push(y.QNAME),j.push(yt);continue}if(ne.charAt(oe)==":"){C.push(y.AXISNAME),j.push(yt);continue}}if(H=="("){if(yt=="comment"||yt=="text"||yt=="node"){C.push(y.NODETYPE),j.push(yt);continue}if(yt=="processing-instruction"){ne.charAt(oe)==")"?C.push(y.NODETYPE):C.push(y.PROCESSINGINSTRUCTIONWITHLITERAL),j.push(yt);continue}C.push(y.FUNCTIONNAME),j.push(yt);continue}C.push(y.QNAME),j.push(yt);continue}throw new Error("Unexpected character "+H)}return C.push(1),j.push("[EOF]"),[C,j]},y.SHIFT="s",y.REDUCE="r",y.ACCEPT="a",y.prototype.parse=function(Ut){var C,j,ne=this.tokenize(Ut);if(ne!=null){C=ne[0],j=ne[1];var oe=0,H=[],Ge=[],St=[],Ut,$e,yt;for(H.push(0),Ge.push(1),St.push("_S"),$e=C[oe],yt=j[oe++];;)switch(Ut=H[H.length-1],y.actionTable[Ut].charAt($e-1)){case y.SHIFT:Ge.push(-$e),St.push(yt),H.push(y.actionTableNumber[Ut].charCodeAt($e-1)-32),$e=C[oe],yt=j[oe++];break;case y.REDUCE:for(var Wn=y.productions[y.actionTableNumber[Ut].charCodeAt($e-1)-32][1],Xi=[],ar=0;ar<Wn;ar++)Ge.pop(),Xi.unshift(St.pop()),H.pop();var Mo=H[H.length-1];Ge.push(y.productions[y.actionTableNumber[Ut].charCodeAt($e-1)-32][0]),this.reduceActions[y.actionTableNumber[Ut].charCodeAt($e-1)-32]==null?St.push(Xi[0]):St.push(this.reduceActions[y.actionTableNumber[Ut].charCodeAt($e-1)-32](Xi)),H.push(y.gotoTable[Mo].charCodeAt(y.productions[y.actionTableNumber[Ut].charCodeAt($e-1)-32][0]-2)-33);break;case y.ACCEPT:return new w(St.pop());default:throw new Error("XPath parse error")}}},w.prototype=new Object,w.prototype.constructor=w,w.superclass=Object.prototype;function w(p){this.expression=p}o(w,"XPath"),w.prototype.toString=function(){return this.expression.toString()};function S(p,C,j){C in p||(p[C]=j)}o(S,"setIfUnset"),w.prototype.evaluate=function(p){return p.contextNode=p.expressionContextNode,p.contextSize=1,p.contextPosition=1,p.isHtml&&(S(p,"caseInsensitive",!0),S(p,"allowAnyNamespaceForNoPrefix",!0)),S(p,"caseInsensitive",!1),this.expression.evaluate(p)},w.XML_NAMESPACE_URI="http://www.w3.org/XML/1998/namespace",w.XMLNS_NAMESPACE_URI="http://www.w3.org/2000/xmlns/",E.prototype=new Object,E.prototype.constructor=E,E.superclass=Object.prototype;function E(){}o(E,"Expression"),E.prototype.init=function(){},E.prototype.toString=function(){return"<Expression>"},E.prototype.evaluate=function(p){throw new Error("Could not evaluate expression.")},x.prototype=new E,x.prototype.constructor=x,x.superclass=E.prototype;function x(p){arguments.length>0&&this.init(p)}o(x,"UnaryOperation"),x.prototype.init=function(p){this.rhs=p},b.prototype=new x,b.prototype.constructor=b,b.superclass=x.prototype;function b(p){arguments.length>0&&this.init(p)}o(b,"UnaryMinusOperation"),b.prototype.init=function(p){b.superclass.init.call(this,p)},b.prototype.evaluate=function(p){return this.rhs.evaluate(p).number().negate()},b.prototype.toString=function(){return"-"+this.rhs.toString()},A.prototype=new E,A.prototype.constructor=A,A.superclass=E.prototype;function A(p,C){arguments.length>0&&this.init(p,C)}o(A,"BinaryOperation"),A.prototype.init=function(p,C){this.lhs=p,this.rhs=C},k.prototype=new A,k.prototype.constructor=k,k.superclass=A.prototype;function k(p,C){arguments.length>0&&this.init(p,C)}o(k,"OrOperation"),k.prototype.init=function(p,C){k.superclass.init.call(this,p,C)},k.prototype.toString=function(){return"("+this.lhs.toString()+" or "+this.rhs.toString()+")"},k.prototype.evaluate=function(p){var C=this.lhs.evaluate(p).bool();return C.booleanValue()?C:this.rhs.evaluate(p).bool()},I.prototype=new A,I.prototype.constructor=I,I.superclass=A.prototype;function I(p,C){arguments.length>0&&this.init(p,C)}o(I,"AndOperation"),I.prototype.init=function(p,C){I.superclass.init.call(this,p,C)},I.prototype.toString=function(){return"("+this.lhs.toString()+" and "+this.rhs.toString()+")"},I.prototype.evaluate=function(p){var C=this.lhs.evaluate(p).bool();return C.booleanValue()?this.rhs.evaluate(p).bool():C},T.prototype=new A,T.prototype.constructor=T,T.superclass=A.prototype;function T(p,C){arguments.length>0&&this.init(p,C)}o(T,"EqualsOperation"),T.prototype.init=function(p,C){T.superclass.init.call(this,p,C)},T.prototype.toString=function(){return"("+this.lhs.toString()+" = "+this.rhs.toString()+")"},T.prototype.evaluate=function(p){return this.lhs.evaluate(p).equals(this.rhs.evaluate(p))},V.prototype=new A,V.prototype.constructor=V,V.superclass=A.prototype;function V(p,C){arguments.length>0&&this.init(p,C)}o(V,"NotEqualOperation"),V.prototype.init=function(p,C){V.superclass.init.call(this,p,C)},V.prototype.toString=function(){return"("+this.lhs.toString()+" != "+this.rhs.toString()+")"},V.prototype.evaluate=function(p){return this.lhs.evaluate(p).notequal(this.rhs.evaluate(p))},U.prototype=new A,U.prototype.constructor=U,U.superclass=A.prototype;function U(p,C){arguments.length>0&&this.init(p,C)}o(U,"LessThanOperation"),U.prototype.init=function(p,C){U.superclass.init.call(this,p,C)},U.prototype.evaluate=function(p){return this.lhs.evaluate(p).lessthan(this.rhs.evaluate(p))},U.prototype.toString=function(){return"("+this.lhs.toString()+" < "+this.rhs.toString()+")"},M.prototype=new A,M.prototype.constructor=M,M.superclass=A.prototype;function M(p,C){arguments.length>0&&this.init(p,C)}o(M,"GreaterThanOperation"),M.prototype.init=function(p,C){M.superclass.init.call(this,p,C)},M.prototype.evaluate=function(p){return this.lhs.evaluate(p).greaterthan(this.rhs.evaluate(p))},M.prototype.toString=function(){return"("+this.lhs.toString()+" > "+this.rhs.toString()+")"},ie.prototype=new A,ie.prototype.constructor=ie,ie.superclass=A.prototype;function ie(p,C){arguments.length>0&&this.init(p,C)}o(ie,"LessThanOrEqualOperation"),ie.prototype.init=function(p,C){ie.superclass.init.call(this,p,C)},ie.prototype.evaluate=function(p){return this.lhs.evaluate(p).lessthanorequal(this.rhs.evaluate(p))},ie.prototype.toString=function(){return"("+this.lhs.toString()+" <= "+this.rhs.toString()+")"},Z.prototype=new A,Z.prototype.constructor=Z,Z.superclass=A.prototype;function Z(p,C){arguments.length>0&&this.init(p,C)}o(Z,"GreaterThanOrEqualOperation"),Z.prototype.init=function(p,C){Z.superclass.init.call(this,p,C)},Z.prototype.evaluate=function(p){return this.lhs.evaluate(p).greaterthanorequal(this.rhs.evaluate(p))},Z.prototype.toString=function(){return"("+this.lhs.toString()+" >= "+this.rhs.toString()+")"},ue.prototype=new A,ue.prototype.constructor=ue,ue.superclass=A.prototype;function ue(p,C){arguments.length>0&&this.init(p,C)}o(ue,"PlusOperation"),ue.prototype.init=function(p,C){ue.superclass.init.call(this,p,C)},ue.prototype.evaluate=function(p){return this.lhs.evaluate(p).number().plus(this.rhs.evaluate(p).number())},ue.prototype.toString=function(){return"("+this.lhs.toString()+" + "+this.rhs.toString()+")"},$.prototype=new A,$.prototype.constructor=$,$.superclass=A.prototype;function $(p,C){arguments.length>0&&this.init(p,C)}o($,"MinusOperation"),$.prototype.init=function(p,C){$.superclass.init.call(this,p,C)},$.prototype.evaluate=function(p){return this.lhs.evaluate(p).number().minus(this.rhs.evaluate(p).number())},$.prototype.toString=function(){return"("+this.lhs.toString()+" - "+this.rhs.toString()+")"},de.prototype=new A,de.prototype.constructor=de,de.superclass=A.prototype;function de(p,C){arguments.length>0&&this.init(p,C)}o(de,"MultiplyOperation"),de.prototype.init=function(p,C){de.superclass.init.call(this,p,C)},de.prototype.evaluate=function(p){return this.lhs.evaluate(p).number().multiply(this.rhs.evaluate(p).number())},de.prototype.toString=function(){return"("+this.lhs.toString()+" * "+this.rhs.toString()+")"},xe.prototype=new A,xe.prototype.constructor=xe,xe.superclass=A.prototype;function xe(p,C){arguments.length>0&&this.init(p,C)}o(xe,"DivOperation"),xe.prototype.init=function(p,C){xe.superclass.init.call(this,p,C)},xe.prototype.evaluate=function(p){return this.lhs.evaluate(p).number().div(this.rhs.evaluate(p).number())},xe.prototype.toString=function(){return"("+this.lhs.toString()+" div "+this.rhs.toString()+")"},ve.prototype=new A,ve.prototype.constructor=ve,ve.superclass=A.prototype;function ve(p,C){arguments.length>0&&this.init(p,C)}o(ve,"ModOperation"),ve.prototype.init=function(p,C){ve.superclass.init.call(this,p,C)},ve.prototype.evaluate=function(p){return this.lhs.evaluate(p).number().mod(this.rhs.evaluate(p).number())},ve.prototype.toString=function(){return"("+this.lhs.toString()+" mod "+this.rhs.toString()+")"},me.prototype=new A,me.prototype.constructor=me,me.superclass=A.prototype;function me(p,C){arguments.length>0&&this.init(p,C)}o(me,"BarOperation"),me.prototype.init=function(p,C){me.superclass.init.call(this,p,C)},me.prototype.evaluate=function(p){return this.lhs.evaluate(p).nodeset().union(this.rhs.evaluate(p).nodeset())},me.prototype.toString=function(){return s(c,[this.lhs,this.rhs]).join(" | ")},z.prototype=new E,z.prototype.constructor=z,z.superclass=E.prototype;function z(p,C,j){arguments.length>0&&this.init(p,C,j)}o(z,"PathExpr"),z.prototype.init=function(p,C,j){z.superclass.init.call(this),this.filter=p,this.filterPredicates=C,this.locationPath=j};function ee(p){for(;p&&p.parentNode;)p=p.parentNode;return p}o(ee,"findRoot"),z.applyPredicates=function(p,C,j){if(p.length===0)return j;var ne=C.extend({});return n(function(oe,H){return ne.contextSize=oe.length,i(function(Ge,St){return ne.contextNode=Ge,ne.contextPosition=St+1,z.predicateMatches(H,ne)},oe)},j,p)},z.getRoot=function(p,C){var j=C[0];if(j.nodeType===v.DOCUMENT_NODE)return j;if(p.virtualRoot)return p.virtualRoot;var ne=j.ownerDocument;if(ne)return ne;for(var oe=j;oe.parentNode!=null;)oe=oe.parentNode;return oe},z.applyStep=function(p,C,j){var ne=this,oe=[];switch(C.contextNode=j,p.axis){case _.ANCESTOR:if(C.contextNode===C.virtualRoot)break;var H;for(C.contextNode.nodeType==v.ATTRIBUTE_NODE?H=z.getOwnerElement(C.contextNode):H=C.contextNode.parentNode;H!=null&&(p.nodeTest.matches(H,C)&&oe.push(H),H!==C.virtualRoot);)H=H.parentNode;break;case _.ANCESTORORSELF:for(var H=C.contextNode;H!=null&&(p.nodeTest.matches(H,C)&&oe.push(H),H!==C.virtualRoot);H=H.nodeType==v.ATTRIBUTE_NODE?z.getOwnerElement(H):H.parentNode);break;case _.ATTRIBUTE:var Ge=C.contextNode.attributes;if(Ge!=null)for(var St=0;St<Ge.length;St++){var H=Ge.item(St);p.nodeTest.matches(H,C)&&oe.push(H)}break;case _.CHILD:for(var H=C.contextNode.firstChild;H!=null;H=H.nextSibling)p.nodeTest.matches(H,C)&&oe.push(H);break;case _.DESCENDANT:for(var ar=[C.contextNode.firstChild];ar.length>0;)for(var H=ar.pop();H!=null;)p.nodeTest.matches(H,C)&&oe.push(H),H.firstChild!=null?(ar.push(H.nextSibling),H=H.firstChild):H=H.nextSibling;break;case _.DESCENDANTORSELF:p.nodeTest.matches(C.contextNode,C)&&oe.push(C.contextNode);for(var ar=[C.contextNode.firstChild];ar.length>0;)for(var H=ar.pop();H!=null;)p.nodeTest.matches(H,C)&&oe.push(H),H.firstChild!=null?(ar.push(H.nextSibling),H=H.firstChild):H=H.nextSibling;break;case _.FOLLOWING:if(C.contextNode===C.virtualRoot)break;var ar=[];C.contextNode.firstChild!=null?ar.unshift(C.contextNode.firstChild):ar.unshift(C.contextNode.nextSibling);for(var H=C.contextNode.parentNode;H!=null&&H.nodeType!=v.DOCUMENT_NODE&&H!==C.virtualRoot;H=H.parentNode)ar.unshift(H.nextSibling);do for(var H=ar.pop();H!=null;)p.nodeTest.matches(H,C)&&oe.push(H),H.firstChild!=null?(ar.push(H.nextSibling),H=H.firstChild):H=H.nextSibling;while(ar.length>0);break;case _.FOLLOWINGSIBLING:if(C.contextNode===C.virtualRoot)break;for(var H=C.contextNode.nextSibling;H!=null;H=H.nextSibling)p.nodeTest.matches(H,C)&&oe.push(H);break;case _.NAMESPACE:var Ut={};if(C.contextNode.nodeType==v.ELEMENT_NODE){Ut.xml=w.XML_NAMESPACE_URI,Ut.xmlns=w.XMLNS_NAMESPACE_URI;for(var H=C.contextNode;H!=null&&H.nodeType==v.ELEMENT_NODE;H=H.parentNode)for(var St=0;St<H.attributes.length;St++){var $e=H.attributes.item(St),yt=String($e.name);if(yt=="xmlns")Ut[""]==null&&(Ut[""]=$e.value);else if(yt.length>6&&yt.substring(0,6)=="xmlns:"){var Wn=yt.substring(6,yt.length);Ut[Wn]==null&&(Ut[Wn]=$e.value)}}for(var Wn in Ut){var Xi=new dr(Wn,Ut[Wn],C.contextNode);p.nodeTest.matches(Xi,C)&&oe.push(Xi)}}break;case _.PARENT:H=null,C.contextNode!==C.virtualRoot&&(C.contextNode.nodeType==v.ATTRIBUTE_NODE?H=z.getOwnerElement(C.contextNode):H=C.contextNode.parentNode),H!=null&&p.nodeTest.matches(H,C)&&oe.push(H);break;case _.PRECEDING:var ar;C.virtualRoot!=null?ar=[C.virtualRoot]:ar=[ee(C.contextNode)];e:for(;ar.length>0;)for(var H=ar.pop();H!=null;){if(H==C.contextNode)break e;p.nodeTest.matches(H,C)&&oe.unshift(H),H.firstChild!=null?(ar.push(H.nextSibling),H=H.firstChild):H=H.nextSibling}break;case _.PRECEDINGSIBLING:if(C.contextNode===C.virtualRoot)break;for(var H=C.contextNode.previousSibling;H!=null;H=H.previousSibling)p.nodeTest.matches(H,C)&&oe.push(H);break;case _.SELF:p.nodeTest.matches(C.contextNode,C)&&oe.push(C.contextNode);break;default:}return oe};function le(p,C,j){return z.applyPredicates(p.predicates,C,z.applyStep(p,C,j))}o(le,"applyStepWithPredicates");function Ae(p,C,j){return g(s(le.bind(null,j,p),C))}o(Ae,"applyStepToNodes"),z.applySteps=function(p,C,j){return n(Ae.bind(null,C),j,p)},z.prototype.applyFilter=function(p,C){if(!this.filter)return{nodes:[p.contextNode]};var j=this.filter.evaluate(p);if(!Ke.instance_of(j,ke)){if(this.filterPredicates!=null&&this.filterPredicates.length>0||this.locationPath!=null)throw new Error("Path expression filter must evaluate to a nodeset if predicates or location path are used");return{nonNodes:j}}return{nodes:z.applyPredicates(this.filterPredicates||[],C,j.toUnsortedArray())}},z.applyLocationPath=function(p,C,j){if(!p)return j;var ne=p.absolute?[z.getRoot(C,j)]:j;return z.applySteps(p.steps,C,ne)},z.prototype.evaluate=function(p){var C=m(new Ir,p),j=this.applyFilter(p,C);if("nonNodes"in j)return j.nonNodes;var ne=new ke;return ne.addArray(z.applyLocationPath(this.locationPath,C,j.nodes)),ne},z.predicateMatches=function(p,C){var j=p.evaluate(C);return Ke.instance_of(j,N)?C.contextPosition===j.numberValue():j.booleanValue()},z.predicateString=function(p){return f("[","]",p.toString())},z.predicatesString=function(p){return l("",s(z.predicateString,p))},z.prototype.toString=function(){if(this.filter!=null){var p=c(this.filter);return Ke.instance_of(this.filter,R)?f("'","'",p):this.filterPredicates!=null&&this.filterPredicates.length?f("(",")",p)+z.predicatesString(this.filterPredicates):this.locationPath!=null?p+(this.locationPath.absolute?"":"/")+c(this.locationPath):p}return c(this.locationPath)},z.getOwnerElement=function(p){if(p.ownerElement)return p.ownerElement;try{if(p.selectSingleNode)return p.selectSingleNode("..")}catch{}for(var C=p.nodeType==v.DOCUMENT_NODE?p:p.ownerDocument,j=C.getElementsByTagName("*"),ne=0;ne<j.length;ne++)for(var oe=j.item(ne),H=oe.attributes,Ge=0;Ge<H.length;Ge++){var St=H.item(Ge);if(St===p)return oe}return null},Ie.prototype=new Object,Ie.prototype.constructor=Ie,Ie.superclass=Object.prototype;function Ie(p,C){arguments.length>0&&this.init(p,C)}o(Ie,"LocationPath"),Ie.prototype.init=function(p,C){this.absolute=p,this.steps=C},Ie.prototype.toString=function(){return(this.absolute?"/":"")+s(c,this.steps).join("/")},_.prototype=new Object,_.prototype.constructor=_,_.superclass=Object.prototype;function _(p,C,j){arguments.length>0&&this.init(p,C,j)}o(_,"Step"),_.prototype.init=function(p,C,j){this.axis=p,this.nodeTest=C,this.predicates=j},_.prototype.toString=function(){return _.STEPNAMES[this.axis]+"::"+this.nodeTest.toString()+z.predicatesString(this.predicates)},_.ANCESTOR=0,_.ANCESTORORSELF=1,_.ATTRIBUTE=2,_.CHILD=3,_.DESCENDANT=4,_.DESCENDANTORSELF=5,_.FOLLOWING=6,_.FOLLOWINGSIBLING=7,_.NAMESPACE=8,_.PARENT=9,_.PRECEDING=10,_.PRECEDINGSIBLING=11,_.SELF=12,_.STEPNAMES=n(function(p,C){return p[C[0]]=C[1],p},{},[[_.ANCESTOR,"ancestor"],[_.ANCESTORORSELF,"ancestor-or-self"],[_.ATTRIBUTE,"attribute"],[_.CHILD,"child"],[_.DESCENDANT,"descendant"],[_.DESCENDANTORSELF,"descendant-or-self"],[_.FOLLOWING,"following"],[_.FOLLOWINGSIBLING,"following-sibling"],[_.NAMESPACE,"namespace"],[_.PARENT,"parent"],[_.PRECEDING,"preceding"],[_.PRECEDINGSIBLING,"preceding-sibling"],[_.SELF,"self"]]),D.prototype=new Object,D.prototype.constructor=D,D.superclass=Object.prototype;function D(p,C){arguments.length>0&&this.init(p,C)}o(D,"NodeTest"),D.prototype.init=function(p,C){this.type=p,this.value=C},D.prototype.toString=function(){return"<unknown nodetest type>"},D.prototype.matches=function(p,C){console.warn("unknown node test type")},D.NAMETESTANY=0,D.NAMETESTPREFIXANY=1,D.NAMETESTQNAME=2,D.COMMENT=3,D.TEXT=4,D.PI=5,D.NODE=6,D.isNodeType=function(p){return function(C){return a(p,C.nodeType)}},D.makeNodeTestType=function(p,C,j){var ne=j||function(){};return ne.prototype=new D(p),ne.prototype.constructor=ne,m(ne.prototype,C),ne},D.makeNodeTypeTest=function(p,C,j){return new(D.makeNodeTestType(p,{matches:D.isNodeType(C),toString:u(j)}))},D.hasPrefix=function(p){return p.prefix||(p.nodeName||p.tagName).indexOf(":")!==-1},D.isElementOrAttribute=D.isNodeType([1,2]),D.nameSpaceMatches=function(p,C,j){var ne=j.namespaceURI||"";if(!p)return!ne||C.allowAnyNamespaceForNoPrefix&&!D.hasPrefix(j);var oe=C.namespaceResolver.getNamespace(p,C.expressionContextNode);if(oe==null)throw new Error("Cannot resolve QName "+p);return oe===ne},D.localNameMatches=function(p,C,j){var ne=j.localName||j.nodeName;return C.caseInsensitive?p.toLowerCase()===ne.toLowerCase():p===ne},D.NameTestPrefixAny=D.makeNodeTestType(D.NAMETESTPREFIXANY,{matches:o(function(p,C){return D.isElementOrAttribute(p)&&D.nameSpaceMatches(this.prefix,C,p)},"matches"),toString:o(function(){return this.prefix+":*"},"toString")},o(function(C){this.prefix=C},"NameTestPrefixAny")),D.NameTestQName=D.makeNodeTestType(D.NAMETESTQNAME,{matches:o(function(p,C){return D.isNodeType([v.ELEMENT_NODE,v.ATTRIBUTE_NODE,dr.XPATH_NAMESPACE_NODE])(p)&&D.nameSpaceMatches(this.prefix,C,p)&&D.localNameMatches(this.localName,C,p)},"matches"),toString:o(function(){return this.name},"toString")},o(function(C){var j=C.split(":");this.name=C,this.prefix=j.length>1?j[0]:null,this.localName=j[j.length>1?1:0]},"NameTestQName")),D.PITest=D.makeNodeTestType(D.PI,{matches:o(function(p,C){return D.isNodeType([v.PROCESSING_INSTRUCTION_NODE])(p)&&(p.target||p.nodeName)===this.name},"matches"),toString:o(function(){return f('processing-instruction("','")',this.name)},"toString")},function(p){this.name=p}),D.nameTestAny=D.makeNodeTypeTest(D.NAMETESTANY,[v.ELEMENT_NODE,v.ATTRIBUTE_NODE,dr.XPATH_NAMESPACE_NODE],"*"),D.textTest=D.makeNodeTypeTest(D.TEXT,[v.TEXT_NODE,v.CDATA_SECTION_NODE],"text()"),D.commentTest=D.makeNodeTypeTest(D.COMMENT,[v.COMMENT_NODE],"comment()"),D.nodeTest=D.makeNodeTypeTest(D.NODE,[v.ELEMENT_NODE,v.ATTRIBUTE_NODE,v.TEXT_NODE,v.CDATA_SECTION_NODE,v.PROCESSING_INSTRUCTION_NODE,v.COMMENT_NODE,v.DOCUMENT_NODE],"node()"),D.anyPiTest=D.makeNodeTypeTest(D.PI,[v.PROCESSING_INSTRUCTION_NODE],"processing-instruction()"),Y.prototype=new E,Y.prototype.constructor=Y,Y.superclass=E.prototype;function Y(p){arguments.length>0&&this.init(p)}o(Y,"VariableReference"),Y.prototype.init=function(p){this.variable=p},Y.prototype.toString=function(){return"$"+this.variable},Y.prototype.evaluate=function(p){var C=Ke.resolveQName(this.variable,p.namespaceResolver,p.contextNode,!1);if(C[0]==null)throw new Error("Cannot resolve QName "+fn);var j=p.variableResolver.getVariable(C[1],C[0]);if(!j)throw Rs.fromMessage("Undeclared variable: "+this.toString());return j},q.prototype=new E,q.prototype.constructor=q,q.superclass=E.prototype;function q(p,C){arguments.length>0&&this.init(p,C)}o(q,"FunctionCall"),q.prototype.init=function(p,C){this.functionName=p,this.arguments=C},q.prototype.toString=function(){for(var p=this.functionName+"(",C=0;C<this.arguments.length;C++)C>0&&(p+=", "),p+=this.arguments[C].toString();return p+")"},q.prototype.evaluate=function(p){var C=Vr.getFunctionFromContext(this.functionName,p);if(!C)throw new Error("Unknown function "+this.functionName);var j=[p].concat(this.arguments);return C.apply(p.functionResolver.thisArg,j)};var Oe=new Object;Oe.equals=function(p,C){return p.equals(C)},Oe.notequal=function(p,C){return p.notequal(C)},Oe.lessthan=function(p,C){return p.lessthan(C)},Oe.greaterthan=function(p,C){return p.greaterthan(C)},Oe.lessthanorequal=function(p,C){return p.lessthanorequal(C)},Oe.greaterthanorequal=function(p,C){return p.greaterthanorequal(C)},R.prototype=new E,R.prototype.constructor=R,R.superclass=E.prototype;function R(p){arguments.length>0&&this.init(p)}o(R,"XString"),R.prototype.init=function(p){this.str=String(p)},R.prototype.toString=function(){return this.str},R.prototype.evaluate=function(p){return this},R.prototype.string=function(){return this},R.prototype.number=function(){return new N(this.str)},R.prototype.bool=function(){return new Ee(this.str)},R.prototype.nodeset=function(){throw new Error("Cannot convert string to nodeset")},R.prototype.stringValue=function(){return this.str},R.prototype.numberValue=function(){return this.number().numberValue()},R.prototype.booleanValue=function(){return this.bool().booleanValue()},R.prototype.equals=function(p){return Ke.instance_of(p,Ee)?this.bool().equals(p):Ke.instance_of(p,N)?this.number().equals(p):Ke.instance_of(p,ke)?p.compareWithString(this,Oe.equals):new Ee(this.str==p.str)},R.prototype.notequal=function(p){return Ke.instance_of(p,Ee)?this.bool().notequal(p):Ke.instance_of(p,N)?this.number().notequal(p):Ke.instance_of(p,ke)?p.compareWithString(this,Oe.notequal):new Ee(this.str!=p.str)},R.prototype.lessthan=function(p){return this.number().lessthan(p)},R.prototype.greaterthan=function(p){return this.number().greaterthan(p)},R.prototype.lessthanorequal=function(p){return this.number().lessthanorequal(p)},R.prototype.greaterthanorequal=function(p){return this.number().greaterthanorequal(p)},N.prototype=new E,N.prototype.constructor=N,N.superclass=E.prototype;function N(p){arguments.length>0&&this.init(p)}o(N,"XNumber"),N.prototype.init=function(p){this.num=typeof p=="string"?this.parse(p):Number(p)},N.prototype.numberFormat=/^\s*-?[0-9]*\.?[0-9]+\s*$/,N.prototype.parse=function(p){return this.numberFormat.test(p)?parseFloat(p):Number.NaN};function te(p){for(var C=p.split("e-"),j=C[0].replace(".",""),ne=Number(C[1]),oe=0;oe<ne-1;oe+=1)j="0"+j;return"0."+j}o(te,"padSmallNumber");function W(p){for(var C=p.split("e"),j=C[0].replace(".",""),ne=Number(C[1]),oe=ne+1-j.length,H=0;H<oe;H+=1)j+="0";return j}o(W,"padLargeNumber"),N.prototype.toString=function(){var p=this.num.toString();return p.indexOf("e-")!==-1?te(p):p.indexOf("e")!==-1?W(p):p},N.prototype.evaluate=function(p){return this},N.prototype.string=function(){return new R(this.toString())},N.prototype.number=function(){return this},N.prototype.bool=function(){return new Ee(this.num)},N.prototype.nodeset=function(){throw new Error("Cannot convert number to nodeset")},N.prototype.stringValue=function(){return this.string().stringValue()},N.prototype.numberValue=function(){return this.num},N.prototype.booleanValue=function(){return this.bool().booleanValue()},N.prototype.negate=function(){return new N(-this.num)},N.prototype.equals=function(p){return Ke.instance_of(p,Ee)?this.bool().equals(p):Ke.instance_of(p,R)?this.equals(p.number()):Ke.instance_of(p,ke)?p.compareWithNumber(this,Oe.equals):new Ee(this.num==p.num)},N.prototype.notequal=function(p){return Ke.instance_of(p,Ee)?this.bool().notequal(p):Ke.instance_of(p,R)?this.notequal(p.number()):Ke.instance_of(p,ke)?p.compareWithNumber(this,Oe.notequal):new Ee(this.num!=p.num)},N.prototype.lessthan=function(p){return Ke.instance_of(p,ke)?p.compareWithNumber(this,Oe.greaterthan):Ke.instance_of(p,Ee)||Ke.instance_of(p,R)?this.lessthan(p.number()):new Ee(this.num<p.num)},N.prototype.greaterthan=function(p){return Ke.instance_of(p,ke)?p.compareWithNumber(this,Oe.lessthan):Ke.instance_of(p,Ee)||Ke.instance_of(p,R)?this.greaterthan(p.number()):new Ee(this.num>p.num)},N.prototype.lessthanorequal=function(p){return Ke.instance_of(p,ke)?p.compareWithNumber(this,Oe.greaterthanorequal):Ke.instance_of(p,Ee)||Ke.instance_of(p,R)?this.lessthanorequal(p.number()):new Ee(this.num<=p.num)},N.prototype.greaterthanorequal=function(p){return Ke.instance_of(p,ke)?p.compareWithNumber(this,Oe.lessthanorequal):Ke.instance_of(p,Ee)||Ke.instance_of(p,R)?this.greaterthanorequal(p.number()):new Ee(this.num>=p.num)},N.prototype.plus=function(p){return new N(this.num+p.num)},N.prototype.minus=function(p){return new N(this.num-p.num)},N.prototype.multiply=function(p){return new N(this.num*p.num)},N.prototype.div=function(p){return new N(this.num/p.num)},N.prototype.mod=function(p){return new N(this.num%p.num)},Ee.prototype=new E,Ee.prototype.constructor=Ee,Ee.superclass=E.prototype;function Ee(p){arguments.length>0&&this.init(p)}o(Ee,"XBoolean"),Ee.prototype.init=function(p){this.b=!!p},Ee.prototype.toString=function(){return this.b.toString()},Ee.prototype.evaluate=function(p){return this},Ee.prototype.string=function(){return new R(this.b)},Ee.prototype.number=function(){return new N(this.b)},Ee.prototype.bool=function(){return this},Ee.prototype.nodeset=function(){throw new Error("Cannot convert boolean to nodeset")},Ee.prototype.stringValue=function(){return this.string().stringValue()},Ee.prototype.numberValue=function(){return this.number().numberValue()},Ee.prototype.booleanValue=function(){return this.b},Ee.prototype.not=function(){return new Ee(!this.b)},Ee.prototype.equals=function(p){return Ke.instance_of(p,R)||Ke.instance_of(p,N)?this.equals(p.bool()):Ke.instance_of(p,ke)?p.compareWithBoolean(this,Oe.equals):new Ee(this.b==p.b)},Ee.prototype.notequal=function(p){return Ke.instance_of(p,R)||Ke.instance_of(p,N)?this.notequal(p.bool()):Ke.instance_of(p,ke)?p.compareWithBoolean(this,Oe.notequal):new Ee(this.b!=p.b)},Ee.prototype.lessthan=function(p){return this.number().lessthan(p)},Ee.prototype.greaterthan=function(p){return this.number().greaterthan(p)},Ee.prototype.lessthanorequal=function(p){return this.number().lessthanorequal(p)},Ee.prototype.greaterthanorequal=function(p){return this.number().greaterthanorequal(p)},Ee.true_=new Ee(!0),Ee.false_=new Ee(!1),rt.prototype=new Object,rt.prototype.constructor=rt,rt.superclass=Object.prototype;function rt(p){this.init(p)}o(rt,"AVLTree"),rt.prototype.init=function(p){this.left=null,this.right=null,this.node=p,this.depth=1},rt.prototype.balance=function(){var p=this.left==null?0:this.left.depth,C=this.right==null?0:this.right.depth;if(p>C+1){var j=this.left.left==null?0:this.left.left.depth,ne=this.left.right==null?0:this.left.right.depth;j<ne&&this.left.rotateRR(),this.rotateLL()}else if(p+1<C){var oe=this.right.right==null?0:this.right.right.depth,H=this.right.left==null?0:this.right.left.depth;H>oe&&this.right.rotateLL(),this.rotateRR()}},rt.prototype.rotateLL=function(){var p=this.node,C=this.right;this.node=this.left.node,this.right=this.left,this.left=this.left.left,this.right.left=this.right.right,this.right.right=C,this.right.node=p,this.right.updateInNewLocation(),this.updateInNewLocation()},rt.prototype.rotateRR=function(){var p=this.node,C=this.left;this.node=this.right.node,this.left=this.right,this.right=this.right.right,this.left.right=this.left.left,this.left.left=C,this.left.node=p,this.left.updateInNewLocation(),this.updateInNewLocation()},rt.prototype.updateInNewLocation=function(){this.getDepthFromChildren()},rt.prototype.getDepthFromChildren=function(){this.depth=this.node==null?0:1,this.left!=null&&(this.depth=this.left.depth+1),this.right!=null&&this.depth<=this.right.depth&&(this.depth=this.right.depth+1)};function er(p,C){if(p===C)return 0;if(p.compareDocumentPosition){var j=p.compareDocumentPosition(C);return j&1||j&10?1:j&20?-1:0}for(var ne=0,oe=0,H=p;H!=null;H=H.parentNode||H.ownerElement)ne++;for(var Ge=C;Ge!=null;Ge=Ge.parentNode||Ge.ownerElement)oe++;if(ne>oe){for(;ne>oe;)p=p.parentNode||p.ownerElement,ne--;if(p===C)return 1}else if(oe>ne){for(;oe>ne;)C=C.parentNode||C.ownerElement,oe--;if(p===C)return-1}for(var St=p.parentNode||p.ownerElement,Ut=C.parentNode||C.ownerElement;St!==Ut;)p=St,C=Ut,St=p.parentNode||p.ownerElement,Ut=C.parentNode||C.ownerElement;var $e=Ke.isAttribute(p),yt=Ke.isAttribute(C);if($e&&!yt)return-1;if(!$e&&yt)return 1;if(St)for(var Wn=$e?St.attributes:St.childNodes,Xi=Wn.length,ar=0;ar<Xi;ar+=1){var Mo=Wn[ar];if(Mo===p)return-1;if(Mo===C)return 1}throw new Error("Unexpected: could not determine node order")}o(er,"nodeOrder"),rt.prototype.add=function(p){if(p===this.node)return!1;var C=er(p,this.node),j=!1;return C==-1?this.left==null?(this.left=new rt(p),j=!0):(j=this.left.add(p),j&&this.balance()):C==1&&(this.right==null?(this.right=new rt(p),j=!0):(j=this.right.add(p),j&&this.balance())),j&&this.getDepthFromChildren(),j},ke.prototype=new E,ke.prototype.constructor=ke,ke.superclass=E.prototype;function ke(){this.init()}o(ke,"XNodeSet"),ke.prototype.init=function(){this.tree=null,this.nodes=[],this.size=0},ke.prototype.toString=function(){var p=this.first();return p==null?"":this.stringForNode(p)},ke.prototype.evaluate=function(p){return this},ke.prototype.string=function(){return new R(this.toString())},ke.prototype.stringValue=function(){return this.toString()},ke.prototype.number=function(){return new N(this.string())},ke.prototype.numberValue=function(){return Number(this.string())},ke.prototype.bool=function(){return new Ee(this.booleanValue())},ke.prototype.booleanValue=function(){return!!this.size},ke.prototype.nodeset=function(){return this},ke.prototype.stringForNode=function(p){return p.nodeType==v.DOCUMENT_NODE||p.nodeType==v.ELEMENT_NODE||p.nodeType===v.DOCUMENT_FRAGMENT_NODE?this.stringForContainerNode(p):p.nodeType===v.ATTRIBUTE_NODE?p.value||p.nodeValue:p.isNamespaceNode?p.namespace:p.nodeValue},ke.prototype.stringForContainerNode=function(p){for(var C="",j=p.firstChild;j!=null;j=j.nextSibling){var ne=j.nodeType;(ne===1||ne===3||ne===4||ne===9||ne===11)&&(C+=this.stringForNode(j))}return C},ke.prototype.buildTree=function(){if(!this.tree&&this.nodes.length){this.tree=new rt(this.nodes[0]);for(var p=1;p<this.nodes.length;p+=1)this.tree.add(this.nodes[p])}return this.tree},ke.prototype.first=function(){var p=this.buildTree();if(p==null)return null;for(;p.left!=null;)p=p.left;return p.node},ke.prototype.add=function(p){for(var C=0;C<this.nodes.length;C+=1)if(p===this.nodes[C])return;this.tree=null,this.nodes.push(p),this.size+=1},ke.prototype.addArray=function(p){var C=this;t(function(j){C.add(j)},p)},ke.prototype.toArray=function(){var p=[];return this.toArrayRec(this.buildTree(),p),p},ke.prototype.toArrayRec=function(p,C){p!=null&&(this.toArrayRec(p.left,C),C.push(p.node),this.toArrayRec(p.right,C))},ke.prototype.toUnsortedArray=function(){return this.nodes.slice()},ke.prototype.compareWithString=function(p,C){for(var j=this.toUnsortedArray(),ne=0;ne<j.length;ne++){var oe=j[ne],H=new R(this.stringForNode(oe)),Ge=C(H,p);if(Ge.booleanValue())return Ge}return new Ee(!1)},ke.prototype.compareWithNumber=function(p,C){for(var j=this.toUnsortedArray(),ne=0;ne<j.length;ne++){var oe=j[ne],H=new N(this.stringForNode(oe)),Ge=C(H,p);if(Ge.booleanValue())return Ge}return new Ee(!1)},ke.prototype.compareWithBoolean=function(p,C){return C(this.bool(),p)},ke.prototype.compareWithNodeSet=function(p,C){for(var j=this.toUnsortedArray(),ne=o(function(St,Ut){return C(Ut,St)},"oInvert"),oe=0;oe<j.length;oe++){var H=new R(this.stringForNode(j[oe])),Ge=p.compareWithString(H,ne);if(Ge.booleanValue())return Ge}return new Ee(!1)},ke.compareWith=e(function(p,C){return Ke.instance_of(C,R)?this.compareWithString(C,p):Ke.instance_of(C,N)?this.compareWithNumber(C,p):Ke.instance_of(C,Ee)?this.compareWithBoolean(C,p):this.compareWithNodeSet(C,p)}),ke.prototype.equals=ke.compareWith(Oe.equals),ke.prototype.notequal=ke.compareWith(Oe.notequal),ke.prototype.lessthan=ke.compareWith(Oe.lessthan),ke.prototype.greaterthan=ke.compareWith(Oe.greaterthan),ke.prototype.lessthanorequal=ke.compareWith(Oe.lessthanorequal),ke.prototype.greaterthanorequal=ke.compareWith(Oe.greaterthanorequal),ke.prototype.union=function(p){var C=new ke;return C.addArray(this.toUnsortedArray()),C.addArray(p.toUnsortedArray()),C},dr.prototype=new Object,dr.prototype.constructor=dr,dr.superclass=Object.prototype;function dr(p,C,j){this.isXPathNamespace=!0,this.ownerDocument=j.ownerDocument,this.nodeName="#namespace",this.prefix=p,this.localName=p,this.namespaceURI=C,this.nodeValue=C,this.ownerElement=j,this.nodeType=dr.XPATH_NAMESPACE_NODE}o(dr,"XPathNamespace"),dr.prototype.toString=function(){return'{ "'+this.prefix+'", "'+this.namespaceURI+'" }'},Ir.prototype=new Object,Ir.prototype.constructor=Ir,Ir.superclass=Object.prototype;function Ir(p,C,j){this.variableResolver=p??new ir,this.namespaceResolver=C??new wi,this.functionResolver=j??new Vr}o(Ir,"XPathContext"),Ir.prototype.extend=function(p){return m(new Ir,this,p)},ir.prototype=new Object,ir.prototype.constructor=ir,ir.superclass=Object.prototype;function ir(){}o(ir,"VariableResolver"),ir.prototype.getVariable=function(p,C){return null},Vr.prototype=new Object,Vr.prototype.constructor=Vr,Vr.superclass=Object.prototype;function Vr(p){this.thisArg=p??Qe,this.functions=new Object,this.addStandardFunctions()}o(Vr,"FunctionResolver"),Vr.prototype.addStandardFunctions=function(){this.functions["{}last"]=Qe.last,this.functions["{}position"]=Qe.position,this.functions["{}count"]=Qe.count,this.functions["{}id"]=Qe.id,this.functions["{}local-name"]=Qe.localName,this.functions["{}namespace-uri"]=Qe.namespaceURI,this.functions["{}name"]=Qe.name,this.functions["{}string"]=Qe.string,this.functions["{}concat"]=Qe.concat,this.functions["{}starts-with"]=Qe.startsWith,this.functions["{}contains"]=Qe.contains,this.functions["{}substring-before"]=Qe.substringBefore,this.functions["{}substring-after"]=Qe.substringAfter,this.functions["{}substring"]=Qe.substring,this.functions["{}string-length"]=Qe.stringLength,this.functions["{}normalize-space"]=Qe.normalizeSpace,this.functions["{}translate"]=Qe.translate,this.functions["{}boolean"]=Qe.boolean_,this.functions["{}not"]=Qe.not,this.functions["{}true"]=Qe.true_,this.functions["{}false"]=Qe.false_,this.functions["{}lang"]=Qe.lang,this.functions["{}number"]=Qe.number,this.functions["{}sum"]=Qe.sum,this.functions["{}floor"]=Qe.floor,this.functions["{}ceiling"]=Qe.ceiling,this.functions["{}round"]=Qe.round},Vr.prototype.addFunction=function(p,C,j){this.functions["{"+p+"}"+C]=j},Vr.getFunctionFromContext=function(p,C){var j=Ke.resolveQName(p,C.namespaceResolver,C.contextNode,!1);if(j[0]===null)throw new Error("Cannot resolve QName "+name);return C.functionResolver.getFunction(j[1],j[0])},Vr.prototype.getFunction=function(p,C){return this.functions["{"+C+"}"+p]},wi.prototype=new Object,wi.prototype.constructor=wi,wi.superclass=Object.prototype;function wi(){}o(wi,"NamespaceResolver"),wi.prototype.getNamespace=function(p,C){if(p=="xml")return w.XML_NAMESPACE_URI;if(p=="xmlns")return w.XMLNS_NAMESPACE_URI;for(C.nodeType==v.DOCUMENT_NODE?C=C.documentElement:C.nodeType==v.ATTRIBUTE_NODE?C=z.getOwnerElement(C):C.nodeType!=v.ELEMENT_NODE&&(C=C.parentNode);C!=null&&C.nodeType==v.ELEMENT_NODE;){for(var j=C.attributes,ne=0;ne<j.length;ne++){var oe=j.item(ne),H=oe.name||oe.nodeName;if(H==="xmlns"&&p===""||H==="xmlns:"+p)return String(oe.value||oe.nodeValue)}C=C.parentNode}return null};var Qe=new Object;Qe.last=function(p){if(arguments.length!=1)throw new Error("Function last expects ()");return new N(p.contextSize)},Qe.position=function(p){if(arguments.length!=1)throw new Error("Function position expects ()");return new N(p.contextPosition)},Qe.count=function(){var p=arguments[0],C;if(arguments.length!=2||!Ke.instance_of(C=arguments[1].evaluate(p),ke))throw new Error("Function count expects (node-set)");return new N(C.size)},Qe.id=function(){var p=arguments[0],C;if(arguments.length!=2)throw new Error("Function id expects (object)");C=arguments[1].evaluate(p),Ke.instance_of(C,ke)?C=C.toArray().join(" "):C=C.stringValue();for(var j=C.split(/[\x0d\x0a\x09\x20]+/),ne=0,oe=new ke,H=p.contextNode.nodeType==v.DOCUMENT_NODE?p.contextNode:p.contextNode.ownerDocument,Ge=0;Ge<j.length;Ge++){var St;H.getElementById?St=H.getElementById(j[Ge]):St=Ke.getElementById(H,j[Ge]),St!=null&&(oe.add(St),ne++)}return oe},Qe.localName=function(p,C){var j;if(arguments.length==1)j=p.contextNode;else if(arguments.length==2)j=C.evaluate(p).first();else throw new Error("Function local-name expects (node-set?)");return j==null?new R(""):new R(j.localName||j.baseName||j.target||j.nodeName||"")},Qe.namespaceURI=function(){var p=arguments[0],C;if(arguments.length==1)C=p.contextNode;else if(arguments.length==2)C=arguments[1].evaluate(p).first();else throw new Error("Function namespace-uri expects (node-set?)");return C==null?new R(""):new R(C.namespaceURI)},Qe.name=function(){var p=arguments[0],C;if(arguments.length==1)C=p.contextNode;else if(arguments.length==2)C=arguments[1].evaluate(p).first();else throw new Error("Function name expects (node-set?)");return C==null?new R(""):C.nodeType==v.ELEMENT_NODE?new R(C.nodeName):C.nodeType==v.ATTRIBUTE_NODE?new R(C.name||C.nodeName):C.nodeType===v.PROCESSING_INSTRUCTION_NODE?new R(C.target||C.nodeName):C.localName==null?new R(""):new R(C.localName)},Qe.string=function(){var p=arguments[0];if(arguments.length==1)return new R(ke.prototype.stringForNode(p.contextNode));if(arguments.length==2)return arguments[1].evaluate(p).string();throw new Error("Function string expects (object?)")},Qe.concat=function(p){if(arguments.length<3)throw new Error("Function concat expects (string, string[, string]*)");for(var C="",j=1;j<arguments.length;j++)C+=arguments[j].evaluate(p).stringValue();return new R(C)},Qe.startsWith=function(){var p=arguments[0];if(arguments.length!=3)throw new Error("Function startsWith expects (string, string)");var C=arguments[1].evaluate(p).stringValue(),j=arguments[2].evaluate(p).stringValue();return new Ee(C.substring(0,j.length)==j)},Qe.contains=function(){var p=arguments[0];if(arguments.length!=3)throw new Error("Function contains expects (string, string)");var C=arguments[1].evaluate(p).stringValue(),j=arguments[2].evaluate(p).stringValue();return new Ee(C.indexOf(j)!==-1)},Qe.substringBefore=function(){var p=arguments[0];if(arguments.length!=3)throw new Error("Function substring-before expects (string, string)");var C=arguments[1].evaluate(p).stringValue(),j=arguments[2].evaluate(p).stringValue();return new R(C.substring(0,C.indexOf(j)))},Qe.substringAfter=function(){var p=arguments[0];if(arguments.length!=3)throw new Error("Function substring-after expects (string, string)");var C=arguments[1].evaluate(p).stringValue(),j=arguments[2].evaluate(p).stringValue();if(j.length==0)return new R(C);var ne=C.indexOf(j);return ne==-1?new R(""):new R(C.substring(ne+j.length))},Qe.substring=function(){var p=arguments[0];if(!(arguments.length==3||arguments.length==4))throw new Error("Function substring expects (string, number, number?)");var C=arguments[1].evaluate(p).stringValue(),j=Math.round(arguments[2].evaluate(p).numberValue())-1,ne=arguments.length==4?j+Math.round(arguments[3].evaluate(p).numberValue()):void 0;return new R(C.substring(j,ne))},Qe.stringLength=function(){var p=arguments[0],C;if(arguments.length==1)C=ke.prototype.stringForNode(p.contextNode);else if(arguments.length==2)C=arguments[1].evaluate(p).stringValue();else throw new Error("Function string-length expects (string?)");return new N(C.length)},Qe.normalizeSpace=function(){var p=arguments[0],C;if(arguments.length==1)C=ke.prototype.stringForNode(p.contextNode);else if(arguments.length==2)C=arguments[1].evaluate(p).stringValue();else throw new Error("Function normalize-space expects (string?)");for(var j=0,ne=C.length-1;Ke.isSpace(C.charCodeAt(ne));)ne--;for(var oe="";j<=ne&&Ke.isSpace(C.charCodeAt(j));)j++;for(;j<=ne;)if(Ke.isSpace(C.charCodeAt(j)))for(oe+=" ";j<=ne&&Ke.isSpace(C.charCodeAt(j));)j++;else oe+=C.charAt(j),j++;return new R(oe)},Qe.translate=function(p,C,j,ne){if(arguments.length!=4)throw new Error("Function translate expects (string, string, string)");var oe=C.evaluate(p).stringValue(),H=j.evaluate(p).stringValue(),Ge=ne.evaluate(p).stringValue(),St=n(function($e,yt,Wn){return yt in $e||($e[yt]=Wn>Ge.length?"":Ge[Wn]),$e},{},H),Ut=l("",s(function($e){return $e in St?St[$e]:$e},oe));return new R(Ut)},Qe.boolean_=function(){var p=arguments[0];if(arguments.length!=2)throw new Error("Function boolean expects (object)");return arguments[1].evaluate(p).bool()},Qe.not=function(p,C){if(arguments.length!=2)throw new Error("Function not expects (object)");return C.evaluate(p).bool().not()},Qe.true_=function(){if(arguments.length!=1)throw new Error("Function true expects ()");return Ee.true_},Qe.false_=function(){if(arguments.length!=1)throw new Error("Function false expects ()");return Ee.false_},Qe.lang=function(){var p=arguments[0];if(arguments.length!=2)throw new Error("Function lang expects (string)");for(var C,j=p.contextNode;j!=null&&j.nodeType!=v.DOCUMENT_NODE;j=j.parentNode){var ne=j.getAttributeNS(w.XML_NAMESPACE_URI,"lang");if(ne!=null){C=String(ne);break}}if(C==null)return Ee.false_;var oe=arguments[1].evaluate(p).stringValue();return new Ee(C.substring(0,oe.length)==oe&&(C.length==oe.length||C.charAt(oe.length)=="-"))},Qe.number=function(){var p=arguments[0];if(!(arguments.length==1||arguments.length==2))throw new Error("Function number expects (object?)");return arguments.length==1?new N(ke.prototype.stringForNode(p.contextNode)):arguments[1].evaluate(p).number()},Qe.sum=function(){var p=arguments[0],C;if(arguments.length!=2||!Ke.instance_of(C=arguments[1].evaluate(p),ke))throw new Error("Function sum expects (node-set)");C=C.toUnsortedArray();for(var j=0,ne=0;ne<C.length;ne++)j+=new N(ke.prototype.stringForNode(C[ne])).numberValue();return new N(j)},Qe.floor=function(){var p=arguments[0];if(arguments.length!=2)throw new Error("Function floor expects (number)");return new N(Math.floor(arguments[1].evaluate(p).numberValue()))},Qe.ceiling=function(){var p=arguments[0];if(arguments.length!=2)throw new Error("Function ceiling expects (number)");return new N(Math.ceil(arguments[1].evaluate(p).numberValue()))},Qe.round=function(){var p=arguments[0];if(arguments.length!=2)throw new Error("Function round expects (number)");return new N(Math.round(arguments[1].evaluate(p).numberValue()))};var Ke=new Object;Ke.isAttribute=function(p){return p&&(p.nodeType===v.ATTRIBUTE_NODE||p.ownerElement)},Ke.splitQName=function(p){var C=p.indexOf(":");return C==-1?[null,p]:[p.substring(0,C),p.substring(C+1)]},Ke.resolveQName=function(p,C,j,ne){var oe=Ke.splitQName(p);return oe[0]!=null?oe[0]=C.getNamespace(oe[0],j):ne?(oe[0]=C.getNamespace("",j),oe[0]==null&&(oe[0]="")):oe[0]="",oe},Ke.isSpace=function(p){return p==9||p==13||p==10||p==32},Ke.isLetter=function(p){return p>=65&&p<=90||p>=97&&p<=122||p>=192&&p<=214||p>=216&&p<=246||p>=248&&p<=255||p>=256&&p<=305||p>=308&&p<=318||p>=321&&p<=328||p>=330&&p<=382||p>=384&&p<=451||p>=461&&p<=496||p>=500&&p<=501||p>=506&&p<=535||p>=592&&p<=680||p>=699&&p<=705||p==902||p>=904&&p<=906||p==908||p>=910&&p<=929||p>=931&&p<=974||p>=976&&p<=982||p==986||p==988||p==990||p==992||p>=994&&p<=1011||p>=1025&&p<=1036||p>=1038&&p<=1103||p>=1105&&p<=1116||p>=1118&&p<=1153||p>=1168&&p<=1220||p>=1223&&p<=1224||p>=1227&&p<=1228||p>=1232&&p<=1259||p>=1262&&p<=1269||p>=1272&&p<=1273||p>=1329&&p<=1366||p==1369||p>=1377&&p<=1414||p>=1488&&p<=1514||p>=1520&&p<=1522||p>=1569&&p<=1594||p>=1601&&p<=1610||p>=1649&&p<=1719||p>=1722&&p<=1726||p>=1728&&p<=1742||p>=1744&&p<=1747||p==1749||p>=1765&&p<=1766||p>=2309&&p<=2361||p==2365||p>=2392&&p<=2401||p>=2437&&p<=2444||p>=2447&&p<=2448||p>=2451&&p<=2472||p>=2474&&p<=2480||p==2482||p>=2486&&p<=2489||p>=2524&&p<=2525||p>=2527&&p<=2529||p>=2544&&p<=2545||p>=2565&&p<=2570||p>=2575&&p<=2576||p>=2579&&p<=2600||p>=2602&&p<=2608||p>=2610&&p<=2611||p>=2613&&p<=2614||p>=2616&&p<=2617||p>=2649&&p<=2652||p==2654||p>=2674&&p<=2676||p>=2693&&p<=2699||p==2701||p>=2703&&p<=2705||p>=2707&&p<=2728||p>=2730&&p<=2736||p>=2738&&p<=2739||p>=2741&&p<=2745||p==2749||p==2784||p>=2821&&p<=2828||p>=2831&&p<=2832||p>=2835&&p<=2856||p>=2858&&p<=2864||p>=2866&&p<=2867||p>=2870&&p<=2873||p==2877||p>=2908&&p<=2909||p>=2911&&p<=2913||p>=2949&&p<=2954||p>=2958&&p<=2960||p>=2962&&p<=2965||p>=2969&&p<=2970||p==2972||p>=2974&&p<=2975||p>=2979&&p<=2980||p>=2984&&p<=2986||p>=2990&&p<=2997||p>=2999&&p<=3001||p>=3077&&p<=3084||p>=3086&&p<=3088||p>=3090&&p<=3112||p>=3114&&p<=3123||p>=3125&&p<=3129||p>=3168&&p<=3169||p>=3205&&p<=3212||p>=3214&&p<=3216||p>=3218&&p<=3240||p>=3242&&p<=3251||p>=3253&&p<=3257||p==3294||p>=3296&&p<=3297||p>=3333&&p<=3340||p>=3342&&p<=3344||p>=3346&&p<=3368||p>=3370&&p<=3385||p>=3424&&p<=3425||p>=3585&&p<=3630||p==3632||p>=3634&&p<=3635||p>=3648&&p<=3653||p>=3713&&p<=3714||p==3716||p>=3719&&p<=3720||p==3722||p==3725||p>=3732&&p<=3735||p>=3737&&p<=3743||p>=3745&&p<=3747||p==3749||p==3751||p>=3754&&p<=3755||p>=3757&&p<=3758||p==3760||p>=3762&&p<=3763||p==3773||p>=3776&&p<=3780||p>=3904&&p<=3911||p>=3913&&p<=3945||p>=4256&&p<=4293||p>=4304&&p<=4342||p==4352||p>=4354&&p<=4355||p>=4357&&p<=4359||p==4361||p>=4363&&p<=4364||p>=4366&&p<=4370||p==4412||p==4414||p==4416||p==4428||p==4430||p==4432||p>=4436&&p<=4437||p==4441||p>=4447&&p<=4449||p==4451||p==4453||p==4455||p==4457||p>=4461&&p<=4462||p>=4466&&p<=4467||p==4469||p==4510||p==4520||p==4523||p>=4526&&p<=4527||p>=4535&&p<=4536||p==4538||p>=4540&&p<=4546||p==4587||p==4592||p==4601||p>=7680&&p<=7835||p>=7840&&p<=7929||p>=7936&&p<=7957||p>=7960&&p<=7965||p>=7968&&p<=8005||p>=8008&&p<=8013||p>=8016&&p<=8023||p==8025||p==8027||p==8029||p>=8031&&p<=8061||p>=8064&&p<=8116||p>=8118&&p<=8124||p==8126||p>=8130&&p<=8132||p>=8134&&p<=8140||p>=8144&&p<=8147||p>=8150&&p<=8155||p>=8160&&p<=8172||p>=8178&&p<=8180||p>=8182&&p<=8188||p==8486||p>=8490&&p<=8491||p==8494||p>=8576&&p<=8578||p>=12353&&p<=12436||p>=12449&&p<=12538||p>=12549&&p<=12588||p>=44032&&p<=55203||p>=19968&&p<=40869||p==12295||p>=12321&&p<=12329},Ke.isNCNameChar=function(p){return p>=48&&p<=57||p>=1632&&p<=1641||p>=1776&&p<=1785||p>=2406&&p<=2415||p>=2534&&p<=2543||p>=2662&&p<=2671||p>=2790&&p<=2799||p>=2918&&p<=2927||p>=3047&&p<=3055||p>=3174&&p<=3183||p>=3302&&p<=3311||p>=3430&&p<=3439||p>=3664&&p<=3673||p>=3792&&p<=3801||p>=3872&&p<=3881||p==46||p==45||p==95||Ke.isLetter(p)||p>=768&&p<=837||p>=864&&p<=865||p>=1155&&p<=1158||p>=1425&&p<=1441||p>=1443&&p<=1465||p>=1467&&p<=1469||p==1471||p>=1473&&p<=1474||p==1476||p>=1611&&p<=1618||p==1648||p>=1750&&p<=1756||p>=1757&&p<=1759||p>=1760&&p<=1764||p>=1767&&p<=1768||p>=1770&&p<=1773||p>=2305&&p<=2307||p==2364||p>=2366&&p<=2380||p==2381||p>=2385&&p<=2388||p>=2402&&p<=2403||p>=2433&&p<=2435||p==2492||p==2494||p==2495||p>=2496&&p<=2500||p>=2503&&p<=2504||p>=2507&&p<=2509||p==2519||p>=2530&&p<=2531||p==2562||p==2620||p==2622||p==2623||p>=2624&&p<=2626||p>=2631&&p<=2632||p>=2635&&p<=2637||p>=2672&&p<=2673||p>=2689&&p<=2691||p==2748||p>=2750&&p<=2757||p>=2759&&p<=2761||p>=2763&&p<=2765||p>=2817&&p<=2819||p==2876||p>=2878&&p<=2883||p>=2887&&p<=2888||p>=2891&&p<=2893||p>=2902&&p<=2903||p>=2946&&p<=2947||p>=3006&&p<=3010||p>=3014&&p<=3016||p>=3018&&p<=3021||p==3031||p>=3073&&p<=3075||p>=3134&&p<=3140||p>=3142&&p<=3144||p>=3146&&p<=3149||p>=3157&&p<=3158||p>=3202&&p<=3203||p>=3262&&p<=3268||p>=3270&&p<=3272||p>=3274&&p<=3277||p>=3285&&p<=3286||p>=3330&&p<=3331||p>=3390&&p<=3395||p>=3398&&p<=3400||p>=3402&&p<=3405||p==3415||p==3633||p>=3636&&p<=3642||p>=3655&&p<=3662||p==3761||p>=3764&&p<=3769||p>=3771&&p<=3772||p>=3784&&p<=3789||p>=3864&&p<=3865||p==3893||p==3895||p==3897||p==3902||p==3903||p>=3953&&p<=3972||p>=3974&&p<=3979||p>=3984&&p<=3989||p==3991||p>=3993&&p<=4013||p>=4017&&p<=4023||p==4025||p>=8400&&p<=8412||p==8417||p>=12330&&p<=12335||p==12441||p==12442||p==183||p==720||p==721||p==903||p==1600||p==3654||p==3782||p==12293||p>=12337&&p<=12341||p>=12445&&p<=12446||p>=12540&&p<=12542},Ke.coalesceText=function(p){for(var C=p.firstChild;C!=null;C=C.nextSibling)if(C.nodeType==v.TEXT_NODE||C.nodeType==v.CDATA_SECTION_NODE){var j=C.nodeValue,ne=C;for(C=C.nextSibling;C!=null&&(C.nodeType==v.TEXT_NODE||C.nodeType==v.CDATA_SECTION_NODE);){j+=C.nodeValue;var oe=C;C=C.nextSibling,oe.parentNode.removeChild(oe)}if(ne.nodeType==v.CDATA_SECTION_NODE){var H=ne.parentNode;if(ne.nextSibling==null)H.removeChild(ne),H.appendChild(H.ownerDocument.createTextNode(j));else{var Ge=ne.nextSibling;H.removeChild(ne),H.insertBefore(H.ownerDocument.createTextNode(j),Ge)}}else ne.nodeValue=j;if(C==null)break}else C.nodeType==v.ELEMENT_NODE&&Ke.coalesceText(C)},Ke.instance_of=function(p,C){for(;p!=null;){if(p.constructor===C)return!0;if(p===Object)return!1;p=p.constructor.superclass}return!1},Ke.getElementById=function(p,C){if(p.nodeType==v.ELEMENT_NODE&&(p.getAttribute("id")==C||p.getAttributeNS(null,"id")==C))return p;for(var j=p.firstChild;j!=null;j=j.nextSibling){var ne=Ke.getElementById(j,C);if(ne!=null)return ne}return null};var Rs=(function(){function p(j,ne){var oe=ne?": "+ne.toString():"";switch(j){case C.INVALID_EXPRESSION_ERR:return"Invalid expression"+oe;case C.TYPE_ERR:return"Type error"+oe}return null}o(p,"getMessage");function C(j,ne,oe){var H=Error.call(this,p(j,ne)||oe);return H.code=j,H.exception=ne,H}return o(C,"XPathException"),C.prototype=Object.create(Error.prototype),C.prototype.constructor=C,C.superclass=Error,C.prototype.toString=function(){return this.message},C.fromMessage=function(j,ne){return new C(null,ne,j)},C.INVALID_EXPRESSION_ERR=51,C.TYPE_ERR=52,C})();bi.prototype={},bi.prototype.constructor=bi,bi.superclass=Object.prototype;function bi(p,C,j){this.xpath=j.parse(p),this.context=new Ir,this.context.namespaceResolver=new dh(C)}o(bi,"XPathExpression"),bi.getOwnerDocument=function(p){return p.nodeType===v.DOCUMENT_NODE?p:p.ownerDocument},bi.detectHtmlDom=function(p){if(!p)return!1;var C=bi.getOwnerDocument(p);try{return C.implementation.hasFeature("HTML","2.0")}catch{return!0}},bi.prototype.evaluate=function(p,C,j){this.context.expressionContextNode=p,this.context.caseInsensitive=bi.detectHtmlDom(p);var ne=this.xpath.evaluate(this.context);return new Tt(ne,C)},dh.prototype={},dh.prototype.constructor=dh,dh.superclass=Object.prototype;function dh(p){this.xpathNSResolver=p}o(dh,"XPathNSResolverWrapper"),dh.prototype.getNamespace=function(p,C){return this.xpathNSResolver==null?null:this.xpathNSResolver.lookupNamespaceURI(p)},mh.prototype={},mh.prototype.constructor=mh,mh.superclass=Object.prototype;function mh(p){this.node=p,this.namespaceResolver=new wi}o(mh,"NodeXPathNSResolver"),mh.prototype.lookupNamespaceURI=function(p){return this.namespaceResolver.getNamespace(p,this.node)},Tt.prototype={},Tt.prototype.constructor=Tt,Tt.superclass=Object.prototype;function Tt(p,C){switch(C==Tt.ANY_TYPE&&(p.constructor===R?C=Tt.STRING_TYPE:p.constructor===N?C=Tt.NUMBER_TYPE:p.constructor===Ee?C=Tt.BOOLEAN_TYPE:p.constructor===ke&&(C=Tt.UNORDERED_NODE_ITERATOR_TYPE)),this.resultType=C,C){case Tt.NUMBER_TYPE:this.numberValue=p.numberValue();return;case Tt.STRING_TYPE:this.stringValue=p.stringValue();return;case Tt.BOOLEAN_TYPE:this.booleanValue=p.booleanValue();return;case Tt.ANY_UNORDERED_NODE_TYPE:case Tt.FIRST_ORDERED_NODE_TYPE:if(p.constructor===ke){this.singleNodeValue=p.first();return}break;case Tt.UNORDERED_NODE_ITERATOR_TYPE:case Tt.ORDERED_NODE_ITERATOR_TYPE:if(p.constructor===ke){this.invalidIteratorState=!1,this.nodes=p.toArray(),this.iteratorIndex=0;return}break;case Tt.UNORDERED_NODE_SNAPSHOT_TYPE:case Tt.ORDERED_NODE_SNAPSHOT_TYPE:if(p.constructor===ke){this.nodes=p.toArray(),this.snapshotLength=this.nodes.length;return}break}throw new Rs(Rs.TYPE_ERR)}o(Tt,"XPathResult"),Tt.prototype.iterateNext=function(){if(this.resultType!=Tt.UNORDERED_NODE_ITERATOR_TYPE&&this.resultType!=Tt.ORDERED_NODE_ITERATOR_TYPE)throw new Rs(Rs.TYPE_ERR);return this.nodes[this.iteratorIndex++]},Tt.prototype.snapshotItem=function(p){if(this.resultType!=Tt.UNORDERED_NODE_SNAPSHOT_TYPE&&this.resultType!=Tt.ORDERED_NODE_SNAPSHOT_TYPE)throw new Rs(Rs.TYPE_ERR);return this.nodes[p]},Tt.ANY_TYPE=0,Tt.NUMBER_TYPE=1,Tt.STRING_TYPE=2,Tt.BOOLEAN_TYPE=3,Tt.UNORDERED_NODE_ITERATOR_TYPE=4,Tt.ORDERED_NODE_ITERATOR_TYPE=5,Tt.UNORDERED_NODE_SNAPSHOT_TYPE=6,Tt.ORDERED_NODE_SNAPSHOT_TYPE=7,Tt.ANY_UNORDERED_NODE_TYPE=8,Tt.FIRST_ORDERED_NODE_TYPE=9;function XO(p,C){p.createExpression=function(j,ne){try{return new bi(j,ne,C)}catch(oe){throw new Rs(Rs.INVALID_EXPRESSION_ERR,oe)}},p.createNSResolver=function(j){return new mh(j)},p.evaluate=function(j,ne,oe,H,Ge){if(H<0||H>9)throw{code:0,toString:o(function(){return"Request type not supported"},"toString")};return p.createExpression(j,oe,C).evaluate(ne,H,Ge)}}o(XO,"installDOM3XPathSupport");try{var GO=!0;try{document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("XPath",null)&&(GO=!1)}catch{}GO&&XO(document,new y)}catch{}XO(r,new y),(function(){var p=new y,C=new wi,j=new Vr,ne=new ir;function oe(Ue){return{getNamespace:o(function(Vt,ss){var jo=Ue(Vt,ss);return jo||C.getNamespace(Vt,ss)},"getNamespace")}}o(oe,"makeNSResolverFromFunction");function H(Ue){return oe(Ue.getNamespace.bind(Ue))}o(H,"makeNSResolverFromObject");function Ge(Ue){return oe(function(Vt){return Ue[Vt]})}o(Ge,"makeNSResolverFromMap");function St(Ue){return Ue&&typeof Ue.getNamespace=="function"?H(Ue):typeof Ue=="function"?oe(Ue):typeof Ue=="object"?Ge(Ue):C}o(St,"makeNSResolver");function Ut(Ue){if(Ue===null||typeof Ue>"u"||Ue instanceof R||Ue instanceof Ee||Ue instanceof N||Ue instanceof ke)return Ue;switch(typeof Ue){case"string":return new R(Ue);case"boolean":return new Ee(Ue);case"number":return new N(Ue)}var Vt=new ke;return Vt.addArray([].concat(Ue)),Vt}o(Ut,"convertValue");function $e(Ue){return function(Vt){var ss=Array.prototype.slice.call(arguments,1).map(function(qK){return qK.evaluate(Vt)}),jo=Ue.apply(this,[].concat(Vt,ss));return Ut(jo)}}o($e,"makeEvaluator");function yt(Ue){return{getFunction:o(function(Vt,ss){var jo=Ue(Vt,ss);return jo?$e(jo):j.getFunction(Vt,ss)},"getFunction")}}o(yt,"makeFunctionResolverFromFunction");function Wn(Ue){return yt(Ue.getFunction.bind(Ue))}o(Wn,"makeFunctionResolverFromObject");function Xi(Ue){return yt(function(Vt){return Ue[Vt]})}o(Xi,"makeFunctionResolverFromMap");function ar(Ue){return Ue&&typeof Ue.getFunction=="function"?Wn(Ue):typeof Ue=="function"?yt(Ue):typeof Ue=="object"?Xi(Ue):j}o(ar,"makeFunctionResolver");function Mo(Ue){return{getVariable:o(function(Vt,ss){var jo=Ue(Vt,ss);return Ut(jo)},"getVariable")}}o(Mo,"makeVariableResolverFromFunction");function FK(Ue){if(Ue){if(typeof Ue.getVariable=="function")return Mo(Ue.getVariable.bind(Ue));if(typeof Ue=="function")return Mo(Ue);if(typeof Ue=="object")return Mo(function(Vt){return Ue[Vt]})}return ne}o(FK,"makeVariableResolver");function zO(Ue,Vt,ss){Ue in ss&&(Vt[Ue]=ss[Ue])}o(zO,"copyIfPresent");function UK(Ue){var Vt=new Ir;return Ue?(Vt.namespaceResolver=St(Ue.namespaces),Vt.functionResolver=ar(Ue.functions),Vt.variableResolver=FK(Ue.variables),Vt.expressionContextNode=Ue.node,zO("allowAnyNamespaceForNoPrefix",Vt,Ue),zO("isHtml",Vt,Ue)):Vt.namespaceResolver=C,Vt}o(UK,"makeContext");function VK(Ue,Vt){var ss=UK(Vt);return Ue.evaluate(ss)}o(VK,"evaluate");var MK={evaluate:o(function(Ue){return VK(this.expression,Ue)},"evaluate"),evaluateNumber:o(function(Ue){return this.evaluate(Ue).numberValue()},"evaluateNumber"),evaluateString:o(function(Ue){return this.evaluate(Ue).stringValue()},"evaluateString"),evaluateBoolean:o(function(Ue){return this.evaluate(Ue).booleanValue()},"evaluateBoolean"),evaluateNodeSet:o(function(Ue){return this.evaluate(Ue).nodeset()},"evaluateNodeSet"),select:o(function(Ue){return this.evaluateNodeSet(Ue).toArray()},"select"),select1:o(function(Ue){return this.select(Ue)[0]},"select1")};function jK(Ue){var Vt=p.parse(Ue);return Object.create(MK,{expression:{value:Vt}})}o(jK,"parse"),r.parse=jK})(),m(r,{XPath:w,XPathParser:y,XPathResult:Tt,Step:_,PathExpr:z,NodeTest:D,LocationPath:Ie,OrOperation:k,AndOperation:I,BarOperation:me,EqualsOperation:T,NotEqualOperation:V,LessThanOperation:U,GreaterThanOperation:M,LessThanOrEqualOperation:ie,GreaterThanOrEqualOperation:Z,PlusOperation:ue,MinusOperation:$,MultiplyOperation:de,DivOperation:xe,ModOperation:ve,UnaryMinusOperation:b,FunctionCall:q,VariableReference:Y,XPathContext:Ir,XNodeSet:ke,XBoolean:Ee,XString:R,XNumber:N,NamespaceResolver:wi,FunctionResolver:Vr,VariableResolver:ir,Utilities:Ke}),r.select=function(p,C,j){return r.selectWithResolver(p,C,null,j)},r.useNamespaces=function(p){var C={mappings:p||{},lookupNamespaceURI:o(function(j){return this.mappings[j]},"lookupNamespaceURI")};return function(j,ne,oe){return r.selectWithResolver(j,ne,C,oe)}},r.selectWithResolver=function(p,C,j,ne){var oe=new bi(p,j,new y),H=Tt.ANY_TYPE,Ge=oe.evaluate(C,H,null);return Ge.resultType==Tt.STRING_TYPE?Ge=Ge.stringValue:Ge.resultType==Tt.NUMBER_TYPE?Ge=Ge.numberValue:Ge.resultType==Tt.BOOLEAN_TYPE?Ge=Ge.booleanValue:(Ge=Ge.nodes,ne&&(Ge=Ge[0])),Ge},r.select1=function(p,C){return r.select(p,C,!0)};var aC=o(function(p){return p&&typeof p.nodeType=="number"&&Number.isInteger(p.nodeType)&&p.nodeType>=1&&p.nodeType<=11&&typeof p.nodeName=="string"},"isNodeLike"),LK=o(function(p){return Array.isArray(p)&&p.every(aC)},"isArrayOfNodes"),Fa=o(function(p){return function(C){return aC(C)&&C.nodeType===p}},"isNodeOfType");m(r,{isNodeLike:aC,isArrayOfNodes:LK,isElement:Fa(v.ELEMENT_NODE),isAttribute:Fa(v.ATTRIBUTE_NODE),isTextNode:Fa(v.TEXT_NODE),isCDATASection:Fa(v.CDATA_SECTION_NODE),isProcessingInstruction:Fa(v.PROCESSING_INSTRUCTION_NODE),isComment:Fa(v.COMMENT_NODE),isDocumentNode:Fa(v.DOCUMENT_NODE),isDocumentTypeNode:Fa(v.DOCUMENT_TYPE_NODE),isDocumentFragment:Fa(v.DOCUMENT_FRAGMENT_NODE)})})(Kne)});var np=X(ft=>{"use strict";Object.defineProperty(ft,"__esModule",{value:!0});ft.assertIsDocumentFragmentNode=ft.assertIsDocumentTypeNode=ft.assertIsDocumentNode=ft.assertIsCommentNode=ft.assertIsProcessingInstructionNode=ft.assertIsCDATASectionNode=ft.assertIsTextNode=ft.assertIsAttributeNode=ft.assertIsElementNode=ft.isDocumentFragmentNode=ft.isDocumentTypeNode=ft.isDocumentNode=ft.isCommentNode=ft.isProcessingInstructionNode=ft.isCDATASectionNode=ft.isTextNode=ft.isAttributeNode=ft.isElementNode=ft.assertIsArrayOfNodes=ft.isArrayOfNodes=ft.assertIsNodeLike=ft.isNodeLike=ft.NodeTypes=void 0;var Hr;(function(r){r[r.ELEMENT_NODE=1]="ELEMENT_NODE",r[r.ATTRIBUTE_NODE=2]="ATTRIBUTE_NODE",r[r.TEXT_NODE=3]="TEXT_NODE",r[r.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",r[r.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",r[r.COMMENT_NODE=8]="COMMENT_NODE",r[r.DOCUMENT_NODE=9]="DOCUMENT_NODE",r[r.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",r[r.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE"})(Hr||(ft.NodeTypes=Hr={}));function BE(r){return r&&typeof r=="object"&&Number.isInteger(r.nodeType)&&r.nodeType>=1&&r.nodeType<=11&&typeof r.nodeName=="string"&&typeof r.appendChild=="function"&&typeof r.removeChild=="function"}o(BE,"isNodeLike");ft.isNodeLike=BE;function $ne(r){if(!BE(r))throw new Error(`Value is not a Node-like object. Received: ${r}`)}o($ne,"assertIsNodeLike");ft.assertIsNodeLike=$ne;function sU(r){return Array.isArray(r)&&r.every(BE)}o(sU,"isArrayOfNodes");ft.isArrayOfNodes=sU;function Xne(r){if(!sU(r))throw new Error("Value is not an array of Nodes")}o(Xne,"assertIsArrayOfNodes");ft.assertIsArrayOfNodes=Xne;function ha(r,e){return BE(e)&&e.nodeType===r}o(ha,"isNodeOfType");function za(r,e){let t=Object.keys(Hr).find(n=>Hr[n]===r);if(!ha(r,e))throw new Error(`Value is not of type ${t}`)}o(za,"assertIsNodeOfType");var Gne=o(r=>ha(Hr.ELEMENT_NODE,r),"isElementNode");ft.isElementNode=Gne;var zne=o(r=>ha(Hr.ATTRIBUTE_NODE,r),"isAttributeNode");ft.isAttributeNode=zne;var Wne=o(r=>ha(Hr.TEXT_NODE,r),"isTextNode");ft.isTextNode=Wne;var Jne=o(r=>ha(Hr.CDATA_SECTION_NODE,r),"isCDATASectionNode");ft.isCDATASectionNode=Jne;var Yne=o(r=>ha(Hr.PROCESSING_INSTRUCTION_NODE,r),"isProcessingInstructionNode");ft.isProcessingInstructionNode=Yne;var Qne=o(r=>ha(Hr.COMMENT_NODE,r),"isCommentNode");ft.isCommentNode=Qne;var Zne=o(r=>ha(Hr.DOCUMENT_NODE,r),"isDocumentNode");ft.isDocumentNode=Zne;var ese=o(r=>ha(Hr.DOCUMENT_TYPE_NODE,r),"isDocumentTypeNode");ft.isDocumentTypeNode=ese;var tse=o(r=>ha(Hr.DOCUMENT_FRAGMENT_NODE,r),"isDocumentFragmentNode");ft.isDocumentFragmentNode=tse;var rse=o(r=>{za(Hr.ELEMENT_NODE,r)},"assertIsElementNode");ft.assertIsElementNode=rse;var nse=o(r=>za(Hr.ATTRIBUTE_NODE,r),"assertIsAttributeNode");ft.assertIsAttributeNode=nse;var sse=o(r=>za(Hr.TEXT_NODE,r),"assertIsTextNode");ft.assertIsTextNode=sse;var ise=o(r=>za(Hr.CDATA_SECTION_NODE,r),"assertIsCDATASectionNode");ft.assertIsCDATASectionNode=ise;var ase=o(r=>za(Hr.PROCESSING_INSTRUCTION_NODE,r),"assertIsProcessingInstructionNode");ft.assertIsProcessingInstructionNode=ase;var ose=o(r=>za(Hr.COMMENT_NODE,r),"assertIsCommentNode");ft.assertIsCommentNode=ose;var use=o(r=>za(Hr.DOCUMENT_NODE,r),"assertIsDocumentNode");ft.assertIsDocumentNode=use;var cse=o(r=>za(Hr.DOCUMENT_TYPE_NODE,r),"assertIsDocumentTypeNode");ft.assertIsDocumentTypeNode=cse;var lse=o(r=>za(Hr.DOCUMENT_FRAGMENT_NODE,r),"assertIsDocumentFragmentNode");ft.assertIsDocumentFragmentNode=lse});var yg=X(Wt=>{"use strict";Object.defineProperty(Wt,"__esModule",{value:!0});Wt.validateDigestValue=Wt.findAncestorNs=Wt.derToPem=Wt.pemToDer=Wt.normalizePem=Wt.BASE64_REGEX=Wt.EXTRACT_X509_CERTS=Wt.PEM_FORMAT_REGEX=Wt.encodeSpecialCharactersInText=Wt.encodeSpecialCharactersInAttribute=Wt.findChilds=Wt.findChildren=Wt.findAttr=Wt.isArrayHasLength=void 0;var fse=DE(),LI=np();function iU(r){return Array.isArray(r)&&r.length>0}o(iU,"isArrayHasLength");Wt.isArrayHasLength=iU;function hse(r,e,t){return r.localName===e&&(r.namespaceURI===t||t==null)}o(hse,"attrEqualsExplicitly");function pse(r,e,t,n){return r.localName===e&&(!r.namespaceURI&&n?.namespaceURI===t||t==null)}o(pse,"attrEqualsImplicitly");function dse(r,e,t){for(let n=0;n<r.attributes.length;n++){let s=r.attributes[n];if(hse(s,e,t)||pse(s,e,t,r))return s}return null}o(dse,"findAttr");Wt.findAttr=dse;function aU(r,e,t){let n=r.documentElement??r,s=[];for(let i=0;i<n.childNodes.length;i++){let a=n.childNodes[i];LI.isElementNode(a)&&a.localName===e&&(a.namespaceURI===t||t==null)&&s.push(a)}return s}o(aU,"findChildren");Wt.findChildren=aU;function mse(r,e,t){return aU(r,e,t)}o(mse,"findChilds");Wt.findChilds=mse;var gse={"&":"&","<":"<",'"':""","\r":"
","\n":"
"," ":"	"},yse={"&":"&","<":"<",">":">","\r":"
"};function vse(r){return r.replace(/([&<"\r\n\t])/g,function(e,t){return gse[t]})}o(vse,"encodeSpecialCharactersInAttribute");Wt.encodeSpecialCharactersInAttribute=vse;function xse(r){return r.replace(/([&<>\r])/g,function(e,t){return yse[t]})}o(xse,"encodeSpecialCharactersInText");Wt.encodeSpecialCharactersInText=xse;Wt.PEM_FORMAT_REGEX=new RegExp("^-----BEGIN [A-Z ]{1,48}-----([^-]*)-----END [A-Z ]{1,48}-----$","s");Wt.EXTRACT_X509_CERTS=new RegExp("-----BEGIN CERTIFICATE-----[^-]*-----END CERTIFICATE-----","g");Wt.BASE64_REGEX=new RegExp("^(?:[A-Za-z0-9\\+\\/]{4}\\n{0,1})*(?:[A-Za-z0-9\\+\\/]{2}==|[A-Za-z0-9\\+\\/]{3}=)?$","s");function kI(r){return`${(r.trim().replace(/(\r\n|\r)/g,`
|
|
44
|
+
`;)H=ne.charAt(oe++);if(H=="\0"||oe>=ne.length)break;if(H=="("){C.push(y.LEFTPARENTHESIS),j.push(H),H=ne.charAt(oe++);continue}if(H==")"){C.push(y.RIGHTPARENTHESIS),j.push(H),H=ne.charAt(oe++);continue}if(H=="["){C.push(y.LEFTBRACKET),j.push(H),H=ne.charAt(oe++);continue}if(H=="]"){C.push(y.RIGHTBRACKET),j.push(H),H=ne.charAt(oe++);continue}if(H=="@"){C.push(y.AT),j.push(H),H=ne.charAt(oe++);continue}if(H==","){C.push(y.COMMA),j.push(H),H=ne.charAt(oe++);continue}if(H=="|"){C.push(y.BAR),j.push(H),H=ne.charAt(oe++);continue}if(H=="+"){C.push(y.PLUS),j.push(H),H=ne.charAt(oe++);continue}if(H=="-"){C.push(y.MINUS),j.push(H),H=ne.charAt(oe++);continue}if(H=="="){C.push(y.EQUALS),j.push(H),H=ne.charAt(oe++);continue}if(H=="$"){C.push(y.DOLLAR),j.push(H),H=ne.charAt(oe++);continue}if(H=="."){if(H=ne.charAt(oe++),H=="."){C.push(y.DOUBLEDOT),j.push(".."),H=ne.charAt(oe++);continue}if(H>="0"&&H<="9"){var Ge="."+H;for(H=ne.charAt(oe++);H>="0"&&H<="9";)Ge+=H,H=ne.charAt(oe++);C.push(y.NUMBER),j.push(Ge);continue}C.push(y.DOT),j.push(".");continue}if(H=="'"||H=='"'){for(var St=H,Ut="";oe<ne.length&&(H=ne.charAt(oe))!==St;)Ut+=H,oe+=1;if(H!==St)throw Rs.fromMessage("Unterminated string literal: "+St+Ut);oe+=1,C.push(y.LITERAL),j.push(Ut),H=ne.charAt(oe++);continue}if(H>="0"&&H<="9"){var Ge=H;for(H=ne.charAt(oe++);H>="0"&&H<="9";)Ge+=H,H=ne.charAt(oe++);if(H=="."&&ne.charAt(oe)>="0"&&ne.charAt(oe)<="9")for(Ge+=H,Ge+=ne.charAt(oe++),H=ne.charAt(oe++);H>="0"&&H<="9";)Ge+=H,H=ne.charAt(oe++);C.push(y.NUMBER),j.push(Ge);continue}if(H=="*"){if(C.length>0){var $e=C[C.length-1];if($e!=y.AT&&$e!=y.DOUBLECOLON&&$e!=y.LEFTPARENTHESIS&&$e!=y.LEFTBRACKET&&$e!=y.AND&&$e!=y.OR&&$e!=y.MOD&&$e!=y.DIV&&$e!=y.MULTIPLYOPERATOR&&$e!=y.SLASH&&$e!=y.DOUBLESLASH&&$e!=y.BAR&&$e!=y.PLUS&&$e!=y.MINUS&&$e!=y.EQUALS&&$e!=y.NOTEQUAL&&$e!=y.LESSTHAN&&$e!=y.LESSTHANOREQUAL&&$e!=y.GREATERTHAN&&$e!=y.GREATERTHANOREQUAL){C.push(y.MULTIPLYOPERATOR),j.push(H),H=ne.charAt(oe++);continue}}C.push(y.ASTERISKNAMETEST),j.push(H),H=ne.charAt(oe++);continue}if(H==":"&&ne.charAt(oe)==":"){C.push(y.DOUBLECOLON),j.push("::"),oe++,H=ne.charAt(oe++);continue}if(H=="/"){if(H=ne.charAt(oe++),H=="/"){C.push(y.DOUBLESLASH),j.push("//"),H=ne.charAt(oe++);continue}C.push(y.SLASH),j.push("/");continue}if(H=="!"&&ne.charAt(oe)=="="){C.push(y.NOTEQUAL),j.push("!="),oe++,H=ne.charAt(oe++);continue}if(H=="<"){if(ne.charAt(oe)=="="){C.push(y.LESSTHANOREQUAL),j.push("<="),oe++,H=ne.charAt(oe++);continue}C.push(y.LESSTHAN),j.push("<"),H=ne.charAt(oe++);continue}if(H==">"){if(ne.charAt(oe)=="="){C.push(y.GREATERTHANOREQUAL),j.push(">="),oe++,H=ne.charAt(oe++);continue}C.push(y.GREATERTHAN),j.push(">"),H=ne.charAt(oe++);continue}if(H=="_"||Ke.isLetter(H.charCodeAt(0))){var yt=H;for(H=ne.charAt(oe++);Ke.isNCNameChar(H.charCodeAt(0));)yt+=H,H=ne.charAt(oe++);if(C.length>0){var $e=C[C.length-1];if($e!=y.AT&&$e!=y.DOUBLECOLON&&$e!=y.LEFTPARENTHESIS&&$e!=y.LEFTBRACKET&&$e!=y.AND&&$e!=y.OR&&$e!=y.MOD&&$e!=y.DIV&&$e!=y.MULTIPLYOPERATOR&&$e!=y.SLASH&&$e!=y.DOUBLESLASH&&$e!=y.BAR&&$e!=y.PLUS&&$e!=y.MINUS&&$e!=y.EQUALS&&$e!=y.NOTEQUAL&&$e!=y.LESSTHAN&&$e!=y.LESSTHANOREQUAL&&$e!=y.GREATERTHAN&&$e!=y.GREATERTHANOREQUAL){if(yt=="and"){C.push(y.AND),j.push(yt);continue}if(yt=="or"){C.push(y.OR),j.push(yt);continue}if(yt=="mod"){C.push(y.MOD),j.push(yt);continue}if(yt=="div"){C.push(y.DIV),j.push(yt);continue}}}if(H==":"){if(ne.charAt(oe)=="*"){C.push(y.NCNAMECOLONASTERISK),j.push(yt+":*"),oe++,H=ne.charAt(oe++);continue}if(ne.charAt(oe)=="_"||Ke.isLetter(ne.charCodeAt(oe))){for(yt+=":",H=ne.charAt(oe++);Ke.isNCNameChar(H.charCodeAt(0));)yt+=H,H=ne.charAt(oe++);if(H=="("){C.push(y.FUNCTIONNAME),j.push(yt);continue}C.push(y.QNAME),j.push(yt);continue}if(ne.charAt(oe)==":"){C.push(y.AXISNAME),j.push(yt);continue}}if(H=="("){if(yt=="comment"||yt=="text"||yt=="node"){C.push(y.NODETYPE),j.push(yt);continue}if(yt=="processing-instruction"){ne.charAt(oe)==")"?C.push(y.NODETYPE):C.push(y.PROCESSINGINSTRUCTIONWITHLITERAL),j.push(yt);continue}C.push(y.FUNCTIONNAME),j.push(yt);continue}C.push(y.QNAME),j.push(yt);continue}throw new Error("Unexpected character "+H)}return C.push(1),j.push("[EOF]"),[C,j]},y.SHIFT="s",y.REDUCE="r",y.ACCEPT="a",y.prototype.parse=function(Ut){var C,j,ne=this.tokenize(Ut);if(ne!=null){C=ne[0],j=ne[1];var oe=0,H=[],Ge=[],St=[],Ut,$e,yt;for(H.push(0),Ge.push(1),St.push("_S"),$e=C[oe],yt=j[oe++];;)switch(Ut=H[H.length-1],y.actionTable[Ut].charAt($e-1)){case y.SHIFT:Ge.push(-$e),St.push(yt),H.push(y.actionTableNumber[Ut].charCodeAt($e-1)-32),$e=C[oe],yt=j[oe++];break;case y.REDUCE:for(var Wn=y.productions[y.actionTableNumber[Ut].charCodeAt($e-1)-32][1],Xi=[],or=0;or<Wn;or++)Ge.pop(),Xi.unshift(St.pop()),H.pop();var Mo=H[H.length-1];Ge.push(y.productions[y.actionTableNumber[Ut].charCodeAt($e-1)-32][0]),this.reduceActions[y.actionTableNumber[Ut].charCodeAt($e-1)-32]==null?St.push(Xi[0]):St.push(this.reduceActions[y.actionTableNumber[Ut].charCodeAt($e-1)-32](Xi)),H.push(y.gotoTable[Mo].charCodeAt(y.productions[y.actionTableNumber[Ut].charCodeAt($e-1)-32][0]-2)-33);break;case y.ACCEPT:return new w(St.pop());default:throw new Error("XPath parse error")}}},w.prototype=new Object,w.prototype.constructor=w,w.superclass=Object.prototype;function w(p){this.expression=p}o(w,"XPath"),w.prototype.toString=function(){return this.expression.toString()};function S(p,C,j){C in p||(p[C]=j)}o(S,"setIfUnset"),w.prototype.evaluate=function(p){return p.contextNode=p.expressionContextNode,p.contextSize=1,p.contextPosition=1,p.isHtml&&(S(p,"caseInsensitive",!0),S(p,"allowAnyNamespaceForNoPrefix",!0)),S(p,"caseInsensitive",!1),this.expression.evaluate(p)},w.XML_NAMESPACE_URI="http://www.w3.org/XML/1998/namespace",w.XMLNS_NAMESPACE_URI="http://www.w3.org/2000/xmlns/",E.prototype=new Object,E.prototype.constructor=E,E.superclass=Object.prototype;function E(){}o(E,"Expression"),E.prototype.init=function(){},E.prototype.toString=function(){return"<Expression>"},E.prototype.evaluate=function(p){throw new Error("Could not evaluate expression.")},x.prototype=new E,x.prototype.constructor=x,x.superclass=E.prototype;function x(p){arguments.length>0&&this.init(p)}o(x,"UnaryOperation"),x.prototype.init=function(p){this.rhs=p},b.prototype=new x,b.prototype.constructor=b,b.superclass=x.prototype;function b(p){arguments.length>0&&this.init(p)}o(b,"UnaryMinusOperation"),b.prototype.init=function(p){b.superclass.init.call(this,p)},b.prototype.evaluate=function(p){return this.rhs.evaluate(p).number().negate()},b.prototype.toString=function(){return"-"+this.rhs.toString()},A.prototype=new E,A.prototype.constructor=A,A.superclass=E.prototype;function A(p,C){arguments.length>0&&this.init(p,C)}o(A,"BinaryOperation"),A.prototype.init=function(p,C){this.lhs=p,this.rhs=C},k.prototype=new A,k.prototype.constructor=k,k.superclass=A.prototype;function k(p,C){arguments.length>0&&this.init(p,C)}o(k,"OrOperation"),k.prototype.init=function(p,C){k.superclass.init.call(this,p,C)},k.prototype.toString=function(){return"("+this.lhs.toString()+" or "+this.rhs.toString()+")"},k.prototype.evaluate=function(p){var C=this.lhs.evaluate(p).bool();return C.booleanValue()?C:this.rhs.evaluate(p).bool()},I.prototype=new A,I.prototype.constructor=I,I.superclass=A.prototype;function I(p,C){arguments.length>0&&this.init(p,C)}o(I,"AndOperation"),I.prototype.init=function(p,C){I.superclass.init.call(this,p,C)},I.prototype.toString=function(){return"("+this.lhs.toString()+" and "+this.rhs.toString()+")"},I.prototype.evaluate=function(p){var C=this.lhs.evaluate(p).bool();return C.booleanValue()?this.rhs.evaluate(p).bool():C},T.prototype=new A,T.prototype.constructor=T,T.superclass=A.prototype;function T(p,C){arguments.length>0&&this.init(p,C)}o(T,"EqualsOperation"),T.prototype.init=function(p,C){T.superclass.init.call(this,p,C)},T.prototype.toString=function(){return"("+this.lhs.toString()+" = "+this.rhs.toString()+")"},T.prototype.evaluate=function(p){return this.lhs.evaluate(p).equals(this.rhs.evaluate(p))},V.prototype=new A,V.prototype.constructor=V,V.superclass=A.prototype;function V(p,C){arguments.length>0&&this.init(p,C)}o(V,"NotEqualOperation"),V.prototype.init=function(p,C){V.superclass.init.call(this,p,C)},V.prototype.toString=function(){return"("+this.lhs.toString()+" != "+this.rhs.toString()+")"},V.prototype.evaluate=function(p){return this.lhs.evaluate(p).notequal(this.rhs.evaluate(p))},U.prototype=new A,U.prototype.constructor=U,U.superclass=A.prototype;function U(p,C){arguments.length>0&&this.init(p,C)}o(U,"LessThanOperation"),U.prototype.init=function(p,C){U.superclass.init.call(this,p,C)},U.prototype.evaluate=function(p){return this.lhs.evaluate(p).lessthan(this.rhs.evaluate(p))},U.prototype.toString=function(){return"("+this.lhs.toString()+" < "+this.rhs.toString()+")"},M.prototype=new A,M.prototype.constructor=M,M.superclass=A.prototype;function M(p,C){arguments.length>0&&this.init(p,C)}o(M,"GreaterThanOperation"),M.prototype.init=function(p,C){M.superclass.init.call(this,p,C)},M.prototype.evaluate=function(p){return this.lhs.evaluate(p).greaterthan(this.rhs.evaluate(p))},M.prototype.toString=function(){return"("+this.lhs.toString()+" > "+this.rhs.toString()+")"},ie.prototype=new A,ie.prototype.constructor=ie,ie.superclass=A.prototype;function ie(p,C){arguments.length>0&&this.init(p,C)}o(ie,"LessThanOrEqualOperation"),ie.prototype.init=function(p,C){ie.superclass.init.call(this,p,C)},ie.prototype.evaluate=function(p){return this.lhs.evaluate(p).lessthanorequal(this.rhs.evaluate(p))},ie.prototype.toString=function(){return"("+this.lhs.toString()+" <= "+this.rhs.toString()+")"},Z.prototype=new A,Z.prototype.constructor=Z,Z.superclass=A.prototype;function Z(p,C){arguments.length>0&&this.init(p,C)}o(Z,"GreaterThanOrEqualOperation"),Z.prototype.init=function(p,C){Z.superclass.init.call(this,p,C)},Z.prototype.evaluate=function(p){return this.lhs.evaluate(p).greaterthanorequal(this.rhs.evaluate(p))},Z.prototype.toString=function(){return"("+this.lhs.toString()+" >= "+this.rhs.toString()+")"},ue.prototype=new A,ue.prototype.constructor=ue,ue.superclass=A.prototype;function ue(p,C){arguments.length>0&&this.init(p,C)}o(ue,"PlusOperation"),ue.prototype.init=function(p,C){ue.superclass.init.call(this,p,C)},ue.prototype.evaluate=function(p){return this.lhs.evaluate(p).number().plus(this.rhs.evaluate(p).number())},ue.prototype.toString=function(){return"("+this.lhs.toString()+" + "+this.rhs.toString()+")"},$.prototype=new A,$.prototype.constructor=$,$.superclass=A.prototype;function $(p,C){arguments.length>0&&this.init(p,C)}o($,"MinusOperation"),$.prototype.init=function(p,C){$.superclass.init.call(this,p,C)},$.prototype.evaluate=function(p){return this.lhs.evaluate(p).number().minus(this.rhs.evaluate(p).number())},$.prototype.toString=function(){return"("+this.lhs.toString()+" - "+this.rhs.toString()+")"},de.prototype=new A,de.prototype.constructor=de,de.superclass=A.prototype;function de(p,C){arguments.length>0&&this.init(p,C)}o(de,"MultiplyOperation"),de.prototype.init=function(p,C){de.superclass.init.call(this,p,C)},de.prototype.evaluate=function(p){return this.lhs.evaluate(p).number().multiply(this.rhs.evaluate(p).number())},de.prototype.toString=function(){return"("+this.lhs.toString()+" * "+this.rhs.toString()+")"},xe.prototype=new A,xe.prototype.constructor=xe,xe.superclass=A.prototype;function xe(p,C){arguments.length>0&&this.init(p,C)}o(xe,"DivOperation"),xe.prototype.init=function(p,C){xe.superclass.init.call(this,p,C)},xe.prototype.evaluate=function(p){return this.lhs.evaluate(p).number().div(this.rhs.evaluate(p).number())},xe.prototype.toString=function(){return"("+this.lhs.toString()+" div "+this.rhs.toString()+")"},ve.prototype=new A,ve.prototype.constructor=ve,ve.superclass=A.prototype;function ve(p,C){arguments.length>0&&this.init(p,C)}o(ve,"ModOperation"),ve.prototype.init=function(p,C){ve.superclass.init.call(this,p,C)},ve.prototype.evaluate=function(p){return this.lhs.evaluate(p).number().mod(this.rhs.evaluate(p).number())},ve.prototype.toString=function(){return"("+this.lhs.toString()+" mod "+this.rhs.toString()+")"},me.prototype=new A,me.prototype.constructor=me,me.superclass=A.prototype;function me(p,C){arguments.length>0&&this.init(p,C)}o(me,"BarOperation"),me.prototype.init=function(p,C){me.superclass.init.call(this,p,C)},me.prototype.evaluate=function(p){return this.lhs.evaluate(p).nodeset().union(this.rhs.evaluate(p).nodeset())},me.prototype.toString=function(){return s(c,[this.lhs,this.rhs]).join(" | ")},z.prototype=new E,z.prototype.constructor=z,z.superclass=E.prototype;function z(p,C,j){arguments.length>0&&this.init(p,C,j)}o(z,"PathExpr"),z.prototype.init=function(p,C,j){z.superclass.init.call(this),this.filter=p,this.filterPredicates=C,this.locationPath=j};function ee(p){for(;p&&p.parentNode;)p=p.parentNode;return p}o(ee,"findRoot"),z.applyPredicates=function(p,C,j){if(p.length===0)return j;var ne=C.extend({});return n(function(oe,H){return ne.contextSize=oe.length,i(function(Ge,St){return ne.contextNode=Ge,ne.contextPosition=St+1,z.predicateMatches(H,ne)},oe)},j,p)},z.getRoot=function(p,C){var j=C[0];if(j.nodeType===v.DOCUMENT_NODE)return j;if(p.virtualRoot)return p.virtualRoot;var ne=j.ownerDocument;if(ne)return ne;for(var oe=j;oe.parentNode!=null;)oe=oe.parentNode;return oe},z.applyStep=function(p,C,j){var ne=this,oe=[];switch(C.contextNode=j,p.axis){case _.ANCESTOR:if(C.contextNode===C.virtualRoot)break;var H;for(C.contextNode.nodeType==v.ATTRIBUTE_NODE?H=z.getOwnerElement(C.contextNode):H=C.contextNode.parentNode;H!=null&&(p.nodeTest.matches(H,C)&&oe.push(H),H!==C.virtualRoot);)H=H.parentNode;break;case _.ANCESTORORSELF:for(var H=C.contextNode;H!=null&&(p.nodeTest.matches(H,C)&&oe.push(H),H!==C.virtualRoot);H=H.nodeType==v.ATTRIBUTE_NODE?z.getOwnerElement(H):H.parentNode);break;case _.ATTRIBUTE:var Ge=C.contextNode.attributes;if(Ge!=null)for(var St=0;St<Ge.length;St++){var H=Ge.item(St);p.nodeTest.matches(H,C)&&oe.push(H)}break;case _.CHILD:for(var H=C.contextNode.firstChild;H!=null;H=H.nextSibling)p.nodeTest.matches(H,C)&&oe.push(H);break;case _.DESCENDANT:for(var or=[C.contextNode.firstChild];or.length>0;)for(var H=or.pop();H!=null;)p.nodeTest.matches(H,C)&&oe.push(H),H.firstChild!=null?(or.push(H.nextSibling),H=H.firstChild):H=H.nextSibling;break;case _.DESCENDANTORSELF:p.nodeTest.matches(C.contextNode,C)&&oe.push(C.contextNode);for(var or=[C.contextNode.firstChild];or.length>0;)for(var H=or.pop();H!=null;)p.nodeTest.matches(H,C)&&oe.push(H),H.firstChild!=null?(or.push(H.nextSibling),H=H.firstChild):H=H.nextSibling;break;case _.FOLLOWING:if(C.contextNode===C.virtualRoot)break;var or=[];C.contextNode.firstChild!=null?or.unshift(C.contextNode.firstChild):or.unshift(C.contextNode.nextSibling);for(var H=C.contextNode.parentNode;H!=null&&H.nodeType!=v.DOCUMENT_NODE&&H!==C.virtualRoot;H=H.parentNode)or.unshift(H.nextSibling);do for(var H=or.pop();H!=null;)p.nodeTest.matches(H,C)&&oe.push(H),H.firstChild!=null?(or.push(H.nextSibling),H=H.firstChild):H=H.nextSibling;while(or.length>0);break;case _.FOLLOWINGSIBLING:if(C.contextNode===C.virtualRoot)break;for(var H=C.contextNode.nextSibling;H!=null;H=H.nextSibling)p.nodeTest.matches(H,C)&&oe.push(H);break;case _.NAMESPACE:var Ut={};if(C.contextNode.nodeType==v.ELEMENT_NODE){Ut.xml=w.XML_NAMESPACE_URI,Ut.xmlns=w.XMLNS_NAMESPACE_URI;for(var H=C.contextNode;H!=null&&H.nodeType==v.ELEMENT_NODE;H=H.parentNode)for(var St=0;St<H.attributes.length;St++){var $e=H.attributes.item(St),yt=String($e.name);if(yt=="xmlns")Ut[""]==null&&(Ut[""]=$e.value);else if(yt.length>6&&yt.substring(0,6)=="xmlns:"){var Wn=yt.substring(6,yt.length);Ut[Wn]==null&&(Ut[Wn]=$e.value)}}for(var Wn in Ut){var Xi=new dr(Wn,Ut[Wn],C.contextNode);p.nodeTest.matches(Xi,C)&&oe.push(Xi)}}break;case _.PARENT:H=null,C.contextNode!==C.virtualRoot&&(C.contextNode.nodeType==v.ATTRIBUTE_NODE?H=z.getOwnerElement(C.contextNode):H=C.contextNode.parentNode),H!=null&&p.nodeTest.matches(H,C)&&oe.push(H);break;case _.PRECEDING:var or;C.virtualRoot!=null?or=[C.virtualRoot]:or=[ee(C.contextNode)];e:for(;or.length>0;)for(var H=or.pop();H!=null;){if(H==C.contextNode)break e;p.nodeTest.matches(H,C)&&oe.unshift(H),H.firstChild!=null?(or.push(H.nextSibling),H=H.firstChild):H=H.nextSibling}break;case _.PRECEDINGSIBLING:if(C.contextNode===C.virtualRoot)break;for(var H=C.contextNode.previousSibling;H!=null;H=H.previousSibling)p.nodeTest.matches(H,C)&&oe.push(H);break;case _.SELF:p.nodeTest.matches(C.contextNode,C)&&oe.push(C.contextNode);break;default:}return oe};function le(p,C,j){return z.applyPredicates(p.predicates,C,z.applyStep(p,C,j))}o(le,"applyStepWithPredicates");function Ae(p,C,j){return g(s(le.bind(null,j,p),C))}o(Ae,"applyStepToNodes"),z.applySteps=function(p,C,j){return n(Ae.bind(null,C),j,p)},z.prototype.applyFilter=function(p,C){if(!this.filter)return{nodes:[p.contextNode]};var j=this.filter.evaluate(p);if(!Ke.instance_of(j,ke)){if(this.filterPredicates!=null&&this.filterPredicates.length>0||this.locationPath!=null)throw new Error("Path expression filter must evaluate to a nodeset if predicates or location path are used");return{nonNodes:j}}return{nodes:z.applyPredicates(this.filterPredicates||[],C,j.toUnsortedArray())}},z.applyLocationPath=function(p,C,j){if(!p)return j;var ne=p.absolute?[z.getRoot(C,j)]:j;return z.applySteps(p.steps,C,ne)},z.prototype.evaluate=function(p){var C=m(new Ir,p),j=this.applyFilter(p,C);if("nonNodes"in j)return j.nonNodes;var ne=new ke;return ne.addArray(z.applyLocationPath(this.locationPath,C,j.nodes)),ne},z.predicateMatches=function(p,C){var j=p.evaluate(C);return Ke.instance_of(j,N)?C.contextPosition===j.numberValue():j.booleanValue()},z.predicateString=function(p){return f("[","]",p.toString())},z.predicatesString=function(p){return l("",s(z.predicateString,p))},z.prototype.toString=function(){if(this.filter!=null){var p=c(this.filter);return Ke.instance_of(this.filter,R)?f("'","'",p):this.filterPredicates!=null&&this.filterPredicates.length?f("(",")",p)+z.predicatesString(this.filterPredicates):this.locationPath!=null?p+(this.locationPath.absolute?"":"/")+c(this.locationPath):p}return c(this.locationPath)},z.getOwnerElement=function(p){if(p.ownerElement)return p.ownerElement;try{if(p.selectSingleNode)return p.selectSingleNode("..")}catch{}for(var C=p.nodeType==v.DOCUMENT_NODE?p:p.ownerDocument,j=C.getElementsByTagName("*"),ne=0;ne<j.length;ne++)for(var oe=j.item(ne),H=oe.attributes,Ge=0;Ge<H.length;Ge++){var St=H.item(Ge);if(St===p)return oe}return null},Ie.prototype=new Object,Ie.prototype.constructor=Ie,Ie.superclass=Object.prototype;function Ie(p,C){arguments.length>0&&this.init(p,C)}o(Ie,"LocationPath"),Ie.prototype.init=function(p,C){this.absolute=p,this.steps=C},Ie.prototype.toString=function(){return(this.absolute?"/":"")+s(c,this.steps).join("/")},_.prototype=new Object,_.prototype.constructor=_,_.superclass=Object.prototype;function _(p,C,j){arguments.length>0&&this.init(p,C,j)}o(_,"Step"),_.prototype.init=function(p,C,j){this.axis=p,this.nodeTest=C,this.predicates=j},_.prototype.toString=function(){return _.STEPNAMES[this.axis]+"::"+this.nodeTest.toString()+z.predicatesString(this.predicates)},_.ANCESTOR=0,_.ANCESTORORSELF=1,_.ATTRIBUTE=2,_.CHILD=3,_.DESCENDANT=4,_.DESCENDANTORSELF=5,_.FOLLOWING=6,_.FOLLOWINGSIBLING=7,_.NAMESPACE=8,_.PARENT=9,_.PRECEDING=10,_.PRECEDINGSIBLING=11,_.SELF=12,_.STEPNAMES=n(function(p,C){return p[C[0]]=C[1],p},{},[[_.ANCESTOR,"ancestor"],[_.ANCESTORORSELF,"ancestor-or-self"],[_.ATTRIBUTE,"attribute"],[_.CHILD,"child"],[_.DESCENDANT,"descendant"],[_.DESCENDANTORSELF,"descendant-or-self"],[_.FOLLOWING,"following"],[_.FOLLOWINGSIBLING,"following-sibling"],[_.NAMESPACE,"namespace"],[_.PARENT,"parent"],[_.PRECEDING,"preceding"],[_.PRECEDINGSIBLING,"preceding-sibling"],[_.SELF,"self"]]),D.prototype=new Object,D.prototype.constructor=D,D.superclass=Object.prototype;function D(p,C){arguments.length>0&&this.init(p,C)}o(D,"NodeTest"),D.prototype.init=function(p,C){this.type=p,this.value=C},D.prototype.toString=function(){return"<unknown nodetest type>"},D.prototype.matches=function(p,C){console.warn("unknown node test type")},D.NAMETESTANY=0,D.NAMETESTPREFIXANY=1,D.NAMETESTQNAME=2,D.COMMENT=3,D.TEXT=4,D.PI=5,D.NODE=6,D.isNodeType=function(p){return function(C){return a(p,C.nodeType)}},D.makeNodeTestType=function(p,C,j){var ne=j||function(){};return ne.prototype=new D(p),ne.prototype.constructor=ne,m(ne.prototype,C),ne},D.makeNodeTypeTest=function(p,C,j){return new(D.makeNodeTestType(p,{matches:D.isNodeType(C),toString:u(j)}))},D.hasPrefix=function(p){return p.prefix||(p.nodeName||p.tagName).indexOf(":")!==-1},D.isElementOrAttribute=D.isNodeType([1,2]),D.nameSpaceMatches=function(p,C,j){var ne=j.namespaceURI||"";if(!p)return!ne||C.allowAnyNamespaceForNoPrefix&&!D.hasPrefix(j);var oe=C.namespaceResolver.getNamespace(p,C.expressionContextNode);if(oe==null)throw new Error("Cannot resolve QName "+p);return oe===ne},D.localNameMatches=function(p,C,j){var ne=j.localName||j.nodeName;return C.caseInsensitive?p.toLowerCase()===ne.toLowerCase():p===ne},D.NameTestPrefixAny=D.makeNodeTestType(D.NAMETESTPREFIXANY,{matches:o(function(p,C){return D.isElementOrAttribute(p)&&D.nameSpaceMatches(this.prefix,C,p)},"matches"),toString:o(function(){return this.prefix+":*"},"toString")},o(function(C){this.prefix=C},"NameTestPrefixAny")),D.NameTestQName=D.makeNodeTestType(D.NAMETESTQNAME,{matches:o(function(p,C){return D.isNodeType([v.ELEMENT_NODE,v.ATTRIBUTE_NODE,dr.XPATH_NAMESPACE_NODE])(p)&&D.nameSpaceMatches(this.prefix,C,p)&&D.localNameMatches(this.localName,C,p)},"matches"),toString:o(function(){return this.name},"toString")},o(function(C){var j=C.split(":");this.name=C,this.prefix=j.length>1?j[0]:null,this.localName=j[j.length>1?1:0]},"NameTestQName")),D.PITest=D.makeNodeTestType(D.PI,{matches:o(function(p,C){return D.isNodeType([v.PROCESSING_INSTRUCTION_NODE])(p)&&(p.target||p.nodeName)===this.name},"matches"),toString:o(function(){return f('processing-instruction("','")',this.name)},"toString")},function(p){this.name=p}),D.nameTestAny=D.makeNodeTypeTest(D.NAMETESTANY,[v.ELEMENT_NODE,v.ATTRIBUTE_NODE,dr.XPATH_NAMESPACE_NODE],"*"),D.textTest=D.makeNodeTypeTest(D.TEXT,[v.TEXT_NODE,v.CDATA_SECTION_NODE],"text()"),D.commentTest=D.makeNodeTypeTest(D.COMMENT,[v.COMMENT_NODE],"comment()"),D.nodeTest=D.makeNodeTypeTest(D.NODE,[v.ELEMENT_NODE,v.ATTRIBUTE_NODE,v.TEXT_NODE,v.CDATA_SECTION_NODE,v.PROCESSING_INSTRUCTION_NODE,v.COMMENT_NODE,v.DOCUMENT_NODE],"node()"),D.anyPiTest=D.makeNodeTypeTest(D.PI,[v.PROCESSING_INSTRUCTION_NODE],"processing-instruction()"),Y.prototype=new E,Y.prototype.constructor=Y,Y.superclass=E.prototype;function Y(p){arguments.length>0&&this.init(p)}o(Y,"VariableReference"),Y.prototype.init=function(p){this.variable=p},Y.prototype.toString=function(){return"$"+this.variable},Y.prototype.evaluate=function(p){var C=Ke.resolveQName(this.variable,p.namespaceResolver,p.contextNode,!1);if(C[0]==null)throw new Error("Cannot resolve QName "+fn);var j=p.variableResolver.getVariable(C[1],C[0]);if(!j)throw Rs.fromMessage("Undeclared variable: "+this.toString());return j},q.prototype=new E,q.prototype.constructor=q,q.superclass=E.prototype;function q(p,C){arguments.length>0&&this.init(p,C)}o(q,"FunctionCall"),q.prototype.init=function(p,C){this.functionName=p,this.arguments=C},q.prototype.toString=function(){for(var p=this.functionName+"(",C=0;C<this.arguments.length;C++)C>0&&(p+=", "),p+=this.arguments[C].toString();return p+")"},q.prototype.evaluate=function(p){var C=Vr.getFunctionFromContext(this.functionName,p);if(!C)throw new Error("Unknown function "+this.functionName);var j=[p].concat(this.arguments);return C.apply(p.functionResolver.thisArg,j)};var Oe=new Object;Oe.equals=function(p,C){return p.equals(C)},Oe.notequal=function(p,C){return p.notequal(C)},Oe.lessthan=function(p,C){return p.lessthan(C)},Oe.greaterthan=function(p,C){return p.greaterthan(C)},Oe.lessthanorequal=function(p,C){return p.lessthanorequal(C)},Oe.greaterthanorequal=function(p,C){return p.greaterthanorequal(C)},R.prototype=new E,R.prototype.constructor=R,R.superclass=E.prototype;function R(p){arguments.length>0&&this.init(p)}o(R,"XString"),R.prototype.init=function(p){this.str=String(p)},R.prototype.toString=function(){return this.str},R.prototype.evaluate=function(p){return this},R.prototype.string=function(){return this},R.prototype.number=function(){return new N(this.str)},R.prototype.bool=function(){return new Ee(this.str)},R.prototype.nodeset=function(){throw new Error("Cannot convert string to nodeset")},R.prototype.stringValue=function(){return this.str},R.prototype.numberValue=function(){return this.number().numberValue()},R.prototype.booleanValue=function(){return this.bool().booleanValue()},R.prototype.equals=function(p){return Ke.instance_of(p,Ee)?this.bool().equals(p):Ke.instance_of(p,N)?this.number().equals(p):Ke.instance_of(p,ke)?p.compareWithString(this,Oe.equals):new Ee(this.str==p.str)},R.prototype.notequal=function(p){return Ke.instance_of(p,Ee)?this.bool().notequal(p):Ke.instance_of(p,N)?this.number().notequal(p):Ke.instance_of(p,ke)?p.compareWithString(this,Oe.notequal):new Ee(this.str!=p.str)},R.prototype.lessthan=function(p){return this.number().lessthan(p)},R.prototype.greaterthan=function(p){return this.number().greaterthan(p)},R.prototype.lessthanorequal=function(p){return this.number().lessthanorequal(p)},R.prototype.greaterthanorequal=function(p){return this.number().greaterthanorequal(p)},N.prototype=new E,N.prototype.constructor=N,N.superclass=E.prototype;function N(p){arguments.length>0&&this.init(p)}o(N,"XNumber"),N.prototype.init=function(p){this.num=typeof p=="string"?this.parse(p):Number(p)},N.prototype.numberFormat=/^\s*-?[0-9]*\.?[0-9]+\s*$/,N.prototype.parse=function(p){return this.numberFormat.test(p)?parseFloat(p):Number.NaN};function te(p){for(var C=p.split("e-"),j=C[0].replace(".",""),ne=Number(C[1]),oe=0;oe<ne-1;oe+=1)j="0"+j;return"0."+j}o(te,"padSmallNumber");function W(p){for(var C=p.split("e"),j=C[0].replace(".",""),ne=Number(C[1]),oe=ne+1-j.length,H=0;H<oe;H+=1)j+="0";return j}o(W,"padLargeNumber"),N.prototype.toString=function(){var p=this.num.toString();return p.indexOf("e-")!==-1?te(p):p.indexOf("e")!==-1?W(p):p},N.prototype.evaluate=function(p){return this},N.prototype.string=function(){return new R(this.toString())},N.prototype.number=function(){return this},N.prototype.bool=function(){return new Ee(this.num)},N.prototype.nodeset=function(){throw new Error("Cannot convert number to nodeset")},N.prototype.stringValue=function(){return this.string().stringValue()},N.prototype.numberValue=function(){return this.num},N.prototype.booleanValue=function(){return this.bool().booleanValue()},N.prototype.negate=function(){return new N(-this.num)},N.prototype.equals=function(p){return Ke.instance_of(p,Ee)?this.bool().equals(p):Ke.instance_of(p,R)?this.equals(p.number()):Ke.instance_of(p,ke)?p.compareWithNumber(this,Oe.equals):new Ee(this.num==p.num)},N.prototype.notequal=function(p){return Ke.instance_of(p,Ee)?this.bool().notequal(p):Ke.instance_of(p,R)?this.notequal(p.number()):Ke.instance_of(p,ke)?p.compareWithNumber(this,Oe.notequal):new Ee(this.num!=p.num)},N.prototype.lessthan=function(p){return Ke.instance_of(p,ke)?p.compareWithNumber(this,Oe.greaterthan):Ke.instance_of(p,Ee)||Ke.instance_of(p,R)?this.lessthan(p.number()):new Ee(this.num<p.num)},N.prototype.greaterthan=function(p){return Ke.instance_of(p,ke)?p.compareWithNumber(this,Oe.lessthan):Ke.instance_of(p,Ee)||Ke.instance_of(p,R)?this.greaterthan(p.number()):new Ee(this.num>p.num)},N.prototype.lessthanorequal=function(p){return Ke.instance_of(p,ke)?p.compareWithNumber(this,Oe.greaterthanorequal):Ke.instance_of(p,Ee)||Ke.instance_of(p,R)?this.lessthanorequal(p.number()):new Ee(this.num<=p.num)},N.prototype.greaterthanorequal=function(p){return Ke.instance_of(p,ke)?p.compareWithNumber(this,Oe.lessthanorequal):Ke.instance_of(p,Ee)||Ke.instance_of(p,R)?this.greaterthanorequal(p.number()):new Ee(this.num>=p.num)},N.prototype.plus=function(p){return new N(this.num+p.num)},N.prototype.minus=function(p){return new N(this.num-p.num)},N.prototype.multiply=function(p){return new N(this.num*p.num)},N.prototype.div=function(p){return new N(this.num/p.num)},N.prototype.mod=function(p){return new N(this.num%p.num)},Ee.prototype=new E,Ee.prototype.constructor=Ee,Ee.superclass=E.prototype;function Ee(p){arguments.length>0&&this.init(p)}o(Ee,"XBoolean"),Ee.prototype.init=function(p){this.b=!!p},Ee.prototype.toString=function(){return this.b.toString()},Ee.prototype.evaluate=function(p){return this},Ee.prototype.string=function(){return new R(this.b)},Ee.prototype.number=function(){return new N(this.b)},Ee.prototype.bool=function(){return this},Ee.prototype.nodeset=function(){throw new Error("Cannot convert boolean to nodeset")},Ee.prototype.stringValue=function(){return this.string().stringValue()},Ee.prototype.numberValue=function(){return this.number().numberValue()},Ee.prototype.booleanValue=function(){return this.b},Ee.prototype.not=function(){return new Ee(!this.b)},Ee.prototype.equals=function(p){return Ke.instance_of(p,R)||Ke.instance_of(p,N)?this.equals(p.bool()):Ke.instance_of(p,ke)?p.compareWithBoolean(this,Oe.equals):new Ee(this.b==p.b)},Ee.prototype.notequal=function(p){return Ke.instance_of(p,R)||Ke.instance_of(p,N)?this.notequal(p.bool()):Ke.instance_of(p,ke)?p.compareWithBoolean(this,Oe.notequal):new Ee(this.b!=p.b)},Ee.prototype.lessthan=function(p){return this.number().lessthan(p)},Ee.prototype.greaterthan=function(p){return this.number().greaterthan(p)},Ee.prototype.lessthanorequal=function(p){return this.number().lessthanorequal(p)},Ee.prototype.greaterthanorequal=function(p){return this.number().greaterthanorequal(p)},Ee.true_=new Ee(!0),Ee.false_=new Ee(!1),rt.prototype=new Object,rt.prototype.constructor=rt,rt.superclass=Object.prototype;function rt(p){this.init(p)}o(rt,"AVLTree"),rt.prototype.init=function(p){this.left=null,this.right=null,this.node=p,this.depth=1},rt.prototype.balance=function(){var p=this.left==null?0:this.left.depth,C=this.right==null?0:this.right.depth;if(p>C+1){var j=this.left.left==null?0:this.left.left.depth,ne=this.left.right==null?0:this.left.right.depth;j<ne&&this.left.rotateRR(),this.rotateLL()}else if(p+1<C){var oe=this.right.right==null?0:this.right.right.depth,H=this.right.left==null?0:this.right.left.depth;H>oe&&this.right.rotateLL(),this.rotateRR()}},rt.prototype.rotateLL=function(){var p=this.node,C=this.right;this.node=this.left.node,this.right=this.left,this.left=this.left.left,this.right.left=this.right.right,this.right.right=C,this.right.node=p,this.right.updateInNewLocation(),this.updateInNewLocation()},rt.prototype.rotateRR=function(){var p=this.node,C=this.left;this.node=this.right.node,this.left=this.right,this.right=this.right.right,this.left.right=this.left.left,this.left.left=C,this.left.node=p,this.left.updateInNewLocation(),this.updateInNewLocation()},rt.prototype.updateInNewLocation=function(){this.getDepthFromChildren()},rt.prototype.getDepthFromChildren=function(){this.depth=this.node==null?0:1,this.left!=null&&(this.depth=this.left.depth+1),this.right!=null&&this.depth<=this.right.depth&&(this.depth=this.right.depth+1)};function er(p,C){if(p===C)return 0;if(p.compareDocumentPosition){var j=p.compareDocumentPosition(C);return j&1||j&10?1:j&20?-1:0}for(var ne=0,oe=0,H=p;H!=null;H=H.parentNode||H.ownerElement)ne++;for(var Ge=C;Ge!=null;Ge=Ge.parentNode||Ge.ownerElement)oe++;if(ne>oe){for(;ne>oe;)p=p.parentNode||p.ownerElement,ne--;if(p===C)return 1}else if(oe>ne){for(;oe>ne;)C=C.parentNode||C.ownerElement,oe--;if(p===C)return-1}for(var St=p.parentNode||p.ownerElement,Ut=C.parentNode||C.ownerElement;St!==Ut;)p=St,C=Ut,St=p.parentNode||p.ownerElement,Ut=C.parentNode||C.ownerElement;var $e=Ke.isAttribute(p),yt=Ke.isAttribute(C);if($e&&!yt)return-1;if(!$e&&yt)return 1;if(St)for(var Wn=$e?St.attributes:St.childNodes,Xi=Wn.length,or=0;or<Xi;or+=1){var Mo=Wn[or];if(Mo===p)return-1;if(Mo===C)return 1}throw new Error("Unexpected: could not determine node order")}o(er,"nodeOrder"),rt.prototype.add=function(p){if(p===this.node)return!1;var C=er(p,this.node),j=!1;return C==-1?this.left==null?(this.left=new rt(p),j=!0):(j=this.left.add(p),j&&this.balance()):C==1&&(this.right==null?(this.right=new rt(p),j=!0):(j=this.right.add(p),j&&this.balance())),j&&this.getDepthFromChildren(),j},ke.prototype=new E,ke.prototype.constructor=ke,ke.superclass=E.prototype;function ke(){this.init()}o(ke,"XNodeSet"),ke.prototype.init=function(){this.tree=null,this.nodes=[],this.size=0},ke.prototype.toString=function(){var p=this.first();return p==null?"":this.stringForNode(p)},ke.prototype.evaluate=function(p){return this},ke.prototype.string=function(){return new R(this.toString())},ke.prototype.stringValue=function(){return this.toString()},ke.prototype.number=function(){return new N(this.string())},ke.prototype.numberValue=function(){return Number(this.string())},ke.prototype.bool=function(){return new Ee(this.booleanValue())},ke.prototype.booleanValue=function(){return!!this.size},ke.prototype.nodeset=function(){return this},ke.prototype.stringForNode=function(p){return p.nodeType==v.DOCUMENT_NODE||p.nodeType==v.ELEMENT_NODE||p.nodeType===v.DOCUMENT_FRAGMENT_NODE?this.stringForContainerNode(p):p.nodeType===v.ATTRIBUTE_NODE?p.value||p.nodeValue:p.isNamespaceNode?p.namespace:p.nodeValue},ke.prototype.stringForContainerNode=function(p){for(var C="",j=p.firstChild;j!=null;j=j.nextSibling){var ne=j.nodeType;(ne===1||ne===3||ne===4||ne===9||ne===11)&&(C+=this.stringForNode(j))}return C},ke.prototype.buildTree=function(){if(!this.tree&&this.nodes.length){this.tree=new rt(this.nodes[0]);for(var p=1;p<this.nodes.length;p+=1)this.tree.add(this.nodes[p])}return this.tree},ke.prototype.first=function(){var p=this.buildTree();if(p==null)return null;for(;p.left!=null;)p=p.left;return p.node},ke.prototype.add=function(p){for(var C=0;C<this.nodes.length;C+=1)if(p===this.nodes[C])return;this.tree=null,this.nodes.push(p),this.size+=1},ke.prototype.addArray=function(p){var C=this;t(function(j){C.add(j)},p)},ke.prototype.toArray=function(){var p=[];return this.toArrayRec(this.buildTree(),p),p},ke.prototype.toArrayRec=function(p,C){p!=null&&(this.toArrayRec(p.left,C),C.push(p.node),this.toArrayRec(p.right,C))},ke.prototype.toUnsortedArray=function(){return this.nodes.slice()},ke.prototype.compareWithString=function(p,C){for(var j=this.toUnsortedArray(),ne=0;ne<j.length;ne++){var oe=j[ne],H=new R(this.stringForNode(oe)),Ge=C(H,p);if(Ge.booleanValue())return Ge}return new Ee(!1)},ke.prototype.compareWithNumber=function(p,C){for(var j=this.toUnsortedArray(),ne=0;ne<j.length;ne++){var oe=j[ne],H=new N(this.stringForNode(oe)),Ge=C(H,p);if(Ge.booleanValue())return Ge}return new Ee(!1)},ke.prototype.compareWithBoolean=function(p,C){return C(this.bool(),p)},ke.prototype.compareWithNodeSet=function(p,C){for(var j=this.toUnsortedArray(),ne=o(function(St,Ut){return C(Ut,St)},"oInvert"),oe=0;oe<j.length;oe++){var H=new R(this.stringForNode(j[oe])),Ge=p.compareWithString(H,ne);if(Ge.booleanValue())return Ge}return new Ee(!1)},ke.compareWith=e(function(p,C){return Ke.instance_of(C,R)?this.compareWithString(C,p):Ke.instance_of(C,N)?this.compareWithNumber(C,p):Ke.instance_of(C,Ee)?this.compareWithBoolean(C,p):this.compareWithNodeSet(C,p)}),ke.prototype.equals=ke.compareWith(Oe.equals),ke.prototype.notequal=ke.compareWith(Oe.notequal),ke.prototype.lessthan=ke.compareWith(Oe.lessthan),ke.prototype.greaterthan=ke.compareWith(Oe.greaterthan),ke.prototype.lessthanorequal=ke.compareWith(Oe.lessthanorequal),ke.prototype.greaterthanorequal=ke.compareWith(Oe.greaterthanorequal),ke.prototype.union=function(p){var C=new ke;return C.addArray(this.toUnsortedArray()),C.addArray(p.toUnsortedArray()),C},dr.prototype=new Object,dr.prototype.constructor=dr,dr.superclass=Object.prototype;function dr(p,C,j){this.isXPathNamespace=!0,this.ownerDocument=j.ownerDocument,this.nodeName="#namespace",this.prefix=p,this.localName=p,this.namespaceURI=C,this.nodeValue=C,this.ownerElement=j,this.nodeType=dr.XPATH_NAMESPACE_NODE}o(dr,"XPathNamespace"),dr.prototype.toString=function(){return'{ "'+this.prefix+'", "'+this.namespaceURI+'" }'},Ir.prototype=new Object,Ir.prototype.constructor=Ir,Ir.superclass=Object.prototype;function Ir(p,C,j){this.variableResolver=p??new ar,this.namespaceResolver=C??new wi,this.functionResolver=j??new Vr}o(Ir,"XPathContext"),Ir.prototype.extend=function(p){return m(new Ir,this,p)},ar.prototype=new Object,ar.prototype.constructor=ar,ar.superclass=Object.prototype;function ar(){}o(ar,"VariableResolver"),ar.prototype.getVariable=function(p,C){return null},Vr.prototype=new Object,Vr.prototype.constructor=Vr,Vr.superclass=Object.prototype;function Vr(p){this.thisArg=p??Qe,this.functions=new Object,this.addStandardFunctions()}o(Vr,"FunctionResolver"),Vr.prototype.addStandardFunctions=function(){this.functions["{}last"]=Qe.last,this.functions["{}position"]=Qe.position,this.functions["{}count"]=Qe.count,this.functions["{}id"]=Qe.id,this.functions["{}local-name"]=Qe.localName,this.functions["{}namespace-uri"]=Qe.namespaceURI,this.functions["{}name"]=Qe.name,this.functions["{}string"]=Qe.string,this.functions["{}concat"]=Qe.concat,this.functions["{}starts-with"]=Qe.startsWith,this.functions["{}contains"]=Qe.contains,this.functions["{}substring-before"]=Qe.substringBefore,this.functions["{}substring-after"]=Qe.substringAfter,this.functions["{}substring"]=Qe.substring,this.functions["{}string-length"]=Qe.stringLength,this.functions["{}normalize-space"]=Qe.normalizeSpace,this.functions["{}translate"]=Qe.translate,this.functions["{}boolean"]=Qe.boolean_,this.functions["{}not"]=Qe.not,this.functions["{}true"]=Qe.true_,this.functions["{}false"]=Qe.false_,this.functions["{}lang"]=Qe.lang,this.functions["{}number"]=Qe.number,this.functions["{}sum"]=Qe.sum,this.functions["{}floor"]=Qe.floor,this.functions["{}ceiling"]=Qe.ceiling,this.functions["{}round"]=Qe.round},Vr.prototype.addFunction=function(p,C,j){this.functions["{"+p+"}"+C]=j},Vr.getFunctionFromContext=function(p,C){var j=Ke.resolveQName(p,C.namespaceResolver,C.contextNode,!1);if(j[0]===null)throw new Error("Cannot resolve QName "+name);return C.functionResolver.getFunction(j[1],j[0])},Vr.prototype.getFunction=function(p,C){return this.functions["{"+C+"}"+p]},wi.prototype=new Object,wi.prototype.constructor=wi,wi.superclass=Object.prototype;function wi(){}o(wi,"NamespaceResolver"),wi.prototype.getNamespace=function(p,C){if(p=="xml")return w.XML_NAMESPACE_URI;if(p=="xmlns")return w.XMLNS_NAMESPACE_URI;for(C.nodeType==v.DOCUMENT_NODE?C=C.documentElement:C.nodeType==v.ATTRIBUTE_NODE?C=z.getOwnerElement(C):C.nodeType!=v.ELEMENT_NODE&&(C=C.parentNode);C!=null&&C.nodeType==v.ELEMENT_NODE;){for(var j=C.attributes,ne=0;ne<j.length;ne++){var oe=j.item(ne),H=oe.name||oe.nodeName;if(H==="xmlns"&&p===""||H==="xmlns:"+p)return String(oe.value||oe.nodeValue)}C=C.parentNode}return null};var Qe=new Object;Qe.last=function(p){if(arguments.length!=1)throw new Error("Function last expects ()");return new N(p.contextSize)},Qe.position=function(p){if(arguments.length!=1)throw new Error("Function position expects ()");return new N(p.contextPosition)},Qe.count=function(){var p=arguments[0],C;if(arguments.length!=2||!Ke.instance_of(C=arguments[1].evaluate(p),ke))throw new Error("Function count expects (node-set)");return new N(C.size)},Qe.id=function(){var p=arguments[0],C;if(arguments.length!=2)throw new Error("Function id expects (object)");C=arguments[1].evaluate(p),Ke.instance_of(C,ke)?C=C.toArray().join(" "):C=C.stringValue();for(var j=C.split(/[\x0d\x0a\x09\x20]+/),ne=0,oe=new ke,H=p.contextNode.nodeType==v.DOCUMENT_NODE?p.contextNode:p.contextNode.ownerDocument,Ge=0;Ge<j.length;Ge++){var St;H.getElementById?St=H.getElementById(j[Ge]):St=Ke.getElementById(H,j[Ge]),St!=null&&(oe.add(St),ne++)}return oe},Qe.localName=function(p,C){var j;if(arguments.length==1)j=p.contextNode;else if(arguments.length==2)j=C.evaluate(p).first();else throw new Error("Function local-name expects (node-set?)");return j==null?new R(""):new R(j.localName||j.baseName||j.target||j.nodeName||"")},Qe.namespaceURI=function(){var p=arguments[0],C;if(arguments.length==1)C=p.contextNode;else if(arguments.length==2)C=arguments[1].evaluate(p).first();else throw new Error("Function namespace-uri expects (node-set?)");return C==null?new R(""):new R(C.namespaceURI)},Qe.name=function(){var p=arguments[0],C;if(arguments.length==1)C=p.contextNode;else if(arguments.length==2)C=arguments[1].evaluate(p).first();else throw new Error("Function name expects (node-set?)");return C==null?new R(""):C.nodeType==v.ELEMENT_NODE?new R(C.nodeName):C.nodeType==v.ATTRIBUTE_NODE?new R(C.name||C.nodeName):C.nodeType===v.PROCESSING_INSTRUCTION_NODE?new R(C.target||C.nodeName):C.localName==null?new R(""):new R(C.localName)},Qe.string=function(){var p=arguments[0];if(arguments.length==1)return new R(ke.prototype.stringForNode(p.contextNode));if(arguments.length==2)return arguments[1].evaluate(p).string();throw new Error("Function string expects (object?)")},Qe.concat=function(p){if(arguments.length<3)throw new Error("Function concat expects (string, string[, string]*)");for(var C="",j=1;j<arguments.length;j++)C+=arguments[j].evaluate(p).stringValue();return new R(C)},Qe.startsWith=function(){var p=arguments[0];if(arguments.length!=3)throw new Error("Function startsWith expects (string, string)");var C=arguments[1].evaluate(p).stringValue(),j=arguments[2].evaluate(p).stringValue();return new Ee(C.substring(0,j.length)==j)},Qe.contains=function(){var p=arguments[0];if(arguments.length!=3)throw new Error("Function contains expects (string, string)");var C=arguments[1].evaluate(p).stringValue(),j=arguments[2].evaluate(p).stringValue();return new Ee(C.indexOf(j)!==-1)},Qe.substringBefore=function(){var p=arguments[0];if(arguments.length!=3)throw new Error("Function substring-before expects (string, string)");var C=arguments[1].evaluate(p).stringValue(),j=arguments[2].evaluate(p).stringValue();return new R(C.substring(0,C.indexOf(j)))},Qe.substringAfter=function(){var p=arguments[0];if(arguments.length!=3)throw new Error("Function substring-after expects (string, string)");var C=arguments[1].evaluate(p).stringValue(),j=arguments[2].evaluate(p).stringValue();if(j.length==0)return new R(C);var ne=C.indexOf(j);return ne==-1?new R(""):new R(C.substring(ne+j.length))},Qe.substring=function(){var p=arguments[0];if(!(arguments.length==3||arguments.length==4))throw new Error("Function substring expects (string, number, number?)");var C=arguments[1].evaluate(p).stringValue(),j=Math.round(arguments[2].evaluate(p).numberValue())-1,ne=arguments.length==4?j+Math.round(arguments[3].evaluate(p).numberValue()):void 0;return new R(C.substring(j,ne))},Qe.stringLength=function(){var p=arguments[0],C;if(arguments.length==1)C=ke.prototype.stringForNode(p.contextNode);else if(arguments.length==2)C=arguments[1].evaluate(p).stringValue();else throw new Error("Function string-length expects (string?)");return new N(C.length)},Qe.normalizeSpace=function(){var p=arguments[0],C;if(arguments.length==1)C=ke.prototype.stringForNode(p.contextNode);else if(arguments.length==2)C=arguments[1].evaluate(p).stringValue();else throw new Error("Function normalize-space expects (string?)");for(var j=0,ne=C.length-1;Ke.isSpace(C.charCodeAt(ne));)ne--;for(var oe="";j<=ne&&Ke.isSpace(C.charCodeAt(j));)j++;for(;j<=ne;)if(Ke.isSpace(C.charCodeAt(j)))for(oe+=" ";j<=ne&&Ke.isSpace(C.charCodeAt(j));)j++;else oe+=C.charAt(j),j++;return new R(oe)},Qe.translate=function(p,C,j,ne){if(arguments.length!=4)throw new Error("Function translate expects (string, string, string)");var oe=C.evaluate(p).stringValue(),H=j.evaluate(p).stringValue(),Ge=ne.evaluate(p).stringValue(),St=n(function($e,yt,Wn){return yt in $e||($e[yt]=Wn>Ge.length?"":Ge[Wn]),$e},{},H),Ut=l("",s(function($e){return $e in St?St[$e]:$e},oe));return new R(Ut)},Qe.boolean_=function(){var p=arguments[0];if(arguments.length!=2)throw new Error("Function boolean expects (object)");return arguments[1].evaluate(p).bool()},Qe.not=function(p,C){if(arguments.length!=2)throw new Error("Function not expects (object)");return C.evaluate(p).bool().not()},Qe.true_=function(){if(arguments.length!=1)throw new Error("Function true expects ()");return Ee.true_},Qe.false_=function(){if(arguments.length!=1)throw new Error("Function false expects ()");return Ee.false_},Qe.lang=function(){var p=arguments[0];if(arguments.length!=2)throw new Error("Function lang expects (string)");for(var C,j=p.contextNode;j!=null&&j.nodeType!=v.DOCUMENT_NODE;j=j.parentNode){var ne=j.getAttributeNS(w.XML_NAMESPACE_URI,"lang");if(ne!=null){C=String(ne);break}}if(C==null)return Ee.false_;var oe=arguments[1].evaluate(p).stringValue();return new Ee(C.substring(0,oe.length)==oe&&(C.length==oe.length||C.charAt(oe.length)=="-"))},Qe.number=function(){var p=arguments[0];if(!(arguments.length==1||arguments.length==2))throw new Error("Function number expects (object?)");return arguments.length==1?new N(ke.prototype.stringForNode(p.contextNode)):arguments[1].evaluate(p).number()},Qe.sum=function(){var p=arguments[0],C;if(arguments.length!=2||!Ke.instance_of(C=arguments[1].evaluate(p),ke))throw new Error("Function sum expects (node-set)");C=C.toUnsortedArray();for(var j=0,ne=0;ne<C.length;ne++)j+=new N(ke.prototype.stringForNode(C[ne])).numberValue();return new N(j)},Qe.floor=function(){var p=arguments[0];if(arguments.length!=2)throw new Error("Function floor expects (number)");return new N(Math.floor(arguments[1].evaluate(p).numberValue()))},Qe.ceiling=function(){var p=arguments[0];if(arguments.length!=2)throw new Error("Function ceiling expects (number)");return new N(Math.ceil(arguments[1].evaluate(p).numberValue()))},Qe.round=function(){var p=arguments[0];if(arguments.length!=2)throw new Error("Function round expects (number)");return new N(Math.round(arguments[1].evaluate(p).numberValue()))};var Ke=new Object;Ke.isAttribute=function(p){return p&&(p.nodeType===v.ATTRIBUTE_NODE||p.ownerElement)},Ke.splitQName=function(p){var C=p.indexOf(":");return C==-1?[null,p]:[p.substring(0,C),p.substring(C+1)]},Ke.resolveQName=function(p,C,j,ne){var oe=Ke.splitQName(p);return oe[0]!=null?oe[0]=C.getNamespace(oe[0],j):ne?(oe[0]=C.getNamespace("",j),oe[0]==null&&(oe[0]="")):oe[0]="",oe},Ke.isSpace=function(p){return p==9||p==13||p==10||p==32},Ke.isLetter=function(p){return p>=65&&p<=90||p>=97&&p<=122||p>=192&&p<=214||p>=216&&p<=246||p>=248&&p<=255||p>=256&&p<=305||p>=308&&p<=318||p>=321&&p<=328||p>=330&&p<=382||p>=384&&p<=451||p>=461&&p<=496||p>=500&&p<=501||p>=506&&p<=535||p>=592&&p<=680||p>=699&&p<=705||p==902||p>=904&&p<=906||p==908||p>=910&&p<=929||p>=931&&p<=974||p>=976&&p<=982||p==986||p==988||p==990||p==992||p>=994&&p<=1011||p>=1025&&p<=1036||p>=1038&&p<=1103||p>=1105&&p<=1116||p>=1118&&p<=1153||p>=1168&&p<=1220||p>=1223&&p<=1224||p>=1227&&p<=1228||p>=1232&&p<=1259||p>=1262&&p<=1269||p>=1272&&p<=1273||p>=1329&&p<=1366||p==1369||p>=1377&&p<=1414||p>=1488&&p<=1514||p>=1520&&p<=1522||p>=1569&&p<=1594||p>=1601&&p<=1610||p>=1649&&p<=1719||p>=1722&&p<=1726||p>=1728&&p<=1742||p>=1744&&p<=1747||p==1749||p>=1765&&p<=1766||p>=2309&&p<=2361||p==2365||p>=2392&&p<=2401||p>=2437&&p<=2444||p>=2447&&p<=2448||p>=2451&&p<=2472||p>=2474&&p<=2480||p==2482||p>=2486&&p<=2489||p>=2524&&p<=2525||p>=2527&&p<=2529||p>=2544&&p<=2545||p>=2565&&p<=2570||p>=2575&&p<=2576||p>=2579&&p<=2600||p>=2602&&p<=2608||p>=2610&&p<=2611||p>=2613&&p<=2614||p>=2616&&p<=2617||p>=2649&&p<=2652||p==2654||p>=2674&&p<=2676||p>=2693&&p<=2699||p==2701||p>=2703&&p<=2705||p>=2707&&p<=2728||p>=2730&&p<=2736||p>=2738&&p<=2739||p>=2741&&p<=2745||p==2749||p==2784||p>=2821&&p<=2828||p>=2831&&p<=2832||p>=2835&&p<=2856||p>=2858&&p<=2864||p>=2866&&p<=2867||p>=2870&&p<=2873||p==2877||p>=2908&&p<=2909||p>=2911&&p<=2913||p>=2949&&p<=2954||p>=2958&&p<=2960||p>=2962&&p<=2965||p>=2969&&p<=2970||p==2972||p>=2974&&p<=2975||p>=2979&&p<=2980||p>=2984&&p<=2986||p>=2990&&p<=2997||p>=2999&&p<=3001||p>=3077&&p<=3084||p>=3086&&p<=3088||p>=3090&&p<=3112||p>=3114&&p<=3123||p>=3125&&p<=3129||p>=3168&&p<=3169||p>=3205&&p<=3212||p>=3214&&p<=3216||p>=3218&&p<=3240||p>=3242&&p<=3251||p>=3253&&p<=3257||p==3294||p>=3296&&p<=3297||p>=3333&&p<=3340||p>=3342&&p<=3344||p>=3346&&p<=3368||p>=3370&&p<=3385||p>=3424&&p<=3425||p>=3585&&p<=3630||p==3632||p>=3634&&p<=3635||p>=3648&&p<=3653||p>=3713&&p<=3714||p==3716||p>=3719&&p<=3720||p==3722||p==3725||p>=3732&&p<=3735||p>=3737&&p<=3743||p>=3745&&p<=3747||p==3749||p==3751||p>=3754&&p<=3755||p>=3757&&p<=3758||p==3760||p>=3762&&p<=3763||p==3773||p>=3776&&p<=3780||p>=3904&&p<=3911||p>=3913&&p<=3945||p>=4256&&p<=4293||p>=4304&&p<=4342||p==4352||p>=4354&&p<=4355||p>=4357&&p<=4359||p==4361||p>=4363&&p<=4364||p>=4366&&p<=4370||p==4412||p==4414||p==4416||p==4428||p==4430||p==4432||p>=4436&&p<=4437||p==4441||p>=4447&&p<=4449||p==4451||p==4453||p==4455||p==4457||p>=4461&&p<=4462||p>=4466&&p<=4467||p==4469||p==4510||p==4520||p==4523||p>=4526&&p<=4527||p>=4535&&p<=4536||p==4538||p>=4540&&p<=4546||p==4587||p==4592||p==4601||p>=7680&&p<=7835||p>=7840&&p<=7929||p>=7936&&p<=7957||p>=7960&&p<=7965||p>=7968&&p<=8005||p>=8008&&p<=8013||p>=8016&&p<=8023||p==8025||p==8027||p==8029||p>=8031&&p<=8061||p>=8064&&p<=8116||p>=8118&&p<=8124||p==8126||p>=8130&&p<=8132||p>=8134&&p<=8140||p>=8144&&p<=8147||p>=8150&&p<=8155||p>=8160&&p<=8172||p>=8178&&p<=8180||p>=8182&&p<=8188||p==8486||p>=8490&&p<=8491||p==8494||p>=8576&&p<=8578||p>=12353&&p<=12436||p>=12449&&p<=12538||p>=12549&&p<=12588||p>=44032&&p<=55203||p>=19968&&p<=40869||p==12295||p>=12321&&p<=12329},Ke.isNCNameChar=function(p){return p>=48&&p<=57||p>=1632&&p<=1641||p>=1776&&p<=1785||p>=2406&&p<=2415||p>=2534&&p<=2543||p>=2662&&p<=2671||p>=2790&&p<=2799||p>=2918&&p<=2927||p>=3047&&p<=3055||p>=3174&&p<=3183||p>=3302&&p<=3311||p>=3430&&p<=3439||p>=3664&&p<=3673||p>=3792&&p<=3801||p>=3872&&p<=3881||p==46||p==45||p==95||Ke.isLetter(p)||p>=768&&p<=837||p>=864&&p<=865||p>=1155&&p<=1158||p>=1425&&p<=1441||p>=1443&&p<=1465||p>=1467&&p<=1469||p==1471||p>=1473&&p<=1474||p==1476||p>=1611&&p<=1618||p==1648||p>=1750&&p<=1756||p>=1757&&p<=1759||p>=1760&&p<=1764||p>=1767&&p<=1768||p>=1770&&p<=1773||p>=2305&&p<=2307||p==2364||p>=2366&&p<=2380||p==2381||p>=2385&&p<=2388||p>=2402&&p<=2403||p>=2433&&p<=2435||p==2492||p==2494||p==2495||p>=2496&&p<=2500||p>=2503&&p<=2504||p>=2507&&p<=2509||p==2519||p>=2530&&p<=2531||p==2562||p==2620||p==2622||p==2623||p>=2624&&p<=2626||p>=2631&&p<=2632||p>=2635&&p<=2637||p>=2672&&p<=2673||p>=2689&&p<=2691||p==2748||p>=2750&&p<=2757||p>=2759&&p<=2761||p>=2763&&p<=2765||p>=2817&&p<=2819||p==2876||p>=2878&&p<=2883||p>=2887&&p<=2888||p>=2891&&p<=2893||p>=2902&&p<=2903||p>=2946&&p<=2947||p>=3006&&p<=3010||p>=3014&&p<=3016||p>=3018&&p<=3021||p==3031||p>=3073&&p<=3075||p>=3134&&p<=3140||p>=3142&&p<=3144||p>=3146&&p<=3149||p>=3157&&p<=3158||p>=3202&&p<=3203||p>=3262&&p<=3268||p>=3270&&p<=3272||p>=3274&&p<=3277||p>=3285&&p<=3286||p>=3330&&p<=3331||p>=3390&&p<=3395||p>=3398&&p<=3400||p>=3402&&p<=3405||p==3415||p==3633||p>=3636&&p<=3642||p>=3655&&p<=3662||p==3761||p>=3764&&p<=3769||p>=3771&&p<=3772||p>=3784&&p<=3789||p>=3864&&p<=3865||p==3893||p==3895||p==3897||p==3902||p==3903||p>=3953&&p<=3972||p>=3974&&p<=3979||p>=3984&&p<=3989||p==3991||p>=3993&&p<=4013||p>=4017&&p<=4023||p==4025||p>=8400&&p<=8412||p==8417||p>=12330&&p<=12335||p==12441||p==12442||p==183||p==720||p==721||p==903||p==1600||p==3654||p==3782||p==12293||p>=12337&&p<=12341||p>=12445&&p<=12446||p>=12540&&p<=12542},Ke.coalesceText=function(p){for(var C=p.firstChild;C!=null;C=C.nextSibling)if(C.nodeType==v.TEXT_NODE||C.nodeType==v.CDATA_SECTION_NODE){var j=C.nodeValue,ne=C;for(C=C.nextSibling;C!=null&&(C.nodeType==v.TEXT_NODE||C.nodeType==v.CDATA_SECTION_NODE);){j+=C.nodeValue;var oe=C;C=C.nextSibling,oe.parentNode.removeChild(oe)}if(ne.nodeType==v.CDATA_SECTION_NODE){var H=ne.parentNode;if(ne.nextSibling==null)H.removeChild(ne),H.appendChild(H.ownerDocument.createTextNode(j));else{var Ge=ne.nextSibling;H.removeChild(ne),H.insertBefore(H.ownerDocument.createTextNode(j),Ge)}}else ne.nodeValue=j;if(C==null)break}else C.nodeType==v.ELEMENT_NODE&&Ke.coalesceText(C)},Ke.instance_of=function(p,C){for(;p!=null;){if(p.constructor===C)return!0;if(p===Object)return!1;p=p.constructor.superclass}return!1},Ke.getElementById=function(p,C){if(p.nodeType==v.ELEMENT_NODE&&(p.getAttribute("id")==C||p.getAttributeNS(null,"id")==C))return p;for(var j=p.firstChild;j!=null;j=j.nextSibling){var ne=Ke.getElementById(j,C);if(ne!=null)return ne}return null};var Rs=(function(){function p(j,ne){var oe=ne?": "+ne.toString():"";switch(j){case C.INVALID_EXPRESSION_ERR:return"Invalid expression"+oe;case C.TYPE_ERR:return"Type error"+oe}return null}o(p,"getMessage");function C(j,ne,oe){var H=Error.call(this,p(j,ne)||oe);return H.code=j,H.exception=ne,H}return o(C,"XPathException"),C.prototype=Object.create(Error.prototype),C.prototype.constructor=C,C.superclass=Error,C.prototype.toString=function(){return this.message},C.fromMessage=function(j,ne){return new C(null,ne,j)},C.INVALID_EXPRESSION_ERR=51,C.TYPE_ERR=52,C})();bi.prototype={},bi.prototype.constructor=bi,bi.superclass=Object.prototype;function bi(p,C,j){this.xpath=j.parse(p),this.context=new Ir,this.context.namespaceResolver=new dh(C)}o(bi,"XPathExpression"),bi.getOwnerDocument=function(p){return p.nodeType===v.DOCUMENT_NODE?p:p.ownerDocument},bi.detectHtmlDom=function(p){if(!p)return!1;var C=bi.getOwnerDocument(p);try{return C.implementation.hasFeature("HTML","2.0")}catch{return!0}},bi.prototype.evaluate=function(p,C,j){this.context.expressionContextNode=p,this.context.caseInsensitive=bi.detectHtmlDom(p);var ne=this.xpath.evaluate(this.context);return new Tt(ne,C)},dh.prototype={},dh.prototype.constructor=dh,dh.superclass=Object.prototype;function dh(p){this.xpathNSResolver=p}o(dh,"XPathNSResolverWrapper"),dh.prototype.getNamespace=function(p,C){return this.xpathNSResolver==null?null:this.xpathNSResolver.lookupNamespaceURI(p)},mh.prototype={},mh.prototype.constructor=mh,mh.superclass=Object.prototype;function mh(p){this.node=p,this.namespaceResolver=new wi}o(mh,"NodeXPathNSResolver"),mh.prototype.lookupNamespaceURI=function(p){return this.namespaceResolver.getNamespace(p,this.node)},Tt.prototype={},Tt.prototype.constructor=Tt,Tt.superclass=Object.prototype;function Tt(p,C){switch(C==Tt.ANY_TYPE&&(p.constructor===R?C=Tt.STRING_TYPE:p.constructor===N?C=Tt.NUMBER_TYPE:p.constructor===Ee?C=Tt.BOOLEAN_TYPE:p.constructor===ke&&(C=Tt.UNORDERED_NODE_ITERATOR_TYPE)),this.resultType=C,C){case Tt.NUMBER_TYPE:this.numberValue=p.numberValue();return;case Tt.STRING_TYPE:this.stringValue=p.stringValue();return;case Tt.BOOLEAN_TYPE:this.booleanValue=p.booleanValue();return;case Tt.ANY_UNORDERED_NODE_TYPE:case Tt.FIRST_ORDERED_NODE_TYPE:if(p.constructor===ke){this.singleNodeValue=p.first();return}break;case Tt.UNORDERED_NODE_ITERATOR_TYPE:case Tt.ORDERED_NODE_ITERATOR_TYPE:if(p.constructor===ke){this.invalidIteratorState=!1,this.nodes=p.toArray(),this.iteratorIndex=0;return}break;case Tt.UNORDERED_NODE_SNAPSHOT_TYPE:case Tt.ORDERED_NODE_SNAPSHOT_TYPE:if(p.constructor===ke){this.nodes=p.toArray(),this.snapshotLength=this.nodes.length;return}break}throw new Rs(Rs.TYPE_ERR)}o(Tt,"XPathResult"),Tt.prototype.iterateNext=function(){if(this.resultType!=Tt.UNORDERED_NODE_ITERATOR_TYPE&&this.resultType!=Tt.ORDERED_NODE_ITERATOR_TYPE)throw new Rs(Rs.TYPE_ERR);return this.nodes[this.iteratorIndex++]},Tt.prototype.snapshotItem=function(p){if(this.resultType!=Tt.UNORDERED_NODE_SNAPSHOT_TYPE&&this.resultType!=Tt.ORDERED_NODE_SNAPSHOT_TYPE)throw new Rs(Rs.TYPE_ERR);return this.nodes[p]},Tt.ANY_TYPE=0,Tt.NUMBER_TYPE=1,Tt.STRING_TYPE=2,Tt.BOOLEAN_TYPE=3,Tt.UNORDERED_NODE_ITERATOR_TYPE=4,Tt.ORDERED_NODE_ITERATOR_TYPE=5,Tt.UNORDERED_NODE_SNAPSHOT_TYPE=6,Tt.ORDERED_NODE_SNAPSHOT_TYPE=7,Tt.ANY_UNORDERED_NODE_TYPE=8,Tt.FIRST_ORDERED_NODE_TYPE=9;function XO(p,C){p.createExpression=function(j,ne){try{return new bi(j,ne,C)}catch(oe){throw new Rs(Rs.INVALID_EXPRESSION_ERR,oe)}},p.createNSResolver=function(j){return new mh(j)},p.evaluate=function(j,ne,oe,H,Ge){if(H<0||H>9)throw{code:0,toString:o(function(){return"Request type not supported"},"toString")};return p.createExpression(j,oe,C).evaluate(ne,H,Ge)}}o(XO,"installDOM3XPathSupport");try{var GO=!0;try{document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("XPath",null)&&(GO=!1)}catch{}GO&&XO(document,new y)}catch{}XO(r,new y),(function(){var p=new y,C=new wi,j=new Vr,ne=new ar;function oe(Ue){return{getNamespace:o(function(Mt,ss){var jo=Ue(Mt,ss);return jo||C.getNamespace(Mt,ss)},"getNamespace")}}o(oe,"makeNSResolverFromFunction");function H(Ue){return oe(Ue.getNamespace.bind(Ue))}o(H,"makeNSResolverFromObject");function Ge(Ue){return oe(function(Mt){return Ue[Mt]})}o(Ge,"makeNSResolverFromMap");function St(Ue){return Ue&&typeof Ue.getNamespace=="function"?H(Ue):typeof Ue=="function"?oe(Ue):typeof Ue=="object"?Ge(Ue):C}o(St,"makeNSResolver");function Ut(Ue){if(Ue===null||typeof Ue>"u"||Ue instanceof R||Ue instanceof Ee||Ue instanceof N||Ue instanceof ke)return Ue;switch(typeof Ue){case"string":return new R(Ue);case"boolean":return new Ee(Ue);case"number":return new N(Ue)}var Mt=new ke;return Mt.addArray([].concat(Ue)),Mt}o(Ut,"convertValue");function $e(Ue){return function(Mt){var ss=Array.prototype.slice.call(arguments,1).map(function(qK){return qK.evaluate(Mt)}),jo=Ue.apply(this,[].concat(Mt,ss));return Ut(jo)}}o($e,"makeEvaluator");function yt(Ue){return{getFunction:o(function(Mt,ss){var jo=Ue(Mt,ss);return jo?$e(jo):j.getFunction(Mt,ss)},"getFunction")}}o(yt,"makeFunctionResolverFromFunction");function Wn(Ue){return yt(Ue.getFunction.bind(Ue))}o(Wn,"makeFunctionResolverFromObject");function Xi(Ue){return yt(function(Mt){return Ue[Mt]})}o(Xi,"makeFunctionResolverFromMap");function or(Ue){return Ue&&typeof Ue.getFunction=="function"?Wn(Ue):typeof Ue=="function"?yt(Ue):typeof Ue=="object"?Xi(Ue):j}o(or,"makeFunctionResolver");function Mo(Ue){return{getVariable:o(function(Mt,ss){var jo=Ue(Mt,ss);return Ut(jo)},"getVariable")}}o(Mo,"makeVariableResolverFromFunction");function FK(Ue){if(Ue){if(typeof Ue.getVariable=="function")return Mo(Ue.getVariable.bind(Ue));if(typeof Ue=="function")return Mo(Ue);if(typeof Ue=="object")return Mo(function(Mt){return Ue[Mt]})}return ne}o(FK,"makeVariableResolver");function zO(Ue,Mt,ss){Ue in ss&&(Mt[Ue]=ss[Ue])}o(zO,"copyIfPresent");function UK(Ue){var Mt=new Ir;return Ue?(Mt.namespaceResolver=St(Ue.namespaces),Mt.functionResolver=or(Ue.functions),Mt.variableResolver=FK(Ue.variables),Mt.expressionContextNode=Ue.node,zO("allowAnyNamespaceForNoPrefix",Mt,Ue),zO("isHtml",Mt,Ue)):Mt.namespaceResolver=C,Mt}o(UK,"makeContext");function VK(Ue,Mt){var ss=UK(Mt);return Ue.evaluate(ss)}o(VK,"evaluate");var MK={evaluate:o(function(Ue){return VK(this.expression,Ue)},"evaluate"),evaluateNumber:o(function(Ue){return this.evaluate(Ue).numberValue()},"evaluateNumber"),evaluateString:o(function(Ue){return this.evaluate(Ue).stringValue()},"evaluateString"),evaluateBoolean:o(function(Ue){return this.evaluate(Ue).booleanValue()},"evaluateBoolean"),evaluateNodeSet:o(function(Ue){return this.evaluate(Ue).nodeset()},"evaluateNodeSet"),select:o(function(Ue){return this.evaluateNodeSet(Ue).toArray()},"select"),select1:o(function(Ue){return this.select(Ue)[0]},"select1")};function jK(Ue){var Mt=p.parse(Ue);return Object.create(MK,{expression:{value:Mt}})}o(jK,"parse"),r.parse=jK})(),m(r,{XPath:w,XPathParser:y,XPathResult:Tt,Step:_,PathExpr:z,NodeTest:D,LocationPath:Ie,OrOperation:k,AndOperation:I,BarOperation:me,EqualsOperation:T,NotEqualOperation:V,LessThanOperation:U,GreaterThanOperation:M,LessThanOrEqualOperation:ie,GreaterThanOrEqualOperation:Z,PlusOperation:ue,MinusOperation:$,MultiplyOperation:de,DivOperation:xe,ModOperation:ve,UnaryMinusOperation:b,FunctionCall:q,VariableReference:Y,XPathContext:Ir,XNodeSet:ke,XBoolean:Ee,XString:R,XNumber:N,NamespaceResolver:wi,FunctionResolver:Vr,VariableResolver:ar,Utilities:Ke}),r.select=function(p,C,j){return r.selectWithResolver(p,C,null,j)},r.useNamespaces=function(p){var C={mappings:p||{},lookupNamespaceURI:o(function(j){return this.mappings[j]},"lookupNamespaceURI")};return function(j,ne,oe){return r.selectWithResolver(j,ne,C,oe)}},r.selectWithResolver=function(p,C,j,ne){var oe=new bi(p,j,new y),H=Tt.ANY_TYPE,Ge=oe.evaluate(C,H,null);return Ge.resultType==Tt.STRING_TYPE?Ge=Ge.stringValue:Ge.resultType==Tt.NUMBER_TYPE?Ge=Ge.numberValue:Ge.resultType==Tt.BOOLEAN_TYPE?Ge=Ge.booleanValue:(Ge=Ge.nodes,ne&&(Ge=Ge[0])),Ge},r.select1=function(p,C){return r.select(p,C,!0)};var aC=o(function(p){return p&&typeof p.nodeType=="number"&&Number.isInteger(p.nodeType)&&p.nodeType>=1&&p.nodeType<=11&&typeof p.nodeName=="string"},"isNodeLike"),LK=o(function(p){return Array.isArray(p)&&p.every(aC)},"isArrayOfNodes"),Fa=o(function(p){return function(C){return aC(C)&&C.nodeType===p}},"isNodeOfType");m(r,{isNodeLike:aC,isArrayOfNodes:LK,isElement:Fa(v.ELEMENT_NODE),isAttribute:Fa(v.ATTRIBUTE_NODE),isTextNode:Fa(v.TEXT_NODE),isCDATASection:Fa(v.CDATA_SECTION_NODE),isProcessingInstruction:Fa(v.PROCESSING_INSTRUCTION_NODE),isComment:Fa(v.COMMENT_NODE),isDocumentNode:Fa(v.DOCUMENT_NODE),isDocumentTypeNode:Fa(v.DOCUMENT_TYPE_NODE),isDocumentFragment:Fa(v.DOCUMENT_FRAGMENT_NODE)})})(Kne)});var np=X(ft=>{"use strict";Object.defineProperty(ft,"__esModule",{value:!0});ft.assertIsDocumentFragmentNode=ft.assertIsDocumentTypeNode=ft.assertIsDocumentNode=ft.assertIsCommentNode=ft.assertIsProcessingInstructionNode=ft.assertIsCDATASectionNode=ft.assertIsTextNode=ft.assertIsAttributeNode=ft.assertIsElementNode=ft.isDocumentFragmentNode=ft.isDocumentTypeNode=ft.isDocumentNode=ft.isCommentNode=ft.isProcessingInstructionNode=ft.isCDATASectionNode=ft.isTextNode=ft.isAttributeNode=ft.isElementNode=ft.assertIsArrayOfNodes=ft.isArrayOfNodes=ft.assertIsNodeLike=ft.isNodeLike=ft.NodeTypes=void 0;var Hr;(function(r){r[r.ELEMENT_NODE=1]="ELEMENT_NODE",r[r.ATTRIBUTE_NODE=2]="ATTRIBUTE_NODE",r[r.TEXT_NODE=3]="TEXT_NODE",r[r.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",r[r.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",r[r.COMMENT_NODE=8]="COMMENT_NODE",r[r.DOCUMENT_NODE=9]="DOCUMENT_NODE",r[r.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",r[r.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE"})(Hr||(ft.NodeTypes=Hr={}));function BE(r){return r&&typeof r=="object"&&Number.isInteger(r.nodeType)&&r.nodeType>=1&&r.nodeType<=11&&typeof r.nodeName=="string"&&typeof r.appendChild=="function"&&typeof r.removeChild=="function"}o(BE,"isNodeLike");ft.isNodeLike=BE;function $ne(r){if(!BE(r))throw new Error(`Value is not a Node-like object. Received: ${r}`)}o($ne,"assertIsNodeLike");ft.assertIsNodeLike=$ne;function sU(r){return Array.isArray(r)&&r.every(BE)}o(sU,"isArrayOfNodes");ft.isArrayOfNodes=sU;function Xne(r){if(!sU(r))throw new Error("Value is not an array of Nodes")}o(Xne,"assertIsArrayOfNodes");ft.assertIsArrayOfNodes=Xne;function ha(r,e){return BE(e)&&e.nodeType===r}o(ha,"isNodeOfType");function za(r,e){let t=Object.keys(Hr).find(n=>Hr[n]===r);if(!ha(r,e))throw new Error(`Value is not of type ${t}`)}o(za,"assertIsNodeOfType");var Gne=o(r=>ha(Hr.ELEMENT_NODE,r),"isElementNode");ft.isElementNode=Gne;var zne=o(r=>ha(Hr.ATTRIBUTE_NODE,r),"isAttributeNode");ft.isAttributeNode=zne;var Wne=o(r=>ha(Hr.TEXT_NODE,r),"isTextNode");ft.isTextNode=Wne;var Jne=o(r=>ha(Hr.CDATA_SECTION_NODE,r),"isCDATASectionNode");ft.isCDATASectionNode=Jne;var Yne=o(r=>ha(Hr.PROCESSING_INSTRUCTION_NODE,r),"isProcessingInstructionNode");ft.isProcessingInstructionNode=Yne;var Qne=o(r=>ha(Hr.COMMENT_NODE,r),"isCommentNode");ft.isCommentNode=Qne;var Zne=o(r=>ha(Hr.DOCUMENT_NODE,r),"isDocumentNode");ft.isDocumentNode=Zne;var ese=o(r=>ha(Hr.DOCUMENT_TYPE_NODE,r),"isDocumentTypeNode");ft.isDocumentTypeNode=ese;var tse=o(r=>ha(Hr.DOCUMENT_FRAGMENT_NODE,r),"isDocumentFragmentNode");ft.isDocumentFragmentNode=tse;var rse=o(r=>{za(Hr.ELEMENT_NODE,r)},"assertIsElementNode");ft.assertIsElementNode=rse;var nse=o(r=>za(Hr.ATTRIBUTE_NODE,r),"assertIsAttributeNode");ft.assertIsAttributeNode=nse;var sse=o(r=>za(Hr.TEXT_NODE,r),"assertIsTextNode");ft.assertIsTextNode=sse;var ise=o(r=>za(Hr.CDATA_SECTION_NODE,r),"assertIsCDATASectionNode");ft.assertIsCDATASectionNode=ise;var ase=o(r=>za(Hr.PROCESSING_INSTRUCTION_NODE,r),"assertIsProcessingInstructionNode");ft.assertIsProcessingInstructionNode=ase;var ose=o(r=>za(Hr.COMMENT_NODE,r),"assertIsCommentNode");ft.assertIsCommentNode=ose;var use=o(r=>za(Hr.DOCUMENT_NODE,r),"assertIsDocumentNode");ft.assertIsDocumentNode=use;var cse=o(r=>za(Hr.DOCUMENT_TYPE_NODE,r),"assertIsDocumentTypeNode");ft.assertIsDocumentTypeNode=cse;var lse=o(r=>za(Hr.DOCUMENT_FRAGMENT_NODE,r),"assertIsDocumentFragmentNode");ft.assertIsDocumentFragmentNode=lse});var yg=X(Wt=>{"use strict";Object.defineProperty(Wt,"__esModule",{value:!0});Wt.validateDigestValue=Wt.findAncestorNs=Wt.derToPem=Wt.pemToDer=Wt.normalizePem=Wt.BASE64_REGEX=Wt.EXTRACT_X509_CERTS=Wt.PEM_FORMAT_REGEX=Wt.encodeSpecialCharactersInText=Wt.encodeSpecialCharactersInAttribute=Wt.findChilds=Wt.findChildren=Wt.findAttr=Wt.isArrayHasLength=void 0;var fse=DE(),LI=np();function iU(r){return Array.isArray(r)&&r.length>0}o(iU,"isArrayHasLength");Wt.isArrayHasLength=iU;function hse(r,e,t){return r.localName===e&&(r.namespaceURI===t||t==null)}o(hse,"attrEqualsExplicitly");function pse(r,e,t,n){return r.localName===e&&(!r.namespaceURI&&n?.namespaceURI===t||t==null)}o(pse,"attrEqualsImplicitly");function dse(r,e,t){for(let n=0;n<r.attributes.length;n++){let s=r.attributes[n];if(hse(s,e,t)||pse(s,e,t,r))return s}return null}o(dse,"findAttr");Wt.findAttr=dse;function aU(r,e,t){let n=r.documentElement??r,s=[];for(let i=0;i<n.childNodes.length;i++){let a=n.childNodes[i];LI.isElementNode(a)&&a.localName===e&&(a.namespaceURI===t||t==null)&&s.push(a)}return s}o(aU,"findChildren");Wt.findChildren=aU;function mse(r,e,t){return aU(r,e,t)}o(mse,"findChilds");Wt.findChilds=mse;var gse={"&":"&","<":"<",'"':""","\r":"
","\n":"
"," ":"	"},yse={"&":"&","<":"<",">":">","\r":"
"};function vse(r){return r.replace(/([&<"\r\n\t])/g,function(e,t){return gse[t]})}o(vse,"encodeSpecialCharactersInAttribute");Wt.encodeSpecialCharactersInAttribute=vse;function xse(r){return r.replace(/([&<>\r])/g,function(e,t){return yse[t]})}o(xse,"encodeSpecialCharactersInText");Wt.encodeSpecialCharactersInText=xse;Wt.PEM_FORMAT_REGEX=new RegExp("^-----BEGIN [A-Z ]{1,48}-----([^-]*)-----END [A-Z ]{1,48}-----$","s");Wt.EXTRACT_X509_CERTS=new RegExp("-----BEGIN CERTIFICATE-----[^-]*-----END CERTIFICATE-----","g");Wt.BASE64_REGEX=new RegExp("^(?:[A-Za-z0-9\\+\\/]{4}\\n{0,1})*(?:[A-Za-z0-9\\+\\/]{2}==|[A-Za-z0-9\\+\\/]{3}=)?$","s");function kI(r){return`${(r.trim().replace(/(\r\n|\r)/g,`
|
|
45
45
|
`).match(/.{1,64}/g)??[]).join(`
|
|
46
46
|
`)}
|
|
47
47
|
`}o(kI,"normalizePem");Wt.normalizePem=kI;function Ese(r){if(!Wt.PEM_FORMAT_REGEX.test(r.trim()))throw new Error("Invalid PEM format.");return Buffer.from(r.replace(/(\r\n|\r)/g,"").replace(/-----BEGIN [A-Z\x20]{1,48}-----\n?/,"").replace(/-----END [A-Z\x20]{1,48}-----\n?/,""),"base64")}o(Ese,"pemToDer");Wt.pemToDer=Ese;function wse(r,e){let t=Buffer.isBuffer(r)?r.toString("base64").trim():r.replace(/(\r\n|\r)/g,"").trim();if(Wt.PEM_FORMAT_REGEX.test(t))return kI(t);if(Wt.BASE64_REGEX.test(t.replace(/ /g,""))){if(e==null)throw new Error("PEM label is required when DER is given.");let n=`-----BEGIN ${e}-----
|
|
@@ -62,10 +62,10 @@ Line: `+R.line+`
|
|
|
62
62
|
Column: `+R.column+`
|
|
63
63
|
Char: `+R.c),N=new Error(N),R.error=N,U(R,"onerror",N),R}o(ve,"error");function me(R){return R.sawRoot&&!R.closedRoot&&z(R,"Unclosed root tag"),R.state!==T.BEGIN&&R.state!==T.BEGIN_WHITESPACE&&R.state!==T.TEXT&&ve(R,"Unexpected end"),de(R),R.c="",R.closed=!0,U(R,"onend"),t.call(R,R.strict,R.opt),R}o(me,"end");function z(R,N){if(typeof R!="object"||!(R instanceof t))throw new Error("bad call to strictFail");R.strict&&ve(R,N)}o(z,"strictFail");function ee(R){R.strict||(R.tagName=R.tagName[R.looseCase]());var N=R.tags[R.tags.length-1]||R,te=R.tag={name:R.tagName,attributes:{}};R.opt.xmlns&&(te.ns=N.ns),R.attribList.length=0,$(R,"onopentagstart",te)}o(ee,"newTag");function le(R,N){var te=R.indexOf(":"),W=te<0?["",R]:R.split(":"),Ee=W[0],rt=W[1];return N&&R==="xmlns"&&(Ee="xmlns",rt=""),{prefix:Ee,local:rt}}o(le,"qname");function Ae(R){if(R.strict||(R.attribName=R.attribName[R.looseCase]()),R.attribList.indexOf(R.attribName)!==-1||R.tag.attributes.hasOwnProperty(R.attribName)){R.attribName=R.attribValue="";return}if(R.opt.xmlns){var N=le(R.attribName,!0),te=N.prefix,W=N.local;if(te==="xmlns")if(W==="xml"&&R.attribValue!==g)z(R,"xml: prefix must be bound to "+g+`
|
|
64
64
|
Actual: `+R.attribValue);else if(W==="xmlns"&&R.attribValue!==m)z(R,"xmlns: prefix must be bound to "+m+`
|
|
65
|
-
Actual: `+R.attribValue);else{var Ee=R.tag,rt=R.tags[R.tags.length-1]||R;Ee.ns===rt.ns&&(Ee.ns=Object.create(rt.ns)),Ee.ns[W]=R.attribValue}R.attribList.push([R.attribName,R.attribValue])}else R.tag.attributes[R.attribName]=R.attribValue,$(R,"onattribute",{name:R.attribName,value:R.attribValue});R.attribName=R.attribValue=""}o(Ae,"attrib");function Ie(R,N){if(R.opt.xmlns){var te=R.tag,W=le(R.tagName);te.prefix=W.prefix,te.local=W.local,te.uri=te.ns[W.prefix]||"",te.prefix&&!te.uri&&(z(R,"Unbound namespace prefix: "+JSON.stringify(R.tagName)),te.uri=W.prefix);var Ee=R.tags[R.tags.length-1]||R;te.ns&&Ee.ns!==te.ns&&Object.keys(te.ns).forEach(function(Rs){$(R,"onopennamespace",{prefix:Rs,uri:te.ns[Rs]})});for(var rt=0,er=R.attribList.length;rt<er;rt++){var ke=R.attribList[rt],dr=ke[0],Ir=ke[1],
|
|
65
|
+
Actual: `+R.attribValue);else{var Ee=R.tag,rt=R.tags[R.tags.length-1]||R;Ee.ns===rt.ns&&(Ee.ns=Object.create(rt.ns)),Ee.ns[W]=R.attribValue}R.attribList.push([R.attribName,R.attribValue])}else R.tag.attributes[R.attribName]=R.attribValue,$(R,"onattribute",{name:R.attribName,value:R.attribValue});R.attribName=R.attribValue=""}o(Ae,"attrib");function Ie(R,N){if(R.opt.xmlns){var te=R.tag,W=le(R.tagName);te.prefix=W.prefix,te.local=W.local,te.uri=te.ns[W.prefix]||"",te.prefix&&!te.uri&&(z(R,"Unbound namespace prefix: "+JSON.stringify(R.tagName)),te.uri=W.prefix);var Ee=R.tags[R.tags.length-1]||R;te.ns&&Ee.ns!==te.ns&&Object.keys(te.ns).forEach(function(Rs){$(R,"onopennamespace",{prefix:Rs,uri:te.ns[Rs]})});for(var rt=0,er=R.attribList.length;rt<er;rt++){var ke=R.attribList[rt],dr=ke[0],Ir=ke[1],ar=le(dr,!0),Vr=ar.prefix,wi=ar.local,Qe=Vr===""?"":te.ns[Vr]||"",Ke={name:dr,value:Ir,prefix:Vr,local:wi,uri:Qe};Vr&&Vr!=="xmlns"&&!Qe&&(z(R,"Unbound namespace prefix: "+JSON.stringify(Vr)),Ke.uri=Vr),R.tag.attributes[dr]=Ke,$(R,"onattribute",Ke)}R.attribList.length=0}R.tag.isSelfClosing=!!N,R.sawRoot=!0,R.tags.push(R.tag),$(R,"onopentag",R.tag),N||(!R.noscript&&R.tagName.toLowerCase()==="script"?R.state=T.SCRIPT:R.state=T.TEXT,R.tag=null,R.tagName=""),R.attribName=R.attribValue="",R.attribList.length=0}o(Ie,"openTag");function _(R){if(!R.tagName){z(R,"Weird empty close tag."),R.textNode+="</>",R.state=T.TEXT;return}if(R.script){if(R.tagName!=="script"){R.script+="</"+R.tagName+">",R.tagName="",R.state=T.SCRIPT;return}$(R,"onscript",R.script),R.script=""}var N=R.tags.length,te=R.tagName;R.strict||(te=te[R.looseCase]());for(var W=te;N--;){var Ee=R.tags[N];if(Ee.name!==W)z(R,"Unexpected close tag");else break}if(N<0){z(R,"Unmatched closing tag: "+R.tagName),R.textNode+="</"+R.tagName+">",R.state=T.TEXT;return}R.tagName=te;for(var rt=R.tags.length;rt-- >N;){var er=R.tag=R.tags.pop();R.tagName=R.tag.name,$(R,"onclosetag",R.tagName);var ke={};for(var dr in er.ns)ke[dr]=er.ns[dr];var Ir=R.tags[R.tags.length-1]||R;R.opt.xmlns&&er.ns!==Ir.ns&&Object.keys(er.ns).forEach(function(ar){var Vr=er.ns[ar];$(R,"onclosenamespace",{prefix:ar,uri:Vr})})}N===0&&(R.closedRoot=!0),R.tagName=R.attribValue=R.attribName="",R.attribList.length=0,R.state=T.TEXT}o(_,"closeTag");function D(R){var N=R.entity,te=N.toLowerCase(),W,Ee="";return R.ENTITIES[N]?R.ENTITIES[N]:R.ENTITIES[te]?R.ENTITIES[te]:(N=te,N.charAt(0)==="#"&&(N.charAt(1)==="x"?(N=N.slice(2),W=parseInt(N,16),Ee=W.toString(16)):(N=N.slice(1),W=parseInt(N,10),Ee=W.toString(10))),N=N.replace(/^0+/,""),isNaN(W)||Ee.toLowerCase()!==N||W<0||W>1114111?(z(R,"Invalid character entity"),"&"+R.entity+";"):String.fromCodePoint(W))}o(D,"parseEntity");function Y(R,N){N==="<"?(R.state=T.OPEN_WAKA,R.startTagPosition=R.position):x(N)||(z(R,"Non-whitespace before first tag."),R.textNode=N,R.state=T.TEXT)}o(Y,"beginWhiteSpace");function q(R,N){var te="";return N<R.length&&(te=R.charAt(N)),te}o(q,"charAt");function Oe(R){var N=this;if(this.error)throw this.error;if(N.closed)return ve(N,"Cannot write after close. Assign an onready handler.");if(R===null)return me(N);typeof R=="object"&&(R=R.toString());for(var te=0,W="";W=q(R,te++),N.c=W,!!W;)switch(N.trackPosition&&(N.position++,W===`
|
|
66
66
|
`?(N.line++,N.column=0):N.column++),N.state){case T.BEGIN:if(N.state=T.BEGIN_WHITESPACE,W==="\uFEFF")continue;Y(N,W);continue;case T.BEGIN_WHITESPACE:Y(N,W);continue;case T.TEXT:if(N.sawRoot&&!N.closedRoot){for(var rt=te-1;W&&W!=="<"&&W!=="&";)W=q(R,te++),W&&N.trackPosition&&(N.position++,W===`
|
|
67
67
|
`?(N.line++,N.column=0):N.column++);N.textNode+=R.substring(rt,te-1)}W==="<"&&!(N.sawRoot&&N.closedRoot&&!N.strict)?(N.state=T.OPEN_WAKA,N.startTagPosition=N.position):(!x(W)&&(!N.sawRoot||N.closedRoot)&&z(N,"Text data outside of root node."),W==="&"?N.state=T.TEXT_ENTITY:N.textNode+=W);continue;case T.SCRIPT:W==="<"?N.state=T.SCRIPT_ENDING:N.script+=W;continue;case T.SCRIPT_ENDING:W==="/"?N.state=T.CLOSE_TAG:(N.script+="<"+W,N.state=T.SCRIPT);continue;case T.OPEN_WAKA:if(W==="!")N.state=T.SGML_DECL,N.sgmlDecl="";else if(!x(W))if(k(y,W))N.state=T.OPEN_TAG,N.tagName=W;else if(W==="/")N.state=T.CLOSE_TAG,N.tagName="";else if(W==="?")N.state=T.PROC_INST,N.procInstName=N.procInstBody="";else{if(z(N,"Unencoded <"),N.startTagPosition+1<N.position){var Ee=N.position-N.startTagPosition;W=new Array(Ee).join(" ")+W}N.textNode+="<"+W,N.state=T.TEXT}continue;case T.SGML_DECL:if(N.sgmlDecl+W==="--"){N.state=T.COMMENT,N.comment="",N.sgmlDecl="";continue}N.doctype&&N.doctype!==!0&&N.sgmlDecl?(N.state=T.DOCTYPE_DTD,N.doctype+="<!"+N.sgmlDecl+W,N.sgmlDecl=""):(N.sgmlDecl+W).toUpperCase()===h?($(N,"onopencdata"),N.state=T.CDATA,N.sgmlDecl="",N.cdata=""):(N.sgmlDecl+W).toUpperCase()===d?(N.state=T.DOCTYPE,(N.doctype||N.sawRoot)&&z(N,"Inappropriately located doctype declaration"),N.doctype="",N.sgmlDecl=""):W===">"?($(N,"onsgmldeclaration",N.sgmlDecl),N.sgmlDecl="",N.state=T.TEXT):(b(W)&&(N.state=T.SGML_DECL_QUOTED),N.sgmlDecl+=W);continue;case T.SGML_DECL_QUOTED:W===N.q&&(N.state=T.SGML_DECL,N.q=""),N.sgmlDecl+=W;continue;case T.DOCTYPE:W===">"?(N.state=T.TEXT,$(N,"ondoctype",N.doctype),N.doctype=!0):(N.doctype+=W,W==="["?N.state=T.DOCTYPE_DTD:b(W)&&(N.state=T.DOCTYPE_QUOTED,N.q=W));continue;case T.DOCTYPE_QUOTED:N.doctype+=W,W===N.q&&(N.q="",N.state=T.DOCTYPE);continue;case T.DOCTYPE_DTD:W==="]"?(N.doctype+=W,N.state=T.DOCTYPE):W==="<"?(N.state=T.OPEN_WAKA,N.startTagPosition=N.position):b(W)?(N.doctype+=W,N.state=T.DOCTYPE_DTD_QUOTED,N.q=W):N.doctype+=W;continue;case T.DOCTYPE_DTD_QUOTED:N.doctype+=W,W===N.q&&(N.state=T.DOCTYPE_DTD,N.q="");continue;case T.COMMENT:W==="-"?N.state=T.COMMENT_ENDING:N.comment+=W;continue;case T.COMMENT_ENDING:W==="-"?(N.state=T.COMMENT_ENDED,N.comment=xe(N.opt,N.comment),N.comment&&$(N,"oncomment",N.comment),N.comment=""):(N.comment+="-"+W,N.state=T.COMMENT);continue;case T.COMMENT_ENDED:W!==">"?(z(N,"Malformed comment"),N.comment+="--"+W,N.state=T.COMMENT):N.doctype&&N.doctype!==!0?N.state=T.DOCTYPE_DTD:N.state=T.TEXT;continue;case T.CDATA:for(var rt=te-1;W&&W!=="]";)W=q(R,te++),W&&N.trackPosition&&(N.position++,W===`
|
|
68
|
-
`?(N.line++,N.column=0):N.column++);N.cdata+=R.substring(rt,te-1),W==="]"&&(N.state=T.CDATA_ENDING);continue;case T.CDATA_ENDING:W==="]"?N.state=T.CDATA_ENDING_2:(N.cdata+="]"+W,N.state=T.CDATA);continue;case T.CDATA_ENDING_2:W===">"?(N.cdata&&$(N,"oncdata",N.cdata),$(N,"onclosecdata"),N.cdata="",N.state=T.TEXT):W==="]"?N.cdata+="]":(N.cdata+="]]"+W,N.state=T.CDATA);continue;case T.PROC_INST:W==="?"?N.state=T.PROC_INST_ENDING:x(W)?N.state=T.PROC_INST_BODY:N.procInstName+=W;continue;case T.PROC_INST_BODY:if(!N.procInstBody&&x(W))continue;W==="?"?N.state=T.PROC_INST_ENDING:N.procInstBody+=W;continue;case T.PROC_INST_ENDING:if(W===">"){let Ir={name:N.procInstName,body:N.procInstBody};ue(N,Ir),$(N,"onprocessinginstruction",Ir),N.procInstName=N.procInstBody="",N.state=T.TEXT}else N.procInstBody+="?"+W,N.state=T.PROC_INST_BODY;continue;case T.OPEN_TAG:k(w,W)?N.tagName+=W:(ee(N),W===">"?Ie(N):W==="/"?N.state=T.OPEN_TAG_SLASH:(x(W)||z(N,"Invalid character in tag name"),N.state=T.ATTRIB));continue;case T.OPEN_TAG_SLASH:W===">"?(Ie(N,!0),_(N)):(z(N,"Forward-slash in opening tag not followed by >"),N.state=T.ATTRIB);continue;case T.ATTRIB:if(x(W))continue;W===">"?Ie(N):W==="/"?N.state=T.OPEN_TAG_SLASH:k(y,W)?(N.attribName=W,N.attribValue="",N.state=T.ATTRIB_NAME):z(N,"Invalid attribute name");continue;case T.ATTRIB_NAME:W==="="?N.state=T.ATTRIB_VALUE:W===">"?(z(N,"Attribute without value"),N.attribValue=N.attribName,Ae(N),Ie(N)):x(W)?N.state=T.ATTRIB_NAME_SAW_WHITE:k(w,W)?N.attribName+=W:z(N,"Invalid attribute name");continue;case T.ATTRIB_NAME_SAW_WHITE:if(W==="=")N.state=T.ATTRIB_VALUE;else{if(x(W))continue;z(N,"Attribute without value"),N.tag.attributes[N.attribName]="",N.attribValue="",$(N,"onattribute",{name:N.attribName,value:""}),N.attribName="",W===">"?Ie(N):k(y,W)?(N.attribName=W,N.state=T.ATTRIB_NAME):(z(N,"Invalid attribute name"),N.state=T.ATTRIB)}continue;case T.ATTRIB_VALUE:if(x(W))continue;b(W)?(N.q=W,N.state=T.ATTRIB_VALUE_QUOTED):(N.opt.unquotedAttributeValues||ve(N,"Unquoted attribute value"),N.state=T.ATTRIB_VALUE_UNQUOTED,N.attribValue=W);continue;case T.ATTRIB_VALUE_QUOTED:if(W!==N.q){W==="&"?N.state=T.ATTRIB_VALUE_ENTITY_Q:N.attribValue+=W;continue}Ae(N),N.q="",N.state=T.ATTRIB_VALUE_CLOSED;continue;case T.ATTRIB_VALUE_CLOSED:x(W)?N.state=T.ATTRIB:W===">"?Ie(N):W==="/"?N.state=T.OPEN_TAG_SLASH:k(y,W)?(z(N,"No whitespace between attributes"),N.attribName=W,N.attribValue="",N.state=T.ATTRIB_NAME):z(N,"Invalid attribute name");continue;case T.ATTRIB_VALUE_UNQUOTED:if(!A(W)){W==="&"?N.state=T.ATTRIB_VALUE_ENTITY_U:N.attribValue+=W;continue}Ae(N),W===">"?Ie(N):N.state=T.ATTRIB;continue;case T.CLOSE_TAG:if(N.tagName)W===">"?_(N):k(w,W)?N.tagName+=W:N.script?(N.script+="</"+N.tagName+W,N.tagName="",N.state=T.SCRIPT):(x(W)||z(N,"Invalid tagname in closing tag"),N.state=T.CLOSE_TAG_SAW_WHITE);else{if(x(W))continue;I(y,W)?N.script?(N.script+="</"+W,N.state=T.SCRIPT):z(N,"Invalid tagname in closing tag."):N.tagName=W}continue;case T.CLOSE_TAG_SAW_WHITE:if(x(W))continue;W===">"?_(N):z(N,"Invalid characters in closing tag");continue;case T.TEXT_ENTITY:case T.ATTRIB_VALUE_ENTITY_Q:case T.ATTRIB_VALUE_ENTITY_U:var er,ke;switch(N.state){case T.TEXT_ENTITY:er=T.TEXT,ke="textNode";break;case T.ATTRIB_VALUE_ENTITY_Q:er=T.ATTRIB_VALUE_QUOTED,ke="attribValue";break;case T.ATTRIB_VALUE_ENTITY_U:er=T.ATTRIB_VALUE_UNQUOTED,ke="attribValue";break}if(W===";"){var dr=D(N);N.opt.unparsedEntities&&!Object.values(r.XML_ENTITIES).includes(dr)?((N.entityCount+=1)>N.opt.maxEntityCount&&ve(N,"Parsed entity count exceeds max entity count"),(N.entityDepth+=1)>N.opt.maxEntityDepth&&ve(N,"Parsed entity depth exceeds max entity depth"),N.entity="",N.state=er,N.write(dr),N.entityDepth-=1):(N[ke]+=dr,N.entity="",N.state=er)}else k(N.entity.length?E:S,W)?N.entity+=W:(z(N,"Invalid character in entity name"),N[ke]+="&"+N.entity+W,N.entity="",N.state=er);continue;default:throw new Error(N,"Unknown state: "+N.state)}return N.position>=N.bufferCheckPosition&&n(N),N}o(Oe,"write");String.fromCodePoint||(function(){var R=String.fromCharCode,N=Math.floor,te=o(function(){var W=16384,Ee=[],rt,er,ke=-1,dr=arguments.length;if(!dr)return"";for(var Ir="";++ke<dr;){var ir=Number(arguments[ke]);if(!isFinite(ir)||ir<0||ir>1114111||N(ir)!==ir)throw RangeError("Invalid code point: "+ir);ir<=65535?Ee.push(ir):(ir-=65536,rt=(ir>>10)+55296,er=ir%1024+56320,Ee.push(rt,er)),(ke+1===dr||Ee.length>W)&&(Ir+=R.apply(null,Ee),Ee.length=0)}return Ir},"fromCodePoint");Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:te,configurable:!0,writable:!0}):String.fromCodePoint=te})()})(typeof ZE>"u"?ZE.sax={}:ZE)});var bV=X(ew=>{"use strict";Object.defineProperty(ew,"__esModule",{value:!0});ew.NamespaceContext=void 0;var jie=class{static{o(this,"NamespaceScope")}constructor(e){this.parent=e,this.namespaces={}}getNamespaceURI(e,t){switch(e){case"xml":return"http://www.w3.org/XML/1998/namespace";case"xmlns":return"http://www.w3.org/2000/xmlns/";default:{let n=this.namespaces[e];return n!=null?n.uri:!t&&this.parent?this.parent.getNamespaceURI(e):null}}}getNamespaceMapping(e){switch(e){case"xml":return{uri:"http://www.w3.org/XML/1998/namespace",prefix:"xml",declared:!0};case"xmlns":return{uri:"http://www.w3.org/2000/xmlns/",prefix:"xmlns",declared:!0};default:{let t=this.namespaces[e];return t??(this.parent?this.parent.getNamespaceMapping(e):null)}}}getPrefix(e,t){switch(e){case"http://www.w3.org/XML/1998/namespace":return"xml";case"http://www.w3.org/2000/xmlns/":return"xmlns";default:for(let n in this.namespaces)if(this.namespaces[n].uri===e)return n;return!t&&this.parent?this.parent.getPrefix(e):null}}},qie=class{static{o(this,"NamespaceContext")}constructor(){this.scopes=[],this.pushContext(),this.prefixCount=0}addNamespace(e,t,n){return this.getNamespaceURI(e,n)===t?!1:this.currentScope?(this.currentScope.namespaces[e]={uri:t,prefix:e,declared:!1},!0):!1}pushContext(){let e=new jie(this.currentScope);return this.scopes.push(e),this.currentScope=e,e}popContext(){let e=this.scopes.pop();return e?this.currentScope=e.parent:this.currentScope=null,e}getNamespaceURI(e,t){return this.currentScope&&this.currentScope.getNamespaceURI(e,t)}getPrefix(e,t){return this.currentScope&&this.currentScope.getPrefix(e,t)}registerNamespace(e){let t=this.getPrefix(e);if(t)return t;for(;t="ns"+ ++this.prefixCount,!!this.getNamespaceURI(t););return this.addNamespace(t,e,!0),t}declareNamespace(e,t){if(this.currentScope){let n=this.currentScope.getNamespaceMapping(e);return n&&n.uri===t&&n.declared?!1:(this.currentScope.namespaces[e]={uri:t,prefix:e,declared:!0},!0)}return!1}};ew.NamespaceContext=qie});var OV=X(We=>{"use strict";var Hie=We&&We.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(We,"__esModule",{value:!0});We.ImportElement=We.IncludeElement=We.BodyElement=We.DefinitionsElement=We.ServiceElement=We.PortElement=We.BindingElement=We.PortTypeElement=We.OperationElement=We.TypesElement=We.SchemaElement=We.DocumentationElement=We.MessageElement=We.AllElement=We.AttributeElement=We.SequenceElement=We.SimpleContentElement=We.ComplexContentElement=We.ComplexTypeElement=We.EnumerationElement=We.ChoiceElement=We.ExtensionElement=We.RestrictionElement=We.SimpleTypeElement=We.OutputElement=We.InputElement=We.AnyElement=We.ElementElement=We.UnexpectedElement=We.Element=void 0;var hD=require("assert"),Kie=Hie(qh()),yr=ds(),$ie=(0,Kie.default)("node-soap"),tw={string:1,boolean:1,decimal:1,float:1,double:1,anyType:1,byte:1,int:1,long:1,short:1,negativeInteger:1,nonNegativeInteger:1,positiveInteger:1,nonPositiveInteger:1,unsignedByte:1,unsignedInt:1,unsignedLong:1,unsignedShort:1,duration:0,dateTime:0,time:0,date:0,gYearMonth:0,gYear:0,gMonthDay:0,gDay:0,gMonth:0,hexBinary:0,base64Binary:0,anyURI:0,QName:0,NOTATION:0},Qt=class{static{o(this,"Element")}constructor(e,t,n,s){this.allowedChildren={},this.children=[];let i=(0,yr.splitQName)(e);this.nsName=e,this.prefix=i.prefix,this.name=i.name,this.children=[],this.xmlns={},this.schemaXmlns={},this._initializeOptions(n);for(let a in t){let u=/^xmlns:?(.*)$/.exec(a);u?this.xmlns[u[1]?u[1]:yr.TNS_PREFIX]=t[a]:a==="value"?this[this.valueKey]=t[a]:this["$"+a]=t[a]}for(let a in s){let u=/^xmlns:?(.*)$/.exec(a);u&&u[1]&&(this.schemaXmlns[u[1]]=s[a])}this.$targetNamespace!==void 0&&(this.xmlns[yr.TNS_PREFIX]=this.$targetNamespace),this.init()}deleteFixedAttrs(){this.children&&this.children.length===0&&delete this.children,this.xmlns&&Object.keys(this.xmlns).length===0&&delete this.xmlns,delete this.nsName,delete this.prefix,delete this.name}startElement(e,t,n,s,i){if(!this.allowedChildren)return;let a=this.allowedChildren[(0,yr.splitQName)(t).name];if(a==null&&!this.strict&&(a=SV),a){let u=new a(t,n,s,i);u.init();let c=e[0];c instanceof bD&&(u.definitionsXmlns=c.xmlns),e.push(u)}else this.unexpected(t)}endElement(e,t){if(this.nsName===t){if(e.length<2)return;let n=e[e.length-2];this!==e[0]&&((0,yr.defaultsDeep)(e[0].xmlns,this.xmlns),n.children.push(this),n.addChild(this)),e.pop()}}addChild(e){}unexpected(e){throw new Error("Found unexpected element ("+e+") inside "+this.nsName)}description(e,t){return this.$name||this.name}init(){}_initializeOptions(e){e?(this.valueKey=e.valueKey||"$value",this.xmlKey=e.xmlKey||"$xml",this.ignoredNamespaces=e.ignoredNamespaces||[],this.strict=e.strict||!1,this.forceUseSchemaXmlns=e.forceUseSchemaXmlns||!1):(this.valueKey="$value",this.xmlKey="$xml",this.ignoredNamespaces=[],this.strict=!1,this.forceUseSchemaXmlns=!1)}};We.Element=Qt;var SV=class AV extends Qt{static{o(this,"UnexpectedElement")}startElement(e,t,n,s,i){let a=new AV(t,n,s,i);a.init(),e.push(a)}};We.UnexpectedElement=SV;var pD=class extends Qt{static{o(this,"ElementElement")}constructor(){super(...arguments),this.allowedChildren=zr(["annotation","complexType","simpleType"])}description(e,t){let n={},s=this.$name,i=1,a=1;this.$maxOccurs==="unbounded"?a=1/0:this.$maxOccurs&&(a=parseInt(this.$maxOccurs,10)),this.$minOccurs&&(i=parseInt(this.$minOccurs,10));let u=a>1;u&&s&&(s+="[]"),t&&t[yr.TNS_PREFIX]&&(this.$targetNamespace=t[yr.TNS_PREFIX]);let c=this.$type||this.$ref;if(c){c=(0,yr.splitQName)(c);let l=c.name,f=!!Au(c.prefix,this.definitionsXmlns,e.xmlns)||!!Au(this.targetNSAlias,this.definitionsXmlns,e.xmlns)||this.forceUseSchemaXmlns,h=Au(c.prefix,t,this.xmlns,f?this.schemaXmlns:void 0,this.definitionsXmlns,e.xmlns),d=e.schemas[h],g=d&&(this.$type?d.complexTypes[l]||d.types[l]:d.elements[l]),m=this.$type?e.descriptions.types:e.descriptions.elements,v=h?`${h}::${l}`:l;if(h&&e.schemas[h]&&(t=e.schemas[h].xmlns),g&&!(l in tw))if(v in m)if(this.$ref)if(u){let y=l+"[]",w=h?`${h}::${y}`:y;m[w]=m[v],n[y]=m[w]}else n=m[v];else n[s]=m[v];else{let y={};m[v]=y,u&&"maxOccurs"in g&&(g.maxOccurs=this.$maxOccurs),this.$minOccurs&&"minOccurs"in g&&(g.minOccurs=this.$minOccurs);let w=g.description(e,t);if(typeof w=="string")y=w;else{Object.keys(w).forEach(E=>{y[E]=w[E]});let S=w[Di.Symbol];S&&(y[Di.Symbol]=S)}this.$ref?n=y:n[s]=y,typeof y=="object"&&(y.targetNSAlias=c.prefix,y.targetNamespace=h),m[v]=y}else n[s]=this.$type}else{let l=this.children;n[s]={};for(let f of l)(f instanceof aw||f instanceof nw)&&(n[s]=f.description(e,t))}return n}};We.ElementElement=pD;var rw=class extends Qt{static{o(this,"AnyElement")}};We.AnyElement=rw;var CV=class extends Qt{static{o(this,"InputElement")}constructor(){super(...arguments),this.allowedChildren=zr(["body","documentation","header","SecuritySpecRef"])}addChild(e){e instanceof ow&&(this.use=e.$use,this.use==="encoded"&&(this.encodingStyle=e.$encodingStyle),this.children.pop())}};We.InputElement=CV;var NV=class extends Qt{static{o(this,"OutputElement")}constructor(){super(...arguments),this.allowedChildren=zr(["body","documentation","header","SecuritySpecRef"])}addChild(e){e instanceof ow&&(this.use=e.$use,this.use==="encoded"&&(this.encodingStyle=e.$encodingStyle),this.children.pop())}};We.OutputElement=NV;var nw=class extends Qt{static{o(this,"SimpleTypeElement")}constructor(){super(...arguments),this.allowedChildren=zr(["restriction"])}description(e){for(let t of this.children)if(t instanceof sw)return[this.$name,t.description()].filter(Boolean).join("|");return{}}};We.SimpleTypeElement=nw;var sw=class extends Qt{static{o(this,"RestrictionElement")}constructor(){super(...arguments),this.allowedChildren=zr(["all","choice","enumeration","sequence","attribute"])}description(e,t){let n=this.children,s,i=!1,a={};for(let c of n){if(c instanceof Di){a[c.$name]=c.description(e);continue}!i&&(c instanceof _g||c instanceof Rg)&&(i=!0,s=c.description(e,t))}if(Object.keys(a).length>0&&(s=s??{},s[Di.Symbol]=a),s&&this.$base){let c=(0,yr.splitQName)(this.$base),l=c.name,f=Au(c.prefix,t,this.definitionsXmlns,e.xmlns),h=e.schemas[f],d=h&&(h.complexTypes[l]||h.types[l]||h.elements[l]);if(s.getBase=()=>d.description(e,h.xmlns),d){let g=d.description(e,h.xmlns);g[Di.Symbol]&&(0,yr.defaults)(a,g[Di.Symbol]),s=(0,yr.defaults)(s,g)}return s}let u=this.children.map(c=>c.description()).join(",");return[this.$base,u].filter(Boolean).join("|")}};We.RestrictionElement=sw;var iw=class extends Qt{static{o(this,"ExtensionElement")}constructor(){super(...arguments),this.allowedChildren=zr(["all","choice","sequence"])}description(e,t){let n={};for(let s of this.children)(s instanceof _g||s instanceof Rg)&&(n=s.description(e,t));if(this.$base){let s=(0,yr.splitQName)(this.$base),i=s.name,a=Au(s.prefix,t,this.definitionsXmlns,e.xmlns),u=e.schemas[a];if(i in tw)return this.$base;{let c=u&&(u.complexTypes[i]||u.types[i]||u.elements[i]);if(c){let l=c.description(e,u.xmlns);n=typeof l=="string"?l:(0,yr.defaults)(l,n)}}}return n}};We.ExtensionElement=iw;var Rg=class extends Qt{static{o(this,"ChoiceElement")}constructor(){super(...arguments),this.allowedChildren=zr(["any","choice","element","sequence"])}description(e,t){let n={};for(let s of this.children){let i=s.description(e,t);for(let a in i)n[a]=i[a]}return n}};We.ChoiceElement=Rg;var TV=class extends Qt{static{o(this,"EnumerationElement")}description(){return this[this.valueKey]}};We.EnumerationElement=TV;var aw=class extends Qt{static{o(this,"ComplexTypeElement")}constructor(){super(...arguments),this.allowedChildren=zr(["all","annotation","choice","complexContent","sequence","simpleContent","attribute"])}description(e,t){let n={},s=!1,i={},a=this.children||[];for(let u of a){if(u instanceof Di){i[u.$name]=u.description(e);continue}!s&&(u instanceof Rg||u instanceof _g||u instanceof gD||u instanceof mD||u instanceof dD)&&(s=!0,n=u.description(e,t))}return Object.keys(i).length>0&&(n[Di.Symbol]=i),n}};We.ComplexTypeElement=aw;var dD=class extends Qt{static{o(this,"ComplexContentElement")}constructor(){super(...arguments),this.allowedChildren=zr(["extension","restriction"])}description(e,t){for(let n of this.children)if(n instanceof iw||n instanceof sw)return n.description(e,t);return{}}};We.ComplexContentElement=dD;var mD=class extends Qt{static{o(this,"SimpleContentElement")}constructor(){super(...arguments),this.allowedChildren=zr(["extension"])}description(e,t){for(let n of this.children)if(n instanceof iw)return n.description(e,t);return{}}};We.SimpleContentElement=mD;var _g=class extends Qt{static{o(this,"SequenceElement")}constructor(){super(...arguments),this.allowedChildren=zr(["any","choice","element","sequence"])}description(e,t){let n={};for(let s of this.children){if(s instanceof rw)continue;let i=s.description(e,t);for(let a in i)n[a]=i[a]}return n}};We.SequenceElement=_g;var Di=class extends Qt{static{o(this,"AttributeElement")}description(e){return{type:this.$type,required:this.$use==="required"}}};We.AttributeElement=Di;Di.Symbol=Symbol("$attributes");var gD=class extends Qt{static{o(this,"AllElement")}constructor(){super(...arguments),this.allowedChildren=zr(["choice","element"])}description(e,t){let n={};for(let s of this.children){if(s instanceof rw)continue;let i=s.description(e,t);for(let a in i)n[a]=i[a]}return n}};We.AllElement=gD;var yD=class extends Qt{static{o(this,"MessageElement")}constructor(){super(...arguments),this.allowedChildren=zr(["part","documentation"]),this.element=null,this.parts=null}postProcess(e){let t=null,n=this.children||[];for(let s of n)if(s.name==="part"){t=s;break}if(t){if(t.$element){let s=[];delete this.parts;let i=(0,yr.splitQName)(t.$element),a=Au(i.prefix,this.definitionsXmlns,e.xmlns),u=e.schemas[a];if(this.element=u.elements[i.name],!this.element){$ie(i.name+" is not present in wsdl and cannot be processed correctly.");return}this.element.targetNSAlias=i.prefix,this.element.targetNamespace=a,this.element.$lookupType=t.$element;let c=this.element.children;if(c.length>0)for(let l of c)s.push(this._getNestedLookupTypeString(l));if(s.length>0){s=s.join("_").split("_").filter(o(function(h){return h!=="^"},"removeEmptyLookupTypes"));let l=e.schemas[this.element.targetNamespace].xmlns;for(let f=0;f<s.length;f++)s[f]=this._createLookupTypeObject(s[f],l)}if(this.element.$lookupTypes=s,this.element.$type){let l=(0,yr.splitQName)(this.element.$type),f=Au(l.prefix,u.xmlns,this.definitionsXmlns,e.xmlns);if(f&&!(l.name in tw)){u=e.schemas[f];let h=u.complexTypes[l.name]||u.types[l.name]||u.elements[l.name];h&&(this.parts=h.description(e,u.xmlns))}}else{let l=this.element.description(e,u.xmlns);this.parts=l[i.name]}this.children.splice(0,1)}else{this.parts={},delete this.element;for(let s=0;s<this.children.length;s++){let i=this.children[s];if(i.name==="documentation")continue;(0,hD.ok)(i.name==="part","Expected part element");let a=(0,yr.splitQName)(i.$type),u=Au(a.prefix,this.definitionsXmlns,e.xmlns),c=a.name;typeof e.schemas[u]<"u"?this.parts[i.$name]=e.schemas[u].types[c]||e.schemas[u].complexTypes[c]:this.parts[i.$name]=i.$type,typeof this.parts[i.$name]=="object"&&(this.parts[i.$name].prefix=a.prefix,this.parts[i.$name].xmlns=u),this.children.splice(s--,1)}}this.deleteFixedAttrs()}}description(e){if(this.element)return this.element&&this.element.description(e);let t={};return t[this.$name]=this.parts,t}_createLookupTypeObject(e,t){let n=(0,yr.splitQName)(e),s=n.prefix,i=n.name.split("#"),a=i[0],u=i[1];return{$namespace:t[s],$type:s+":"+a,$name:u}}_getNestedLookupTypeString(e){let t="^",n=this.ignoredNamespaces.concat("xs");return Object.hasOwnProperty.call(e,"$type")&&typeof e.$type=="string"&&n.indexOf(e.$type.split(":")[0])===-1&&(t+="_"+e.$type+"#"+e.$name),e.children.length>0&&e.children.forEach(s=>{let i=this._getNestedLookupTypeString(s).replace(/\^_/,"");i&&typeof i=="string"&&(t+="_"+i)}),t}};We.MessageElement=yD;var IV=class extends Qt{static{o(this,"DocumentationElement")}};We.DocumentationElement=IV;var Bg=class DV extends Qt{static{o(this,"SchemaElement")}constructor(){super(...arguments),this.allowedChildren=zr(["complexType","element","import","include","simpleType"]),this.complexTypes={},this.types={},this.elements={},this.includes=[]}merge(e){return(0,hD.ok)(e instanceof DV),(0,yr.merge)(this.complexTypes,e.complexTypes),(0,yr.merge)(this.types,e.types),(0,yr.merge)(this.elements,e.elements),(0,yr.merge)(this.xmlns,e.xmlns),(0,yr.merge)(this,(0,yr.pickBy)(e,(t,n)=>n.startsWith("$")&&!Object.hasOwnProperty.call(this,n))),this}addChild(e){if(!(e.$name in tw)){if(e instanceof SD||e instanceof AD){let t=e.$schemaLocation||e.$location;t&&this.includes.push({namespace:e.$namespace||e.$targetNamespace||this.$targetNamespace,location:t})}else e instanceof aw?this.complexTypes[e.$name]=e:e instanceof pD?this.elements[e.$name]=e:e instanceof nw&&(this.types[e.$name]=e);this.children.pop()}}};We.SchemaElement=Bg;var vD=class extends Qt{static{o(this,"TypesElement")}constructor(){super(...arguments),this.allowedChildren=zr(["documentation","schema"]),this.schemas={}}addChild(e){(0,hD.ok)(e instanceof Bg);let t=e.includes.find(i=>Object.hasOwnProperty.call(i,"namespace")),n=typeof t<"u"&&Object.hasOwnProperty.call(t,"namespace")&&e instanceof Bg?t.namespace:void 0,s=e.$targetNamespace||e.includes[0]?.namespace||n;Object.hasOwnProperty.call(this.schemas,s)?s===e.$targetNamespace?this.schemas[s]=e:console.error('Target-Namespace "'+s+'" already in use by another Schema!'):this.schemas[s]=e}};We.TypesElement=vD;var BV=class RV extends Qt{static{o(this,"OperationElement")}constructor(){super(...arguments),this.allowedChildren=zr(["documentation","fault","input","operation","output"]),this.input=null,this.output=null,this.inputSoap=null,this.outputSoap=null,this.style="",this.soapAction=""}addChild(e){e instanceof RV&&(this.soapAction=e.$soapAction||"",this.style=e.$style||"",this.children.pop())}postProcess(e,t){let n=this.children;for(let s=0;s<n.length;s++){let i=n[s];if(i.name!=="input"&&i.name!=="output")continue;if(t==="binding"){this[i.name]=i,n.splice(s--,1);continue}let a=(0,yr.splitQName)(i.$message).name,u=e.messages[a];u&&(u.postProcess(e),u.element?(e.messages[u.element.$name]=u,this[i.name]=u.element):this[i.name]=u,n.splice(s--,1))}this.deleteFixedAttrs()}description(e){let t=this.input?this.input.description(e):null,n=this.output?this.output.description(e):null;return{input:t&&t[Object.keys(t)[0]],output:n&&n[Object.keys(n)[0]]}}};We.OperationElement=BV;var xD=class extends Qt{static{o(this,"PortTypeElement")}constructor(){super(...arguments),this.allowedChildren=zr(["documentation","operation"]),this.methods={}}postProcess(e){let t=this.children;if(!(typeof t>"u")){for(let n=0;n<t.length;n++){let s=t[n];s.name==="operation"&&(s.postProcess(e,"portType"),this.methods[s.$name]=s,t.splice(n--,1))}delete this.$name,this.deleteFixedAttrs()}}description(e){let t={};for(let n in this.methods){let s=this.methods[n];t[n]=s.description(e)}return t}};We.PortTypeElement=xD;var ED=class extends Qt{static{o(this,"BindingElement")}constructor(){super(...arguments),this.allowedChildren=zr(["binding","documentation","operation","SecuritySpec"]),this.transport="",this.style="",this.methods={}}addChild(e){e.name==="binding"&&(this.transport=e.$transport,this.style=e.$style,this.children.pop())}postProcess(e){let t=(0,yr.splitQName)(this.$type).name,n=e.portTypes[t],s=this.style,i=this.children;if(n){n.postProcess(e),this.methods=n.methods;for(let a=0;a<i.length;a++){let u=i[a];if(u.name!=="operation")continue;u.postProcess(e,"binding"),i.splice(a--,1),u.style||(u.style=s);let c=this.methods[u.$name];c&&(c.style=u.style,c.soapAction=u.soapAction,c.inputSoap=u.input||null,c.outputSoap=u.output||null,c.inputSoap&&c.inputSoap.deleteFixedAttrs(),c.outputSoap&&c.outputSoap.deleteFixedAttrs())}}delete this.$name,delete this.$type,this.deleteFixedAttrs()}description(e){let t={};for(let n in this.methods){let s=this.methods[n];t[n]=s.description(e)}return t}};We.BindingElement=ED;var _V=class extends Qt{static{o(this,"PortElement")}constructor(){super(...arguments),this.allowedChildren=zr(["address","documentation"]),this.location=null}addChild(e){e.name==="address"&&typeof e.$location<"u"&&(this.location=e.$location)}};We.PortElement=_V;var wD=class extends Qt{static{o(this,"ServiceElement")}constructor(){super(...arguments),this.allowedChildren=zr(["documentation","port"]),this.ports={}}postProcess(e){let t=this.children,n=e.bindings;if(t&&t.length>0)for(let s=0;s<t.length;s++){let i=t[s];if(i.name!=="port")continue;let a=(0,yr.splitQName)(i.$binding).name,u=n[a];u&&(u.postProcess(e),this.ports[i.$name]={location:i.location,binding:u},t.splice(s--,1))}delete this.$name,this.deleteFixedAttrs()}description(e){let t={};for(let n in this.ports){let s=this.ports[n];t[n]=s.binding.description(e)}return t}};We.ServiceElement=wD;var bD=class extends Qt{static{o(this,"DefinitionsElement")}constructor(){super(...arguments),this.allowedChildren=zr(["binding","documentation","import","message","portType","service","types"]),this.messages={},this.portTypes={},this.bindings={},this.services={},this.schemas={},this.descriptions={types:{},elements:{}}}init(){this.name!=="definitions"&&this.unexpected(this.nsName)}addChild(e){if(e instanceof vD)(0,yr.merge)(this.schemas,e.schemas);else if(e instanceof yD)this.messages[e.$name]=e;else if(e.name==="import"){let t=new Bg(e.$namespace,{});t.init(),this.schemas[e.$namespace]=t,this.schemas[e.$namespace].addChild(e)}else e instanceof xD?this.portTypes[e.$name]=e:e instanceof ED?(e.transport==="http://schemas.xmlsoap.org/soap/http"||e.transport==="http://www.w3.org/2003/05/soap/bindings/HTTP/")&&(this.bindings[e.$name]=e):e instanceof wD&&(this.services[e.$name]=e);this.children.pop()}};We.DefinitionsElement=bD;var ow=class extends Qt{static{o(this,"BodyElement")}};We.BodyElement=ow;var SD=class extends Qt{static{o(this,"IncludeElement")}};We.IncludeElement=SD;var AD=class extends Qt{static{o(this,"ImportElement")}};We.ImportElement=AD;var Xie={all:gD,any:rw,binding:ED,body:ow,choice:Rg,complexContent:dD,complexType:aw,definitions:bD,documentation:IV,element:pD,enumeration:TV,extension:iw,fault:Qt,import:AD,include:SD,input:CV,message:yD,operation:BV,output:NV,port:_V,portType:xD,restriction:sw,schema:Bg,sequence:_g,service:wD,simpleContent:mD,simpleType:nw,types:vD,attribute:Di};function zr(r){let e={};for(let t of r)e[t.replace(/^_/,"")]=Xie[t]||Qt;return e}o(zr,"buildAllowedChildren");function Au(r,...e){for(let t of e)if(t?.[r])return t[r]}o(Au,"findNs")});var TD=X(vs=>{"use strict";var Gie=vs&&vs.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:o(function(){return e[t]},"get")}),Object.defineProperty(r,n,s)}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),zie=vs&&vs.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),fw=vs&&vs.__importStar||(function(){var r=o(function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(n[n.length]=s);return n},r(e)},"ownKeys");return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),s=0;s<n.length;s++)n[s]!=="default"&&Gie(t,e,n[s]);return zie(t,e),t}})(),Wie=vs&&vs.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(vs,"__esModule",{value:!0});vs.WSDL=void 0;vs.trim=ND;vs.open_wsdl=FV;var Jie=require("assert"),Yie=Wie(qh()),Qie=fw(require("fs")),PV=ds(),Og=fw(require("path")),uw=fw(wV()),Zie=AE(),eae=bV(),cr=ds(),gl=fw(OV()),kV=(0,Yie.default)("node-soap"),LV="http://www.w3.org/2001/XMLSchema-instance",tae="http://schemas.xmlsoap.org/soap/envelope/";function ND(r){return r.trim()}o(ND,"trim");function cw(r){return r&&r.charAt(r.length-1)!==":"?r+":":r}o(cw,"appendColon");function CD(r){return r&&r.charAt(r.length-1)===":"?r.substring(0,r.length-1):r}o(CD,"noColonNameSpace");var lw=class{static{o(this,"WSDL")}constructor(e,t,n){this.ignoredNamespaces=["tns","targetNamespace","typedNamespace"],this.ignoreBaseNameSpaces=!1,this.valueKey="$value",this.xmlKey="$xml";let s;if(this.uri=t,this.callback=()=>{},this._includesWsdl=[],this.WSDL_CACHE={},n&&n.WSDL_CACHE&&(this.WSDL_CACHE=n.WSDL_CACHE),this._initializeOptions(n),typeof e=="string")e=(0,cr.stripBom)(e),s=this._fromXML;else if(typeof e=="object")s=this._fromServices;else throw new Error("WSDL constructor takes either an XML string or service definition");process.nextTick(()=>{try{s.call(this,e)}catch(i){return this.callback(i)}this.processIncludes(i=>{let a;if(i)return this.callback(i);try{this.definitions.deleteFixedAttrs();let u=this.services=this.definitions.services;if(u)for(a in u)u[a].postProcess(this.definitions);let c=this.definitions.complexTypes;if(c)for(a in c)c[a].deleteFixedAttrs();let l=this.definitions.bindings;for(let f in l){let h=l[f];typeof h.style>"u"&&(h.style="document");let d=h.methods,g=h.topElements={};for(let m in d)if((d[m].style||h.style)==="document"&&d[m].input){let v=d[m].input.$name,y="";d[m].output&&(y=d[m].output.$name),g[v]={methodName:m,outputName:y}}}this.xmlnsInEnvelope=this._xmlnsMap(),this.callback(i,this)}catch(u){this.callback(u)}})})}onReady(e){e&&(this.callback=e)}processIncludes(e){let t=this.definitions.schemas,n=[];for(let s in t){let i=t[s];n=n.concat(i.includes||[])}this._processNextInclude(n,e)}describeServices(){let e={};for(let t in this.services){let n=this.services[t];e[t]=n.description(this.definitions)}return e}toXML(){return this.xml||""}getSaxStream(e){let t=uw.createStream(!0,null);return e.pipe(t),t}xmlToObject(e,t){let n=typeof t=="function"?{}:uw.parser(!0,null),s=null,i={},u=[{name:null,object:i,schema:{Envelope:{Header:{Security:{UsernameToken:{Username:"string",Password:"string"}}},Body:{Fault:{faultcode:"string",faultstring:"string",detail:"string"}}}}}],c=new Map,l="soap",f={},h={};if(n.onopentag=g=>{let m=g.name,v=g.attributes,y=(0,cr.splitQName)(m).name,w,S=u[u.length-1],E=S.schema,x={},b=!1,A=!1,k={},I=y;if(v.href){let U=v.href.substr(1);h[U]||(h[U]={hrefs:[],obj:null}),h[U].hrefs.push({par:S.object,key:y,obj:k})}v.id&&(h[v.id]||(h[v.id]={hrefs:[],obj:null}));for(w in v){let U=v[w];if(/^xmlns:|^xmlns$/.test(w)){let M=(0,cr.splitQName)(w).name;f[M]=U,U===LV&&c.set(M,U),U===tae&&(l=M);continue}b=!0,x[w]=U}for(w in x){let U=(0,cr.splitQName)(w);if(U.name==="nil"&&f[U.prefix]===LV&&x[w]&&(x[w].toLowerCase()==="true"||x[w]==="1")){A=!0;break}}if(b&&(k[this.options.attributesKey]=x),!s&&f[l]&&S.name==="Body"&&y!=="Fault"){let U=this.definitions.messages[y];if(!U)try{let M=!1;/Response$/.test(y)?y=y.replace(/Response$/,""):/Request$/.test(y)?(M=!0,y=y.replace(/Request$/,"")):/Solicit$/.test(y)&&(M=!0,y=y.replace(/Solicit$/,""));let ie=this.definitions.portTypes,Z=Object.keys(ie);for(let ue of Z){let $=ie[ue];if($.methods[y])try{M?y=$.methods[y].input.$name:y=$.methods[y].output.$name,U=this.definitions.messages[y];break}catch{throw new Error(`Failed to lookup message ${y} in methods`)}}if(!U)throw new Error(`Could not find message ${y}`);this.definitions.messages[I]=U}catch(M){this.options.returnFault&&n.onerror(M)}E=U.description(this.definitions),s=I}let T,V;for(let U of c.keys())if(`${U}:type`in x){V=x[`${U}:type`];break}if(V){let U=(0,cr.splitQName)(V),M;U.prefix===cr.TNS_PREFIX?M=f[U.prefix]||f.xmlns:M=f[U.prefix];let ie=this.findSchemaObject(M,U.name);ie&&(T=ie.description(this.definitions))}E&&E[y+"[]"]&&(y=y+"[]"),u.push({name:I,object:k,schema:T||E&&E[y],id:v.id,nil:A})},n.onclosetag=g=>{let m=u.pop(),v=m.object,y=u[u.length-1],w=y.object,S=y.schema,E=(0,cr.splitQName)(g).name;if(typeof m.schema=="string"&&(0,cr.splitQName)(m.schema).name==="string"&&typeof v=="object"&&Object.keys(v).length===0&&(v=m.object=this.options.preserveWhitespace&&m.text||""),m.nil===!0)if(this.options.handleNilAsNull)v=null;else return;(0,PV.isPlainObject)(v)&&!Object.keys(v).length&&(v=null),S&&S[E+"[]"]?(w[E]||(w[E]=[]),w[E].push(v)):E in w?(Array.isArray(w[E])||(w[E]=[w[E]]),w[E].push(v)):w[E]=v,m.id&&(h[m.id].obj=v)},n.oncdata=g=>{let m=g;if(g=ND(g),!!g.length)if(/<\?xml[\s\S]+\?>/.test(g)){let v=u[u.length-1],y=this.xmlToObject(g);v.object[this.options.attributesKey]?v.object[this.options.valueKey]=y:v.object=y}else n.ontext(m)},n.onerror=g=>{throw n.resume(),{Fault:{faultcode:500,faultstring:"Invalid XML",detail:new Error(g).message,statusCode:500}}},n.ontext=g=>{let m=u[u.length-1],v=g;if(g=ND(g),!g.length){this.options.preserveWhitespace&&(m.text=(m.text||"")+v);return}let y=(0,cr.splitQName)(m.schema).name,w;this.options&&this.options.customDeserializer&&this.options.customDeserializer[y]?w=this.options.customDeserializer[y](g,m):y==="int"||y==="integer"||y==="short"||y==="long"?w=parseInt(g,10):y==="double"||y==="float"||y==="decimal"?w=Number(g):y==="bool"||y==="boolean"?w=g.toLowerCase()==="true"||g==="1":y==="dateTime"||y==="date"?w=new Date(g):(this.options.preserveWhitespace&&(g=v),typeof m.object!="string"?w=g:w=m.object+g),m.object[this.options.attributesKey]?m.object[this.options.valueKey]=w:m.object=w},typeof t=="function"){let g=uw.createStream(!0,null);g.on("opentag",n.onopentag),g.on("closetag",n.onclosetag),g.on("cdata",n.oncdata),g.on("text",n.ontext),e.pipe(g).on("error",m=>{t(m)}).on("end",()=>{let m;try{m=d()}catch(v){return t(v)}t(null,m)});return}return n.write(e).close(),d();function d(){for(let g in h){let m=h[g];for(let v of m.hrefs)Object.assign(v.obj,m.obj)}if(i.Envelope){let g=i.Envelope.Body;if(g&&g.Fault){let m=g.Fault,v=m.faultcode&&m.faultcode.$value,y=m.faultstring&&m.faultstring.$value,w=m.detail&&m.detail.$value;v=v||m.faultcode,y=y||m.faultstring,w=w||m.detail,v=v||m.Code&&`${m.Code.Value}: ${m.Code.Subcode&&m.Code.Subcode.Value}`,y=y||m.Reason&&m.Reason.Text.$value,y=y||m.Reason&&m.Reason.Text,w=w||m.Detail;let S=new Error(v+": "+y+(w?": "+JSON.stringify(w):""));throw S.root=i,S}return i.Envelope}return i}o(d,"finish")}findSchemaObject(e,t){if(!e||!t)return null;let n=null;if(this.definitions.schemas){let s=this.definitions.schemas[e];s&&(t.indexOf(":")!==-1&&(t=t.substring(t.indexOf(":")+1,t.length)),n=s.complexTypes[t]||s.types[t]||s.elements[t])}return n}objectToDocumentXML(e,t,n,s,i){if(t&&t._xml)return t._xml;let a={};a[e]=t;let u=i?this.findSchemaObject(s,i):null;return this.objectToXML(a,null,n,s,!0,null,u)}objectToRpcXML(e,t,n,s,i){let a=[],u=this.definitions,c="_xmlns";n=n||(0,cr.findPrefix)(u.xmlns,s),s=s||u.xmlns[n],n=n===cr.TNS_PREFIX?"":n+":",a.push(["<",n,e,">"].join(""));for(let l in t)if(Object.prototype.hasOwnProperty.call(t,l)&&l!==c){let f=t[l];if(l===this.options.xmlKey)a.push(this.objectToXML({[l]:f},null,n,s));else{let h=(i?"":n)+l,d=[];if(typeof f=="object"&&Object.prototype.hasOwnProperty.call(f,this.options.attributesKey)){let g=f[this.options.attributesKey];for(let m in g)d.push(" "+m+'="'+g[m]+'"')}a.push(["<",h].concat(d).concat(">").join("")),a.push(typeof f=="object"?this.objectToXML(f,l,n,s):(0,cr.xmlEscape)(f)),a.push(["</",h,">"].join(""))}}return a.push(["</",n,e,">"].join("")),a.join("")}isIgnoredNameSpace(e){return this.options.ignoredNamespaces.indexOf(e)>-1}filterOutIgnoredNameSpace(e){let t=CD(e);return this.isIgnoredNameSpace(t)?"":t}objectToXML(e,t,n,s,i,a,u,c){let l=this.definitions.schemas[s];if(this.options.overrideElementKey&&Object.keys(this.options.overrideElementKey).length>0)for(let E in this.options.overrideElementKey){let x=this.options.overrideElementKey[E];e&&e[E]&&(Object.defineProperty(e,x,Object.getOwnPropertyDescriptor(e,E)),delete e[E])}let f=n?n.parent:void 0;typeof f<"u"&&(n=n.current),f=CD(f),this.isIgnoredNameSpace(f)&&(f="");let h=!l,d=l&&l.$elementFormDefault==="qualified",g=[],m=(n||d)&&n!==cr.TNS_PREFIX,v="";s&&i&&(this.options.overrideRootElement&&this.options.overrideRootElement.xmlnsAttributes?this.options.overrideRootElement.xmlnsAttributes.forEach(E=>{v+=" "+E.name+'="'+E.value+'"'}):(m&&!this.isIgnoredNameSpace(n)&&(v+=" xmlns:"+n+'="'+s+'"'),(d||h)&&(v+=' xmlns="'+s+'"'))),c?c.pushContext():(c=new eae.NamespaceContext,c.declareNamespace(n,s)),a&&!(this.options.overrideRootElement&&this.options.overrideRootElement.xmlnsAttributes)&&(v=a);let y="";this.options.overrideRootElement&&i?y=this.options.overrideRootElement.namespace:m&&(d||i||h)&&!this.isIgnoredNameSpace(n)&&(y=n);let w,S;if(Array.isArray(e)){let E="",x=!1,b=/^([^:]+):([^:]+)$/.exec(t);for(b?(E=b[1],t=b[2]):t[0]===":"&&(x=!0,t=t.substr(1)),w=0,S=e.length;w<S;w++){let A=e[w],k=this.processAttributes(A,c),I=E||f||y,T=this.objectToXML(A,t,n,s,!1,null,u,c),V=["<",t,k,v];x||(V=["<",cw(I),t,k,v]),T===""&&this.options.useEmptyTag?(V.push(" />"),g.push(V.join(""))):(V.push(">"),(this.options.namespaceArrayElements||w===0)&&g.push(V.join("")),g.push(T),(this.options.namespaceArrayElements||w===S-1)&&(x?g.push(["</",t,">"].join("")):g.push(["</",cw(I),t,">"].join(""))))}}else if(typeof e=="object"){let E="";for(t in e){if(e.hasOwnProperty||(e=Object.assign({},e)),!Object.prototype.hasOwnProperty.call(e,t)||t===this.options.attributesKey)continue;if(t===this.options.xmlKey)return c.popContext(),e[t];if(t===this.options.valueKey)return c.popContext(),(0,cr.xmlEscape)(e[t]);let x=e[t];if(typeof x>"u")continue;let b=this.processAttributes(x,c),A="",k="",I=!1,T=/^([^:]+):([^:]+)$/.exec(t);if(T?(k=T[1]+":",t=T[2]):t[0]===":"&&(I=!0,t=t.substr(1)),i)A=this.objectToXML(x,t,n,s,!1,null,u,c);else if(this.definitions.schemas)if(l){let U=this.findChildSchemaObject(u,t);if(U&&(U.$type&&U.$type.indexOf("xsd:")===-1||U.$ref||U.$name)){let M="",ie="",Z,ue="",$=U.$ref||U.$name;if($){$=(0,cr.splitQName)($),ie=$.name,$.prefix===cr.TNS_PREFIX?(Z=U.$targetNamespace,M=c.registerNamespace(Z),this.isIgnoredNameSpace(M)&&(M=n)):(M=$.prefix,this.isIgnoredNameSpace(M)&&(M=n),Z=l.xmlns[M]||this.definitions.xmlns[M]);let xe=!1;U.$name&&U.targetNamespace===void 0&&(U.$form==="unqualified"?xe=!0:U.$form==="qualified"?xe=!1:xe=l.$elementFormDefault!=="qualified"),xe&&(M=""),Z&&M&&c.declareNamespace(M,Z)&&(ue=" xmlns:"+M+'="'+Z+'"',v.includes(M)||(E=ue,v+=ue))}let de;if(U.$type){let xe=(0,cr.splitQName)(U.$type),ve=U.$baseNameSpace||xe.prefix,me=l.xmlns[ve]||this.definitions.xmlns[ve];Z=me,me!=="http://www.w3.org/2001/XMLSchema"&&ve!==cr.TNS_PREFIX&&c.addNamespace(ve,me),de=this.findSchemaType(xe.name,me)||U}else de=this.findSchemaObject(Z,ie)||U;U.$baseNameSpace&&this.options.ignoreBaseNameSpaces&&(M=n,Z=s),this.options.ignoreBaseNameSpaces&&(M="",Z=""),y=M,Array.isArray(x)?(M={current:M,parent:y},ue=ue&&ue.length?ue:E):ue=null,A=this.objectToXML(x,t,M,Z,!1,ue,de,c)}else e[this.options.attributesKey]&&e[this.options.attributesKey].xsi_type?(k=e[this.options.attributesKey].xsi_type.prefix,c.addNamespace(e[this.options.attributesKey].xsi_type.prefix,e[this.options.attributesKey].xsi_type.xmlns),A=this.objectToXML(x,t,e[this.options.attributesKey].xsi_type.prefix,e[this.options.attributesKey].xsi_type.xmlns,!1,null,null,c)):(Array.isArray(x)&&(I?t=":"+t:t=k+t),A=this.objectToXML(x,t,n,s,!1,null,null,c))}else A=this.objectToXML(x,t,n,s,!1,null,null,c);y=CD(y),m&&!d&&i&&!this.options.overrideRootElement?y=n:this.isIgnoredNameSpace(y)&&(y="");let V=!A&&this.options.useEmptyTag;Array.isArray(x)||g.push(["<",I?"":cw(k||y),t,b,v,x===null?' xsi:nil="true"':"",V?" />":">"].join("")),V||(g.push(A),Array.isArray(x)||g.push(["</",I?"":cw(k||y),t,">"].join("")))}}else e!==void 0&&g.push(this.options.escapeXML?(0,cr.xmlEscape)(e):e);return c.popContext(),g.join("")}processAttributes(e,t){let n="";e==null&&(e=[]);let s=e[this.options.attributesKey]||{};if(s&&s.xsi_type){let i=s.xsi_type,a=i.prefix||i.namespace;i.xmlns&&(a?t.declareNamespace(a,i.xmlns):a=t.registerNamespace(i.xmlns),i.prefix=a)}return Object.keys(s).forEach(i=>{let a=s[i];if(i==="xsi_type"){let u=a.type;a.prefix&&(u=`${a.prefix}:${u}`),n+=` xsi:type="${u}"`,a.xmlns&&(n+=` xmlns:${a.prefix}="${a.xmlns}"`)}else n+=` ${i}="${(0,cr.xmlEscape)(a)}"`}),n}findSchemaType(e,t){if(!this.definitions.schemas||!e||!t)return null;let n=this.definitions.schemas[t];return!n||!n.complexTypes?null:n.complexTypes[e]}findChildSchemaObject(e,t,n){if(!e||!t||(n||(n=[]),n.indexOf(e)>=0))return null;n=n.concat([e]);let s=null,i=0,a;if(Array.isArray(e.$lookupTypes)&&e.$lookupTypes.length){let l=e.$lookupTypes;for(i=0;i<l.length;i++){let f=l[i];if(f.$name===t){s=f;break}}}let u=e;if(u.$name===t&&u.name==="element"||u.$ref&&(a=(0,cr.splitQName)(u.$ref),a.name===t))return u;let c;if(u.$type&&n.length===1){let l=(0,cr.splitQName)(u.$type);l.prefix===cr.TNS_PREFIX?c=e.$targetNamespace:c=this.definitions.xmlns[l.prefix];let f=this.findSchemaType(l.name,c);if(f)return this.findChildSchemaObject(f,t,n)}if(u.$base&&(!Array.isArray(u.children)||!u.children.length)){let l=(0,cr.splitQName)(u.$base);c=e.$targetNamespace,l.prefix!==cr.TNS_PREFIX&&(c=this.definitions.xmlns[l.prefix]);let f=this.findSchemaType(l.name,c);if(f)return this.findChildSchemaObject(f,t,n)}if(Array.isArray(u.children)&&u.children.length>0)for(let l of u.children){if(s=this.findChildSchemaObject(l,t,n),s)break;if(l.$base){let f=(0,cr.splitQName)(l.$base),h=f.prefix===cr.TNS_PREFIX?"":f.prefix;c=l.xmlns[f.prefix]||l.schemaXmlns[f.prefix];let d=this.findSchemaType(f.name,c);if(d&&(s=this.findChildSchemaObject(d,t,n),s)){s.$baseNameSpace=h;break}}}return!s&&u.$name===t?u:s}_initializeOptions(e){this._originalIgnoredNamespaces=(e||{}).ignoredNamespaces,this.options={};let t=e?e.ignoredNamespaces:null;t&&(Array.isArray(t.namespaces)||typeof t.namespaces=="string")?t.override?this.options.ignoredNamespaces=t.namespaces:this.options.ignoredNamespaces=this.ignoredNamespaces.concat(t.namespaces):this.options.ignoredNamespaces=this.ignoredNamespaces,this.options.valueKey=e.valueKey||this.valueKey,this.options.xmlKey=e.xmlKey||this.xmlKey,e.escapeXML!==void 0?this.options.escapeXML=e.escapeXML:this.options.escapeXML=!0,e.returnFault!==void 0?this.options.returnFault=e.returnFault:this.options.returnFault=!1,this.options.handleNilAsNull=!!e.handleNilAsNull,e.namespaceArrayElements!==void 0?this.options.namespaceArrayElements=e.namespaceArrayElements:this.options.namespaceArrayElements=!0,this.options.wsdl_headers=e.wsdl_headers,this.options.wsdl_options=e.wsdl_options,e.httpClient&&(this.options.httpClient=e.httpClient),e.request&&(this.options.request=e.request);let n=e?e.ignoreBaseNameSpaces:null;n!==null&&typeof n<"u"?this.options.ignoreBaseNameSpaces=n:this.options.ignoreBaseNameSpaces=this.ignoreBaseNameSpaces,this.options.forceSoap12Headers=e.forceSoap12Headers,this.options.customDeserializer=e.customDeserializer,this.options.forceUseSchemaXmlns=e.forceUseSchemaXmlns,e.overrideElementKey!==void 0&&(this.options.overrideElementKey=e.overrideElementKey),e.overrideRootElement!==void 0&&(this.options.overrideRootElement=e.overrideRootElement),this.options.useEmptyTag=!!e.useEmptyTag}_processNextInclude(e,t){let n=e.shift();if(!n)return t();let s;if(!/^https?:/i.test(this.uri)&&!/^https?:/i.test(n.location))(this.options.wsdl_options!==void 0&&Object.prototype.hasOwnProperty.call(this.options.wsdl_options,"fixedPath")?this.options.wsdl_options.fixedPath:!1)?s=Og.resolve(Og.dirname(this.uri),Og.parse(n.location).base):s=Og.resolve(Og.dirname(this.uri),n.location);else if(/^https?:/i.test(n.location))s=n.location;else try{s=new URL(n.location,this.uri||"").toString()}catch{s=n.location}let i=Object.assign({},this.options);if(i.ignoredNamespaces=this._originalIgnoredNamespaces||this.options.ignoredNamespaces,i.WSDL_CACHE=this.WSDL_CACHE,this.options.wsdl_options!==void 0&&typeof this.options.wsdl_options.overrideImportLocation=="function")try{s=this.options.wsdl_options.overrideImportLocation(s,this.uri,n.location,i)}catch(a){return t(a)}rae(s,i,(a,u)=>{if(a)return t(a);if(this._includesWsdl.push(u),u.definitions instanceof gl.DefinitionsElement)(0,PV.mergeWith)(this.definitions,u.definitions,(c,l)=>c instanceof gl.SchemaElement?c.merge(l):void 0);else return t(new Error("wsdl.defintions is not an instance of elements.DefinitionsElement"));this._processNextInclude(e,c=>{t(c)})})}_parse(e){let t=uw.parser(!0,null),n=[],s=null,i=null,a=null,u=null,c=this.options;return t.onopentag=l=>{let f=l.name,h=l.attributes,d=n[n.length-1],g=(0,cr.splitQName)(f).name;if(g==="schema"&&(u=h),d)try{d.startElement(n,f,h,c,u)}catch(m){if(this.options.strict)throw m;n.push(new gl.Element(f,h,c,u))}else if(g==="definitions")s=new gl.DefinitionsElement(f,h,c),n.push(s);else if(g==="schema")s=new gl.DefinitionsElement("definitions",{},{}),i=new gl.TypesElement("types",{},{}),a=new gl.SchemaElement(f,h,c),i.addChild(a),s.addChild(i),n.push(a);else throw g==="html"?new Error("Root element of WSDL was <html>. This is likely an authentication issue."):new Error("Unexpected root element of WSDL or include")},t.onclosetag=l=>{let f=n[n.length-1];(0,Jie.ok)(f,"Unmatched close tag: "+l),f.endElement(n,l)},t.write(e).close(),s}_fromXML(e){this.definitions=this._parse(e),this.definitions.descriptions={types:{},elements:{}},this.xml=e}_fromServices(e){}_xmlnsMap(){let e=this.definitions.xmlns,t="";for(let n in e){if(n===""||n===cr.TNS_PREFIX)continue;let s=e[n];switch(s){case"http://xml.apache.org/xml-soap":case"http://schemas.xmlsoap.org/wsdl/":case"http://schemas.xmlsoap.org/wsdl/soap/":case"http://schemas.xmlsoap.org/wsdl/soap12/":case"http://schemas.xmlsoap.org/soap/encoding/":case"http://www.w3.org/2001/XMLSchema":continue}~s.indexOf("http://schemas.xmlsoap.org/")||~s.indexOf("http://www.w3.org/")||~s.indexOf("http://xml.apache.org/")||(t+=" xmlns:"+n+'="'+s+'"')}return t}};vs.WSDL=lw;function rae(r,e,t){let n,s;typeof e=="function"?(n={},s=e):(n=e,s=t);let i=n.WSDL_CACHE[r];return i?s.call(i,null,i):FV(r,n,s)}o(rae,"open_wsdl_recursive");function FV(r,e,t){let n,s;typeof e=="function"?(n={},s=e):typeof t=="function"&&(n=e,s=t);let i=n.WSDL_CACHE||{},a=n.wsdl_headers,u=n.wsdl_options,c;return/^<\?xml[^>]*?>/i.test(r)?(c=new lw(r,r,n),i[r]=c,c.WSDL_CACHE=i,c.onReady(s)):/^https?:/i.test(r)?(kV("Reading url: %s",r),(n.httpClient||new Zie.HttpClient(n)).request(r,null,(f,h,d)=>{f?s(f):h&&h.status===200?(c=new lw(d,r,n),i[r]=c,c.WSDL_CACHE=i,c.onReady(s)):s(new Error("Invalid WSDL URL: "+r+`
|
|
68
|
+
`?(N.line++,N.column=0):N.column++);N.cdata+=R.substring(rt,te-1),W==="]"&&(N.state=T.CDATA_ENDING);continue;case T.CDATA_ENDING:W==="]"?N.state=T.CDATA_ENDING_2:(N.cdata+="]"+W,N.state=T.CDATA);continue;case T.CDATA_ENDING_2:W===">"?(N.cdata&&$(N,"oncdata",N.cdata),$(N,"onclosecdata"),N.cdata="",N.state=T.TEXT):W==="]"?N.cdata+="]":(N.cdata+="]]"+W,N.state=T.CDATA);continue;case T.PROC_INST:W==="?"?N.state=T.PROC_INST_ENDING:x(W)?N.state=T.PROC_INST_BODY:N.procInstName+=W;continue;case T.PROC_INST_BODY:if(!N.procInstBody&&x(W))continue;W==="?"?N.state=T.PROC_INST_ENDING:N.procInstBody+=W;continue;case T.PROC_INST_ENDING:if(W===">"){let Ir={name:N.procInstName,body:N.procInstBody};ue(N,Ir),$(N,"onprocessinginstruction",Ir),N.procInstName=N.procInstBody="",N.state=T.TEXT}else N.procInstBody+="?"+W,N.state=T.PROC_INST_BODY;continue;case T.OPEN_TAG:k(w,W)?N.tagName+=W:(ee(N),W===">"?Ie(N):W==="/"?N.state=T.OPEN_TAG_SLASH:(x(W)||z(N,"Invalid character in tag name"),N.state=T.ATTRIB));continue;case T.OPEN_TAG_SLASH:W===">"?(Ie(N,!0),_(N)):(z(N,"Forward-slash in opening tag not followed by >"),N.state=T.ATTRIB);continue;case T.ATTRIB:if(x(W))continue;W===">"?Ie(N):W==="/"?N.state=T.OPEN_TAG_SLASH:k(y,W)?(N.attribName=W,N.attribValue="",N.state=T.ATTRIB_NAME):z(N,"Invalid attribute name");continue;case T.ATTRIB_NAME:W==="="?N.state=T.ATTRIB_VALUE:W===">"?(z(N,"Attribute without value"),N.attribValue=N.attribName,Ae(N),Ie(N)):x(W)?N.state=T.ATTRIB_NAME_SAW_WHITE:k(w,W)?N.attribName+=W:z(N,"Invalid attribute name");continue;case T.ATTRIB_NAME_SAW_WHITE:if(W==="=")N.state=T.ATTRIB_VALUE;else{if(x(W))continue;z(N,"Attribute without value"),N.tag.attributes[N.attribName]="",N.attribValue="",$(N,"onattribute",{name:N.attribName,value:""}),N.attribName="",W===">"?Ie(N):k(y,W)?(N.attribName=W,N.state=T.ATTRIB_NAME):(z(N,"Invalid attribute name"),N.state=T.ATTRIB)}continue;case T.ATTRIB_VALUE:if(x(W))continue;b(W)?(N.q=W,N.state=T.ATTRIB_VALUE_QUOTED):(N.opt.unquotedAttributeValues||ve(N,"Unquoted attribute value"),N.state=T.ATTRIB_VALUE_UNQUOTED,N.attribValue=W);continue;case T.ATTRIB_VALUE_QUOTED:if(W!==N.q){W==="&"?N.state=T.ATTRIB_VALUE_ENTITY_Q:N.attribValue+=W;continue}Ae(N),N.q="",N.state=T.ATTRIB_VALUE_CLOSED;continue;case T.ATTRIB_VALUE_CLOSED:x(W)?N.state=T.ATTRIB:W===">"?Ie(N):W==="/"?N.state=T.OPEN_TAG_SLASH:k(y,W)?(z(N,"No whitespace between attributes"),N.attribName=W,N.attribValue="",N.state=T.ATTRIB_NAME):z(N,"Invalid attribute name");continue;case T.ATTRIB_VALUE_UNQUOTED:if(!A(W)){W==="&"?N.state=T.ATTRIB_VALUE_ENTITY_U:N.attribValue+=W;continue}Ae(N),W===">"?Ie(N):N.state=T.ATTRIB;continue;case T.CLOSE_TAG:if(N.tagName)W===">"?_(N):k(w,W)?N.tagName+=W:N.script?(N.script+="</"+N.tagName+W,N.tagName="",N.state=T.SCRIPT):(x(W)||z(N,"Invalid tagname in closing tag"),N.state=T.CLOSE_TAG_SAW_WHITE);else{if(x(W))continue;I(y,W)?N.script?(N.script+="</"+W,N.state=T.SCRIPT):z(N,"Invalid tagname in closing tag."):N.tagName=W}continue;case T.CLOSE_TAG_SAW_WHITE:if(x(W))continue;W===">"?_(N):z(N,"Invalid characters in closing tag");continue;case T.TEXT_ENTITY:case T.ATTRIB_VALUE_ENTITY_Q:case T.ATTRIB_VALUE_ENTITY_U:var er,ke;switch(N.state){case T.TEXT_ENTITY:er=T.TEXT,ke="textNode";break;case T.ATTRIB_VALUE_ENTITY_Q:er=T.ATTRIB_VALUE_QUOTED,ke="attribValue";break;case T.ATTRIB_VALUE_ENTITY_U:er=T.ATTRIB_VALUE_UNQUOTED,ke="attribValue";break}if(W===";"){var dr=D(N);N.opt.unparsedEntities&&!Object.values(r.XML_ENTITIES).includes(dr)?((N.entityCount+=1)>N.opt.maxEntityCount&&ve(N,"Parsed entity count exceeds max entity count"),(N.entityDepth+=1)>N.opt.maxEntityDepth&&ve(N,"Parsed entity depth exceeds max entity depth"),N.entity="",N.state=er,N.write(dr),N.entityDepth-=1):(N[ke]+=dr,N.entity="",N.state=er)}else k(N.entity.length?E:S,W)?N.entity+=W:(z(N,"Invalid character in entity name"),N[ke]+="&"+N.entity+W,N.entity="",N.state=er);continue;default:throw new Error(N,"Unknown state: "+N.state)}return N.position>=N.bufferCheckPosition&&n(N),N}o(Oe,"write");String.fromCodePoint||(function(){var R=String.fromCharCode,N=Math.floor,te=o(function(){var W=16384,Ee=[],rt,er,ke=-1,dr=arguments.length;if(!dr)return"";for(var Ir="";++ke<dr;){var ar=Number(arguments[ke]);if(!isFinite(ar)||ar<0||ar>1114111||N(ar)!==ar)throw RangeError("Invalid code point: "+ar);ar<=65535?Ee.push(ar):(ar-=65536,rt=(ar>>10)+55296,er=ar%1024+56320,Ee.push(rt,er)),(ke+1===dr||Ee.length>W)&&(Ir+=R.apply(null,Ee),Ee.length=0)}return Ir},"fromCodePoint");Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:te,configurable:!0,writable:!0}):String.fromCodePoint=te})()})(typeof ZE>"u"?ZE.sax={}:ZE)});var bV=X(ew=>{"use strict";Object.defineProperty(ew,"__esModule",{value:!0});ew.NamespaceContext=void 0;var jie=class{static{o(this,"NamespaceScope")}constructor(e){this.parent=e,this.namespaces={}}getNamespaceURI(e,t){switch(e){case"xml":return"http://www.w3.org/XML/1998/namespace";case"xmlns":return"http://www.w3.org/2000/xmlns/";default:{let n=this.namespaces[e];return n!=null?n.uri:!t&&this.parent?this.parent.getNamespaceURI(e):null}}}getNamespaceMapping(e){switch(e){case"xml":return{uri:"http://www.w3.org/XML/1998/namespace",prefix:"xml",declared:!0};case"xmlns":return{uri:"http://www.w3.org/2000/xmlns/",prefix:"xmlns",declared:!0};default:{let t=this.namespaces[e];return t??(this.parent?this.parent.getNamespaceMapping(e):null)}}}getPrefix(e,t){switch(e){case"http://www.w3.org/XML/1998/namespace":return"xml";case"http://www.w3.org/2000/xmlns/":return"xmlns";default:for(let n in this.namespaces)if(this.namespaces[n].uri===e)return n;return!t&&this.parent?this.parent.getPrefix(e):null}}},qie=class{static{o(this,"NamespaceContext")}constructor(){this.scopes=[],this.pushContext(),this.prefixCount=0}addNamespace(e,t,n){return this.getNamespaceURI(e,n)===t?!1:this.currentScope?(this.currentScope.namespaces[e]={uri:t,prefix:e,declared:!1},!0):!1}pushContext(){let e=new jie(this.currentScope);return this.scopes.push(e),this.currentScope=e,e}popContext(){let e=this.scopes.pop();return e?this.currentScope=e.parent:this.currentScope=null,e}getNamespaceURI(e,t){return this.currentScope&&this.currentScope.getNamespaceURI(e,t)}getPrefix(e,t){return this.currentScope&&this.currentScope.getPrefix(e,t)}registerNamespace(e){let t=this.getPrefix(e);if(t)return t;for(;t="ns"+ ++this.prefixCount,!!this.getNamespaceURI(t););return this.addNamespace(t,e,!0),t}declareNamespace(e,t){if(this.currentScope){let n=this.currentScope.getNamespaceMapping(e);return n&&n.uri===t&&n.declared?!1:(this.currentScope.namespaces[e]={uri:t,prefix:e,declared:!0},!0)}return!1}};ew.NamespaceContext=qie});var OV=X(We=>{"use strict";var Hie=We&&We.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(We,"__esModule",{value:!0});We.ImportElement=We.IncludeElement=We.BodyElement=We.DefinitionsElement=We.ServiceElement=We.PortElement=We.BindingElement=We.PortTypeElement=We.OperationElement=We.TypesElement=We.SchemaElement=We.DocumentationElement=We.MessageElement=We.AllElement=We.AttributeElement=We.SequenceElement=We.SimpleContentElement=We.ComplexContentElement=We.ComplexTypeElement=We.EnumerationElement=We.ChoiceElement=We.ExtensionElement=We.RestrictionElement=We.SimpleTypeElement=We.OutputElement=We.InputElement=We.AnyElement=We.ElementElement=We.UnexpectedElement=We.Element=void 0;var hD=require("assert"),Kie=Hie(qh()),yr=ds(),$ie=(0,Kie.default)("node-soap"),tw={string:1,boolean:1,decimal:1,float:1,double:1,anyType:1,byte:1,int:1,long:1,short:1,negativeInteger:1,nonNegativeInteger:1,positiveInteger:1,nonPositiveInteger:1,unsignedByte:1,unsignedInt:1,unsignedLong:1,unsignedShort:1,duration:0,dateTime:0,time:0,date:0,gYearMonth:0,gYear:0,gMonthDay:0,gDay:0,gMonth:0,hexBinary:0,base64Binary:0,anyURI:0,QName:0,NOTATION:0},Qt=class{static{o(this,"Element")}constructor(e,t,n,s){this.allowedChildren={},this.children=[];let i=(0,yr.splitQName)(e);this.nsName=e,this.prefix=i.prefix,this.name=i.name,this.children=[],this.xmlns={},this.schemaXmlns={},this._initializeOptions(n);for(let a in t){let u=/^xmlns:?(.*)$/.exec(a);u?this.xmlns[u[1]?u[1]:yr.TNS_PREFIX]=t[a]:a==="value"?this[this.valueKey]=t[a]:this["$"+a]=t[a]}for(let a in s){let u=/^xmlns:?(.*)$/.exec(a);u&&u[1]&&(this.schemaXmlns[u[1]]=s[a])}this.$targetNamespace!==void 0&&(this.xmlns[yr.TNS_PREFIX]=this.$targetNamespace),this.init()}deleteFixedAttrs(){this.children&&this.children.length===0&&delete this.children,this.xmlns&&Object.keys(this.xmlns).length===0&&delete this.xmlns,delete this.nsName,delete this.prefix,delete this.name}startElement(e,t,n,s,i){if(!this.allowedChildren)return;let a=this.allowedChildren[(0,yr.splitQName)(t).name];if(a==null&&!this.strict&&(a=SV),a){let u=new a(t,n,s,i);u.init();let c=e[0];c instanceof bD&&(u.definitionsXmlns=c.xmlns),e.push(u)}else this.unexpected(t)}endElement(e,t){if(this.nsName===t){if(e.length<2)return;let n=e[e.length-2];this!==e[0]&&((0,yr.defaultsDeep)(e[0].xmlns,this.xmlns),n.children.push(this),n.addChild(this)),e.pop()}}addChild(e){}unexpected(e){throw new Error("Found unexpected element ("+e+") inside "+this.nsName)}description(e,t){return this.$name||this.name}init(){}_initializeOptions(e){e?(this.valueKey=e.valueKey||"$value",this.xmlKey=e.xmlKey||"$xml",this.ignoredNamespaces=e.ignoredNamespaces||[],this.strict=e.strict||!1,this.forceUseSchemaXmlns=e.forceUseSchemaXmlns||!1):(this.valueKey="$value",this.xmlKey="$xml",this.ignoredNamespaces=[],this.strict=!1,this.forceUseSchemaXmlns=!1)}};We.Element=Qt;var SV=class AV extends Qt{static{o(this,"UnexpectedElement")}startElement(e,t,n,s,i){let a=new AV(t,n,s,i);a.init(),e.push(a)}};We.UnexpectedElement=SV;var pD=class extends Qt{static{o(this,"ElementElement")}constructor(){super(...arguments),this.allowedChildren=zr(["annotation","complexType","simpleType"])}description(e,t){let n={},s=this.$name,i=1,a=1;this.$maxOccurs==="unbounded"?a=1/0:this.$maxOccurs&&(a=parseInt(this.$maxOccurs,10)),this.$minOccurs&&(i=parseInt(this.$minOccurs,10));let u=a>1;u&&s&&(s+="[]"),t&&t[yr.TNS_PREFIX]&&(this.$targetNamespace=t[yr.TNS_PREFIX]);let c=this.$type||this.$ref;if(c){c=(0,yr.splitQName)(c);let l=c.name,f=!!Au(c.prefix,this.definitionsXmlns,e.xmlns)||!!Au(this.targetNSAlias,this.definitionsXmlns,e.xmlns)||this.forceUseSchemaXmlns,h=Au(c.prefix,t,this.xmlns,f?this.schemaXmlns:void 0,this.definitionsXmlns,e.xmlns),d=e.schemas[h],g=d&&(this.$type?d.complexTypes[l]||d.types[l]:d.elements[l]),m=this.$type?e.descriptions.types:e.descriptions.elements,v=h?`${h}::${l}`:l;if(h&&e.schemas[h]&&(t=e.schemas[h].xmlns),g&&!(l in tw))if(v in m)if(this.$ref)if(u){let y=l+"[]",w=h?`${h}::${y}`:y;m[w]=m[v],n[y]=m[w]}else n=m[v];else n[s]=m[v];else{let y={};m[v]=y,u&&"maxOccurs"in g&&(g.maxOccurs=this.$maxOccurs),this.$minOccurs&&"minOccurs"in g&&(g.minOccurs=this.$minOccurs);let w=g.description(e,t);if(typeof w=="string")y=w;else{Object.keys(w).forEach(E=>{y[E]=w[E]});let S=w[Di.Symbol];S&&(y[Di.Symbol]=S)}this.$ref?n=y:n[s]=y,typeof y=="object"&&(y.targetNSAlias=c.prefix,y.targetNamespace=h),m[v]=y}else n[s]=this.$type}else{let l=this.children;n[s]={};for(let f of l)(f instanceof aw||f instanceof nw)&&(n[s]=f.description(e,t))}return n}};We.ElementElement=pD;var rw=class extends Qt{static{o(this,"AnyElement")}};We.AnyElement=rw;var CV=class extends Qt{static{o(this,"InputElement")}constructor(){super(...arguments),this.allowedChildren=zr(["body","documentation","header","SecuritySpecRef"])}addChild(e){e instanceof ow&&(this.use=e.$use,this.use==="encoded"&&(this.encodingStyle=e.$encodingStyle),this.children.pop())}};We.InputElement=CV;var NV=class extends Qt{static{o(this,"OutputElement")}constructor(){super(...arguments),this.allowedChildren=zr(["body","documentation","header","SecuritySpecRef"])}addChild(e){e instanceof ow&&(this.use=e.$use,this.use==="encoded"&&(this.encodingStyle=e.$encodingStyle),this.children.pop())}};We.OutputElement=NV;var nw=class extends Qt{static{o(this,"SimpleTypeElement")}constructor(){super(...arguments),this.allowedChildren=zr(["restriction"])}description(e){for(let t of this.children)if(t instanceof sw)return[this.$name,t.description()].filter(Boolean).join("|");return{}}};We.SimpleTypeElement=nw;var sw=class extends Qt{static{o(this,"RestrictionElement")}constructor(){super(...arguments),this.allowedChildren=zr(["all","choice","enumeration","sequence","attribute"])}description(e,t){let n=this.children,s,i=!1,a={};for(let c of n){if(c instanceof Di){a[c.$name]=c.description(e);continue}!i&&(c instanceof _g||c instanceof Rg)&&(i=!0,s=c.description(e,t))}if(Object.keys(a).length>0&&(s=s??{},s[Di.Symbol]=a),s&&this.$base){let c=(0,yr.splitQName)(this.$base),l=c.name,f=Au(c.prefix,t,this.definitionsXmlns,e.xmlns),h=e.schemas[f],d=h&&(h.complexTypes[l]||h.types[l]||h.elements[l]);if(s.getBase=()=>d.description(e,h.xmlns),d){let g=d.description(e,h.xmlns);g[Di.Symbol]&&(0,yr.defaults)(a,g[Di.Symbol]),s=(0,yr.defaults)(s,g)}return s}let u=this.children.map(c=>c.description()).join(",");return[this.$base,u].filter(Boolean).join("|")}};We.RestrictionElement=sw;var iw=class extends Qt{static{o(this,"ExtensionElement")}constructor(){super(...arguments),this.allowedChildren=zr(["all","choice","sequence"])}description(e,t){let n={};for(let s of this.children)(s instanceof _g||s instanceof Rg)&&(n=s.description(e,t));if(this.$base){let s=(0,yr.splitQName)(this.$base),i=s.name,a=Au(s.prefix,t,this.definitionsXmlns,e.xmlns),u=e.schemas[a];if(i in tw)return this.$base;{let c=u&&(u.complexTypes[i]||u.types[i]||u.elements[i]);if(c){let l=c.description(e,u.xmlns);n=typeof l=="string"?l:(0,yr.defaults)(l,n)}}}return n}};We.ExtensionElement=iw;var Rg=class extends Qt{static{o(this,"ChoiceElement")}constructor(){super(...arguments),this.allowedChildren=zr(["any","choice","element","sequence"])}description(e,t){let n={};for(let s of this.children){let i=s.description(e,t);for(let a in i)n[a]=i[a]}return n}};We.ChoiceElement=Rg;var TV=class extends Qt{static{o(this,"EnumerationElement")}description(){return this[this.valueKey]}};We.EnumerationElement=TV;var aw=class extends Qt{static{o(this,"ComplexTypeElement")}constructor(){super(...arguments),this.allowedChildren=zr(["all","annotation","choice","complexContent","sequence","simpleContent","attribute"])}description(e,t){let n={},s=!1,i={},a=this.children||[];for(let u of a){if(u instanceof Di){i[u.$name]=u.description(e);continue}!s&&(u instanceof Rg||u instanceof _g||u instanceof gD||u instanceof mD||u instanceof dD)&&(s=!0,n=u.description(e,t))}return Object.keys(i).length>0&&(n[Di.Symbol]=i),n}};We.ComplexTypeElement=aw;var dD=class extends Qt{static{o(this,"ComplexContentElement")}constructor(){super(...arguments),this.allowedChildren=zr(["extension","restriction"])}description(e,t){for(let n of this.children)if(n instanceof iw||n instanceof sw)return n.description(e,t);return{}}};We.ComplexContentElement=dD;var mD=class extends Qt{static{o(this,"SimpleContentElement")}constructor(){super(...arguments),this.allowedChildren=zr(["extension"])}description(e,t){for(let n of this.children)if(n instanceof iw)return n.description(e,t);return{}}};We.SimpleContentElement=mD;var _g=class extends Qt{static{o(this,"SequenceElement")}constructor(){super(...arguments),this.allowedChildren=zr(["any","choice","element","sequence"])}description(e,t){let n={};for(let s of this.children){if(s instanceof rw)continue;let i=s.description(e,t);for(let a in i)n[a]=i[a]}return n}};We.SequenceElement=_g;var Di=class extends Qt{static{o(this,"AttributeElement")}description(e){return{type:this.$type,required:this.$use==="required"}}};We.AttributeElement=Di;Di.Symbol=Symbol("$attributes");var gD=class extends Qt{static{o(this,"AllElement")}constructor(){super(...arguments),this.allowedChildren=zr(["choice","element"])}description(e,t){let n={};for(let s of this.children){if(s instanceof rw)continue;let i=s.description(e,t);for(let a in i)n[a]=i[a]}return n}};We.AllElement=gD;var yD=class extends Qt{static{o(this,"MessageElement")}constructor(){super(...arguments),this.allowedChildren=zr(["part","documentation"]),this.element=null,this.parts=null}postProcess(e){let t=null,n=this.children||[];for(let s of n)if(s.name==="part"){t=s;break}if(t){if(t.$element){let s=[];delete this.parts;let i=(0,yr.splitQName)(t.$element),a=Au(i.prefix,this.definitionsXmlns,e.xmlns),u=e.schemas[a];if(this.element=u.elements[i.name],!this.element){$ie(i.name+" is not present in wsdl and cannot be processed correctly.");return}this.element.targetNSAlias=i.prefix,this.element.targetNamespace=a,this.element.$lookupType=t.$element;let c=this.element.children;if(c.length>0)for(let l of c)s.push(this._getNestedLookupTypeString(l));if(s.length>0){s=s.join("_").split("_").filter(o(function(h){return h!=="^"},"removeEmptyLookupTypes"));let l=e.schemas[this.element.targetNamespace].xmlns;for(let f=0;f<s.length;f++)s[f]=this._createLookupTypeObject(s[f],l)}if(this.element.$lookupTypes=s,this.element.$type){let l=(0,yr.splitQName)(this.element.$type),f=Au(l.prefix,u.xmlns,this.definitionsXmlns,e.xmlns);if(f&&!(l.name in tw)){u=e.schemas[f];let h=u.complexTypes[l.name]||u.types[l.name]||u.elements[l.name];h&&(this.parts=h.description(e,u.xmlns))}}else{let l=this.element.description(e,u.xmlns);this.parts=l[i.name]}this.children.splice(0,1)}else{this.parts={},delete this.element;for(let s=0;s<this.children.length;s++){let i=this.children[s];if(i.name==="documentation")continue;(0,hD.ok)(i.name==="part","Expected part element");let a=(0,yr.splitQName)(i.$type),u=Au(a.prefix,this.definitionsXmlns,e.xmlns),c=a.name;typeof e.schemas[u]<"u"?this.parts[i.$name]=e.schemas[u].types[c]||e.schemas[u].complexTypes[c]:this.parts[i.$name]=i.$type,typeof this.parts[i.$name]=="object"&&(this.parts[i.$name].prefix=a.prefix,this.parts[i.$name].xmlns=u),this.children.splice(s--,1)}}this.deleteFixedAttrs()}}description(e){if(this.element)return this.element&&this.element.description(e);let t={};return t[this.$name]=this.parts,t}_createLookupTypeObject(e,t){let n=(0,yr.splitQName)(e),s=n.prefix,i=n.name.split("#"),a=i[0],u=i[1];return{$namespace:t[s],$type:s+":"+a,$name:u}}_getNestedLookupTypeString(e){let t="^",n=this.ignoredNamespaces.concat("xs");return Object.hasOwnProperty.call(e,"$type")&&typeof e.$type=="string"&&n.indexOf(e.$type.split(":")[0])===-1&&(t+="_"+e.$type+"#"+e.$name),e.children.length>0&&e.children.forEach(s=>{let i=this._getNestedLookupTypeString(s).replace(/\^_/,"");i&&typeof i=="string"&&(t+="_"+i)}),t}};We.MessageElement=yD;var IV=class extends Qt{static{o(this,"DocumentationElement")}};We.DocumentationElement=IV;var Bg=class DV extends Qt{static{o(this,"SchemaElement")}constructor(){super(...arguments),this.allowedChildren=zr(["complexType","element","import","include","simpleType"]),this.complexTypes={},this.types={},this.elements={},this.includes=[]}merge(e){return(0,hD.ok)(e instanceof DV),(0,yr.merge)(this.complexTypes,e.complexTypes),(0,yr.merge)(this.types,e.types),(0,yr.merge)(this.elements,e.elements),(0,yr.merge)(this.xmlns,e.xmlns),(0,yr.merge)(this,(0,yr.pickBy)(e,(t,n)=>n.startsWith("$")&&!Object.hasOwnProperty.call(this,n))),this}addChild(e){if(!(e.$name in tw)){if(e instanceof SD||e instanceof AD){let t=e.$schemaLocation||e.$location;t&&this.includes.push({namespace:e.$namespace||e.$targetNamespace||this.$targetNamespace,location:t})}else e instanceof aw?this.complexTypes[e.$name]=e:e instanceof pD?this.elements[e.$name]=e:e instanceof nw&&(this.types[e.$name]=e);this.children.pop()}}};We.SchemaElement=Bg;var vD=class extends Qt{static{o(this,"TypesElement")}constructor(){super(...arguments),this.allowedChildren=zr(["documentation","schema"]),this.schemas={}}addChild(e){(0,hD.ok)(e instanceof Bg);let t=e.includes.find(i=>Object.hasOwnProperty.call(i,"namespace")),n=typeof t<"u"&&Object.hasOwnProperty.call(t,"namespace")&&e instanceof Bg?t.namespace:void 0,s=e.$targetNamespace||e.includes[0]?.namespace||n;Object.hasOwnProperty.call(this.schemas,s)?s===e.$targetNamespace?this.schemas[s]=e:console.error('Target-Namespace "'+s+'" already in use by another Schema!'):this.schemas[s]=e}};We.TypesElement=vD;var BV=class RV extends Qt{static{o(this,"OperationElement")}constructor(){super(...arguments),this.allowedChildren=zr(["documentation","fault","input","operation","output"]),this.input=null,this.output=null,this.inputSoap=null,this.outputSoap=null,this.style="",this.soapAction=""}addChild(e){e instanceof RV&&(this.soapAction=e.$soapAction||"",this.style=e.$style||"",this.children.pop())}postProcess(e,t){let n=this.children;for(let s=0;s<n.length;s++){let i=n[s];if(i.name!=="input"&&i.name!=="output")continue;if(t==="binding"){this[i.name]=i,n.splice(s--,1);continue}let a=(0,yr.splitQName)(i.$message).name,u=e.messages[a];u&&(u.postProcess(e),u.element?(e.messages[u.element.$name]=u,this[i.name]=u.element):this[i.name]=u,n.splice(s--,1))}this.deleteFixedAttrs()}description(e){let t=this.input?this.input.description(e):null,n=this.output?this.output.description(e):null;return{input:t&&t[Object.keys(t)[0]],output:n&&n[Object.keys(n)[0]]}}};We.OperationElement=BV;var xD=class extends Qt{static{o(this,"PortTypeElement")}constructor(){super(...arguments),this.allowedChildren=zr(["documentation","operation"]),this.methods={}}postProcess(e){let t=this.children;if(!(typeof t>"u")){for(let n=0;n<t.length;n++){let s=t[n];s.name==="operation"&&(s.postProcess(e,"portType"),this.methods[s.$name]=s,t.splice(n--,1))}delete this.$name,this.deleteFixedAttrs()}}description(e){let t={};for(let n in this.methods){let s=this.methods[n];t[n]=s.description(e)}return t}};We.PortTypeElement=xD;var ED=class extends Qt{static{o(this,"BindingElement")}constructor(){super(...arguments),this.allowedChildren=zr(["binding","documentation","operation","SecuritySpec"]),this.transport="",this.style="",this.methods={}}addChild(e){e.name==="binding"&&(this.transport=e.$transport,this.style=e.$style,this.children.pop())}postProcess(e){let t=(0,yr.splitQName)(this.$type).name,n=e.portTypes[t],s=this.style,i=this.children;if(n){n.postProcess(e),this.methods=n.methods;for(let a=0;a<i.length;a++){let u=i[a];if(u.name!=="operation")continue;u.postProcess(e,"binding"),i.splice(a--,1),u.style||(u.style=s);let c=this.methods[u.$name];c&&(c.style=u.style,c.soapAction=u.soapAction,c.inputSoap=u.input||null,c.outputSoap=u.output||null,c.inputSoap&&c.inputSoap.deleteFixedAttrs(),c.outputSoap&&c.outputSoap.deleteFixedAttrs())}}delete this.$name,delete this.$type,this.deleteFixedAttrs()}description(e){let t={};for(let n in this.methods){let s=this.methods[n];t[n]=s.description(e)}return t}};We.BindingElement=ED;var _V=class extends Qt{static{o(this,"PortElement")}constructor(){super(...arguments),this.allowedChildren=zr(["address","documentation"]),this.location=null}addChild(e){e.name==="address"&&typeof e.$location<"u"&&(this.location=e.$location)}};We.PortElement=_V;var wD=class extends Qt{static{o(this,"ServiceElement")}constructor(){super(...arguments),this.allowedChildren=zr(["documentation","port"]),this.ports={}}postProcess(e){let t=this.children,n=e.bindings;if(t&&t.length>0)for(let s=0;s<t.length;s++){let i=t[s];if(i.name!=="port")continue;let a=(0,yr.splitQName)(i.$binding).name,u=n[a];u&&(u.postProcess(e),this.ports[i.$name]={location:i.location,binding:u},t.splice(s--,1))}delete this.$name,this.deleteFixedAttrs()}description(e){let t={};for(let n in this.ports){let s=this.ports[n];t[n]=s.binding.description(e)}return t}};We.ServiceElement=wD;var bD=class extends Qt{static{o(this,"DefinitionsElement")}constructor(){super(...arguments),this.allowedChildren=zr(["binding","documentation","import","message","portType","service","types"]),this.messages={},this.portTypes={},this.bindings={},this.services={},this.schemas={},this.descriptions={types:{},elements:{}}}init(){this.name!=="definitions"&&this.unexpected(this.nsName)}addChild(e){if(e instanceof vD)(0,yr.merge)(this.schemas,e.schemas);else if(e instanceof yD)this.messages[e.$name]=e;else if(e.name==="import"){let t=new Bg(e.$namespace,{});t.init(),this.schemas[e.$namespace]=t,this.schemas[e.$namespace].addChild(e)}else e instanceof xD?this.portTypes[e.$name]=e:e instanceof ED?(e.transport==="http://schemas.xmlsoap.org/soap/http"||e.transport==="http://www.w3.org/2003/05/soap/bindings/HTTP/")&&(this.bindings[e.$name]=e):e instanceof wD&&(this.services[e.$name]=e);this.children.pop()}};We.DefinitionsElement=bD;var ow=class extends Qt{static{o(this,"BodyElement")}};We.BodyElement=ow;var SD=class extends Qt{static{o(this,"IncludeElement")}};We.IncludeElement=SD;var AD=class extends Qt{static{o(this,"ImportElement")}};We.ImportElement=AD;var Xie={all:gD,any:rw,binding:ED,body:ow,choice:Rg,complexContent:dD,complexType:aw,definitions:bD,documentation:IV,element:pD,enumeration:TV,extension:iw,fault:Qt,import:AD,include:SD,input:CV,message:yD,operation:BV,output:NV,port:_V,portType:xD,restriction:sw,schema:Bg,sequence:_g,service:wD,simpleContent:mD,simpleType:nw,types:vD,attribute:Di};function zr(r){let e={};for(let t of r)e[t.replace(/^_/,"")]=Xie[t]||Qt;return e}o(zr,"buildAllowedChildren");function Au(r,...e){for(let t of e)if(t?.[r])return t[r]}o(Au,"findNs")});var TD=X(vs=>{"use strict";var Gie=vs&&vs.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:o(function(){return e[t]},"get")}),Object.defineProperty(r,n,s)}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),zie=vs&&vs.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),fw=vs&&vs.__importStar||(function(){var r=o(function(e){return r=Object.getOwnPropertyNames||function(t){var n=[];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(n[n.length]=s);return n},r(e)},"ownKeys");return function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=r(e),s=0;s<n.length;s++)n[s]!=="default"&&Gie(t,e,n[s]);return zie(t,e),t}})(),Wie=vs&&vs.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(vs,"__esModule",{value:!0});vs.WSDL=void 0;vs.trim=ND;vs.open_wsdl=FV;var Jie=require("assert"),Yie=Wie(qh()),Qie=fw(require("fs")),PV=ds(),Og=fw(require("path")),uw=fw(wV()),Zie=AE(),eae=bV(),cr=ds(),gl=fw(OV()),kV=(0,Yie.default)("node-soap"),LV="http://www.w3.org/2001/XMLSchema-instance",tae="http://schemas.xmlsoap.org/soap/envelope/";function ND(r){return r.trim()}o(ND,"trim");function cw(r){return r&&r.charAt(r.length-1)!==":"?r+":":r}o(cw,"appendColon");function CD(r){return r&&r.charAt(r.length-1)===":"?r.substring(0,r.length-1):r}o(CD,"noColonNameSpace");var lw=class{static{o(this,"WSDL")}constructor(e,t,n){this.ignoredNamespaces=["tns","targetNamespace","typedNamespace"],this.ignoreBaseNameSpaces=!1,this.valueKey="$value",this.xmlKey="$xml";let s;if(this.uri=t,this.callback=()=>{},this._includesWsdl=[],this.WSDL_CACHE={},n&&n.WSDL_CACHE&&(this.WSDL_CACHE=n.WSDL_CACHE),this._initializeOptions(n),typeof e=="string")e=(0,cr.stripBom)(e),s=this._fromXML;else if(typeof e=="object")s=this._fromServices;else throw new Error("WSDL constructor takes either an XML string or service definition");process.nextTick(()=>{try{s.call(this,e)}catch(i){return this.callback(i)}this.processIncludes(i=>{let a;if(i)return this.callback(i);try{this.definitions.deleteFixedAttrs();let u=this.services=this.definitions.services;if(u)for(a in u)u[a].postProcess(this.definitions);let c=this.definitions.complexTypes;if(c)for(a in c)c[a].deleteFixedAttrs();let l=this.definitions.bindings;for(let f in l){let h=l[f];typeof h.style>"u"&&(h.style="document");let d=h.methods,g=h.topElements={};for(let m in d)if((d[m].style||h.style)==="document"&&d[m].input){let v=d[m].input.$name,y="";d[m].output&&(y=d[m].output.$name),g[v]={methodName:m,outputName:y}}}this.xmlnsInEnvelope=this._xmlnsMap(),this.callback(i,this)}catch(u){this.callback(u)}})})}onReady(e){e&&(this.callback=e)}processIncludes(e){let t=this.definitions.schemas,n=[];for(let s in t){let i=t[s];n=n.concat(i.includes||[])}this._processNextInclude(n,e)}describeServices(){let e={};for(let t in this.services){let n=this.services[t];e[t]=n.description(this.definitions)}return e}toXML(){return this.xml||""}getSaxStream(e){let t=uw.createStream(!0,null);return e.pipe(t),t}xmlToObject(e,t){let n=typeof t=="function"?{}:uw.parser(!0,null),s=null,i={},u=[{name:null,object:i,schema:{Envelope:{Header:{Security:{UsernameToken:{Username:"string",Password:"string"}}},Body:{Fault:{faultcode:"string",faultstring:"string",detail:"string"}}}}}],c=new Map,l="soap",f={},h={};if(n.onopentag=g=>{let m=g.name,v=g.attributes,y=(0,cr.splitQName)(m).name,w,S=u[u.length-1],E=S.schema,x={},b=!1,A=!1,k={},I=y;if(v.href){let U=v.href.substr(1);h[U]||(h[U]={hrefs:[],obj:null}),h[U].hrefs.push({par:S.object,key:y,obj:k})}v.id&&(h[v.id]||(h[v.id]={hrefs:[],obj:null}));for(w in v){let U=v[w];if(/^xmlns:|^xmlns$/.test(w)){let M=(0,cr.splitQName)(w).name;f[M]=U,U===LV&&c.set(M,U),U===tae&&(l=M);continue}b=!0,x[w]=U}for(w in x){let U=(0,cr.splitQName)(w);if(U.name==="nil"&&f[U.prefix]===LV&&x[w]&&(x[w].toLowerCase()==="true"||x[w]==="1")){A=!0;break}}if(b&&(k[this.options.attributesKey]=x),!s&&f[l]&&S.name==="Body"&&y!=="Fault"){let U=this.definitions.messages[y];if(!U)try{let M=!1;/Response$/.test(y)?y=y.replace(/Response$/,""):/Request$/.test(y)?(M=!0,y=y.replace(/Request$/,"")):/Solicit$/.test(y)&&(M=!0,y=y.replace(/Solicit$/,""));let ie=this.definitions.portTypes,Z=Object.keys(ie);for(let ue of Z){let $=ie[ue];if($.methods[y])try{M?y=$.methods[y].input.$name:y=$.methods[y].output.$name,U=this.definitions.messages[y];break}catch{throw new Error(`Failed to lookup message ${y} in methods`)}}if(!U)throw new Error(`Could not find message ${y}`);this.definitions.messages[I]=U}catch(M){this.options.returnFault&&n.onerror(M)}E=U.description(this.definitions),s=I}let T,V;for(let U of c.keys())if(`${U}:type`in x){V=x[`${U}:type`];break}if(V){let U=(0,cr.splitQName)(V),M;U.prefix===cr.TNS_PREFIX?M=f[U.prefix]||f.xmlns:M=f[U.prefix];let ie=this.findSchemaObject(M,U.name);ie&&(T=ie.description(this.definitions))}E&&E[y+"[]"]&&(y=y+"[]"),u.push({name:I,object:k,schema:T||E&&E[y],id:v.id,nil:A})},n.onclosetag=g=>{let m=u.pop(),v=m.object,y=u[u.length-1],w=y.object,S=y.schema,E=(0,cr.splitQName)(g).name;if(typeof m.schema=="string"&&(0,cr.splitQName)(m.schema).name==="string"&&typeof v=="object"&&Object.keys(v).length===0&&(v=m.object=this.options.preserveWhitespace&&m.text||""),m.nil===!0)if(this.options.handleNilAsNull)v=null;else return;(0,PV.isPlainObject)(v)&&!Object.keys(v).length&&(v=null),S&&S[E+"[]"]?(w[E]||(w[E]=[]),w[E].push(v)):E in w?(Array.isArray(w[E])||(w[E]=[w[E]]),w[E].push(v)):w[E]=v,m.id&&(h[m.id].obj=v)},n.oncdata=g=>{let m=g;if(g=ND(g),!!g.length)if(/<\?xml[\s\S]+\?>/.test(g)){let v=u[u.length-1],y=this.xmlToObject(g);v.object[this.options.attributesKey]?v.object[this.options.valueKey]=y:v.object=y}else n.ontext(m)},n.onerror=g=>{throw n.resume(),{Fault:{faultcode:500,faultstring:"Invalid XML",detail:new Error(g).message,statusCode:500}}},n.ontext=g=>{let m=u[u.length-1],v=g;if(g=ND(g),!g.length){this.options.preserveWhitespace&&(m.text=(m.text||"")+v);return}let y=(0,cr.splitQName)(m.schema).name,w;this.options&&this.options.customDeserializer&&this.options.customDeserializer[y]?w=this.options.customDeserializer[y](g,m):y==="int"||y==="integer"||y==="short"||y==="long"?w=parseInt(g,10):y==="double"||y==="float"||y==="decimal"?w=Number(g):y==="bool"||y==="boolean"?w=g.toLowerCase()==="true"||g==="1":y==="dateTime"||y==="date"?w=new Date(g):(this.options.preserveWhitespace&&(g=v),typeof m.object!="string"?w=g:w=m.object+g),m.object[this.options.attributesKey]?m.object[this.options.valueKey]=w:m.object=w},typeof t=="function"){let g=uw.createStream(!0,null);g.on("opentag",n.onopentag),g.on("closetag",n.onclosetag),g.on("cdata",n.oncdata),g.on("text",n.ontext),e.pipe(g).on("error",m=>{t(m)}).on("end",()=>{let m;try{m=d()}catch(v){return t(v)}t(null,m)});return}return n.write(e).close(),d();function d(){for(let g in h){let m=h[g];for(let v of m.hrefs)Object.assign(v.obj,m.obj)}if(i.Envelope){let g=i.Envelope.Body;if(g&&g.Fault){let m=g.Fault,v=m.faultcode&&m.faultcode.$value,y=m.faultstring&&m.faultstring.$value,w=m.detail&&m.detail.$value;v=v||m.faultcode,y=y||m.faultstring,w=w||m.detail,v=v||m.Code&&`${m.Code.Value}: ${m.Code.Subcode&&m.Code.Subcode.Value}`,y=y||m.Reason&&m.Reason.Text.$value,y=y||m.Reason&&m.Reason.Text,w=w||m.Detail;let S=new Error(v+": "+y+(w?": "+JSON.stringify(w):""));throw S.root=i,S}return i.Envelope}return i}o(d,"finish")}findSchemaObject(e,t){if(!e||!t)return null;let n=null;if(this.definitions.schemas){let s=this.definitions.schemas[e];s&&(t.indexOf(":")!==-1&&(t=t.substring(t.indexOf(":")+1,t.length)),n=s.complexTypes[t]||s.types[t]||s.elements[t])}return n}objectToDocumentXML(e,t,n,s,i){if(t&&t._xml)return t._xml;let a={};a[e]=t;let u=i?this.findSchemaObject(s,i):null;return this.objectToXML(a,null,n,s,!0,null,u)}objectToRpcXML(e,t,n,s,i){let a=[],u=this.definitions,c="_xmlns";n=n||(0,cr.findPrefix)(u.xmlns,s),s=s||u.xmlns[n],n=n===cr.TNS_PREFIX?"":n+":",a.push(["<",n,e,">"].join(""));for(let l in t)if(Object.prototype.hasOwnProperty.call(t,l)&&l!==c){let f=t[l];if(l===this.options.xmlKey)a.push(this.objectToXML({[l]:f},null,n,s));else{let h=(i?"":n)+l,d=[];if(typeof f=="object"&&Object.prototype.hasOwnProperty.call(f,this.options.attributesKey)){let g=f[this.options.attributesKey];for(let m in g)d.push(" "+m+'="'+g[m]+'"')}a.push(["<",h].concat(d).concat(">").join("")),a.push(typeof f=="object"?this.objectToXML(f,l,n,s):(0,cr.xmlEscape)(f)),a.push(["</",h,">"].join(""))}}return a.push(["</",n,e,">"].join("")),a.join("")}isIgnoredNameSpace(e){return this.options.ignoredNamespaces.indexOf(e)>-1}filterOutIgnoredNameSpace(e){let t=CD(e);return this.isIgnoredNameSpace(t)?"":t}objectToXML(e,t,n,s,i,a,u,c){let l=this.definitions.schemas[s];if(this.options.overrideElementKey&&Object.keys(this.options.overrideElementKey).length>0)for(let E in this.options.overrideElementKey){let x=this.options.overrideElementKey[E];e&&e[E]&&(Object.defineProperty(e,x,Object.getOwnPropertyDescriptor(e,E)),delete e[E])}let f=n?n.parent:void 0;typeof f<"u"&&(n=n.current),f=CD(f),this.isIgnoredNameSpace(f)&&(f="");let h=!l,d=l&&l.$elementFormDefault==="qualified",g=[],m=(n||d)&&n!==cr.TNS_PREFIX,v="";s&&i&&(this.options.overrideRootElement&&this.options.overrideRootElement.xmlnsAttributes?this.options.overrideRootElement.xmlnsAttributes.forEach(E=>{v+=" "+E.name+'="'+E.value+'"'}):(m&&!this.isIgnoredNameSpace(n)&&(v+=" xmlns:"+n+'="'+s+'"'),(d||h)&&(v+=' xmlns="'+s+'"'))),c?c.pushContext():(c=new eae.NamespaceContext,c.declareNamespace(n,s)),a&&!(this.options.overrideRootElement&&this.options.overrideRootElement.xmlnsAttributes)&&(v=a);let y="";this.options.overrideRootElement&&i?y=this.options.overrideRootElement.namespace:m&&(d||i||h)&&!this.isIgnoredNameSpace(n)&&(y=n);let w,S;if(Array.isArray(e)){let E="",x=!1,b=/^([^:]+):([^:]+)$/.exec(t);for(b?(E=b[1],t=b[2]):t[0]===":"&&(x=!0,t=t.substr(1)),w=0,S=e.length;w<S;w++){let A=e[w],k=this.processAttributes(A,c),I=E||f||y,T=this.objectToXML(A,t,n,s,!1,null,u,c),V=["<",t,k,v];x||(V=["<",cw(I),t,k,v]),T===""&&this.options.useEmptyTag?(V.push(" />"),g.push(V.join(""))):(V.push(">"),(this.options.namespaceArrayElements||w===0)&&g.push(V.join("")),g.push(T),(this.options.namespaceArrayElements||w===S-1)&&(x?g.push(["</",t,">"].join("")):g.push(["</",cw(I),t,">"].join(""))))}}else if(typeof e=="object"){let E="";for(t in e){if(e.hasOwnProperty||(e=Object.assign({},e)),!Object.prototype.hasOwnProperty.call(e,t)||t===this.options.attributesKey)continue;if(t===this.options.xmlKey)return c.popContext(),e[t];if(t===this.options.valueKey)return c.popContext(),(0,cr.xmlEscape)(e[t]);let x=e[t];if(typeof x>"u")continue;let b=this.processAttributes(x,c),A="",k="",I=!1,T=/^([^:]+):([^:]+)$/.exec(t);if(T?(k=T[1]+":",t=T[2]):t[0]===":"&&(I=!0,t=t.substr(1)),i)A=this.objectToXML(x,t,n,s,!1,null,u,c);else if(this.definitions.schemas)if(l){let U=this.findChildSchemaObject(u,t);if(U&&(U.$type&&U.$type.indexOf("xsd:")===-1||U.$ref||U.$name)){let M="",ie="",Z,ue="",$=U.$ref||U.$name;if($){$=(0,cr.splitQName)($),ie=$.name,$.prefix===cr.TNS_PREFIX?(Z=U.$targetNamespace,M=c.registerNamespace(Z),this.isIgnoredNameSpace(M)&&(M=n)):(M=$.prefix,this.isIgnoredNameSpace(M)&&(M=n),Z=l.xmlns[M]||this.definitions.xmlns[M]);let xe=!1;U.$name&&U.targetNamespace===void 0&&(U.$form==="unqualified"?xe=!0:U.$form==="qualified"?xe=!1:xe=l.$elementFormDefault!=="qualified"),xe&&(M=""),Z&&M&&c.declareNamespace(M,Z)&&(ue=" xmlns:"+M+'="'+Z+'"',v.includes(M)||(E=ue,v+=ue))}let de;if(U.$type){let xe=(0,cr.splitQName)(U.$type),ve=U.$baseNameSpace||xe.prefix,me=l.xmlns[ve]||this.definitions.xmlns[ve];Z=me,me!=="http://www.w3.org/2001/XMLSchema"&&ve!==cr.TNS_PREFIX&&c.addNamespace(ve,me),de=this.findSchemaType(xe.name,me)||U}else de=this.findSchemaObject(Z,ie)||U;U.$baseNameSpace&&this.options.ignoreBaseNameSpaces&&(M=n,Z=s),this.options.ignoreBaseNameSpaces&&(M="",Z=""),y=M,Array.isArray(x)?(M={current:M,parent:y},ue=ue&&ue.length?ue:E):ue=null,A=this.objectToXML(x,t,M,Z,!1,ue,de,c)}else e[this.options.attributesKey]&&e[this.options.attributesKey].xsi_type?(k=e[this.options.attributesKey].xsi_type.prefix,c.addNamespace(e[this.options.attributesKey].xsi_type.prefix,e[this.options.attributesKey].xsi_type.xmlns),A=this.objectToXML(x,t,e[this.options.attributesKey].xsi_type.prefix,e[this.options.attributesKey].xsi_type.xmlns,!1,null,null,c)):(Array.isArray(x)&&(I?t=":"+t:t=k+t),A=this.objectToXML(x,t,n,s,!1,null,null,c))}else A=this.objectToXML(x,t,n,s,!1,null,null,c);y=CD(y),m&&!d&&i&&!this.options.overrideRootElement?y=n:this.isIgnoredNameSpace(y)&&(y="");let V=!A&&this.options.useEmptyTag;Array.isArray(x)||g.push(["<",I?"":cw(k||y),t,b,v,x===null?' xsi:nil="true"':"",V?" />":">"].join("")),V||(g.push(A),Array.isArray(x)||g.push(["</",I?"":cw(k||y),t,">"].join("")))}}else e!==void 0&&g.push(this.options.escapeXML?(0,cr.xmlEscape)(e):e);return c.popContext(),g.join("")}processAttributes(e,t){let n="";e==null&&(e=[]);let s=e[this.options.attributesKey]||{};if(s&&s.xsi_type){let i=s.xsi_type,a=i.prefix||i.namespace;i.xmlns&&(a?t.declareNamespace(a,i.xmlns):a=t.registerNamespace(i.xmlns),i.prefix=a)}return Object.keys(s).forEach(i=>{let a=s[i];if(i==="xsi_type"){let u=a.type;a.prefix&&(u=`${a.prefix}:${u}`),n+=` xsi:type="${u}"`,a.xmlns&&(n+=` xmlns:${a.prefix}="${a.xmlns}"`)}else n+=` ${i}="${(0,cr.xmlEscape)(a)}"`}),n}findSchemaType(e,t){if(!this.definitions.schemas||!e||!t)return null;let n=this.definitions.schemas[t];return!n||!n.complexTypes?null:n.complexTypes[e]}findChildSchemaObject(e,t,n){if(!e||!t||(n||(n=[]),n.indexOf(e)>=0))return null;n=n.concat([e]);let s=null,i=0,a;if(Array.isArray(e.$lookupTypes)&&e.$lookupTypes.length){let l=e.$lookupTypes;for(i=0;i<l.length;i++){let f=l[i];if(f.$name===t){s=f;break}}}let u=e;if(u.$name===t&&u.name==="element"||u.$ref&&(a=(0,cr.splitQName)(u.$ref),a.name===t))return u;let c;if(u.$type&&n.length===1){let l=(0,cr.splitQName)(u.$type);l.prefix===cr.TNS_PREFIX?c=e.$targetNamespace:c=this.definitions.xmlns[l.prefix];let f=this.findSchemaType(l.name,c);if(f)return this.findChildSchemaObject(f,t,n)}if(u.$base&&(!Array.isArray(u.children)||!u.children.length)){let l=(0,cr.splitQName)(u.$base);c=e.$targetNamespace,l.prefix!==cr.TNS_PREFIX&&(c=this.definitions.xmlns[l.prefix]);let f=this.findSchemaType(l.name,c);if(f)return this.findChildSchemaObject(f,t,n)}if(Array.isArray(u.children)&&u.children.length>0)for(let l of u.children){if(s=this.findChildSchemaObject(l,t,n),s)break;if(l.$base){let f=(0,cr.splitQName)(l.$base),h=f.prefix===cr.TNS_PREFIX?"":f.prefix;c=l.xmlns[f.prefix]||l.schemaXmlns[f.prefix];let d=this.findSchemaType(f.name,c);if(d&&(s=this.findChildSchemaObject(d,t,n),s)){s.$baseNameSpace=h;break}}}return!s&&u.$name===t?u:s}_initializeOptions(e){this._originalIgnoredNamespaces=(e||{}).ignoredNamespaces,this.options={};let t=e?e.ignoredNamespaces:null;t&&(Array.isArray(t.namespaces)||typeof t.namespaces=="string")?t.override?this.options.ignoredNamespaces=t.namespaces:this.options.ignoredNamespaces=this.ignoredNamespaces.concat(t.namespaces):this.options.ignoredNamespaces=this.ignoredNamespaces,this.options.valueKey=e.valueKey||this.valueKey,this.options.xmlKey=e.xmlKey||this.xmlKey,e.escapeXML!==void 0?this.options.escapeXML=e.escapeXML:this.options.escapeXML=!0,e.returnFault!==void 0?this.options.returnFault=e.returnFault:this.options.returnFault=!1,this.options.handleNilAsNull=!!e.handleNilAsNull,e.namespaceArrayElements!==void 0?this.options.namespaceArrayElements=e.namespaceArrayElements:this.options.namespaceArrayElements=!0,this.options.wsdl_headers=e.wsdl_headers,this.options.wsdl_options=e.wsdl_options,e.httpClient&&(this.options.httpClient=e.httpClient),e.request&&(this.options.request=e.request);let n=e?e.ignoreBaseNameSpaces:null;n!==null&&typeof n<"u"?this.options.ignoreBaseNameSpaces=n:this.options.ignoreBaseNameSpaces=this.ignoreBaseNameSpaces,this.options.forceSoap12Headers=e.forceSoap12Headers,this.options.customDeserializer=e.customDeserializer,this.options.forceUseSchemaXmlns=e.forceUseSchemaXmlns,e.overrideElementKey!==void 0&&(this.options.overrideElementKey=e.overrideElementKey),e.overrideRootElement!==void 0&&(this.options.overrideRootElement=e.overrideRootElement),this.options.useEmptyTag=!!e.useEmptyTag}_processNextInclude(e,t){let n=e.shift();if(!n)return t();let s;if(!/^https?:/i.test(this.uri)&&!/^https?:/i.test(n.location))(this.options.wsdl_options!==void 0&&Object.prototype.hasOwnProperty.call(this.options.wsdl_options,"fixedPath")?this.options.wsdl_options.fixedPath:!1)?s=Og.resolve(Og.dirname(this.uri),Og.parse(n.location).base):s=Og.resolve(Og.dirname(this.uri),n.location);else if(/^https?:/i.test(n.location))s=n.location;else try{s=new URL(n.location,this.uri||"").toString()}catch{s=n.location}let i=Object.assign({},this.options);if(i.ignoredNamespaces=this._originalIgnoredNamespaces||this.options.ignoredNamespaces,i.WSDL_CACHE=this.WSDL_CACHE,this.options.wsdl_options!==void 0&&typeof this.options.wsdl_options.overrideImportLocation=="function")try{s=this.options.wsdl_options.overrideImportLocation(s,this.uri,n.location,i)}catch(a){return t(a)}rae(s,i,(a,u)=>{if(a)return t(a);if(this._includesWsdl.push(u),u.definitions instanceof gl.DefinitionsElement)(0,PV.mergeWith)(this.definitions,u.definitions,(c,l)=>c instanceof gl.SchemaElement?c.merge(l):void 0);else return t(new Error("wsdl.defintions is not an instance of elements.DefinitionsElement"));this._processNextInclude(e,c=>{t(c)})})}_parse(e){let t=uw.parser(!0,null),n=[],s=null,i=null,a=null,u=null,c=this.options;return t.onopentag=l=>{let f=l.name,h=l.attributes,d=n[n.length-1],g=(0,cr.splitQName)(f).name;if(g==="schema"&&(u=h),d)try{d.startElement(n,f,h,c,u)}catch(m){if(this.options.strict)throw m;n.push(new gl.Element(f,h,c,u))}else if(g==="definitions")s=new gl.DefinitionsElement(f,h,c),n.push(s);else if(g==="schema")s=new gl.DefinitionsElement("definitions",{},{}),i=new gl.TypesElement("types",{},{}),a=new gl.SchemaElement(f,h,c),i.addChild(a),s.addChild(i),n.push(a);else throw g==="html"?new Error("Root element of WSDL was <html>. This is likely an authentication issue."):new Error("Unexpected root element of WSDL or include")},t.onclosetag=l=>{let f=n[n.length-1];(0,Jie.ok)(f,"Unmatched close tag: "+l),f.endElement(n,l)},t.write(e).close(),s}_fromXML(e){this.definitions=this._parse(e),this.definitions.descriptions={types:{},elements:{}},this.xml=e}_fromServices(e){}_xmlnsMap(){let e=this.definitions.xmlns,t="";for(let n in e){if(n===""||n===cr.TNS_PREFIX)continue;let s=e[n];switch(s){case"http://xml.apache.org/xml-soap":case"http://schemas.xmlsoap.org/wsdl/":case"http://schemas.xmlsoap.org/wsdl/soap/":case"http://schemas.xmlsoap.org/wsdl/soap12/":case"http://schemas.xmlsoap.org/soap/encoding/":case"http://www.w3.org/2001/XMLSchema":continue}~s.indexOf("http://schemas.xmlsoap.org/")||~s.indexOf("http://www.w3.org/")||~s.indexOf("http://xml.apache.org/")||(t+=" xmlns:"+n+'="'+s+'"')}return t}};vs.WSDL=lw;function rae(r,e,t){let n,s;typeof e=="function"?(n={},s=e):(n=e,s=t);let i=n.WSDL_CACHE[r];return i?s.call(i,null,i):FV(r,n,s)}o(rae,"open_wsdl_recursive");function FV(r,e,t){let n,s;typeof e=="function"?(n={},s=e):typeof t=="function"&&(n=e,s=t);let i=n.WSDL_CACHE||{},a=n.wsdl_headers,u=n.wsdl_options,c;return/^<\?xml[^>]*?>/i.test(r)?(c=new lw(r,r,n),i[r]=c,c.WSDL_CACHE=i,c.onReady(s)):/^https?:/i.test(r)?(kV("Reading url: %s",r),(n.httpClient||new Zie.HttpClient(n)).request(r,null,(f,h,d)=>{f?s(f):h&&h.status===200?(c=new lw(d,r,n),i[r]=c,c.WSDL_CACHE=i,c.onReady(s)):s(new Error("Invalid WSDL URL: "+r+`
|
|
69
69
|
|
|
70
70
|
\r Code: `+h.status+`
|
|
71
71
|
|
|
@@ -77,15 +77,15 @@ Line: `+_.line+`
|
|
|
77
77
|
Column: `+_.column+`
|
|
78
78
|
Char: `+_.c),D=new Error(D),_.error=D,V(_,"onerror",D),_}o(Z,"error");function ue(_){return _.sawRoot&&!_.closedRoot&&$(_,"Unclosed root tag"),_.state!==I.BEGIN&&_.state!==I.BEGIN_WHITESPACE&&_.state!==I.TEXT&&Z(_,"Unexpected end"),M(_),_.c="",_.closed=!0,V(_,"onend"),t.call(_,_.strict,_.opt),_}o(ue,"end");function $(_,D){if(typeof _!="object"||!(_ instanceof t))throw new Error("bad call to strictFail");_.strict&&Z(_,D)}o($,"strictFail");function de(_){_.strict||(_.tagName=_.tagName[_.looseCase]());var D=_.tags[_.tags.length-1]||_,Y=_.tag={name:_.tagName,attributes:{}};_.opt.xmlns&&(Y.ns=D.ns),_.attribList.length=0,U(_,"onopentagstart",Y)}o(de,"newTag");function xe(_,D){var Y=_.indexOf(":"),q=Y<0?["",_]:_.split(":"),Oe=q[0],R=q[1];return D&&_==="xmlns"&&(Oe="xmlns",R=""),{prefix:Oe,local:R}}o(xe,"qname");function ve(_){if(_.strict||(_.attribName=_.attribName[_.looseCase]()),_.attribList.indexOf(_.attribName)!==-1||_.tag.attributes.hasOwnProperty(_.attribName)){_.attribName=_.attribValue="";return}if(_.opt.xmlns){var D=xe(_.attribName,!0),Y=D.prefix,q=D.local;if(Y==="xmlns")if(q==="xml"&&_.attribValue!==d)$(_,"xml: prefix must be bound to "+d+`
|
|
79
79
|
Actual: `+_.attribValue);else if(q==="xmlns"&&_.attribValue!==g)$(_,"xmlns: prefix must be bound to "+g+`
|
|
80
|
-
Actual: `+_.attribValue);else{var Oe=_.tag,R=_.tags[_.tags.length-1]||_;Oe.ns===R.ns&&(Oe.ns=Object.create(R.ns)),Oe.ns[q]=_.attribValue}_.attribList.push([_.attribName,_.attribValue])}else _.tag.attributes[_.attribName]=_.attribValue,U(_,"onattribute",{name:_.attribName,value:_.attribValue});_.attribName=_.attribValue=""}o(ve,"attrib");function me(_,D){if(_.opt.xmlns){var Y=_.tag,q=xe(_.tagName);Y.prefix=q.prefix,Y.local=q.local,Y.uri=Y.ns[q.prefix]||"",Y.prefix&&!Y.uri&&($(_,"Unbound namespace prefix: "+JSON.stringify(_.tagName)),Y.uri=q.prefix);var Oe=_.tags[_.tags.length-1]||_;Y.ns&&Oe.ns!==Y.ns&&Object.keys(Y.ns).forEach(function(
|
|
80
|
+
Actual: `+_.attribValue);else{var Oe=_.tag,R=_.tags[_.tags.length-1]||_;Oe.ns===R.ns&&(Oe.ns=Object.create(R.ns)),Oe.ns[q]=_.attribValue}_.attribList.push([_.attribName,_.attribValue])}else _.tag.attributes[_.attribName]=_.attribValue,U(_,"onattribute",{name:_.attribName,value:_.attribValue});_.attribName=_.attribValue=""}o(ve,"attrib");function me(_,D){if(_.opt.xmlns){var Y=_.tag,q=xe(_.tagName);Y.prefix=q.prefix,Y.local=q.local,Y.uri=Y.ns[q.prefix]||"",Y.prefix&&!Y.uri&&($(_,"Unbound namespace prefix: "+JSON.stringify(_.tagName)),Y.uri=q.prefix);var Oe=_.tags[_.tags.length-1]||_;Y.ns&&Oe.ns!==Y.ns&&Object.keys(Y.ns).forEach(function(ar){U(_,"onopennamespace",{prefix:ar,uri:Y.ns[ar]})});for(var R=0,N=_.attribList.length;R<N;R++){var te=_.attribList[R],W=te[0],Ee=te[1],rt=xe(W,!0),er=rt.prefix,ke=rt.local,dr=er===""?"":Y.ns[er]||"",Ir={name:W,value:Ee,prefix:er,local:ke,uri:dr};er&&er!=="xmlns"&&!dr&&($(_,"Unbound namespace prefix: "+JSON.stringify(er)),Ir.uri=er),_.tag.attributes[W]=Ir,U(_,"onattribute",Ir)}_.attribList.length=0}_.tag.isSelfClosing=!!D,_.sawRoot=!0,_.tags.push(_.tag),U(_,"onopentag",_.tag),D||(!_.noscript&&_.tagName.toLowerCase()==="script"?_.state=I.SCRIPT:_.state=I.TEXT,_.tag=null,_.tagName=""),_.attribName=_.attribValue="",_.attribList.length=0}o(me,"openTag");function z(_){if(!_.tagName){$(_,"Weird empty close tag."),_.textNode+="</>",_.state=I.TEXT;return}if(_.script){if(_.tagName!=="script"){_.script+="</"+_.tagName+">",_.tagName="",_.state=I.SCRIPT;return}U(_,"onscript",_.script),_.script=""}var D=_.tags.length,Y=_.tagName;_.strict||(Y=Y[_.looseCase]());for(var q=Y;D--;){var Oe=_.tags[D];if(Oe.name!==q)$(_,"Unexpected close tag");else break}if(D<0){$(_,"Unmatched closing tag: "+_.tagName),_.textNode+="</"+_.tagName+">",_.state=I.TEXT;return}_.tagName=Y;for(var R=_.tags.length;R-- >D;){var N=_.tag=_.tags.pop();_.tagName=_.tag.name,U(_,"onclosetag",_.tagName);var te={};for(var W in N.ns)te[W]=N.ns[W];var Ee=_.tags[_.tags.length-1]||_;_.opt.xmlns&&N.ns!==Ee.ns&&Object.keys(N.ns).forEach(function(rt){var er=N.ns[rt];U(_,"onclosenamespace",{prefix:rt,uri:er})})}D===0&&(_.closedRoot=!0),_.tagName=_.attribValue=_.attribName="",_.attribList.length=0,_.state=I.TEXT}o(z,"closeTag");function ee(_){var D=_.entity,Y=D.toLowerCase(),q,Oe="";return _.ENTITIES[D]?_.ENTITIES[D]:_.ENTITIES[Y]?_.ENTITIES[Y]:(D=Y,D.charAt(0)==="#"&&(D.charAt(1)==="x"?(D=D.slice(2),q=parseInt(D,16),Oe=q.toString(16)):(D=D.slice(1),q=parseInt(D,10),Oe=q.toString(10))),D=D.replace(/^0+/,""),isNaN(q)||Oe.toLowerCase()!==D?($(_,"Invalid character entity"),"&"+_.entity+";"):String.fromCodePoint(q))}o(ee,"parseEntity");function le(_,D){D==="<"?(_.state=I.OPEN_WAKA,_.startTagPosition=_.position):E(D)||($(_,"Non-whitespace before first tag."),_.textNode=D,_.state=I.TEXT)}o(le,"beginWhiteSpace");function Ae(_,D){var Y="";return D<_.length&&(Y=_.charAt(D)),Y}o(Ae,"charAt");function Ie(_){var D=this;if(this.error)throw this.error;if(D.closed)return Z(D,"Cannot write after close. Assign an onready handler.");if(_===null)return ue(D);typeof _=="object"&&(_=_.toString());for(var Y=0,q="";q=Ae(_,Y++),D.c=q,!!q;)switch(D.trackPosition&&(D.position++,q===`
|
|
81
81
|
`?(D.line++,D.column=0):D.column++),D.state){case I.BEGIN:if(D.state=I.BEGIN_WHITESPACE,q==="\uFEFF")continue;le(D,q);continue;case I.BEGIN_WHITESPACE:le(D,q);continue;case I.TEXT:if(D.sawRoot&&!D.closedRoot){for(var Oe=Y-1;q&&q!=="<"&&q!=="&";)q=Ae(_,Y++),q&&D.trackPosition&&(D.position++,q===`
|
|
82
82
|
`?(D.line++,D.column=0):D.column++);D.textNode+=_.substring(Oe,Y-1)}q==="<"&&!(D.sawRoot&&D.closedRoot&&!D.strict)?(D.state=I.OPEN_WAKA,D.startTagPosition=D.position):(!E(q)&&(!D.sawRoot||D.closedRoot)&&$(D,"Text data outside of root node."),q==="&"?D.state=I.TEXT_ENTITY:D.textNode+=q);continue;case I.SCRIPT:q==="<"?D.state=I.SCRIPT_ENDING:D.script+=q;continue;case I.SCRIPT_ENDING:q==="/"?D.state=I.CLOSE_TAG:(D.script+="<"+q,D.state=I.SCRIPT);continue;case I.OPEN_WAKA:if(q==="!")D.state=I.SGML_DECL,D.sgmlDecl="";else if(!E(q))if(A(v,q))D.state=I.OPEN_TAG,D.tagName=q;else if(q==="/")D.state=I.CLOSE_TAG,D.tagName="";else if(q==="?")D.state=I.PROC_INST,D.procInstName=D.procInstBody="";else{if($(D,"Unencoded <"),D.startTagPosition+1<D.position){var R=D.position-D.startTagPosition;q=new Array(R).join(" ")+q}D.textNode+="<"+q,D.state=I.TEXT}continue;case I.SGML_DECL:if(D.sgmlDecl+q==="--"){D.state=I.COMMENT,D.comment="",D.sgmlDecl="";continue}D.doctype&&D.doctype!==!0&&D.sgmlDecl?(D.state=I.DOCTYPE_DTD,D.doctype+="<!"+D.sgmlDecl+q,D.sgmlDecl=""):(D.sgmlDecl+q).toUpperCase()===f?(U(D,"onopencdata"),D.state=I.CDATA,D.sgmlDecl="",D.cdata=""):(D.sgmlDecl+q).toUpperCase()===h?(D.state=I.DOCTYPE,(D.doctype||D.sawRoot)&&$(D,"Inappropriately located doctype declaration"),D.doctype="",D.sgmlDecl=""):q===">"?(U(D,"onsgmldeclaration",D.sgmlDecl),D.sgmlDecl="",D.state=I.TEXT):(x(q)&&(D.state=I.SGML_DECL_QUOTED),D.sgmlDecl+=q);continue;case I.SGML_DECL_QUOTED:q===D.q&&(D.state=I.SGML_DECL,D.q=""),D.sgmlDecl+=q;continue;case I.DOCTYPE:q===">"?(D.state=I.TEXT,U(D,"ondoctype",D.doctype),D.doctype=!0):(D.doctype+=q,q==="["?D.state=I.DOCTYPE_DTD:x(q)&&(D.state=I.DOCTYPE_QUOTED,D.q=q));continue;case I.DOCTYPE_QUOTED:D.doctype+=q,q===D.q&&(D.q="",D.state=I.DOCTYPE);continue;case I.DOCTYPE_DTD:q==="]"?(D.doctype+=q,D.state=I.DOCTYPE):q==="<"?(D.state=I.OPEN_WAKA,D.startTagPosition=D.position):x(q)?(D.doctype+=q,D.state=I.DOCTYPE_DTD_QUOTED,D.q=q):D.doctype+=q;continue;case I.DOCTYPE_DTD_QUOTED:D.doctype+=q,q===D.q&&(D.state=I.DOCTYPE_DTD,D.q="");continue;case I.COMMENT:q==="-"?D.state=I.COMMENT_ENDING:D.comment+=q;continue;case I.COMMENT_ENDING:q==="-"?(D.state=I.COMMENT_ENDED,D.comment=ie(D.opt,D.comment),D.comment&&U(D,"oncomment",D.comment),D.comment=""):(D.comment+="-"+q,D.state=I.COMMENT);continue;case I.COMMENT_ENDED:q!==">"?($(D,"Malformed comment"),D.comment+="--"+q,D.state=I.COMMENT):D.doctype&&D.doctype!==!0?D.state=I.DOCTYPE_DTD:D.state=I.TEXT;continue;case I.CDATA:q==="]"?D.state=I.CDATA_ENDING:D.cdata+=q;continue;case I.CDATA_ENDING:q==="]"?D.state=I.CDATA_ENDING_2:(D.cdata+="]"+q,D.state=I.CDATA);continue;case I.CDATA_ENDING_2:q===">"?(D.cdata&&U(D,"oncdata",D.cdata),U(D,"onclosecdata"),D.cdata="",D.state=I.TEXT):q==="]"?D.cdata+="]":(D.cdata+="]]"+q,D.state=I.CDATA);continue;case I.PROC_INST:q==="?"?D.state=I.PROC_INST_ENDING:E(q)?D.state=I.PROC_INST_BODY:D.procInstName+=q;continue;case I.PROC_INST_BODY:if(!D.procInstBody&&E(q))continue;q==="?"?D.state=I.PROC_INST_ENDING:D.procInstBody+=q;continue;case I.PROC_INST_ENDING:q===">"?(U(D,"onprocessinginstruction",{name:D.procInstName,body:D.procInstBody}),D.procInstName=D.procInstBody="",D.state=I.TEXT):(D.procInstBody+="?"+q,D.state=I.PROC_INST_BODY);continue;case I.OPEN_TAG:A(y,q)?D.tagName+=q:(de(D),q===">"?me(D):q==="/"?D.state=I.OPEN_TAG_SLASH:(E(q)||$(D,"Invalid character in tag name"),D.state=I.ATTRIB));continue;case I.OPEN_TAG_SLASH:q===">"?(me(D,!0),z(D)):($(D,"Forward-slash in opening tag not followed by >"),D.state=I.ATTRIB);continue;case I.ATTRIB:if(E(q))continue;q===">"?me(D):q==="/"?D.state=I.OPEN_TAG_SLASH:A(v,q)?(D.attribName=q,D.attribValue="",D.state=I.ATTRIB_NAME):$(D,"Invalid attribute name");continue;case I.ATTRIB_NAME:q==="="?D.state=I.ATTRIB_VALUE:q===">"?($(D,"Attribute without value"),D.attribValue=D.attribName,ve(D),me(D)):E(q)?D.state=I.ATTRIB_NAME_SAW_WHITE:A(y,q)?D.attribName+=q:$(D,"Invalid attribute name");continue;case I.ATTRIB_NAME_SAW_WHITE:if(q==="=")D.state=I.ATTRIB_VALUE;else{if(E(q))continue;$(D,"Attribute without value"),D.tag.attributes[D.attribName]="",D.attribValue="",U(D,"onattribute",{name:D.attribName,value:""}),D.attribName="",q===">"?me(D):A(v,q)?(D.attribName=q,D.state=I.ATTRIB_NAME):($(D,"Invalid attribute name"),D.state=I.ATTRIB)}continue;case I.ATTRIB_VALUE:if(E(q))continue;x(q)?(D.q=q,D.state=I.ATTRIB_VALUE_QUOTED):(D.opt.unquotedAttributeValues||Z(D,"Unquoted attribute value"),D.state=I.ATTRIB_VALUE_UNQUOTED,D.attribValue=q);continue;case I.ATTRIB_VALUE_QUOTED:if(q!==D.q){q==="&"?D.state=I.ATTRIB_VALUE_ENTITY_Q:D.attribValue+=q;continue}ve(D),D.q="",D.state=I.ATTRIB_VALUE_CLOSED;continue;case I.ATTRIB_VALUE_CLOSED:E(q)?D.state=I.ATTRIB:q===">"?me(D):q==="/"?D.state=I.OPEN_TAG_SLASH:A(v,q)?($(D,"No whitespace between attributes"),D.attribName=q,D.attribValue="",D.state=I.ATTRIB_NAME):$(D,"Invalid attribute name");continue;case I.ATTRIB_VALUE_UNQUOTED:if(!b(q)){q==="&"?D.state=I.ATTRIB_VALUE_ENTITY_U:D.attribValue+=q;continue}ve(D),q===">"?me(D):D.state=I.ATTRIB;continue;case I.CLOSE_TAG:if(D.tagName)q===">"?z(D):A(y,q)?D.tagName+=q:D.script?(D.script+="</"+D.tagName,D.tagName="",D.state=I.SCRIPT):(E(q)||$(D,"Invalid tagname in closing tag"),D.state=I.CLOSE_TAG_SAW_WHITE);else{if(E(q))continue;k(v,q)?D.script?(D.script+="</"+q,D.state=I.SCRIPT):$(D,"Invalid tagname in closing tag."):D.tagName=q}continue;case I.CLOSE_TAG_SAW_WHITE:if(E(q))continue;q===">"?z(D):$(D,"Invalid characters in closing tag");continue;case I.TEXT_ENTITY:case I.ATTRIB_VALUE_ENTITY_Q:case I.ATTRIB_VALUE_ENTITY_U:var N,te;switch(D.state){case I.TEXT_ENTITY:N=I.TEXT,te="textNode";break;case I.ATTRIB_VALUE_ENTITY_Q:N=I.ATTRIB_VALUE_QUOTED,te="attribValue";break;case I.ATTRIB_VALUE_ENTITY_U:N=I.ATTRIB_VALUE_UNQUOTED,te="attribValue";break}if(q===";"){var W=ee(D);D.opt.unparsedEntities&&!Object.values(r.XML_ENTITIES).includes(W)?(D.entity="",D.state=N,D.write(W)):(D[te]+=W,D.entity="",D.state=N)}else A(D.entity.length?S:w,q)?D.entity+=q:($(D,"Invalid character in entity name"),D[te]+="&"+D.entity+q,D.entity="",D.state=N);continue;default:throw new Error(D,"Unknown state: "+D.state)}return D.position>=D.bufferCheckPosition&&n(D),D}o(Ie,"write");String.fromCodePoint||(function(){var _=String.fromCharCode,D=Math.floor,Y=o(function(){var q=16384,Oe=[],R,N,te=-1,W=arguments.length;if(!W)return"";for(var Ee="";++te<W;){var rt=Number(arguments[te]);if(!isFinite(rt)||rt<0||rt>1114111||D(rt)!==rt)throw RangeError("Invalid code point: "+rt);rt<=65535?Oe.push(rt):(rt-=65536,R=(rt>>10)+55296,N=rt%1024+56320,Oe.push(R,N)),(te+1===W||Oe.length>q)&&(Ee+=_.apply(null,Oe),Oe.length=0)}return Ee},"fromCodePoint");Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:Y,configurable:!0,writable:!0}):String.fromCodePoint=Y})()})(typeof Gw>"u"?Gw.sax={}:Gw)});var R9=X(gB=>{"use strict";(function(){"use strict";gB.stripBOM=function(r){return r[0]==="\uFEFF"?r.substring(1):r}}).call(gB)});var yB=X(bl=>{"use strict";(function(){"use strict";var r;r=new RegExp(/(?!xmlns)^.*:/),bl.normalize=function(e){return e.toLowerCase()},bl.firstCharLowerCase=function(e){return e.charAt(0).toLowerCase()+e.slice(1)},bl.stripPrefix=function(e){return e.replace(r,"")},bl.parseNumbers=function(e){return isNaN(e)||(e=e%1===0?parseInt(e,10):parseFloat(e)),e},bl.parseBooleans=function(e){return/^(?:true|false)$/i.test(e)&&(e=e.toLowerCase()==="true"),e}}).call(bl)});var _9=X(no=>{"use strict";(function(){"use strict";var r,e,t,n,s,i,a,u,c,l=o(function(d,g){return function(){return d.apply(g,arguments)}},"bind"),f=o(function(d,g){for(var m in g)h.call(g,m)&&(d[m]=g[m]);function v(){this.constructor=d}return o(v,"ctor"),v.prototype=g.prototype,d.prototype=new v,d.__super__=g.prototype,d},"extend"),h={}.hasOwnProperty;u=B9(),n=require("events"),r=R9(),a=yB(),c=require("timers").setImmediate,e=_w().defaults,s=o(function(d){return typeof d=="object"&&d!=null&&Object.keys(d).length===0},"isEmpty"),i=o(function(d,g,m){var v,y,w;for(v=0,y=d.length;v<y;v++)w=d[v],g=w(g,m);return g},"processItem"),t=o(function(d,g,m){var v;return v=Object.create(null),v.value=m,v.writable=!0,v.enumerable=!0,v.configurable=!0,Object.defineProperty(d,g,v)},"defineProperty"),no.Parser=(function(d){f(g,d);function g(m){this.parseStringPromise=l(this.parseStringPromise,this),this.parseString=l(this.parseString,this),this.reset=l(this.reset,this),this.assignOrPush=l(this.assignOrPush,this),this.processAsync=l(this.processAsync,this);var v,y,w;if(!(this instanceof no.Parser))return new no.Parser(m);this.options={},y=e["0.2"];for(v in y)h.call(y,v)&&(w=y[v],this.options[v]=w);for(v in m)h.call(m,v)&&(w=m[v],this.options[v]=w);this.options.xmlns&&(this.options.xmlnskey=this.options.attrkey+"ns"),this.options.normalizeTags&&(this.options.tagNameProcessors||(this.options.tagNameProcessors=[]),this.options.tagNameProcessors.unshift(a.normalize)),this.reset()}return o(g,"Parser"),g.prototype.processAsync=function(){var m,v;try{return this.remaining.length<=this.options.chunkSize?(m=this.remaining,this.remaining="",this.saxParser=this.saxParser.write(m),this.saxParser.close()):(m=this.remaining.substr(0,this.options.chunkSize),this.remaining=this.remaining.substr(this.options.chunkSize,this.remaining.length),this.saxParser=this.saxParser.write(m),c(this.processAsync))}catch(y){if(v=y,!this.saxParser.errThrown)return this.saxParser.errThrown=!0,this.emit(v)}},g.prototype.assignOrPush=function(m,v,y){return v in m?(m[v]instanceof Array||t(m,v,[m[v]]),m[v].push(y)):this.options.explicitArray?t(m,v,[y]):t(m,v,y)},g.prototype.reset=function(){var m,v,y,w;return this.removeAllListeners(),this.saxParser=u.parser(this.options.strict,{trim:!1,normalize:!1,xmlns:this.options.xmlns}),this.saxParser.errThrown=!1,this.saxParser.onerror=(function(S){return function(E){if(S.saxParser.resume(),!S.saxParser.errThrown)return S.saxParser.errThrown=!0,S.emit("error",E)}})(this),this.saxParser.onend=(function(S){return function(){if(!S.saxParser.ended)return S.saxParser.ended=!0,S.emit("end",S.resultObject)}})(this),this.saxParser.ended=!1,this.EXPLICIT_CHARKEY=this.options.explicitCharkey,this.resultObject=null,w=[],m=this.options.attrkey,v=this.options.charkey,this.saxParser.onopentag=(function(S){return function(E){var x,b,A,k,I;if(A={},A[v]="",!S.options.ignoreAttrs){I=E.attributes;for(x in I)h.call(I,x)&&(!(m in A)&&!S.options.mergeAttrs&&(A[m]={}),b=S.options.attrValueProcessors?i(S.options.attrValueProcessors,E.attributes[x],x):E.attributes[x],k=S.options.attrNameProcessors?i(S.options.attrNameProcessors,x):x,S.options.mergeAttrs?S.assignOrPush(A,k,b):t(A[m],k,b))}return A["#name"]=S.options.tagNameProcessors?i(S.options.tagNameProcessors,E.name):E.name,S.options.xmlns&&(A[S.options.xmlnskey]={uri:E.uri,local:E.local}),w.push(A)}})(this),this.saxParser.onclosetag=(function(S){return function(){var E,x,b,A,k,I,T,V,U,M;if(I=w.pop(),k=I["#name"],(!S.options.explicitChildren||!S.options.preserveChildrenOrder)&&delete I["#name"],I.cdata===!0&&(E=I.cdata,delete I.cdata),U=w[w.length-1],I[v].match(/^\s*$/)&&!E?(x=I[v],delete I[v]):(S.options.trim&&(I[v]=I[v].trim()),S.options.normalize&&(I[v]=I[v].replace(/\s{2,}/g," ").trim()),I[v]=S.options.valueProcessors?i(S.options.valueProcessors,I[v],k):I[v],Object.keys(I).length===1&&v in I&&!S.EXPLICIT_CHARKEY&&(I=I[v])),s(I)&&(typeof S.options.emptyTag=="function"?I=S.options.emptyTag():I=S.options.emptyTag!==""?S.options.emptyTag:x),S.options.validator!=null&&(M="/"+(function(){var ie,Z,ue;for(ue=[],ie=0,Z=w.length;ie<Z;ie++)A=w[ie],ue.push(A["#name"]);return ue})().concat(k).join("/"),(function(){var ie;try{return I=S.options.validator(M,U&&U[k],I)}catch(Z){return ie=Z,S.emit("error",ie)}})()),S.options.explicitChildren&&!S.options.mergeAttrs&&typeof I=="object"){if(!S.options.preserveChildrenOrder)A={},S.options.attrkey in I&&(A[S.options.attrkey]=I[S.options.attrkey],delete I[S.options.attrkey]),!S.options.charsAsChildren&&S.options.charkey in I&&(A[S.options.charkey]=I[S.options.charkey],delete I[S.options.charkey]),Object.getOwnPropertyNames(I).length>0&&(A[S.options.childkey]=I),I=A;else if(U){U[S.options.childkey]=U[S.options.childkey]||[],T={};for(b in I)h.call(I,b)&&t(T,b,I[b]);U[S.options.childkey].push(T),delete I["#name"],Object.keys(I).length===1&&v in I&&!S.EXPLICIT_CHARKEY&&(I=I[v])}}return w.length>0?S.assignOrPush(U,k,I):(S.options.explicitRoot&&(V=I,I={},t(I,k,V)),S.resultObject=I,S.saxParser.ended=!0,S.emit("end",S.resultObject))}})(this),y=(function(S){return function(E){var x,b;if(b=w[w.length-1],b)return b[v]+=E,S.options.explicitChildren&&S.options.preserveChildrenOrder&&S.options.charsAsChildren&&(S.options.includeWhiteChars||E.replace(/\\n/g,"").trim()!=="")&&(b[S.options.childkey]=b[S.options.childkey]||[],x={"#name":"__text__"},x[v]=E,S.options.normalize&&(x[v]=x[v].replace(/\s{2,}/g," ").trim()),b[S.options.childkey].push(x)),b}})(this),this.saxParser.ontext=y,this.saxParser.oncdata=(function(S){return function(E){var x;if(x=y(E),x)return x.cdata=!0}})(this)},g.prototype.parseString=function(m,v){var y;v!=null&&typeof v=="function"&&(this.on("end",function(w){return this.reset(),v(null,w)}),this.on("error",function(w){return this.reset(),v(w)}));try{return m=m.toString(),m.trim()===""?(this.emit("end",null),!0):(m=r.stripBOM(m),this.options.async?(this.remaining=m,c(this.processAsync),this.saxParser):this.saxParser.write(m).close())}catch(w){if(y=w,this.saxParser.errThrown||this.saxParser.ended){if(this.saxParser.ended)throw y}else return this.emit("error",y),this.saxParser.errThrown=!0}},g.prototype.parseStringPromise=function(m){return new Promise((function(v){return function(y,w){return v.parseString(m,function(S,E){return S?w(S):y(E)})}})(this))},g})(n),no.parseString=function(d,g,m){var v,y,w;return m!=null?(typeof m=="function"&&(v=m),typeof g=="object"&&(y=g)):(typeof g=="function"&&(v=g),y={}),w=new no.Parser(y),w.parseString(d,v)},no.parseStringPromise=function(d,g){var m,v;return typeof g=="object"&&(m=g),v=new no.Parser(m),v.parseStringPromise(d)}}).call(no)});var O9=X(so=>{"use strict";(function(){"use strict";var r,e,t,n,s=o(function(a,u){for(var c in u)i.call(u,c)&&(a[c]=u[c]);function l(){this.constructor=a}return o(l,"ctor"),l.prototype=u.prototype,a.prototype=new l,a.__super__=u.prototype,a},"extend"),i={}.hasOwnProperty;e=_w(),r=D9(),t=_9(),n=yB(),so.defaults=e.defaults,so.processors=n,so.ValidationError=(function(a){s(u,a);function u(c){this.message=c}return o(u,"ValidationError"),u})(Error),so.Builder=r.Builder,so.Parser=t.Parser,so.parseString=t.parseString,so.parseStringPromise=t.parseStringPromise}).call(so)});var lh=X(Fn=>{"use strict";function whe(r,e,t){if(t===void 0&&(t=Array.prototype),r&&typeof t.find=="function")return t.find.call(r,e);for(var n=0;n<r.length;n++)if(ch(r,n)){var s=r[n];if(e.call(void 0,s,n,r))return s}}o(whe,"find");function Qm(r,e){return e===void 0&&(e=Object),e&&typeof e.getOwnPropertyDescriptors=="function"&&(r=e.create(null,e.getOwnPropertyDescriptors(r))),e&&typeof e.freeze=="function"?e.freeze(r):r}o(Qm,"freeze");function ch(r,e){return Object.prototype.hasOwnProperty.call(r,e)}o(ch,"hasOwn");function bhe(r,e){if(r===null||typeof r!="object")throw new TypeError("target is not an object");for(var t in e)ch(e,t)&&(r[t]=e[t]);return r}o(bhe,"assign");var EH=Qm({allowfullscreen:!0,async:!0,autofocus:!0,autoplay:!0,checked:!0,controls:!0,default:!0,defer:!0,disabled:!0,formnovalidate:!0,hidden:!0,ismap:!0,itemscope:!0,loop:!0,multiple:!0,muted:!0,nomodule:!0,novalidate:!0,open:!0,playsinline:!0,readonly:!0,required:!0,reversed:!0,selected:!0});function She(r){return ch(EH,r.toLowerCase())}o(She,"isHTMLBooleanAttribute");var wH=Qm({area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Ahe(r){return ch(wH,r.toLowerCase())}o(Ahe,"isHTMLVoidElement");var fx=Qm({script:!1,style:!1,textarea:!0,title:!0});function Che(r){var e=r.toLowerCase();return ch(fx,e)&&!fx[e]}o(Che,"isHTMLRawTextElement");function Nhe(r){var e=r.toLowerCase();return ch(fx,e)&&fx[e]}o(Nhe,"isHTMLEscapableRawTextElement");function bH(r){return r===hx.HTML}o(bH,"isHTMLMimeType");function The(r){return bH(r)||r===hx.XML_XHTML_APPLICATION}o(The,"hasDefaultHTMLNamespace");var hx=Qm({HTML:"text/html",XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),Ihe=Object.keys(hx).map(function(r){return hx[r]});function Dhe(r){return Ihe.indexOf(r)>-1}o(Dhe,"isValidMimeType");var Bhe=Qm({HTML:"http://www.w3.org/1999/xhtml",SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});Fn.assign=bhe;Fn.find=whe;Fn.freeze=Qm;Fn.HTML_BOOLEAN_ATTRIBUTES=EH;Fn.HTML_RAW_TEXT_ELEMENTS=fx;Fn.HTML_VOID_ELEMENTS=wH;Fn.hasDefaultHTMLNamespace=The;Fn.hasOwn=ch;Fn.isHTMLBooleanAttribute=She;Fn.isHTMLRawTextElement=Che;Fn.isHTMLEscapableRawTextElement=Nhe;Fn.isHTMLMimeType=bH;Fn.isHTMLVoidElement=Ahe;Fn.isValidMimeType=Dhe;Fn.MIME_TYPE=hx;Fn.NAMESPACE=Bhe});var yx=X(gx=>{"use strict";var Rhe=lh();function AH(r,e){r.prototype=Object.create(Error.prototype,{constructor:{value:r},name:{value:r.name,enumerable:!0,writable:e}})}o(AH,"extendError");var dx=Rhe.freeze({Error:"Error",IndexSizeError:"IndexSizeError",DomstringSizeError:"DomstringSizeError",HierarchyRequestError:"HierarchyRequestError",WrongDocumentError:"WrongDocumentError",InvalidCharacterError:"InvalidCharacterError",NoDataAllowedError:"NoDataAllowedError",NoModificationAllowedError:"NoModificationAllowedError",NotFoundError:"NotFoundError",NotSupportedError:"NotSupportedError",InUseAttributeError:"InUseAttributeError",InvalidStateError:"InvalidStateError",SyntaxError:"SyntaxError",InvalidModificationError:"InvalidModificationError",NamespaceError:"NamespaceError",InvalidAccessError:"InvalidAccessError",ValidationError:"ValidationError",TypeMismatchError:"TypeMismatchError",SecurityError:"SecurityError",NetworkError:"NetworkError",AbortError:"AbortError",URLMismatchError:"URLMismatchError",QuotaExceededError:"QuotaExceededError",TimeoutError:"TimeoutError",InvalidNodeTypeError:"InvalidNodeTypeError",DataCloneError:"DataCloneError",EncodingError:"EncodingError",NotReadableError:"NotReadableError",UnknownError:"UnknownError",ConstraintError:"ConstraintError",DataError:"DataError",TransactionInactiveError:"TransactionInactiveError",ReadOnlyError:"ReadOnlyError",VersionError:"VersionError",OperationError:"OperationError",NotAllowedError:"NotAllowedError",OptOutError:"OptOutError"}),CH=Object.keys(dx);function NH(r){return typeof r=="number"&&r>=1&&r<=25}o(NH,"isValidDomExceptionCode");function _he(r){return typeof r=="string"&&r.substring(r.length-dx.Error.length)===dx.Error}o(_he,"endsWithError");function mx(r,e){NH(r)?(this.name=CH[r],this.message=e||""):(this.message=r,this.name=_he(e)?e:dx.Error),Error.captureStackTrace&&Error.captureStackTrace(this,mx)}o(mx,"DOMException");AH(mx,!0);Object.defineProperties(mx.prototype,{code:{enumerable:!0,get:o(function(){var r=CH.indexOf(this.name);return NH(r)?r:0},"get")}});var TH={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25},Y_=Object.entries(TH);for(px=0;px<Y_.length;px++)SH=Y_[px][0],mx[SH]=Y_[px][1];var SH,px;function Q_(r,e){this.message=r,this.locator=e,Error.captureStackTrace&&Error.captureStackTrace(this,Q_)}o(Q_,"ParseError");AH(Q_);gx.DOMException=mx;gx.DOMExceptionName=dx;gx.ExceptionCode=TH;gx.ParseError=Q_});var iO=X(wt=>{"use strict";function PH(r){try{typeof r!="function"&&(r=RegExp);var e=new r("\u{1D306}","u").exec("\u{1D306}");return!!e&&e[0].length===2}catch{}return!1}o(PH,"detectUnicodeSupport");var t0=PH();function Fc(r){if(r.source[0]!=="[")throw new Error(r+" can not be used with chars");return r.source.slice(1,r.source.lastIndexOf("]"))}o(Fc,"chars");function Zm(r,e){if(r.source[0]!=="[")throw new Error("/"+r.source+"/ can not be used with chars_without");if(!e||typeof e!="string")throw new Error(JSON.stringify(e)+" is not a valid search");if(r.source.indexOf(e)===-1)throw new Error('"'+e+'" is not is /'+r.source+"/");if(e==="-"&&r.source.indexOf(e)!==1)throw new Error('"'+e+'" is not at the first postion of /'+r.source+"/");return new RegExp(r.source.replace(e,""),t0?"u":"")}o(Zm,"chars_without");function Bt(r){var e=this;return new RegExp(Array.prototype.slice.call(arguments).map(function(t){var n=typeof t=="string";if(n&&e===void 0&&t==="|")throw new Error("use regg instead of reg to wrap expressions with `|`!");return n?t:t.source}).join(""),t0?"mu":"m")}o(Bt,"reg");function ht(r){if(arguments.length===0)throw new Error("no parameters provided");return Bt.apply(ht,["(?:"].concat(Array.prototype.slice.call(arguments),[")"]))}o(ht,"regg");var Ohe="\uFFFD",Uc=/[-\x09\x0A\x0D\x20-\x2C\x2E-\uD7FF\uE000-\uFFFD]/;t0&&(Uc=Bt("[",Fc(Uc),"\\u{10000}-\\u{10FFFF}","]"));var Phe=new RegExp("[^"+Fc(Uc)+"]",t0?"u":""),eO=/[\x20\x09\x0D\x0A]/,khe=Fc(eO),lr=Bt(eO,"+"),Ur=Bt(eO,"*"),vx=/[:_a-zA-Z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;t0&&(vx=Bt("[",Fc(vx),"\\u{10000}-\\u{10FFFF}","]"));var Lhe=Fc(vx),tO=Bt("[",Lhe,Fc(/[-.0-9\xB7]/),Fc(/[\u0300-\u036F\u203F-\u2040]/),"]"),yi=Bt(vx,tO,"*"),IH=Bt(tO,"+"),Fhe=Bt("&",yi,";"),Uhe=ht(/&#[0-9]+;|&#x[0-9a-fA-F]+;/),xx=ht(Fhe,"|",Uhe),Ex=Bt("%",yi,";"),rO=ht(Bt('"',ht(/[^%&"]/,"|",Ex,"|",xx),"*",'"'),"|",Bt("'",ht(/[^%&']/,"|",Ex,"|",xx),"*","'")),Vhe=ht('"',ht(/[^<&"]/,"|",xx),"*",'"',"|","'",ht(/[^<&']/,"|",xx),"*","'"),Mhe=Zm(vx,":"),jhe=Zm(tO,":"),DH=Bt(Mhe,jhe,"*"),wx=Bt(DH,ht(":",DH),"?"),qhe=Bt("^",wx,"$"),Hhe=Bt("(",wx,")"),e0=ht(/"[^"]*"|'[^']*'/),Khe=Bt(/^<\?/,"(",yi,")",ht(lr,"(",Uc,"*?)"),"?",/\?>/),BH=/[\x20\x0D\x0Aa-zA-Z0-9-'()+,./:=?;!*#@$_%]/,bx=ht('"',BH,'*"',"|","'",Zm(BH,"'"),"*'"),kH="<!--",LH="-->",$he=Bt(kH,ht(Zm(Uc,"-"),"|",Bt("-",Zm(Uc,"-"))),"*",LH),RH="#PCDATA",Xhe=ht(Bt(/\(/,Ur,RH,ht(Ur,/\|/,Ur,wx),"*",Ur,/\)\*/),"|",Bt(/\(/,Ur,RH,Ur,/\)/)),Ghe=/[?*+]?/,zhe=Bt(/\([^>]+\)/,Ghe),Whe=ht("EMPTY","|","ANY","|",Xhe,"|",zhe),Jhe="<!ELEMENT",Yhe=Bt(Jhe,lr,ht(wx,"|",Ex),lr,ht(Whe,"|",Ex),Ur,">"),Qhe=Bt("NOTATION",lr,/\(/,Ur,yi,ht(Ur,/\|/,Ur,yi),"*",Ur,/\)/),Zhe=Bt(/\(/,Ur,IH,ht(Ur,/\|/,Ur,IH),"*",Ur,/\)/),epe=ht(Qhe,"|",Zhe),tpe=ht(/CDATA|ID|IDREF|IDREFS|ENTITY|ENTITIES|NMTOKEN|NMTOKENS/,"|",epe),rpe=ht(/#REQUIRED|#IMPLIED/,"|",ht(ht("#FIXED",lr),"?",Vhe)),npe=ht(lr,yi,lr,tpe,lr,rpe),spe="<!ATTLIST",ipe=Bt(spe,lr,yi,npe,"*",Ur,">"),Z_="about:legacy-compat",ape=ht('"'+Z_+'"',"|","'"+Z_+"'"),nO="SYSTEM",qA="PUBLIC",HA=ht(ht(nO,lr,e0),"|",ht(qA,lr,bx,lr,e0)),ope=Bt("^",ht(ht(nO,lr,"(?<SystemLiteralOnly>",e0,")"),"|",ht(qA,lr,"(?<PubidLiteral>",bx,")",lr,"(?<SystemLiteral>",e0,")"))),upe=Bt("^",bx,"$"),cpe=Bt("^",e0,"$"),lpe=ht(lr,"NDATA",lr,yi),fpe=ht(rO,"|",ht(HA,lpe,"?")),FH="<!ENTITY",hpe=Bt(FH,lr,yi,lr,fpe,Ur,">"),ppe=ht(rO,"|",HA),dpe=Bt(FH,lr,"%",lr,yi,lr,ppe,Ur,">"),mpe=ht(hpe,"|",dpe),gpe=Bt(qA,lr,bx),ype=Bt("<!NOTATION",lr,yi,lr,ht(HA,"|",gpe),Ur,">"),sO=Bt(Ur,"=",Ur),_H=/1[.]\d+/,vpe=Bt(lr,"version",sO,ht("'",_H,"'","|",'"',_H,'"')),OH=/[A-Za-z][-A-Za-z0-9._]*/,xpe=ht(lr,"encoding",sO,ht('"',OH,'"',"|","'",OH,"'")),Epe=ht(lr,"standalone",sO,ht("'",ht("yes","|","no"),"'","|",'"',ht("yes","|","no"),'"')),wpe=Bt(/^<\?xml/,vpe,xpe,"?",Epe,"?",Ur,/\?>/),bpe="<!DOCTYPE",Spe="<![CDATA[",Ape="]]>",Cpe=/<!\[CDATA\[/,Npe=/\]\]>/,Tpe=Bt(Uc,"*?",Npe),Ipe=Bt(Cpe,Tpe);wt.chars=Fc;wt.chars_without=Zm;wt.detectUnicodeSupport=PH;wt.reg=Bt;wt.regg=ht;wt.ABOUT_LEGACY_COMPAT=Z_;wt.ABOUT_LEGACY_COMPAT_SystemLiteral=ape;wt.AttlistDecl=ipe;wt.CDATA_START=Spe;wt.CDATA_END=Ape;wt.CDSect=Ipe;wt.Char=Uc;wt.Comment=$he;wt.COMMENT_START=kH;wt.COMMENT_END=LH;wt.DOCTYPE_DECL_START=bpe;wt.elementdecl=Yhe;wt.EntityDecl=mpe;wt.EntityValue=rO;wt.ExternalID=HA;wt.ExternalID_match=ope;wt.Name=yi;wt.NotationDecl=ype;wt.Reference=xx;wt.PEReference=Ex;wt.PI=Khe;wt.PUBLIC=qA;wt.PubidLiteral=bx;wt.PubidLiteral_match=upe;wt.QName=wx;wt.QName_exact=qhe;wt.QName_group=Hhe;wt.S=lr;wt.SChar_s=khe;wt.S_OPT=Ur;wt.SYSTEM=nO;wt.SystemLiteral=e0;wt.SystemLiteral_match=cpe;wt.InvalidChar=Phe;wt.UNICODE_REPLACEMENT_CHARACTER=Ohe;wt.UNICODE_SUPPORT=t0;wt.XMLDecl=wpe});var pO=X(Gr=>{"use strict";var Ei=lh(),ka=Ei.find,Dpe=Ei.hasDefaultHTMLNamespace,n0=Ei.hasOwn,Bpe=Ei.isHTMLMimeType,Rpe=Ei.isHTMLRawTextElement,_pe=Ei.isHTMLVoidElement,Sx=Ei.MIME_TYPE,La=Ei.NAMESPACE,ns=Symbol(),KH=yx(),Je=KH.DOMException,vi=KH.DOMExceptionName,Un=iO();function Is(r){if(r!==ns)throw new TypeError("Illegal constructor")}o(Is,"checkSymbol");function Ope(r){return r!==""}o(Ope,"notEmptyString");function Ppe(r){return r?r.split(/[\t\n\f\r ]+/).filter(Ope):[]}o(Ppe,"splitOnASCIIWhitespace");function kpe(r,e){return n0(r,e)||(r[e]=!0),r}o(kpe,"orderedSetReducer");function UH(r){if(!r)return[];var e=Ppe(r);return Object.keys(e.reduce(kpe,{}))}o(UH,"toOrderedSet");function Lpe(r){return function(e){return r&&r.indexOf(e)!==-1}}o(Lpe,"arrayIncludes");function $H(r){if(!Un.QName_exact.test(r))throw new Je(Je.INVALID_CHARACTER_ERR,'invalid character in qualified name "'+r+'"')}o($H,"validateQualifiedName");function oO(r,e){$H(e),r=r||null;var t=null,n=e;if(e.indexOf(":")>=0){var s=e.split(":");t=s[0],n=s[1]}if(t!==null&&r===null)throw new Je(Je.NAMESPACE_ERR,"prefix is non-null and namespace is null");if(t==="xml"&&r!==Ei.NAMESPACE.XML)throw new Je(Je.NAMESPACE_ERR,'prefix is "xml" and namespace is not the XML namespace');if((t==="xmlns"||e==="xmlns")&&r!==Ei.NAMESPACE.XMLNS)throw new Je(Je.NAMESPACE_ERR,'either qualifiedName or prefix is "xmlns" and namespace is not the XMLNS namespace');if(r===Ei.NAMESPACE.XMLNS&&t!=="xmlns"&&e!=="xmlns")throw new Je(Je.NAMESPACE_ERR,'namespace is the XMLNS namespace and neither qualifiedName nor prefix is "xmlns"');return[r,t,n]}o(oO,"validateAndExtract");function a0(r,e){for(var t in r)n0(r,t)&&(e[t]=r[t])}o(a0,"copy");function Ds(r,e){var t=r.prototype;if(!(t instanceof e)){let n=function(){};o(n,"t"),n.prototype=e.prototype,n=new n,a0(t,n),r.prototype=t=n}t.constructor!=r&&(typeof r!="function"&&console.error("unknown Class:"+r),t.constructor=r)}o(Ds,"_extends");var Bs={},xi=Bs.ELEMENT_NODE=1,s0=Bs.ATTRIBUTE_NODE=2,XA=Bs.TEXT_NODE=3,XH=Bs.CDATA_SECTION_NODE=4,GH=Bs.ENTITY_REFERENCE_NODE=5,Fpe=Bs.ENTITY_NODE=6,uO=Bs.PROCESSING_INSTRUCTION_NODE=7,cO=Bs.COMMENT_NODE=8,r0=Bs.DOCUMENT_NODE=9,zH=Bs.DOCUMENT_TYPE_NODE=10,Vc=Bs.DOCUMENT_FRAGMENT_NODE=11,Upe=Bs.NOTATION_NODE=12,Xr=Ei.freeze({DOCUMENT_POSITION_DISCONNECTED:1,DOCUMENT_POSITION_PRECEDING:2,DOCUMENT_POSITION_FOLLOWING:4,DOCUMENT_POSITION_CONTAINS:8,DOCUMENT_POSITION_CONTAINED_BY:16,DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:32});function WH(r,e){if(e.length<r.length)return WH(e,r);var t=null;for(var n in r){if(r[n]!==e[n])return t;t=r[n]}return t}o(WH,"commonAncestor");function VH(r){return r.guid||(r.guid=Math.random()),r.guid}o(VH,"docGUID");function ln(){}o(ln,"NodeList");ln.prototype={length:0,item:o(function(r){return r>=0&&r<this.length?this[r]:null},"item"),toString:o(function(r){var e;typeof r=="function"?e={requireWellFormed:!1,splitCDATASections:!0,nodeFilter:r}:r?e={requireWellFormed:!!r.requireWellFormed,splitCDATASections:r.splitCDATASections!==!1,nodeFilter:r.nodeFilter||null}:e={requireWellFormed:!1,splitCDATASections:!0,nodeFilter:null};for(var t=[],n=0;n<this.length;n++)hO(this[n],t,null,e);return t.join("")},"toString"),filter:o(function(r){return Array.prototype.filter.call(this,r)},"filter"),indexOf:o(function(r){return Array.prototype.indexOf.call(this,r)},"indexOf")};ln.prototype[Symbol.iterator]=function(){var r=this,e=0;return{next:o(function(){return e<r.length?{value:r[e++],done:!1}:{done:!0}},"next"),return:o(function(){return{done:!0}},"return")}};function Pa(r,e){this._node=r,this._refresh=e,zA(this)}o(Pa,"LiveNodeList");function zA(r){var e=r._node._inc||r._node.ownerDocument._inc;if(r._inc!==e){var t=r._refresh(r._node);if(oK(r,"length",t.length),!r.$$length||t.length<r.$$length)for(var n=t.length;n in r;n++)n0(r,n)&&delete r[n];a0(t,r),r._inc=e}}o(zA,"_updateLiveList");Pa.prototype.item=function(r){return zA(this),this[r]||null};Ds(Pa,ln);function i0(){}o(i0,"NamedNodeMap");function JH(r,e){for(var t=0;t<r.length;){if(r[t]===e)return t;t++}}o(JH,"_findNodeIndex");function Vpe(r,e,t,n){if(n?e[JH(e,n)]=t:(e[e.length]=t,e.length++),r){t.ownerElement=r;var s=r.ownerDocument;s&&(n&&ZH(s,r,n),Mpe(s,r,t))}}o(Vpe,"_addNamedNode");function MH(r,e,t){var n=JH(e,t);if(n>=0){for(var s=e.length-1;n<=s;)e[n]=e[++n];if(e.length=s,r){var i=r.ownerDocument;i&&ZH(i,r,t),t.ownerElement=null}}}o(MH,"_removeNamedNode");i0.prototype={length:0,item:ln.prototype.item,getNamedItem:o(function(r){this._ownerElement&&this._ownerElement._isInHTMLDocumentAndNamespace()&&(r=r.toLowerCase());for(var e=0;e<this.length;){var t=this[e];if(t.nodeName===r)return t;e++}return null},"getNamedItem"),setNamedItem:o(function(r){var e=r.ownerElement;if(e&&e!==this._ownerElement)throw new Je(Je.INUSE_ATTRIBUTE_ERR);var t=this.getNamedItemNS(r.namespaceURI,r.localName);return t===r?r:(Vpe(this._ownerElement,this,r,t),t)},"setNamedItem"),setNamedItemNS:o(function(r){return this.setNamedItem(r)},"setNamedItemNS"),removeNamedItem:o(function(r){var e=this.getNamedItem(r);if(!e)throw new Je(Je.NOT_FOUND_ERR,r);return MH(this._ownerElement,this,e),e},"removeNamedItem"),removeNamedItemNS:o(function(r,e){var t=this.getNamedItemNS(r,e);if(!t)throw new Je(Je.NOT_FOUND_ERR,r?r+" : "+e:e);return MH(this._ownerElement,this,t),t},"removeNamedItemNS"),getNamedItemNS:o(function(r,e){r||(r=null);for(var t=0;t<this.length;){var n=this[t];if(n.localName===e&&n.namespaceURI===r)return n;t++}return null},"getNamedItemNS")};i0.prototype[Symbol.iterator]=function(){var r=this,e=0;return{next:o(function(){return e<r.length?{value:r[e++],done:!1}:{done:!0}},"next"),return:o(function(){return{done:!0}},"return")}};function YH(){}o(YH,"DOMImplementation");YH.prototype={hasFeature:o(function(r,e){return!0},"hasFeature"),createDocument:o(function(r,e,t){var n=Sx.XML_APPLICATION;r===La.HTML?n=Sx.XML_XHTML_APPLICATION:r===La.SVG&&(n=Sx.XML_SVG_IMAGE);var s=new Uo(ns,{contentType:n});if(s.implementation=this,s.childNodes=new ln,s.doctype=t||null,t&&s.appendChild(t),e){var i=s.createElementNS(r,e);s.appendChild(i)}return s},"createDocument"),createDocumentType:o(function(r,e,t,n){$H(r);var s=new YA(ns);return s.name=r,s.nodeName=r,s.publicId=e||"",s.systemId=t||"",s.internalSubset=n||"",s.childNodes=new ln,s},"createDocumentType"),createHTMLDocument:o(function(r){var e=new Uo(ns,{contentType:Sx.HTML});if(e.implementation=this,e.childNodes=new ln,r!==!1){e.doctype=this.createDocumentType("html"),e.doctype.ownerDocument=e,e.appendChild(e.doctype);var t=e.createElement("html");e.appendChild(t);var n=e.createElement("head");if(t.appendChild(n),typeof r=="string"){var s=e.createElement("title");s.appendChild(e.createTextNode(r)),n.appendChild(s)}t.appendChild(e.createElement("body"))}return e},"createHTMLDocument")};function Xt(r){Is(r)}o(Xt,"Node");Xt.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,parentNode:null,get parentElement(){return this.parentNode&&this.parentNode.nodeType===this.ELEMENT_NODE?this.parentNode:null},childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,baseURI:"about:blank",get isConnected(){var r=this.getRootNode();return r&&r.nodeType===r.DOCUMENT_NODE},contains:o(function(r){if(!r)return!1;var e=r;do{if(this===e)return!0;e=e.parentNode}while(e);return!1},"contains"),getRootNode:o(function(r){var e=this;do{if(!e.parentNode)return e;e=e.parentNode}while(e)},"getRootNode"),isEqualNode:o(function(r){if(!r)return!1;for(var e=[{node:this,other:r}];e.length>0;){var t=e.pop(),n=t.node,s=t.other;if(n.nodeType!==s.nodeType)return!1;switch(n.nodeType){case n.DOCUMENT_TYPE_NODE:if(n.name!==s.name||n.publicId!==s.publicId||n.systemId!==s.systemId)return!1;break;case n.ELEMENT_NODE:if(n.namespaceURI!==s.namespaceURI||n.prefix!==s.prefix||n.localName!==s.localName||n.attributes.length!==s.attributes.length)return!1;for(var i=0;i<n.attributes.length;i++){var a=n.attributes.item(i),u=s.getAttributeNodeNS(a.namespaceURI,a.localName);if(!u)return!1;e.push({node:a,other:u})}break;case n.ATTRIBUTE_NODE:if(n.namespaceURI!==s.namespaceURI||n.localName!==s.localName||n.value!==s.value)return!1;break;case n.PROCESSING_INSTRUCTION_NODE:if(n.target!==s.target||n.data!==s.data)return!1;break;case n.TEXT_NODE:case n.CDATA_SECTION_NODE:case n.COMMENT_NODE:if(n.data!==s.data)return!1;break}if(n.childNodes.length!==s.childNodes.length)return!1;for(var i=n.childNodes.length-1;i>=0;i--)e.push({node:n.childNodes[i],other:s.childNodes[i]})}return!0},"isEqualNode"),isSameNode:o(function(r){return this===r},"isSameNode"),insertBefore:o(function(r,e){return GA(this,r,e)},"insertBefore"),replaceChild:o(function(r,e){GA(this,r,e,nK),e&&this.removeChild(e)},"replaceChild"),removeChild:o(function(r){return tK(this,r)},"removeChild"),appendChild:o(function(r){return this.insertBefore(r,null)},"appendChild"),hasChildNodes:o(function(){return this.firstChild!=null},"hasChildNodes"),cloneNode:o(function(r){return aK(this.ownerDocument||this,this,r)},"cloneNode"),normalize:o(function(){Vn(this,null,{enter:o(function(r){for(var e=r.firstChild;e;){var t=e.nextSibling;t!==null&&t.nodeType===XA&&e.nodeType===XA?(r.removeChild(t),e.appendData(t.data)):e=t}return!0},"enter")})},"normalize"),isSupported:o(function(r,e){return this.ownerDocument.implementation.hasFeature(r,e)},"isSupported"),lookupPrefix:o(function(r){for(var e=this;e;){var t=e._nsMap;if(t){for(var n in t)if(n0(t,n)&&t[n]===r)return n}e=e.nodeType==s0?e.ownerDocument:e.parentNode}return null},"lookupPrefix"),lookupNamespaceURI:o(function(r){for(var e=this;e;){var t=e._nsMap;if(t&&n0(t,r))return t[r];e=e.nodeType==s0?e.ownerDocument:e.parentNode}return null},"lookupNamespaceURI"),isDefaultNamespace:o(function(r){var e=this.lookupPrefix(r);return e==null},"isDefaultNamespace"),compareDocumentPosition:o(function(r){if(this===r)return 0;var e=r,t=this,n=null,s=null;if(e instanceof fh&&(n=e,e=n.ownerElement),t instanceof fh&&(s=t,t=s.ownerElement,n&&e&&t===e))for(var i=0,a;a=t.attributes[i];i++){if(a===n)return Xr.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+Xr.DOCUMENT_POSITION_PRECEDING;if(a===s)return Xr.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+Xr.DOCUMENT_POSITION_FOLLOWING}if(!e||!t||t.ownerDocument!==e.ownerDocument)return Xr.DOCUMENT_POSITION_DISCONNECTED+Xr.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+(VH(t.ownerDocument)>VH(e.ownerDocument)?Xr.DOCUMENT_POSITION_FOLLOWING:Xr.DOCUMENT_POSITION_PRECEDING);if(s&&e===t)return Xr.DOCUMENT_POSITION_CONTAINS+Xr.DOCUMENT_POSITION_PRECEDING;if(n&&e===t)return Xr.DOCUMENT_POSITION_CONTAINED_BY+Xr.DOCUMENT_POSITION_FOLLOWING;for(var u=[],c=e.parentNode;c;){if(!s&&c===t)return Xr.DOCUMENT_POSITION_CONTAINED_BY+Xr.DOCUMENT_POSITION_FOLLOWING;u.push(c),c=c.parentNode}u.reverse();for(var l=[],f=t.parentNode;f;){if(!n&&f===e)return Xr.DOCUMENT_POSITION_CONTAINS+Xr.DOCUMENT_POSITION_PRECEDING;l.push(f),f=f.parentNode}l.reverse();var h=WH(u,l);for(var d in h.childNodes){var g=h.childNodes[d];if(g===t)return Xr.DOCUMENT_POSITION_FOLLOWING;if(g===e)return Xr.DOCUMENT_POSITION_PRECEDING;if(l.indexOf(g)>=0)return Xr.DOCUMENT_POSITION_FOLLOWING;if(u.indexOf(g)>=0)return Xr.DOCUMENT_POSITION_PRECEDING}return 0},"compareDocumentPosition")};function QH(r){return r=="<"&&"<"||r==">"&&">"||r=="&"&&"&"||r=='"'&&"""||"&#"+r.charCodeAt()+";"}o(QH,"_xmlEncoder");a0(Bs,Xt);a0(Bs,Xt.prototype);a0(Xr,Xt);a0(Xr,Xt.prototype);function $A(r,e){Vn(r,null,{enter:o(function(t){return e(t)?Vn.STOP:!0},"enter")})}o($A,"_visitNode");function Vn(r,e,t){for(var n=[{node:r,context:e,phase:Vn.ENTER}];n.length>0;){var s=n.pop();if(s.phase===Vn.ENTER){var i=t.enter(s.node,s.context);if(i===Vn.STOP)return Vn.STOP;if(n.push({node:s.node,context:i,phase:Vn.EXIT}),i==null)continue;for(var a=s.node.lastChild;a;)n.push({node:a,context:i,phase:Vn.ENTER}),a=a.previousSibling}else t.exit&&t.exit(s.node,s.context)}}o(Vn,"walkDOM");Vn.STOP=Symbol("walkDOM.STOP");Vn.ENTER=0;Vn.EXIT=1;function Uo(r,e){Is(r);var t=e||{};this.ownerDocument=this,this.contentType=t.contentType||Sx.XML_APPLICATION,this.type=Bpe(this.contentType)?"html":"xml"}o(Uo,"Document");function Mpe(r,e,t){r&&r._inc++;var n=t.namespaceURI;n===La.XMLNS&&(e._nsMap[t.prefix?t.localName:""]=t.value)}o(Mpe,"_onAddAttribute");function ZH(r,e,t,n){r&&r._inc++;var s=t.namespaceURI;s===La.XMLNS&&delete e._nsMap[t.prefix?t.localName:""]}o(ZH,"_onRemoveAttribute");function eK(r,e,t){if(r&&r._inc){r._inc++;var n=e.childNodes;if(t&&!t.nextSibling)n[n.length++]=t;else{for(var s=e.firstChild,i=0;s;)n[i++]=s,s=s.nextSibling;n.length=i,delete n[n.length]}}}o(eK,"_onUpdateChild");function tK(r,e){if(r!==e.parentNode)throw new Je(Je.NOT_FOUND_ERR,"child's parent is not parent");var t=e.previousSibling,n=e.nextSibling;return t?t.nextSibling=n:r.firstChild=n,n?n.previousSibling=t:r.lastChild=t,eK(r.ownerDocument,r),e.parentNode=null,e.previousSibling=null,e.nextSibling=null,e}o(tK,"_removeChild");function jpe(r){return r&&(r.nodeType===Xt.DOCUMENT_NODE||r.nodeType===Xt.DOCUMENT_FRAGMENT_NODE||r.nodeType===Xt.ELEMENT_NODE)}o(jpe,"hasValidParentNodeType");function qpe(r){return r&&(r.nodeType===Xt.CDATA_SECTION_NODE||r.nodeType===Xt.COMMENT_NODE||r.nodeType===Xt.DOCUMENT_FRAGMENT_NODE||r.nodeType===Xt.DOCUMENT_TYPE_NODE||r.nodeType===Xt.ELEMENT_NODE||r.nodeType===Xt.PROCESSING_INSTRUCTION_NODE||r.nodeType===Xt.TEXT_NODE)}o(qpe,"hasInsertableNodeType");function Mc(r){return r&&r.nodeType===Xt.DOCUMENT_TYPE_NODE}o(Mc,"isDocTypeNode");function Fo(r){return r&&r.nodeType===Xt.ELEMENT_NODE}o(Fo,"isElementNode");function rK(r){return r&&r.nodeType===Xt.TEXT_NODE}o(rK,"isTextNode");function jH(r,e){var t=r.childNodes||[];if(ka(t,Fo)||Mc(e))return!1;var n=ka(t,Mc);return!(e&&n&&t.indexOf(n)>t.indexOf(e))}o(jH,"isElementInsertionPossible");function qH(r,e){var t=r.childNodes||[];function n(i){return Fo(i)&&i!==e}if(o(n,"hasElementChildThatIsNotChild"),ka(t,n))return!1;var s=ka(t,Mc);return!(e&&s&&t.indexOf(s)>t.indexOf(e))}o(qH,"isElementReplacementPossible");function Hpe(r,e,t){if(!jpe(r))throw new Je(Je.HIERARCHY_REQUEST_ERR,"Unexpected parent node type "+r.nodeType);if(t&&t.parentNode!==r)throw new Je(Je.NOT_FOUND_ERR,"child not in parent");if(!qpe(e)||Mc(e)&&r.nodeType!==Xt.DOCUMENT_NODE)throw new Je(Je.HIERARCHY_REQUEST_ERR,"Unexpected node type "+e.nodeType+" for parent node type "+r.nodeType)}o(Hpe,"assertPreInsertionValidity1to5");function Kpe(r,e,t){var n=r.childNodes||[],s=e.childNodes||[];if(e.nodeType===Xt.DOCUMENT_FRAGMENT_NODE){var i=s.filter(Fo);if(i.length>1||ka(s,rK))throw new Je(Je.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(i.length===1&&!jH(r,t))throw new Je(Je.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(Fo(e)&&!jH(r,t))throw new Je(Je.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(Mc(e)){if(ka(n,Mc))throw new Je(Je.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var a=ka(n,Fo);if(t&&n.indexOf(a)<n.indexOf(t))throw new Je(Je.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element");if(!t&&a)throw new Je(Je.HIERARCHY_REQUEST_ERR,"Doctype can not be appended since element is present")}}o(Kpe,"assertPreInsertionValidityInDocument");function nK(r,e,t){var n=r.childNodes||[],s=e.childNodes||[];if(e.nodeType===Xt.DOCUMENT_FRAGMENT_NODE){var i=s.filter(Fo);if(i.length>1||ka(s,rK))throw new Je(Je.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(i.length===1&&!qH(r,t))throw new Je(Je.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(Fo(e)&&!qH(r,t))throw new Je(Je.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(Mc(e)){let u=function(c){return Mc(c)&&c!==t};if(o(u,"hasDoctypeChildThatIsNotChild"),ka(n,u))throw new Je(Je.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var a=ka(n,Fo);if(t&&n.indexOf(a)<n.indexOf(t))throw new Je(Je.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element")}}o(nK,"assertPreReplacementValidityInDocument");function GA(r,e,t,n){Hpe(r,e,t),r.nodeType===Xt.DOCUMENT_NODE&&(n||Kpe)(r,e,t);var s=e.parentNode;if(s&&s.removeChild(e),e.nodeType===Vc){var i=e.firstChild;if(i==null)return e;var a=e.lastChild}else i=a=e;var u=t?t.previousSibling:r.lastChild;i.previousSibling=u,a.nextSibling=t,u?u.nextSibling=i:r.firstChild=i,t==null?r.lastChild=a:t.previousSibling=a;do i.parentNode=r;while(i!==a&&(i=i.nextSibling));return eK(r.ownerDocument||r,r,e),e.nodeType==Vc&&(e.firstChild=e.lastChild=null),e}o(GA,"_insertBefore");Uo.prototype={implementation:null,nodeName:"#document",nodeType:r0,doctype:null,documentElement:null,_inc:1,insertBefore:o(function(r,e){if(r.nodeType===Vc){for(var t=r.firstChild;t;){var n=t.nextSibling;this.insertBefore(t,e),t=n}return r}return GA(this,r,e),r.ownerDocument=this,this.documentElement===null&&r.nodeType===xi&&(this.documentElement=r),r},"insertBefore"),removeChild:o(function(r){var e=tK(this,r);return e===this.documentElement&&(this.documentElement=null),e},"removeChild"),replaceChild:o(function(r,e){GA(this,r,e,nK),r.ownerDocument=this,e&&this.removeChild(e),Fo(r)&&(this.documentElement=r)},"replaceChild"),importNode:o(function(r,e){return $pe(this,r,e)},"importNode"),getElementById:o(function(r){var e=null;return $A(this.documentElement,function(t){if(t.nodeType==xi&&t.getAttribute("id")==r)return e=t,!0}),e},"getElementById"),createElement:o(function(r){var e=new Vo(ns);e.ownerDocument=this,this.type==="html"&&(r=r.toLowerCase()),Dpe(this.contentType)&&(e.namespaceURI=La.HTML),e.nodeName=r,e.tagName=r,e.localName=r,e.childNodes=new ln;var t=e.attributes=new i0;return t._ownerElement=e,e},"createElement"),createDocumentFragment:o(function(){var r=new u0(ns);return r.ownerDocument=this,r.childNodes=new ln,r},"createDocumentFragment"),createTextNode:o(function(r){var e=new Ax(ns);return e.ownerDocument=this,e.childNodes=new ln,e.appendData(r),e},"createTextNode"),createComment:o(function(r){var e=new WA(ns);return e.ownerDocument=this,e.childNodes=new ln,e.appendData(r),e},"createComment"),createCDATASection:o(function(r){if(r.indexOf("]]>")!==-1)throw new Je(Je.INVALID_CHARACTER_ERR,'data contains "]]>"');var e=new JA(ns);return e.ownerDocument=this,e.childNodes=new ln,e.appendData(r),e},"createCDATASection"),createProcessingInstruction:o(function(r,e){var t=new ZA(ns);return t.ownerDocument=this,t.childNodes=new ln,t.nodeName=t.target=r,t.nodeValue=t.data=e,t},"createProcessingInstruction"),createAttribute:o(function(r){if(!Un.QName_exact.test(r))throw new Je(Je.INVALID_CHARACTER_ERR,'invalid character in name "'+r+'"');return this.type==="html"&&(r=r.toLowerCase()),this._createAttribute(r)},"createAttribute"),_createAttribute:o(function(r){var e=new fh(ns);return e.ownerDocument=this,e.childNodes=new ln,e.name=r,e.nodeName=r,e.localName=r,e.specified=!0,e},"_createAttribute"),createEntityReference:o(function(r){if(!Un.Name.test(r))throw new Je(Je.INVALID_CHARACTER_ERR,'not a valid xml name "'+r+'"');if(this.type==="html")throw new Je("document is an html document",vi.NotSupportedError);var e=new QA(ns);return e.ownerDocument=this,e.childNodes=new ln,e.nodeName=r,e},"createEntityReference"),createElementNS:o(function(r,e){var t=oO(r,e),n=new Vo(ns),s=n.attributes=new i0;return n.childNodes=new ln,n.ownerDocument=this,n.nodeName=e,n.tagName=e,n.namespaceURI=t[0],n.prefix=t[1],n.localName=t[2],s._ownerElement=n,n},"createElementNS"),createAttributeNS:o(function(r,e){var t=oO(r,e),n=new fh(ns);return n.ownerDocument=this,n.childNodes=new ln,n.nodeName=e,n.name=e,n.specified=!0,n.namespaceURI=t[0],n.prefix=t[1],n.localName=t[2],n},"createAttributeNS")};Ds(Uo,Xt);function Vo(r){Is(r),this._nsMap=Object.create(null)}o(Vo,"Element");Vo.prototype={nodeType:xi,attributes:null,getQualifiedName:o(function(){return this.prefix?this.prefix+":"+this.localName:this.localName},"getQualifiedName"),_isInHTMLDocumentAndNamespace:o(function(){return this.ownerDocument.type==="html"&&this.namespaceURI===La.HTML},"_isInHTMLDocumentAndNamespace"),hasAttributes:o(function(){return!!(this.attributes&&this.attributes.length)},"hasAttributes"),hasAttribute:o(function(r){return!!this.getAttributeNode(r)},"hasAttribute"),getAttribute:o(function(r){var e=this.getAttributeNode(r);return e?e.value:null},"getAttribute"),getAttributeNode:o(function(r){return this._isInHTMLDocumentAndNamespace()&&(r=r.toLowerCase()),this.attributes.getNamedItem(r)},"getAttributeNode"),setAttribute:o(function(r,e){this._isInHTMLDocumentAndNamespace()&&(r=r.toLowerCase());var t=this.getAttributeNode(r);t?t.value=t.nodeValue=""+e:(t=this.ownerDocument._createAttribute(r),t.value=t.nodeValue=""+e,this.setAttributeNode(t))},"setAttribute"),removeAttribute:o(function(r){var e=this.getAttributeNode(r);e&&this.removeAttributeNode(e)},"removeAttribute"),setAttributeNode:o(function(r){return this.attributes.setNamedItem(r)},"setAttributeNode"),setAttributeNodeNS:o(function(r){return this.attributes.setNamedItemNS(r)},"setAttributeNodeNS"),removeAttributeNode:o(function(r){return this.attributes.removeNamedItem(r.nodeName)},"removeAttributeNode"),removeAttributeNS:o(function(r,e){var t=this.getAttributeNodeNS(r,e);t&&this.removeAttributeNode(t)},"removeAttributeNS"),hasAttributeNS:o(function(r,e){return this.getAttributeNodeNS(r,e)!=null},"hasAttributeNS"),getAttributeNS:o(function(r,e){var t=this.getAttributeNodeNS(r,e);return t?t.value:null},"getAttributeNS"),setAttributeNS:o(function(r,e,t){var n=oO(r,e),s=n[2],i=this.getAttributeNodeNS(r,s);i?i.value=i.nodeValue=""+t:(i=this.ownerDocument.createAttributeNS(r,e),i.value=i.nodeValue=""+t,this.setAttributeNode(i))},"setAttributeNS"),getAttributeNodeNS:o(function(r,e){return this.attributes.getNamedItemNS(r,e)},"getAttributeNodeNS"),getElementsByClassName:o(function(r){var e=UH(r);return new Pa(this,function(t){var n=[];return e.length>0&&$A(t,function(s){if(s!==t&&s.nodeType===xi){var i=s.getAttribute("class");if(i){var a=r===i;if(!a){var u=UH(i);a=e.every(Lpe(u))}a&&n.push(s)}}}),n})},"getElementsByClassName"),getElementsByTagName:o(function(r){var e=(this.nodeType===r0?this:this.ownerDocument).type==="html",t=r.toLowerCase();return new Pa(this,function(n){var s=[];return $A(n,function(i){if(!(i===n||i.nodeType!==xi))if(r==="*")s.push(i);else{var a=i.getQualifiedName(),u=e&&i.namespaceURI===La.HTML?t:r;a===u&&s.push(i)}}),s})},"getElementsByTagName"),getElementsByTagNameNS:o(function(r,e){return new Pa(this,function(t){var n=[];return $A(t,function(s){s!==t&&s.nodeType===xi&&(r==="*"||s.namespaceURI===r)&&(e==="*"||s.localName==e)&&n.push(s)}),n})},"getElementsByTagNameNS")};Uo.prototype.getElementsByClassName=Vo.prototype.getElementsByClassName;Uo.prototype.getElementsByTagName=Vo.prototype.getElementsByTagName;Uo.prototype.getElementsByTagNameNS=Vo.prototype.getElementsByTagNameNS;Ds(Vo,Xt);function fh(r){Is(r),this.namespaceURI=null,this.prefix=null,this.ownerElement=null}o(fh,"Attr");fh.prototype.nodeType=s0;Ds(fh,Xt);function o0(r){Is(r)}o(o0,"CharacterData");o0.prototype={data:"",substringData:o(function(r,e){return this.data.substring(r,r+e)},"substringData"),appendData:o(function(r){r=this.data+r,this.nodeValue=this.data=r,this.length=r.length},"appendData"),insertData:o(function(r,e){this.replaceData(r,0,e)},"insertData"),deleteData:o(function(r,e){this.replaceData(r,e,"")},"deleteData"),replaceData:o(function(r,e,t){var n=this.data.substring(0,r),s=this.data.substring(r+e);t=n+t+s,this.nodeValue=this.data=t,this.length=t.length},"replaceData")};Ds(o0,Xt);function Ax(r){Is(r)}o(Ax,"Text");Ax.prototype={nodeName:"#text",nodeType:XA,splitText:o(function(r){var e=this.data,t=e.substring(r);e=e.substring(0,r),this.data=this.nodeValue=e,this.length=e.length;var n=this.ownerDocument.createTextNode(t);return this.parentNode&&this.parentNode.insertBefore(n,this.nextSibling),n},"splitText")};Ds(Ax,o0);function WA(r){Is(r)}o(WA,"Comment");WA.prototype={nodeName:"#comment",nodeType:cO};Ds(WA,o0);function JA(r){Is(r)}o(JA,"CDATASection");JA.prototype={nodeName:"#cdata-section",nodeType:XH};Ds(JA,Ax);function YA(r){Is(r)}o(YA,"DocumentType");YA.prototype.nodeType=zH;Ds(YA,Xt);function lO(r){Is(r)}o(lO,"Notation");lO.prototype.nodeType=Upe;Ds(lO,Xt);function fO(r){Is(r)}o(fO,"Entity");fO.prototype.nodeType=Fpe;Ds(fO,Xt);function QA(r){Is(r)}o(QA,"EntityReference");QA.prototype.nodeType=GH;Ds(QA,Xt);function u0(r){Is(r)}o(u0,"DocumentFragment");u0.prototype.nodeName="#document-fragment";u0.prototype.nodeType=Vc;Ds(u0,Xt);function ZA(r){Is(r)}o(ZA,"ProcessingInstruction");ZA.prototype.nodeType=uO;Ds(ZA,o0);function sK(){}o(sK,"XMLSerializer");sK.prototype.serializeToString=function(r,e){return iK.call(r,e)};Xt.prototype.toString=iK;function iK(r){var e;typeof r=="function"?e={requireWellFormed:!1,splitCDATASections:!0,nodeFilter:r}:r!=null?e={requireWellFormed:!!r.requireWellFormed,splitCDATASections:r.splitCDATASections!==!1,nodeFilter:r.nodeFilter||null}:e={requireWellFormed:!1,splitCDATASections:!0,nodeFilter:null};var t=[],n=this.nodeType===r0&&this.documentElement||this,s=n.prefix,i=n.namespaceURI;if(i&&s==null){var s=n.lookupPrefix(i);if(s==null)var a=[{namespace:i,prefix:null}]}return hO(this,t,a,e),t.join("")}o(iK,"nodeSerializeToString");function HH(r,e,t){var n=r.prefix||"",s=r.namespaceURI;if(!s||n==="xml"&&s===La.XML||s===La.XMLNS)return!1;for(var i=t.length;i--;){var a=t[i];if(a.prefix===n)return a.namespace!==s}return!0}o(HH,"needNamespaceDefine");function KA(r,e,t){r.push(" ",e,'="',t.replace(/[<>&"\t\n\r]/g,QH),'"')}o(KA,"addSerializedAttribute");function hO(r,e,t,n){t||(t=[]);var s=n.nodeFilter,i=n.requireWellFormed,a=n.splitCDATASections,u=r.nodeType===r0?r:r.ownerDocument,c=u.type==="html";Vn(r,{ns:t},{enter:o(function(l,f){var h=f.ns;if(s)if(l=s(l),l){if(typeof l=="string")return e.push(l),null}else return null;switch(l.nodeType){case xi:var d=l.attributes,g=d.length,m=l.tagName,v=m;if(!c&&!l.prefix&&l.namespaceURI){for(var y,w=0;w<d.length;w++)if(d.item(w).name==="xmlns"){y=d.item(w).value;break}if(!y)for(var S=h.length-1;S>=0;S--){var E=h[S];if(E.prefix===""&&E.namespace===l.namespaceURI){y=E.namespace;break}}if(y!==l.namespaceURI)for(var S=h.length-1;S>=0;S--){var E=h[S];if(E.namespace===l.namespaceURI){E.prefix&&(v=E.prefix+":"+m);break}}}e.push("<",v);for(var x=h.slice(),b=0;b<g;b++){var A=d.item(b);A.prefix=="xmlns"?x.push({prefix:A.localName,namespace:A.value}):A.nodeName=="xmlns"&&x.push({prefix:"",namespace:A.value})}for(var b=0;b<g;b++){var A=d.item(b);if(HH(A,c,x)){var k=A.prefix||"",I=A.namespaceURI;KA(e,k?"xmlns:"+k:"xmlns",I),x.push({prefix:k,namespace:I})}var T=s?s(A):A;T&&(typeof T=="string"?e.push(T):KA(e,T.name,T.value))}if(m===v&&HH(l,c,x)){var V=l.prefix||"",I=l.namespaceURI;KA(e,V?"xmlns:"+V:"xmlns",I),x.push({prefix:V,namespace:I})}var U=!l.firstChild;if(U&&(c||l.namespaceURI===La.HTML)&&(U=_pe(m)),U)return e.push("/>"),null;if(e.push(">"),c&&Rpe(m)){for(var M=l.firstChild;M;)M.data?e.push(M.data):hO(M,e,x.slice(),n),M=M.nextSibling;return e.push("</",v,">"),null}return{ns:x,tag:v};case r0:case Vc:if(i&&l.nodeType===r0&&l.documentElement==null)throw new Je("The Document has no documentElement",vi.InvalidStateError);return{ns:h};case s0:return KA(e,l.name,l.value),null;case XA:if(i&&Un.InvalidChar.test(l.data))throw new Je("The Text node data contains characters outside the XML Char production",vi.InvalidStateError);return e.push(l.data.replace(/[<&>]/g,QH)),null;case XH:if(i&&l.data.indexOf("]]>")!==-1)throw new Je('The CDATASection data contains "]]>"',vi.InvalidStateError);return a?e.push(Un.CDATA_START,l.data.replace(/]]>/g,"]]]]><![CDATA[>"),Un.CDATA_END):e.push(Un.CDATA_START,l.data,Un.CDATA_END),null;case cO:if(i){if(Un.InvalidChar.test(l.data))throw new Je("The comment node data contains characters outside the XML Char production",vi.InvalidStateError);if(l.data.indexOf("--")!==-1||l.data[l.data.length-1]==="-")throw new Je('The comment node data contains "--" or ends with "-"',vi.InvalidStateError)}return e.push(Un.COMMENT_START,l.data,Un.COMMENT_END),null;case zH:var ie=l.publicId,Z=l.systemId;if(i){if(ie&&!Un.PubidLiteral_match.test(ie))throw new Je("DocumentType publicId is not a valid PubidLiteral",vi.InvalidStateError);if(Z&&Z!=="."&&!Un.SystemLiteral_match.test(Z))throw new Je("DocumentType systemId is not a valid SystemLiteral",vi.InvalidStateError);if(l.internalSubset&&l.internalSubset.indexOf("]>")!==-1)throw new Je('DocumentType internalSubset contains "]>"',vi.InvalidStateError)}return e.push(Un.DOCTYPE_DECL_START," ",l.name),ie?(e.push(" ",Un.PUBLIC," ",ie),Z&&Z!=="."&&e.push(" ",Z)):Z&&Z!=="."&&e.push(" ",Un.SYSTEM," ",Z),l.internalSubset&&e.push(" [",l.internalSubset,"]"),e.push(">"),null;case uO:if(i){if(l.target.indexOf(":")!==-1||l.target.toLowerCase()==="xml")throw new Je("The ProcessingInstruction target is not well-formed",vi.InvalidStateError);if(Un.InvalidChar.test(l.data))throw new Je("The ProcessingInstruction data contains characters outside the XML Char production",vi.InvalidStateError);if(l.data.indexOf("?>")!==-1)throw new Je('The ProcessingInstruction data contains "?>"',vi.InvalidStateError)}return e.push("<?",l.target," ",l.data,"?>"),null;case GH:return e.push("&",l.nodeName,";"),null;default:return e.push("??",l.nodeName),null}},"enter"),exit:o(function(l,f){f&&f.tag&&e.push("</",f.tag,">")},"exit")})}o(hO,"serializeToString");function $pe(r,e,t){var n;return Vn(e,null,{enter:o(function(s,i){var a=s.cloneNode(!1);a.ownerDocument=r,a.parentNode=null,i===null?n=a:i.appendChild(a);var u=s.nodeType===s0||t;return u?a:null},"enter")}),n}o($pe,"importNode");function aK(r,e,t){var n;return Vn(e,null,{enter:o(function(s,i){var a=new s.constructor(ns);for(var u in s)if(n0(s,u)){var c=s[u];typeof c!="object"&&c!=a[u]&&(a[u]=c)}s.childNodes&&(a.childNodes=new ln),a.ownerDocument=r;var l=t;switch(a.nodeType){case xi:var f=s.attributes,h=a.attributes=new i0,d=f.length;h._ownerElement=a;for(var g=0;g<d;g++)a.setAttributeNode(aK(r,f.item(g),!0));break;case s0:l=!0}return i!==null?i.appendChild(a):n=a,l?a:null},"enter")}),n}o(aK,"cloneNode");function oK(r,e,t){r[e]=t}o(oK,"__set__");function aO(r){for(var e=[],t=r.firstChild;t;)t.nodeType===xi&&e.push(t),t=t.nextSibling;return e}o(aO,"childrenRefresh");try{Object.defineProperty&&(Object.defineProperty(Pa.prototype,"length",{get:o(function(){return zA(this),this.$$length},"get")}),Object.defineProperty(Xt.prototype,"textContent",{get:o(function(){if(this.nodeType===xi||this.nodeType===Vc){var r=[];return Vn(this,null,{enter:o(function(e){if(e.nodeType===xi||e.nodeType===Vc)return!0;if(e.nodeType===uO||e.nodeType===cO)return null;r.push(e.nodeValue)},"enter")}),r.join("")}return this.nodeValue},"get"),set:o(function(r){switch(this.nodeType){case xi:case Vc:for(;this.firstChild;)this.removeChild(this.firstChild);(r||String(r))&&this.appendChild(this.ownerDocument.createTextNode(r));break;default:this.data=r,this.value=r,this.nodeValue=r}},"set")}),Object.defineProperty(Vo.prototype,"children",{get:o(function(){return new Pa(this,aO)},"get")}),Object.defineProperty(Uo.prototype,"children",{get:o(function(){return new Pa(this,aO)},"get")}),Object.defineProperty(u0.prototype,"children",{get:o(function(){return new Pa(this,aO)},"get")}),oK=o(function(r,e,t){r["$$"+e]=t},"__set__"))}catch{}Gr._updateLiveList=zA;Gr.Attr=fh;Gr.CDATASection=JA;Gr.CharacterData=o0;Gr.Comment=WA;Gr.Document=Uo;Gr.DocumentFragment=u0;Gr.DocumentType=YA;Gr.DOMImplementation=YH;Gr.Element=Vo;Gr.Entity=fO;Gr.EntityReference=QA;Gr.LiveNodeList=Pa;Gr.NamedNodeMap=i0;Gr.Node=Xt;Gr.NodeList=ln;Gr.Notation=lO;Gr.Text=Ax;Gr.ProcessingInstruction=ZA;Gr.walkDOM=Vn;Gr.XMLSerializer=sK});var cK=X(Cx=>{"use strict";var uK=lh().freeze;Cx.XML_ENTITIES=uK({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'});Cx.HTML_ENTITIES=uK({Aacute:"\xC1",aacute:"\xE1",Abreve:"\u0102",abreve:"\u0103",ac:"\u223E",acd:"\u223F",acE:"\u223E\u0333",Acirc:"\xC2",acirc:"\xE2",acute:"\xB4",Acy:"\u0410",acy:"\u0430",AElig:"\xC6",aelig:"\xE6",af:"\u2061",Afr:"\u{1D504}",afr:"\u{1D51E}",Agrave:"\xC0",agrave:"\xE0",alefsym:"\u2135",aleph:"\u2135",Alpha:"\u0391",alpha:"\u03B1",Amacr:"\u0100",amacr:"\u0101",amalg:"\u2A3F",AMP:"&",amp:"&",And:"\u2A53",and:"\u2227",andand:"\u2A55",andd:"\u2A5C",andslope:"\u2A58",andv:"\u2A5A",ang:"\u2220",ange:"\u29A4",angle:"\u2220",angmsd:"\u2221",angmsdaa:"\u29A8",angmsdab:"\u29A9",angmsdac:"\u29AA",angmsdad:"\u29AB",angmsdae:"\u29AC",angmsdaf:"\u29AD",angmsdag:"\u29AE",angmsdah:"\u29AF",angrt:"\u221F",angrtvb:"\u22BE",angrtvbd:"\u299D",angsph:"\u2222",angst:"\xC5",angzarr:"\u237C",Aogon:"\u0104",aogon:"\u0105",Aopf:"\u{1D538}",aopf:"\u{1D552}",ap:"\u2248",apacir:"\u2A6F",apE:"\u2A70",ape:"\u224A",apid:"\u224B",apos:"'",ApplyFunction:"\u2061",approx:"\u2248",approxeq:"\u224A",Aring:"\xC5",aring:"\xE5",Ascr:"\u{1D49C}",ascr:"\u{1D4B6}",Assign:"\u2254",ast:"*",asymp:"\u2248",asympeq:"\u224D",Atilde:"\xC3",atilde:"\xE3",Auml:"\xC4",auml:"\xE4",awconint:"\u2233",awint:"\u2A11",backcong:"\u224C",backepsilon:"\u03F6",backprime:"\u2035",backsim:"\u223D",backsimeq:"\u22CD",Backslash:"\u2216",Barv:"\u2AE7",barvee:"\u22BD",Barwed:"\u2306",barwed:"\u2305",barwedge:"\u2305",bbrk:"\u23B5",bbrktbrk:"\u23B6",bcong:"\u224C",Bcy:"\u0411",bcy:"\u0431",bdquo:"\u201E",becaus:"\u2235",Because:"\u2235",because:"\u2235",bemptyv:"\u29B0",bepsi:"\u03F6",bernou:"\u212C",Bernoullis:"\u212C",Beta:"\u0392",beta:"\u03B2",beth:"\u2136",between:"\u226C",Bfr:"\u{1D505}",bfr:"\u{1D51F}",bigcap:"\u22C2",bigcirc:"\u25EF",bigcup:"\u22C3",bigodot:"\u2A00",bigoplus:"\u2A01",bigotimes:"\u2A02",bigsqcup:"\u2A06",bigstar:"\u2605",bigtriangledown:"\u25BD",bigtriangleup:"\u25B3",biguplus:"\u2A04",bigvee:"\u22C1",bigwedge:"\u22C0",bkarow:"\u290D",blacklozenge:"\u29EB",blacksquare:"\u25AA",blacktriangle:"\u25B4",blacktriangledown:"\u25BE",blacktriangleleft:"\u25C2",blacktriangleright:"\u25B8",blank:"\u2423",blk12:"\u2592",blk14:"\u2591",blk34:"\u2593",block:"\u2588",bne:"=\u20E5",bnequiv:"\u2261\u20E5",bNot:"\u2AED",bnot:"\u2310",Bopf:"\u{1D539}",bopf:"\u{1D553}",bot:"\u22A5",bottom:"\u22A5",bowtie:"\u22C8",boxbox:"\u29C9",boxDL:"\u2557",boxDl:"\u2556",boxdL:"\u2555",boxdl:"\u2510",boxDR:"\u2554",boxDr:"\u2553",boxdR:"\u2552",boxdr:"\u250C",boxH:"\u2550",boxh:"\u2500",boxHD:"\u2566",boxHd:"\u2564",boxhD:"\u2565",boxhd:"\u252C",boxHU:"\u2569",boxHu:"\u2567",boxhU:"\u2568",boxhu:"\u2534",boxminus:"\u229F",boxplus:"\u229E",boxtimes:"\u22A0",boxUL:"\u255D",boxUl:"\u255C",boxuL:"\u255B",boxul:"\u2518",boxUR:"\u255A",boxUr:"\u2559",boxuR:"\u2558",boxur:"\u2514",boxV:"\u2551",boxv:"\u2502",boxVH:"\u256C",boxVh:"\u256B",boxvH:"\u256A",boxvh:"\u253C",boxVL:"\u2563",boxVl:"\u2562",boxvL:"\u2561",boxvl:"\u2524",boxVR:"\u2560",boxVr:"\u255F",boxvR:"\u255E",boxvr:"\u251C",bprime:"\u2035",Breve:"\u02D8",breve:"\u02D8",brvbar:"\xA6",Bscr:"\u212C",bscr:"\u{1D4B7}",bsemi:"\u204F",bsim:"\u223D",bsime:"\u22CD",bsol:"\\",bsolb:"\u29C5",bsolhsub:"\u27C8",bull:"\u2022",bullet:"\u2022",bump:"\u224E",bumpE:"\u2AAE",bumpe:"\u224F",Bumpeq:"\u224E",bumpeq:"\u224F",Cacute:"\u0106",cacute:"\u0107",Cap:"\u22D2",cap:"\u2229",capand:"\u2A44",capbrcup:"\u2A49",capcap:"\u2A4B",capcup:"\u2A47",capdot:"\u2A40",CapitalDifferentialD:"\u2145",caps:"\u2229\uFE00",caret:"\u2041",caron:"\u02C7",Cayleys:"\u212D",ccaps:"\u2A4D",Ccaron:"\u010C",ccaron:"\u010D",Ccedil:"\xC7",ccedil:"\xE7",Ccirc:"\u0108",ccirc:"\u0109",Cconint:"\u2230",ccups:"\u2A4C",ccupssm:"\u2A50",Cdot:"\u010A",cdot:"\u010B",cedil:"\xB8",Cedilla:"\xB8",cemptyv:"\u29B2",cent:"\xA2",CenterDot:"\xB7",centerdot:"\xB7",Cfr:"\u212D",cfr:"\u{1D520}",CHcy:"\u0427",chcy:"\u0447",check:"\u2713",checkmark:"\u2713",Chi:"\u03A7",chi:"\u03C7",cir:"\u25CB",circ:"\u02C6",circeq:"\u2257",circlearrowleft:"\u21BA",circlearrowright:"\u21BB",circledast:"\u229B",circledcirc:"\u229A",circleddash:"\u229D",CircleDot:"\u2299",circledR:"\xAE",circledS:"\u24C8",CircleMinus:"\u2296",CirclePlus:"\u2295",CircleTimes:"\u2297",cirE:"\u29C3",cire:"\u2257",cirfnint:"\u2A10",cirmid:"\u2AEF",cirscir:"\u29C2",ClockwiseContourIntegral:"\u2232",CloseCurlyDoubleQuote:"\u201D",CloseCurlyQuote:"\u2019",clubs:"\u2663",clubsuit:"\u2663",Colon:"\u2237",colon:":",Colone:"\u2A74",colone:"\u2254",coloneq:"\u2254",comma:",",commat:"@",comp:"\u2201",compfn:"\u2218",complement:"\u2201",complexes:"\u2102",cong:"\u2245",congdot:"\u2A6D",Congruent:"\u2261",Conint:"\u222F",conint:"\u222E",ContourIntegral:"\u222E",Copf:"\u2102",copf:"\u{1D554}",coprod:"\u2210",Coproduct:"\u2210",COPY:"\xA9",copy:"\xA9",copysr:"\u2117",CounterClockwiseContourIntegral:"\u2233",crarr:"\u21B5",Cross:"\u2A2F",cross:"\u2717",Cscr:"\u{1D49E}",cscr:"\u{1D4B8}",csub:"\u2ACF",csube:"\u2AD1",csup:"\u2AD0",csupe:"\u2AD2",ctdot:"\u22EF",cudarrl:"\u2938",cudarrr:"\u2935",cuepr:"\u22DE",cuesc:"\u22DF",cularr:"\u21B6",cularrp:"\u293D",Cup:"\u22D3",cup:"\u222A",cupbrcap:"\u2A48",CupCap:"\u224D",cupcap:"\u2A46",cupcup:"\u2A4A",cupdot:"\u228D",cupor:"\u2A45",cups:"\u222A\uFE00",curarr:"\u21B7",curarrm:"\u293C",curlyeqprec:"\u22DE",curlyeqsucc:"\u22DF",curlyvee:"\u22CE",curlywedge:"\u22CF",curren:"\xA4",curvearrowleft:"\u21B6",curvearrowright:"\u21B7",cuvee:"\u22CE",cuwed:"\u22CF",cwconint:"\u2232",cwint:"\u2231",cylcty:"\u232D",Dagger:"\u2021",dagger:"\u2020",daleth:"\u2138",Darr:"\u21A1",dArr:"\u21D3",darr:"\u2193",dash:"\u2010",Dashv:"\u2AE4",dashv:"\u22A3",dbkarow:"\u290F",dblac:"\u02DD",Dcaron:"\u010E",dcaron:"\u010F",Dcy:"\u0414",dcy:"\u0434",DD:"\u2145",dd:"\u2146",ddagger:"\u2021",ddarr:"\u21CA",DDotrahd:"\u2911",ddotseq:"\u2A77",deg:"\xB0",Del:"\u2207",Delta:"\u0394",delta:"\u03B4",demptyv:"\u29B1",dfisht:"\u297F",Dfr:"\u{1D507}",dfr:"\u{1D521}",dHar:"\u2965",dharl:"\u21C3",dharr:"\u21C2",DiacriticalAcute:"\xB4",DiacriticalDot:"\u02D9",DiacriticalDoubleAcute:"\u02DD",DiacriticalGrave:"`",DiacriticalTilde:"\u02DC",diam:"\u22C4",Diamond:"\u22C4",diamond:"\u22C4",diamondsuit:"\u2666",diams:"\u2666",die:"\xA8",DifferentialD:"\u2146",digamma:"\u03DD",disin:"\u22F2",div:"\xF7",divide:"\xF7",divideontimes:"\u22C7",divonx:"\u22C7",DJcy:"\u0402",djcy:"\u0452",dlcorn:"\u231E",dlcrop:"\u230D",dollar:"$",Dopf:"\u{1D53B}",dopf:"\u{1D555}",Dot:"\xA8",dot:"\u02D9",DotDot:"\u20DC",doteq:"\u2250",doteqdot:"\u2251",DotEqual:"\u2250",dotminus:"\u2238",dotplus:"\u2214",dotsquare:"\u22A1",doublebarwedge:"\u2306",DoubleContourIntegral:"\u222F",DoubleDot:"\xA8",DoubleDownArrow:"\u21D3",DoubleLeftArrow:"\u21D0",DoubleLeftRightArrow:"\u21D4",DoubleLeftTee:"\u2AE4",DoubleLongLeftArrow:"\u27F8",DoubleLongLeftRightArrow:"\u27FA",DoubleLongRightArrow:"\u27F9",DoubleRightArrow:"\u21D2",DoubleRightTee:"\u22A8",DoubleUpArrow:"\u21D1",DoubleUpDownArrow:"\u21D5",DoubleVerticalBar:"\u2225",DownArrow:"\u2193",Downarrow:"\u21D3",downarrow:"\u2193",DownArrowBar:"\u2913",DownArrowUpArrow:"\u21F5",DownBreve:"\u0311",downdownarrows:"\u21CA",downharpoonleft:"\u21C3",downharpoonright:"\u21C2",DownLeftRightVector:"\u2950",DownLeftTeeVector:"\u295E",DownLeftVector:"\u21BD",DownLeftVectorBar:"\u2956",DownRightTeeVector:"\u295F",DownRightVector:"\u21C1",DownRightVectorBar:"\u2957",DownTee:"\u22A4",DownTeeArrow:"\u21A7",drbkarow:"\u2910",drcorn:"\u231F",drcrop:"\u230C",Dscr:"\u{1D49F}",dscr:"\u{1D4B9}",DScy:"\u0405",dscy:"\u0455",dsol:"\u29F6",Dstrok:"\u0110",dstrok:"\u0111",dtdot:"\u22F1",dtri:"\u25BF",dtrif:"\u25BE",duarr:"\u21F5",duhar:"\u296F",dwangle:"\u29A6",DZcy:"\u040F",dzcy:"\u045F",dzigrarr:"\u27FF",Eacute:"\xC9",eacute:"\xE9",easter:"\u2A6E",Ecaron:"\u011A",ecaron:"\u011B",ecir:"\u2256",Ecirc:"\xCA",ecirc:"\xEA",ecolon:"\u2255",Ecy:"\u042D",ecy:"\u044D",eDDot:"\u2A77",Edot:"\u0116",eDot:"\u2251",edot:"\u0117",ee:"\u2147",efDot:"\u2252",Efr:"\u{1D508}",efr:"\u{1D522}",eg:"\u2A9A",Egrave:"\xC8",egrave:"\xE8",egs:"\u2A96",egsdot:"\u2A98",el:"\u2A99",Element:"\u2208",elinters:"\u23E7",ell:"\u2113",els:"\u2A95",elsdot:"\u2A97",Emacr:"\u0112",emacr:"\u0113",empty:"\u2205",emptyset:"\u2205",EmptySmallSquare:"\u25FB",emptyv:"\u2205",EmptyVerySmallSquare:"\u25AB",emsp:"\u2003",emsp13:"\u2004",emsp14:"\u2005",ENG:"\u014A",eng:"\u014B",ensp:"\u2002",Eogon:"\u0118",eogon:"\u0119",Eopf:"\u{1D53C}",eopf:"\u{1D556}",epar:"\u22D5",eparsl:"\u29E3",eplus:"\u2A71",epsi:"\u03B5",Epsilon:"\u0395",epsilon:"\u03B5",epsiv:"\u03F5",eqcirc:"\u2256",eqcolon:"\u2255",eqsim:"\u2242",eqslantgtr:"\u2A96",eqslantless:"\u2A95",Equal:"\u2A75",equals:"=",EqualTilde:"\u2242",equest:"\u225F",Equilibrium:"\u21CC",equiv:"\u2261",equivDD:"\u2A78",eqvparsl:"\u29E5",erarr:"\u2971",erDot:"\u2253",Escr:"\u2130",escr:"\u212F",esdot:"\u2250",Esim:"\u2A73",esim:"\u2242",Eta:"\u0397",eta:"\u03B7",ETH:"\xD0",eth:"\xF0",Euml:"\xCB",euml:"\xEB",euro:"\u20AC",excl:"!",exist:"\u2203",Exists:"\u2203",expectation:"\u2130",ExponentialE:"\u2147",exponentiale:"\u2147",fallingdotseq:"\u2252",Fcy:"\u0424",fcy:"\u0444",female:"\u2640",ffilig:"\uFB03",fflig:"\uFB00",ffllig:"\uFB04",Ffr:"\u{1D509}",ffr:"\u{1D523}",filig:"\uFB01",FilledSmallSquare:"\u25FC",FilledVerySmallSquare:"\u25AA",fjlig:"fj",flat:"\u266D",fllig:"\uFB02",fltns:"\u25B1",fnof:"\u0192",Fopf:"\u{1D53D}",fopf:"\u{1D557}",ForAll:"\u2200",forall:"\u2200",fork:"\u22D4",forkv:"\u2AD9",Fouriertrf:"\u2131",fpartint:"\u2A0D",frac12:"\xBD",frac13:"\u2153",frac14:"\xBC",frac15:"\u2155",frac16:"\u2159",frac18:"\u215B",frac23:"\u2154",frac25:"\u2156",frac34:"\xBE",frac35:"\u2157",frac38:"\u215C",frac45:"\u2158",frac56:"\u215A",frac58:"\u215D",frac78:"\u215E",frasl:"\u2044",frown:"\u2322",Fscr:"\u2131",fscr:"\u{1D4BB}",gacute:"\u01F5",Gamma:"\u0393",gamma:"\u03B3",Gammad:"\u03DC",gammad:"\u03DD",gap:"\u2A86",Gbreve:"\u011E",gbreve:"\u011F",Gcedil:"\u0122",Gcirc:"\u011C",gcirc:"\u011D",Gcy:"\u0413",gcy:"\u0433",Gdot:"\u0120",gdot:"\u0121",gE:"\u2267",ge:"\u2265",gEl:"\u2A8C",gel:"\u22DB",geq:"\u2265",geqq:"\u2267",geqslant:"\u2A7E",ges:"\u2A7E",gescc:"\u2AA9",gesdot:"\u2A80",gesdoto:"\u2A82",gesdotol:"\u2A84",gesl:"\u22DB\uFE00",gesles:"\u2A94",Gfr:"\u{1D50A}",gfr:"\u{1D524}",Gg:"\u22D9",gg:"\u226B",ggg:"\u22D9",gimel:"\u2137",GJcy:"\u0403",gjcy:"\u0453",gl:"\u2277",gla:"\u2AA5",glE:"\u2A92",glj:"\u2AA4",gnap:"\u2A8A",gnapprox:"\u2A8A",gnE:"\u2269",gne:"\u2A88",gneq:"\u2A88",gneqq:"\u2269",gnsim:"\u22E7",Gopf:"\u{1D53E}",gopf:"\u{1D558}",grave:"`",GreaterEqual:"\u2265",GreaterEqualLess:"\u22DB",GreaterFullEqual:"\u2267",GreaterGreater:"\u2AA2",GreaterLess:"\u2277",GreaterSlantEqual:"\u2A7E",GreaterTilde:"\u2273",Gscr:"\u{1D4A2}",gscr:"\u210A",gsim:"\u2273",gsime:"\u2A8E",gsiml:"\u2A90",Gt:"\u226B",GT:">",gt:">",gtcc:"\u2AA7",gtcir:"\u2A7A",gtdot:"\u22D7",gtlPar:"\u2995",gtquest:"\u2A7C",gtrapprox:"\u2A86",gtrarr:"\u2978",gtrdot:"\u22D7",gtreqless:"\u22DB",gtreqqless:"\u2A8C",gtrless:"\u2277",gtrsim:"\u2273",gvertneqq:"\u2269\uFE00",gvnE:"\u2269\uFE00",Hacek:"\u02C7",hairsp:"\u200A",half:"\xBD",hamilt:"\u210B",HARDcy:"\u042A",hardcy:"\u044A",hArr:"\u21D4",harr:"\u2194",harrcir:"\u2948",harrw:"\u21AD",Hat:"^",hbar:"\u210F",Hcirc:"\u0124",hcirc:"\u0125",hearts:"\u2665",heartsuit:"\u2665",hellip:"\u2026",hercon:"\u22B9",Hfr:"\u210C",hfr:"\u{1D525}",HilbertSpace:"\u210B",hksearow:"\u2925",hkswarow:"\u2926",hoarr:"\u21FF",homtht:"\u223B",hookleftarrow:"\u21A9",hookrightarrow:"\u21AA",Hopf:"\u210D",hopf:"\u{1D559}",horbar:"\u2015",HorizontalLine:"\u2500",Hscr:"\u210B",hscr:"\u{1D4BD}",hslash:"\u210F",Hstrok:"\u0126",hstrok:"\u0127",HumpDownHump:"\u224E",HumpEqual:"\u224F",hybull:"\u2043",hyphen:"\u2010",Iacute:"\xCD",iacute:"\xED",ic:"\u2063",Icirc:"\xCE",icirc:"\xEE",Icy:"\u0418",icy:"\u0438",Idot:"\u0130",IEcy:"\u0415",iecy:"\u0435",iexcl:"\xA1",iff:"\u21D4",Ifr:"\u2111",ifr:"\u{1D526}",Igrave:"\xCC",igrave:"\xEC",ii:"\u2148",iiiint:"\u2A0C",iiint:"\u222D",iinfin:"\u29DC",iiota:"\u2129",IJlig:"\u0132",ijlig:"\u0133",Im:"\u2111",Imacr:"\u012A",imacr:"\u012B",image:"\u2111",ImaginaryI:"\u2148",imagline:"\u2110",imagpart:"\u2111",imath:"\u0131",imof:"\u22B7",imped:"\u01B5",Implies:"\u21D2",in:"\u2208",incare:"\u2105",infin:"\u221E",infintie:"\u29DD",inodot:"\u0131",Int:"\u222C",int:"\u222B",intcal:"\u22BA",integers:"\u2124",Integral:"\u222B",intercal:"\u22BA",Intersection:"\u22C2",intlarhk:"\u2A17",intprod:"\u2A3C",InvisibleComma:"\u2063",InvisibleTimes:"\u2062",IOcy:"\u0401",iocy:"\u0451",Iogon:"\u012E",iogon:"\u012F",Iopf:"\u{1D540}",iopf:"\u{1D55A}",Iota:"\u0399",iota:"\u03B9",iprod:"\u2A3C",iquest:"\xBF",Iscr:"\u2110",iscr:"\u{1D4BE}",isin:"\u2208",isindot:"\u22F5",isinE:"\u22F9",isins:"\u22F4",isinsv:"\u22F3",isinv:"\u2208",it:"\u2062",Itilde:"\u0128",itilde:"\u0129",Iukcy:"\u0406",iukcy:"\u0456",Iuml:"\xCF",iuml:"\xEF",Jcirc:"\u0134",jcirc:"\u0135",Jcy:"\u0419",jcy:"\u0439",Jfr:"\u{1D50D}",jfr:"\u{1D527}",jmath:"\u0237",Jopf:"\u{1D541}",jopf:"\u{1D55B}",Jscr:"\u{1D4A5}",jscr:"\u{1D4BF}",Jsercy:"\u0408",jsercy:"\u0458",Jukcy:"\u0404",jukcy:"\u0454",Kappa:"\u039A",kappa:"\u03BA",kappav:"\u03F0",Kcedil:"\u0136",kcedil:"\u0137",Kcy:"\u041A",kcy:"\u043A",Kfr:"\u{1D50E}",kfr:"\u{1D528}",kgreen:"\u0138",KHcy:"\u0425",khcy:"\u0445",KJcy:"\u040C",kjcy:"\u045C",Kopf:"\u{1D542}",kopf:"\u{1D55C}",Kscr:"\u{1D4A6}",kscr:"\u{1D4C0}",lAarr:"\u21DA",Lacute:"\u0139",lacute:"\u013A",laemptyv:"\u29B4",lagran:"\u2112",Lambda:"\u039B",lambda:"\u03BB",Lang:"\u27EA",lang:"\u27E8",langd:"\u2991",langle:"\u27E8",lap:"\u2A85",Laplacetrf:"\u2112",laquo:"\xAB",Larr:"\u219E",lArr:"\u21D0",larr:"\u2190",larrb:"\u21E4",larrbfs:"\u291F",larrfs:"\u291D",larrhk:"\u21A9",larrlp:"\u21AB",larrpl:"\u2939",larrsim:"\u2973",larrtl:"\u21A2",lat:"\u2AAB",lAtail:"\u291B",latail:"\u2919",late:"\u2AAD",lates:"\u2AAD\uFE00",lBarr:"\u290E",lbarr:"\u290C",lbbrk:"\u2772",lbrace:"{",lbrack:"[",lbrke:"\u298B",lbrksld:"\u298F",lbrkslu:"\u298D",Lcaron:"\u013D",lcaron:"\u013E",Lcedil:"\u013B",lcedil:"\u013C",lceil:"\u2308",lcub:"{",Lcy:"\u041B",lcy:"\u043B",ldca:"\u2936",ldquo:"\u201C",ldquor:"\u201E",ldrdhar:"\u2967",ldrushar:"\u294B",ldsh:"\u21B2",lE:"\u2266",le:"\u2264",LeftAngleBracket:"\u27E8",LeftArrow:"\u2190",Leftarrow:"\u21D0",leftarrow:"\u2190",LeftArrowBar:"\u21E4",LeftArrowRightArrow:"\u21C6",leftarrowtail:"\u21A2",LeftCeiling:"\u2308",LeftDoubleBracket:"\u27E6",LeftDownTeeVector:"\u2961",LeftDownVector:"\u21C3",LeftDownVectorBar:"\u2959",LeftFloor:"\u230A",leftharpoondown:"\u21BD",leftharpoonup:"\u21BC",leftleftarrows:"\u21C7",LeftRightArrow:"\u2194",Leftrightarrow:"\u21D4",leftrightarrow:"\u2194",leftrightarrows:"\u21C6",leftrightharpoons:"\u21CB",leftrightsquigarrow:"\u21AD",LeftRightVector:"\u294E",LeftTee:"\u22A3",LeftTeeArrow:"\u21A4",LeftTeeVector:"\u295A",leftthreetimes:"\u22CB",LeftTriangle:"\u22B2",LeftTriangleBar:"\u29CF",LeftTriangleEqual:"\u22B4",LeftUpDownVector:"\u2951",LeftUpTeeVector:"\u2960",LeftUpVector:"\u21BF",LeftUpVectorBar:"\u2958",LeftVector:"\u21BC",LeftVectorBar:"\u2952",lEg:"\u2A8B",leg:"\u22DA",leq:"\u2264",leqq:"\u2266",leqslant:"\u2A7D",les:"\u2A7D",lescc:"\u2AA8",lesdot:"\u2A7F",lesdoto:"\u2A81",lesdotor:"\u2A83",lesg:"\u22DA\uFE00",lesges:"\u2A93",lessapprox:"\u2A85",lessdot:"\u22D6",lesseqgtr:"\u22DA",lesseqqgtr:"\u2A8B",LessEqualGreater:"\u22DA",LessFullEqual:"\u2266",LessGreater:"\u2276",lessgtr:"\u2276",LessLess:"\u2AA1",lesssim:"\u2272",LessSlantEqual:"\u2A7D",LessTilde:"\u2272",lfisht:"\u297C",lfloor:"\u230A",Lfr:"\u{1D50F}",lfr:"\u{1D529}",lg:"\u2276",lgE:"\u2A91",lHar:"\u2962",lhard:"\u21BD",lharu:"\u21BC",lharul:"\u296A",lhblk:"\u2584",LJcy:"\u0409",ljcy:"\u0459",Ll:"\u22D8",ll:"\u226A",llarr:"\u21C7",llcorner:"\u231E",Lleftarrow:"\u21DA",llhard:"\u296B",lltri:"\u25FA",Lmidot:"\u013F",lmidot:"\u0140",lmoust:"\u23B0",lmoustache:"\u23B0",lnap:"\u2A89",lnapprox:"\u2A89",lnE:"\u2268",lne:"\u2A87",lneq:"\u2A87",lneqq:"\u2268",lnsim:"\u22E6",loang:"\u27EC",loarr:"\u21FD",lobrk:"\u27E6",LongLeftArrow:"\u27F5",Longleftarrow:"\u27F8",longleftarrow:"\u27F5",LongLeftRightArrow:"\u27F7",Longleftrightarrow:"\u27FA",longleftrightarrow:"\u27F7",longmapsto:"\u27FC",LongRightArrow:"\u27F6",Longrightarrow:"\u27F9",longrightarrow:"\u27F6",looparrowleft:"\u21AB",looparrowright:"\u21AC",lopar:"\u2985",Lopf:"\u{1D543}",lopf:"\u{1D55D}",loplus:"\u2A2D",lotimes:"\u2A34",lowast:"\u2217",lowbar:"_",LowerLeftArrow:"\u2199",LowerRightArrow:"\u2198",loz:"\u25CA",lozenge:"\u25CA",lozf:"\u29EB",lpar:"(",lparlt:"\u2993",lrarr:"\u21C6",lrcorner:"\u231F",lrhar:"\u21CB",lrhard:"\u296D",lrm:"\u200E",lrtri:"\u22BF",lsaquo:"\u2039",Lscr:"\u2112",lscr:"\u{1D4C1}",Lsh:"\u21B0",lsh:"\u21B0",lsim:"\u2272",lsime:"\u2A8D",lsimg:"\u2A8F",lsqb:"[",lsquo:"\u2018",lsquor:"\u201A",Lstrok:"\u0141",lstrok:"\u0142",Lt:"\u226A",LT:"<",lt:"<",ltcc:"\u2AA6",ltcir:"\u2A79",ltdot:"\u22D6",lthree:"\u22CB",ltimes:"\u22C9",ltlarr:"\u2976",ltquest:"\u2A7B",ltri:"\u25C3",ltrie:"\u22B4",ltrif:"\u25C2",ltrPar:"\u2996",lurdshar:"\u294A",luruhar:"\u2966",lvertneqq:"\u2268\uFE00",lvnE:"\u2268\uFE00",macr:"\xAF",male:"\u2642",malt:"\u2720",maltese:"\u2720",Map:"\u2905",map:"\u21A6",mapsto:"\u21A6",mapstodown:"\u21A7",mapstoleft:"\u21A4",mapstoup:"\u21A5",marker:"\u25AE",mcomma:"\u2A29",Mcy:"\u041C",mcy:"\u043C",mdash:"\u2014",mDDot:"\u223A",measuredangle:"\u2221",MediumSpace:"\u205F",Mellintrf:"\u2133",Mfr:"\u{1D510}",mfr:"\u{1D52A}",mho:"\u2127",micro:"\xB5",mid:"\u2223",midast:"*",midcir:"\u2AF0",middot:"\xB7",minus:"\u2212",minusb:"\u229F",minusd:"\u2238",minusdu:"\u2A2A",MinusPlus:"\u2213",mlcp:"\u2ADB",mldr:"\u2026",mnplus:"\u2213",models:"\u22A7",Mopf:"\u{1D544}",mopf:"\u{1D55E}",mp:"\u2213",Mscr:"\u2133",mscr:"\u{1D4C2}",mstpos:"\u223E",Mu:"\u039C",mu:"\u03BC",multimap:"\u22B8",mumap:"\u22B8",nabla:"\u2207",Nacute:"\u0143",nacute:"\u0144",nang:"\u2220\u20D2",nap:"\u2249",napE:"\u2A70\u0338",napid:"\u224B\u0338",napos:"\u0149",napprox:"\u2249",natur:"\u266E",natural:"\u266E",naturals:"\u2115",nbsp:"\xA0",nbump:"\u224E\u0338",nbumpe:"\u224F\u0338",ncap:"\u2A43",Ncaron:"\u0147",ncaron:"\u0148",Ncedil:"\u0145",ncedil:"\u0146",ncong:"\u2247",ncongdot:"\u2A6D\u0338",ncup:"\u2A42",Ncy:"\u041D",ncy:"\u043D",ndash:"\u2013",ne:"\u2260",nearhk:"\u2924",neArr:"\u21D7",nearr:"\u2197",nearrow:"\u2197",nedot:"\u2250\u0338",NegativeMediumSpace:"\u200B",NegativeThickSpace:"\u200B",NegativeThinSpace:"\u200B",NegativeVeryThinSpace:"\u200B",nequiv:"\u2262",nesear:"\u2928",nesim:"\u2242\u0338",NestedGreaterGreater:"\u226B",NestedLessLess:"\u226A",NewLine:`
|
|
83
83
|
`,nexist:"\u2204",nexists:"\u2204",Nfr:"\u{1D511}",nfr:"\u{1D52B}",ngE:"\u2267\u0338",nge:"\u2271",ngeq:"\u2271",ngeqq:"\u2267\u0338",ngeqslant:"\u2A7E\u0338",nges:"\u2A7E\u0338",nGg:"\u22D9\u0338",ngsim:"\u2275",nGt:"\u226B\u20D2",ngt:"\u226F",ngtr:"\u226F",nGtv:"\u226B\u0338",nhArr:"\u21CE",nharr:"\u21AE",nhpar:"\u2AF2",ni:"\u220B",nis:"\u22FC",nisd:"\u22FA",niv:"\u220B",NJcy:"\u040A",njcy:"\u045A",nlArr:"\u21CD",nlarr:"\u219A",nldr:"\u2025",nlE:"\u2266\u0338",nle:"\u2270",nLeftarrow:"\u21CD",nleftarrow:"\u219A",nLeftrightarrow:"\u21CE",nleftrightarrow:"\u21AE",nleq:"\u2270",nleqq:"\u2266\u0338",nleqslant:"\u2A7D\u0338",nles:"\u2A7D\u0338",nless:"\u226E",nLl:"\u22D8\u0338",nlsim:"\u2274",nLt:"\u226A\u20D2",nlt:"\u226E",nltri:"\u22EA",nltrie:"\u22EC",nLtv:"\u226A\u0338",nmid:"\u2224",NoBreak:"\u2060",NonBreakingSpace:"\xA0",Nopf:"\u2115",nopf:"\u{1D55F}",Not:"\u2AEC",not:"\xAC",NotCongruent:"\u2262",NotCupCap:"\u226D",NotDoubleVerticalBar:"\u2226",NotElement:"\u2209",NotEqual:"\u2260",NotEqualTilde:"\u2242\u0338",NotExists:"\u2204",NotGreater:"\u226F",NotGreaterEqual:"\u2271",NotGreaterFullEqual:"\u2267\u0338",NotGreaterGreater:"\u226B\u0338",NotGreaterLess:"\u2279",NotGreaterSlantEqual:"\u2A7E\u0338",NotGreaterTilde:"\u2275",NotHumpDownHump:"\u224E\u0338",NotHumpEqual:"\u224F\u0338",notin:"\u2209",notindot:"\u22F5\u0338",notinE:"\u22F9\u0338",notinva:"\u2209",notinvb:"\u22F7",notinvc:"\u22F6",NotLeftTriangle:"\u22EA",NotLeftTriangleBar:"\u29CF\u0338",NotLeftTriangleEqual:"\u22EC",NotLess:"\u226E",NotLessEqual:"\u2270",NotLessGreater:"\u2278",NotLessLess:"\u226A\u0338",NotLessSlantEqual:"\u2A7D\u0338",NotLessTilde:"\u2274",NotNestedGreaterGreater:"\u2AA2\u0338",NotNestedLessLess:"\u2AA1\u0338",notni:"\u220C",notniva:"\u220C",notnivb:"\u22FE",notnivc:"\u22FD",NotPrecedes:"\u2280",NotPrecedesEqual:"\u2AAF\u0338",NotPrecedesSlantEqual:"\u22E0",NotReverseElement:"\u220C",NotRightTriangle:"\u22EB",NotRightTriangleBar:"\u29D0\u0338",NotRightTriangleEqual:"\u22ED",NotSquareSubset:"\u228F\u0338",NotSquareSubsetEqual:"\u22E2",NotSquareSuperset:"\u2290\u0338",NotSquareSupersetEqual:"\u22E3",NotSubset:"\u2282\u20D2",NotSubsetEqual:"\u2288",NotSucceeds:"\u2281",NotSucceedsEqual:"\u2AB0\u0338",NotSucceedsSlantEqual:"\u22E1",NotSucceedsTilde:"\u227F\u0338",NotSuperset:"\u2283\u20D2",NotSupersetEqual:"\u2289",NotTilde:"\u2241",NotTildeEqual:"\u2244",NotTildeFullEqual:"\u2247",NotTildeTilde:"\u2249",NotVerticalBar:"\u2224",npar:"\u2226",nparallel:"\u2226",nparsl:"\u2AFD\u20E5",npart:"\u2202\u0338",npolint:"\u2A14",npr:"\u2280",nprcue:"\u22E0",npre:"\u2AAF\u0338",nprec:"\u2280",npreceq:"\u2AAF\u0338",nrArr:"\u21CF",nrarr:"\u219B",nrarrc:"\u2933\u0338",nrarrw:"\u219D\u0338",nRightarrow:"\u21CF",nrightarrow:"\u219B",nrtri:"\u22EB",nrtrie:"\u22ED",nsc:"\u2281",nsccue:"\u22E1",nsce:"\u2AB0\u0338",Nscr:"\u{1D4A9}",nscr:"\u{1D4C3}",nshortmid:"\u2224",nshortparallel:"\u2226",nsim:"\u2241",nsime:"\u2244",nsimeq:"\u2244",nsmid:"\u2224",nspar:"\u2226",nsqsube:"\u22E2",nsqsupe:"\u22E3",nsub:"\u2284",nsubE:"\u2AC5\u0338",nsube:"\u2288",nsubset:"\u2282\u20D2",nsubseteq:"\u2288",nsubseteqq:"\u2AC5\u0338",nsucc:"\u2281",nsucceq:"\u2AB0\u0338",nsup:"\u2285",nsupE:"\u2AC6\u0338",nsupe:"\u2289",nsupset:"\u2283\u20D2",nsupseteq:"\u2289",nsupseteqq:"\u2AC6\u0338",ntgl:"\u2279",Ntilde:"\xD1",ntilde:"\xF1",ntlg:"\u2278",ntriangleleft:"\u22EA",ntrianglelefteq:"\u22EC",ntriangleright:"\u22EB",ntrianglerighteq:"\u22ED",Nu:"\u039D",nu:"\u03BD",num:"#",numero:"\u2116",numsp:"\u2007",nvap:"\u224D\u20D2",nVDash:"\u22AF",nVdash:"\u22AE",nvDash:"\u22AD",nvdash:"\u22AC",nvge:"\u2265\u20D2",nvgt:">\u20D2",nvHarr:"\u2904",nvinfin:"\u29DE",nvlArr:"\u2902",nvle:"\u2264\u20D2",nvlt:"<\u20D2",nvltrie:"\u22B4\u20D2",nvrArr:"\u2903",nvrtrie:"\u22B5\u20D2",nvsim:"\u223C\u20D2",nwarhk:"\u2923",nwArr:"\u21D6",nwarr:"\u2196",nwarrow:"\u2196",nwnear:"\u2927",Oacute:"\xD3",oacute:"\xF3",oast:"\u229B",ocir:"\u229A",Ocirc:"\xD4",ocirc:"\xF4",Ocy:"\u041E",ocy:"\u043E",odash:"\u229D",Odblac:"\u0150",odblac:"\u0151",odiv:"\u2A38",odot:"\u2299",odsold:"\u29BC",OElig:"\u0152",oelig:"\u0153",ofcir:"\u29BF",Ofr:"\u{1D512}",ofr:"\u{1D52C}",ogon:"\u02DB",Ograve:"\xD2",ograve:"\xF2",ogt:"\u29C1",ohbar:"\u29B5",ohm:"\u03A9",oint:"\u222E",olarr:"\u21BA",olcir:"\u29BE",olcross:"\u29BB",oline:"\u203E",olt:"\u29C0",Omacr:"\u014C",omacr:"\u014D",Omega:"\u03A9",omega:"\u03C9",Omicron:"\u039F",omicron:"\u03BF",omid:"\u29B6",ominus:"\u2296",Oopf:"\u{1D546}",oopf:"\u{1D560}",opar:"\u29B7",OpenCurlyDoubleQuote:"\u201C",OpenCurlyQuote:"\u2018",operp:"\u29B9",oplus:"\u2295",Or:"\u2A54",or:"\u2228",orarr:"\u21BB",ord:"\u2A5D",order:"\u2134",orderof:"\u2134",ordf:"\xAA",ordm:"\xBA",origof:"\u22B6",oror:"\u2A56",orslope:"\u2A57",orv:"\u2A5B",oS:"\u24C8",Oscr:"\u{1D4AA}",oscr:"\u2134",Oslash:"\xD8",oslash:"\xF8",osol:"\u2298",Otilde:"\xD5",otilde:"\xF5",Otimes:"\u2A37",otimes:"\u2297",otimesas:"\u2A36",Ouml:"\xD6",ouml:"\xF6",ovbar:"\u233D",OverBar:"\u203E",OverBrace:"\u23DE",OverBracket:"\u23B4",OverParenthesis:"\u23DC",par:"\u2225",para:"\xB6",parallel:"\u2225",parsim:"\u2AF3",parsl:"\u2AFD",part:"\u2202",PartialD:"\u2202",Pcy:"\u041F",pcy:"\u043F",percnt:"%",period:".",permil:"\u2030",perp:"\u22A5",pertenk:"\u2031",Pfr:"\u{1D513}",pfr:"\u{1D52D}",Phi:"\u03A6",phi:"\u03C6",phiv:"\u03D5",phmmat:"\u2133",phone:"\u260E",Pi:"\u03A0",pi:"\u03C0",pitchfork:"\u22D4",piv:"\u03D6",planck:"\u210F",planckh:"\u210E",plankv:"\u210F",plus:"+",plusacir:"\u2A23",plusb:"\u229E",pluscir:"\u2A22",plusdo:"\u2214",plusdu:"\u2A25",pluse:"\u2A72",PlusMinus:"\xB1",plusmn:"\xB1",plussim:"\u2A26",plustwo:"\u2A27",pm:"\xB1",Poincareplane:"\u210C",pointint:"\u2A15",Popf:"\u2119",popf:"\u{1D561}",pound:"\xA3",Pr:"\u2ABB",pr:"\u227A",prap:"\u2AB7",prcue:"\u227C",prE:"\u2AB3",pre:"\u2AAF",prec:"\u227A",precapprox:"\u2AB7",preccurlyeq:"\u227C",Precedes:"\u227A",PrecedesEqual:"\u2AAF",PrecedesSlantEqual:"\u227C",PrecedesTilde:"\u227E",preceq:"\u2AAF",precnapprox:"\u2AB9",precneqq:"\u2AB5",precnsim:"\u22E8",precsim:"\u227E",Prime:"\u2033",prime:"\u2032",primes:"\u2119",prnap:"\u2AB9",prnE:"\u2AB5",prnsim:"\u22E8",prod:"\u220F",Product:"\u220F",profalar:"\u232E",profline:"\u2312",profsurf:"\u2313",prop:"\u221D",Proportion:"\u2237",Proportional:"\u221D",propto:"\u221D",prsim:"\u227E",prurel:"\u22B0",Pscr:"\u{1D4AB}",pscr:"\u{1D4C5}",Psi:"\u03A8",psi:"\u03C8",puncsp:"\u2008",Qfr:"\u{1D514}",qfr:"\u{1D52E}",qint:"\u2A0C",Qopf:"\u211A",qopf:"\u{1D562}",qprime:"\u2057",Qscr:"\u{1D4AC}",qscr:"\u{1D4C6}",quaternions:"\u210D",quatint:"\u2A16",quest:"?",questeq:"\u225F",QUOT:'"',quot:'"',rAarr:"\u21DB",race:"\u223D\u0331",Racute:"\u0154",racute:"\u0155",radic:"\u221A",raemptyv:"\u29B3",Rang:"\u27EB",rang:"\u27E9",rangd:"\u2992",range:"\u29A5",rangle:"\u27E9",raquo:"\xBB",Rarr:"\u21A0",rArr:"\u21D2",rarr:"\u2192",rarrap:"\u2975",rarrb:"\u21E5",rarrbfs:"\u2920",rarrc:"\u2933",rarrfs:"\u291E",rarrhk:"\u21AA",rarrlp:"\u21AC",rarrpl:"\u2945",rarrsim:"\u2974",Rarrtl:"\u2916",rarrtl:"\u21A3",rarrw:"\u219D",rAtail:"\u291C",ratail:"\u291A",ratio:"\u2236",rationals:"\u211A",RBarr:"\u2910",rBarr:"\u290F",rbarr:"\u290D",rbbrk:"\u2773",rbrace:"}",rbrack:"]",rbrke:"\u298C",rbrksld:"\u298E",rbrkslu:"\u2990",Rcaron:"\u0158",rcaron:"\u0159",Rcedil:"\u0156",rcedil:"\u0157",rceil:"\u2309",rcub:"}",Rcy:"\u0420",rcy:"\u0440",rdca:"\u2937",rdldhar:"\u2969",rdquo:"\u201D",rdquor:"\u201D",rdsh:"\u21B3",Re:"\u211C",real:"\u211C",realine:"\u211B",realpart:"\u211C",reals:"\u211D",rect:"\u25AD",REG:"\xAE",reg:"\xAE",ReverseElement:"\u220B",ReverseEquilibrium:"\u21CB",ReverseUpEquilibrium:"\u296F",rfisht:"\u297D",rfloor:"\u230B",Rfr:"\u211C",rfr:"\u{1D52F}",rHar:"\u2964",rhard:"\u21C1",rharu:"\u21C0",rharul:"\u296C",Rho:"\u03A1",rho:"\u03C1",rhov:"\u03F1",RightAngleBracket:"\u27E9",RightArrow:"\u2192",Rightarrow:"\u21D2",rightarrow:"\u2192",RightArrowBar:"\u21E5",RightArrowLeftArrow:"\u21C4",rightarrowtail:"\u21A3",RightCeiling:"\u2309",RightDoubleBracket:"\u27E7",RightDownTeeVector:"\u295D",RightDownVector:"\u21C2",RightDownVectorBar:"\u2955",RightFloor:"\u230B",rightharpoondown:"\u21C1",rightharpoonup:"\u21C0",rightleftarrows:"\u21C4",rightleftharpoons:"\u21CC",rightrightarrows:"\u21C9",rightsquigarrow:"\u219D",RightTee:"\u22A2",RightTeeArrow:"\u21A6",RightTeeVector:"\u295B",rightthreetimes:"\u22CC",RightTriangle:"\u22B3",RightTriangleBar:"\u29D0",RightTriangleEqual:"\u22B5",RightUpDownVector:"\u294F",RightUpTeeVector:"\u295C",RightUpVector:"\u21BE",RightUpVectorBar:"\u2954",RightVector:"\u21C0",RightVectorBar:"\u2953",ring:"\u02DA",risingdotseq:"\u2253",rlarr:"\u21C4",rlhar:"\u21CC",rlm:"\u200F",rmoust:"\u23B1",rmoustache:"\u23B1",rnmid:"\u2AEE",roang:"\u27ED",roarr:"\u21FE",robrk:"\u27E7",ropar:"\u2986",Ropf:"\u211D",ropf:"\u{1D563}",roplus:"\u2A2E",rotimes:"\u2A35",RoundImplies:"\u2970",rpar:")",rpargt:"\u2994",rppolint:"\u2A12",rrarr:"\u21C9",Rrightarrow:"\u21DB",rsaquo:"\u203A",Rscr:"\u211B",rscr:"\u{1D4C7}",Rsh:"\u21B1",rsh:"\u21B1",rsqb:"]",rsquo:"\u2019",rsquor:"\u2019",rthree:"\u22CC",rtimes:"\u22CA",rtri:"\u25B9",rtrie:"\u22B5",rtrif:"\u25B8",rtriltri:"\u29CE",RuleDelayed:"\u29F4",ruluhar:"\u2968",rx:"\u211E",Sacute:"\u015A",sacute:"\u015B",sbquo:"\u201A",Sc:"\u2ABC",sc:"\u227B",scap:"\u2AB8",Scaron:"\u0160",scaron:"\u0161",sccue:"\u227D",scE:"\u2AB4",sce:"\u2AB0",Scedil:"\u015E",scedil:"\u015F",Scirc:"\u015C",scirc:"\u015D",scnap:"\u2ABA",scnE:"\u2AB6",scnsim:"\u22E9",scpolint:"\u2A13",scsim:"\u227F",Scy:"\u0421",scy:"\u0441",sdot:"\u22C5",sdotb:"\u22A1",sdote:"\u2A66",searhk:"\u2925",seArr:"\u21D8",searr:"\u2198",searrow:"\u2198",sect:"\xA7",semi:";",seswar:"\u2929",setminus:"\u2216",setmn:"\u2216",sext:"\u2736",Sfr:"\u{1D516}",sfr:"\u{1D530}",sfrown:"\u2322",sharp:"\u266F",SHCHcy:"\u0429",shchcy:"\u0449",SHcy:"\u0428",shcy:"\u0448",ShortDownArrow:"\u2193",ShortLeftArrow:"\u2190",shortmid:"\u2223",shortparallel:"\u2225",ShortRightArrow:"\u2192",ShortUpArrow:"\u2191",shy:"\xAD",Sigma:"\u03A3",sigma:"\u03C3",sigmaf:"\u03C2",sigmav:"\u03C2",sim:"\u223C",simdot:"\u2A6A",sime:"\u2243",simeq:"\u2243",simg:"\u2A9E",simgE:"\u2AA0",siml:"\u2A9D",simlE:"\u2A9F",simne:"\u2246",simplus:"\u2A24",simrarr:"\u2972",slarr:"\u2190",SmallCircle:"\u2218",smallsetminus:"\u2216",smashp:"\u2A33",smeparsl:"\u29E4",smid:"\u2223",smile:"\u2323",smt:"\u2AAA",smte:"\u2AAC",smtes:"\u2AAC\uFE00",SOFTcy:"\u042C",softcy:"\u044C",sol:"/",solb:"\u29C4",solbar:"\u233F",Sopf:"\u{1D54A}",sopf:"\u{1D564}",spades:"\u2660",spadesuit:"\u2660",spar:"\u2225",sqcap:"\u2293",sqcaps:"\u2293\uFE00",sqcup:"\u2294",sqcups:"\u2294\uFE00",Sqrt:"\u221A",sqsub:"\u228F",sqsube:"\u2291",sqsubset:"\u228F",sqsubseteq:"\u2291",sqsup:"\u2290",sqsupe:"\u2292",sqsupset:"\u2290",sqsupseteq:"\u2292",squ:"\u25A1",Square:"\u25A1",square:"\u25A1",SquareIntersection:"\u2293",SquareSubset:"\u228F",SquareSubsetEqual:"\u2291",SquareSuperset:"\u2290",SquareSupersetEqual:"\u2292",SquareUnion:"\u2294",squarf:"\u25AA",squf:"\u25AA",srarr:"\u2192",Sscr:"\u{1D4AE}",sscr:"\u{1D4C8}",ssetmn:"\u2216",ssmile:"\u2323",sstarf:"\u22C6",Star:"\u22C6",star:"\u2606",starf:"\u2605",straightepsilon:"\u03F5",straightphi:"\u03D5",strns:"\xAF",Sub:"\u22D0",sub:"\u2282",subdot:"\u2ABD",subE:"\u2AC5",sube:"\u2286",subedot:"\u2AC3",submult:"\u2AC1",subnE:"\u2ACB",subne:"\u228A",subplus:"\u2ABF",subrarr:"\u2979",Subset:"\u22D0",subset:"\u2282",subseteq:"\u2286",subseteqq:"\u2AC5",SubsetEqual:"\u2286",subsetneq:"\u228A",subsetneqq:"\u2ACB",subsim:"\u2AC7",subsub:"\u2AD5",subsup:"\u2AD3",succ:"\u227B",succapprox:"\u2AB8",succcurlyeq:"\u227D",Succeeds:"\u227B",SucceedsEqual:"\u2AB0",SucceedsSlantEqual:"\u227D",SucceedsTilde:"\u227F",succeq:"\u2AB0",succnapprox:"\u2ABA",succneqq:"\u2AB6",succnsim:"\u22E9",succsim:"\u227F",SuchThat:"\u220B",Sum:"\u2211",sum:"\u2211",sung:"\u266A",Sup:"\u22D1",sup:"\u2283",sup1:"\xB9",sup2:"\xB2",sup3:"\xB3",supdot:"\u2ABE",supdsub:"\u2AD8",supE:"\u2AC6",supe:"\u2287",supedot:"\u2AC4",Superset:"\u2283",SupersetEqual:"\u2287",suphsol:"\u27C9",suphsub:"\u2AD7",suplarr:"\u297B",supmult:"\u2AC2",supnE:"\u2ACC",supne:"\u228B",supplus:"\u2AC0",Supset:"\u22D1",supset:"\u2283",supseteq:"\u2287",supseteqq:"\u2AC6",supsetneq:"\u228B",supsetneqq:"\u2ACC",supsim:"\u2AC8",supsub:"\u2AD4",supsup:"\u2AD6",swarhk:"\u2926",swArr:"\u21D9",swarr:"\u2199",swarrow:"\u2199",swnwar:"\u292A",szlig:"\xDF",Tab:" ",target:"\u2316",Tau:"\u03A4",tau:"\u03C4",tbrk:"\u23B4",Tcaron:"\u0164",tcaron:"\u0165",Tcedil:"\u0162",tcedil:"\u0163",Tcy:"\u0422",tcy:"\u0442",tdot:"\u20DB",telrec:"\u2315",Tfr:"\u{1D517}",tfr:"\u{1D531}",there4:"\u2234",Therefore:"\u2234",therefore:"\u2234",Theta:"\u0398",theta:"\u03B8",thetasym:"\u03D1",thetav:"\u03D1",thickapprox:"\u2248",thicksim:"\u223C",ThickSpace:"\u205F\u200A",thinsp:"\u2009",ThinSpace:"\u2009",thkap:"\u2248",thksim:"\u223C",THORN:"\xDE",thorn:"\xFE",Tilde:"\u223C",tilde:"\u02DC",TildeEqual:"\u2243",TildeFullEqual:"\u2245",TildeTilde:"\u2248",times:"\xD7",timesb:"\u22A0",timesbar:"\u2A31",timesd:"\u2A30",tint:"\u222D",toea:"\u2928",top:"\u22A4",topbot:"\u2336",topcir:"\u2AF1",Topf:"\u{1D54B}",topf:"\u{1D565}",topfork:"\u2ADA",tosa:"\u2929",tprime:"\u2034",TRADE:"\u2122",trade:"\u2122",triangle:"\u25B5",triangledown:"\u25BF",triangleleft:"\u25C3",trianglelefteq:"\u22B4",triangleq:"\u225C",triangleright:"\u25B9",trianglerighteq:"\u22B5",tridot:"\u25EC",trie:"\u225C",triminus:"\u2A3A",TripleDot:"\u20DB",triplus:"\u2A39",trisb:"\u29CD",tritime:"\u2A3B",trpezium:"\u23E2",Tscr:"\u{1D4AF}",tscr:"\u{1D4C9}",TScy:"\u0426",tscy:"\u0446",TSHcy:"\u040B",tshcy:"\u045B",Tstrok:"\u0166",tstrok:"\u0167",twixt:"\u226C",twoheadleftarrow:"\u219E",twoheadrightarrow:"\u21A0",Uacute:"\xDA",uacute:"\xFA",Uarr:"\u219F",uArr:"\u21D1",uarr:"\u2191",Uarrocir:"\u2949",Ubrcy:"\u040E",ubrcy:"\u045E",Ubreve:"\u016C",ubreve:"\u016D",Ucirc:"\xDB",ucirc:"\xFB",Ucy:"\u0423",ucy:"\u0443",udarr:"\u21C5",Udblac:"\u0170",udblac:"\u0171",udhar:"\u296E",ufisht:"\u297E",Ufr:"\u{1D518}",ufr:"\u{1D532}",Ugrave:"\xD9",ugrave:"\xF9",uHar:"\u2963",uharl:"\u21BF",uharr:"\u21BE",uhblk:"\u2580",ulcorn:"\u231C",ulcorner:"\u231C",ulcrop:"\u230F",ultri:"\u25F8",Umacr:"\u016A",umacr:"\u016B",uml:"\xA8",UnderBar:"_",UnderBrace:"\u23DF",UnderBracket:"\u23B5",UnderParenthesis:"\u23DD",Union:"\u22C3",UnionPlus:"\u228E",Uogon:"\u0172",uogon:"\u0173",Uopf:"\u{1D54C}",uopf:"\u{1D566}",UpArrow:"\u2191",Uparrow:"\u21D1",uparrow:"\u2191",UpArrowBar:"\u2912",UpArrowDownArrow:"\u21C5",UpDownArrow:"\u2195",Updownarrow:"\u21D5",updownarrow:"\u2195",UpEquilibrium:"\u296E",upharpoonleft:"\u21BF",upharpoonright:"\u21BE",uplus:"\u228E",UpperLeftArrow:"\u2196",UpperRightArrow:"\u2197",Upsi:"\u03D2",upsi:"\u03C5",upsih:"\u03D2",Upsilon:"\u03A5",upsilon:"\u03C5",UpTee:"\u22A5",UpTeeArrow:"\u21A5",upuparrows:"\u21C8",urcorn:"\u231D",urcorner:"\u231D",urcrop:"\u230E",Uring:"\u016E",uring:"\u016F",urtri:"\u25F9",Uscr:"\u{1D4B0}",uscr:"\u{1D4CA}",utdot:"\u22F0",Utilde:"\u0168",utilde:"\u0169",utri:"\u25B5",utrif:"\u25B4",uuarr:"\u21C8",Uuml:"\xDC",uuml:"\xFC",uwangle:"\u29A7",vangrt:"\u299C",varepsilon:"\u03F5",varkappa:"\u03F0",varnothing:"\u2205",varphi:"\u03D5",varpi:"\u03D6",varpropto:"\u221D",vArr:"\u21D5",varr:"\u2195",varrho:"\u03F1",varsigma:"\u03C2",varsubsetneq:"\u228A\uFE00",varsubsetneqq:"\u2ACB\uFE00",varsupsetneq:"\u228B\uFE00",varsupsetneqq:"\u2ACC\uFE00",vartheta:"\u03D1",vartriangleleft:"\u22B2",vartriangleright:"\u22B3",Vbar:"\u2AEB",vBar:"\u2AE8",vBarv:"\u2AE9",Vcy:"\u0412",vcy:"\u0432",VDash:"\u22AB",Vdash:"\u22A9",vDash:"\u22A8",vdash:"\u22A2",Vdashl:"\u2AE6",Vee:"\u22C1",vee:"\u2228",veebar:"\u22BB",veeeq:"\u225A",vellip:"\u22EE",Verbar:"\u2016",verbar:"|",Vert:"\u2016",vert:"|",VerticalBar:"\u2223",VerticalLine:"|",VerticalSeparator:"\u2758",VerticalTilde:"\u2240",VeryThinSpace:"\u200A",Vfr:"\u{1D519}",vfr:"\u{1D533}",vltri:"\u22B2",vnsub:"\u2282\u20D2",vnsup:"\u2283\u20D2",Vopf:"\u{1D54D}",vopf:"\u{1D567}",vprop:"\u221D",vrtri:"\u22B3",Vscr:"\u{1D4B1}",vscr:"\u{1D4CB}",vsubnE:"\u2ACB\uFE00",vsubne:"\u228A\uFE00",vsupnE:"\u2ACC\uFE00",vsupne:"\u228B\uFE00",Vvdash:"\u22AA",vzigzag:"\u299A",Wcirc:"\u0174",wcirc:"\u0175",wedbar:"\u2A5F",Wedge:"\u22C0",wedge:"\u2227",wedgeq:"\u2259",weierp:"\u2118",Wfr:"\u{1D51A}",wfr:"\u{1D534}",Wopf:"\u{1D54E}",wopf:"\u{1D568}",wp:"\u2118",wr:"\u2240",wreath:"\u2240",Wscr:"\u{1D4B2}",wscr:"\u{1D4CC}",xcap:"\u22C2",xcirc:"\u25EF",xcup:"\u22C3",xdtri:"\u25BD",Xfr:"\u{1D51B}",xfr:"\u{1D535}",xhArr:"\u27FA",xharr:"\u27F7",Xi:"\u039E",xi:"\u03BE",xlArr:"\u27F8",xlarr:"\u27F5",xmap:"\u27FC",xnis:"\u22FB",xodot:"\u2A00",Xopf:"\u{1D54F}",xopf:"\u{1D569}",xoplus:"\u2A01",xotime:"\u2A02",xrArr:"\u27F9",xrarr:"\u27F6",Xscr:"\u{1D4B3}",xscr:"\u{1D4CD}",xsqcup:"\u2A06",xuplus:"\u2A04",xutri:"\u25B3",xvee:"\u22C1",xwedge:"\u22C0",Yacute:"\xDD",yacute:"\xFD",YAcy:"\u042F",yacy:"\u044F",Ycirc:"\u0176",ycirc:"\u0177",Ycy:"\u042B",ycy:"\u044B",yen:"\xA5",Yfr:"\u{1D51C}",yfr:"\u{1D536}",YIcy:"\u0407",yicy:"\u0457",Yopf:"\u{1D550}",yopf:"\u{1D56A}",Yscr:"\u{1D4B4}",yscr:"\u{1D4CE}",YUcy:"\u042E",yucy:"\u044E",Yuml:"\u0178",yuml:"\xFF",Zacute:"\u0179",zacute:"\u017A",Zcaron:"\u017D",zcaron:"\u017E",Zcy:"\u0417",zcy:"\u0437",Zdot:"\u017B",zdot:"\u017C",zeetrf:"\u2128",ZeroWidthSpace:"\u200B",Zeta:"\u0396",zeta:"\u03B6",Zfr:"\u2128",zfr:"\u{1D537}",ZHcy:"\u0416",zhcy:"\u0436",zigrarr:"\u21DD",Zopf:"\u2124",zopf:"\u{1D56B}",Zscr:"\u{1D4B5}",zscr:"\u{1D4CF}",zwj:"\u200D",zwnj:"\u200C"});Cx.entityMap=Cx.HTML_ENTITIES});var EK=X(tC=>{"use strict";var h0=lh(),bt=iO(),dK=yx(),Xpe=h0.isHTMLEscapableRawTextElement,Gpe=h0.isHTMLMimeType,zpe=h0.isHTMLRawTextElement,Dx=h0.hasOwn,lK=h0.NAMESPACE,fK=dK.ParseError,Wpe=dK.DOMException,Nx=0,jc=1,c0=2,Tx=3,l0=4,f0=5,Ix=6,eC=7;function mK(){}o(mK,"XMLReader");mK.prototype={parse:o(function(r,e,t){var n=this.domBuilder;n.startDocument(),gK(e,e=Object.create(null)),Jpe(r,e,t,n,this.errorHandler),n.endDocument()},"parse")};var dO=/&#?\w+;?/g;function Jpe(r,e,t,n,s){var i=Gpe(n.mimeType);r.indexOf(bt.UNICODE_REPLACEMENT_CHARACTER)>=0&&s.warning("Unicode replacement character detected, source encoding issues?");function a(ve){if(ve>65535){ve-=65536;var me=55296+(ve>>10),z=56320+(ve&1023);return String.fromCharCode(me,z)}else return String.fromCharCode(ve)}o(a,"fixedFromCharCode");function u(ve){var me=ve[ve.length-1]===";"?ve:ve+";";if(!i&&me!==ve)return s.error("EntityRef: expecting ;"),ve;var z=bt.Reference.exec(me);if(!z||z[0].length!==me.length)return s.error("entity not matching Reference production: "+ve),ve;var ee=me.slice(1,-1);return Dx(t,ee)?t[ee]:ee.charAt(0)==="#"?a(parseInt(ee.substring(1).replace("x","0x"))):(s.error("entity not found:"+ve),ve)}o(u,"entityReplacer");function c(ve){if(ve>y){var me=r.substring(y,ve).replace(dO,u);d&&g(y),n.characters(me,0,ve-y),y=ve}}o(c,"appendText");var l=0,f=0,h=/\r\n?|\n|$/g,d=n.locator;function g(ve,me){for(;ve>=f&&(me=h.exec(r));)l=f,f=me.index+me[0].length,d.lineNumber++;d.columnNumber=ve-l+1}o(g,"position");for(var m=[{currentNSMap:e}],v=[],y=0;;){try{var w=r.indexOf("<",y);if(w<0){if(!i&&v.length>0)return s.fatalError("unclosed xml tag(s): "+v.join(", "));if(!r.substring(y).match(/^\s*$/)){var S=n.doc,E=S.createTextNode(r.substring(y));if(S.documentElement)return s.error("Extra content at the end of the document");S.appendChild(E),n.currentElement=E}return}if(w>y){var x=r.substring(y,w);!i&&v.length===0&&(x=x.replace(new RegExp(bt.S_OPT.source,"g"),""),x&&s.error("Unexpected content outside root element: '"+x+"'")),c(w)}switch(r.charAt(w+1)){case"/":var Z=r.indexOf(">",w+2),b=r.substring(w+2,Z>0?Z:void 0);if(!b)return s.fatalError("end tag name missing");var A=Z>0&&bt.reg("^",bt.QName_group,bt.S_OPT,"$").exec(b);if(!A)return s.fatalError('end tag name contains invalid characters: "'+b+'"');if(!n.currentElement&&!n.doc.documentElement)return;var k=v[v.length-1]||n.currentElement.tagName||n.doc.documentElement.tagName||"";if(k!==A[1]){var I=A[1].toLowerCase();if(!i||k.toLowerCase()!==I)return s.fatalError('Opening and ending tag mismatch: "'+k+'" != "'+b+'"')}var T=m.pop();v.pop();var V=T.localNSMap;if(n.endElement(T.uri,T.localName,k),V)for(var U in V)Dx(V,U)&&n.endPrefixMapping(U);Z++;break;case"?":d&&g(w),Z=ede(r,w,n,s);break;case"!":d&&g(w),Z=vK(r,w,n,s,i);break;default:d&&g(w);var M=new xK,ie=m[m.length-1].currentNSMap,Z=Ype(r,w,M,ie,u,s,i),ue=M.length;if(M.closed||(i&&h0.isHTMLVoidElement(M.tagName)?M.closed=!0:v.push(M.tagName)),d&&ue){for(var $=hK(d,{}),de=0;de<ue;de++){var xe=M[de];g(xe.offset),xe.locator=hK(d,{})}n.locator=$,pK(M,n,ie)&&m.push(M),n.locator=d}else pK(M,n,ie)&&m.push(M);i&&!M.closed?Z=Qpe(r,Z,M.tagName,u,n):Z++}}catch(ve){if(ve instanceof fK)throw ve;if(ve instanceof Wpe)throw new fK(ve.name+": "+ve.message,n.locator,ve);s.error("element parse error: "+ve),Z=-1}Z>y?y=Z:c(Math.max(w,y)+1)}}o(Jpe,"parse");function hK(r,e){return e.lineNumber=r.lineNumber,e.columnNumber=r.columnNumber,e}o(hK,"copyLocator");function Ype(r,e,t,n,s,i,a){function u(g,m,v){if(Dx(t.attributeNames,g))return i.fatalError("Attribute "+g+" redefined");if(!a&&m.indexOf("<")>=0)return i.fatalError("Unescaped '<' not allowed in attributes values");t.addValue(g,m.replace(/[\t\n\r]/g," ").replace(dO,s),v)}o(u,"addAttribute");for(var c,l,f=++e,h=Nx;;){var d=r.charAt(f);switch(d){case"=":if(h===jc)c=r.slice(e,f),h=Tx;else if(h===c0)h=Tx;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(h===Tx||h===jc)if(h===jc&&(i.warning('attribute value must after "="'),c=r.slice(e,f)),e=f+1,f=r.indexOf(d,e),f>0)l=r.slice(e,f),u(c,l,e-1),h=f0;else throw new Error("attribute value no end '"+d+"' match");else if(h==l0)l=r.slice(e,f),u(c,l,e),i.warning('attribute "'+c+'" missed start quot('+d+")!!"),e=f+1,h=f0;else throw new Error('attribute value must after "="');break;case"/":switch(h){case Nx:t.setTagName(r.slice(e,f));case f0:case Ix:case eC:h=eC,t.closed=!0;case l0:case jc:break;case c0:t.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return i.error("unexpected end of input"),h==Nx&&t.setTagName(r.slice(e,f)),f;case">":switch(h){case Nx:t.setTagName(r.slice(e,f));case f0:case Ix:case eC:break;case l0:case jc:l=r.slice(e,f),l.slice(-1)==="/"&&(t.closed=!0,l=l.slice(0,-1));case c0:h===c0&&(l=c),h==l0?(i.warning('attribute "'+l+'" missed quot(")!'),u(c,l,e)):(a||i.warning('attribute "'+l+'" missed value!! "'+l+'" instead!!'),u(l,l,e));break;case Tx:if(!a)return i.fatalError(`AttValue: ' or " expected`)}return f;case"\x80":d=" ";default:if(d<=" ")switch(h){case Nx:t.setTagName(r.slice(e,f)),h=Ix;break;case jc:c=r.slice(e,f),h=c0;break;case l0:var l=r.slice(e,f);i.warning('attribute "'+l+'" missed quot(")!!'),u(c,l,e);case f0:h=Ix;break}else switch(h){case c0:a||i.warning('attribute "'+c+'" missed value!! "'+c+'" instead2!!'),u(c,c,e),e=f,h=jc;break;case f0:i.warning('attribute space is required"'+c+'"!!');case Ix:h=jc,e=f;break;case Tx:h=l0,e=f;break;case eC:throw new Error("elements closed character '/' and '>' must be connected to")}}f++}}o(Ype,"parseElementStartPart");function pK(r,e,t){for(var n=r.tagName,s=null,h=r.length;h--;){var i=r[h],a=i.qName,u=i.value,d=a.indexOf(":");if(d>0)var c=i.prefix=a.slice(0,d),l=a.slice(d+1),f=c==="xmlns"&&l;else l=a,c=null,f=a==="xmlns"&&"";i.localName=l,f!==!1&&(s==null&&(s=Object.create(null),gK(t,t=Object.create(null))),t[f]=s[f]=u,i.uri=lK.XMLNS,e.startPrefixMapping(f,u))}for(var h=r.length;h--;)i=r[h],i.prefix&&(i.prefix==="xml"&&(i.uri=lK.XML),i.prefix!=="xmlns"&&(i.uri=t[i.prefix]));var d=n.indexOf(":");d>0?(c=r.prefix=n.slice(0,d),l=r.localName=n.slice(d+1)):(c=null,l=r.localName=n);var g=r.uri=t[c||""];if(e.startElement(g,l,n,r),r.closed){if(e.endElement(g,l,n),s)for(c in s)Dx(s,c)&&e.endPrefixMapping(c)}else return r.currentNSMap=t,r.localNSMap=s,!0}o(pK,"appendElement");function Qpe(r,e,t,n,s){var i=Xpe(t);if(i||zpe(t)){var a=r.indexOf("</"+t+">",e),u=r.substring(e+1,a);return i&&(u=u.replace(dO,n)),s.characters(u,0,u.length),a}return e+1}o(Qpe,"parseHtmlSpecialContent");function gK(r,e){for(var t in r)Dx(r,t)&&(e[t]=r[t])}o(gK,"_copy");function yK(r,e){var t=e;function n(f){return f=f||0,r.charAt(t+f)}o(n,"char");function s(f){f=f||1,t+=f}o(s,"skip");function i(){for(var f=0;t<r.length;){var h=n();if(h!==" "&&h!==`
|
|
84
84
|
`&&h!==" "&&h!=="\r")return f;f++,s()}return-1}o(i,"skipBlanks");function a(){return r.substring(t)}o(a,"substringFromIndex");function u(f){return r.substring(t,t+f.length)===f}o(u,"substringStartsWith");function c(f){return r.substring(t,t+f.length).toUpperCase()===f.toUpperCase()}o(c,"substringStartsWithCaseInsensitive");function l(f){var h=bt.reg("^",f),d=h.exec(a());return d?(s(d[0].length),d[0]):null}return o(l,"getMatch"),{char:n,getIndex:o(function(){return t},"getIndex"),getMatch:l,getSource:o(function(){return r},"getSource"),skip:s,skipBlanks:i,substringFromIndex:a,substringStartsWith:u,substringStartsWithCaseInsensitive:c}}o(yK,"parseUtils");function Zpe(r,e){function t(u,c){var l=bt.PI.exec(u.substringFromIndex());return l?l[1].toLowerCase()==="xml"?c.fatalError("xml declaration is only allowed at the start of the document, but found at position "+u.getIndex()):(u.skip(l[0].length),l[0]):c.fatalError("processing instruction is not well-formed at position "+u.getIndex())}o(t,"parsePI");var n=r.getSource();if(r.char()==="["){r.skip(1);for(var s=r.getIndex();r.getIndex()<n.length;){if(r.skipBlanks(),r.char()==="]"){var i=n.substring(s,r.getIndex());return r.skip(1),i}var a=null;if(r.char()==="<"&&r.char(1)==="!")switch(r.char(2)){case"E":r.char(3)==="L"?a=r.getMatch(bt.elementdecl):r.char(3)==="N"&&(a=r.getMatch(bt.EntityDecl));break;case"A":a=r.getMatch(bt.AttlistDecl);break;case"N":a=r.getMatch(bt.NotationDecl);break;case"-":a=r.getMatch(bt.Comment);break}else if(r.char()==="<"&&r.char(1)==="?")a=t(r,e);else if(r.char()==="%")a=r.getMatch(bt.PEReference);else return e.fatalError("Error detected in Markup declaration");if(!a)return e.fatalError("Error in internal subset at position "+r.getIndex())}return e.fatalError("doctype internal subset is not well-formed, missing ]")}}o(Zpe,"parseDoctypeInternalSubset");function vK(r,e,t,n,s){var i=yK(r,e);switch(s?i.char(2).toUpperCase():i.char(2)){case"-":var a=i.getMatch(bt.Comment);return a?(t.comment(a,bt.COMMENT_START.length,a.length-bt.COMMENT_START.length-bt.COMMENT_END.length),i.getIndex()):n.fatalError("comment is not well-formed at position "+i.getIndex());case"[":var u=i.getMatch(bt.CDSect);return u?!s&&!t.currentElement?n.fatalError("CDATA outside of element"):(t.startCDATA(),t.characters(u,bt.CDATA_START.length,u.length-bt.CDATA_START.length-bt.CDATA_END.length),t.endCDATA(),i.getIndex()):n.fatalError("Invalid CDATA starting at position "+e);case"D":{if(t.doc&&t.doc.documentElement)return n.fatalError("Doctype not allowed inside or after documentElement at position "+i.getIndex());if(s?!i.substringStartsWithCaseInsensitive(bt.DOCTYPE_DECL_START):!i.substringStartsWith(bt.DOCTYPE_DECL_START))return n.fatalError("Expected "+bt.DOCTYPE_DECL_START+" at position "+i.getIndex());if(i.skip(bt.DOCTYPE_DECL_START.length),i.skipBlanks()<1)return n.fatalError("Expected whitespace after "+bt.DOCTYPE_DECL_START+" at position "+i.getIndex());var c={name:void 0,publicId:void 0,systemId:void 0,internalSubset:void 0};if(c.name=i.getMatch(bt.Name),!c.name)return n.fatalError("doctype name missing or contains unexpected characters at position "+i.getIndex());if(s&&c.name.toLowerCase()!=="html"&&n.warning("Unexpected DOCTYPE in HTML document at position "+i.getIndex()),i.skipBlanks(),i.substringStartsWith(bt.PUBLIC)||i.substringStartsWith(bt.SYSTEM)){var l=bt.ExternalID_match.exec(i.substringFromIndex());if(!l)return n.fatalError("doctype external id is not well-formed at position "+i.getIndex());l.groups.SystemLiteralOnly!==void 0?c.systemId=l.groups.SystemLiteralOnly:(c.systemId=l.groups.SystemLiteral,c.publicId=l.groups.PubidLiteral),i.skip(l[0].length)}else if(s&&i.substringStartsWithCaseInsensitive(bt.SYSTEM)){if(i.skip(bt.SYSTEM.length),i.skipBlanks()<1)return n.fatalError("Expected whitespace after "+bt.SYSTEM+" at position "+i.getIndex());if(c.systemId=i.getMatch(bt.ABOUT_LEGACY_COMPAT_SystemLiteral),!c.systemId)return n.fatalError("Expected "+bt.ABOUT_LEGACY_COMPAT+" in single or double quotes after "+bt.SYSTEM+" at position "+i.getIndex())}return s&&c.systemId&&!bt.ABOUT_LEGACY_COMPAT_SystemLiteral.test(c.systemId)&&n.warning("Unexpected doctype.systemId in HTML document at position "+i.getIndex()),s||(i.skipBlanks(),c.internalSubset=Zpe(i,n)),i.skipBlanks(),i.char()!==">"?n.fatalError("doctype not terminated with > at position "+i.getIndex()):(i.skip(1),t.startDTD(c.name,c.publicId,c.systemId,c.internalSubset),t.endDTD(),i.getIndex())}default:return n.fatalError('Not well-formed XML starting with "<!" at position '+e)}}o(vK,"parseDoctypeCommentOrCData");function ede(r,e,t,n){var s=r.substring(e).match(bt.PI);if(!s)return n.fatalError("Invalid processing instruction starting at position "+e);if(s[1].toLowerCase()==="xml"){if(e>0)return n.fatalError("processing instruction at position "+e+" is an xml declaration which is only at the start of the document");if(!bt.XMLDecl.test(r.substring(e)))return n.fatalError("xml declaration is not well-formed")}return t.processingInstruction(s[1],s[2]),e+s[0].length}o(ede,"parseProcessingInstruction");function xK(){this.attributeNames=Object.create(null)}o(xK,"ElementAttributes");xK.prototype={setTagName:o(function(r){if(!bt.QName_exact.test(r))throw new Error("invalid tagName:"+r);this.tagName=r},"setTagName"),addValue:o(function(r,e,t){if(!bt.QName_exact.test(r))throw new Error("invalid attribute:"+r);this.attributeNames[r]=this.length,this[this.length++]={qName:r,value:e,offset:t}},"addValue"),length:0,getLocalName:o(function(r){return this[r].localName},"getLocalName"),getLocator:o(function(r){return this[r].locator},"getLocator"),getQName:o(function(r){return this[r].qName},"getQName"),getURI:o(function(r){return this[r].uri},"getURI"),getValue:o(function(r){return this[r].value},"getValue")};tC.XMLReader=mK;tC.parseUtils=yK;tC.parseDoctypeCommentOrCData=vK});var TK=X(d0=>{"use strict";var hh=lh(),tde=pO(),rde=yx(),wK=cK(),nde=EK(),sde=tde.DOMImplementation,ide=hh.hasDefaultHTMLNamespace,ade=hh.isHTMLMimeType,ode=hh.isValidMimeType,AK=hh.MIME_TYPE,mO=hh.NAMESPACE,bK=rde.ParseError,ude=nde.XMLReader;function CK(r){return r.replace(/\r[\n\u0085]/g,`
|
|
85
85
|
`).replace(/[\r\u0085\u2028\u2029]/g,`
|
|
86
86
|
`)}o(CK,"normalizeLineEndings");function NK(r){if(r=r||{},r.locator===void 0&&(r.locator=!0),this.assign=r.assign||hh.assign,this.domHandler=r.domHandler||nC,this.onError=r.onError||r.errorHandler,r.errorHandler&&typeof r.errorHandler!="function")throw new TypeError("errorHandler object is no longer supported, switch to onError!");r.errorHandler&&r.errorHandler("warning","The `errorHandler` option has been deprecated, use `onError` instead!",this),this.normalizeLineEndings=r.normalizeLineEndings||CK,this.locator=!!r.locator,this.xmlns=this.assign(Object.create(null),r.xmlns)}o(NK,"DOMParser");NK.prototype.parseFromString=function(r,e){if(!ode(e))throw new TypeError('DOMParser.parseFromString: the provided mimeType "'+e+'" is not valid.');var t=this.assign(Object.create(null),this.xmlns),n=wK.XML_ENTITIES,s=t[""]||null;ide(e)?(n=wK.HTML_ENTITIES,s=mO.HTML):e===AK.XML_SVG_IMAGE&&(s=mO.SVG),t[""]=s,t.xml=t.xml||mO.XML;var i=new this.domHandler({mimeType:e,defaultNamespace:s,onError:this.onError}),a=this.locator?{}:void 0;this.locator&&i.setDocumentLocator(a);var u=new ude;u.errorHandler=i,u.domBuilder=i;var c=!hh.isHTMLMimeType(e);return c&&typeof r!="string"&&u.errorHandler.fatalError("source is not a string"),u.parse(this.normalizeLineEndings(String(r)),t,n),i.doc.documentElement||u.errorHandler.fatalError("missing root element"),i.doc};function nC(r){var e=r||{};this.mimeType=e.mimeType||AK.XML_APPLICATION,this.defaultNamespace=e.defaultNamespace||null,this.cdata=!1,this.currentElement=void 0,this.doc=void 0,this.locator=void 0,this.onError=e.onError}o(nC,"DOMHandler");function p0(r,e){e.lineNumber=r.lineNumber,e.columnNumber=r.columnNumber}o(p0,"position");nC.prototype={startDocument:o(function(){var r=new sde;this.doc=ade(this.mimeType)?r.createHTMLDocument(!1):r.createDocument(this.defaultNamespace,"")},"startDocument"),startElement:o(function(r,e,t,n){var s=this.doc,i=s.createElementNS(r,t||e),a=n.length;rC(this,i),this.currentElement=i,this.locator&&p0(this.locator,i);for(var u=0;u<a;u++){var r=n.getURI(u),c=n.getValue(u),t=n.getQName(u),l=s.createAttributeNS(r,t);this.locator&&p0(n.getLocator(u),l),l.value=l.nodeValue=c,i.setAttributeNode(l)}},"startElement"),endElement:o(function(r,e,t){this.currentElement=this.currentElement.parentNode},"endElement"),startPrefixMapping:o(function(r,e){},"startPrefixMapping"),endPrefixMapping:o(function(r){},"endPrefixMapping"),processingInstruction:o(function(r,e){var t=this.doc.createProcessingInstruction(r,e);this.locator&&p0(this.locator,t),rC(this,t)},"processingInstruction"),ignorableWhitespace:o(function(r,e,t){},"ignorableWhitespace"),characters:o(function(r,e,t){if(r=SK.apply(this,arguments),r){if(this.cdata)var n=this.doc.createCDATASection(r);else var n=this.doc.createTextNode(r);this.currentElement?this.currentElement.appendChild(n):/^\s*$/.test(r)&&this.doc.appendChild(n),this.locator&&p0(this.locator,n)}},"characters"),skippedEntity:o(function(r){},"skippedEntity"),endDocument:o(function(){this.doc.normalize()},"endDocument"),setDocumentLocator:o(function(r){r&&(r.lineNumber=0),this.locator=r},"setDocumentLocator"),comment:o(function(r,e,t){r=SK.apply(this,arguments);var n=this.doc.createComment(r);this.locator&&p0(this.locator,n),rC(this,n)},"comment"),startCDATA:o(function(){this.cdata=!0},"startCDATA"),endCDATA:o(function(){this.cdata=!1},"endCDATA"),startDTD:o(function(r,e,t,n){var s=this.doc.implementation;if(s&&s.createDocumentType){var i=s.createDocumentType(r,e,t,n);this.locator&&p0(this.locator,i),rC(this,i),this.doc.doctype=i}},"startDTD"),reportError:o(function(r,e){if(typeof this.onError=="function")try{this.onError(r,e,this)}catch(t){throw new bK("Reporting "+r+' "'+e+'" caused '+t,this.locator)}else console.error("[xmldom "+r+"] "+e,cde(this.locator))},"reportError"),warning:o(function(r){this.reportError("warning",r)},"warning"),error:o(function(r){this.reportError("error",r)},"error"),fatalError:o(function(r){throw this.reportError("fatalError",r),new bK(r,this.locator)},"fatalError")};function cde(r){if(r)return`
|
|
87
|
-
@#[line:`+r.lineNumber+",col:"+r.columnNumber+"]"}o(cde,"_locator");function SK(r,e,t){return typeof r=="string"?r.substr(e,t):r.length>=e+t||e?new java.lang.String(r,e,t)+"":r}o(SK,"_toString");"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(r){nC.prototype[r]=function(){return null}});function rC(r,e){r.currentElement?r.currentElement.appendChild(e):r.doc.appendChild(e)}o(rC,"appendElement");function lde(r){if(r==="error")throw"onErrorStopParsing"}o(lde,"onErrorStopParsing");function fde(){throw"onWarningStopParsing"}o(fde,"onWarningStopParsing");d0.__DOMHandler=nC;d0.DOMParser=NK;d0.normalizeLineEndings=CK;d0.onErrorStopParsing=lde;d0.onWarningStopParsing=fde});var IK=X(Gt=>{"use strict";var m0=lh();Gt.assign=m0.assign;Gt.hasDefaultHTMLNamespace=m0.hasDefaultHTMLNamespace;Gt.isHTMLMimeType=m0.isHTMLMimeType;Gt.isValidMimeType=m0.isValidMimeType;Gt.MIME_TYPE=m0.MIME_TYPE;Gt.NAMESPACE=m0.NAMESPACE;var sC=yx();Gt.DOMException=sC.DOMException;Gt.DOMExceptionName=sC.DOMExceptionName;Gt.ExceptionCode=sC.ExceptionCode;Gt.ParseError=sC.ParseError;var hn=pO();Gt.Attr=hn.Attr;Gt.CDATASection=hn.CDATASection;Gt.CharacterData=hn.CharacterData;Gt.Comment=hn.Comment;Gt.Document=hn.Document;Gt.DocumentFragment=hn.DocumentFragment;Gt.DocumentType=hn.DocumentType;Gt.DOMImplementation=hn.DOMImplementation;Gt.Element=hn.Element;Gt.Entity=hn.Entity;Gt.EntityReference=hn.EntityReference;Gt.LiveNodeList=hn.LiveNodeList;Gt.NamedNodeMap=hn.NamedNodeMap;Gt.Node=hn.Node;Gt.NodeList=hn.NodeList;Gt.Notation=hn.Notation;Gt.ProcessingInstruction=hn.ProcessingInstruction;Gt.Text=hn.Text;Gt.XMLSerializer=hn.XMLSerializer;var iC=TK();Gt.DOMParser=iC.DOMParser;Gt.normalizeLineEndings=iC.normalizeLineEndings;Gt.onErrorStopParsing=iC.onErrorStopParsing;Gt.onWarningStopParsing=iC.onWarningStopParsing});var gde={};Bx(gde,{ASN1:()=>Ka,CanonicalizationMethod:()=>oC,Choice:()=>pde,Decimal:()=>Kc,DigestAlgorithm:()=>Ox,EntitySigner:()=>cC,Environment:()=>JK,IsDecimal:()=>yO,Left:()=>kx,MemoryCacheAdapter:()=>EC,NFeTsError:()=>Mt,NativeCertificateRepository:()=>IN,NullCacheAdapter:()=>M0,PdfkitPdfBuilder:()=>xC,Right:()=>w0,SignatureAlgorithm:()=>Ua,SignatureMethod:()=>_x,SignatureNamespace:()=>Rx,Signer:()=>Hc,SkipAllValidations:()=>QK,SkipValidation:()=>YK,SkipValidationMetadata:()=>yh,SoapRemoteTransmissionRepository:()=>oB,StateAcronyms:()=>WK,StateCodeAcValidator:()=>xO,StateCodeAlValidator:()=>EO,StateCodeAmValidator:()=>wO,StateCodeApValidator:()=>bO,StateCodeBaValidator:()=>SO,StateCodeCeValidator:()=>AO,StateCodeDfValidator:()=>CO,StateCodeEsValidator:()=>NO,StateCodeGoValidator:()=>TO,StateCodeMaValidator:()=>IO,StateCodeMgValidator:()=>DO,StateCodeMsValidator:()=>BO,StateCodeMtValidator:()=>RO,StateCodePaValidator:()=>_O,StateCodePbValidator:()=>OO,StateCodePeValidator:()=>PO,StateCodePiValidator:()=>kO,StateCodePrValidator:()=>LO,StateCodeRjValidator:()=>FO,StateCodeRnValidator:()=>UO,StateCodeRoValidator:()=>VO,StateCodeRrValidator:()=>MO,StateCodeRsValidator:()=>jO,StateCodeScValidator:()=>qO,StateCodeSeValidator:()=>HO,StateCodeSpValidator:()=>KO,StateCodeToValidator:()=>$O,StateCodes:()=>rr,TransformDateString:()=>mde,TransformDecimal:()=>dde,TransmissionError:()=>x0,TransmissionHostNotFoundError:()=>gh,TransmissionTimeoutError:()=>qc,ValidateErrorsMetadata:()=>hC,Validates:()=>ZK,ValidationError:()=>uC,Xml2JsToolkit:()=>gO,XmlSigner:()=>lC,clearEmptyValues:()=>b0,dateToolkit:()=>tl,fixUtf8Mojibake:()=>ij,left:()=>or,leftFromError:()=>us,leftFromTransmissionError:()=>sB,mapConstraintsToErrors:()=>pC,mapTransmissionError:()=>sj,normalizeTransmissionStrings:()=>aB,plainToInstance:()=>fC,right:()=>Qr,search:()=>S2,timezones:()=>JO,unreachable:()=>Px});module.exports=zK(gde);var Rx="http://www.w3.org/2000/09/xmldsig#",oC="http://www.w3.org/TR/2001/REC-xml-c14n-20010315",_x=(function(r){return r.RSA_SHA1="http://www.w3.org/2000/09/xmldsig#rsa-sha1",r.RSA_SHA256="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256",r})({}),Ua=(function(r){return r.SHA1="sha1",r.SHA256="sha256",r})({}),Ox=(function(r){return r.SHA1="http://www.w3.org/2000/09/xmldsig#sha1",r.SHA256="http://www.w3.org/2001/04/xmlenc#sha256",r})({});var rr={AC:"12",AL:"27",AM:"13",AP:"16",BA:"29",CE:"23",DF:"53",ES:"32",GO:"52",MA:"21",MG:"31",MS:"50",MT:"51",PA:"15",PB:"25",PE:"26",PI:"22",PR:"41",RJ:"33",RN:"24",RO:"11",RR:"14",RS:"43",SC:"42",SE:"28",SP:"35",TO:"17"},WK=Object.keys(rr);var JK={Production:"1",Homolog:"2"};var JO={[rr.AC]:"America/Rio_Branco",[rr.AL]:"America/Maceio",[rr.AM]:"America/Manaus",[rr.AP]:"America/Belem",[rr.BA]:"America/Bahia",[rr.CE]:"America/Fortaleza",[rr.DF]:"America/Sao_Paulo",[rr.ES]:"America/Sao_Paulo",[rr.GO]:"America/Sao_Paulo",[rr.MA]:"America/Fortaleza",[rr.MG]:"America/Sao_Paulo",[rr.MS]:"America/Campo_Grande",[rr.MT]:"America/Cuiaba",[rr.PA]:"America/Belem",[rr.PB]:"America/Fortaleza",[rr.PE]:"America/Recife",[rr.PI]:"America/Fortaleza",[rr.PR]:"America/Sao_Paulo",[rr.RJ]:"America/Sao_Paulo",[rr.RN]:"America/Fortaleza",[rr.RO]:"America/Porto_Velho",[rr.RR]:"America/Boa_Vista",[rr.RS]:"America/Sao_Paulo",[rr.SC]:"America/Sao_Paulo",[rr.SE]:"America/Maceio",[rr.SP]:"America/Sao_Paulo",[rr.TO]:"America/Araguaina"};var Mt=class extends Error{static{o(this,"NFeTsError")}};var x0=class extends Mt{static{o(this,"TransmissionError")}},gh=class extends x0{static{o(this,"TransmissionHostNotFoundError")}},qc=class extends x0{static{o(this,"TransmissionTimeoutError")}};var uC=class extends Mt{static{o(this,"ValidationError")}};var E0={includeComments:!1,exclusive:!0};var Px=o(r=>{throw new Mt("Didn't expect to get here")},"unreachable");var Hc=class{static{o(this,"Signer")}toolkit;certificateRepository;algorithm;canonical;constructor(e,t,n=Ua.SHA1,s=E0){this.toolkit=e,this.certificateRepository=t,this.algorithm=n,this.canonical=s}assemble(e,t,n){let s=this.certificateRepository.getStringCertificate(n);return{$:{xmlns:Rx},SignedInfo:e,SignatureValue:t,KeyInfo:{X509Data:{X509Certificate:s}}}}signedInfo(e,t){return{CanonicalizationMethod:{$:{Algorithm:oC}},SignatureMethod:{$:{Algorithm:this.signatureMethod}},Reference:{$:{URI:`#${this.toolkit.getAttribute(e,t)}`},Transforms:this.transforms,DigestMethod:{$:{Algorithm:this.digestAlgorithm}},DigestValue:this.digest(e)}}}digest(e){return this.toolkit.digest(e,this.algorithm,this.canonical)}async signOrLeft(e,t){let n=this.toolkit.canonicalize(await this.toolkit.build({$:{xmlns:Rx},...e},{rootName:"SignedInfo"}),this.canonical);return this.certificateRepository.sign(n,t,this.algorithm)}get transforms(){return{Transform:[{$:{Algorithm:"http://www.w3.org/2000/09/xmldsig#enveloped-signature"}},{$:{Algorithm:"http://www.w3.org/TR/2001/REC-xml-c14n-20010315"}}]}}get digestAlgorithm(){switch(this.algorithm){case Ua.SHA256:return Ox.SHA256;case Ua.SHA1:return Ox.SHA1;default:return Px(this.algorithm)}}get signatureMethod(){switch(this.algorithm){case Ua.SHA256:return _x.RSA_SHA256;case Ua.SHA1:return _x.RSA_SHA1;default:return Px(this.algorithm)}}};var kx=class{static{o(this,"Left")}value;constructor(e){this.value=e}isLeft(){return!0}isRight(){return!1}},w0=class{static{o(this,"Right")}value;constructor(e){this.value=e}isLeft(){return!1}isRight(){return!0}},or=o(r=>new kx(r),"left"),Qr=o(r=>r===void 0?new w0(void 0):new w0(r),"right");var cC=class extends Hc{static{o(this,"EntitySigner")}async sign(e,t,n){let{tag:s,mark:i}=t,{certificate:a}=n;if(!e[s])return or(new Mt(`Node ${String(s)} not found`));let u=await this.toolkit.build(this.ns(e,s),{headless:!0,rootName:String(s),renderOpts:{pretty:!1}}),c=this.signedInfo(u,i),l=await this.signOrLeft(c,n);if(l.isLeft())return l;let f=e;return f.Signature=this.assemble(c,l.value,a),Qr(f)}ns(e,t){let n=e.$?.xmlns,{$:s,...i}=e[t],{xmlns:a,...u}=s??{};return{$:{xmlns:n,...u},...i}}};var lC=class extends Hc{static{o(this,"XmlSigner")}async sign(e,t,n){let{tag:s,mark:i}=t,{certificate:a}=n,u=this.toolkit.getNode(e,s);if(!u)return or(new Mt(`Node ${s} not found`));let c=this.signedInfo(u,i),l=await this.signOrLeft(c,n);if(l.isLeft())return l;let f=await this.toolkit.build(this.assemble(c,l.value,a),{rootName:"Signature"});return Qr(this.toolkit.appendNode(e,f))}};var xme=require("reflect-metadata"),QO=require("class-validator");var dme=require("reflect-metadata");var yh="__SkipValidation__",YK=o(()=>(r,e)=>{Reflect.defineMetadata(yh,!0,r,e.toString())},"SkipValidation"),QK=o(()=>r=>{Reflect.defineMetadata(yh,!0,r)},"SkipAllValidations");var YO=require("class-transformer");var b0=o(r=>{for(let[e,t]of Object.entries(r))typeof t>"u"&&delete r[e],t===""&&delete r[e],t&&typeof t=="object"&&b0(t)},"clearEmptyValues"),fC=o((r,e,t={})=>{let n=(0,YO.plainToInstance)(e,r);return t.clearEmptyValues&&b0(n),n},"plainToInstance");var hC="__ValidateErrors__",pC=o((r,e)=>r.reduce((t,n)=>{if(n.children?.length)return t.concat(pC(n.children,e?`${e}.${n.property}`:n.property));let s=Object.values(n.constraints??{}).map(i=>e?`${e}.${i}`:i).join(", ");return s?t.concat(s):t},[]),"mapConstraintsToErrors"),ZK=o(r=>(e,t,n)=>{let s=n.value;n.value=function(...i){let a=Reflect.getMetadata(yh,this.constructor);if(Reflect.getMetadata(yh,this.constructor.prototype,t.toString())===!0||a===!0)return s?.apply(this,i);let[c,...l]=i;if(!c)return s?.apply(this,i);let f=fC(c,r),h=(0,QO.validateSync)(f,{whitelist:!0});if(b0(f),h.length){let d=Reflect.getMetadata(hC,this)??[];Reflect.defineMetadata(hC,d.concat(pC(h,s?.name)),this)}return s?.apply(this,[f,...l])}},"Validates");var $ke=require("reflect-metadata");var vh=9e15,$o=1e9,dC="0123456789abcdef",Ux="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Vx="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",mC={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-vh,maxE:vh,crypto:!1},r3,Va,pt=!0,jx="[DecimalError] ",Ko=jx+"Invalid argument: ",n3=jx+"Precision limit exceeded",s3=jx+"crypto unavailable",i3="[object Decimal]",jn=Math.floor,nn=Math.pow,e$=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,t$=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,r$=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,a3=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Si=1e7,at=7,n$=9007199254740991,s$=Ux.length-1,gC=Vx.length-1,Ne={toStringTag:i3};Ne.absoluteValue=Ne.abs=function(){var r=new this.constructor(this);return r.s<0&&(r.s=1),et(r)};Ne.ceil=function(){return et(new this.constructor(this),this.e+1,2)};Ne.clampedTo=Ne.clamp=function(r,e){var t,n=this,s=n.constructor;if(r=new s(r),e=new s(e),!r.s||!e.s)return new s(NaN);if(r.gt(e))throw Error(Ko+e);return t=n.cmp(r),t<0?r:n.cmp(e)>0?e:new s(n)};Ne.comparedTo=Ne.cmp=function(r){var e,t,n,s,i=this,a=i.d,u=(r=new i.constructor(r)).d,c=i.s,l=r.s;if(!a||!u)return!c||!l?NaN:c!==l?c:a===u?0:!a^c<0?1:-1;if(!a[0]||!u[0])return a[0]?c:u[0]?-l:0;if(c!==l)return c;if(i.e!==r.e)return i.e>r.e^c<0?1:-1;for(n=a.length,s=u.length,e=0,t=n<s?n:s;e<t;++e)if(a[e]!==u[e])return a[e]>u[e]^c<0?1:-1;return n===s?0:n>s^c<0?1:-1};Ne.cosine=Ne.cos=function(){var r,e,t=this,n=t.constructor;return t.d?t.d[0]?(r=n.precision,e=n.rounding,n.precision=r+Math.max(t.e,t.sd())+at,n.rounding=1,t=i$(n,f3(n,t)),n.precision=r,n.rounding=e,et(Va==2||Va==3?t.neg():t,r,e,!0)):new n(1):new n(NaN)};Ne.cubeRoot=Ne.cbrt=function(){var r,e,t,n,s,i,a,u,c,l,f=this,h=f.constructor;if(!f.isFinite()||f.isZero())return new h(f);for(pt=!1,i=f.s*nn(f.s*f,1/3),!i||Math.abs(i)==1/0?(t=In(f.d),r=f.e,(i=(r-t.length+1)%3)&&(t+=i==1||i==-2?"0":"00"),i=nn(t,1/3),r=jn((r+1)/3)-(r%3==(r<0?-1:2)),i==1/0?t="5e"+r:(t=i.toExponential(),t=t.slice(0,t.indexOf("e")+1)+r),n=new h(t),n.s=f.s):n=new h(i.toString()),a=(r=h.precision)+3;;)if(u=n,c=u.times(u).times(u),l=c.plus(f),n=mr(l.plus(f).times(u),l.plus(c),a+2,1),In(u.d).slice(0,a)===(t=In(n.d)).slice(0,a))if(t=t.slice(a-3,a+1),t=="9999"||!s&&t=="4999"){if(!s&&(et(u,r+1,0),u.times(u).times(u).eq(f))){n=u;break}a+=4,s=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(et(n,r+1,1),e=!n.times(n).times(n).eq(f));break}return pt=!0,et(n,r,h.rounding,e)};Ne.decimalPlaces=Ne.dp=function(){var r,e=this.d,t=NaN;if(e){if(r=e.length-1,t=(r-jn(this.e/at))*at,r=e[r],r)for(;r%10==0;r/=10)t--;t<0&&(t=0)}return t};Ne.dividedBy=Ne.div=function(r){return mr(this,new this.constructor(r))};Ne.dividedToIntegerBy=Ne.divToInt=function(r){var e=this,t=e.constructor;return et(mr(e,new t(r),0,1,1),t.precision,t.rounding)};Ne.equals=Ne.eq=function(r){return this.cmp(r)===0};Ne.floor=function(){return et(new this.constructor(this),this.e+1,3)};Ne.greaterThan=Ne.gt=function(r){return this.cmp(r)>0};Ne.greaterThanOrEqualTo=Ne.gte=function(r){var e=this.cmp(r);return e==1||e===0};Ne.hyperbolicCosine=Ne.cosh=function(){var r,e,t,n,s,i=this,a=i.constructor,u=new a(1);if(!i.isFinite())return new a(i.s?1/0:NaN);if(i.isZero())return u;t=a.precision,n=a.rounding,a.precision=t+Math.max(i.e,i.sd())+4,a.rounding=1,s=i.d.length,s<32?(r=Math.ceil(s/3),e=(1/Hx(4,r)).toString()):(r=16,e="2.3283064365386962890625e-10"),i=xh(a,1,i.times(e),new a(1),!0);for(var c,l=r,f=new a(8);l--;)c=i.times(i),i=u.minus(c.times(f.minus(c.times(f))));return et(i,a.precision=t,a.rounding=n,!0)};Ne.hyperbolicSine=Ne.sinh=function(){var r,e,t,n,s=this,i=s.constructor;if(!s.isFinite()||s.isZero())return new i(s);if(e=i.precision,t=i.rounding,i.precision=e+Math.max(s.e,s.sd())+4,i.rounding=1,n=s.d.length,n<3)s=xh(i,2,s,s,!0);else{r=1.4*Math.sqrt(n),r=r>16?16:r|0,s=s.times(1/Hx(5,r)),s=xh(i,2,s,s,!0);for(var a,u=new i(5),c=new i(16),l=new i(20);r--;)a=s.times(s),s=s.times(u.plus(a.times(c.times(a).plus(l))))}return i.precision=e,i.rounding=t,et(s,e,t,!0)};Ne.hyperbolicTangent=Ne.tanh=function(){var r,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+7,n.rounding=1,mr(t.sinh(),t.cosh(),n.precision=r,n.rounding=e)):new n(t.s)};Ne.inverseCosine=Ne.acos=function(){var r=this,e=r.constructor,t=r.abs().cmp(1),n=e.precision,s=e.rounding;return t!==-1?t===0?r.isNeg()?Gi(e,n,s):new e(0):new e(NaN):r.isZero()?Gi(e,n+4,s).times(.5):(e.precision=n+6,e.rounding=1,r=new e(1).minus(r).div(r.plus(1)).sqrt().atan(),e.precision=n,e.rounding=s,r.times(2))};Ne.inverseHyperbolicCosine=Ne.acosh=function(){var r,e,t=this,n=t.constructor;return t.lte(1)?new n(t.eq(1)?0:NaN):t.isFinite()?(r=n.precision,e=n.rounding,n.precision=r+Math.max(Math.abs(t.e),t.sd())+4,n.rounding=1,pt=!1,t=t.times(t).minus(1).sqrt().plus(t),pt=!0,n.precision=r,n.rounding=e,t.ln()):new n(t)};Ne.inverseHyperbolicSine=Ne.asinh=function(){var r,e,t=this,n=t.constructor;return!t.isFinite()||t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+2*Math.max(Math.abs(t.e),t.sd())+6,n.rounding=1,pt=!1,t=t.times(t).plus(1).sqrt().plus(t),pt=!0,n.precision=r,n.rounding=e,t.ln())};Ne.inverseHyperbolicTangent=Ne.atanh=function(){var r,e,t,n,s=this,i=s.constructor;return s.isFinite()?s.e>=0?new i(s.abs().eq(1)?s.s/0:s.isZero()?s:NaN):(r=i.precision,e=i.rounding,n=s.sd(),Math.max(n,r)<2*-s.e-1?et(new i(s),r,e,!0):(i.precision=t=n-s.e,s=mr(s.plus(1),new i(1).minus(s),t+r,1),i.precision=r+4,i.rounding=1,s=s.ln(),i.precision=r,i.rounding=e,s.times(.5))):new i(NaN)};Ne.inverseSine=Ne.asin=function(){var r,e,t,n,s=this,i=s.constructor;return s.isZero()?new i(s):(e=s.abs().cmp(1),t=i.precision,n=i.rounding,e!==-1?e===0?(r=Gi(i,t+4,n).times(.5),r.s=s.s,r):new i(NaN):(i.precision=t+6,i.rounding=1,s=s.div(new i(1).minus(s.times(s)).sqrt().plus(1)).atan(),i.precision=t,i.rounding=n,s.times(2)))};Ne.inverseTangent=Ne.atan=function(){var r,e,t,n,s,i,a,u,c,l=this,f=l.constructor,h=f.precision,d=f.rounding;if(l.isFinite()){if(l.isZero())return new f(l);if(l.abs().eq(1)&&h+4<=gC)return a=Gi(f,h+4,d).times(.25),a.s=l.s,a}else{if(!l.s)return new f(NaN);if(h+4<=gC)return a=Gi(f,h+4,d).times(.5),a.s=l.s,a}for(f.precision=u=h+10,f.rounding=1,t=Math.min(28,u/at+2|0),r=t;r;--r)l=l.div(l.times(l).plus(1).sqrt().plus(1));for(pt=!1,e=Math.ceil(u/at),n=1,c=l.times(l),a=new f(l),s=l;r!==-1;)if(s=s.times(c),i=a.minus(s.div(n+=2)),s=s.times(c),a=i.plus(s.div(n+=2)),a.d[e]!==void 0)for(r=e;a.d[r]===i.d[r]&&r--;);return t&&(a=a.times(2<<t-1)),pt=!0,et(a,f.precision=h,f.rounding=d,!0)};Ne.isFinite=function(){return!!this.d};Ne.isInteger=Ne.isInt=function(){return!!this.d&&jn(this.e/at)>this.d.length-2};Ne.isNaN=function(){return!this.s};Ne.isNegative=Ne.isNeg=function(){return this.s<0};Ne.isPositive=Ne.isPos=function(){return this.s>0};Ne.isZero=function(){return!!this.d&&this.d[0]===0};Ne.lessThan=Ne.lt=function(r){return this.cmp(r)<0};Ne.lessThanOrEqualTo=Ne.lte=function(r){return this.cmp(r)<1};Ne.logarithm=Ne.log=function(r){var e,t,n,s,i,a,u,c,l=this,f=l.constructor,h=f.precision,d=f.rounding,g=5;if(r==null)r=new f(10),e=!0;else{if(r=new f(r),t=r.d,r.s<0||!t||!t[0]||r.eq(1))return new f(NaN);e=r.eq(10)}if(t=l.d,l.s<0||!t||!t[0]||l.eq(1))return new f(t&&!t[0]?-1/0:l.s!=1?NaN:t?0:1/0);if(e)if(t.length>1)i=!0;else{for(s=t[0];s%10===0;)s/=10;i=s!==1}if(pt=!1,u=h+g,a=Ho(l,u),n=e?Mx(f,u+10):Ho(r,u),c=mr(a,n,u,1),S0(c.d,s=h,d))do if(u+=10,a=Ho(l,u),n=e?Mx(f,u+10):Ho(r,u),c=mr(a,n,u,1),!i){+In(c.d).slice(s+1,s+15)+1==1e14&&(c=et(c,h+1,0));break}while(S0(c.d,s+=10,d));return pt=!0,et(c,h,d)};Ne.minus=Ne.sub=function(r){var e,t,n,s,i,a,u,c,l,f,h,d,g=this,m=g.constructor;if(r=new m(r),!g.d||!r.d)return!g.s||!r.s?r=new m(NaN):g.d?r.s=-r.s:r=new m(r.d||g.s!==r.s?g:NaN),r;if(g.s!=r.s)return r.s=-r.s,g.plus(r);if(l=g.d,d=r.d,u=m.precision,c=m.rounding,!l[0]||!d[0]){if(d[0])r.s=-r.s;else if(l[0])r=new m(g);else return new m(c===3?-0:0);return pt?et(r,u,c):r}if(t=jn(r.e/at),f=jn(g.e/at),l=l.slice(),i=f-t,i){for(h=i<0,h?(e=l,i=-i,a=d.length):(e=d,t=f,a=l.length),n=Math.max(Math.ceil(u/at),a)+2,i>n&&(i=n,e.length=1),e.reverse(),n=i;n--;)e.push(0);e.reverse()}else{for(n=l.length,a=d.length,h=n<a,h&&(a=n),n=0;n<a;n++)if(l[n]!=d[n]){h=l[n]<d[n];break}i=0}for(h&&(e=l,l=d,d=e,r.s=-r.s),a=l.length,n=d.length-a;n>0;--n)l[a++]=0;for(n=d.length;n>i;){if(l[--n]<d[n]){for(s=n;s&&l[--s]===0;)l[s]=Si-1;--l[s],l[n]+=Si}l[n]-=d[n]}for(;l[--a]===0;)l.pop();for(;l[0]===0;l.shift())--t;return l[0]?(r.d=l,r.e=qx(l,t),pt?et(r,u,c):r):new m(c===3?-0:0)};Ne.modulo=Ne.mod=function(r){var e,t=this,n=t.constructor;return r=new n(r),!t.d||!r.s||r.d&&!r.d[0]?new n(NaN):!r.d||t.d&&!t.d[0]?et(new n(t),n.precision,n.rounding):(pt=!1,n.modulo==9?(e=mr(t,r.abs(),0,3,1),e.s*=r.s):e=mr(t,r,0,n.modulo,1),e=e.times(r),pt=!0,t.minus(e))};Ne.naturalExponential=Ne.exp=function(){return yC(this)};Ne.naturalLogarithm=Ne.ln=function(){return Ho(this)};Ne.negated=Ne.neg=function(){var r=new this.constructor(this);return r.s=-r.s,et(r)};Ne.plus=Ne.add=function(r){var e,t,n,s,i,a,u,c,l,f,h=this,d=h.constructor;if(r=new d(r),!h.d||!r.d)return!h.s||!r.s?r=new d(NaN):h.d||(r=new d(r.d||h.s===r.s?h:NaN)),r;if(h.s!=r.s)return r.s=-r.s,h.minus(r);if(l=h.d,f=r.d,u=d.precision,c=d.rounding,!l[0]||!f[0])return f[0]||(r=new d(h)),pt?et(r,u,c):r;if(i=jn(h.e/at),n=jn(r.e/at),l=l.slice(),s=i-n,s){for(s<0?(t=l,s=-s,a=f.length):(t=f,n=i,a=l.length),i=Math.ceil(u/at),a=i>a?i+1:a+1,s>a&&(s=a,t.length=1),t.reverse();s--;)t.push(0);t.reverse()}for(a=l.length,s=f.length,a-s<0&&(s=a,t=f,f=l,l=t),e=0;s;)e=(l[--s]=l[s]+f[s]+e)/Si|0,l[s]%=Si;for(e&&(l.unshift(e),++n),a=l.length;l[--a]==0;)l.pop();return r.d=l,r.e=qx(l,n),pt?et(r,u,c):r};Ne.precision=Ne.sd=function(r){var e,t=this;if(r!==void 0&&r!==!!r&&r!==1&&r!==0)throw Error(Ko+r);return t.d?(e=o3(t.d),r&&t.e+1>e&&(e=t.e+1)):e=NaN,e};Ne.round=function(){var r=this,e=r.constructor;return et(new e(r),r.e+1,e.rounding)};Ne.sine=Ne.sin=function(){var r,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+Math.max(t.e,t.sd())+at,n.rounding=1,t=o$(n,f3(n,t)),n.precision=r,n.rounding=e,et(Va>2?t.neg():t,r,e,!0)):new n(NaN)};Ne.squareRoot=Ne.sqrt=function(){var r,e,t,n,s,i,a=this,u=a.d,c=a.e,l=a.s,f=a.constructor;if(l!==1||!u||!u[0])return new f(!l||l<0&&(!u||u[0])?NaN:u?a:1/0);for(pt=!1,l=Math.sqrt(+a),l==0||l==1/0?(e=In(u),(e.length+c)%2==0&&(e+="0"),l=Math.sqrt(e),c=jn((c+1)/2)-(c<0||c%2),l==1/0?e="5e"+c:(e=l.toExponential(),e=e.slice(0,e.indexOf("e")+1)+c),n=new f(e)):n=new f(l.toString()),t=(c=f.precision)+3;;)if(i=n,n=i.plus(mr(a,i,t+2,1)).times(.5),In(i.d).slice(0,t)===(e=In(n.d)).slice(0,t))if(e=e.slice(t-3,t+1),e=="9999"||!s&&e=="4999"){if(!s&&(et(i,c+1,0),i.times(i).eq(a))){n=i;break}t+=4,s=1}else{(!+e||!+e.slice(1)&&e.charAt(0)=="5")&&(et(n,c+1,1),r=!n.times(n).eq(a));break}return pt=!0,et(n,c,f.rounding,r)};Ne.tangent=Ne.tan=function(){var r,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+10,n.rounding=1,t=t.sin(),t.s=1,t=mr(t,new n(1).minus(t.times(t)).sqrt(),r+10,0),n.precision=r,n.rounding=e,et(Va==2||Va==4?t.neg():t,r,e,!0)):new n(NaN)};Ne.times=Ne.mul=function(r){var e,t,n,s,i,a,u,c,l,f=this,h=f.constructor,d=f.d,g=(r=new h(r)).d;if(r.s*=f.s,!d||!d[0]||!g||!g[0])return new h(!r.s||d&&!d[0]&&!g||g&&!g[0]&&!d?NaN:!d||!g?r.s/0:r.s*0);for(t=jn(f.e/at)+jn(r.e/at),c=d.length,l=g.length,c<l&&(i=d,d=g,g=i,a=c,c=l,l=a),i=[],a=c+l,n=a;n--;)i.push(0);for(n=l;--n>=0;){for(e=0,s=c+n;s>n;)u=i[s]+g[n]*d[s-n-1]+e,i[s--]=u%Si|0,e=u/Si|0;i[s]=(i[s]+e)%Si|0}for(;!i[--a];)i.pop();return e?++t:i.shift(),r.d=i,r.e=qx(i,t),pt?et(r,h.precision,h.rounding):r};Ne.toBinary=function(r,e){return vC(this,2,r,e)};Ne.toDecimalPlaces=Ne.toDP=function(r,e){var t=this,n=t.constructor;return t=new n(t),r===void 0?t:(is(r,0,$o),e===void 0?e=n.rounding:is(e,0,8),et(t,r+t.e+1,e))};Ne.toExponential=function(r,e){var t,n=this,s=n.constructor;return r===void 0?t=zi(n,!0):(is(r,0,$o),e===void 0?e=s.rounding:is(e,0,8),n=et(new s(n),r+1,e),t=zi(n,!0,r+1)),n.isNeg()&&!n.isZero()?"-"+t:t};Ne.toFixed=function(r,e){var t,n,s=this,i=s.constructor;return r===void 0?t=zi(s):(is(r,0,$o),e===void 0?e=i.rounding:is(e,0,8),n=et(new i(s),r+s.e+1,e),t=zi(n,!1,r+n.e+1)),s.isNeg()&&!s.isZero()?"-"+t:t};Ne.toFraction=function(r){var e,t,n,s,i,a,u,c,l,f,h,d,g=this,m=g.d,v=g.constructor;if(!m)return new v(g);if(l=t=new v(1),n=c=new v(0),e=new v(n),i=e.e=o3(m)-g.e-1,a=i%at,e.d[0]=nn(10,a<0?at+a:a),r==null)r=i>0?e:l;else{if(u=new v(r),!u.isInt()||u.lt(l))throw Error(Ko+u);r=u.gt(e)?i>0?e:l:u}for(pt=!1,u=new v(In(m)),f=v.precision,v.precision=i=m.length*at*2;h=mr(u,e,0,1,1),s=t.plus(h.times(n)),s.cmp(r)!=1;)t=n,n=s,s=l,l=c.plus(h.times(s)),c=s,s=e,e=u.minus(h.times(s)),u=s;return s=mr(r.minus(t),n,0,1,1),c=c.plus(s.times(l)),t=t.plus(s.times(n)),c.s=l.s=g.s,d=mr(l,n,i,1).minus(g).abs().cmp(mr(c,t,i,1).minus(g).abs())<1?[l,n]:[c,t],v.precision=f,pt=!0,d};Ne.toHexadecimal=Ne.toHex=function(r,e){return vC(this,16,r,e)};Ne.toNearest=function(r,e){var t=this,n=t.constructor;if(t=new n(t),r==null){if(!t.d)return t;r=new n(1),e=n.rounding}else{if(r=new n(r),e===void 0?e=n.rounding:is(e,0,8),!t.d)return r.s?t:r;if(!r.d)return r.s&&(r.s=t.s),r}return r.d[0]?(pt=!1,t=mr(t,r,0,e,1).times(r),pt=!0,et(t)):(r.s=t.s,t=r),t};Ne.toNumber=function(){return+this};Ne.toOctal=function(r,e){return vC(this,8,r,e)};Ne.toPower=Ne.pow=function(r){var e,t,n,s,i,a,u=this,c=u.constructor,l=+(r=new c(r));if(!u.d||!r.d||!u.d[0]||!r.d[0])return new c(nn(+u,l));if(u=new c(u),u.eq(1))return u;if(n=c.precision,i=c.rounding,r.eq(1))return et(u,n,i);if(e=jn(r.e/at),e>=r.d.length-1&&(t=l<0?-l:l)<=n$)return s=u3(c,u,t,n),r.s<0?new c(1).div(s):et(s,n,i);if(a=u.s,a<0){if(e<r.d.length-1)return new c(NaN);if((r.d[e]&1)==0&&(a=1),u.e==0&&u.d[0]==1&&u.d.length==1)return u.s=a,u}return t=nn(+u,l),e=t==0||!isFinite(t)?jn(l*(Math.log("0."+In(u.d))/Math.LN10+u.e+1)):new c(t+"").e,e>c.maxE+1||e<c.minE-1?new c(e>0?a/0:0):(pt=!1,c.rounding=u.s=1,t=Math.min(12,(e+"").length),s=yC(r.times(Ho(u,n+t)),n),s.d&&(s=et(s,n+5,1),S0(s.d,n,i)&&(e=n+10,s=et(yC(r.times(Ho(u,e+t)),e),e+5,1),+In(s.d).slice(n+1,n+15)+1==1e14&&(s=et(s,n+1,0)))),s.s=a,pt=!0,c.rounding=i,et(s,n,i))};Ne.toPrecision=function(r,e){var t,n=this,s=n.constructor;return r===void 0?t=zi(n,n.e<=s.toExpNeg||n.e>=s.toExpPos):(is(r,1,$o),e===void 0?e=s.rounding:is(e,0,8),n=et(new s(n),r,e),t=zi(n,r<=n.e||n.e<=s.toExpNeg,r)),n.isNeg()&&!n.isZero()?"-"+t:t};Ne.toSignificantDigits=Ne.toSD=function(r,e){var t=this,n=t.constructor;return r===void 0?(r=n.precision,e=n.rounding):(is(r,1,$o),e===void 0?e=n.rounding:is(e,0,8)),et(new n(t),r,e)};Ne.toString=function(){var r=this,e=r.constructor,t=zi(r,r.e<=e.toExpNeg||r.e>=e.toExpPos);return r.isNeg()&&!r.isZero()?"-"+t:t};Ne.truncated=Ne.trunc=function(){return et(new this.constructor(this),this.e+1,1)};Ne.valueOf=Ne.toJSON=function(){var r=this,e=r.constructor,t=zi(r,r.e<=e.toExpNeg||r.e>=e.toExpPos);return r.isNeg()?"-"+t:t};function In(r){var e,t,n,s=r.length-1,i="",a=r[0];if(s>0){for(i+=a,e=1;e<s;e++)n=r[e]+"",t=at-n.length,t&&(i+=qo(t)),i+=n;a=r[e],n=a+"",t=at-n.length,t&&(i+=qo(t))}else if(a===0)return"0";for(;a%10===0;)a/=10;return i+a}o(In,"digitsToString");function is(r,e,t){if(r!==~~r||r<e||r>t)throw Error(Ko+r)}o(is,"checkInt32");function S0(r,e,t,n){var s,i,a,u;for(i=r[0];i>=10;i/=10)--e;return--e<0?(e+=at,s=0):(s=Math.ceil((e+1)/at),e%=at),i=nn(10,at-e),u=r[s]%i|0,n==null?e<3?(e==0?u=u/100|0:e==1&&(u=u/10|0),a=t<4&&u==99999||t>3&&u==49999||u==5e4||u==0):a=(t<4&&u+1==i||t>3&&u+1==i/2)&&(r[s+1]/i/100|0)==nn(10,e-2)-1||(u==i/2||u==0)&&(r[s+1]/i/100|0)==0:e<4?(e==0?u=u/1e3|0:e==1?u=u/100|0:e==2&&(u=u/10|0),a=(n||t<4)&&u==9999||!n&&t>3&&u==4999):a=((n||t<4)&&u+1==i||!n&&t>3&&u+1==i/2)&&(r[s+1]/i/1e3|0)==nn(10,e-3)-1,a}o(S0,"checkRoundingDigits");function Lx(r,e,t){for(var n,s=[0],i,a=0,u=r.length;a<u;){for(i=s.length;i--;)s[i]*=e;for(s[0]+=dC.indexOf(r.charAt(a++)),n=0;n<s.length;n++)s[n]>t-1&&(s[n+1]===void 0&&(s[n+1]=0),s[n+1]+=s[n]/t|0,s[n]%=t)}return s.reverse()}o(Lx,"convertBase");function i$(r,e){var t,n,s;if(e.isZero())return e;n=e.d.length,n<32?(t=Math.ceil(n/3),s=(1/Hx(4,t)).toString()):(t=16,s="2.3283064365386962890625e-10"),r.precision+=t,e=xh(r,1,e.times(s),new r(1));for(var i=t;i--;){var a=e.times(e);e=a.times(a).minus(a).times(8).plus(1)}return r.precision-=t,e}o(i$,"cosine");var mr=(function(){function r(n,s,i){var a,u=0,c=n.length;for(n=n.slice();c--;)a=n[c]*s+u,n[c]=a%i|0,u=a/i|0;return u&&n.unshift(u),n}o(r,"multiplyInteger");function e(n,s,i,a){var u,c;if(i!=a)c=i>a?1:-1;else for(u=c=0;u<i;u++)if(n[u]!=s[u]){c=n[u]>s[u]?1:-1;break}return c}o(e,"compare");function t(n,s,i,a){for(var u=0;i--;)n[i]-=u,u=n[i]<s[i]?1:0,n[i]=u*a+n[i]-s[i];for(;!n[0]&&n.length>1;)n.shift()}return o(t,"subtract"),function(n,s,i,a,u,c){var l,f,h,d,g,m,v,y,w,S,E,x,b,A,k,I,T,V,U,M,ie=n.constructor,Z=n.s==s.s?1:-1,ue=n.d,$=s.d;if(!ue||!ue[0]||!$||!$[0])return new ie(!n.s||!s.s||(ue?$&&ue[0]==$[0]:!$)?NaN:ue&&ue[0]==0||!$?Z*0:Z/0);for(c?(g=1,f=n.e-s.e):(c=Si,g=at,f=jn(n.e/g)-jn(s.e/g)),U=$.length,T=ue.length,w=new ie(Z),S=w.d=[],h=0;$[h]==(ue[h]||0);h++);if($[h]>(ue[h]||0)&&f--,i==null?(A=i=ie.precision,a=ie.rounding):u?A=i+(n.e-s.e)+1:A=i,A<0)S.push(1),m=!0;else{if(A=A/g+2|0,h=0,U==1){for(d=0,$=$[0],A++;(h<T||d)&&A--;h++)k=d*c+(ue[h]||0),S[h]=k/$|0,d=k%$|0;m=d||h<T}else{for(d=c/($[0]+1)|0,d>1&&($=r($,d,c),ue=r(ue,d,c),U=$.length,T=ue.length),I=U,E=ue.slice(0,U),x=E.length;x<U;)E[x++]=0;M=$.slice(),M.unshift(0),V=$[0],$[1]>=c/2&&++V;do d=0,l=e($,E,U,x),l<0?(b=E[0],U!=x&&(b=b*c+(E[1]||0)),d=b/V|0,d>1?(d>=c&&(d=c-1),v=r($,d,c),y=v.length,x=E.length,l=e(v,E,y,x),l==1&&(d--,t(v,U<y?M:$,y,c))):(d==0&&(l=d=1),v=$.slice()),y=v.length,y<x&&v.unshift(0),t(E,v,x,c),l==-1&&(x=E.length,l=e($,E,U,x),l<1&&(d++,t(E,U<x?M:$,x,c))),x=E.length):l===0&&(d++,E=[0]),S[h++]=d,l&&E[0]?E[x++]=ue[I]||0:(E=[ue[I]],x=1);while((I++<T||E[0]!==void 0)&&A--);m=E[0]!==void 0}S[0]||S.shift()}if(g==1)w.e=f,r3=m;else{for(h=1,d=S[0];d>=10;d/=10)h++;w.e=h+f*g-1,et(w,u?i+w.e+1:i,a,m)}return w}})();function et(r,e,t,n){var s,i,a,u,c,l,f,h,d,g=r.constructor;e:if(e!=null){if(h=r.d,!h)return r;for(s=1,u=h[0];u>=10;u/=10)s++;if(i=e-s,i<0)i+=at,a=e,f=h[d=0],c=f/nn(10,s-a-1)%10|0;else if(d=Math.ceil((i+1)/at),u=h.length,d>=u)if(n){for(;u++<=d;)h.push(0);f=c=0,s=1,i%=at,a=i-at+1}else break e;else{for(f=u=h[d],s=1;u>=10;u/=10)s++;i%=at,a=i-at+s,c=a<0?0:f/nn(10,s-a-1)%10|0}if(n=n||e<0||h[d+1]!==void 0||(a<0?f:f%nn(10,s-a-1)),l=t<4?(c||n)&&(t==0||t==(r.s<0?3:2)):c>5||c==5&&(t==4||n||t==6&&(i>0?a>0?f/nn(10,s-a):0:h[d-1])%10&1||t==(r.s<0?8:7)),e<1||!h[0])return h.length=0,l?(e-=r.e+1,h[0]=nn(10,(at-e%at)%at),r.e=-e||0):h[0]=r.e=0,r;if(i==0?(h.length=d,u=1,d--):(h.length=d+1,u=nn(10,at-i),h[d]=a>0?(f/nn(10,s-a)%nn(10,a)|0)*u:0),l)for(;;)if(d==0){for(i=1,a=h[0];a>=10;a/=10)i++;for(a=h[0]+=u,u=1;a>=10;a/=10)u++;i!=u&&(r.e++,h[0]==Si&&(h[0]=1));break}else{if(h[d]+=u,h[d]!=Si)break;h[d--]=0,u=1}for(i=h.length;h[--i]===0;)h.pop()}return pt&&(r.e>g.maxE?(r.d=null,r.e=NaN):r.e<g.minE&&(r.e=0,r.d=[0])),r}o(et,"finalise");function zi(r,e,t){if(!r.isFinite())return l3(r);var n,s=r.e,i=In(r.d),a=i.length;return e?(t&&(n=t-a)>0?i=i.charAt(0)+"."+i.slice(1)+qo(n):a>1&&(i=i.charAt(0)+"."+i.slice(1)),i=i+(r.e<0?"e":"e+")+r.e):s<0?(i="0."+qo(-s-1)+i,t&&(n=t-a)>0&&(i+=qo(n))):s>=a?(i+=qo(s+1-a),t&&(n=t-s-1)>0&&(i=i+"."+qo(n))):((n=s+1)<a&&(i=i.slice(0,n)+"."+i.slice(n)),t&&(n=t-a)>0&&(s+1===a&&(i+="."),i+=qo(n))),i}o(zi,"finiteToString");function qx(r,e){var t=r[0];for(e*=at;t>=10;t/=10)e++;return e}o(qx,"getBase10Exponent");function Mx(r,e,t){if(e>s$)throw pt=!0,t&&(r.precision=t),Error(n3);return et(new r(Ux),e,1,!0)}o(Mx,"getLn10");function Gi(r,e,t){if(e>gC)throw Error(n3);return et(new r(Vx),e,t,!0)}o(Gi,"getPi");function o3(r){var e=r.length-1,t=e*at+1;if(e=r[e],e){for(;e%10==0;e/=10)t--;for(e=r[0];e>=10;e/=10)t++}return t}o(o3,"getPrecision");function qo(r){for(var e="";r--;)e+="0";return e}o(qo,"getZeroString");function u3(r,e,t,n){var s,i=new r(1),a=Math.ceil(n/at+4);for(pt=!1;;){if(t%2&&(i=i.times(e),e3(i.d,a)&&(s=!0)),t=jn(t/2),t===0){t=i.d.length-1,s&&i.d[t]===0&&++i.d[t];break}e=e.times(e),e3(e.d,a)}return pt=!0,i}o(u3,"intPow");function ZO(r){return r.d[r.d.length-1]&1}o(ZO,"isOdd");function c3(r,e,t){for(var n,s,i=new r(e[0]),a=0;++a<e.length;){if(s=new r(e[a]),!s.s){i=s;break}n=i.cmp(s),(n===t||n===0&&i.s===t)&&(i=s)}return i}o(c3,"maxOrMin");function yC(r,e){var t,n,s,i,a,u,c,l=0,f=0,h=0,d=r.constructor,g=d.rounding,m=d.precision;if(!r.d||!r.d[0]||r.e>17)return new d(r.d?r.d[0]?r.s<0?0:1/0:1:r.s?r.s<0?0:r:NaN);for(e==null?(pt=!1,c=m):c=e,u=new d(.03125);r.e>-2;)r=r.times(u),h+=5;for(n=Math.log(nn(2,h))/Math.LN10*2+5|0,c+=n,t=i=a=new d(1),d.precision=c;;){if(i=et(i.times(r),c,1),t=t.times(++f),u=a.plus(mr(i,t,c,1)),In(u.d).slice(0,c)===In(a.d).slice(0,c)){for(s=h;s--;)a=et(a.times(a),c,1);if(e==null)if(l<3&&S0(a.d,c-n,g,l))d.precision=c+=10,t=i=u=new d(1),f=0,l++;else return et(a,d.precision=m,g,pt=!0);else return d.precision=m,a}a=u}}o(yC,"naturalExponential");function Ho(r,e){var t,n,s,i,a,u,c,l,f,h,d,g=1,m=10,v=r,y=v.d,w=v.constructor,S=w.rounding,E=w.precision;if(v.s<0||!y||!y[0]||!v.e&&y[0]==1&&y.length==1)return new w(y&&!y[0]?-1/0:v.s!=1?NaN:y?0:v);if(e==null?(pt=!1,f=E):f=e,w.precision=f+=m,t=In(y),n=t.charAt(0),Math.abs(i=v.e)<15e14){for(;n<7&&n!=1||n==1&&t.charAt(1)>3;)v=v.times(r),t=In(v.d),n=t.charAt(0),g++;i=v.e,n>1?(v=new w("0."+t),i++):v=new w(n+"."+t.slice(1))}else return l=Mx(w,f+2,E).times(i+""),v=Ho(new w(n+"."+t.slice(1)),f-m).plus(l),w.precision=E,e==null?et(v,E,S,pt=!0):v;for(h=v,c=a=v=mr(v.minus(1),v.plus(1),f,1),d=et(v.times(v),f,1),s=3;;){if(a=et(a.times(d),f,1),l=c.plus(mr(a,new w(s),f,1)),In(l.d).slice(0,f)===In(c.d).slice(0,f))if(c=c.times(2),i!==0&&(c=c.plus(Mx(w,f+2,E).times(i+""))),c=mr(c,new w(g),f,1),e==null)if(S0(c.d,f-m,S,u))w.precision=f+=m,l=a=v=mr(h.minus(1),h.plus(1),f,1),d=et(v.times(v),f,1),s=u=1;else return et(c,w.precision=E,S,pt=!0);else return w.precision=E,c;c=l,s+=2}}o(Ho,"naturalLogarithm");function l3(r){return String(r.s*r.s/0)}o(l3,"nonFiniteToString");function Fx(r,e){var t,n,s;for((t=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(t<0&&(t=n),t+=+e.slice(n+1),e=e.substring(0,n)):t<0&&(t=e.length),n=0;e.charCodeAt(n)===48;n++);for(s=e.length;e.charCodeAt(s-1)===48;--s);if(e=e.slice(n,s),e){if(s-=n,r.e=t=t-n-1,r.d=[],n=(t+1)%at,t<0&&(n+=at),n<s){for(n&&r.d.push(+e.slice(0,n)),s-=at;n<s;)r.d.push(+e.slice(n,n+=at));e=e.slice(n),n=at-e.length}else n-=s;for(;n--;)e+="0";r.d.push(+e),pt&&(r.e>r.constructor.maxE?(r.d=null,r.e=NaN):r.e<r.constructor.minE&&(r.e=0,r.d=[0]))}else r.e=0,r.d=[0];return r}o(Fx,"parseDecimal");function a$(r,e){var t,n,s,i,a,u,c,l,f;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),a3.test(e))return Fx(r,e)}else if(e==="Infinity"||e==="NaN")return+e||(r.s=NaN),r.e=NaN,r.d=null,r;if(t$.test(e))t=16,e=e.toLowerCase();else if(e$.test(e))t=2;else if(r$.test(e))t=8;else throw Error(Ko+e);for(i=e.search(/p/i),i>0?(c=+e.slice(i+1),e=e.substring(2,i)):e=e.slice(2),i=e.indexOf("."),a=i>=0,n=r.constructor,a&&(e=e.replace(".",""),u=e.length,i=u-i,s=u3(n,new n(t),i,i*2)),l=Lx(e,t,Si),f=l.length-1,i=f;l[i]===0;--i)l.pop();return i<0?new n(r.s*0):(r.e=qx(l,f),r.d=l,pt=!1,a&&(r=mr(r,s,u*4)),c&&(r=r.times(Math.abs(c)<54?nn(2,c):Eh.pow(2,c))),pt=!0,r)}o(a$,"parseOther");function o$(r,e){var t,n=e.d.length;if(n<3)return e.isZero()?e:xh(r,2,e,e);t=1.4*Math.sqrt(n),t=t>16?16:t|0,e=e.times(1/Hx(5,t)),e=xh(r,2,e,e);for(var s,i=new r(5),a=new r(16),u=new r(20);t--;)s=e.times(e),e=e.times(i.plus(s.times(a.times(s).minus(u))));return e}o(o$,"sine");function xh(r,e,t,n,s){var i,a,u,c,l=1,f=r.precision,h=Math.ceil(f/at);for(pt=!1,c=t.times(t),u=new r(n);;){if(a=mr(u.times(c),new r(e++*e++),f,1),u=s?n.plus(a):n.minus(a),n=mr(a.times(c),new r(e++*e++),f,1),a=u.plus(n),a.d[h]!==void 0){for(i=h;a.d[i]===u.d[i]&&i--;);if(i==-1)break}i=u,u=n,n=a,a=i,l++}return pt=!0,a.d.length=h+1,a}o(xh,"taylorSeries");function Hx(r,e){for(var t=r;--e;)t*=r;return t}o(Hx,"tinyPow");function f3(r,e){var t,n=e.s<0,s=Gi(r,r.precision,1),i=s.times(.5);if(e=e.abs(),e.lte(i))return Va=n?4:1,e;if(t=e.divToInt(s),t.isZero())Va=n?3:2;else{if(e=e.minus(t.times(s)),e.lte(i))return Va=ZO(t)?n?2:3:n?4:1,e;Va=ZO(t)?n?1:4:n?3:2}return e.minus(s).abs()}o(f3,"toLessThanHalfPi");function vC(r,e,t,n){var s,i,a,u,c,l,f,h,d,g=r.constructor,m=t!==void 0;if(m?(is(t,1,$o),n===void 0?n=g.rounding:is(n,0,8)):(t=g.precision,n=g.rounding),!r.isFinite())f=l3(r);else{for(f=zi(r),a=f.indexOf("."),m?(s=2,e==16?t=t*4-3:e==8&&(t=t*3-2)):s=e,a>=0&&(f=f.replace(".",""),d=new g(1),d.e=f.length-a,d.d=Lx(zi(d),10,s),d.e=d.d.length),h=Lx(f,10,s),i=c=h.length;h[--c]==0;)h.pop();if(!h[0])f=m?"0p+0":"0";else{if(a<0?i--:(r=new g(r),r.d=h,r.e=i,r=mr(r,d,t,n,0,s),h=r.d,i=r.e,l=r3),a=h[t],u=s/2,l=l||h[t+1]!==void 0,l=n<4?(a!==void 0||l)&&(n===0||n===(r.s<0?3:2)):a>u||a===u&&(n===4||l||n===6&&h[t-1]&1||n===(r.s<0?8:7)),h.length=t,l)for(;++h[--t]>s-1;)h[t]=0,t||(++i,h.unshift(1));for(c=h.length;!h[c-1];--c);for(a=0,f="";a<c;a++)f+=dC.charAt(h[a]);if(m){if(c>1)if(e==16||e==8){for(a=e==16?4:3,--c;c%a;c++)f+="0";for(h=Lx(f,s,e),c=h.length;!h[c-1];--c);for(a=1,f="1.";a<c;a++)f+=dC.charAt(h[a])}else f=f.charAt(0)+"."+f.slice(1);f=f+(i<0?"p":"p+")+i}else if(i<0){for(;++i;)f="0"+f;f="0."+f}else if(++i>c)for(i-=c;i--;)f+="0";else i<c&&(f=f.slice(0,i)+"."+f.slice(i))}f=(e==16?"0x":e==2?"0b":e==8?"0o":"")+f}return r.s<0?"-"+f:f}o(vC,"toStringBinary");function e3(r,e){if(r.length>e)return r.length=e,!0}o(e3,"truncate");function u$(r){return new this(r).abs()}o(u$,"abs");function c$(r){return new this(r).acos()}o(c$,"acos");function l$(r){return new this(r).acosh()}o(l$,"acosh");function f$(r,e){return new this(r).plus(e)}o(f$,"add");function h$(r){return new this(r).asin()}o(h$,"asin");function p$(r){return new this(r).asinh()}o(p$,"asinh");function d$(r){return new this(r).atan()}o(d$,"atan");function m$(r){return new this(r).atanh()}o(m$,"atanh");function g$(r,e){r=new this(r),e=new this(e);var t,n=this.precision,s=this.rounding,i=n+4;return!r.s||!e.s?t=new this(NaN):!r.d&&!e.d?(t=Gi(this,i,1).times(e.s>0?.25:.75),t.s=r.s):!e.d||r.isZero()?(t=e.s<0?Gi(this,n,s):new this(0),t.s=r.s):!r.d||e.isZero()?(t=Gi(this,i,1).times(.5),t.s=r.s):e.s<0?(this.precision=i,this.rounding=1,t=this.atan(mr(r,e,i,1)),e=Gi(this,i,1),this.precision=n,this.rounding=s,t=r.s<0?t.minus(e):t.plus(e)):t=this.atan(mr(r,e,i,1)),t}o(g$,"atan2");function y$(r){return new this(r).cbrt()}o(y$,"cbrt");function v$(r){return et(r=new this(r),r.e+1,2)}o(v$,"ceil");function x$(r,e,t){return new this(r).clamp(e,t)}o(x$,"clamp");function E$(r){if(!r||typeof r!="object")throw Error(jx+"Object expected");var e,t,n,s=r.defaults===!0,i=["precision",1,$o,"rounding",0,8,"toExpNeg",-vh,0,"toExpPos",0,vh,"maxE",0,vh,"minE",-vh,0,"modulo",0,9];for(e=0;e<i.length;e+=3)if(t=i[e],s&&(this[t]=mC[t]),(n=r[t])!==void 0)if(jn(n)===n&&n>=i[e+1]&&n<=i[e+2])this[t]=n;else throw Error(Ko+t+": "+n);if(t="crypto",s&&(this[t]=mC[t]),(n=r[t])!==void 0)if(n===!0||n===!1||n===0||n===1)if(n)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[t]=!0;else throw Error(s3);else this[t]=!1;else throw Error(Ko+t+": "+n);return this}o(E$,"config");function w$(r){return new this(r).cos()}o(w$,"cos");function b$(r){return new this(r).cosh()}o(b$,"cosh");function h3(r){var e,t,n;function s(i){var a,u,c,l=this;if(!(l instanceof s))return new s(i);if(l.constructor=s,t3(i)){l.s=i.s,pt?!i.d||i.e>s.maxE?(l.e=NaN,l.d=null):i.e<s.minE?(l.e=0,l.d=[0]):(l.e=i.e,l.d=i.d.slice()):(l.e=i.e,l.d=i.d?i.d.slice():i.d);return}if(c=typeof i,c==="number"){if(i===0){l.s=1/i<0?-1:1,l.e=0,l.d=[0];return}if(i<0?(i=-i,l.s=-1):l.s=1,i===~~i&&i<1e7){for(a=0,u=i;u>=10;u/=10)a++;pt?a>s.maxE?(l.e=NaN,l.d=null):a<s.minE?(l.e=0,l.d=[0]):(l.e=a,l.d=[i]):(l.e=a,l.d=[i]);return}if(i*0!==0){i||(l.s=NaN),l.e=NaN,l.d=null;return}return Fx(l,i.toString())}if(c==="string")return(u=i.charCodeAt(0))===45?(i=i.slice(1),l.s=-1):(u===43&&(i=i.slice(1)),l.s=1),a3.test(i)?Fx(l,i):a$(l,i);if(c==="bigint")return i<0?(i=-i,l.s=-1):l.s=1,Fx(l,i.toString());throw Error(Ko+i)}if(o(s,"Decimal"),s.prototype=Ne,s.ROUND_UP=0,s.ROUND_DOWN=1,s.ROUND_CEIL=2,s.ROUND_FLOOR=3,s.ROUND_HALF_UP=4,s.ROUND_HALF_DOWN=5,s.ROUND_HALF_EVEN=6,s.ROUND_HALF_CEIL=7,s.ROUND_HALF_FLOOR=8,s.EUCLID=9,s.config=s.set=E$,s.clone=h3,s.isDecimal=t3,s.abs=u$,s.acos=c$,s.acosh=l$,s.add=f$,s.asin=h$,s.asinh=p$,s.atan=d$,s.atanh=m$,s.atan2=g$,s.cbrt=y$,s.ceil=v$,s.clamp=x$,s.cos=w$,s.cosh=b$,s.div=S$,s.exp=A$,s.floor=C$,s.hypot=N$,s.ln=T$,s.log=I$,s.log10=B$,s.log2=D$,s.max=R$,s.min=_$,s.mod=O$,s.mul=P$,s.pow=k$,s.random=L$,s.round=F$,s.sign=U$,s.sin=V$,s.sinh=M$,s.sqrt=j$,s.sub=q$,s.sum=H$,s.tan=K$,s.tanh=$$,s.trunc=X$,r===void 0&&(r={}),r&&r.defaults!==!0)for(n=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],e=0;e<n.length;)r.hasOwnProperty(t=n[e++])||(r[t]=this[t]);return s.config(r),s}o(h3,"clone");function S$(r,e){return new this(r).div(e)}o(S$,"div");function A$(r){return new this(r).exp()}o(A$,"exp");function C$(r){return et(r=new this(r),r.e+1,3)}o(C$,"floor");function N$(){var r,e,t=new this(0);for(pt=!1,r=0;r<arguments.length;)if(e=new this(arguments[r++]),e.d)t.d&&(t=t.plus(e.times(e)));else{if(e.s)return pt=!0,new this(1/0);t=e}return pt=!0,t.sqrt()}o(N$,"hypot");function t3(r){return r instanceof Eh||r&&r.toStringTag===i3||!1}o(t3,"isDecimalInstance");function T$(r){return new this(r).ln()}o(T$,"ln");function I$(r,e){return new this(r).log(e)}o(I$,"log");function D$(r){return new this(r).log(2)}o(D$,"log2");function B$(r){return new this(r).log(10)}o(B$,"log10");function R$(){return c3(this,arguments,-1)}o(R$,"max");function _$(){return c3(this,arguments,1)}o(_$,"min");function O$(r,e){return new this(r).mod(e)}o(O$,"mod");function P$(r,e){return new this(r).mul(e)}o(P$,"mul");function k$(r,e){return new this(r).pow(e)}o(k$,"pow");function L$(r){var e,t,n,s,i=0,a=new this(1),u=[];if(r===void 0?r=this.precision:is(r,1,$o),n=Math.ceil(r/at),this.crypto)if(crypto.getRandomValues)for(e=crypto.getRandomValues(new Uint32Array(n));i<n;)s=e[i],s>=429e7?e[i]=crypto.getRandomValues(new Uint32Array(1))[0]:u[i++]=s%1e7;else if(crypto.randomBytes){for(e=crypto.randomBytes(n*=4);i<n;)s=e[i]+(e[i+1]<<8)+(e[i+2]<<16)+((e[i+3]&127)<<24),s>=214e7?crypto.randomBytes(4).copy(e,i):(u.push(s%1e7),i+=4);i=n/4}else throw Error(s3);else for(;i<n;)u[i++]=Math.random()*1e7|0;for(n=u[--i],r%=at,n&&r&&(s=nn(10,at-r),u[i]=(n/s|0)*s);u[i]===0;i--)u.pop();if(i<0)t=0,u=[0];else{for(t=-1;u[0]===0;t-=at)u.shift();for(n=1,s=u[0];s>=10;s/=10)n++;n<at&&(t-=at-n)}return a.e=t,a.d=u,a}o(L$,"random");function F$(r){return et(r=new this(r),r.e+1,this.rounding)}o(F$,"round");function U$(r){return r=new this(r),r.d?r.d[0]?r.s:0*r.s:r.s||NaN}o(U$,"sign");function V$(r){return new this(r).sin()}o(V$,"sin");function M$(r){return new this(r).sinh()}o(M$,"sinh");function j$(r){return new this(r).sqrt()}o(j$,"sqrt");function q$(r,e){return new this(r).sub(e)}o(q$,"sub");function H$(){var r=0,e=arguments,t=new this(e[r]);for(pt=!1;t.s&&++r<e.length;)t=t.plus(e[r]);return pt=!0,et(t,this.precision,this.rounding)}o(H$,"sum");function K$(r){return new this(r).tan()}o(K$,"tan");function $$(r){return new this(r).tanh()}o($$,"tanh");function X$(r){return et(r=new this(r),r.e+1,1)}o(X$,"trunc");Ne[Symbol.for("nodejs.util.inspect.custom")]=Ne.toString;Ne[Symbol.toStringTag]="Decimal";var Eh=Ne.constructor=h3(mC);Ux=new Eh(Ux);Vx=new Eh(Vx);var Kc=class r extends Eh{static{o(this,"Decimal")}static from(e){return new r(e)}static newOrZero(e){return e===void 0?r.from(0):r.from(e)}static newOrUndefined(e){if(e!==void 0)return r.from(e)}};var p3=Rt(require("pdfkit"),1);var xC=class r{static{o(this,"PdfkitPdfBuilder")}defaults={autoFirstPage:!1};doc=new p3.default(this.defaults);constructor(e){e&&this.configure(e)}static new(e){return new r(e)}configure(e){return this.doc.options={...this.doc.options,...e},this}pipe(e){return this.doc.pipe(e),this}end(){return this.doc.end()}restore(){return this.doc.restore(),this}save(){return this.doc.save(),this}stroke(e){return this.doc.stroke(e),this}page(e){return this.doc.addPage(e),this}table(e){return this.doc.table(e),this}text(e,t){let{x:n,y:s,...i}=t??{};return n||s?(this.doc.text(e,n,s,i),this):(this.doc.text(e,t),this)}fontSize(e){return this.doc.fontSize(e),this}font(e,t,n){return typeof t=="string"?(this.doc.font(e,t,n),this):typeof t=="number"?(this.doc.font(e,t),this):(this.doc.font(e),this)}image(e,t,n,s){return typeof t=="number"&&typeof n=="number"?(this.doc.image(e,t,n,s),this):(this.doc.image(e,t),this)}rect(e,t,n,s){return this.doc.rect(e,t,n,s),this}path(e){return this.doc.path(e),this}translate(e,t){return this.doc.translate(e,t),this}scale(e,t){return this.doc.scale(e,t),this}fill(e,t){return this.doc.fill(e,t),this}pageWidth(){return this.doc.page.width}pageHeight(){return this.doc.page.height}heightOfString(e,t){return this.doc.heightOfString(e,t)}widthOfString(e,t){return this.doc.widthOfString(e,t)}pageMargins(){return this.doc.page.margins}currentLineHeight(e){return this.doc.currentLineHeight(e)}x(){return this.doc.x}y(){return this.doc.y}moveDown(e){return this.doc.moveDown(e),this}row(e,...t){let n,s;typeof e=="function"?(n={},s=[e,...t]):(n=e??{},s=t),n.columns??=1;let i=this.y(),a=n.right??0,u=n.left??0,c=n.gap??0,l=this.pageWidth(),f=l-u-a-c*(n.columns-1);n.size??=Array(n.columns).fill(12/n.columns);let h=[];for(let d=0;d<n.columns;d++){let g=n.size[d]/12;h[d]=f*g}for(let d=0,g=u;d<n.columns;d++){let m=d===n.columns-1,v=h[d];if(m&&n.columns>1){let S=l-a-g;S>0&&Math.abs(S-v)>.01&&(v=S)}let y={y:i,x:g,width:v};s[d](y),g+=v,c>0&&!m&&(g+=c)}return this}};var EC=class{static{o(this,"MemoryCacheAdapter")}cache=new Map;async get(e){return Promise.resolve(this.cache.get(e)??null)}has(e){return Promise.resolve(this.cache.has(e))}set(e,t){return this.cache.set(e,t),Promise.resolve(!0)}};var Pk=Rt(require("os"),1),TN=Rt(require("fs"),1),kk=Rt(require("path"),1),Uh=Rt(require("crypto"),1),nu=Rt(Dk(),1);var RW=o(r=>!!r&&typeof r=="object"&&"message"in r,"hasMessageInRecord"),us=o(r=>typeof r=="string"?or(new Mt(r)):r instanceof Error?or(new Mt(r.message,{cause:r.cause})):RW(r)?or(new Mt(r.message)):or(new Mt("unexpected error")),"leftFromError");var M0=class{static{o(this,"NullCacheAdapter")}async get(e){return Promise.resolve(null)}has(e){return Promise.resolve(!1)}set(e,t){return Promise.resolve(!0)}};var j0=require("os"),ia=require("path");var AN=require("path"),SN=require("module"),b2=require("url");var _W=typeof jest<"u"||process.env.JEST_WORKER_ID!==void 0,Lh,Bk=o(()=>{if(Lh!==void 0)return Lh;if(_W){Lh=void 0;return}try{Lh=new Function("try { return import.meta.url; } catch { return undefined; }")()}catch{Lh=void 0}return Lh},"getImportMetaUrl"),Rk=o(()=>{if(typeof require<"u")return require;let r=Bk();if(r)return(0,SN.createRequire)(r);let e=(0,b2.pathToFileURL)((0,AN.resolve)(process.cwd(),"package.json")).href;return(0,SN.createRequire)(e)},"getRequireFn"),_k=o(()=>{if(typeof __filename<"u")return __filename;let r=Bk();return r?(0,b2.fileURLToPath)(r):(0,AN.resolve)(process.cwd())},"getCurrentFile");var Ps=require("path"),el=require("fs");var Ok=o(()=>typeof process<"u"&&typeof process.versions<"u"&&"electron"in process.versions,"isElectron"),OW=o(()=>{if(!Ok())return null;try{let e=require("electron").app;if(e?.getAppPath&&typeof e.getAppPath=="function")return{getAppPath:e.getAppPath}}catch{}return null},"getElectronApp"),PW=o(()=>{if(!Ok())return null;let r=process;if(r.resourcesPath)return r.resourcesPath;let e=OW();if(e)try{let t=e.getAppPath();if(typeof t=="string")return(0,Ps.dirname)(t.replace(/\.asar$/,""))}catch{}return null},"getElectronResourcesPath"),S2=o((r,{onFound:e,onNotFound:t})=>{let n=PW();if(n){let l=(0,Ps.resolve)(n,"node_modules","nfets",r);if((0,el.existsSync)(l))return e(l);let f=(0,Ps.resolve)(n,"app.asar.unpacked","node_modules","nfets",r);if((0,el.existsSync)(f))return e(f)}let s=_k(),i=s.includes(".asar")?process.cwd():s,a=(0,Ps.resolve)(i,"../../../../"),u=(0,Ps.resolve)(a,r);if((0,el.existsSync)(u))return e(u);let c=i;for(let l=0;l<5;l++){let f=(0,Ps.resolve)(c,r);if((0,el.existsSync)(f))return e(f);let h=(0,Ps.dirname)(c);if(h===c)break;c=h}c=i;for(let l=0;l<5;l++){let f=(0,Ps.resolve)(c,"node_modules","nfets",r);if((0,el.existsSync)(f))return e(f);let h=(0,Ps.dirname)(c);if(h===c)break;c=h}c=i;for(let l=0;l<5;l++){let f=(0,Ps.resolve)(c,r.replace(/^build\//,"Release/"));if((0,el.existsSync)(f))return e(f);let h=(0,Ps.dirname)(c);if(h===c)break;c=h}return t()},"search");var kW=o(r=>{let e=r.replace(/^\\\\\?\\/,"");return(0,ia.resolve)((0,ia.normalize)(e))},"normalizePath"),LW=o(r=>{(0,j0.platform)()==="win32"&&(process.env.PATH=`${(0,ia.dirname)(r)}${ia.delimiter}${process.env.PATH}`)},"addAddonDirToPath"),CN=o(r=>{let e=kW(r);return LW(e),Rk()(e)},"exportRequireModule"),Fh=o(r=>{if(r=`${r}.node`,process.env.NFETS_ADDONS_DIR)return CN((0,ia.join)(process.env.NFETS_ADDONS_DIR,r));let e=`${(0,j0.platform)()}-${(0,j0.arch)()}`;try{return S2(`build/addons/${e}/${r}`,{onFound:o(t=>CN(t),"onFound"),onNotFound:o(()=>{throw new Error(`Addon ${e}/${r} not found`)},"onNotFound")})}catch{return S2(`build/Release/${r}`,{onFound:o(t=>CN(t),"onFound"),onNotFound:o(()=>{throw new Error(`Addon ${e}/${r} not found`)},"onNotFound")})}},"addon");var Ka=class{static{o(this,"ASN1")}extractCertificateInfo(e){let n=e.subject.split(`
|
|
88
|
-
`).reduce((i,a)=>{let[u,c]=a.split("=").map(l=>l.trim());return!u||!c?i:i.set(u,c)},new Map),s=this.oid("2.16.76.1.3.1",e.raw);return{CNPJ:this.oid("2.16.76.1.3.3",e.raw),CPF:s,CN:n.get("CN"),O:n.get("O"),OU:n.get("OU"),ST:n.get("ST"),L:n.get("L"),C:n.get("C")}}oid(e,t){let n=this.marker(e),s=t.indexOf(n);if(s===-1)return;let i=[t.subarray(0,s),t.subarray(s)];if(i.length<=1)return;let u=i[0].subarray(-4),c=u.subarray(-2);u[0]===48?c=u:u[1]===48&&(c=u.subarray(-3));let l=Buffer.concat([c,n,i[1]]),f=this.length(l),h=n.length,d=l.subarray(2+h,2+h+f),g=d.length-c.length-2;if(g<=0||g>d.length)return;let v=d.subarray(-g).toString("utf8");return v.substring(Buffer.from(v).findIndex((y,w)=>v.charCodeAt(w)>=32&&v.charCodeAt(w)<=126))}length(e){return e.length<2?0:e[1]<=127?e[1]:Buffer.from([e[1]&15]).reduce((t,n)=>t<<8|n,0)}marker(e){let t=e.split("."),n=t.slice(2).reduce((s,i)=>{let a=this.base128(s,Number.parseInt(i,10),!0);return s.length=0,s.push(...a),s},[]);return Buffer.from([6,n.length+1,40*Number.parseInt(t[0],10)+Number.parseInt(t[1],10),...n])}base128(e,t,n){let s=[...e];if(t>127){let a=this.base128(e,Math.floor(t/128),!1);a.length=0,s.push(...a)}let i=t%128;return n?s.push(i):s.push(128|i),s}};var A2=class{static{o(this,"WincryptSignerRepository")}async sign(e,t,n){try{let s=Fh("wincrypt_certificate_store"),i=new Ka,{CN:a}=i.extractCertificateInfo(t.certificate),u=await s.sign(a??"",Buffer.from(e),n),c=Buffer.from(u).toString("base64");return await Promise.resolve(Qr(c))}catch(s){return Promise.resolve(us(s))}}};var NN=Rt(require("crypto"),1);var C2=class{static{o(this,"CryptoSignerRepository")}async sign(e,t,n){try{if(!t.privateKey)return or(new Mt("Certificate private key not found"));let i=NN.default.sign(n,Buffer.from(e),{key:t.privateKey,padding:NN.default.constants.RSA_PKCS1_PADDING}).toString("base64");return await Promise.resolve(Qr(i))}catch(s){return Promise.resolve(us(s))}}};var IN=class{static{o(this,"NativeCertificateRepository")}httpClient;cache;signer;constructor(e,t=new M0,n=Pk.default.platform()==="win32"?new A2:new C2){this.httpClient=e,this.cache=t,this.signer=n}async read(e){try{let{password:t,pfxPathOrBase64:n,publicCertDerBase64:s}=e,i=s?.trim(),a=n?.trim();if(i&&a)return or(new Mt("Use either pfxPathOrBase64 or publicCertDerBase64, not both"));if(i)try{let w=Buffer.from(i,"base64"),S=new Uh.default.X509Certificate(w);return Qr({ca:[],password:t,certificate:S,privateKey:void 0})}catch(w){return us(w)}if(!a)return or(new Mt("Certificate path (pfxPathOrBase64) is required"));let u=await this.getPfxBuffer({...e,pfxPathOrBase64:a});if(u.isLeft())return u;let c=nu.default.asn1.fromDer(u.value.toString("binary")),l=nu.default.pkcs12.pkcs12FromAsn1(c,t),{certBag:f}=nu.default.pki.oids,d=l.getBags({bagType:f})[f];if(!d?.length)return or(new Mt("Cannot read certificate"));let[{cert:g},...m]=d;if(!g)return or(new Mt("Issuer Certificate not found"));let v=m.reduce((w,{cert:S})=>(S&&w.push(new Uh.default.X509Certificate(nu.default.pki.certificateToPem(S))),w),[]),y=new Uh.default.X509Certificate(nu.default.pki.certificateToPem(g));return Qr({ca:v,password:t,certificate:y,privateKey:this.getPrivateKey(l)})}catch(t){return us(t)}}getPrivateKey(e){let{pkcs8ShroudedKeyBag:t}=nu.default.pki.oids,s=e.getBags({bagType:t})[t]?.[0]?.key;if(s)return Uh.default.createPrivateKey(nu.default.pki.privateKeyToPem(s))}async sign(e,t,n=Ua.SHA1){return this.signer.sign(e,t,n)}getCertificateInfo(e){return new Ka().extractCertificateInfo(e)}getStringCertificate(e){return e.raw.toString("base64")}getStringPrivateKey(e){try{return e.export({type:"pkcs8",format:"pem"})}catch{throw new Mt("Cannot extract private key")}}async getPfxBuffer(e){let{pfxPathOrBase64:t,password:n}=e,s=this.getCacheKey(t,n),i=await this.cache.get(s);if(i)return Qr(i);if(kk.default.isAbsolute(t)||TN.default.existsSync(t))return this.hitBufferOnCache(s,TN.default.readFileSync(t));if(this.isValidRemoteUrl(t))try{let a=await this.httpClient.get(t,{responseType:"arraybuffer"});return await this.hitBufferOnCache(s,Buffer.from(a.data))}catch(a){return us(a)}return this.hitBufferOnCache(s,Buffer.from(t,"base64"))}getCacheKey(e,t){return Uh.default.createHash("sha256").update(`${e}.${t}`).digest("hex")}async hitBufferOnCache(e,t){return await this.cache.set(e,t),Qr(t)}isValidRemoteUrl(e){try{return new URL(e),!0}catch{return!1}}};var oj=Rt(require("os"),1);var N2=Rt(require("dayjs"),1),Lk=Rt(require("dayjs/plugin/utc"),1),Fk=Rt(require("dayjs/plugin/timezone"),1);N2.default.extend(Lk.default);N2.default.extend(Fk.default);var tl=N2.default;var uj=require("crypto"),Rw=require("https"),cj=Rt(KV(),1);function Pg(r,e){return o(function(){return r.apply(e,arguments)},"wrap")}o(Pg,"bind");var{toString:xae}=Object.prototype,{getPrototypeOf:pw}=Object,{iterator:dw,toStringTag:zV}=Symbol,mw=(r=>e=>{let t=xae.call(e);return r[t]||(r[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),Bi=o(r=>(r=r.toLowerCase(),e=>mw(e)===r),"kindOfTest"),gw=o(r=>e=>typeof e===r,"typeOfTest"),{isArray:vp}=Array,yp=gw("undefined");function kg(r){return r!==null&&!yp(r)&&r.constructor!==null&&!yp(r.constructor)&&xs(r.constructor.isBuffer)&&r.constructor.isBuffer(r)}o(kg,"isBuffer");var WV=Bi("ArrayBuffer");function Eae(r){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(r):e=r&&r.buffer&&WV(r.buffer),e}o(Eae,"isArrayBufferView");var wae=gw("string"),xs=gw("function"),JV=gw("number"),Lg=o(r=>r!==null&&typeof r=="object","isObject"),bae=o(r=>r===!0||r===!1,"isBoolean"),hw=o(r=>{if(mw(r)!=="object")return!1;let e=pw(r);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(zV in r)&&!(dw in r)},"isPlainObject"),Sae=o(r=>{if(!Lg(r)||kg(r))return!1;try{return Object.keys(r).length===0&&Object.getPrototypeOf(r)===Object.prototype}catch{return!1}},"isEmptyObject"),Aae=Bi("Date"),Cae=Bi("File"),Nae=o(r=>!!(r&&typeof r.uri<"u"),"isReactNativeBlob"),Tae=o(r=>r&&typeof r.getParts<"u","isReactNative"),Iae=Bi("Blob"),Dae=Bi("FileList"),Bae=o(r=>Lg(r)&&xs(r.pipe),"isStream");function Rae(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}o(Rae,"getGlobal");var $V=Rae(),XV=typeof $V.FormData<"u"?$V.FormData:void 0,_ae=o(r=>{if(!r)return!1;if(XV&&r instanceof XV)return!0;let e=pw(r);if(!e||e===Object.prototype||!xs(r.append))return!1;let t=mw(r);return t==="formdata"||t==="object"&&xs(r.toString)&&r.toString()==="[object FormData]"},"isFormData"),Oae=Bi("URLSearchParams"),[Pae,kae,Lae,Fae]=["ReadableStream","Request","Response","Headers"].map(Bi),Uae=o(r=>r.trim?r.trim():r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),"trim");function Fg(r,e,{allOwnKeys:t=!1}={}){if(r===null||typeof r>"u")return;let n,s;if(typeof r!="object"&&(r=[r]),vp(r))for(n=0,s=r.length;n<s;n++)e.call(null,r[n],n,r);else{if(kg(r))return;let i=t?Object.getOwnPropertyNames(r):Object.keys(r),a=i.length,u;for(n=0;n<a;n++)u=i[n],e.call(null,r[u],u,r)}}o(Fg,"forEach");function YV(r,e){if(kg(r))return null;e=e.toLowerCase();let t=Object.keys(r),n=t.length,s;for(;n-- >0;)if(s=t[n],e===s.toLowerCase())return s;return null}o(YV,"findKey");var yl=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,QV=o(r=>!yp(r)&&r!==yl,"isContextDefined");function ID(){let{caseless:r,skipUndefined:e}=QV(this)&&this||{},t={},n=o((s,i)=>{if(i==="__proto__"||i==="constructor"||i==="prototype")return;let a=r&&YV(t,i)||i;hw(t[a])&&hw(s)?t[a]=ID(t[a],s):hw(s)?t[a]=ID({},s):vp(s)?t[a]=s.slice():(!e||!yp(s))&&(t[a]=s)},"assignValue");for(let s=0,i=arguments.length;s<i;s++)arguments[s]&&Fg(arguments[s],n);return t}o(ID,"merge");var Vae=o((r,e,t,{allOwnKeys:n}={})=>(Fg(e,(s,i)=>{t&&xs(s)?Object.defineProperty(r,i,{value:Pg(s,t),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(r,i,{value:s,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:n}),r),"extend"),Mae=o(r=>(r.charCodeAt(0)===65279&&(r=r.slice(1)),r),"stripBOM"),jae=o((r,e,t,n)=>{r.prototype=Object.create(e.prototype,n),Object.defineProperty(r.prototype,"constructor",{value:r,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(r,"super",{value:e.prototype}),t&&Object.assign(r.prototype,t)},"inherits"),qae=o((r,e,t,n)=>{let s,i,a,u={};if(e=e||{},r==null)return e;do{for(s=Object.getOwnPropertyNames(r),i=s.length;i-- >0;)a=s[i],(!n||n(a,r,e))&&!u[a]&&(e[a]=r[a],u[a]=!0);r=t!==!1&&pw(r)}while(r&&(!t||t(r,e))&&r!==Object.prototype);return e},"toFlatObject"),Hae=o((r,e,t)=>{r=String(r),(t===void 0||t>r.length)&&(t=r.length),t-=e.length;let n=r.indexOf(e,t);return n!==-1&&n===t},"endsWith"),Kae=o(r=>{if(!r)return null;if(vp(r))return r;let e=r.length;if(!JV(e))return null;let t=new Array(e);for(;e-- >0;)t[e]=r[e];return t},"toArray"),$ae=(r=>e=>r&&e instanceof r)(typeof Uint8Array<"u"&&pw(Uint8Array)),Xae=o((r,e)=>{let n=(r&&r[dw]).call(r),s;for(;(s=n.next())&&!s.done;){let i=s.value;e.call(r,i[0],i[1])}},"forEachEntry"),Gae=o((r,e)=>{let t,n=[];for(;(t=r.exec(e))!==null;)n.push(t);return n},"matchAll"),zae=Bi("HTMLFormElement"),Wae=o(r=>r.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,o(function(t,n,s){return n.toUpperCase()+s},"replacer")),"toCamelCase"),GV=(({hasOwnProperty:r})=>(e,t)=>r.call(e,t))(Object.prototype),Jae=Bi("RegExp"),ZV=o((r,e)=>{let t=Object.getOwnPropertyDescriptors(r),n={};Fg(t,(s,i)=>{let a;(a=e(s,i,r))!==!1&&(n[i]=a||s)}),Object.defineProperties(r,n)},"reduceDescriptors"),Yae=o(r=>{ZV(r,(e,t)=>{if(xs(r)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;let n=r[t];if(xs(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},"freezeMethods"),Qae=o((r,e)=>{let t={},n=o(s=>{s.forEach(i=>{t[i]=!0})},"define");return vp(r)?n(r):n(String(r).split(e)),t},"toObjectSet"),Zae=o(()=>{},"noop"),eoe=o((r,e)=>r!=null&&Number.isFinite(r=+r)?r:e,"toFiniteNumber");function toe(r){return!!(r&&xs(r.append)&&r[zV]==="FormData"&&r[dw])}o(toe,"isSpecCompliantForm");var roe=o(r=>{let e=new Array(10),t=o((n,s)=>{if(Lg(n)){if(e.indexOf(n)>=0)return;if(kg(n))return n;if(!("toJSON"in n)){e[s]=n;let i=vp(n)?[]:{};return Fg(n,(a,u)=>{let c=t(a,s+1);!yp(c)&&(i[u]=c)}),e[s]=void 0,i}}return n},"visit");return t(r,0)},"toJSONObject"),noe=Bi("AsyncFunction"),soe=o(r=>r&&(Lg(r)||xs(r))&&xs(r.then)&&xs(r.catch),"isThenable"),eM=((r,e)=>r?setImmediate:e?((t,n)=>(yl.addEventListener("message",({source:s,data:i})=>{s===yl&&i===t&&n.length&&n.shift()()},!1),s=>{n.push(s),yl.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",xs(yl.postMessage)),ioe=typeof queueMicrotask<"u"?queueMicrotask.bind(yl):typeof process<"u"&&process.nextTick||eM,aoe=o(r=>r!=null&&xs(r[dw]),"isIterable"),J={isArray:vp,isArrayBuffer:WV,isBuffer:kg,isFormData:_ae,isArrayBufferView:Eae,isString:wae,isNumber:JV,isBoolean:bae,isObject:Lg,isPlainObject:hw,isEmptyObject:Sae,isReadableStream:Pae,isRequest:kae,isResponse:Lae,isHeaders:Fae,isUndefined:yp,isDate:Aae,isFile:Cae,isReactNativeBlob:Nae,isReactNative:Tae,isBlob:Iae,isRegExp:Jae,isFunction:xs,isStream:Bae,isURLSearchParams:Oae,isTypedArray:$ae,isFileList:Dae,forEach:Fg,merge:ID,extend:Vae,trim:Uae,stripBOM:Mae,inherits:jae,toFlatObject:qae,kindOf:mw,kindOfTest:Bi,endsWith:Hae,toArray:Kae,forEachEntry:Xae,matchAll:Gae,isHTMLForm:zae,hasOwnProperty:GV,hasOwnProp:GV,reduceDescriptors:ZV,freezeMethods:Yae,toObjectSet:Qae,toCamelCase:Wae,noop:Zae,toFiniteNumber:eoe,findKey:YV,global:yl,isContextDefined:QV,isSpecCompliantForm:toe,toJSONObject:roe,isAsyncFn:noe,isThenable:soe,setImmediate:eM,asap:ioe,isIterable:aoe};var Es=class tM extends Error{static{o(this,"AxiosError")}static from(e,t,n,s,i,a){let u=new tM(e.message,t||e.code,n,s,i);return u.cause=e,u.name=e.name,e.status!=null&&u.status==null&&(u.status=e.status),a&&Object.assign(u,a),u}constructor(e,t,n,s,i){super(e),Object.defineProperty(this,"message",{value:e,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),n&&(this.config=n),s&&(this.request=s),i&&(this.response=i,this.status=i.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:J.toJSONObject(this.config),code:this.code,status:this.status}}};Es.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";Es.ERR_BAD_OPTION="ERR_BAD_OPTION";Es.ECONNABORTED="ECONNABORTED";Es.ETIMEDOUT="ETIMEDOUT";Es.ERR_NETWORK="ERR_NETWORK";Es.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";Es.ERR_DEPRECATED="ERR_DEPRECATED";Es.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";Es.ERR_BAD_REQUEST="ERR_BAD_REQUEST";Es.ERR_CANCELED="ERR_CANCELED";Es.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";Es.ERR_INVALID_URL="ERR_INVALID_URL";Es.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";var Pe=Es;var rM=Rt(QN(),1),yw=rM.default;function BD(r){return J.isPlainObject(r)||J.isArray(r)}o(BD,"isVisitable");function nM(r){return J.endsWith(r,"[]")?r.slice(0,-2):r}o(nM,"removeBrackets");function DD(r,e,t){return r?r.concat(e).map(o(function(s,i){return s=nM(s),!t&&i?"["+s+"]":s},"each")).join(t?".":""):e}o(DD,"renderKey");function ooe(r){return J.isArray(r)&&!r.some(BD)}o(ooe,"isFlatArray");var uoe=J.toFlatObject(J,{},null,o(function(e){return/^is[A-Z]/.test(e)},"filter"));function coe(r,e,t){if(!J.isObject(r))throw new TypeError("target must be an object");e=e||new(yw||FormData),t=J.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,o(function(y,w){return!J.isUndefined(w[y])},"defined"));let n=t.metaTokens,s=t.visitor||h,i=t.dots,a=t.indexes,u=t.Blob||typeof Blob<"u"&&Blob,c=t.maxDepth===void 0?100:t.maxDepth,l=u&&J.isSpecCompliantForm(e);if(!J.isFunction(s))throw new TypeError("visitor must be a function");function f(v){if(v===null)return"";if(J.isDate(v))return v.toISOString();if(J.isBoolean(v))return v.toString();if(!l&&J.isBlob(v))throw new Pe("Blob is not supported. Use a Buffer instead.");return J.isArrayBuffer(v)||J.isTypedArray(v)?l&&typeof Blob=="function"?new Blob([v]):Buffer.from(v):v}o(f,"convertValue");function h(v,y,w){let S=v;if(J.isReactNative(e)&&J.isReactNativeBlob(v))return e.append(DD(w,y,i),f(v)),!1;if(v&&!w&&typeof v=="object"){if(J.endsWith(y,"{}"))y=n?y:y.slice(0,-2),v=JSON.stringify(v);else if(J.isArray(v)&&ooe(v)||(J.isFileList(v)||J.endsWith(y,"[]"))&&(S=J.toArray(v)))return y=nM(y),S.forEach(o(function(x,b){!(J.isUndefined(x)||x===null)&&e.append(a===!0?DD([y],b,i):a===null?y:y+"[]",f(x))},"each")),!1}return BD(v)?!0:(e.append(DD(w,y,i),f(v)),!1)}o(h,"defaultVisitor");let d=[],g=Object.assign(uoe,{defaultVisitor:h,convertValue:f,isVisitable:BD});function m(v,y,w=0){if(!J.isUndefined(v)){if(w>c)throw new Pe("Object is too deeply nested ("+w+" levels). Max depth: "+c,Pe.ERR_FORM_DATA_DEPTH_EXCEEDED);if(d.indexOf(v)!==-1)throw Error("Circular reference detected in "+y.join("."));d.push(v),J.forEach(v,o(function(E,x){(!(J.isUndefined(E)||E===null)&&s.call(e,E,J.isString(x)?x.trim():x,y,g))===!0&&m(E,y?y.concat(x):[x],w+1)},"each")),d.pop()}}if(o(m,"build"),!J.isObject(r))throw new TypeError("data must be an object");return m(r),e}o(coe,"toFormData");var Cu=coe;function sM(r){let e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(r).replace(/[!'()~]|%20/g,o(function(n){return e[n]},"replacer"))}o(sM,"encode");function iM(r,e){this._pairs=[],r&&Cu(r,this,e)}o(iM,"AxiosURLSearchParams");var aM=iM.prototype;aM.append=o(function(e,t){this._pairs.push([e,t])},"append");aM.toString=o(function(e){let t=e?function(n){return e.call(this,n,sM)}:sM;return this._pairs.map(o(function(s){return t(s[0])+"="+t(s[1])},"each"),"").join("&")},"toString");var oM=iM;function loe(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}o(loe,"encode");function vl(r,e,t){if(!e)return r;let n=t&&t.encode||loe,s=J.isFunction(t)?{serialize:t}:t,i=s&&s.serialize,a;if(i?a=i(e,s):a=J.isURLSearchParams(e)?e.toString():new oM(e,s).toString(n),a){let u=r.indexOf("#");u!==-1&&(r=r.slice(0,u)),r+=(r.indexOf("?")===-1?"?":"&")+a}return r}o(vl,"buildURL");var foe=class{static{o(this,"InterceptorManager")}constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){J.forEach(this.handlers,o(function(n){n!==null&&e(n)},"forEachHandler"))}},RD=foe;var Nu={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0};var fM=Rt(require("crypto"),1);var uM=Rt(require("url"),1),cM=uM.default.URLSearchParams;var _D="abcdefghijklmnopqrstuvwxyz",lM="0123456789",hM={DIGIT:lM,ALPHA:_D,ALPHA_DIGIT:_D+_D.toUpperCase()+lM},hoe=o((r=16,e=hM.ALPHA_DIGIT)=>{let t="",{length:n}=e,s=new Uint32Array(r);fM.default.randomFillSync(s);for(let i=0;i<r;i++)t+=e[s[i]%n];return t},"generateString"),pM={isNode:!0,classes:{URLSearchParams:cM,FormData:yw,Blob:typeof Blob<"u"&&Blob||null},ALPHABET:hM,generateString:hoe,protocols:["http","https","file","data"]};var kD={};Bx(kD,{hasBrowserEnv:()=>PD,hasStandardBrowserEnv:()=>poe,hasStandardBrowserWebWorkerEnv:()=>doe,navigator:()=>OD,origin:()=>moe});var PD=typeof window<"u"&&typeof document<"u",OD=typeof navigator=="object"&&navigator||void 0,poe=PD&&(!OD||["ReactNative","NativeScript","NS"].indexOf(OD.product)<0),doe=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",moe=PD&&window.location.href||"http://localhost";var Zt={...kD,...pM};function LD(r,e){return Cu(r,new Zt.classes.URLSearchParams,{visitor:o(function(t,n,s,i){return Zt.isNode&&J.isBuffer(t)?(this.append(n,t.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},"visitor"),...e})}o(LD,"toURLEncodedForm");function goe(r){return J.matchAll(/\w+|\[(\w*)]/g,r).map(e=>e[0]==="[]"?"":e[1]||e[0])}o(goe,"parsePropPath");function yoe(r){let e={},t=Object.keys(r),n,s=t.length,i;for(n=0;n<s;n++)i=t[n],e[i]=r[i];return e}o(yoe,"arrayToObject");function voe(r){function e(t,n,s,i){let a=t[i++];if(a==="__proto__")return!0;let u=Number.isFinite(+a),c=i>=t.length;return a=!a&&J.isArray(s)?s.length:a,c?(J.hasOwnProp(s,a)?s[a]=J.isArray(s[a])?s[a].concat(n):[s[a],n]:s[a]=n,!u):((!s[a]||!J.isObject(s[a]))&&(s[a]=[]),e(t,n,s[a],i)&&J.isArray(s[a])&&(s[a]=yoe(s[a])),!u)}if(o(e,"buildPath"),J.isFormData(r)&&J.isFunction(r.entries)){let t={};return J.forEachEntry(r,(n,s)=>{e(goe(n),s,t,0)}),t}return null}o(voe,"formDataToJSON");var vw=voe;var xp=o((r,e)=>r!=null&&J.hasOwnProp(r,e)?r[e]:void 0,"own");function xoe(r,e,t){if(J.isString(r))try{return(e||JSON.parse)(r),J.trim(r)}catch(n){if(n.name!=="SyntaxError")throw n}return(t||JSON.stringify)(r)}o(xoe,"stringifySafely");var FD={transitional:Nu,adapter:["xhr","http","fetch"],transformRequest:[o(function(e,t){let n=t.getContentType()||"",s=n.indexOf("application/json")>-1,i=J.isObject(e);if(i&&J.isHTMLForm(e)&&(e=new FormData(e)),J.isFormData(e))return s?JSON.stringify(vw(e)):e;if(J.isArrayBuffer(e)||J.isBuffer(e)||J.isStream(e)||J.isFile(e)||J.isBlob(e)||J.isReadableStream(e))return e;if(J.isArrayBufferView(e))return e.buffer;if(J.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let u;if(i){let c=xp(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return LD(e,c).toString();if((u=J.isFileList(e))||n.indexOf("multipart/form-data")>-1){let l=xp(this,"env"),f=l&&l.FormData;return Cu(u?{"files[]":e}:e,f&&new f,c)}}return i||s?(t.setContentType("application/json",!1),xoe(e)):e},"transformRequest")],transformResponse:[o(function(e){let t=xp(this,"transitional")||FD.transitional,n=t&&t.forcedJSONParsing,s=xp(this,"responseType"),i=s==="json";if(J.isResponse(e)||J.isReadableStream(e))return e;if(e&&J.isString(e)&&(n&&!s||i)){let u=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e,xp(this,"parseReviver"))}catch(c){if(u)throw c.name==="SyntaxError"?Pe.from(c,Pe.ERR_BAD_RESPONSE,this,null,xp(this,"response")):c}}return e},"transformResponse")],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Zt.classes.FormData,Blob:Zt.classes.Blob},validateStatus:o(function(e){return e>=200&&e<300},"validateStatus"),headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};J.forEach(["delete","get","head","post","put","patch"],r=>{FD.headers[r]={}});var Ep=FD;var Eoe=J.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),dM=o((r=>{let e={},t,n,s;return r&&r.split(`
|
|
87
|
+
@#[line:`+r.lineNumber+",col:"+r.columnNumber+"]"}o(cde,"_locator");function SK(r,e,t){return typeof r=="string"?r.substr(e,t):r.length>=e+t||e?new java.lang.String(r,e,t)+"":r}o(SK,"_toString");"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(r){nC.prototype[r]=function(){return null}});function rC(r,e){r.currentElement?r.currentElement.appendChild(e):r.doc.appendChild(e)}o(rC,"appendElement");function lde(r){if(r==="error")throw"onErrorStopParsing"}o(lde,"onErrorStopParsing");function fde(){throw"onWarningStopParsing"}o(fde,"onWarningStopParsing");d0.__DOMHandler=nC;d0.DOMParser=NK;d0.normalizeLineEndings=CK;d0.onErrorStopParsing=lde;d0.onWarningStopParsing=fde});var IK=X(Gt=>{"use strict";var m0=lh();Gt.assign=m0.assign;Gt.hasDefaultHTMLNamespace=m0.hasDefaultHTMLNamespace;Gt.isHTMLMimeType=m0.isHTMLMimeType;Gt.isValidMimeType=m0.isValidMimeType;Gt.MIME_TYPE=m0.MIME_TYPE;Gt.NAMESPACE=m0.NAMESPACE;var sC=yx();Gt.DOMException=sC.DOMException;Gt.DOMExceptionName=sC.DOMExceptionName;Gt.ExceptionCode=sC.ExceptionCode;Gt.ParseError=sC.ParseError;var hn=pO();Gt.Attr=hn.Attr;Gt.CDATASection=hn.CDATASection;Gt.CharacterData=hn.CharacterData;Gt.Comment=hn.Comment;Gt.Document=hn.Document;Gt.DocumentFragment=hn.DocumentFragment;Gt.DocumentType=hn.DocumentType;Gt.DOMImplementation=hn.DOMImplementation;Gt.Element=hn.Element;Gt.Entity=hn.Entity;Gt.EntityReference=hn.EntityReference;Gt.LiveNodeList=hn.LiveNodeList;Gt.NamedNodeMap=hn.NamedNodeMap;Gt.Node=hn.Node;Gt.NodeList=hn.NodeList;Gt.Notation=hn.Notation;Gt.ProcessingInstruction=hn.ProcessingInstruction;Gt.Text=hn.Text;Gt.XMLSerializer=hn.XMLSerializer;var iC=TK();Gt.DOMParser=iC.DOMParser;Gt.normalizeLineEndings=iC.normalizeLineEndings;Gt.onErrorStopParsing=iC.onErrorStopParsing;Gt.onWarningStopParsing=iC.onWarningStopParsing});var gde={};Bx(gde,{ASN1:()=>Ka,CanonicalizationMethod:()=>oC,Choice:()=>pde,Decimal:()=>Kc,DigestAlgorithm:()=>Ox,EntitySigner:()=>cC,Environment:()=>JK,IsDecimal:()=>yO,Left:()=>kx,MemoryCacheAdapter:()=>EC,NFeTsError:()=>Vt,NativeCertificateRepository:()=>IN,NullCacheAdapter:()=>M0,PdfkitPdfBuilder:()=>xC,Right:()=>w0,SignatureAlgorithm:()=>Ua,SignatureMethod:()=>_x,SignatureNamespace:()=>Rx,Signer:()=>Hc,SkipAllValidations:()=>QK,SkipValidation:()=>YK,SkipValidationMetadata:()=>yh,SoapRemoteTransmissionRepository:()=>oB,StateAcronyms:()=>WK,StateCodeAcValidator:()=>xO,StateCodeAlValidator:()=>EO,StateCodeAmValidator:()=>wO,StateCodeApValidator:()=>bO,StateCodeBaValidator:()=>SO,StateCodeCeValidator:()=>AO,StateCodeDfValidator:()=>CO,StateCodeEsValidator:()=>NO,StateCodeGoValidator:()=>TO,StateCodeMaValidator:()=>IO,StateCodeMgValidator:()=>DO,StateCodeMsValidator:()=>BO,StateCodeMtValidator:()=>RO,StateCodePaValidator:()=>_O,StateCodePbValidator:()=>OO,StateCodePeValidator:()=>PO,StateCodePiValidator:()=>kO,StateCodePrValidator:()=>LO,StateCodeRjValidator:()=>FO,StateCodeRnValidator:()=>UO,StateCodeRoValidator:()=>VO,StateCodeRrValidator:()=>MO,StateCodeRsValidator:()=>jO,StateCodeScValidator:()=>qO,StateCodeSeValidator:()=>HO,StateCodeSpValidator:()=>KO,StateCodeToValidator:()=>$O,StateCodes:()=>rr,TransformDateString:()=>mde,TransformDecimal:()=>dde,TransmissionError:()=>x0,TransmissionHostNotFoundError:()=>gh,TransmissionTimeoutError:()=>qc,ValidateErrorsMetadata:()=>hC,Validates:()=>ZK,ValidationError:()=>uC,Xml2JsToolkit:()=>gO,XmlSigner:()=>lC,clearEmptyValues:()=>b0,dateToolkit:()=>tl,fixUtf8Mojibake:()=>ij,left:()=>nr,leftFromError:()=>us,leftFromTransmissionError:()=>sB,mapConstraintsToErrors:()=>pC,mapTransmissionError:()=>sj,normalizeTransmissionStrings:()=>aB,plainToInstance:()=>fC,right:()=>Qr,search:()=>S2,timezones:()=>JO,unreachable:()=>Px});module.exports=zK(gde);var Rx="http://www.w3.org/2000/09/xmldsig#",oC="http://www.w3.org/TR/2001/REC-xml-c14n-20010315",_x=(function(r){return r.RSA_SHA1="http://www.w3.org/2000/09/xmldsig#rsa-sha1",r.RSA_SHA256="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256",r})({}),Ua=(function(r){return r.SHA1="sha1",r.SHA256="sha256",r})({}),Ox=(function(r){return r.SHA1="http://www.w3.org/2000/09/xmldsig#sha1",r.SHA256="http://www.w3.org/2001/04/xmlenc#sha256",r})({});var rr={AC:"12",AL:"27",AM:"13",AP:"16",BA:"29",CE:"23",DF:"53",ES:"32",GO:"52",MA:"21",MG:"31",MS:"50",MT:"51",PA:"15",PB:"25",PE:"26",PI:"22",PR:"41",RJ:"33",RN:"24",RO:"11",RR:"14",RS:"43",SC:"42",SE:"28",SP:"35",TO:"17"},WK=Object.keys(rr);var JK={Production:"1",Homolog:"2"};var JO={[rr.AC]:"America/Rio_Branco",[rr.AL]:"America/Maceio",[rr.AM]:"America/Manaus",[rr.AP]:"America/Belem",[rr.BA]:"America/Bahia",[rr.CE]:"America/Fortaleza",[rr.DF]:"America/Sao_Paulo",[rr.ES]:"America/Sao_Paulo",[rr.GO]:"America/Sao_Paulo",[rr.MA]:"America/Fortaleza",[rr.MG]:"America/Sao_Paulo",[rr.MS]:"America/Campo_Grande",[rr.MT]:"America/Cuiaba",[rr.PA]:"America/Belem",[rr.PB]:"America/Fortaleza",[rr.PE]:"America/Recife",[rr.PI]:"America/Fortaleza",[rr.PR]:"America/Sao_Paulo",[rr.RJ]:"America/Sao_Paulo",[rr.RN]:"America/Fortaleza",[rr.RO]:"America/Porto_Velho",[rr.RR]:"America/Boa_Vista",[rr.RS]:"America/Sao_Paulo",[rr.SC]:"America/Sao_Paulo",[rr.SE]:"America/Maceio",[rr.SP]:"America/Sao_Paulo",[rr.TO]:"America/Araguaina"};var Vt=class extends Error{static{o(this,"NFeTsError")}};var x0=class extends Vt{static{o(this,"TransmissionError")}},gh=class extends x0{static{o(this,"TransmissionHostNotFoundError")}},qc=class extends x0{static{o(this,"TransmissionTimeoutError")}};var uC=class extends Vt{static{o(this,"ValidationError")}};var E0={includeComments:!1,exclusive:!0};var Px=o(r=>{throw new Vt("Didn't expect to get here")},"unreachable");var Hc=class{static{o(this,"Signer")}toolkit;certificateRepository;algorithm;canonical;constructor(e,t,n=Ua.SHA1,s=E0){this.toolkit=e,this.certificateRepository=t,this.algorithm=n,this.canonical=s}assemble(e,t,n){let s=this.certificateRepository.getStringCertificate(n);return{$:{xmlns:Rx},SignedInfo:e,SignatureValue:t,KeyInfo:{X509Data:{X509Certificate:s}}}}signedInfo(e,t){return{CanonicalizationMethod:{$:{Algorithm:oC}},SignatureMethod:{$:{Algorithm:this.signatureMethod}},Reference:{$:{URI:`#${this.toolkit.getAttribute(e,t)}`},Transforms:this.transforms,DigestMethod:{$:{Algorithm:this.digestAlgorithm}},DigestValue:this.digest(e)}}}digest(e){return this.toolkit.digest(e,this.algorithm,this.canonical)}async signOrLeft(e,t){let n=this.toolkit.canonicalize(await this.toolkit.build({$:{xmlns:Rx},...e},{rootName:"SignedInfo"}),this.canonical);return this.certificateRepository.sign(n,t,this.algorithm)}get transforms(){return{Transform:[{$:{Algorithm:"http://www.w3.org/2000/09/xmldsig#enveloped-signature"}},{$:{Algorithm:"http://www.w3.org/TR/2001/REC-xml-c14n-20010315"}}]}}get digestAlgorithm(){switch(this.algorithm){case Ua.SHA256:return Ox.SHA256;case Ua.SHA1:return Ox.SHA1;default:return Px(this.algorithm)}}get signatureMethod(){switch(this.algorithm){case Ua.SHA256:return _x.RSA_SHA256;case Ua.SHA1:return _x.RSA_SHA1;default:return Px(this.algorithm)}}};var kx=class{static{o(this,"Left")}value;constructor(e){this.value=e}isLeft(){return!0}isRight(){return!1}},w0=class{static{o(this,"Right")}value;constructor(e){this.value=e}isLeft(){return!1}isRight(){return!0}},nr=o(r=>new kx(r),"left"),Qr=o(r=>r===void 0?new w0(void 0):new w0(r),"right");var cC=class extends Hc{static{o(this,"EntitySigner")}async sign(e,t,n){let{tag:s,mark:i}=t,{certificate:a}=n;if(!e[s])return nr(new Vt(`Node ${String(s)} not found`));let u=await this.toolkit.build(this.ns(e,s),{headless:!0,rootName:String(s),renderOpts:{pretty:!1}}),c=this.signedInfo(u,i),l=await this.signOrLeft(c,n);if(l.isLeft())return l;let f=e;return f.Signature=this.assemble(c,l.value,a),Qr(f)}ns(e,t){let n=e.$?.xmlns,{$:s,...i}=e[t],{xmlns:a,...u}=s??{};return{$:{xmlns:n,...u},...i}}};var lC=class extends Hc{static{o(this,"XmlSigner")}async sign(e,t,n){let{tag:s,mark:i}=t,{certificate:a}=n,u=this.toolkit.getNode(e,s);if(!u)return nr(new Vt(`Node ${s} not found`));let c=this.signedInfo(u,i),l=await this.signOrLeft(c,n);if(l.isLeft())return l;let f=await this.toolkit.build(this.assemble(c,l.value,a),{rootName:"Signature"});return Qr(this.toolkit.appendNode(e,f))}};var xme=require("reflect-metadata"),QO=require("class-validator");var dme=require("reflect-metadata");var yh="__SkipValidation__",YK=o(()=>(r,e)=>{Reflect.defineMetadata(yh,!0,r,e.toString())},"SkipValidation"),QK=o(()=>r=>{Reflect.defineMetadata(yh,!0,r)},"SkipAllValidations");var YO=require("class-transformer");var b0=o(r=>{for(let[e,t]of Object.entries(r))typeof t>"u"&&delete r[e],t===""&&delete r[e],t&&typeof t=="object"&&b0(t)},"clearEmptyValues"),fC=o((r,e,t={})=>{let n=(0,YO.plainToInstance)(e,r);return t.clearEmptyValues&&b0(n),n},"plainToInstance");var hC="__ValidateErrors__",pC=o((r,e)=>r.reduce((t,n)=>{if(n.children?.length)return t.concat(pC(n.children,e?`${e}.${n.property}`:n.property));let s=Object.values(n.constraints??{}).map(i=>e?`${e}.${i}`:i).join(", ");return s?t.concat(s):t},[]),"mapConstraintsToErrors"),ZK=o(r=>(e,t,n)=>{let s=n.value;n.value=function(...i){let a=Reflect.getMetadata(yh,this.constructor);if(Reflect.getMetadata(yh,this.constructor.prototype,t.toString())===!0||a===!0)return s?.apply(this,i);let[c,...l]=i;if(!c)return s?.apply(this,i);let f=fC(c,r),h=(0,QO.validateSync)(f,{whitelist:!0});if(b0(f),h.length){let d=Reflect.getMetadata(hC,this)??[];Reflect.defineMetadata(hC,d.concat(pC(h,s?.name)),this)}return s?.apply(this,[f,...l])}},"Validates");var $ke=require("reflect-metadata");var vh=9e15,$o=1e9,dC="0123456789abcdef",Ux="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Vx="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",mC={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-vh,maxE:vh,crypto:!1},r3,Va,pt=!0,jx="[DecimalError] ",Ko=jx+"Invalid argument: ",n3=jx+"Precision limit exceeded",s3=jx+"crypto unavailable",i3="[object Decimal]",jn=Math.floor,nn=Math.pow,e$=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,t$=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,r$=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,a3=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Si=1e7,at=7,n$=9007199254740991,s$=Ux.length-1,gC=Vx.length-1,Ne={toStringTag:i3};Ne.absoluteValue=Ne.abs=function(){var r=new this.constructor(this);return r.s<0&&(r.s=1),et(r)};Ne.ceil=function(){return et(new this.constructor(this),this.e+1,2)};Ne.clampedTo=Ne.clamp=function(r,e){var t,n=this,s=n.constructor;if(r=new s(r),e=new s(e),!r.s||!e.s)return new s(NaN);if(r.gt(e))throw Error(Ko+e);return t=n.cmp(r),t<0?r:n.cmp(e)>0?e:new s(n)};Ne.comparedTo=Ne.cmp=function(r){var e,t,n,s,i=this,a=i.d,u=(r=new i.constructor(r)).d,c=i.s,l=r.s;if(!a||!u)return!c||!l?NaN:c!==l?c:a===u?0:!a^c<0?1:-1;if(!a[0]||!u[0])return a[0]?c:u[0]?-l:0;if(c!==l)return c;if(i.e!==r.e)return i.e>r.e^c<0?1:-1;for(n=a.length,s=u.length,e=0,t=n<s?n:s;e<t;++e)if(a[e]!==u[e])return a[e]>u[e]^c<0?1:-1;return n===s?0:n>s^c<0?1:-1};Ne.cosine=Ne.cos=function(){var r,e,t=this,n=t.constructor;return t.d?t.d[0]?(r=n.precision,e=n.rounding,n.precision=r+Math.max(t.e,t.sd())+at,n.rounding=1,t=i$(n,f3(n,t)),n.precision=r,n.rounding=e,et(Va==2||Va==3?t.neg():t,r,e,!0)):new n(1):new n(NaN)};Ne.cubeRoot=Ne.cbrt=function(){var r,e,t,n,s,i,a,u,c,l,f=this,h=f.constructor;if(!f.isFinite()||f.isZero())return new h(f);for(pt=!1,i=f.s*nn(f.s*f,1/3),!i||Math.abs(i)==1/0?(t=In(f.d),r=f.e,(i=(r-t.length+1)%3)&&(t+=i==1||i==-2?"0":"00"),i=nn(t,1/3),r=jn((r+1)/3)-(r%3==(r<0?-1:2)),i==1/0?t="5e"+r:(t=i.toExponential(),t=t.slice(0,t.indexOf("e")+1)+r),n=new h(t),n.s=f.s):n=new h(i.toString()),a=(r=h.precision)+3;;)if(u=n,c=u.times(u).times(u),l=c.plus(f),n=mr(l.plus(f).times(u),l.plus(c),a+2,1),In(u.d).slice(0,a)===(t=In(n.d)).slice(0,a))if(t=t.slice(a-3,a+1),t=="9999"||!s&&t=="4999"){if(!s&&(et(u,r+1,0),u.times(u).times(u).eq(f))){n=u;break}a+=4,s=1}else{(!+t||!+t.slice(1)&&t.charAt(0)=="5")&&(et(n,r+1,1),e=!n.times(n).times(n).eq(f));break}return pt=!0,et(n,r,h.rounding,e)};Ne.decimalPlaces=Ne.dp=function(){var r,e=this.d,t=NaN;if(e){if(r=e.length-1,t=(r-jn(this.e/at))*at,r=e[r],r)for(;r%10==0;r/=10)t--;t<0&&(t=0)}return t};Ne.dividedBy=Ne.div=function(r){return mr(this,new this.constructor(r))};Ne.dividedToIntegerBy=Ne.divToInt=function(r){var e=this,t=e.constructor;return et(mr(e,new t(r),0,1,1),t.precision,t.rounding)};Ne.equals=Ne.eq=function(r){return this.cmp(r)===0};Ne.floor=function(){return et(new this.constructor(this),this.e+1,3)};Ne.greaterThan=Ne.gt=function(r){return this.cmp(r)>0};Ne.greaterThanOrEqualTo=Ne.gte=function(r){var e=this.cmp(r);return e==1||e===0};Ne.hyperbolicCosine=Ne.cosh=function(){var r,e,t,n,s,i=this,a=i.constructor,u=new a(1);if(!i.isFinite())return new a(i.s?1/0:NaN);if(i.isZero())return u;t=a.precision,n=a.rounding,a.precision=t+Math.max(i.e,i.sd())+4,a.rounding=1,s=i.d.length,s<32?(r=Math.ceil(s/3),e=(1/Hx(4,r)).toString()):(r=16,e="2.3283064365386962890625e-10"),i=xh(a,1,i.times(e),new a(1),!0);for(var c,l=r,f=new a(8);l--;)c=i.times(i),i=u.minus(c.times(f.minus(c.times(f))));return et(i,a.precision=t,a.rounding=n,!0)};Ne.hyperbolicSine=Ne.sinh=function(){var r,e,t,n,s=this,i=s.constructor;if(!s.isFinite()||s.isZero())return new i(s);if(e=i.precision,t=i.rounding,i.precision=e+Math.max(s.e,s.sd())+4,i.rounding=1,n=s.d.length,n<3)s=xh(i,2,s,s,!0);else{r=1.4*Math.sqrt(n),r=r>16?16:r|0,s=s.times(1/Hx(5,r)),s=xh(i,2,s,s,!0);for(var a,u=new i(5),c=new i(16),l=new i(20);r--;)a=s.times(s),s=s.times(u.plus(a.times(c.times(a).plus(l))))}return i.precision=e,i.rounding=t,et(s,e,t,!0)};Ne.hyperbolicTangent=Ne.tanh=function(){var r,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+7,n.rounding=1,mr(t.sinh(),t.cosh(),n.precision=r,n.rounding=e)):new n(t.s)};Ne.inverseCosine=Ne.acos=function(){var r=this,e=r.constructor,t=r.abs().cmp(1),n=e.precision,s=e.rounding;return t!==-1?t===0?r.isNeg()?Gi(e,n,s):new e(0):new e(NaN):r.isZero()?Gi(e,n+4,s).times(.5):(e.precision=n+6,e.rounding=1,r=new e(1).minus(r).div(r.plus(1)).sqrt().atan(),e.precision=n,e.rounding=s,r.times(2))};Ne.inverseHyperbolicCosine=Ne.acosh=function(){var r,e,t=this,n=t.constructor;return t.lte(1)?new n(t.eq(1)?0:NaN):t.isFinite()?(r=n.precision,e=n.rounding,n.precision=r+Math.max(Math.abs(t.e),t.sd())+4,n.rounding=1,pt=!1,t=t.times(t).minus(1).sqrt().plus(t),pt=!0,n.precision=r,n.rounding=e,t.ln()):new n(t)};Ne.inverseHyperbolicSine=Ne.asinh=function(){var r,e,t=this,n=t.constructor;return!t.isFinite()||t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+2*Math.max(Math.abs(t.e),t.sd())+6,n.rounding=1,pt=!1,t=t.times(t).plus(1).sqrt().plus(t),pt=!0,n.precision=r,n.rounding=e,t.ln())};Ne.inverseHyperbolicTangent=Ne.atanh=function(){var r,e,t,n,s=this,i=s.constructor;return s.isFinite()?s.e>=0?new i(s.abs().eq(1)?s.s/0:s.isZero()?s:NaN):(r=i.precision,e=i.rounding,n=s.sd(),Math.max(n,r)<2*-s.e-1?et(new i(s),r,e,!0):(i.precision=t=n-s.e,s=mr(s.plus(1),new i(1).minus(s),t+r,1),i.precision=r+4,i.rounding=1,s=s.ln(),i.precision=r,i.rounding=e,s.times(.5))):new i(NaN)};Ne.inverseSine=Ne.asin=function(){var r,e,t,n,s=this,i=s.constructor;return s.isZero()?new i(s):(e=s.abs().cmp(1),t=i.precision,n=i.rounding,e!==-1?e===0?(r=Gi(i,t+4,n).times(.5),r.s=s.s,r):new i(NaN):(i.precision=t+6,i.rounding=1,s=s.div(new i(1).minus(s.times(s)).sqrt().plus(1)).atan(),i.precision=t,i.rounding=n,s.times(2)))};Ne.inverseTangent=Ne.atan=function(){var r,e,t,n,s,i,a,u,c,l=this,f=l.constructor,h=f.precision,d=f.rounding;if(l.isFinite()){if(l.isZero())return new f(l);if(l.abs().eq(1)&&h+4<=gC)return a=Gi(f,h+4,d).times(.25),a.s=l.s,a}else{if(!l.s)return new f(NaN);if(h+4<=gC)return a=Gi(f,h+4,d).times(.5),a.s=l.s,a}for(f.precision=u=h+10,f.rounding=1,t=Math.min(28,u/at+2|0),r=t;r;--r)l=l.div(l.times(l).plus(1).sqrt().plus(1));for(pt=!1,e=Math.ceil(u/at),n=1,c=l.times(l),a=new f(l),s=l;r!==-1;)if(s=s.times(c),i=a.minus(s.div(n+=2)),s=s.times(c),a=i.plus(s.div(n+=2)),a.d[e]!==void 0)for(r=e;a.d[r]===i.d[r]&&r--;);return t&&(a=a.times(2<<t-1)),pt=!0,et(a,f.precision=h,f.rounding=d,!0)};Ne.isFinite=function(){return!!this.d};Ne.isInteger=Ne.isInt=function(){return!!this.d&&jn(this.e/at)>this.d.length-2};Ne.isNaN=function(){return!this.s};Ne.isNegative=Ne.isNeg=function(){return this.s<0};Ne.isPositive=Ne.isPos=function(){return this.s>0};Ne.isZero=function(){return!!this.d&&this.d[0]===0};Ne.lessThan=Ne.lt=function(r){return this.cmp(r)<0};Ne.lessThanOrEqualTo=Ne.lte=function(r){return this.cmp(r)<1};Ne.logarithm=Ne.log=function(r){var e,t,n,s,i,a,u,c,l=this,f=l.constructor,h=f.precision,d=f.rounding,g=5;if(r==null)r=new f(10),e=!0;else{if(r=new f(r),t=r.d,r.s<0||!t||!t[0]||r.eq(1))return new f(NaN);e=r.eq(10)}if(t=l.d,l.s<0||!t||!t[0]||l.eq(1))return new f(t&&!t[0]?-1/0:l.s!=1?NaN:t?0:1/0);if(e)if(t.length>1)i=!0;else{for(s=t[0];s%10===0;)s/=10;i=s!==1}if(pt=!1,u=h+g,a=Ho(l,u),n=e?Mx(f,u+10):Ho(r,u),c=mr(a,n,u,1),S0(c.d,s=h,d))do if(u+=10,a=Ho(l,u),n=e?Mx(f,u+10):Ho(r,u),c=mr(a,n,u,1),!i){+In(c.d).slice(s+1,s+15)+1==1e14&&(c=et(c,h+1,0));break}while(S0(c.d,s+=10,d));return pt=!0,et(c,h,d)};Ne.minus=Ne.sub=function(r){var e,t,n,s,i,a,u,c,l,f,h,d,g=this,m=g.constructor;if(r=new m(r),!g.d||!r.d)return!g.s||!r.s?r=new m(NaN):g.d?r.s=-r.s:r=new m(r.d||g.s!==r.s?g:NaN),r;if(g.s!=r.s)return r.s=-r.s,g.plus(r);if(l=g.d,d=r.d,u=m.precision,c=m.rounding,!l[0]||!d[0]){if(d[0])r.s=-r.s;else if(l[0])r=new m(g);else return new m(c===3?-0:0);return pt?et(r,u,c):r}if(t=jn(r.e/at),f=jn(g.e/at),l=l.slice(),i=f-t,i){for(h=i<0,h?(e=l,i=-i,a=d.length):(e=d,t=f,a=l.length),n=Math.max(Math.ceil(u/at),a)+2,i>n&&(i=n,e.length=1),e.reverse(),n=i;n--;)e.push(0);e.reverse()}else{for(n=l.length,a=d.length,h=n<a,h&&(a=n),n=0;n<a;n++)if(l[n]!=d[n]){h=l[n]<d[n];break}i=0}for(h&&(e=l,l=d,d=e,r.s=-r.s),a=l.length,n=d.length-a;n>0;--n)l[a++]=0;for(n=d.length;n>i;){if(l[--n]<d[n]){for(s=n;s&&l[--s]===0;)l[s]=Si-1;--l[s],l[n]+=Si}l[n]-=d[n]}for(;l[--a]===0;)l.pop();for(;l[0]===0;l.shift())--t;return l[0]?(r.d=l,r.e=qx(l,t),pt?et(r,u,c):r):new m(c===3?-0:0)};Ne.modulo=Ne.mod=function(r){var e,t=this,n=t.constructor;return r=new n(r),!t.d||!r.s||r.d&&!r.d[0]?new n(NaN):!r.d||t.d&&!t.d[0]?et(new n(t),n.precision,n.rounding):(pt=!1,n.modulo==9?(e=mr(t,r.abs(),0,3,1),e.s*=r.s):e=mr(t,r,0,n.modulo,1),e=e.times(r),pt=!0,t.minus(e))};Ne.naturalExponential=Ne.exp=function(){return yC(this)};Ne.naturalLogarithm=Ne.ln=function(){return Ho(this)};Ne.negated=Ne.neg=function(){var r=new this.constructor(this);return r.s=-r.s,et(r)};Ne.plus=Ne.add=function(r){var e,t,n,s,i,a,u,c,l,f,h=this,d=h.constructor;if(r=new d(r),!h.d||!r.d)return!h.s||!r.s?r=new d(NaN):h.d||(r=new d(r.d||h.s===r.s?h:NaN)),r;if(h.s!=r.s)return r.s=-r.s,h.minus(r);if(l=h.d,f=r.d,u=d.precision,c=d.rounding,!l[0]||!f[0])return f[0]||(r=new d(h)),pt?et(r,u,c):r;if(i=jn(h.e/at),n=jn(r.e/at),l=l.slice(),s=i-n,s){for(s<0?(t=l,s=-s,a=f.length):(t=f,n=i,a=l.length),i=Math.ceil(u/at),a=i>a?i+1:a+1,s>a&&(s=a,t.length=1),t.reverse();s--;)t.push(0);t.reverse()}for(a=l.length,s=f.length,a-s<0&&(s=a,t=f,f=l,l=t),e=0;s;)e=(l[--s]=l[s]+f[s]+e)/Si|0,l[s]%=Si;for(e&&(l.unshift(e),++n),a=l.length;l[--a]==0;)l.pop();return r.d=l,r.e=qx(l,n),pt?et(r,u,c):r};Ne.precision=Ne.sd=function(r){var e,t=this;if(r!==void 0&&r!==!!r&&r!==1&&r!==0)throw Error(Ko+r);return t.d?(e=o3(t.d),r&&t.e+1>e&&(e=t.e+1)):e=NaN,e};Ne.round=function(){var r=this,e=r.constructor;return et(new e(r),r.e+1,e.rounding)};Ne.sine=Ne.sin=function(){var r,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+Math.max(t.e,t.sd())+at,n.rounding=1,t=o$(n,f3(n,t)),n.precision=r,n.rounding=e,et(Va>2?t.neg():t,r,e,!0)):new n(NaN)};Ne.squareRoot=Ne.sqrt=function(){var r,e,t,n,s,i,a=this,u=a.d,c=a.e,l=a.s,f=a.constructor;if(l!==1||!u||!u[0])return new f(!l||l<0&&(!u||u[0])?NaN:u?a:1/0);for(pt=!1,l=Math.sqrt(+a),l==0||l==1/0?(e=In(u),(e.length+c)%2==0&&(e+="0"),l=Math.sqrt(e),c=jn((c+1)/2)-(c<0||c%2),l==1/0?e="5e"+c:(e=l.toExponential(),e=e.slice(0,e.indexOf("e")+1)+c),n=new f(e)):n=new f(l.toString()),t=(c=f.precision)+3;;)if(i=n,n=i.plus(mr(a,i,t+2,1)).times(.5),In(i.d).slice(0,t)===(e=In(n.d)).slice(0,t))if(e=e.slice(t-3,t+1),e=="9999"||!s&&e=="4999"){if(!s&&(et(i,c+1,0),i.times(i).eq(a))){n=i;break}t+=4,s=1}else{(!+e||!+e.slice(1)&&e.charAt(0)=="5")&&(et(n,c+1,1),r=!n.times(n).eq(a));break}return pt=!0,et(n,c,f.rounding,r)};Ne.tangent=Ne.tan=function(){var r,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+10,n.rounding=1,t=t.sin(),t.s=1,t=mr(t,new n(1).minus(t.times(t)).sqrt(),r+10,0),n.precision=r,n.rounding=e,et(Va==2||Va==4?t.neg():t,r,e,!0)):new n(NaN)};Ne.times=Ne.mul=function(r){var e,t,n,s,i,a,u,c,l,f=this,h=f.constructor,d=f.d,g=(r=new h(r)).d;if(r.s*=f.s,!d||!d[0]||!g||!g[0])return new h(!r.s||d&&!d[0]&&!g||g&&!g[0]&&!d?NaN:!d||!g?r.s/0:r.s*0);for(t=jn(f.e/at)+jn(r.e/at),c=d.length,l=g.length,c<l&&(i=d,d=g,g=i,a=c,c=l,l=a),i=[],a=c+l,n=a;n--;)i.push(0);for(n=l;--n>=0;){for(e=0,s=c+n;s>n;)u=i[s]+g[n]*d[s-n-1]+e,i[s--]=u%Si|0,e=u/Si|0;i[s]=(i[s]+e)%Si|0}for(;!i[--a];)i.pop();return e?++t:i.shift(),r.d=i,r.e=qx(i,t),pt?et(r,h.precision,h.rounding):r};Ne.toBinary=function(r,e){return vC(this,2,r,e)};Ne.toDecimalPlaces=Ne.toDP=function(r,e){var t=this,n=t.constructor;return t=new n(t),r===void 0?t:(is(r,0,$o),e===void 0?e=n.rounding:is(e,0,8),et(t,r+t.e+1,e))};Ne.toExponential=function(r,e){var t,n=this,s=n.constructor;return r===void 0?t=zi(n,!0):(is(r,0,$o),e===void 0?e=s.rounding:is(e,0,8),n=et(new s(n),r+1,e),t=zi(n,!0,r+1)),n.isNeg()&&!n.isZero()?"-"+t:t};Ne.toFixed=function(r,e){var t,n,s=this,i=s.constructor;return r===void 0?t=zi(s):(is(r,0,$o),e===void 0?e=i.rounding:is(e,0,8),n=et(new i(s),r+s.e+1,e),t=zi(n,!1,r+n.e+1)),s.isNeg()&&!s.isZero()?"-"+t:t};Ne.toFraction=function(r){var e,t,n,s,i,a,u,c,l,f,h,d,g=this,m=g.d,v=g.constructor;if(!m)return new v(g);if(l=t=new v(1),n=c=new v(0),e=new v(n),i=e.e=o3(m)-g.e-1,a=i%at,e.d[0]=nn(10,a<0?at+a:a),r==null)r=i>0?e:l;else{if(u=new v(r),!u.isInt()||u.lt(l))throw Error(Ko+u);r=u.gt(e)?i>0?e:l:u}for(pt=!1,u=new v(In(m)),f=v.precision,v.precision=i=m.length*at*2;h=mr(u,e,0,1,1),s=t.plus(h.times(n)),s.cmp(r)!=1;)t=n,n=s,s=l,l=c.plus(h.times(s)),c=s,s=e,e=u.minus(h.times(s)),u=s;return s=mr(r.minus(t),n,0,1,1),c=c.plus(s.times(l)),t=t.plus(s.times(n)),c.s=l.s=g.s,d=mr(l,n,i,1).minus(g).abs().cmp(mr(c,t,i,1).minus(g).abs())<1?[l,n]:[c,t],v.precision=f,pt=!0,d};Ne.toHexadecimal=Ne.toHex=function(r,e){return vC(this,16,r,e)};Ne.toNearest=function(r,e){var t=this,n=t.constructor;if(t=new n(t),r==null){if(!t.d)return t;r=new n(1),e=n.rounding}else{if(r=new n(r),e===void 0?e=n.rounding:is(e,0,8),!t.d)return r.s?t:r;if(!r.d)return r.s&&(r.s=t.s),r}return r.d[0]?(pt=!1,t=mr(t,r,0,e,1).times(r),pt=!0,et(t)):(r.s=t.s,t=r),t};Ne.toNumber=function(){return+this};Ne.toOctal=function(r,e){return vC(this,8,r,e)};Ne.toPower=Ne.pow=function(r){var e,t,n,s,i,a,u=this,c=u.constructor,l=+(r=new c(r));if(!u.d||!r.d||!u.d[0]||!r.d[0])return new c(nn(+u,l));if(u=new c(u),u.eq(1))return u;if(n=c.precision,i=c.rounding,r.eq(1))return et(u,n,i);if(e=jn(r.e/at),e>=r.d.length-1&&(t=l<0?-l:l)<=n$)return s=u3(c,u,t,n),r.s<0?new c(1).div(s):et(s,n,i);if(a=u.s,a<0){if(e<r.d.length-1)return new c(NaN);if((r.d[e]&1)==0&&(a=1),u.e==0&&u.d[0]==1&&u.d.length==1)return u.s=a,u}return t=nn(+u,l),e=t==0||!isFinite(t)?jn(l*(Math.log("0."+In(u.d))/Math.LN10+u.e+1)):new c(t+"").e,e>c.maxE+1||e<c.minE-1?new c(e>0?a/0:0):(pt=!1,c.rounding=u.s=1,t=Math.min(12,(e+"").length),s=yC(r.times(Ho(u,n+t)),n),s.d&&(s=et(s,n+5,1),S0(s.d,n,i)&&(e=n+10,s=et(yC(r.times(Ho(u,e+t)),e),e+5,1),+In(s.d).slice(n+1,n+15)+1==1e14&&(s=et(s,n+1,0)))),s.s=a,pt=!0,c.rounding=i,et(s,n,i))};Ne.toPrecision=function(r,e){var t,n=this,s=n.constructor;return r===void 0?t=zi(n,n.e<=s.toExpNeg||n.e>=s.toExpPos):(is(r,1,$o),e===void 0?e=s.rounding:is(e,0,8),n=et(new s(n),r,e),t=zi(n,r<=n.e||n.e<=s.toExpNeg,r)),n.isNeg()&&!n.isZero()?"-"+t:t};Ne.toSignificantDigits=Ne.toSD=function(r,e){var t=this,n=t.constructor;return r===void 0?(r=n.precision,e=n.rounding):(is(r,1,$o),e===void 0?e=n.rounding:is(e,0,8)),et(new n(t),r,e)};Ne.toString=function(){var r=this,e=r.constructor,t=zi(r,r.e<=e.toExpNeg||r.e>=e.toExpPos);return r.isNeg()&&!r.isZero()?"-"+t:t};Ne.truncated=Ne.trunc=function(){return et(new this.constructor(this),this.e+1,1)};Ne.valueOf=Ne.toJSON=function(){var r=this,e=r.constructor,t=zi(r,r.e<=e.toExpNeg||r.e>=e.toExpPos);return r.isNeg()?"-"+t:t};function In(r){var e,t,n,s=r.length-1,i="",a=r[0];if(s>0){for(i+=a,e=1;e<s;e++)n=r[e]+"",t=at-n.length,t&&(i+=qo(t)),i+=n;a=r[e],n=a+"",t=at-n.length,t&&(i+=qo(t))}else if(a===0)return"0";for(;a%10===0;)a/=10;return i+a}o(In,"digitsToString");function is(r,e,t){if(r!==~~r||r<e||r>t)throw Error(Ko+r)}o(is,"checkInt32");function S0(r,e,t,n){var s,i,a,u;for(i=r[0];i>=10;i/=10)--e;return--e<0?(e+=at,s=0):(s=Math.ceil((e+1)/at),e%=at),i=nn(10,at-e),u=r[s]%i|0,n==null?e<3?(e==0?u=u/100|0:e==1&&(u=u/10|0),a=t<4&&u==99999||t>3&&u==49999||u==5e4||u==0):a=(t<4&&u+1==i||t>3&&u+1==i/2)&&(r[s+1]/i/100|0)==nn(10,e-2)-1||(u==i/2||u==0)&&(r[s+1]/i/100|0)==0:e<4?(e==0?u=u/1e3|0:e==1?u=u/100|0:e==2&&(u=u/10|0),a=(n||t<4)&&u==9999||!n&&t>3&&u==4999):a=((n||t<4)&&u+1==i||!n&&t>3&&u+1==i/2)&&(r[s+1]/i/1e3|0)==nn(10,e-3)-1,a}o(S0,"checkRoundingDigits");function Lx(r,e,t){for(var n,s=[0],i,a=0,u=r.length;a<u;){for(i=s.length;i--;)s[i]*=e;for(s[0]+=dC.indexOf(r.charAt(a++)),n=0;n<s.length;n++)s[n]>t-1&&(s[n+1]===void 0&&(s[n+1]=0),s[n+1]+=s[n]/t|0,s[n]%=t)}return s.reverse()}o(Lx,"convertBase");function i$(r,e){var t,n,s;if(e.isZero())return e;n=e.d.length,n<32?(t=Math.ceil(n/3),s=(1/Hx(4,t)).toString()):(t=16,s="2.3283064365386962890625e-10"),r.precision+=t,e=xh(r,1,e.times(s),new r(1));for(var i=t;i--;){var a=e.times(e);e=a.times(a).minus(a).times(8).plus(1)}return r.precision-=t,e}o(i$,"cosine");var mr=(function(){function r(n,s,i){var a,u=0,c=n.length;for(n=n.slice();c--;)a=n[c]*s+u,n[c]=a%i|0,u=a/i|0;return u&&n.unshift(u),n}o(r,"multiplyInteger");function e(n,s,i,a){var u,c;if(i!=a)c=i>a?1:-1;else for(u=c=0;u<i;u++)if(n[u]!=s[u]){c=n[u]>s[u]?1:-1;break}return c}o(e,"compare");function t(n,s,i,a){for(var u=0;i--;)n[i]-=u,u=n[i]<s[i]?1:0,n[i]=u*a+n[i]-s[i];for(;!n[0]&&n.length>1;)n.shift()}return o(t,"subtract"),function(n,s,i,a,u,c){var l,f,h,d,g,m,v,y,w,S,E,x,b,A,k,I,T,V,U,M,ie=n.constructor,Z=n.s==s.s?1:-1,ue=n.d,$=s.d;if(!ue||!ue[0]||!$||!$[0])return new ie(!n.s||!s.s||(ue?$&&ue[0]==$[0]:!$)?NaN:ue&&ue[0]==0||!$?Z*0:Z/0);for(c?(g=1,f=n.e-s.e):(c=Si,g=at,f=jn(n.e/g)-jn(s.e/g)),U=$.length,T=ue.length,w=new ie(Z),S=w.d=[],h=0;$[h]==(ue[h]||0);h++);if($[h]>(ue[h]||0)&&f--,i==null?(A=i=ie.precision,a=ie.rounding):u?A=i+(n.e-s.e)+1:A=i,A<0)S.push(1),m=!0;else{if(A=A/g+2|0,h=0,U==1){for(d=0,$=$[0],A++;(h<T||d)&&A--;h++)k=d*c+(ue[h]||0),S[h]=k/$|0,d=k%$|0;m=d||h<T}else{for(d=c/($[0]+1)|0,d>1&&($=r($,d,c),ue=r(ue,d,c),U=$.length,T=ue.length),I=U,E=ue.slice(0,U),x=E.length;x<U;)E[x++]=0;M=$.slice(),M.unshift(0),V=$[0],$[1]>=c/2&&++V;do d=0,l=e($,E,U,x),l<0?(b=E[0],U!=x&&(b=b*c+(E[1]||0)),d=b/V|0,d>1?(d>=c&&(d=c-1),v=r($,d,c),y=v.length,x=E.length,l=e(v,E,y,x),l==1&&(d--,t(v,U<y?M:$,y,c))):(d==0&&(l=d=1),v=$.slice()),y=v.length,y<x&&v.unshift(0),t(E,v,x,c),l==-1&&(x=E.length,l=e($,E,U,x),l<1&&(d++,t(E,U<x?M:$,x,c))),x=E.length):l===0&&(d++,E=[0]),S[h++]=d,l&&E[0]?E[x++]=ue[I]||0:(E=[ue[I]],x=1);while((I++<T||E[0]!==void 0)&&A--);m=E[0]!==void 0}S[0]||S.shift()}if(g==1)w.e=f,r3=m;else{for(h=1,d=S[0];d>=10;d/=10)h++;w.e=h+f*g-1,et(w,u?i+w.e+1:i,a,m)}return w}})();function et(r,e,t,n){var s,i,a,u,c,l,f,h,d,g=r.constructor;e:if(e!=null){if(h=r.d,!h)return r;for(s=1,u=h[0];u>=10;u/=10)s++;if(i=e-s,i<0)i+=at,a=e,f=h[d=0],c=f/nn(10,s-a-1)%10|0;else if(d=Math.ceil((i+1)/at),u=h.length,d>=u)if(n){for(;u++<=d;)h.push(0);f=c=0,s=1,i%=at,a=i-at+1}else break e;else{for(f=u=h[d],s=1;u>=10;u/=10)s++;i%=at,a=i-at+s,c=a<0?0:f/nn(10,s-a-1)%10|0}if(n=n||e<0||h[d+1]!==void 0||(a<0?f:f%nn(10,s-a-1)),l=t<4?(c||n)&&(t==0||t==(r.s<0?3:2)):c>5||c==5&&(t==4||n||t==6&&(i>0?a>0?f/nn(10,s-a):0:h[d-1])%10&1||t==(r.s<0?8:7)),e<1||!h[0])return h.length=0,l?(e-=r.e+1,h[0]=nn(10,(at-e%at)%at),r.e=-e||0):h[0]=r.e=0,r;if(i==0?(h.length=d,u=1,d--):(h.length=d+1,u=nn(10,at-i),h[d]=a>0?(f/nn(10,s-a)%nn(10,a)|0)*u:0),l)for(;;)if(d==0){for(i=1,a=h[0];a>=10;a/=10)i++;for(a=h[0]+=u,u=1;a>=10;a/=10)u++;i!=u&&(r.e++,h[0]==Si&&(h[0]=1));break}else{if(h[d]+=u,h[d]!=Si)break;h[d--]=0,u=1}for(i=h.length;h[--i]===0;)h.pop()}return pt&&(r.e>g.maxE?(r.d=null,r.e=NaN):r.e<g.minE&&(r.e=0,r.d=[0])),r}o(et,"finalise");function zi(r,e,t){if(!r.isFinite())return l3(r);var n,s=r.e,i=In(r.d),a=i.length;return e?(t&&(n=t-a)>0?i=i.charAt(0)+"."+i.slice(1)+qo(n):a>1&&(i=i.charAt(0)+"."+i.slice(1)),i=i+(r.e<0?"e":"e+")+r.e):s<0?(i="0."+qo(-s-1)+i,t&&(n=t-a)>0&&(i+=qo(n))):s>=a?(i+=qo(s+1-a),t&&(n=t-s-1)>0&&(i=i+"."+qo(n))):((n=s+1)<a&&(i=i.slice(0,n)+"."+i.slice(n)),t&&(n=t-a)>0&&(s+1===a&&(i+="."),i+=qo(n))),i}o(zi,"finiteToString");function qx(r,e){var t=r[0];for(e*=at;t>=10;t/=10)e++;return e}o(qx,"getBase10Exponent");function Mx(r,e,t){if(e>s$)throw pt=!0,t&&(r.precision=t),Error(n3);return et(new r(Ux),e,1,!0)}o(Mx,"getLn10");function Gi(r,e,t){if(e>gC)throw Error(n3);return et(new r(Vx),e,t,!0)}o(Gi,"getPi");function o3(r){var e=r.length-1,t=e*at+1;if(e=r[e],e){for(;e%10==0;e/=10)t--;for(e=r[0];e>=10;e/=10)t++}return t}o(o3,"getPrecision");function qo(r){for(var e="";r--;)e+="0";return e}o(qo,"getZeroString");function u3(r,e,t,n){var s,i=new r(1),a=Math.ceil(n/at+4);for(pt=!1;;){if(t%2&&(i=i.times(e),e3(i.d,a)&&(s=!0)),t=jn(t/2),t===0){t=i.d.length-1,s&&i.d[t]===0&&++i.d[t];break}e=e.times(e),e3(e.d,a)}return pt=!0,i}o(u3,"intPow");function ZO(r){return r.d[r.d.length-1]&1}o(ZO,"isOdd");function c3(r,e,t){for(var n,s,i=new r(e[0]),a=0;++a<e.length;){if(s=new r(e[a]),!s.s){i=s;break}n=i.cmp(s),(n===t||n===0&&i.s===t)&&(i=s)}return i}o(c3,"maxOrMin");function yC(r,e){var t,n,s,i,a,u,c,l=0,f=0,h=0,d=r.constructor,g=d.rounding,m=d.precision;if(!r.d||!r.d[0]||r.e>17)return new d(r.d?r.d[0]?r.s<0?0:1/0:1:r.s?r.s<0?0:r:NaN);for(e==null?(pt=!1,c=m):c=e,u=new d(.03125);r.e>-2;)r=r.times(u),h+=5;for(n=Math.log(nn(2,h))/Math.LN10*2+5|0,c+=n,t=i=a=new d(1),d.precision=c;;){if(i=et(i.times(r),c,1),t=t.times(++f),u=a.plus(mr(i,t,c,1)),In(u.d).slice(0,c)===In(a.d).slice(0,c)){for(s=h;s--;)a=et(a.times(a),c,1);if(e==null)if(l<3&&S0(a.d,c-n,g,l))d.precision=c+=10,t=i=u=new d(1),f=0,l++;else return et(a,d.precision=m,g,pt=!0);else return d.precision=m,a}a=u}}o(yC,"naturalExponential");function Ho(r,e){var t,n,s,i,a,u,c,l,f,h,d,g=1,m=10,v=r,y=v.d,w=v.constructor,S=w.rounding,E=w.precision;if(v.s<0||!y||!y[0]||!v.e&&y[0]==1&&y.length==1)return new w(y&&!y[0]?-1/0:v.s!=1?NaN:y?0:v);if(e==null?(pt=!1,f=E):f=e,w.precision=f+=m,t=In(y),n=t.charAt(0),Math.abs(i=v.e)<15e14){for(;n<7&&n!=1||n==1&&t.charAt(1)>3;)v=v.times(r),t=In(v.d),n=t.charAt(0),g++;i=v.e,n>1?(v=new w("0."+t),i++):v=new w(n+"."+t.slice(1))}else return l=Mx(w,f+2,E).times(i+""),v=Ho(new w(n+"."+t.slice(1)),f-m).plus(l),w.precision=E,e==null?et(v,E,S,pt=!0):v;for(h=v,c=a=v=mr(v.minus(1),v.plus(1),f,1),d=et(v.times(v),f,1),s=3;;){if(a=et(a.times(d),f,1),l=c.plus(mr(a,new w(s),f,1)),In(l.d).slice(0,f)===In(c.d).slice(0,f))if(c=c.times(2),i!==0&&(c=c.plus(Mx(w,f+2,E).times(i+""))),c=mr(c,new w(g),f,1),e==null)if(S0(c.d,f-m,S,u))w.precision=f+=m,l=a=v=mr(h.minus(1),h.plus(1),f,1),d=et(v.times(v),f,1),s=u=1;else return et(c,w.precision=E,S,pt=!0);else return w.precision=E,c;c=l,s+=2}}o(Ho,"naturalLogarithm");function l3(r){return String(r.s*r.s/0)}o(l3,"nonFiniteToString");function Fx(r,e){var t,n,s;for((t=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(t<0&&(t=n),t+=+e.slice(n+1),e=e.substring(0,n)):t<0&&(t=e.length),n=0;e.charCodeAt(n)===48;n++);for(s=e.length;e.charCodeAt(s-1)===48;--s);if(e=e.slice(n,s),e){if(s-=n,r.e=t=t-n-1,r.d=[],n=(t+1)%at,t<0&&(n+=at),n<s){for(n&&r.d.push(+e.slice(0,n)),s-=at;n<s;)r.d.push(+e.slice(n,n+=at));e=e.slice(n),n=at-e.length}else n-=s;for(;n--;)e+="0";r.d.push(+e),pt&&(r.e>r.constructor.maxE?(r.d=null,r.e=NaN):r.e<r.constructor.minE&&(r.e=0,r.d=[0]))}else r.e=0,r.d=[0];return r}o(Fx,"parseDecimal");function a$(r,e){var t,n,s,i,a,u,c,l,f;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),a3.test(e))return Fx(r,e)}else if(e==="Infinity"||e==="NaN")return+e||(r.s=NaN),r.e=NaN,r.d=null,r;if(t$.test(e))t=16,e=e.toLowerCase();else if(e$.test(e))t=2;else if(r$.test(e))t=8;else throw Error(Ko+e);for(i=e.search(/p/i),i>0?(c=+e.slice(i+1),e=e.substring(2,i)):e=e.slice(2),i=e.indexOf("."),a=i>=0,n=r.constructor,a&&(e=e.replace(".",""),u=e.length,i=u-i,s=u3(n,new n(t),i,i*2)),l=Lx(e,t,Si),f=l.length-1,i=f;l[i]===0;--i)l.pop();return i<0?new n(r.s*0):(r.e=qx(l,f),r.d=l,pt=!1,a&&(r=mr(r,s,u*4)),c&&(r=r.times(Math.abs(c)<54?nn(2,c):Eh.pow(2,c))),pt=!0,r)}o(a$,"parseOther");function o$(r,e){var t,n=e.d.length;if(n<3)return e.isZero()?e:xh(r,2,e,e);t=1.4*Math.sqrt(n),t=t>16?16:t|0,e=e.times(1/Hx(5,t)),e=xh(r,2,e,e);for(var s,i=new r(5),a=new r(16),u=new r(20);t--;)s=e.times(e),e=e.times(i.plus(s.times(a.times(s).minus(u))));return e}o(o$,"sine");function xh(r,e,t,n,s){var i,a,u,c,l=1,f=r.precision,h=Math.ceil(f/at);for(pt=!1,c=t.times(t),u=new r(n);;){if(a=mr(u.times(c),new r(e++*e++),f,1),u=s?n.plus(a):n.minus(a),n=mr(a.times(c),new r(e++*e++),f,1),a=u.plus(n),a.d[h]!==void 0){for(i=h;a.d[i]===u.d[i]&&i--;);if(i==-1)break}i=u,u=n,n=a,a=i,l++}return pt=!0,a.d.length=h+1,a}o(xh,"taylorSeries");function Hx(r,e){for(var t=r;--e;)t*=r;return t}o(Hx,"tinyPow");function f3(r,e){var t,n=e.s<0,s=Gi(r,r.precision,1),i=s.times(.5);if(e=e.abs(),e.lte(i))return Va=n?4:1,e;if(t=e.divToInt(s),t.isZero())Va=n?3:2;else{if(e=e.minus(t.times(s)),e.lte(i))return Va=ZO(t)?n?2:3:n?4:1,e;Va=ZO(t)?n?1:4:n?3:2}return e.minus(s).abs()}o(f3,"toLessThanHalfPi");function vC(r,e,t,n){var s,i,a,u,c,l,f,h,d,g=r.constructor,m=t!==void 0;if(m?(is(t,1,$o),n===void 0?n=g.rounding:is(n,0,8)):(t=g.precision,n=g.rounding),!r.isFinite())f=l3(r);else{for(f=zi(r),a=f.indexOf("."),m?(s=2,e==16?t=t*4-3:e==8&&(t=t*3-2)):s=e,a>=0&&(f=f.replace(".",""),d=new g(1),d.e=f.length-a,d.d=Lx(zi(d),10,s),d.e=d.d.length),h=Lx(f,10,s),i=c=h.length;h[--c]==0;)h.pop();if(!h[0])f=m?"0p+0":"0";else{if(a<0?i--:(r=new g(r),r.d=h,r.e=i,r=mr(r,d,t,n,0,s),h=r.d,i=r.e,l=r3),a=h[t],u=s/2,l=l||h[t+1]!==void 0,l=n<4?(a!==void 0||l)&&(n===0||n===(r.s<0?3:2)):a>u||a===u&&(n===4||l||n===6&&h[t-1]&1||n===(r.s<0?8:7)),h.length=t,l)for(;++h[--t]>s-1;)h[t]=0,t||(++i,h.unshift(1));for(c=h.length;!h[c-1];--c);for(a=0,f="";a<c;a++)f+=dC.charAt(h[a]);if(m){if(c>1)if(e==16||e==8){for(a=e==16?4:3,--c;c%a;c++)f+="0";for(h=Lx(f,s,e),c=h.length;!h[c-1];--c);for(a=1,f="1.";a<c;a++)f+=dC.charAt(h[a])}else f=f.charAt(0)+"."+f.slice(1);f=f+(i<0?"p":"p+")+i}else if(i<0){for(;++i;)f="0"+f;f="0."+f}else if(++i>c)for(i-=c;i--;)f+="0";else i<c&&(f=f.slice(0,i)+"."+f.slice(i))}f=(e==16?"0x":e==2?"0b":e==8?"0o":"")+f}return r.s<0?"-"+f:f}o(vC,"toStringBinary");function e3(r,e){if(r.length>e)return r.length=e,!0}o(e3,"truncate");function u$(r){return new this(r).abs()}o(u$,"abs");function c$(r){return new this(r).acos()}o(c$,"acos");function l$(r){return new this(r).acosh()}o(l$,"acosh");function f$(r,e){return new this(r).plus(e)}o(f$,"add");function h$(r){return new this(r).asin()}o(h$,"asin");function p$(r){return new this(r).asinh()}o(p$,"asinh");function d$(r){return new this(r).atan()}o(d$,"atan");function m$(r){return new this(r).atanh()}o(m$,"atanh");function g$(r,e){r=new this(r),e=new this(e);var t,n=this.precision,s=this.rounding,i=n+4;return!r.s||!e.s?t=new this(NaN):!r.d&&!e.d?(t=Gi(this,i,1).times(e.s>0?.25:.75),t.s=r.s):!e.d||r.isZero()?(t=e.s<0?Gi(this,n,s):new this(0),t.s=r.s):!r.d||e.isZero()?(t=Gi(this,i,1).times(.5),t.s=r.s):e.s<0?(this.precision=i,this.rounding=1,t=this.atan(mr(r,e,i,1)),e=Gi(this,i,1),this.precision=n,this.rounding=s,t=r.s<0?t.minus(e):t.plus(e)):t=this.atan(mr(r,e,i,1)),t}o(g$,"atan2");function y$(r){return new this(r).cbrt()}o(y$,"cbrt");function v$(r){return et(r=new this(r),r.e+1,2)}o(v$,"ceil");function x$(r,e,t){return new this(r).clamp(e,t)}o(x$,"clamp");function E$(r){if(!r||typeof r!="object")throw Error(jx+"Object expected");var e,t,n,s=r.defaults===!0,i=["precision",1,$o,"rounding",0,8,"toExpNeg",-vh,0,"toExpPos",0,vh,"maxE",0,vh,"minE",-vh,0,"modulo",0,9];for(e=0;e<i.length;e+=3)if(t=i[e],s&&(this[t]=mC[t]),(n=r[t])!==void 0)if(jn(n)===n&&n>=i[e+1]&&n<=i[e+2])this[t]=n;else throw Error(Ko+t+": "+n);if(t="crypto",s&&(this[t]=mC[t]),(n=r[t])!==void 0)if(n===!0||n===!1||n===0||n===1)if(n)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[t]=!0;else throw Error(s3);else this[t]=!1;else throw Error(Ko+t+": "+n);return this}o(E$,"config");function w$(r){return new this(r).cos()}o(w$,"cos");function b$(r){return new this(r).cosh()}o(b$,"cosh");function h3(r){var e,t,n;function s(i){var a,u,c,l=this;if(!(l instanceof s))return new s(i);if(l.constructor=s,t3(i)){l.s=i.s,pt?!i.d||i.e>s.maxE?(l.e=NaN,l.d=null):i.e<s.minE?(l.e=0,l.d=[0]):(l.e=i.e,l.d=i.d.slice()):(l.e=i.e,l.d=i.d?i.d.slice():i.d);return}if(c=typeof i,c==="number"){if(i===0){l.s=1/i<0?-1:1,l.e=0,l.d=[0];return}if(i<0?(i=-i,l.s=-1):l.s=1,i===~~i&&i<1e7){for(a=0,u=i;u>=10;u/=10)a++;pt?a>s.maxE?(l.e=NaN,l.d=null):a<s.minE?(l.e=0,l.d=[0]):(l.e=a,l.d=[i]):(l.e=a,l.d=[i]);return}if(i*0!==0){i||(l.s=NaN),l.e=NaN,l.d=null;return}return Fx(l,i.toString())}if(c==="string")return(u=i.charCodeAt(0))===45?(i=i.slice(1),l.s=-1):(u===43&&(i=i.slice(1)),l.s=1),a3.test(i)?Fx(l,i):a$(l,i);if(c==="bigint")return i<0?(i=-i,l.s=-1):l.s=1,Fx(l,i.toString());throw Error(Ko+i)}if(o(s,"Decimal"),s.prototype=Ne,s.ROUND_UP=0,s.ROUND_DOWN=1,s.ROUND_CEIL=2,s.ROUND_FLOOR=3,s.ROUND_HALF_UP=4,s.ROUND_HALF_DOWN=5,s.ROUND_HALF_EVEN=6,s.ROUND_HALF_CEIL=7,s.ROUND_HALF_FLOOR=8,s.EUCLID=9,s.config=s.set=E$,s.clone=h3,s.isDecimal=t3,s.abs=u$,s.acos=c$,s.acosh=l$,s.add=f$,s.asin=h$,s.asinh=p$,s.atan=d$,s.atanh=m$,s.atan2=g$,s.cbrt=y$,s.ceil=v$,s.clamp=x$,s.cos=w$,s.cosh=b$,s.div=S$,s.exp=A$,s.floor=C$,s.hypot=N$,s.ln=T$,s.log=I$,s.log10=B$,s.log2=D$,s.max=R$,s.min=_$,s.mod=O$,s.mul=P$,s.pow=k$,s.random=L$,s.round=F$,s.sign=U$,s.sin=V$,s.sinh=M$,s.sqrt=j$,s.sub=q$,s.sum=H$,s.tan=K$,s.tanh=$$,s.trunc=X$,r===void 0&&(r={}),r&&r.defaults!==!0)for(n=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],e=0;e<n.length;)r.hasOwnProperty(t=n[e++])||(r[t]=this[t]);return s.config(r),s}o(h3,"clone");function S$(r,e){return new this(r).div(e)}o(S$,"div");function A$(r){return new this(r).exp()}o(A$,"exp");function C$(r){return et(r=new this(r),r.e+1,3)}o(C$,"floor");function N$(){var r,e,t=new this(0);for(pt=!1,r=0;r<arguments.length;)if(e=new this(arguments[r++]),e.d)t.d&&(t=t.plus(e.times(e)));else{if(e.s)return pt=!0,new this(1/0);t=e}return pt=!0,t.sqrt()}o(N$,"hypot");function t3(r){return r instanceof Eh||r&&r.toStringTag===i3||!1}o(t3,"isDecimalInstance");function T$(r){return new this(r).ln()}o(T$,"ln");function I$(r,e){return new this(r).log(e)}o(I$,"log");function D$(r){return new this(r).log(2)}o(D$,"log2");function B$(r){return new this(r).log(10)}o(B$,"log10");function R$(){return c3(this,arguments,-1)}o(R$,"max");function _$(){return c3(this,arguments,1)}o(_$,"min");function O$(r,e){return new this(r).mod(e)}o(O$,"mod");function P$(r,e){return new this(r).mul(e)}o(P$,"mul");function k$(r,e){return new this(r).pow(e)}o(k$,"pow");function L$(r){var e,t,n,s,i=0,a=new this(1),u=[];if(r===void 0?r=this.precision:is(r,1,$o),n=Math.ceil(r/at),this.crypto)if(crypto.getRandomValues)for(e=crypto.getRandomValues(new Uint32Array(n));i<n;)s=e[i],s>=429e7?e[i]=crypto.getRandomValues(new Uint32Array(1))[0]:u[i++]=s%1e7;else if(crypto.randomBytes){for(e=crypto.randomBytes(n*=4);i<n;)s=e[i]+(e[i+1]<<8)+(e[i+2]<<16)+((e[i+3]&127)<<24),s>=214e7?crypto.randomBytes(4).copy(e,i):(u.push(s%1e7),i+=4);i=n/4}else throw Error(s3);else for(;i<n;)u[i++]=Math.random()*1e7|0;for(n=u[--i],r%=at,n&&r&&(s=nn(10,at-r),u[i]=(n/s|0)*s);u[i]===0;i--)u.pop();if(i<0)t=0,u=[0];else{for(t=-1;u[0]===0;t-=at)u.shift();for(n=1,s=u[0];s>=10;s/=10)n++;n<at&&(t-=at-n)}return a.e=t,a.d=u,a}o(L$,"random");function F$(r){return et(r=new this(r),r.e+1,this.rounding)}o(F$,"round");function U$(r){return r=new this(r),r.d?r.d[0]?r.s:0*r.s:r.s||NaN}o(U$,"sign");function V$(r){return new this(r).sin()}o(V$,"sin");function M$(r){return new this(r).sinh()}o(M$,"sinh");function j$(r){return new this(r).sqrt()}o(j$,"sqrt");function q$(r,e){return new this(r).sub(e)}o(q$,"sub");function H$(){var r=0,e=arguments,t=new this(e[r]);for(pt=!1;t.s&&++r<e.length;)t=t.plus(e[r]);return pt=!0,et(t,this.precision,this.rounding)}o(H$,"sum");function K$(r){return new this(r).tan()}o(K$,"tan");function $$(r){return new this(r).tanh()}o($$,"tanh");function X$(r){return et(r=new this(r),r.e+1,1)}o(X$,"trunc");Ne[Symbol.for("nodejs.util.inspect.custom")]=Ne.toString;Ne[Symbol.toStringTag]="Decimal";var Eh=Ne.constructor=h3(mC);Ux=new Eh(Ux);Vx=new Eh(Vx);var Kc=class r extends Eh{static{o(this,"Decimal")}static from(e){return new r(e)}static newOrZero(e){return e===void 0?r.from(0):r.from(e)}static newOrUndefined(e){if(e!==void 0)return r.from(e)}};var p3=Rt(require("pdfkit"),1);var xC=class r{static{o(this,"PdfkitPdfBuilder")}defaults={autoFirstPage:!1};doc=new p3.default(this.defaults);constructor(e){e&&this.configure(e)}static new(e){return new r(e)}configure(e){return this.doc.options={...this.doc.options,...e},this}pipe(e){return this.doc.pipe(e),this}end(){return this.doc.end()}restore(){return this.doc.restore(),this}save(){return this.doc.save(),this}stroke(e){return this.doc.stroke(e),this}page(e){return this.doc.addPage(e),this}table(e){return this.doc.table(e),this}text(e,t){let{x:n,y:s,...i}=t??{};return n||s?(this.doc.text(e,n,s,i),this):(this.doc.text(e,t),this)}fontSize(e){return this.doc.fontSize(e),this}font(e,t,n){return typeof t=="string"?(this.doc.font(e,t,n),this):typeof t=="number"?(this.doc.font(e,t),this):(this.doc.font(e),this)}image(e,t,n,s){return typeof t=="number"&&typeof n=="number"?(this.doc.image(e,t,n,s),this):(this.doc.image(e,t),this)}rect(e,t,n,s){return this.doc.rect(e,t,n,s),this}path(e){return this.doc.path(e),this}translate(e,t){return this.doc.translate(e,t),this}scale(e,t){return this.doc.scale(e,t),this}fill(e,t){return this.doc.fill(e,t),this}pageWidth(){return this.doc.page.width}pageHeight(){return this.doc.page.height}heightOfString(e,t){return this.doc.heightOfString(e,t)}widthOfString(e,t){return this.doc.widthOfString(e,t)}pageMargins(){return this.doc.page.margins}currentLineHeight(e){return this.doc.currentLineHeight(e)}x(){return this.doc.x}y(){return this.doc.y}moveDown(e){return this.doc.moveDown(e),this}row(e,...t){let n,s;typeof e=="function"?(n={},s=[e,...t]):(n=e??{},s=t),n.columns??=1;let i=this.y(),a=n.right??0,u=n.left??0,c=n.gap??0,l=this.pageWidth(),f=l-u-a-c*(n.columns-1);n.size??=Array(n.columns).fill(12/n.columns);let h=[];for(let d=0;d<n.columns;d++){let g=n.size[d]/12;h[d]=f*g}for(let d=0,g=u;d<n.columns;d++){let m=d===n.columns-1,v=h[d];if(m&&n.columns>1){let S=l-a-g;S>0&&Math.abs(S-v)>.01&&(v=S)}let y={y:i,x:g,width:v};s[d](y),g+=v,c>0&&!m&&(g+=c)}return this}};var EC=class{static{o(this,"MemoryCacheAdapter")}cache=new Map;async get(e){return Promise.resolve(this.cache.get(e)??null)}has(e){return Promise.resolve(this.cache.has(e))}set(e,t){return this.cache.set(e,t),Promise.resolve(!0)}};var Pk=Rt(require("os"),1),TN=Rt(require("fs"),1),kk=Rt(require("path"),1),Uh=Rt(require("crypto"),1),nu=Rt(Dk(),1);var RW=o(r=>!!r&&typeof r=="object"&&"message"in r,"hasMessageInRecord"),us=o(r=>typeof r=="string"?nr(new Vt(r)):r instanceof Error?nr(new Vt(r.message,{cause:r.cause})):RW(r)?nr(new Vt(r.message)):nr(new Vt("unexpected error")),"leftFromError");var M0=class{static{o(this,"NullCacheAdapter")}async get(e){return Promise.resolve(null)}has(e){return Promise.resolve(!1)}set(e,t){return Promise.resolve(!0)}};var j0=require("os"),ia=require("path");var AN=require("path"),SN=require("module"),b2=require("url");var _W=typeof jest<"u"||process.env.JEST_WORKER_ID!==void 0,Lh,Bk=o(()=>{if(Lh!==void 0)return Lh;if(_W){Lh=void 0;return}try{Lh=new Function("try { return import.meta.url; } catch { return undefined; }")()}catch{Lh=void 0}return Lh},"getImportMetaUrl"),Rk=o(()=>{if(typeof require<"u")return require;let r=Bk();if(r)return(0,SN.createRequire)(r);let e=(0,b2.pathToFileURL)((0,AN.resolve)(process.cwd(),"package.json")).href;return(0,SN.createRequire)(e)},"getRequireFn"),_k=o(()=>{if(typeof __filename<"u")return __filename;let r=Bk();return r?(0,b2.fileURLToPath)(r):(0,AN.resolve)(process.cwd())},"getCurrentFile");var Ps=require("path"),el=require("fs");var Ok=o(()=>typeof process<"u"&&typeof process.versions<"u"&&"electron"in process.versions,"isElectron"),OW=o(()=>{if(!Ok())return null;try{let e=require("electron").app;if(e?.getAppPath&&typeof e.getAppPath=="function")return{getAppPath:e.getAppPath}}catch{}return null},"getElectronApp"),PW=o(()=>{if(!Ok())return null;let r=process;if(r.resourcesPath)return r.resourcesPath;let e=OW();if(e)try{let t=e.getAppPath();if(typeof t=="string")return(0,Ps.dirname)(t.replace(/\.asar$/,""))}catch{}return null},"getElectronResourcesPath"),S2=o((r,{onFound:e,onNotFound:t})=>{let n=PW();if(n){let l=(0,Ps.resolve)(n,"node_modules","nfets",r);if((0,el.existsSync)(l))return e(l);let f=(0,Ps.resolve)(n,"app.asar.unpacked","node_modules","nfets",r);if((0,el.existsSync)(f))return e(f)}let s=_k(),i=s.includes(".asar")?process.cwd():s,a=(0,Ps.resolve)(i,"../../../../"),u=(0,Ps.resolve)(a,r);if((0,el.existsSync)(u))return e(u);let c=i;for(let l=0;l<5;l++){let f=(0,Ps.resolve)(c,r);if((0,el.existsSync)(f))return e(f);let h=(0,Ps.dirname)(c);if(h===c)break;c=h}c=i;for(let l=0;l<5;l++){let f=(0,Ps.resolve)(c,"node_modules","nfets",r);if((0,el.existsSync)(f))return e(f);let h=(0,Ps.dirname)(c);if(h===c)break;c=h}c=i;for(let l=0;l<5;l++){let f=(0,Ps.resolve)(c,r.replace(/^build\//,"Release/"));if((0,el.existsSync)(f))return e(f);let h=(0,Ps.dirname)(c);if(h===c)break;c=h}return t()},"search");var kW=o(r=>{let e=r.replace(/^\\\\\?\\/,"");return(0,ia.resolve)((0,ia.normalize)(e))},"normalizePath"),LW=o(r=>{(0,j0.platform)()==="win32"&&(process.env.PATH=`${(0,ia.dirname)(r)}${ia.delimiter}${process.env.PATH}`)},"addAddonDirToPath"),CN=o(r=>{let e=kW(r);return LW(e),Rk()(e)},"exportRequireModule"),Fh=o(r=>{if(r=`${r}.node`,process.env.NFETS_ADDONS_DIR)return CN((0,ia.join)(process.env.NFETS_ADDONS_DIR,r));let e=`${(0,j0.platform)()}-${(0,j0.arch)()}`;try{return S2(`build/addons/${e}/${r}`,{onFound:o(t=>CN(t),"onFound"),onNotFound:o(()=>{throw new Error(`Addon ${e}/${r} not found`)},"onNotFound")})}catch{return S2(`build/Release/${r}`,{onFound:o(t=>CN(t),"onFound"),onNotFound:o(()=>{throw new Error(`Addon ${e}/${r} not found`)},"onNotFound")})}},"addon");var Ka=class{static{o(this,"ASN1")}extractCertificateInfo(e){let n=e.subject.split(`
|
|
88
|
+
`).reduce((i,a)=>{let[u,c]=a.split("=").map(l=>l.trim());return!u||!c?i:i.set(u,c)},new Map),s=this.oid("2.16.76.1.3.1",e.raw);return{CNPJ:this.oid("2.16.76.1.3.3",e.raw),CPF:s,CN:n.get("CN"),O:n.get("O"),OU:n.get("OU"),ST:n.get("ST"),L:n.get("L"),C:n.get("C")}}oid(e,t){let n=this.marker(e),s=t.indexOf(n);if(s===-1)return;let i=[t.subarray(0,s),t.subarray(s)];if(i.length<=1)return;let u=i[0].subarray(-4),c=u.subarray(-2);u[0]===48?c=u:u[1]===48&&(c=u.subarray(-3));let l=Buffer.concat([c,n,i[1]]),f=this.length(l),h=n.length,d=l.subarray(2+h,2+h+f),g=d.length-c.length-2;if(g<=0||g>d.length)return;let v=d.subarray(-g).toString("utf8");return v.substring(Buffer.from(v).findIndex((y,w)=>v.charCodeAt(w)>=32&&v.charCodeAt(w)<=126))}length(e){return e.length<2?0:e[1]<=127?e[1]:Buffer.from([e[1]&15]).reduce((t,n)=>t<<8|n,0)}marker(e){let t=e.split("."),n=t.slice(2).reduce((s,i)=>{let a=this.base128(s,Number.parseInt(i,10),!0);return s.length=0,s.push(...a),s},[]);return Buffer.from([6,n.length+1,40*Number.parseInt(t[0],10)+Number.parseInt(t[1],10),...n])}base128(e,t,n){let s=[...e];if(t>127){let a=this.base128(e,Math.floor(t/128),!1);a.length=0,s.push(...a)}let i=t%128;return n?s.push(i):s.push(128|i),s}};var A2=class{static{o(this,"WincryptSignerRepository")}async sign(e,t,n){try{let s=Fh("wincrypt_certificate_store"),i=new Ka,{CN:a}=i.extractCertificateInfo(t.certificate),u=await s.sign(a??"",Buffer.from(e),n),c=Buffer.from(u).toString("base64");return await Promise.resolve(Qr(c))}catch(s){return Promise.resolve(us(s))}}};var NN=Rt(require("crypto"),1);var C2=class{static{o(this,"CryptoSignerRepository")}async sign(e,t,n){try{if(!t.privateKey)return nr(new Vt("Certificate private key not found"));let i=NN.default.sign(n,Buffer.from(e),{key:t.privateKey,padding:NN.default.constants.RSA_PKCS1_PADDING}).toString("base64");return await Promise.resolve(Qr(i))}catch(s){return Promise.resolve(us(s))}}};var IN=class{static{o(this,"NativeCertificateRepository")}httpClient;cache;signer;constructor(e,t=new M0,n=Pk.default.platform()==="win32"?new A2:new C2){this.httpClient=e,this.cache=t,this.signer=n}async read(e){try{let{password:t,pfxPathOrBase64:n,publicCertDerBase64:s}=e,i=s?.trim(),a=n?.trim();if(i&&a)return nr(new Vt("Use either pfxPathOrBase64 or publicCertDerBase64, not both"));if(i)try{let w=Buffer.from(i,"base64"),S=new Uh.default.X509Certificate(w);return Qr({ca:[],password:t,certificate:S,privateKey:void 0})}catch(w){return us(w)}if(!a)return nr(new Vt("Certificate path (pfxPathOrBase64) is required"));let u=await this.getPfxBuffer({...e,pfxPathOrBase64:a});if(u.isLeft())return u;let c=nu.default.asn1.fromDer(u.value.toString("binary")),l=nu.default.pkcs12.pkcs12FromAsn1(c,t),{certBag:f}=nu.default.pki.oids,d=l.getBags({bagType:f})[f];if(!d?.length)return nr(new Vt("Cannot read certificate"));let[{cert:g},...m]=d;if(!g)return nr(new Vt("Issuer Certificate not found"));let v=m.reduce((w,{cert:S})=>(S&&w.push(new Uh.default.X509Certificate(nu.default.pki.certificateToPem(S))),w),[]),y=new Uh.default.X509Certificate(nu.default.pki.certificateToPem(g));return Qr({ca:v,password:t,certificate:y,privateKey:this.getPrivateKey(l)})}catch(t){return us(t)}}getPrivateKey(e){let{pkcs8ShroudedKeyBag:t}=nu.default.pki.oids,s=e.getBags({bagType:t})[t]?.[0]?.key;if(s)return Uh.default.createPrivateKey(nu.default.pki.privateKeyToPem(s))}async sign(e,t,n=Ua.SHA1){return this.signer.sign(e,t,n)}getCertificateInfo(e){return new Ka().extractCertificateInfo(e)}getStringCertificate(e){return e.raw.toString("base64")}getStringPrivateKey(e){try{return e.export({type:"pkcs8",format:"pem"})}catch{throw new Vt("Cannot extract private key")}}async getPfxBuffer(e){let{pfxPathOrBase64:t,password:n}=e,s=this.getCacheKey(t,n),i=await this.cache.get(s);if(i)return Qr(i);if(kk.default.isAbsolute(t)||TN.default.existsSync(t))return this.hitBufferOnCache(s,TN.default.readFileSync(t));if(this.isValidRemoteUrl(t))try{let a=await this.httpClient.get(t,{responseType:"arraybuffer"});return await this.hitBufferOnCache(s,Buffer.from(a.data))}catch(a){return us(a)}return this.hitBufferOnCache(s,Buffer.from(t,"base64"))}getCacheKey(e,t){return Uh.default.createHash("sha256").update(`${e}.${t}`).digest("hex")}async hitBufferOnCache(e,t){return await this.cache.set(e,t),Qr(t)}isValidRemoteUrl(e){try{return new URL(e),!0}catch{return!1}}};var oj=Rt(require("os"),1);var N2=Rt(require("dayjs"),1),Lk=Rt(require("dayjs/plugin/utc"),1),Fk=Rt(require("dayjs/plugin/timezone"),1);N2.default.extend(Lk.default);N2.default.extend(Fk.default);var tl=N2.default;var uj=require("crypto"),Rw=require("https"),cj=Rt(KV(),1);function Pg(r,e){return o(function(){return r.apply(e,arguments)},"wrap")}o(Pg,"bind");var{toString:xae}=Object.prototype,{getPrototypeOf:pw}=Object,{iterator:dw,toStringTag:zV}=Symbol,mw=(r=>e=>{let t=xae.call(e);return r[t]||(r[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),Bi=o(r=>(r=r.toLowerCase(),e=>mw(e)===r),"kindOfTest"),gw=o(r=>e=>typeof e===r,"typeOfTest"),{isArray:vp}=Array,yp=gw("undefined");function kg(r){return r!==null&&!yp(r)&&r.constructor!==null&&!yp(r.constructor)&&xs(r.constructor.isBuffer)&&r.constructor.isBuffer(r)}o(kg,"isBuffer");var WV=Bi("ArrayBuffer");function Eae(r){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(r):e=r&&r.buffer&&WV(r.buffer),e}o(Eae,"isArrayBufferView");var wae=gw("string"),xs=gw("function"),JV=gw("number"),Lg=o(r=>r!==null&&typeof r=="object","isObject"),bae=o(r=>r===!0||r===!1,"isBoolean"),hw=o(r=>{if(mw(r)!=="object")return!1;let e=pw(r);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(zV in r)&&!(dw in r)},"isPlainObject"),Sae=o(r=>{if(!Lg(r)||kg(r))return!1;try{return Object.keys(r).length===0&&Object.getPrototypeOf(r)===Object.prototype}catch{return!1}},"isEmptyObject"),Aae=Bi("Date"),Cae=Bi("File"),Nae=o(r=>!!(r&&typeof r.uri<"u"),"isReactNativeBlob"),Tae=o(r=>r&&typeof r.getParts<"u","isReactNative"),Iae=Bi("Blob"),Dae=Bi("FileList"),Bae=o(r=>Lg(r)&&xs(r.pipe),"isStream");function Rae(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}o(Rae,"getGlobal");var $V=Rae(),XV=typeof $V.FormData<"u"?$V.FormData:void 0,_ae=o(r=>{if(!r)return!1;if(XV&&r instanceof XV)return!0;let e=pw(r);if(!e||e===Object.prototype||!xs(r.append))return!1;let t=mw(r);return t==="formdata"||t==="object"&&xs(r.toString)&&r.toString()==="[object FormData]"},"isFormData"),Oae=Bi("URLSearchParams"),[Pae,kae,Lae,Fae]=["ReadableStream","Request","Response","Headers"].map(Bi),Uae=o(r=>r.trim?r.trim():r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),"trim");function Fg(r,e,{allOwnKeys:t=!1}={}){if(r===null||typeof r>"u")return;let n,s;if(typeof r!="object"&&(r=[r]),vp(r))for(n=0,s=r.length;n<s;n++)e.call(null,r[n],n,r);else{if(kg(r))return;let i=t?Object.getOwnPropertyNames(r):Object.keys(r),a=i.length,u;for(n=0;n<a;n++)u=i[n],e.call(null,r[u],u,r)}}o(Fg,"forEach");function YV(r,e){if(kg(r))return null;e=e.toLowerCase();let t=Object.keys(r),n=t.length,s;for(;n-- >0;)if(s=t[n],e===s.toLowerCase())return s;return null}o(YV,"findKey");var yl=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,QV=o(r=>!yp(r)&&r!==yl,"isContextDefined");function ID(){let{caseless:r,skipUndefined:e}=QV(this)&&this||{},t={},n=o((s,i)=>{if(i==="__proto__"||i==="constructor"||i==="prototype")return;let a=r&&YV(t,i)||i;hw(t[a])&&hw(s)?t[a]=ID(t[a],s):hw(s)?t[a]=ID({},s):vp(s)?t[a]=s.slice():(!e||!yp(s))&&(t[a]=s)},"assignValue");for(let s=0,i=arguments.length;s<i;s++)arguments[s]&&Fg(arguments[s],n);return t}o(ID,"merge");var Vae=o((r,e,t,{allOwnKeys:n}={})=>(Fg(e,(s,i)=>{t&&xs(s)?Object.defineProperty(r,i,{value:Pg(s,t),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(r,i,{value:s,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:n}),r),"extend"),Mae=o(r=>(r.charCodeAt(0)===65279&&(r=r.slice(1)),r),"stripBOM"),jae=o((r,e,t,n)=>{r.prototype=Object.create(e.prototype,n),Object.defineProperty(r.prototype,"constructor",{value:r,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(r,"super",{value:e.prototype}),t&&Object.assign(r.prototype,t)},"inherits"),qae=o((r,e,t,n)=>{let s,i,a,u={};if(e=e||{},r==null)return e;do{for(s=Object.getOwnPropertyNames(r),i=s.length;i-- >0;)a=s[i],(!n||n(a,r,e))&&!u[a]&&(e[a]=r[a],u[a]=!0);r=t!==!1&&pw(r)}while(r&&(!t||t(r,e))&&r!==Object.prototype);return e},"toFlatObject"),Hae=o((r,e,t)=>{r=String(r),(t===void 0||t>r.length)&&(t=r.length),t-=e.length;let n=r.indexOf(e,t);return n!==-1&&n===t},"endsWith"),Kae=o(r=>{if(!r)return null;if(vp(r))return r;let e=r.length;if(!JV(e))return null;let t=new Array(e);for(;e-- >0;)t[e]=r[e];return t},"toArray"),$ae=(r=>e=>r&&e instanceof r)(typeof Uint8Array<"u"&&pw(Uint8Array)),Xae=o((r,e)=>{let n=(r&&r[dw]).call(r),s;for(;(s=n.next())&&!s.done;){let i=s.value;e.call(r,i[0],i[1])}},"forEachEntry"),Gae=o((r,e)=>{let t,n=[];for(;(t=r.exec(e))!==null;)n.push(t);return n},"matchAll"),zae=Bi("HTMLFormElement"),Wae=o(r=>r.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,o(function(t,n,s){return n.toUpperCase()+s},"replacer")),"toCamelCase"),GV=(({hasOwnProperty:r})=>(e,t)=>r.call(e,t))(Object.prototype),Jae=Bi("RegExp"),ZV=o((r,e)=>{let t=Object.getOwnPropertyDescriptors(r),n={};Fg(t,(s,i)=>{let a;(a=e(s,i,r))!==!1&&(n[i]=a||s)}),Object.defineProperties(r,n)},"reduceDescriptors"),Yae=o(r=>{ZV(r,(e,t)=>{if(xs(r)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;let n=r[t];if(xs(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},"freezeMethods"),Qae=o((r,e)=>{let t={},n=o(s=>{s.forEach(i=>{t[i]=!0})},"define");return vp(r)?n(r):n(String(r).split(e)),t},"toObjectSet"),Zae=o(()=>{},"noop"),eoe=o((r,e)=>r!=null&&Number.isFinite(r=+r)?r:e,"toFiniteNumber");function toe(r){return!!(r&&xs(r.append)&&r[zV]==="FormData"&&r[dw])}o(toe,"isSpecCompliantForm");var roe=o(r=>{let e=new Array(10),t=o((n,s)=>{if(Lg(n)){if(e.indexOf(n)>=0)return;if(kg(n))return n;if(!("toJSON"in n)){e[s]=n;let i=vp(n)?[]:{};return Fg(n,(a,u)=>{let c=t(a,s+1);!yp(c)&&(i[u]=c)}),e[s]=void 0,i}}return n},"visit");return t(r,0)},"toJSONObject"),noe=Bi("AsyncFunction"),soe=o(r=>r&&(Lg(r)||xs(r))&&xs(r.then)&&xs(r.catch),"isThenable"),eM=((r,e)=>r?setImmediate:e?((t,n)=>(yl.addEventListener("message",({source:s,data:i})=>{s===yl&&i===t&&n.length&&n.shift()()},!1),s=>{n.push(s),yl.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",xs(yl.postMessage)),ioe=typeof queueMicrotask<"u"?queueMicrotask.bind(yl):typeof process<"u"&&process.nextTick||eM,aoe=o(r=>r!=null&&xs(r[dw]),"isIterable"),J={isArray:vp,isArrayBuffer:WV,isBuffer:kg,isFormData:_ae,isArrayBufferView:Eae,isString:wae,isNumber:JV,isBoolean:bae,isObject:Lg,isPlainObject:hw,isEmptyObject:Sae,isReadableStream:Pae,isRequest:kae,isResponse:Lae,isHeaders:Fae,isUndefined:yp,isDate:Aae,isFile:Cae,isReactNativeBlob:Nae,isReactNative:Tae,isBlob:Iae,isRegExp:Jae,isFunction:xs,isStream:Bae,isURLSearchParams:Oae,isTypedArray:$ae,isFileList:Dae,forEach:Fg,merge:ID,extend:Vae,trim:Uae,stripBOM:Mae,inherits:jae,toFlatObject:qae,kindOf:mw,kindOfTest:Bi,endsWith:Hae,toArray:Kae,forEachEntry:Xae,matchAll:Gae,isHTMLForm:zae,hasOwnProperty:GV,hasOwnProp:GV,reduceDescriptors:ZV,freezeMethods:Yae,toObjectSet:Qae,toCamelCase:Wae,noop:Zae,toFiniteNumber:eoe,findKey:YV,global:yl,isContextDefined:QV,isSpecCompliantForm:toe,toJSONObject:roe,isAsyncFn:noe,isThenable:soe,setImmediate:eM,asap:ioe,isIterable:aoe};var Es=class tM extends Error{static{o(this,"AxiosError")}static from(e,t,n,s,i,a){let u=new tM(e.message,t||e.code,n,s,i);return u.cause=e,u.name=e.name,e.status!=null&&u.status==null&&(u.status=e.status),a&&Object.assign(u,a),u}constructor(e,t,n,s,i){super(e),Object.defineProperty(this,"message",{value:e,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),n&&(this.config=n),s&&(this.request=s),i&&(this.response=i,this.status=i.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:J.toJSONObject(this.config),code:this.code,status:this.status}}};Es.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";Es.ERR_BAD_OPTION="ERR_BAD_OPTION";Es.ECONNABORTED="ECONNABORTED";Es.ETIMEDOUT="ETIMEDOUT";Es.ERR_NETWORK="ERR_NETWORK";Es.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";Es.ERR_DEPRECATED="ERR_DEPRECATED";Es.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";Es.ERR_BAD_REQUEST="ERR_BAD_REQUEST";Es.ERR_CANCELED="ERR_CANCELED";Es.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";Es.ERR_INVALID_URL="ERR_INVALID_URL";Es.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";var Pe=Es;var rM=Rt(QN(),1),yw=rM.default;function BD(r){return J.isPlainObject(r)||J.isArray(r)}o(BD,"isVisitable");function nM(r){return J.endsWith(r,"[]")?r.slice(0,-2):r}o(nM,"removeBrackets");function DD(r,e,t){return r?r.concat(e).map(o(function(s,i){return s=nM(s),!t&&i?"["+s+"]":s},"each")).join(t?".":""):e}o(DD,"renderKey");function ooe(r){return J.isArray(r)&&!r.some(BD)}o(ooe,"isFlatArray");var uoe=J.toFlatObject(J,{},null,o(function(e){return/^is[A-Z]/.test(e)},"filter"));function coe(r,e,t){if(!J.isObject(r))throw new TypeError("target must be an object");e=e||new(yw||FormData),t=J.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,o(function(y,w){return!J.isUndefined(w[y])},"defined"));let n=t.metaTokens,s=t.visitor||h,i=t.dots,a=t.indexes,u=t.Blob||typeof Blob<"u"&&Blob,c=t.maxDepth===void 0?100:t.maxDepth,l=u&&J.isSpecCompliantForm(e);if(!J.isFunction(s))throw new TypeError("visitor must be a function");function f(v){if(v===null)return"";if(J.isDate(v))return v.toISOString();if(J.isBoolean(v))return v.toString();if(!l&&J.isBlob(v))throw new Pe("Blob is not supported. Use a Buffer instead.");return J.isArrayBuffer(v)||J.isTypedArray(v)?l&&typeof Blob=="function"?new Blob([v]):Buffer.from(v):v}o(f,"convertValue");function h(v,y,w){let S=v;if(J.isReactNative(e)&&J.isReactNativeBlob(v))return e.append(DD(w,y,i),f(v)),!1;if(v&&!w&&typeof v=="object"){if(J.endsWith(y,"{}"))y=n?y:y.slice(0,-2),v=JSON.stringify(v);else if(J.isArray(v)&&ooe(v)||(J.isFileList(v)||J.endsWith(y,"[]"))&&(S=J.toArray(v)))return y=nM(y),S.forEach(o(function(x,b){!(J.isUndefined(x)||x===null)&&e.append(a===!0?DD([y],b,i):a===null?y:y+"[]",f(x))},"each")),!1}return BD(v)?!0:(e.append(DD(w,y,i),f(v)),!1)}o(h,"defaultVisitor");let d=[],g=Object.assign(uoe,{defaultVisitor:h,convertValue:f,isVisitable:BD});function m(v,y,w=0){if(!J.isUndefined(v)){if(w>c)throw new Pe("Object is too deeply nested ("+w+" levels). Max depth: "+c,Pe.ERR_FORM_DATA_DEPTH_EXCEEDED);if(d.indexOf(v)!==-1)throw Error("Circular reference detected in "+y.join("."));d.push(v),J.forEach(v,o(function(E,x){(!(J.isUndefined(E)||E===null)&&s.call(e,E,J.isString(x)?x.trim():x,y,g))===!0&&m(E,y?y.concat(x):[x],w+1)},"each")),d.pop()}}if(o(m,"build"),!J.isObject(r))throw new TypeError("data must be an object");return m(r),e}o(coe,"toFormData");var Cu=coe;function sM(r){let e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(r).replace(/[!'()~]|%20/g,o(function(n){return e[n]},"replacer"))}o(sM,"encode");function iM(r,e){this._pairs=[],r&&Cu(r,this,e)}o(iM,"AxiosURLSearchParams");var aM=iM.prototype;aM.append=o(function(e,t){this._pairs.push([e,t])},"append");aM.toString=o(function(e){let t=e?function(n){return e.call(this,n,sM)}:sM;return this._pairs.map(o(function(s){return t(s[0])+"="+t(s[1])},"each"),"").join("&")},"toString");var oM=iM;function loe(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}o(loe,"encode");function vl(r,e,t){if(!e)return r;let n=t&&t.encode||loe,s=J.isFunction(t)?{serialize:t}:t,i=s&&s.serialize,a;if(i?a=i(e,s):a=J.isURLSearchParams(e)?e.toString():new oM(e,s).toString(n),a){let u=r.indexOf("#");u!==-1&&(r=r.slice(0,u)),r+=(r.indexOf("?")===-1?"?":"&")+a}return r}o(vl,"buildURL");var foe=class{static{o(this,"InterceptorManager")}constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){J.forEach(this.handlers,o(function(n){n!==null&&e(n)},"forEachHandler"))}},RD=foe;var Nu={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0};var fM=Rt(require("crypto"),1);var uM=Rt(require("url"),1),cM=uM.default.URLSearchParams;var _D="abcdefghijklmnopqrstuvwxyz",lM="0123456789",hM={DIGIT:lM,ALPHA:_D,ALPHA_DIGIT:_D+_D.toUpperCase()+lM},hoe=o((r=16,e=hM.ALPHA_DIGIT)=>{let t="",{length:n}=e,s=new Uint32Array(r);fM.default.randomFillSync(s);for(let i=0;i<r;i++)t+=e[s[i]%n];return t},"generateString"),pM={isNode:!0,classes:{URLSearchParams:cM,FormData:yw,Blob:typeof Blob<"u"&&Blob||null},ALPHABET:hM,generateString:hoe,protocols:["http","https","file","data"]};var kD={};Bx(kD,{hasBrowserEnv:()=>PD,hasStandardBrowserEnv:()=>poe,hasStandardBrowserWebWorkerEnv:()=>doe,navigator:()=>OD,origin:()=>moe});var PD=typeof window<"u"&&typeof document<"u",OD=typeof navigator=="object"&&navigator||void 0,poe=PD&&(!OD||["ReactNative","NativeScript","NS"].indexOf(OD.product)<0),doe=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",moe=PD&&window.location.href||"http://localhost";var Zt={...kD,...pM};function LD(r,e){return Cu(r,new Zt.classes.URLSearchParams,{visitor:o(function(t,n,s,i){return Zt.isNode&&J.isBuffer(t)?(this.append(n,t.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},"visitor"),...e})}o(LD,"toURLEncodedForm");function goe(r){return J.matchAll(/\w+|\[(\w*)]/g,r).map(e=>e[0]==="[]"?"":e[1]||e[0])}o(goe,"parsePropPath");function yoe(r){let e={},t=Object.keys(r),n,s=t.length,i;for(n=0;n<s;n++)i=t[n],e[i]=r[i];return e}o(yoe,"arrayToObject");function voe(r){function e(t,n,s,i){let a=t[i++];if(a==="__proto__")return!0;let u=Number.isFinite(+a),c=i>=t.length;return a=!a&&J.isArray(s)?s.length:a,c?(J.hasOwnProp(s,a)?s[a]=J.isArray(s[a])?s[a].concat(n):[s[a],n]:s[a]=n,!u):((!s[a]||!J.isObject(s[a]))&&(s[a]=[]),e(t,n,s[a],i)&&J.isArray(s[a])&&(s[a]=yoe(s[a])),!u)}if(o(e,"buildPath"),J.isFormData(r)&&J.isFunction(r.entries)){let t={};return J.forEachEntry(r,(n,s)=>{e(goe(n),s,t,0)}),t}return null}o(voe,"formDataToJSON");var vw=voe;var xp=o((r,e)=>r!=null&&J.hasOwnProp(r,e)?r[e]:void 0,"own");function xoe(r,e,t){if(J.isString(r))try{return(e||JSON.parse)(r),J.trim(r)}catch(n){if(n.name!=="SyntaxError")throw n}return(t||JSON.stringify)(r)}o(xoe,"stringifySafely");var FD={transitional:Nu,adapter:["xhr","http","fetch"],transformRequest:[o(function(e,t){let n=t.getContentType()||"",s=n.indexOf("application/json")>-1,i=J.isObject(e);if(i&&J.isHTMLForm(e)&&(e=new FormData(e)),J.isFormData(e))return s?JSON.stringify(vw(e)):e;if(J.isArrayBuffer(e)||J.isBuffer(e)||J.isStream(e)||J.isFile(e)||J.isBlob(e)||J.isReadableStream(e))return e;if(J.isArrayBufferView(e))return e.buffer;if(J.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let u;if(i){let c=xp(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return LD(e,c).toString();if((u=J.isFileList(e))||n.indexOf("multipart/form-data")>-1){let l=xp(this,"env"),f=l&&l.FormData;return Cu(u?{"files[]":e}:e,f&&new f,c)}}return i||s?(t.setContentType("application/json",!1),xoe(e)):e},"transformRequest")],transformResponse:[o(function(e){let t=xp(this,"transitional")||FD.transitional,n=t&&t.forcedJSONParsing,s=xp(this,"responseType"),i=s==="json";if(J.isResponse(e)||J.isReadableStream(e))return e;if(e&&J.isString(e)&&(n&&!s||i)){let u=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e,xp(this,"parseReviver"))}catch(c){if(u)throw c.name==="SyntaxError"?Pe.from(c,Pe.ERR_BAD_RESPONSE,this,null,xp(this,"response")):c}}return e},"transformResponse")],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Zt.classes.FormData,Blob:Zt.classes.Blob},validateStatus:o(function(e){return e>=200&&e<300},"validateStatus"),headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};J.forEach(["delete","get","head","post","put","patch"],r=>{FD.headers[r]={}});var Ep=FD;var Eoe=J.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),dM=o((r=>{let e={},t,n,s;return r&&r.split(`
|
|
89
89
|
`).forEach(o(function(a){s=a.indexOf(":"),t=a.substring(0,s).trim().toLowerCase(),n=a.substring(s+1).trim(),!(!t||e[t]&&Eoe[t])&&(t==="set-cookie"?e[t]?e[t].push(n):e[t]=[n]:e[t]=e[t]?e[t]+", "+n:n)},"parser")),e}),"default");var mM=Symbol("internals"),woe=/[^\x09\x20-\x7E\x80-\xFF]/g;function boe(r){let e=0,t=r.length;for(;e<t;){let n=r.charCodeAt(e);if(n!==9&&n!==32)break;e+=1}for(;t>e;){let n=r.charCodeAt(t-1);if(n!==9&&n!==32)break;t-=1}return e===0&&t===r.length?r:r.slice(e,t)}o(boe,"trimSPorHTAB");function Ug(r){return r&&String(r).trim().toLowerCase()}o(Ug,"normalizeHeader");function Soe(r){return boe(r.replace(woe,""))}o(Soe,"sanitizeHeaderValue");function xw(r){return r===!1||r==null?r:J.isArray(r)?r.map(xw):Soe(String(r))}o(xw,"normalizeValue");function Aoe(r){let e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,n;for(;n=t.exec(r);)e[n[1]]=n[2];return e}o(Aoe,"parseTokens");var Coe=o(r=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(r.trim()),"isValidHeaderName");function UD(r,e,t,n,s){if(J.isFunction(n))return n.call(this,e,t);if(s&&(e=t),!!J.isString(e)){if(J.isString(n))return e.indexOf(n)!==-1;if(J.isRegExp(n))return n.test(e)}}o(UD,"matchHeaderValue");function Noe(r){return r.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}o(Noe,"formatHeader");function Toe(r,e){let t=J.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(r,n+t,{value:o(function(s,i,a){return this[n].call(this,e,s,i,a)},"value"),configurable:!0})})}o(Toe,"buildAccessors");var Ew=class{static{o(this,"AxiosHeaders")}constructor(e){e&&this.set(e)}set(e,t,n){let s=this;function i(u,c,l){let f=Ug(c);if(!f)throw new Error("header name must be a non-empty string");let h=J.findKey(s,f);(!h||s[h]===void 0||l===!0||l===void 0&&s[h]!==!1)&&(s[h||c]=xw(u))}o(i,"setHeader");let a=o((u,c)=>J.forEach(u,(l,f)=>i(l,f,c)),"setHeaders");if(J.isPlainObject(e)||e instanceof this.constructor)a(e,t);else if(J.isString(e)&&(e=e.trim())&&!Coe(e))a(dM(e),t);else if(J.isObject(e)&&J.isIterable(e)){let u={},c,l;for(let f of e){if(!J.isArray(f))throw TypeError("Object iterator must return a key-value pair");u[l=f[0]]=(c=u[l])?J.isArray(c)?[...c,f[1]]:[c,f[1]]:f[1]}a(u,t)}else e!=null&&i(t,e,n);return this}get(e,t){if(e=Ug(e),e){let n=J.findKey(this,e);if(n){let s=this[n];if(!t)return s;if(t===!0)return Aoe(s);if(J.isFunction(t))return t.call(this,s,n);if(J.isRegExp(t))return t.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Ug(e),e){let n=J.findKey(this,e);return!!(n&&this[n]!==void 0&&(!t||UD(this,this[n],n,t)))}return!1}delete(e,t){let n=this,s=!1;function i(a){if(a=Ug(a),a){let u=J.findKey(n,a);u&&(!t||UD(n,n[u],u,t))&&(delete n[u],s=!0)}}return o(i,"deleteHeader"),J.isArray(e)?e.forEach(i):i(e),s}clear(e){let t=Object.keys(this),n=t.length,s=!1;for(;n--;){let i=t[n];(!e||UD(this,this[i],i,e,!0))&&(delete this[i],s=!0)}return s}normalize(e){let t=this,n={};return J.forEach(this,(s,i)=>{let a=J.findKey(n,i);if(a){t[a]=xw(s),delete t[i];return}let u=e?Noe(i):String(i).trim();u!==i&&delete t[i],t[u]=xw(s),n[u]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let t=Object.create(null);return J.forEach(this,(n,s)=>{n!=null&&n!==!1&&(t[s]=e&&J.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(`
|
|
90
90
|
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){let n=new this(e);return t.forEach(s=>n.set(s)),n}static accessor(e){let n=(this[mM]=this[mM]={accessors:{}}).accessors,s=this.prototype;function i(a){let u=Ug(a);n[u]||(Toe(s,a),n[u]=!0)}return o(i,"defineAccessor"),J.isArray(e)?e.forEach(i):i(e),this}};Ew.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);J.reduceDescriptors(Ew.prototype,({value:r},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:o(()=>r,"get"),set(n){this[t]=n}}});J.freezeMethods(Ew);var _r=Ew;function Vg(r,e){let t=this||Ep,n=e||t,s=_r.from(n.headers),i=n.data;return J.forEach(r,o(function(u){i=u.call(t,i,s.normalize(),e?e.status:void 0)},"transform")),s.normalize(),i}o(Vg,"transformData");function Mg(r){return!!(r&&r.__CANCEL__)}o(Mg,"isCancel");var Ioe=class extends Pe{static{o(this,"CanceledError")}constructor(e,t,n){super(e??"canceled",Pe.ERR_CANCELED,t,n),this.name="CanceledError",this.__CANCEL__=!0}},Fs=Ioe;function ga(r,e,t){let n=t.config.validateStatus;!t.status||!n||n(t.status)?r(t):e(new Pe("Request failed with status code "+t.status,[Pe.ERR_BAD_REQUEST,Pe.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}o(ga,"settle");function VD(r){return typeof r!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(r)}o(VD,"isAbsoluteURL");function MD(r,e){return e?r.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):r}o(MD,"combineURLs");function xl(r,e,t){let n=!VD(e);return r&&(n||t===!1)?MD(r,e):e}o(xl,"buildFullPath");var Doe={ftp:21,gopher:70,http:80,https:443,ws:80,wss:443};function Boe(r){try{return new URL(r)}catch{return null}}o(Boe,"parseUrl");function gM(r){var e=(typeof r=="string"?Boe(r):r)||{},t=e.protocol,n=e.host,s=e.port;if(typeof n!="string"||!n||typeof t!="string"||(t=t.split(":",1)[0],n=n.replace(/:\d*$/,""),s=parseInt(s)||Doe[t]||0,!Roe(n,s)))return"";var i=jD(t+"_proxy")||jD("all_proxy");return i&&i.indexOf("://")===-1&&(i=t+"://"+i),i}o(gM,"getProxyForUrl");function Roe(r,e){var t=jD("no_proxy").toLowerCase();return t?t==="*"?!1:t.split(/[,\s]/).every(function(n){if(!n)return!0;var s=n.match(/^(.+):(\d+)$/),i=s?s[1]:n,a=s?parseInt(s[2]):0;return a&&a!==e?!0:/^[.*]/.test(i)?(i.charAt(0)==="*"&&(i=i.slice(1)),!r.endsWith(i)):r!==i}):!0}o(Roe,"shouldProxy");function jD(r){return process.env[r.toLowerCase()]||process.env[r.toUpperCase()]||""}o(jD,"getEnv");var LM=Rt(require("http"),1),FM=Rt(require("https"),1),zD=Rt(require("http2"),1),WD=Rt(require("util"),1),GD=require("path"),UM=Rt(fT(),1),ro=Rt(require("zlib"),1);var El="1.15.2";function jg(r){let e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(r);return e&&e[1]||""}o(jg,"parseProtocol");var _oe=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function qD(r,e,t){let n=t&&t.Blob||Zt.classes.Blob,s=jg(r);if(e===void 0&&n&&(e=!0),s==="data"){r=s.length?r.slice(s.length+1):r;let i=_oe.exec(r);if(!i)throw new Pe("Invalid URL",Pe.ERR_INVALID_URL);let a=i[1],u=i[2],c=i[3],l=Buffer.from(decodeURIComponent(c),u?"base64":"utf8");if(e){if(!n)throw new Pe("Blob is not supported",Pe.ERR_NOT_SUPPORT);return new n([l],{type:a})}return l}throw new Pe("Unsupported protocol "+s,Pe.ERR_NOT_SUPPORT)}o(qD,"fromDataURI");var ii=Rt(require("stream"),1);var yM=Rt(require("stream"),1);var HD=Symbol("internals"),Ooe=class extends yM.default.Transform{static{o(this,"AxiosTransformStream")}constructor(e){e=J.toFlatObject(e,{maxRate:0,chunkSize:64*1024,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,(n,s)=>!J.isUndefined(s[n])),super({readableHighWaterMark:e.chunkSize});let t=this[HD]={timeWindow:e.timeWindow,chunkSize:e.chunkSize,maxRate:e.maxRate,minChunkSize:e.minChunkSize,bytesSeen:0,isCaptured:!1,notifiedBytesLoaded:0,ts:Date.now(),bytes:0,onReadCallback:null};this.on("newListener",n=>{n==="progress"&&(t.isCaptured||(t.isCaptured=!0))})}_read(e){let t=this[HD];return t.onReadCallback&&t.onReadCallback(),super._read(e)}_transform(e,t,n){let s=this[HD],i=s.maxRate,a=this.readableHighWaterMark,u=s.timeWindow,c=1e3/u,l=i/c,f=s.minChunkSize!==!1?Math.max(s.minChunkSize,l*.01):0,h=o((g,m)=>{let v=Buffer.byteLength(g);s.bytesSeen+=v,s.bytes+=v,s.isCaptured&&this.emit("progress",s.bytesSeen),this.push(g)?process.nextTick(m):s.onReadCallback=()=>{s.onReadCallback=null,process.nextTick(m)}},"pushChunk"),d=o((g,m)=>{let v=Buffer.byteLength(g),y=null,w=a,S,E=0;if(i){let x=Date.now();(!s.ts||(E=x-s.ts)>=u)&&(s.ts=x,S=l-s.bytes,s.bytes=S<0?-S:0,E=0),S=l-s.bytes}if(i){if(S<=0)return setTimeout(()=>{m(null,g)},u-E);S<w&&(w=S)}w&&v>w&&v-w>f&&(y=g.subarray(w),g=g.subarray(0,w)),h(g,y?()=>{process.nextTick(m,null,y)}:m)},"transformChunk");d(e,o(function g(m,v){if(m)return n(m);v?d(v,g):n(null)},"transformNextChunk"))}},KD=Ooe;var VM=require("events");var xM=Rt(require("util"),1),EM=require("stream");var{asyncIterator:vM}=Symbol,Poe=o(async function*(r){r.stream?yield*r.stream():r.arrayBuffer?yield await r.arrayBuffer():r[vM]?yield*r[vM]():yield r},"readBlob"),ww=Poe;var koe=Zt.ALPHABET.ALPHA_DIGIT+"-_",qg=typeof TextEncoder=="function"?new TextEncoder:new xM.default.TextEncoder,wl=`\r
|
|
91
91
|
`,Loe=qg.encode(wl),Foe=2,Uoe=class{static{o(this,"FormDataPart")}constructor(e,t){let{escapeName:n}=this.constructor,s=J.isString(t),i=`Content-Disposition: form-data; name="${n(e)}"${!s&&t.name?`; filename="${n(t.name)}"`:""}${wl}`;if(s)t=qg.encode(String(t).replace(/\r?\n|\r\n?/g,wl));else{let a=String(t.type||"application/octet-stream").replace(/[\r\n]/g,"");i+=`Content-Type: ${a}${wl}`}this.headers=qg.encode(i+wl),this.contentLength=s?t.byteLength:t.size,this.size=this.headers.byteLength+this.contentLength+Foe,this.name=e,this.value=t}async*encode(){yield this.headers;let{value:e}=this;J.isTypedArray(e)?yield e:yield*ww(e),yield Loe}static escapeName(e){return String(e).replace(/[\r\n"]/g,t=>({"\r":"%0D","\n":"%0A",'"':"%22"})[t])}},Voe=o((r,e,t)=>{let{tag:n="form-data-boundary",size:s=25,boundary:i=n+"-"+Zt.generateString(s,koe)}=t||{};if(!J.isFormData(r))throw TypeError("FormData instance required");if(i.length<1||i.length>70)throw Error("boundary must be 10-70 characters long");let a=qg.encode("--"+i+wl),u=qg.encode("--"+i+"--"+wl),c=u.byteLength,l=Array.from(r.entries()).map(([h,d])=>{let g=new Uoe(h,d);return c+=g.size,g});c+=a.byteLength*l.length,c=J.toFiniteNumber(c);let f={"Content-Type":`multipart/form-data; boundary=${i}`};return Number.isFinite(c)&&(f["Content-Length"]=c),e&&e(f),EM.Readable.from((async function*(){for(let h of l)yield a,yield*h.encode();yield u})())},"formDataToStream"),wM=Voe;var bM=Rt(require("stream"),1);var Moe=class extends bM.default.Transform{static{o(this,"ZlibHeaderTransformStream")}__transform(e,t,n){this.push(e),n()}_transform(e,t,n){if(e.length!==0&&(this._transform=this.__transform,e[0]!==120)){let s=Buffer.alloc(2);s[0]=120,s[1]=156,this.push(s,t)}this.__transform(e,t,n)}},SM=Moe;var joe=o((r,e)=>J.isAsyncFn(r)?function(...t){let n=t.pop();r.apply(this,t).then(s=>{try{e?n(null,...e(s)):n(null,s)}catch(i){n(i)}},n)}:r,"callbackify"),AM=joe;var qoe=new Set(["localhost"]),TM=o(r=>{let e=r.split(".");return e.length!==4||e[0]!=="127"?!1:e.every(t=>/^\d+$/.test(t)&&Number(t)>=0&&Number(t)<=255)},"isIPv4Loopback"),Hoe=o(r=>{if(r==="::1")return!0;let e=r.match(/^::ffff:(\d+\.\d+\.\d+\.\d+)$/i);if(e)return TM(e[1]);let t=r.match(/^::ffff:([0-9a-f]{1,4}):([0-9a-f]{1,4})$/i);if(t){let s=parseInt(t[1],16);return s>=32512&&s<=32767}let n=r.split(":");if(n.length===8){for(let s=0;s<7;s++)if(!/^0+$/.test(n[s]))return!1;return/^0*1$/.test(n[7])}return!1},"isIPv6Loopback"),CM=o(r=>r?qoe.has(r)||TM(r)?!0:Hoe(r):!1,"isLoopback"),Koe={http:80,https:443,ws:80,wss:443,ftp:21},$oe=o(r=>{let e=r,t=0;if(e.charAt(0)==="["){let i=e.indexOf("]");if(i!==-1){let a=e.slice(1,i),u=e.slice(i+1);return u.charAt(0)===":"&&/^\d+$/.test(u.slice(1))&&(t=Number.parseInt(u.slice(1),10)),[a,t]}}let n=e.indexOf(":"),s=e.lastIndexOf(":");return n!==-1&&n===s&&/^\d+$/.test(e.slice(s+1))&&(t=Number.parseInt(e.slice(s+1),10),e=e.slice(0,s)),[e,t]},"parseNoProxyEntry"),NM=o(r=>r&&(r.charAt(0)==="["&&r.charAt(r.length-1)==="]"&&(r=r.slice(1,-1)),r.replace(/\.+$/,"")),"normalizeNoProxyHost");function $D(r){let e;try{e=new URL(r)}catch{return!1}let t=(process.env.no_proxy||process.env.NO_PROXY||"").toLowerCase();if(!t)return!1;if(t==="*")return!0;let n=Number.parseInt(e.port,10)||Koe[e.protocol.split(":",1)[0]]||0,s=NM(e.hostname.toLowerCase());return t.split(/[\s,]+/).some(i=>{if(!i)return!1;let[a,u]=$oe(i);return a=NM(a),!a||u&&u!==n?!1:(a.charAt(0)==="*"&&(a=a.slice(1)),a.charAt(0)==="."?s.endsWith(a):s===a||CM(s)&&CM(a))})}o($D,"shouldBypassProxy");function Xoe(r,e){r=r||10;let t=new Array(r),n=new Array(r),s=0,i=0,a;return e=e!==void 0?e:1e3,o(function(c){let l=Date.now(),f=n[i];a||(a=l),t[s]=c,n[s]=l;let h=i,d=0;for(;h!==s;)d+=t[h++],h=h%r;if(s=(s+1)%r,s===i&&(i=(i+1)%r),l-a<e)return;let g=f&&l-f;return g?Math.round(d*1e3/g):void 0},"push")}o(Xoe,"speedometer");var IM=Xoe;function Goe(r,e){let t=0,n=1e3/e,s,i,a=o((l,f=Date.now())=>{t=f,s=null,i&&(clearTimeout(i),i=null),r(...l)},"invoke");return[o((...l)=>{let f=Date.now(),h=f-t;h>=n?a(l,f):(s=l,i||(i=setTimeout(()=>{i=null,a(s)},n-h)))},"throttled"),o(()=>s&&a(s),"flush")]}o(Goe,"throttle");var DM=Goe;var to=o((r,e,t=3)=>{let n=0,s=IM(50,250);return DM(i=>{let a=i.loaded,u=i.lengthComputable?i.total:void 0,c=u!=null?Math.min(a,u):a,l=Math.max(0,c-n),f=s(l);n=Math.max(n,c);let h={loaded:c,total:u,progress:u?c/u:void 0,bytes:l,rate:f||void 0,estimated:f&&u?(u-c)/f:void 0,event:i,lengthComputable:u!=null,[e?"download":"upload"]:!0};r(h)},t)},"progressEventReducer"),wp=o((r,e)=>{let t=r!=null;return[n=>e[0]({lengthComputable:t,total:r,loaded:n}),e[1]]},"progressEventDecorator"),bp=o(r=>(...e)=>J.asap(()=>r(...e)),"asyncDecorator");function XD(r){if(!r||typeof r!="string"||!r.startsWith("data:"))return 0;let e=r.indexOf(",");if(e<0)return 0;let t=r.slice(5,e),n=r.slice(e+1);if(/;base64/i.test(t)){let i=n.length,a=n.length;for(let d=0;d<a;d++)if(n.charCodeAt(d)===37&&d+2<a){let g=n.charCodeAt(d+1),m=n.charCodeAt(d+2);(g>=48&&g<=57||g>=65&&g<=70||g>=97&&g<=102)&&(m>=48&&m<=57||m>=65&&m<=70||m>=97&&m<=102)&&(i-=2,d+=2)}let u=0,c=a-1,l=o(d=>d>=2&&n.charCodeAt(d-2)===37&&n.charCodeAt(d-1)===51&&(n.charCodeAt(d)===68||n.charCodeAt(d)===100),"tailIsPct3D");c>=0&&(n.charCodeAt(c)===61?(u++,c--):l(c)&&(u++,c-=3)),u===1&&c>=0&&(n.charCodeAt(c)===61||l(c))&&u++;let h=Math.floor(i/4)*3-(u||0);return h>0?h:0}return Buffer.byteLength(n,"utf8")}o(XD,"estimateDataURLDecodedBytes");var BM={flush:ro.default.constants.Z_SYNC_FLUSH,finishFlush:ro.default.constants.Z_SYNC_FLUSH},zoe={flush:ro.default.constants.BROTLI_OPERATION_FLUSH,finishFlush:ro.default.constants.BROTLI_OPERATION_FLUSH},RM=J.isFunction(ro.default.createBrotliDecompress),{http:Woe,https:Joe}=UM.default,Yoe=/https:?/,_M=Symbol("axios.http.socketListener"),bw=Symbol("axios.http.currentReq"),OM=Zt.protocols.map(r=>r+":"),PM=o((r,[e,t])=>(r.on("end",t).on("error",t),e),"flushOnFinish"),Qoe=class{static{o(this,"Http2Sessions")}constructor(){this.sessions=Object.create(null)}getSession(e,t){t=Object.assign({sessionTimeout:1e3},t);let n=this.sessions[e];if(n){let f=n.length;for(let h=0;h<f;h++){let[d,g]=n[h];if(!d.destroyed&&!d.closed&&WD.default.isDeepStrictEqual(g,t))return d}}let s=zD.default.connect(e,t),i,a=o(()=>{if(i)return;i=!0;let f=n,h=f.length,d=h;for(;d--;)if(f[d][0]===s){h===1?delete this.sessions[e]:f.splice(d,1),s.closed||s.close();return}},"removeSession"),u=s.request,{sessionTimeout:c}=t;if(c!=null){let f,h=0;s.request=function(){let d=u.apply(this,arguments);return h++,f&&(clearTimeout(f),f=null),d.once("close",()=>{--h||(f=setTimeout(()=>{f=null,a()},c))}),d}}s.once("close",a);let l=[s,t];return n?n.push(l):n=this.sessions[e]=[l],s}},Zoe=new Qoe;function eue(r,e){r.beforeRedirects.proxy&&r.beforeRedirects.proxy(r),r.beforeRedirects.config&&r.beforeRedirects.config(r,e)}o(eue,"dispatchBeforeRedirect");function MM(r,e,t){let n=e;if(!n&&n!==!1){let s=gM(t);s&&($D(t)||(n=new URL(s)))}if(n){if(n.username&&(n.auth=(n.username||"")+":"+(n.password||"")),n.auth){if(!!(n.auth.username||n.auth.password))n.auth=(n.auth.username||"")+":"+(n.auth.password||"");else if(typeof n.auth=="object")throw new Pe("Invalid proxy authorization",Pe.ERR_BAD_OPTION,{proxy:n});let a=Buffer.from(n.auth,"utf8").toString("base64");r.headers["Proxy-Authorization"]="Basic "+a}r.headers.host=r.hostname+(r.port?":"+r.port:"");let s=n.hostname||n.host;r.hostname=s,r.host=s,r.port=n.port,r.path=t,n.protocol&&(r.protocol=n.protocol.includes(":")?n.protocol:`${n.protocol}:`)}r.beforeRedirects.proxy=o(function(i){MM(i,e,i.href)},"beforeRedirect")}o(MM,"setProxy");var tue=typeof process<"u"&&J.kindOf(process)==="process",rue=o(r=>new Promise((e,t)=>{let n,s,i=o((c,l)=>{s||(s=!0,n&&n(c,l))},"done"),a=o(c=>{i(c),e(c)},"_resolve"),u=o(c=>{i(c,!0),t(c)},"_reject");r(a,u,c=>n=c).catch(u)}),"wrapAsync"),nue=o(({address:r,family:e})=>{if(!J.isString(r))throw TypeError("address must be a string");return{address:r,family:e||(r.indexOf(".")<0?6:4)}},"resolveFamily"),kM=o((r,e)=>nue(J.isObject(r)?r:{address:r,family:e}),"buildAddressEntry"),sue={request(r,e){let t=r.protocol+"//"+r.hostname+":"+(r.port||(r.protocol==="https:"?443:80)),{http2Options:n,headers:s}=r,i=Zoe.getSession(t,n),{HTTP2_HEADER_SCHEME:a,HTTP2_HEADER_METHOD:u,HTTP2_HEADER_PATH:c,HTTP2_HEADER_STATUS:l}=zD.default.constants,f={[a]:r.protocol.replace(":",""),[u]:r.method,[c]:r.path};J.forEach(s,(d,g)=>{g.charAt(0)!==":"&&(f[g]=d)});let h=i.request(f);return h.once("response",d=>{let g=h;d=Object.assign({},d);let m=d[l];delete d[l],g.headers=d,g.statusCode=+m,e(g)}),h}},jM=tue&&o(function(e){return rue(o(async function(n,s,i){let a=o(ee=>J.hasOwnProp(e,ee)?e[ee]:void 0,"own"),u=a("data"),c=a("lookup"),l=a("family"),f=a("httpVersion");f===void 0&&(f=1);let h=a("http2Options"),d=a("responseType"),g=a("responseEncoding"),m=e.method.toUpperCase(),v,y=!1,w;if(f=+f,Number.isNaN(f))throw TypeError(`Invalid protocol version: '${e.httpVersion}' is not a number`);if(f!==1&&f!==2)throw TypeError(`Unsupported protocol version '${f}'`);let S=f===2;if(c){let ee=AM(c,le=>J.isArray(le)?le:[le]);c=o((le,Ae,Ie)=>{ee(le,Ae,(_,D,Y)=>{if(_)return Ie(_);let q=J.isArray(D)?D.map(Oe=>kM(Oe)):[kM(D,Y)];Ae.all?Ie(_,q):Ie(_,q[0].address,q[0].family)})},"lookup")}let E=new VM.EventEmitter;function x(ee){try{E.emit("abort",!ee||ee.type?new Fs(null,e,w):ee)}catch(le){console.warn("emit error",le)}}o(x,"abort"),E.once("abort",s);let b=o(()=>{e.cancelToken&&e.cancelToken.unsubscribe(x),e.signal&&e.signal.removeEventListener("abort",x),E.removeAllListeners()},"onFinished");(e.cancelToken||e.signal)&&(e.cancelToken&&e.cancelToken.subscribe(x),e.signal&&(e.signal.aborted?x():e.signal.addEventListener("abort",x))),i((ee,le)=>{if(v=!0,le){y=!0,b();return}let{data:Ae}=ee;if(Ae instanceof ii.default.Readable||Ae instanceof ii.default.Duplex){let Ie=ii.default.finished(Ae,()=>{Ie(),b()})}else b()});let A=xl(e.baseURL,e.url,e.allowAbsoluteUrls),k=new URL(A,Zt.hasBrowserEnv?Zt.origin:void 0),I=k.protocol||OM[0];if(I==="data:"){if(e.maxContentLength>-1){let le=String(e.url||A||"");if(XD(le)>e.maxContentLength)return s(new Pe("maxContentLength size of "+e.maxContentLength+" exceeded",Pe.ERR_BAD_RESPONSE,e))}let ee;if(m!=="GET")return ga(n,s,{status:405,statusText:"method not allowed",headers:{},config:e});try{ee=qD(e.url,d==="blob",{Blob:e.env&&e.env.Blob})}catch(le){throw Pe.from(le,Pe.ERR_BAD_REQUEST,e)}return d==="text"?(ee=ee.toString(g),(!g||g==="utf8")&&(ee=J.stripBOM(ee))):d==="stream"&&(ee=ii.default.Readable.from(ee)),ga(n,s,{data:ee,status:200,statusText:"OK",headers:new _r,config:e})}if(OM.indexOf(I)===-1)return s(new Pe("Unsupported protocol "+I,Pe.ERR_BAD_REQUEST,e));let T=_r.from(e.headers).normalize();T.set("User-Agent","axios/"+El,!1);let{onUploadProgress:V,onDownloadProgress:U}=e,M=e.maxRate,ie,Z;if(J.isSpecCompliantForm(u)){let ee=T.getContentType(/boundary=([-_\w\d]{10,70})/i);u=wM(u,le=>{T.set(le)},{tag:`axios-${El}-boundary`,boundary:ee&&ee[1]||void 0})}else if(J.isFormData(u)&&J.isFunction(u.getHeaders)&&u.getHeaders!==Object.prototype.getHeaders){if(T.set(u.getHeaders()),!T.hasContentLength())try{let ee=await WD.default.promisify(u.getLength).call(u);Number.isFinite(ee)&&ee>=0&&T.setContentLength(ee)}catch{}}else if(J.isBlob(u)||J.isFile(u))u.size&&T.setContentType(u.type||"application/octet-stream"),T.setContentLength(u.size||0),u=ii.default.Readable.from(ww(u));else if(u&&!J.isStream(u)){if(!Buffer.isBuffer(u))if(J.isArrayBuffer(u))u=Buffer.from(new Uint8Array(u));else if(J.isString(u))u=Buffer.from(u,"utf-8");else return s(new Pe("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",Pe.ERR_BAD_REQUEST,e));if(T.setContentLength(u.length,!1),e.maxBodyLength>-1&&u.length>e.maxBodyLength)return s(new Pe("Request body larger than maxBodyLength limit",Pe.ERR_BAD_REQUEST,e))}let ue=J.toFiniteNumber(T.getContentLength());J.isArray(M)?(ie=M[0],Z=M[1]):ie=Z=M,u&&(V||ie)&&(J.isStream(u)||(u=ii.default.Readable.from(u,{objectMode:!1})),u=ii.default.pipeline([u,new KD({maxRate:J.toFiniteNumber(ie)})],J.noop),V&&u.on("progress",PM(u,wp(ue,to(bp(V),!1,3)))));let $,de=a("auth");if(de){let ee=de.username||"",le=de.password||"";$=ee+":"+le}if(!$&&k.username){let ee=k.username,le=k.password;$=ee+":"+le}$&&T.delete("authorization");let xe;try{xe=vl(k.pathname+k.search,e.params,e.paramsSerializer).replace(/^\?/,"")}catch(ee){let le=new Error(ee.message);return le.config=e,le.url=e.url,le.exists=!0,s(le)}T.set("Accept-Encoding","gzip, compress, deflate"+(RM?", br":""),!1);let ve=Object.assign(Object.create(null),{path:xe,method:m,headers:T.toJSON(),agents:{http:e.httpAgent,https:e.httpsAgent},auth:$,protocol:I,family:l,beforeRedirect:eue,beforeRedirects:Object.create(null),http2Options:h});if(!J.isUndefined(c)&&(ve.lookup=c),e.socketPath){if(typeof e.socketPath!="string")return s(new Pe("socketPath must be a string",Pe.ERR_BAD_OPTION_VALUE,e));if(e.allowedSocketPaths!=null){let ee=Array.isArray(e.allowedSocketPaths)?e.allowedSocketPaths:[e.allowedSocketPaths],le=(0,GD.resolve)(e.socketPath);if(!ee.some(Ie=>typeof Ie=="string"&&(0,GD.resolve)(Ie)===le))return s(new Pe(`socketPath "${e.socketPath}" is not permitted by allowedSocketPaths`,Pe.ERR_BAD_OPTION_VALUE,e))}ve.socketPath=e.socketPath}else ve.hostname=k.hostname.startsWith("[")?k.hostname.slice(1,-1):k.hostname,ve.port=k.port,MM(ve,e.proxy,I+"//"+k.hostname+(k.port?":"+k.port:"")+ve.path);let me,z=Yoe.test(ve.protocol);if(ve.agent=z?e.httpsAgent:e.httpAgent,S)me=sue;else{let ee=a("transport");if(ee)me=ee;else if(e.maxRedirects===0)me=z?FM.default:LM.default;else{e.maxRedirects&&(ve.maxRedirects=e.maxRedirects);let le=a("beforeRedirect");le&&(ve.beforeRedirects.config=le),me=z?Joe:Woe}}if(e.maxBodyLength>-1?ve.maxBodyLength=e.maxBodyLength:ve.maxBodyLength=1/0,ve.insecureHTTPParser=!!a("insecureHTTPParser"),w=me.request(ve,o(function(le){if(w.destroyed)return;let Ae=[le],Ie=J.toFiniteNumber(le.headers["content-length"]);if(U||Z){let q=new KD({maxRate:J.toFiniteNumber(Z)});U&&q.on("progress",PM(q,wp(Ie,to(bp(U),!0,3)))),Ae.push(q)}let _=le,D=le.req||w;if(e.decompress!==!1&&le.headers["content-encoding"])switch((m==="HEAD"||le.statusCode===204)&&delete le.headers["content-encoding"],(le.headers["content-encoding"]||"").toLowerCase()){case"gzip":case"x-gzip":case"compress":case"x-compress":Ae.push(ro.default.createUnzip(BM)),delete le.headers["content-encoding"];break;case"deflate":Ae.push(new SM),Ae.push(ro.default.createUnzip(BM)),delete le.headers["content-encoding"];break;case"br":RM&&(Ae.push(ro.default.createBrotliDecompress(zoe)),delete le.headers["content-encoding"])}_=Ae.length>1?ii.default.pipeline(Ae,J.noop):Ae[0];let Y={status:le.statusCode,statusText:le.statusMessage,headers:new _r(le.headers),config:e,request:D};if(d==="stream"){if(e.maxContentLength>-1){let q=e.maxContentLength,Oe=_;async function*R(){let N=0;for await(let te of Oe){if(N+=te.length,N>q)throw new Pe("maxContentLength size of "+q+" exceeded",Pe.ERR_BAD_RESPONSE,e,D);yield te}}o(R,"enforceMaxContentLength"),_=ii.default.Readable.from(R(),{objectMode:!1})}Y.data=_,ga(n,s,Y)}else{let q=[],Oe=0;_.on("data",o(function(N){q.push(N),Oe+=N.length,e.maxContentLength>-1&&Oe>e.maxContentLength&&(y=!0,_.destroy(),x(new Pe("maxContentLength size of "+e.maxContentLength+" exceeded",Pe.ERR_BAD_RESPONSE,e,D)))},"handleStreamData")),_.on("aborted",o(function(){if(y)return;let N=new Pe("stream has been aborted",Pe.ERR_BAD_RESPONSE,e,D);_.destroy(N),s(N)},"handlerStreamAborted")),_.on("error",o(function(N){w.destroyed||s(Pe.from(N,null,e,D))},"handleStreamError")),_.on("end",o(function(){try{let N=q.length===1?q[0]:Buffer.concat(q);d!=="arraybuffer"&&(N=N.toString(g),(!g||g==="utf8")&&(N=J.stripBOM(N))),Y.data=N}catch(N){return s(Pe.from(N,null,e,Y.request,Y))}ga(n,s,Y)},"handleStreamEnd"))}E.once("abort",q=>{_.destroyed||(_.emit("error",q),_.destroy())})},"handleResponse")),E.once("abort",ee=>{w.close?w.close():w.destroy(ee)}),w.on("error",o(function(le){s(Pe.from(le,null,e,w))},"handleRequestError")),w.on("socket",o(function(le){le.setKeepAlive(!0,1e3*60),le[_M]||(le.on("error",o(function(Ie){let _=le[bw];_&&!_.destroyed&&_.destroy(Ie)},"handleSocketError")),le[_M]=!0),le[bw]=w,w.once("close",o(function(){le[bw]===w&&(le[bw]=null)},"clearCurrentReq"))},"handleRequestSocket")),e.timeout){let ee=parseInt(e.timeout,10);if(Number.isNaN(ee)){x(new Pe("error trying to parse `config.timeout` to int",Pe.ERR_BAD_OPTION_VALUE,e,w));return}w.setTimeout(ee,o(function(){if(v)return;let Ae=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",Ie=e.transitional||Nu;e.timeoutErrorMessage&&(Ae=e.timeoutErrorMessage),x(new Pe(Ae,Ie.clarifyTimeoutError?Pe.ETIMEDOUT:Pe.ECONNABORTED,e,w))},"handleRequestTimeout"))}else w.setTimeout(0);if(J.isStream(u)){let ee=!1,le=!1;u.on("end",()=>{ee=!0}),u.once("error",Ie=>{le=!0,w.destroy(Ie)}),u.on("close",()=>{!ee&&!le&&x(new Fs("Request stream has been aborted",e,w))});let Ae=u;if(e.maxBodyLength>-1&&e.maxRedirects===0){let Ie=e.maxBodyLength,_=0;Ae=ii.default.pipeline([u,new ii.default.Transform({transform(D,Y,q){if(_+=D.length,_>Ie)return q(new Pe("Request body larger than maxBodyLength limit",Pe.ERR_BAD_REQUEST,e,w));q(null,D)}})],J.noop),Ae.on("error",D=>{w.destroyed||w.destroy(D)})}Ae.pipe(w)}else u&&w.write(u),w.end()},"dispatchHttpRequest"))},"httpAdapter");var qM=Zt.hasStandardBrowserEnv?((r,e)=>t=>(t=new URL(t,Zt.origin),r.protocol===t.protocol&&r.host===t.host&&(e||r.port===t.port)))(new URL(Zt.origin),Zt.navigator&&/(msie|trident)/i.test(Zt.navigator.userAgent)):()=>!0;var HM=Zt.hasStandardBrowserEnv?{write(r,e,t,n,s,i,a){if(typeof document>"u")return;let u=[`${r}=${encodeURIComponent(e)}`];J.isNumber(t)&&u.push(`expires=${new Date(t).toUTCString()}`),J.isString(n)&&u.push(`path=${n}`),J.isString(s)&&u.push(`domain=${s}`),i===!0&&u.push("secure"),J.isString(a)&&u.push(`SameSite=${a}`),document.cookie=u.join("; ")},read(r){if(typeof document>"u")return null;let e=document.cookie.match(new RegExp("(?:^|; )"+r+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(r){this.write(r,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};var KM=o(r=>r instanceof _r?{...r}:r,"headersToObject");function Ri(r,e){e=e||{};let t=Object.create(null);Object.defineProperty(t,"hasOwnProperty",{value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function n(l,f,h,d){return J.isPlainObject(l)&&J.isPlainObject(f)?J.merge.call({caseless:d},l,f):J.isPlainObject(f)?J.merge({},f):J.isArray(f)?f.slice():f}o(n,"getMergedValue");function s(l,f,h,d){if(J.isUndefined(f)){if(!J.isUndefined(l))return n(void 0,l,h,d)}else return n(l,f,h,d)}o(s,"mergeDeepProperties");function i(l,f){if(!J.isUndefined(f))return n(void 0,f)}o(i,"valueFromConfig2");function a(l,f){if(J.isUndefined(f)){if(!J.isUndefined(l))return n(void 0,l)}else return n(void 0,f)}o(a,"defaultToConfig2");function u(l,f,h){if(J.hasOwnProp(e,h))return n(l,f);if(J.hasOwnProp(r,h))return n(void 0,l)}o(u,"mergeDirectKeys");let c={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,allowedSocketPaths:a,responseEncoding:a,validateStatus:u,headers:o((l,f,h)=>s(KM(l),KM(f),h,!0),"headers")};return J.forEach(Object.keys({...r,...e}),o(function(f){if(f==="__proto__"||f==="constructor"||f==="prototype")return;let h=J.hasOwnProp(c,f)?c[f]:s,d=J.hasOwnProp(r,f)?r[f]:void 0,g=J.hasOwnProp(e,f)?e[f]:void 0,m=h(d,g,f);J.isUndefined(m)&&h!==u||(t[f]=m)},"computeConfigValue")),t}o(Ri,"mergeConfig");var Sw=o((r=>{let e=Ri({},r),t=o(d=>J.hasOwnProp(e,d)?e[d]:void 0,"own"),n=t("data"),s=t("withXSRFToken"),i=t("xsrfHeaderName"),a=t("xsrfCookieName"),u=t("headers"),c=t("auth"),l=t("baseURL"),f=t("allowAbsoluteUrls"),h=t("url");if(e.headers=u=_r.from(u),e.url=vl(xl(l,h,f),r.params,r.paramsSerializer),c&&u.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),J.isFormData(n)){if(Zt.hasStandardBrowserEnv||Zt.hasStandardBrowserWebWorkerEnv)u.setContentType(void 0);else if(J.isFunction(n.getHeaders)){let d=n.getHeaders(),g=["content-type","content-length"];Object.entries(d).forEach(([m,v])=>{g.includes(m.toLowerCase())&&u.set(m,v)})}}if(Zt.hasStandardBrowserEnv&&(J.isFunction(s)&&(s=s(e)),s===!0||s==null&&qM(e.url))){let g=i&&a&&HM.read(a);g&&u.set(i,g)}return e}),"default");var iue=typeof XMLHttpRequest<"u",$M=iue&&function(r){return new Promise(o(function(t,n){let s=Sw(r),i=s.data,a=_r.from(s.headers).normalize(),{responseType:u,onUploadProgress:c,onDownloadProgress:l}=s,f,h,d,g,m;function v(){g&&g(),m&&m(),s.cancelToken&&s.cancelToken.unsubscribe(f),s.signal&&s.signal.removeEventListener("abort",f)}o(v,"done");let y=new XMLHttpRequest;y.open(s.method.toUpperCase(),s.url,!0),y.timeout=s.timeout;function w(){if(!y)return;let E=_r.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),b={data:!u||u==="text"||u==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:E,config:r,request:y};ga(o(function(k){t(k),v()},"_resolve"),o(function(k){n(k),v()},"_reject"),b),y=null}o(w,"onloadend"),"onloadend"in y?y.onloadend=w:y.onreadystatechange=o(function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.indexOf("file:")===0)||setTimeout(w)},"handleLoad"),y.onabort=o(function(){y&&(n(new Pe("Request aborted",Pe.ECONNABORTED,r,y)),y=null)},"handleAbort"),y.onerror=o(function(x){let b=x&&x.message?x.message:"Network Error",A=new Pe(b,Pe.ERR_NETWORK,r,y);A.event=x||null,n(A),y=null},"handleError"),y.ontimeout=o(function(){let x=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded",b=s.transitional||Nu;s.timeoutErrorMessage&&(x=s.timeoutErrorMessage),n(new Pe(x,b.clarifyTimeoutError?Pe.ETIMEDOUT:Pe.ECONNABORTED,r,y)),y=null},"handleTimeout"),i===void 0&&a.setContentType(null),"setRequestHeader"in y&&J.forEach(a.toJSON(),o(function(x,b){y.setRequestHeader(b,x)},"setRequestHeader")),J.isUndefined(s.withCredentials)||(y.withCredentials=!!s.withCredentials),u&&u!=="json"&&(y.responseType=s.responseType),l&&([d,m]=to(l,!0),y.addEventListener("progress",d)),c&&y.upload&&([h,g]=to(c),y.upload.addEventListener("progress",h),y.upload.addEventListener("loadend",g)),(s.cancelToken||s.signal)&&(f=o(E=>{y&&(n(!E||E.type?new Fs(null,r,y):E),y.abort(),y=null)},"onCanceled"),s.cancelToken&&s.cancelToken.subscribe(f),s.signal&&(s.signal.aborted?f():s.signal.addEventListener("abort",f)));let S=jg(s.url);if(S&&Zt.protocols.indexOf(S)===-1){n(new Pe("Unsupported protocol "+S+":",Pe.ERR_BAD_REQUEST,r));return}y.send(i||null)},"dispatchXhrRequest"))};var aue=o((r,e)=>{let{length:t}=r=r?r.filter(Boolean):[];if(e||t){let n=new AbortController,s,i=o(function(l){if(!s){s=!0,u();let f=l instanceof Error?l:this.reason;n.abort(f instanceof Pe?f:new Fs(f instanceof Error?f.message:f))}},"onabort"),a=e&&setTimeout(()=>{a=null,i(new Pe(`timeout of ${e}ms exceeded`,Pe.ETIMEDOUT))},e),u=o(()=>{r&&(a&&clearTimeout(a),a=null,r.forEach(l=>{l.unsubscribe?l.unsubscribe(i):l.removeEventListener("abort",i)}),r=null)},"unsubscribe");r.forEach(l=>l.addEventListener("abort",i));let{signal:c}=n;return c.unsubscribe=()=>J.asap(u),c}},"composeSignals"),XM=aue;var oue=o(function*(r,e){let t=r.byteLength;if(!e||t<e){yield r;return}let n=0,s;for(;n<t;)s=n+e,yield r.slice(n,s),n=s},"streamChunk"),uue=o(async function*(r,e){for await(let t of cue(r))yield*oue(t,e)},"readBytes"),cue=o(async function*(r){if(r[Symbol.asyncIterator]){yield*r;return}let e=r.getReader();try{for(;;){let{done:t,value:n}=await e.read();if(t)break;yield n}}finally{await e.cancel()}},"readStream"),JD=o((r,e,t,n)=>{let s=uue(r,e),i=0,a,u=o(c=>{a||(a=!0,n&&n(c))},"_onFinish");return new ReadableStream({async pull(c){try{let{done:l,value:f}=await s.next();if(l){u(),c.close();return}let h=f.byteLength;if(t){let d=i+=h;t(d)}c.enqueue(new Uint8Array(f))}catch(l){throw u(l),l}},cancel(c){return u(c),s.return()}},{highWaterMark:2})},"trackStream");var GM=64*1024,{isFunction:Aw}=J,lue=(({Request:r,Response:e})=>({Request:r,Response:e}))(J.global),{ReadableStream:zM,TextEncoder:WM}=J.global,JM=o((r,...e)=>{try{return!!r(...e)}catch{return!1}},"test"),fue=o(r=>{r=J.merge.call({skipUndefined:!0},lue,r);let{fetch:e,Request:t,Response:n}=r,s=e?Aw(e):typeof fetch=="function",i=Aw(t),a=Aw(n);if(!s)return!1;let u=s&&Aw(zM),c=s&&(typeof WM=="function"?(m=>v=>m.encode(v))(new WM):async m=>new Uint8Array(await new t(m).arrayBuffer())),l=i&&u&&JM(()=>{let m=!1,v=new t(Zt.origin,{body:new zM,method:"POST",get duplex(){return m=!0,"half"}}),y=v.headers.has("Content-Type");return v.body!=null&&v.body.cancel(),m&&!y}),f=a&&u&&JM(()=>J.isReadableStream(new n("").body)),h={stream:f&&(m=>m.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(m=>{!h[m]&&(h[m]=(v,y)=>{let w=v&&v[m];if(w)return w.call(v);throw new Pe(`Response type '${m}' is not supported`,Pe.ERR_NOT_SUPPORT,y)})});let d=o(async m=>{if(m==null)return 0;if(J.isBlob(m))return m.size;if(J.isSpecCompliantForm(m))return(await new t(Zt.origin,{method:"POST",body:m}).arrayBuffer()).byteLength;if(J.isArrayBufferView(m)||J.isArrayBuffer(m))return m.byteLength;if(J.isURLSearchParams(m)&&(m=m+""),J.isString(m))return(await c(m)).byteLength},"getBodyLength"),g=o(async(m,v)=>{let y=J.toFiniteNumber(m.getContentLength());return y??d(v)},"resolveBodyLength");return async m=>{let{url:v,method:y,data:w,signal:S,cancelToken:E,timeout:x,onDownloadProgress:b,onUploadProgress:A,responseType:k,headers:I,withCredentials:T="same-origin",fetchOptions:V}=Sw(m),U=e||fetch;k=k?(k+"").toLowerCase():"text";let M=XM([S,E&&E.toAbortSignal()],x),ie=null,Z=M&&M.unsubscribe&&(()=>{M.unsubscribe()}),ue;try{if(A&&l&&y!=="get"&&y!=="head"&&(ue=await g(I,w))!==0){let z=new t(v,{method:"POST",body:w,duplex:"half"}),ee;if(J.isFormData(w)&&(ee=z.headers.get("content-type"))&&I.setContentType(ee),z.body){let[le,Ae]=wp(ue,to(bp(A)));w=JD(z.body,GM,le,Ae)}}J.isString(T)||(T=T?"include":"omit");let $=i&&"credentials"in t.prototype;if(J.isFormData(w)){let z=I.getContentType();z&&/^multipart\/form-data/i.test(z)&&!/boundary=/i.test(z)&&I.delete("content-type")}let de={...V,signal:M,method:y.toUpperCase(),headers:I.normalize().toJSON(),body:w,duplex:"half",credentials:$?T:void 0};ie=i&&new t(v,de);let xe=await(i?U(ie,V):U(v,de)),ve=f&&(k==="stream"||k==="response");if(f&&(b||ve&&Z)){let z={};["status","statusText","headers"].forEach(Ie=>{z[Ie]=xe[Ie]});let ee=J.toFiniteNumber(xe.headers.get("content-length")),[le,Ae]=b&&wp(ee,to(bp(b),!0))||[];xe=new n(JD(xe.body,GM,le,()=>{Ae&&Ae(),Z&&Z()}),z)}k=k||"text";let me=await h[J.findKey(h,k)||"text"](xe,m);return!ve&&Z&&Z(),await new Promise((z,ee)=>{ga(z,ee,{data:me,headers:_r.from(xe.headers),status:xe.status,statusText:xe.statusText,config:m,request:ie})})}catch($){throw Z&&Z(),$&&$.name==="TypeError"&&/Load failed|fetch/i.test($.message)?Object.assign(new Pe("Network Error",Pe.ERR_NETWORK,m,ie,$&&$.response),{cause:$.cause||$}):Pe.from($,$&&$.code,m,ie,$&&$.response)}}},"factory"),hue=new Map,YD=o(r=>{let e=r&&r.env||{},{fetch:t,Request:n,Response:s}=e,i=[n,s,t],a=i.length,u=a,c,l,f=hue;for(;u--;)c=i[u],l=f.get(c),l===void 0&&f.set(c,l=u?new Map:fue(e)),f=l;return l},"getFetch"),MAe=YD();var QD={http:jM,xhr:$M,fetch:{get:YD}};J.forEach(QD,(r,e)=>{if(r){try{Object.defineProperty(r,"name",{value:e})}catch{}Object.defineProperty(r,"adapterName",{value:e})}});var YM=o(r=>`- ${r}`,"renderReason"),due=o(r=>J.isFunction(r)||r===null||r===!1,"isResolvedHandle");function mue(r,e){r=J.isArray(r)?r:[r];let{length:t}=r,n,s,i={};for(let a=0;a<t;a++){n=r[a];let u;if(s=n,!due(n)&&(s=QD[(u=String(n)).toLowerCase()],s===void 0))throw new Pe(`Unknown adapter '${u}'`);if(s&&(J.isFunction(s)||(s=s.get(e))))break;i[u||"#"+a]=s}if(!s){let a=Object.entries(i).map(([c,l])=>`adapter ${c} `+(l===!1?"is not supported by the environment":"is not available in the build")),u=t?a.length>1?`since :
|
|
@@ -94,19 +94,19 @@ Actual: `+_.attribValue);else{var Oe=_.tag,R=_.tags[_.tags.length-1]||_;Oe.ns===
|
|
|
94
94
|
`);return a===-1?"":s.stack.slice(a+1)})();try{if(!n.stack)n.stack=i;else if(i){let a=i.indexOf(`
|
|
95
95
|
`),u=a===-1?-1:i.indexOf(`
|
|
96
96
|
`,a+1),c=u===-1?"":i.slice(u+1);String(n.stack).endsWith(c)||(n.stack+=`
|
|
97
|
-
`+i)}}catch{}}throw n}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=Ri(this.defaults,t);let{transitional:n,paramsSerializer:s,headers:i}=t;n!==void 0&&Hg.assertOptions(n,{silentJSONParsing:ai.transitional(ai.boolean),forcedJSONParsing:ai.transitional(ai.boolean),clarifyTimeoutError:ai.transitional(ai.boolean),legacyInterceptorReqResOrdering:ai.transitional(ai.boolean)},!1),s!=null&&(J.isFunction(s)?t.paramsSerializer={serialize:s}:Hg.assertOptions(s,{encode:ai.function,serialize:ai.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Hg.assertOptions(t,{baseUrl:ai.spelling("baseURL"),withXsrfToken:ai.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let a=i&&J.merge(i.common,i[t.method]);i&&J.forEach(["delete","get","head","post","put","patch","common"],m=>{delete i[m]}),t.headers=_r.concat(a,i);let u=[],c=!0;this.interceptors.request.forEach(o(function(v){if(typeof v.runWhen=="function"&&v.runWhen(t)===!1)return;c=c&&v.synchronous;let y=t.transitional||Nu;y&&y.legacyInterceptorReqResOrdering?u.unshift(v.fulfilled,v.rejected):u.push(v.fulfilled,v.rejected)},"unshiftRequestInterceptors"));let l=[];this.interceptors.response.forEach(o(function(v){l.push(v.fulfilled,v.rejected)},"pushResponseInterceptors"));let f,h=0,d;if(!c){let m=[Nw.bind(this),void 0];for(m.unshift(...u),m.push(...l),d=m.length,f=Promise.resolve(t);h<d;)f=f.then(m[h++],m[h++]);return f}d=u.length;let g=t;for(;h<d;){let m=u[h++],v=u[h++];try{g=m(g)}catch(y){v.call(this,y);break}}try{f=Nw.call(this,g)}catch(m){return Promise.reject(m)}for(h=0,d=l.length;h<d;)f=f.then(l[h++],l[h++]);return f}getUri(e){e=Ri(this.defaults,e);let t=xl(e.baseURL,e.url,e.allowAbsoluteUrls);return vl(t,e.params,e.paramsSerializer)}};J.forEach(["delete","get","head","options"],o(function(e){Iw.prototype[e]=function(t,n){return this.request(Ri(n||{},{method:e,url:t,data:(n||{}).data}))}},"forEachMethodNoData"));J.forEach(["post","put","patch"],o(function(e){function t(n){return o(function(i,a,u){return this.request(Ri(u||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:i,data:a}))},"httpMethod")}o(t,"generateHTTPMethod"),Iw.prototype[e]=t(),Iw.prototype[e+"Form"]=t(!0)},"forEachMethodWithData"));var Kg=Iw;var yue=class ZM{static{o(this,"CancelToken")}constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(o(function(i){t=i},"promiseExecutor"));let n=this;this.promise.then(s=>{if(!n._listeners)return;let i=n._listeners.length;for(;i-- >0;)n._listeners[i](s);n._listeners=null}),this.promise.then=s=>{let i,a=new Promise(u=>{n.subscribe(u),i=u}).then(s);return a.cancel=o(function(){n.unsubscribe(i)},"reject"),a},e(o(function(i,a,u){n.reason||(n.reason=new Fs(i,a,u),t(n.reason))},"cancel"))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){let e=new AbortController,t=o(n=>{e.abort(n)},"abort");return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new ZM(o(function(s){e=s},"executor")),cancel:e}}},ej=yue;function eB(r){return o(function(t){return r.apply(null,t)},"wrap")}o(eB,"spread");function tB(r){return J.isObject(r)&&r.isAxiosError===!0}o(tB,"isAxiosError");var rB={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(rB).forEach(([r,e])=>{rB[e]=r});var tj=rB;function rj(r){let e=new Kg(r),t=Pg(Kg.prototype.request,e);return J.extend(t,Kg.prototype,e,{allOwnKeys:!0}),J.extend(t,e,null,{allOwnKeys:!0}),t.create=o(function(s){return rj(Ri(r,s))},"create"),t}o(rj,"createInstance");var tn=rj(Ep);tn.Axios=Kg;tn.CanceledError=Fs;tn.CancelToken=ej;tn.isCancel=Mg;tn.VERSION=El;tn.toFormData=Cu;tn.AxiosError=Pe;tn.Cancel=tn.CanceledError;tn.all=o(function(e){return Promise.all(e)},"all");tn.spread=eB;tn.isAxiosError=tB;tn.mergeConfig=Ri;tn.AxiosHeaders=_r;tn.formToJSON=r=>vw(J.isHTMLForm(r)?new FormData(r):r);tn.getAdapter=Cw.getAdapter;tn.HttpStatusCode=tj;tn.default=tn;var Dw=tn;var{Axios:GCe,AxiosError:zCe,CanceledError:WCe,isCancel:JCe,CancelToken:YCe,VERSION:QCe,all:ZCe,Cancel:eNe,isAxiosError:tNe,spread:rNe,toFormData:nNe,AxiosHeaders:sNe,HttpStatusCode:iNe,formToJSON:aNe,getAdapter:oNe,mergeConfig:uNe}=Dw;var vue=new Set(["ENOTFOUND","EAI_AGAIN","EAI_FAIL","EAI_NONAME"]),xue=new Set(["ETIMEDOUT","ESOCKETTIMEDOUT","ECONNABORTED"]),Eue=o(r=>!!r&&typeof r=="object"&&"message"in r,"hasMessage"),wue=o(r=>{if(!r||typeof r!="object"||!("code"in r))return;let{code:e}=r;return typeof e=="string"?e:void 0},"getCode"),bue=o(r=>{if(!r||typeof r!="object"||!("hostname"in r))return;let{hostname:e}=r;return typeof e=="string"?e:void 0},"getHostname"),nB=o(r=>{if(typeof r=="string")return r;if(r instanceof Error||Eue(r))return r.message},"getMessage"),nj=o(r=>{let e=r.toLowerCase();return e.includes("timeout")||e.includes("timed out")||e.includes("time-out")||e.includes("read econnreset")},"isTimeoutMessage"),Sue=o(r=>/getaddrinfo\s+ENOTFOUND/i.test(r)||/\bENOTFOUND\b/i.test(r),"isHostNotFoundMessage"),Aue=o(r=>{let e=[],t=new Set,n=r;for(;n!=null&&!t.has(n);){if(t.add(n),e.push(n),n instanceof AggregateError)for(let i of n.errors)t.has(i)||e.push(i);n=n instanceof Error?n.cause:void 0}return e},"collectErrorChain"),$g=o(r=>r instanceof Error?{cause:r}:void 0,"errorOptions"),sj=o(r=>{let e=Aue(r),t=nB(r)??e.map(nB).find(n=>!!n);for(let n of e){let s=wue(n);if(s&&vue.has(s))return
|
|
98
|
-
`).reduce((t,n)=>{if(!n.trim()||n.startsWith("HTTP/"))return t;let[s,i]=n.split(":").map(a=>a.trim());return t[s]=i,t},{}):{}}parseResponseBody(e){return e?Buffer.isBuffer(e)?e.toString("utf8"):e:""}async request(e){let t=e.url??"",n=(e.method??"GET").toUpperCase(),s=Fh("winhttp_ssl_client"),{CN:i}=new Ka().extractCertificateInfo(this.certificate.certificate),a=await s.request(i??"",n,t,{headers:this.parseRequestHeaders(e.headers),body:this.parseRequestBody(e.data),timeout:e.timeout});return{status:a.statusCode,data:this.parseResponseBody(a.body),statusText:this.getStatusText(a.statusCode),headers:this.parseResponseHeaders(a.headers),config:e,request:{}}}get(e,t){return this.request({...t,method:"GET",url:e})}post(e,t,n){return this.request({...n,method:"POST",url:e,data:t})}put(e,t,n){return this.request({...n,method:"PUT",url:e,data:t})}patch(e,t,n){return this.request({...n,method:"PATCH",url:e,data:t})}delete(e,t){return this.request({...t,method:"DELETE",url:e})}head(e,t){return this.request({...t,method:"HEAD",url:e})}options(e,t){return this.request({...t,method:"OPTIONS",url:e})}getUri(e){if(!e?.url)return"";try{return new URL(e.url).toString()}catch{return e.url}}static create(e){let t=new r(e),n=t.request.bind(t);return Object.setPrototypeOf(n,r.prototype),Object.assign(n,t),n}getStatusText(e){return{200:"OK",201:"Created",202:"Accepted",204:"No Content",400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable"}[e]??"Unknown"}};var oB=class{static{o(this,"SoapRemoteTransmissionRepository")}toolkit;certificateRepository;constructor(e,t){this.toolkit=e,this.certificateRepository=t}setCertificate(e){return this.certificate=e,this}validateCertificatePeriod(){if(!this.certificate)return Qr(void 0);let{certificate:e}=this.certificate,t=new Date;return t>new Date(e.validTo)?
|
|
97
|
+
`+i)}}catch{}}throw n}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=Ri(this.defaults,t);let{transitional:n,paramsSerializer:s,headers:i}=t;n!==void 0&&Hg.assertOptions(n,{silentJSONParsing:ai.transitional(ai.boolean),forcedJSONParsing:ai.transitional(ai.boolean),clarifyTimeoutError:ai.transitional(ai.boolean),legacyInterceptorReqResOrdering:ai.transitional(ai.boolean)},!1),s!=null&&(J.isFunction(s)?t.paramsSerializer={serialize:s}:Hg.assertOptions(s,{encode:ai.function,serialize:ai.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Hg.assertOptions(t,{baseUrl:ai.spelling("baseURL"),withXsrfToken:ai.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let a=i&&J.merge(i.common,i[t.method]);i&&J.forEach(["delete","get","head","post","put","patch","common"],m=>{delete i[m]}),t.headers=_r.concat(a,i);let u=[],c=!0;this.interceptors.request.forEach(o(function(v){if(typeof v.runWhen=="function"&&v.runWhen(t)===!1)return;c=c&&v.synchronous;let y=t.transitional||Nu;y&&y.legacyInterceptorReqResOrdering?u.unshift(v.fulfilled,v.rejected):u.push(v.fulfilled,v.rejected)},"unshiftRequestInterceptors"));let l=[];this.interceptors.response.forEach(o(function(v){l.push(v.fulfilled,v.rejected)},"pushResponseInterceptors"));let f,h=0,d;if(!c){let m=[Nw.bind(this),void 0];for(m.unshift(...u),m.push(...l),d=m.length,f=Promise.resolve(t);h<d;)f=f.then(m[h++],m[h++]);return f}d=u.length;let g=t;for(;h<d;){let m=u[h++],v=u[h++];try{g=m(g)}catch(y){v.call(this,y);break}}try{f=Nw.call(this,g)}catch(m){return Promise.reject(m)}for(h=0,d=l.length;h<d;)f=f.then(l[h++],l[h++]);return f}getUri(e){e=Ri(this.defaults,e);let t=xl(e.baseURL,e.url,e.allowAbsoluteUrls);return vl(t,e.params,e.paramsSerializer)}};J.forEach(["delete","get","head","options"],o(function(e){Iw.prototype[e]=function(t,n){return this.request(Ri(n||{},{method:e,url:t,data:(n||{}).data}))}},"forEachMethodNoData"));J.forEach(["post","put","patch"],o(function(e){function t(n){return o(function(i,a,u){return this.request(Ri(u||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:i,data:a}))},"httpMethod")}o(t,"generateHTTPMethod"),Iw.prototype[e]=t(),Iw.prototype[e+"Form"]=t(!0)},"forEachMethodWithData"));var Kg=Iw;var yue=class ZM{static{o(this,"CancelToken")}constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(o(function(i){t=i},"promiseExecutor"));let n=this;this.promise.then(s=>{if(!n._listeners)return;let i=n._listeners.length;for(;i-- >0;)n._listeners[i](s);n._listeners=null}),this.promise.then=s=>{let i,a=new Promise(u=>{n.subscribe(u),i=u}).then(s);return a.cancel=o(function(){n.unsubscribe(i)},"reject"),a},e(o(function(i,a,u){n.reason||(n.reason=new Fs(i,a,u),t(n.reason))},"cancel"))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){let e=new AbortController,t=o(n=>{e.abort(n)},"abort");return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new ZM(o(function(s){e=s},"executor")),cancel:e}}},ej=yue;function eB(r){return o(function(t){return r.apply(null,t)},"wrap")}o(eB,"spread");function tB(r){return J.isObject(r)&&r.isAxiosError===!0}o(tB,"isAxiosError");var rB={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(rB).forEach(([r,e])=>{rB[e]=r});var tj=rB;function rj(r){let e=new Kg(r),t=Pg(Kg.prototype.request,e);return J.extend(t,Kg.prototype,e,{allOwnKeys:!0}),J.extend(t,e,null,{allOwnKeys:!0}),t.create=o(function(s){return rj(Ri(r,s))},"create"),t}o(rj,"createInstance");var tn=rj(Ep);tn.Axios=Kg;tn.CanceledError=Fs;tn.CancelToken=ej;tn.isCancel=Mg;tn.VERSION=El;tn.toFormData=Cu;tn.AxiosError=Pe;tn.Cancel=tn.CanceledError;tn.all=o(function(e){return Promise.all(e)},"all");tn.spread=eB;tn.isAxiosError=tB;tn.mergeConfig=Ri;tn.AxiosHeaders=_r;tn.formToJSON=r=>vw(J.isHTMLForm(r)?new FormData(r):r);tn.getAdapter=Cw.getAdapter;tn.HttpStatusCode=tj;tn.default=tn;var Dw=tn;var{Axios:GCe,AxiosError:zCe,CanceledError:WCe,isCancel:JCe,CancelToken:YCe,VERSION:QCe,all:ZCe,Cancel:eNe,isAxiosError:tNe,spread:rNe,toFormData:nNe,AxiosHeaders:sNe,HttpStatusCode:iNe,formToJSON:aNe,getAdapter:oNe,mergeConfig:uNe}=Dw;var vue=new Set(["ENOTFOUND","EAI_AGAIN","EAI_FAIL","EAI_NONAME"]),xue=new Set(["ETIMEDOUT","ESOCKETTIMEDOUT","ECONNABORTED"]),Eue=o(r=>!!r&&typeof r=="object"&&"message"in r,"hasMessage"),wue=o(r=>{if(!r||typeof r!="object"||!("code"in r))return;let{code:e}=r;return typeof e=="string"?e:void 0},"getCode"),bue=o(r=>{if(!r||typeof r!="object"||!("hostname"in r))return;let{hostname:e}=r;return typeof e=="string"?e:void 0},"getHostname"),nB=o(r=>{if(typeof r=="string")return r;if(r instanceof Error||Eue(r))return r.message},"getMessage"),nj=o(r=>{let e=r.toLowerCase();return e.includes("timeout")||e.includes("timed out")||e.includes("time-out")||e.includes("read econnreset")},"isTimeoutMessage"),Sue=o(r=>/getaddrinfo\s+ENOTFOUND/i.test(r)||/\bENOTFOUND\b/i.test(r),"isHostNotFoundMessage"),Aue=o(r=>{let e=[],t=new Set,n=r;for(;n!=null&&!t.has(n);){if(t.add(n),e.push(n),n instanceof AggregateError)for(let i of n.errors)t.has(i)||e.push(i);n=n instanceof Error?n.cause:void 0}return e},"collectErrorChain"),$g=o(r=>r instanceof Error?{cause:r}:void 0,"errorOptions"),sj=o(r=>{let e=Aue(r),t=nB(r)??e.map(nB).find(n=>!!n);for(let n of e){let s=wue(n);if(s&&vue.has(s))return nr(new gh(t??`Host not found (${bue(n)??s})`,$g(r)));if(s&&xue.has(s))return nr(new qc(t??"Transmission timeout",$g(r)));let i=nB(n);if(i&&nj(i))return nr(new qc(i,$g(r)))}return t?Sue(t)?nr(new gh(t,$g(r))):nj(t)?nr(new qc(t,$g(r))):us(r):us(r)},"mapTransmissionError"),sB=o(r=>sj(r),"leftFromTransmissionError");var Cue=/Ã[\u0080-\u00BF]/;function ij(r){if(!Cue.test(r))return r;let e=Buffer.from(r,"latin1").toString("utf8");return e.includes("\uFFFD")?r:e}o(ij,"fixUtf8Mojibake");function iB(r){if(typeof r=="string")return ij(r);if(Array.isArray(r))return r.map(e=>iB(e));if(r!==null&&typeof r=="object"){let e={};for(let[t,n]of Object.entries(r))e[t]=iB(n);return e}return r}o(iB,"normalizeValue");function aB(r){return iB(r)}o(aB,"normalizeTransmissionStrings");var aj=Rt(require("os"),1);var Bw=class r{static{o(this,"WinHttpClient")}certificate;interceptors={request:{use:o(()=>0,"use"),eject:o(()=>{},"eject"),clear:o(()=>{},"clear")},response:{use:o(()=>0,"use"),eject:o(()=>{},"eject"),clear:o(()=>{},"clear")}};defaults={headers:{}};constructor(e){this.certificate=e}parseRequestHeaders(e){return e?Object.entries(e).filter(([t,n])=>n!=null).map(([t,n])=>`${t}: ${Array.isArray(n)?n.join(", "):String(n)}`).join(aj.default.EOL):""}parseRequestBody(e){return e?Buffer.isBuffer(e)?e:typeof e=="string"?Buffer.from(e,"utf8"):Array.isArray(e)?Buffer.concat(e):Buffer.from(JSON.stringify(e),"utf8"):Buffer.from("")}parseResponseHeaders(e){return e?e.split(`\r
|
|
98
|
+
`).reduce((t,n)=>{if(!n.trim()||n.startsWith("HTTP/"))return t;let[s,i]=n.split(":").map(a=>a.trim());return t[s]=i,t},{}):{}}parseResponseBody(e){return e?Buffer.isBuffer(e)?e.toString("utf8"):e:""}async request(e){let t=e.url??"",n=(e.method??"GET").toUpperCase(),s=Fh("winhttp_ssl_client"),{CN:i}=new Ka().extractCertificateInfo(this.certificate.certificate),a=await s.request(i??"",n,t,{headers:this.parseRequestHeaders(e.headers),body:this.parseRequestBody(e.data),timeout:e.timeout});return{status:a.statusCode,data:this.parseResponseBody(a.body),statusText:this.getStatusText(a.statusCode),headers:this.parseResponseHeaders(a.headers),config:e,request:{}}}get(e,t){return this.request({...t,method:"GET",url:e})}post(e,t,n){return this.request({...n,method:"POST",url:e,data:t})}put(e,t,n){return this.request({...n,method:"PUT",url:e,data:t})}patch(e,t,n){return this.request({...n,method:"PATCH",url:e,data:t})}delete(e,t){return this.request({...t,method:"DELETE",url:e})}head(e,t){return this.request({...t,method:"HEAD",url:e})}options(e,t){return this.request({...t,method:"OPTIONS",url:e})}getUri(e){if(!e?.url)return"";try{return new URL(e.url).toString()}catch{return e.url}}static create(e){let t=new r(e),n=t.request.bind(t);return Object.setPrototypeOf(n,r.prototype),Object.assign(n,t),n}getStatusText(e){return{200:"OK",201:"Created",202:"Accepted",204:"No Content",400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable"}[e]??"Unknown"}};var oB=class{static{o(this,"SoapRemoteTransmissionRepository")}toolkit;certificateRepository;constructor(e,t){this.toolkit=e,this.certificateRepository=t}setCertificate(e){return this.certificate=e,this}validateCertificatePeriod(){if(!this.certificate)return Qr(void 0);let{certificate:e}=this.certificate,t=new Date;return t>new Date(e.validTo)?nr(new Vt(`Certificado expirado (${tl(e.validTo).format("DD/MM/YYYY")}). Renove o certificado.`)):t<new Date(e.validFrom)?nr(new Vt(`O certificado ainda n\xE3o est\xE1 v\xE1lido (${tl(e.validFrom).format("DD/MM/YYYY")}).`)):Qr(void 0)}get httpsAgent(){let e={rejectUnauthorized:!1,secureOptions:uj.constants.SSL_OP_LEGACY_SERVER_CONNECT};if(!this.certificate)return new Rw.Agent({...e});let{ca:t,password:n,certificate:s,privateKey:i}=this.certificate;return i?new Rw.Agent({passphrase:n,cert:s.toString(),ca:t.map(a=>a.toString()),key:this.certificateRepository.getStringPrivateKey(i),...e}):new Rw.Agent({...e})}get defaultSoapHeaders(){return{"Content-Type":"application/soap+xml; charset=utf-8"}}getDefaultRequest(e){let t=Dw.create({timeout:e.timeout});return t.defaults.httpsAgent=this.httpsAgent,t}request(e){if(oj.default.platform()==="win32")try{return this.certificate?Bw.create(this.certificate):this.getDefaultRequest({timeout:e.timeout})}catch{return this.getDefaultRequest({timeout:e.timeout})}return this.getDefaultRequest({timeout:e.timeout})}async send(e){let t=this.validateCertificatePeriod();if(t.isLeft())return t;try{let n=this.request({timeout:e.timeout}),s=await(0,cj.createClientAsync)(`${e.url}?wsdl`,{request:n,endpoint:e.url,attributesKey:"$",wsdl_options:{request:n,timeout:e.timeout},forceSoap12Headers:!0});e.payload.$={xmlns:s.wsdl.definitions.$targetNamespace,...e.payload.$};let i=await this.toolkit.build(e.payload,{headless:!0,renderOpts:{pretty:!1},rootName:e.root}),a=this.toolkit.getFirstNode(i)??"",u=e.xsd,c=await this.toolkit.validate(a,u);if(c.isLeft())return c;let l=`${e.method}Async`;if(typeof s[l]!="function"){let h=Object.keys(s).filter(d=>d.endsWith("Async"));return nr(new Vt(`M\xE9todo SOAP "${l}" n\xE3o encontrado em ${e.url}. Dispon\xEDveis: ${h.join(", ")||"nenhum"}`))}let[f]=await s[l]({_xml:i},{request:n,timeout:e.timeout});return Qr(aB(f))}catch(n){return sB(n)}}};var Nue=Fh("xml_validator"),lj=Nue;var RK=Rt(require("crypto"),1),hde=Rt(O9(),1);var P9="application/xml";var xt;(function(r){r[r.None=0]="None",r[r.Element=1]="Element",r[r.Attribute=2]="Attribute",r[r.Text=3]="Text",r[r.CDATA=4]="CDATA",r[r.EntityReference=5]="EntityReference",r[r.Entity=6]="Entity",r[r.ProcessingInstruction=7]="ProcessingInstruction",r[r.Comment=8]="Comment",r[r.Document=9]="Document",r[r.DocumentType=10]="DocumentType",r[r.DocumentFragment=11]="DocumentFragment",r[r.Notation=12]="Notation",r[r.Whitespace=13]="Whitespace",r[r.SignificantWhitespace=14]="SignificantWhitespace",r[r.EndElement=15]="EndElement",r[r.EndEntity=16]="EndEntity",r[r.XmlDeclaration=17]="XmlDeclaration"})(xt||(xt={}));function Tue(r,e){let t=r.ownerDocument==null?r:r.ownerDocument,n=document.createNSResolver(r.ownerDocument==null?r.documentElement:r.ownerDocument.documentElement),s=t.evaluate(e,r,n,XPathResult.ANY_TYPE,null),i=[],a;for(;a=s.iterateNext();)i.push(a);return i}o(Tue,"SelectNodesEx");function Iue(r,e){let t=Ap("xpath").select;return t(e,r)}o(Iue,"SelectNodesNode");var k9=typeof self<"u"?Tue:Iue;function zg(r){r=r.replace(/\r\n/g,`
|
|
99
99
|
`).replace(/\r/g,`
|
|
100
|
-
`);let e;return typeof DOMParser<"u"?e=DOMParser:e=Ap("DOMParser"),new e().parseFromString(r,P9)}o(zg,"Parse");function Sp(r){let e;return typeof XMLSerializer<"u"?e=XMLSerializer:e=Ap("XMLSerializer"),new e().serializeToString(r)}o(Sp,"Stringify");function zw(r,e){let t=k9(r,e);return t&&t.length>0?t[0]:null}o(zw,"SelectSingleNode");function L9(r,e){return r&&r.nodeType===e}o(L9,"isNodeType");function Vs(r){return L9(r,xt.Element)}o(Vs,"isElement");function Sl(r){return L9(r,xt.Document)}o(Sl,"isDocument");var F9=new Map;function U9(r){for(let e in r)F9.set(e,r[e])}o(U9,"setNodeDependencies");function Ap(r){let e=F9.get(r);if(!e)throw new Error(`Node dependency not found: ${r}. Please use 'setNodeDependencies' to register it.`);return e}o(Ap,"getNodeDependency");var Wg="element",Jg="attribute",Ww="content";var Due=1e9;function vB(r,...e){let t=r;for(let n=0;n<e.length;n++){let s=e[n];for(let i in s)Object.prototype.hasOwnProperty.call(s,i)&&(t[i]=s[i])}return t}o(vB,"assign");function Et(r){return e=>{let t=e;t.localName=r.localName||t.name,t.namespaceURI=r.namespaceURI||t.namespaceURI||null,t.prefix=r.prefix||t.prefix||null,t.parser=r.parser||t.parser,t.target!==t&&(t.items=vB({},t.items)),t.target=e}}o(Et,"XmlElement");function Dt(r={}){return(e,t)=>{let n=e.constructor,s=t;n.items||(n.items={}),n.target!==n&&(n.items=vB({},n.items)),n.target=e;let i;r.parser?i={parser:r.parser,required:r.required||!1,maxOccurs:r.maxOccurs||Due,minOccurs:r.minOccurs===void 0?0:r.minOccurs,noRoot:r.noRoot||!1}:i={namespaceURI:r.namespaceURI||null,required:r.required||!1,prefix:r.prefix||null,defaultValue:r.defaultValue,converter:r.converter,noRoot:r.noRoot||!1},r.localName=r.localName||r.parser&&r.parser.localName||s;let a=n.items,u=r.parser&&r.parser.namespaceURI;a[s]={...i,namespaceURI:r.namespaceURI||u||null,prefix:r.prefix||r.parser&&r.parser.prefix||null,localName:r.localName,type:Wg},M9(e,s,r)}}o(Dt,"XmlChildElement");function wr(r={required:!1,namespaceURI:null}){return(e,t)=>{let n=e.constructor,s=t;r.localName||(r.localName=t),n.items||(n.items={}),n.target!==n&&(n.items=vB({},n.items)),n.target=e;let i=n.items;i[t]=r,i[t].type=Jg,M9(e,s,r)}}o(wr,"XmlAttribute");function M9(r,e,t){let n=`_${e}`,s={set:o(function(i){this[n]!==i&&(this.element=null,this[n]=i)},"set"),get:o(function(){if(this[n]===void 0){let i=t.defaultValue;t.parser&&(i=new t.parser,i.localName=t.localName),this[n]=i}return this[n]},"get")};Object.defineProperty(r,n,{writable:!0,enumerable:!1}),Object.defineProperty(r,e,s)}o(M9,"defineProperty");var Du=class r{static{o(this,"Collection")}constructor(e){this.items=[],e&&(this.items=e)}get Count(){return this.items.length}Item(e){return this.items[e]||null}Add(e){this.items.push(e)}Pop(){return this.items.pop()}RemoveAt(e){this.items=this.items.filter((t,n)=>n!==e)}Clear(){this.items=[]}GetIterator(){return this.items}ForEach(e){this.GetIterator().forEach(e)}Map(e){return new r(this.GetIterator().map(e))}Filter(e){return new r(this.GetIterator().filter(e))}Sort(e){return new r(this.GetIterator().sort(e))}Every(e){return this.GetIterator().every(e)}Some(e){return this.GetIterator().some(e)}IsEmpty(){return this.Count===0}};function Bue(r,...e){let t=r.replace(/%([1-9]\d*)/g,(n,s)=>{let i=parseInt(s,10)-1;return e[i]!==void 0?e[i]:""});return t=t.replace(/%%/g,"%"),t}o(Bue,"printf");function Rue(r,e){let t=r+"";for(;t.length<e;)t="0"+t;return t}o(Rue,"padNum");var _e=class{static{o(this,"XmlError")}constructor(e,...t){this.prefix="XMLJS",this.code=e,this.name=this.constructor.name;let n=Bue(Jr[e],...t);this.message=`${this.prefix}${Rue(e,4)}: ${n}`,this.stack=new Error(this.message).stack}},we;(function(r){r[r.NONE=0]="NONE",r[r.NULL_REFERENCE=1]="NULL_REFERENCE",r[r.NULL_PARAM=2]="NULL_PARAM",r[r.DECORATOR_NULL_PARAM=3]="DECORATOR_NULL_PARAM",r[r.COLLECTION_LIMIT=4]="COLLECTION_LIMIT",r[r.METHOD_NOT_IMPLEMENTED=5]="METHOD_NOT_IMPLEMENTED",r[r.METHOD_NOT_SUPPORTED=6]="METHOD_NOT_SUPPORTED",r[r.PARAM_REQUIRED=7]="PARAM_REQUIRED",r[r.CONVERTER_UNSUPPORTED=8]="CONVERTER_UNSUPPORTED",r[r.ELEMENT_MALFORMED=9]="ELEMENT_MALFORMED",r[r.ELEMENT_MISSING=10]="ELEMENT_MISSING",r[r.ATTRIBUTE_MISSING=11]="ATTRIBUTE_MISSING",r[r.CONTENT_MISSING=12]="CONTENT_MISSING",r[r.CRYPTOGRAPHIC=13]="CRYPTOGRAPHIC",r[r.CRYPTOGRAPHIC_NO_MODULE=14]="CRYPTOGRAPHIC_NO_MODULE",r[r.CRYPTOGRAPHIC_UNKNOWN_TRANSFORM=15]="CRYPTOGRAPHIC_UNKNOWN_TRANSFORM",r[r.ALGORITHM_NOT_SUPPORTED=16]="ALGORITHM_NOT_SUPPORTED",r[r.ALGORITHM_WRONG_NAME=17]="ALGORITHM_WRONG_NAME",r[r.XML_EXCEPTION=18]="XML_EXCEPTION",r[r.KEY_INFO_CLAUSE_NOT_SUPPORTED=19]="KEY_INFO_CLAUSE_NOT_SUPPORTED"})(we||(we={}));var Jr={};Jr[we.NONE]="No description";Jr[we.NULL_REFERENCE]="Null reference";Jr[we.NULL_PARAM]="'%1' has empty '%2' object";Jr[we.DECORATOR_NULL_PARAM]="Decorator '%1' has empty '%2' parameter";Jr[we.COLLECTION_LIMIT]="Collection of '%1' in element '%2' has wrong amount of items";Jr[we.METHOD_NOT_IMPLEMENTED]="Method is not implemented";Jr[we.METHOD_NOT_SUPPORTED]="Method is not supported";Jr[we.PARAM_REQUIRED]="Required parameter is missing '%1'";Jr[we.CONVERTER_UNSUPPORTED]="Converter is not supported";Jr[we.ELEMENT_MALFORMED]="Malformed element '%1'";Jr[we.ELEMENT_MISSING]="Element '%1' is missing in '%2'";Jr[we.ATTRIBUTE_MISSING]="Attribute '%1' is missing in '%2'";Jr[we.CONTENT_MISSING]="Content is missing in '%1'";Jr[we.CRYPTOGRAPHIC]="Cryptographic error: %1";Jr[we.CRYPTOGRAPHIC_NO_MODULE]="WebCrypto module is not found";Jr[we.CRYPTOGRAPHIC_UNKNOWN_TRANSFORM]="Unknown transform %1";Jr[we.ALGORITHM_NOT_SUPPORTED]="Algorithm is not supported '%1'";Jr[we.ALGORITHM_WRONG_NAME]="Algorithm wrong name in use '%1'";Jr[we.XML_EXCEPTION]="XML exception: %1";Jr[we.KEY_INFO_CLAUSE_NOT_SUPPORTED]="KeyInfoClause type '%1' is not supported";var sr=class{static{o(this,"Convert")}static ToString(e,t="utf8"){let n=new Uint8Array(e);switch(t.toLowerCase()){case"utf8":return this.ToUtf8String(n);case"binary":return this.ToBinary(n);case"hex":return this.ToHex(n);case"base64":return this.ToBase64(n);case"base64url":return this.ToBase64Url(n);default:throw new _e(we.CONVERTER_UNSUPPORTED)}}static FromString(e,t="utf8"){switch(t.toLowerCase()){case"utf8":return this.FromUtf8String(e);case"binary":return this.FromBinary(e);case"hex":return this.FromHex(e);case"base64":return this.FromBase64(e);case"base64url":return this.FromBase64Url(e);default:throw new _e(we.CONVERTER_UNSUPPORTED)}}static ToBase64(e){if(typeof btoa<"u"){let t=this.ToString(e,"binary");return btoa(t)}else{if(typeof Buffer<"u")return Buffer.from(e).toString("base64");throw new _e(we.CONVERTER_UNSUPPORTED)}}static FromBase64(e){if(e=e.replace(/\n/g,"").replace(/\r/g,"").replace(/\t/g,"").replace(/\s/g,""),typeof atob<"u")return this.FromBinary(atob(e));if(typeof Buffer<"u")return new Uint8Array(Buffer.from(e,"base64"));throw new _e(we.CONVERTER_UNSUPPORTED)}static FromBase64Url(e){return this.FromBase64(this.Base64Padding(e.replace(/-/g,"+").replace(/_/g,"/")))}static ToBase64Url(e){return this.ToBase64(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}static FromUtf8String(e){let t=unescape(encodeURIComponent(e)),n=new Uint8Array(t.length);for(let s=0;s<t.length;s++)n[s]=t.charCodeAt(s);return n}static ToUtf8String(e){let t=String.fromCharCode.apply(null,e);return decodeURIComponent(escape(t))}static FromBinary(e){let t=e.length,n=new Uint8Array(t);for(let s=0;s<t;s++)n[s]=e.charCodeAt(s);return n}static ToBinary(e){let t="";for(let n=0;n<e.length;n++)t=t+String.fromCharCode(e[n]);return t}static ToHex(e){let n=[];for(let s=0;s<e.length;s++){let i=e[s].toString(16);n.push(i.length===1?"0"+i:i)}return n.join("")}static FromHex(e){let t=new Uint8Array(e.length/2);for(let n=0;n<e.length;n=n+2){let s=e.slice(n,n+2);t[n/2]=parseInt(s,16)}return t}static ToDateTime(e){return new Date(e)}static FromDateTime(e){return e.toISOString()}static Base64Padding(e){let t=4-e.length%4;if(t<4)for(let n=0;n<t;n++)e+="=";return e}};var oi={get:o(r=>{if(r)return sr.ToBase64(r)},"get"),set:o(r=>sr.FromBase64(r),"set")},Yg={get:o(r=>r?r.toString():"0","get"),set:o(r=>Number(r),"set")};var _ue="xml_root",ws=class r{static{o(this,"XmlObject")}static LoadXml(e){let t=new this;return t.LoadXml(e),t}static GetElement(e,t,n=!0){let s=e.getElementsByTagName(t);if(n&&s.length===0)throw new _e(we.ELEMENT_MISSING,t,e.localName);return s[0]||null}static GetAttribute(e,t,n,s=!0){if(e.hasAttribute(t))return e.getAttribute(t);if(s)throw new _e(we.ATTRIBUTE_MISSING,t,e.localName);return n}static GetElementById(e,t){if(e==null||t==null)return null;let n=null;return Sl(e)&&(n=e.getElementById(t)),n==null&&(n=zw(e,`//*[@*[local-name()='Id']='${t}']`),n==null&&(n=zw(e,`//*[@*[local-name()='ID']='${t}']`),n==null&&(n=zw(e,`//*[@*[local-name()='id']='${t}']`)))),n}static CreateDocument(e=_ue,t=null,n=null){if(n&&!t)throw new _e(we.PARAM_REQUIRED,"namespaceUri",`Prefix '${n}' requires namespaceUri`);let s="",i="",a="";n&&(s=n+":",i=":"+n),t&&(a=` xmlns${i}="${t}"`);let u=`${s}${e}`;return zg(`<${u}${a}></${u}>`)}static GetChildren(e,t,n){e=Sl(e)?e.documentElement:e;let s=[];for(let i=0;i<e.childNodes.length;i++){let a=e.childNodes[i];Vs(a)&&a.localName===t&&(a.namespaceURI===n||!n)&&s.push(a)}return s}static GetFirstChild(e,t,n){e=Sl(e)?e.documentElement:e;for(let s=0;s<e.childNodes.length;s++){let i=e.childNodes[s];if(Vs(i)&&i.localName===t&&(i.namespaceURI===n||!n))return i}return null}static GetChild(e,t,n,s=!0){for(let i=0;i<e.childNodes.length;i++){let a=e.childNodes[i];if(Vs(a)&&a.localName===t&&(a.namespaceURI===n||!n))return a}if(s)throw new _e(we.ELEMENT_MISSING,t,e.localName);return null}constructor(e={}){if(this.prefix=this.GetStatic().prefix||null,this.localName=this.GetStatic().localName,this.namespaceURI=this.GetStatic().namespaceURI,e)for(let[t,n]of Object.entries(e))n!==void 0&&(this[t]=n)}get Element(){return this.element}get Prefix(){return this.prefix}set Prefix(e){this.prefix=e}get LocalName(){return this.localName||""}get NamespaceURI(){return this.namespaceURI||null}HasChanged(){let e=this.GetStatic();if(e.items)for(let t in e.items){if(!Object.prototype.hasOwnProperty.call(e.items,t))continue;let n=e.items[t],s=this[t];if(n.parser&&s&&s.HasChanged())return!0}return this.element===null}GetXml(e){if(!(e||this.HasChanged()))return this.element||null;let t=this,n=this.CreateDocument(),s=this.CreateElement(),i=this.GetStatic(),a=this.localName||"";if(i.items)for(let u in i.items){if(!Object.prototype.hasOwnProperty.call(i.items,u))continue;let c=t[u],l=i.items[u];switch(l.type){case Ww:{let f=l,h=f.converter?f.converter.get(c):c;if(f.required&&h==null)throw new _e(we.CONTENT_MISSING,a);(f.defaultValue!==c||f.required)&&(s.textContent=h);break}case Jg:{let f=l,h=f.converter?f.converter.get(c):c;if(f.required&&h==null)throw new _e(we.ATTRIBUTE_MISSING,f.localName,a);(f.defaultValue!==c||f.required)&&(f.namespaceURI?s.setAttributeNS(f.namespaceURI,f.localName||"",h):s.setAttribute(f.localName||"",h));break}case Wg:{let f=l,h=null;if(f.parser){if(f.required&&!c||f.minOccurs&&!c.Count){let d=c?.localName||f.localName;throw new _e(we.ELEMENT_MISSING,d,a)}c&&(h=c.GetXml(c.element===void 0&&(f.required||c.Count)))}else{let d=f.converter?f.converter.get(c):c;if(f.required&&d===void 0)throw new _e(we.ELEMENT_MISSING,f.localName,a);if(c!==f.defaultValue||f.required)if(f.namespaceURI?h=n.createElementNS(f.namespaceURI,`${f.prefix?f.prefix+":":""}${f.localName}`):h=n.createElement(`${f.prefix?f.prefix+":":""}${f.localName}`),Array.isArray(d))for(let g of d){let m=g instanceof r?g.GetXml(!0):g;m!==null&&h&&h.appendChild(m)}else if(d instanceof r){let g=d.GetXml(!0);g&&h&&h.appendChild(g)}else h&&(h.textContent=d)}if(h)if(f.noRoot){let d=[];for(let v=0;v<h.childNodes.length;v++){let y=h.childNodes.item(v);Vs(y)&&d.push(y)}let g=f.minOccurs||0,m=f.maxOccurs||1/0;if(d.length<g||d.length>m)throw new _e(we.COLLECTION_LIMIT,c.localName,i.localName);d.forEach(v=>s.appendChild(v.cloneNode(!0)))}else{if(h.childNodes.length<(f.minOccurs||0)||h.childNodes.length>(f.maxOccurs||1/0))throw new _e(we.COLLECTION_LIMIT,c.localName,i.localName);s.appendChild(h)}break}}}return this.OnGetXml(s),this.element=s,s}LoadXml(e){let t,n=this;if(typeof e=="string"?t=zg(e).documentElement:t=e,!t)throw new _e(we.PARAM_REQUIRED,"element");let s=this.GetStatic(),i=this.localName||"";if(!(t.localName===i&&t.namespaceURI==this.NamespaceURI))throw new _e(we.ELEMENT_MALFORMED,i);if(s.items)for(let a in s.items){if(!Object.prototype.hasOwnProperty.call(s.items,a))continue;let u=s.items[a];switch(u.type){case Ww:{let c=u;if(c.required&&!t.textContent)throw new _e(we.CONTENT_MISSING,i);if(!t.textContent)n[a]=c.defaultValue;else{let l=c.converter?c.converter.set(t.textContent):t.textContent;n[a]=l}break}case Jg:{let c=u,l,f;if(!c.localName)throw new _e(we.PARAM_REQUIRED,"localName");if(c.namespaceURI?(l=t.hasAttributeNS.bind(t,c.namespaceURI,c.localName),f=t.getAttributeNS.bind(t,c.namespaceURI,c.localName)):(l=t.hasAttribute.bind(t,c.localName),f=t.getAttribute.bind(t,c.localName)),c.required&&!l())throw new _e(we.ATTRIBUTE_MISSING,c.localName,i);if(!l())n[a]=c.defaultValue;else{let h=f(),d=c.converter&&h?c.converter.set(h):h;n[a]=d}break}case Wg:{let c=u;if(c.noRoot){if(!c.parser)throw new _e(we.XML_EXCEPTION,`Schema for '${c.localName}' with flag noRoot must have 'parser'`);let f=new c.parser;if(!(f instanceof Cp))throw new _e(we.XML_EXCEPTION,`Schema for '${c.localName}' with flag noRoot must have 'parser' like instance of XmlCollection`);f.OnLoadXml(t),delete f.element;let h=c.minOccurs||0,d=c.maxOccurs||1/0;if(f.Count<h||f.Count>d)throw new _e(we.COLLECTION_LIMIT,c.parser.localName,i);n[a]=f;continue}let l=null;for(let f=0;f<t.childNodes.length;f++){let h=t.childNodes.item(f);if(!Vs(h))continue;let d=h;if(d.localName===c.localName&&d.namespaceURI==c.namespaceURI){l=d;break}}if(c.required&&!l)throw new _e(we.ELEMENT_MISSING,c.parser?c.parser.localName:c.localName,i);if(c.parser){if(l){let f=new c.parser;f.localName=c.localName,f.namespaceURI=c.namespaceURI,n[a]=f,f.LoadXml(l)}}else if(!l)n[a]=c.defaultValue;else{let f=l.textContent||"",h=c.converter?c.converter.set(f):f;n[a]=h}break}}}this.OnLoadXml(t),this.prefix=t.prefix||"",this.element=t}toString(){let e=this.GetXml();return e?Sp(e):""}GetElement(e,t=!0){if(!this.element)throw new _e(we.NULL_PARAM,this.localName);return r.GetElement(this.element,e,t)}GetChildren(e,t){if(!this.element)throw new _e(we.NULL_PARAM,this.localName);return r.GetChildren(this.element,e,t||this.NamespaceURI||void 0)}GetChild(e,t=!0){if(!this.element)throw new _e(we.NULL_PARAM,this.localName);return r.GetChild(this.element,e,this.NamespaceURI||void 0,t)}GetFirstChild(e,t){if(!this.element)throw new _e(we.NULL_PARAM,this.localName);return r.GetFirstChild(this.element,e,t)}GetAttribute(e,t,n=!0){if(!this.element)throw new _e(we.NULL_PARAM,this.localName);return r.GetAttribute(this.element,e,t,n)}IsEmpty(){return this.Element===void 0}OnLoadXml(e){}GetStatic(){return this.constructor}GetPrefix(){return this.Prefix?this.prefix+":":""}OnGetXml(e){}CreateElement(e,t,n=null,s=null){if(!e){let u=this.CreateDocument();if(u)e=u;else throw new _e(we.XML_EXCEPTION,"Document not created")}t=t||this.localName,n=n||this.NamespaceURI,s=s||this.prefix;let i=(s?`${s}:`:"")+t,a=n&&e?e.createElementNS(n,i):e?.createElement(i);return e&&a&&e.importNode(a,!0),a}CreateDocument(){return r.CreateDocument(this.localName,this.NamespaceURI,this.Prefix)}};var Cp=class extends ws{static{o(this,"XmlCollection")}constructor(){super(...arguments),this.MaxOccurs=Number.MAX_VALUE,this.MinOccurs=0,this.items=[]}HasChanged(){let e=super.HasChanged(),t=this.Some(n=>n.HasChanged());return e||t}get Count(){return this.items.length}Item(e){return this.items[e]||null}Add(e){this.items.push(e),this.element=null}Pop(){return this.element=null,this.items.pop()}RemoveAt(e){this.items=this.items.filter((t,n)=>n!==e),this.element=null}Clear(){this.items=[],this.element=null}GetIterator(){return this.items}ForEach(e){this.GetIterator().forEach(e)}Map(e){return new Du(this.GetIterator().map(e))}Filter(e){return new Du(this.GetIterator().filter(e))}Sort(e){return new Du(this.GetIterator().sort(e))}Every(e){return this.GetIterator().every(e)}Some(e){return this.GetIterator().some(e)}IsEmpty(){return this.Count===0}OnGetXml(e){for(let t of this.GetIterator()){let n=t.GetXml();n&&e.appendChild(n)}}OnLoadXml(e){let t=this.GetStatic();if(!t.parser)throw new _e(we.XML_EXCEPTION,`${t.localName} doesn't have required 'parser' in @XmlElement`);for(let n=0;n<e.childNodes.length;n++){let s=e.childNodes.item(n);if(!(Vs(s)&&s.localName===t.parser.localName&&s.namespaceURI==t.namespaceURI))continue;let i=s,a=new t.parser;a.LoadXml(i),this.Add(a)}}};var Np=class extends Du{static{o(this,"NamespaceManager")}Add(e){e.prefix=e.prefix||"",e.namespace=e.namespace||"",super.Add(e)}GetPrefix(e,t=this.Count-1){let n=this.Count-1;e=e||"",t>n&&(t=n);for(let s=t;s>=0;s--){let i=this.items[s];if(i.prefix===e)return i}return null}GetNamespace(e,t=this.Count-1){let n=this.Count-1;e=e||"",t>n&&(t=n);for(let s=t;s>=0;s--){let i=this.items[s];if(i.namespace===e)return i}return null}};var Oue="[object ArrayBuffer]",Ze=class wB{static{o(this,"BufferSourceConverter")}static isArrayBuffer(e){return Object.prototype.toString.call(e)===Oue}static toArrayBuffer(e){return this.isArrayBuffer(e)?e:e.byteLength===e.buffer.byteLength||e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer:this.toUint8Array(e.buffer).slice(e.byteOffset,e.byteOffset+e.byteLength).buffer}static toUint8Array(e){return this.toView(e,Uint8Array)}static toView(e,t){if(e.constructor===t)return e;if(this.isArrayBuffer(e))return new t(e);if(this.isArrayBufferView(e))return new t(e.buffer,e.byteOffset,e.byteLength);throw new TypeError("The provided value is not of type '(ArrayBuffer or ArrayBufferView)'")}static isBufferSource(e){return this.isArrayBufferView(e)||this.isArrayBuffer(e)}static isArrayBufferView(e){return ArrayBuffer.isView(e)||e&&this.isArrayBuffer(e.buffer)}static isEqual(e,t){let n=wB.toUint8Array(e),s=wB.toUint8Array(t);if(n.length!==s.byteLength)return!1;for(let i=0;i<n.length;i++)if(n[i]!==s[i])return!1;return!0}static concat(...e){let t;Array.isArray(e[0])&&!(e[1]instanceof Function)||Array.isArray(e[0])&&e[1]instanceof Function?t=e[0]:e[e.length-1]instanceof Function?t=e.slice(0,e.length-1):t=e;let n=0;for(let a of t)n+=a.byteLength;let s=new Uint8Array(n),i=0;for(let a of t){let u=this.toUint8Array(a);s.set(u,i),i+=u.length}return e[e.length-1]instanceof Function?this.toView(s,e[e.length-1]):s.buffer}},EB="string",Pue=/^[0-9a-f\s]+$/i,kue=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,Lue=/^[a-zA-Z0-9-_]+$/,j9=class{static{o(this,"Utf8Converter")}static fromString(e){let t=unescape(encodeURIComponent(e)),n=new Uint8Array(t.length);for(let s=0;s<t.length;s++)n[s]=t.charCodeAt(s);return n.buffer}static toString(e){let t=Ze.toUint8Array(e),n="";for(let i=0;i<t.length;i++)n+=String.fromCharCode(t[i]);return decodeURIComponent(escape(n))}},va=class{static{o(this,"Utf16Converter")}static toString(e,t=!1){let n=Ze.toArrayBuffer(e),s=new DataView(n),i="";for(let a=0;a<n.byteLength;a+=2){let u=s.getUint16(a,t);i+=String.fromCharCode(u)}return i}static fromString(e,t=!1){let n=new ArrayBuffer(e.length*2),s=new DataView(n);for(let i=0;i<e.length;i++)s.setUint16(i*2,e.charCodeAt(i),t);return n}},ut=class Tp{static{o(this,"Convert")}static isHex(e){return typeof e===EB&&Pue.test(e)}static isBase64(e){return typeof e===EB&&kue.test(e)}static isBase64Url(e){return typeof e===EB&&Lue.test(e)}static ToString(e,t="utf8"){let n=Ze.toUint8Array(e);switch(t.toLowerCase()){case"utf8":return this.ToUtf8String(n);case"binary":return this.ToBinary(n);case"hex":return this.ToHex(n);case"base64":return this.ToBase64(n);case"base64url":return this.ToBase64Url(n);case"utf16le":return va.toString(n,!0);case"utf16":case"utf16be":return va.toString(n);default:throw new Error(`Unknown type of encoding '${t}'`)}}static FromString(e,t="utf8"){if(!e)return new ArrayBuffer(0);switch(t.toLowerCase()){case"utf8":return this.FromUtf8String(e);case"binary":return this.FromBinary(e);case"hex":return this.FromHex(e);case"base64":return this.FromBase64(e);case"base64url":return this.FromBase64Url(e);case"utf16le":return va.fromString(e,!0);case"utf16":case"utf16be":return va.fromString(e);default:throw new Error(`Unknown type of encoding '${t}'`)}}static ToBase64(e){let t=Ze.toUint8Array(e);if(typeof btoa<"u"){let n=this.ToString(t,"binary");return btoa(n)}else return Buffer.from(t).toString("base64")}static FromBase64(e){let t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!Tp.isBase64(t))throw new TypeError("Argument 'base64Text' is not Base64 encoded");return typeof atob<"u"?this.FromBinary(atob(t)):new Uint8Array(Buffer.from(t,"base64")).buffer}static FromBase64Url(e){let t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!Tp.isBase64Url(t))throw new TypeError("Argument 'base64url' is not Base64Url encoded");return this.FromBase64(this.Base64Padding(t.replace(/\-/g,"+").replace(/\_/g,"/")))}static ToBase64Url(e){return this.ToBase64(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}static FromUtf8String(e,t=Tp.DEFAULT_UTF8_ENCODING){switch(t){case"ascii":return this.FromBinary(e);case"utf8":return j9.fromString(e);case"utf16":case"utf16be":return va.fromString(e);case"utf16le":case"usc2":return va.fromString(e,!0);default:throw new Error(`Unknown type of encoding '${t}'`)}}static ToUtf8String(e,t=Tp.DEFAULT_UTF8_ENCODING){switch(t){case"ascii":return this.ToBinary(e);case"utf8":return j9.toString(e);case"utf16":case"utf16be":return va.toString(e);case"utf16le":case"usc2":return va.toString(e,!0);default:throw new Error(`Unknown type of encoding '${t}'`)}}static FromBinary(e){let t=e.length,n=new Uint8Array(t);for(let s=0;s<t;s++)n[s]=e.charCodeAt(s);return n.buffer}static ToBinary(e){let t=Ze.toUint8Array(e),n="";for(let s=0;s<t.length;s++)n+=String.fromCharCode(t[s]);return n}static ToHex(e){let t=Ze.toUint8Array(e),n="",s=t.length;for(let i=0;i<s;i++){let a=t[i];a<16&&(n+="0"),n+=a.toString(16)}return n}static FromHex(e){let t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!Tp.isHex(t))throw new TypeError("Argument 'hexString' is not HEX encoded");t.length%2&&(t=`0${t}`);let n=new Uint8Array(t.length/2);for(let s=0;s<t.length;s=s+2){let i=t.slice(s,s+2);n[s/2]=parseInt(i,16)}return n.buffer}static ToUtf16String(e,t=!1){return va.toString(e,t)}static FromUtf16String(e,t=!1){return va.fromString(e,t)}static Base64Padding(e){let t=4-e.length%4;if(t<4)for(let n=0;n<t;n++)e+="=";return e}static formatString(e){return e?.replace(/[\n\r\t ]/g,"")||""}};ut.DEFAULT_UTF8_ENCODING="utf8";function B(r,e,t){var n;return r instanceof Object&&(n=r[e])!==null&&n!==void 0?n:t}o(B,"getParametersValue");function Jw(r,e=0,t=r.byteLength-e,n=!1){let s="";for(let i of new Uint8Array(r,e,t)){let a=i.toString(16).toUpperCase();a.length===1&&(s+="0"),s+=a,n&&(s+=" ")}return s.trim()}o(Jw,"bufferToHexCodes");function io(r,e){let t=0;if(r.length===1)return r[0];for(let n=r.length-1;n>=0;n--)t+=r[r.length-1-n]*Math.pow(2,e*n);return t}o(io,"utilFromBase");function _i(r,e,t=-1){let n=t,s=r,i=0,a=Math.pow(2,e);for(let u=1;u<8;u++){if(r<a){let c;if(n<0)c=new ArrayBuffer(u),i=u;else{if(n<u)return new ArrayBuffer(0);c=new ArrayBuffer(n),i=n}let l=new Uint8Array(c);for(let f=u-1;f>=0;f--){let h=Math.pow(2,f*e);l[i-f-1]=Math.floor(s/h),s-=l[i-f-1]*h}return c}a*=Math.pow(2,e)}return new ArrayBuffer(0)}o(_i,"utilToBase");function Al(...r){let e=0,t=0;for(let i of r)e+=i.byteLength;let n=new ArrayBuffer(e),s=new Uint8Array(n);for(let i of r)s.set(new Uint8Array(i),t),t+=i.byteLength;return n}o(Al,"utilConcatBuf");function Yw(...r){let e=0,t=0;for(let i of r)e+=i.length;let n=new ArrayBuffer(e),s=new Uint8Array(n);for(let i of r)s.set(i,t),t+=i.length;return s}o(Yw,"utilConcatView");function bB(){let r=new Uint8Array(this.valueHex);if(this.valueHex.byteLength>=2){let u=r[0]===255&&r[1]&128,c=r[0]===0&&(r[1]&128)===0;(u||c)&&this.warnings.push("Needlessly long format")}let e=new ArrayBuffer(this.valueHex.byteLength),t=new Uint8Array(e);for(let u=0;u<this.valueHex.byteLength;u++)t[u]=0;t[0]=r[0]&128;let n=io(t,8),s=new ArrayBuffer(this.valueHex.byteLength),i=new Uint8Array(s);for(let u=0;u<this.valueHex.byteLength;u++)i[u]=r[u];return i[0]&=127,io(i,8)-n}o(bB,"utilDecodeTC");function H9(r){let e=r<0?r*-1:r,t=128;for(let n=1;n<8;n++){if(e<=t){if(r<0){let a=t-e,u=_i(a,8,n),c=new Uint8Array(u);return c[0]|=128,u}let s=_i(e,8,n),i=new Uint8Array(s);if(i[0]&128){let a=s.slice(0),u=new Uint8Array(a);s=new ArrayBuffer(s.byteLength+1),i=new Uint8Array(s);for(let c=0;c<a.byteLength;c++)i[c+1]=u[c];i[0]=0}return s}t*=Math.pow(2,8)}return new ArrayBuffer(0)}o(H9,"utilEncodeTC");function Bu(r,e){if(r.byteLength!==e.byteLength)return!1;let t=new Uint8Array(r),n=new Uint8Array(e);for(let s=0;s<t.length;s++)if(t[s]!==n[s])return!1;return!0}o(Bu,"isEqualBuffer");function bs(r,e){let t=r.toString(10);if(e<t.length)return"";let n=e-t.length,s=new Array(n);for(let a=0;a<n;a++)s[a]="0";return s.join("").concat(t)}o(bs,"padNumber");var K9="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",$9="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=";function Qw(r,e=!1,t=!1,n=!1){let s=0,i=0,a=0,u="",c=e?$9:K9;if(n){let l=0;for(let f=0;f<r.length;f++)if(r.charCodeAt(f)!==0){l=f;break}r=r.slice(l)}for(;s<r.length;){let l=r.charCodeAt(s++);s>=r.length&&(i=1);let f=r.charCodeAt(s++);s>=r.length&&(a=1);let h=r.charCodeAt(s++),d=l>>2,g=(l&3)<<4|f>>4,m=(f&15)<<2|h>>6,v=h&63;i===1?m=v=64:a===1&&(v=64),t?m===64?u+=`${c.charAt(d)}${c.charAt(g)}`:v===64?u+=`${c.charAt(d)}${c.charAt(g)}${c.charAt(m)}`:u+=`${c.charAt(d)}${c.charAt(g)}${c.charAt(m)}${c.charAt(v)}`:u+=`${c.charAt(d)}${c.charAt(g)}${c.charAt(m)}${c.charAt(v)}`}return u}o(Qw,"toBase64");function Ip(r,e=!1,t=!1){let n=e?$9:K9;function s(c){for(let l=0;l<64;l++)if(n.charAt(l)===c)return l;return 64}o(s,"indexOf");function i(c){return c===64?0:c}o(i,"test");let a=0,u="";for(;a<r.length;){let c=s(r.charAt(a++)),l=a>=r.length?0:s(r.charAt(a++)),f=a>=r.length?0:s(r.charAt(a++)),h=a>=r.length?0:s(r.charAt(a++)),d=i(c)<<2|i(l)>>4,g=(i(l)&15)<<4|i(f)>>2,m=(i(f)&3)<<6|i(h);u+=String.fromCharCode(d),f!==64&&(u+=String.fromCharCode(g)),h!==64&&(u+=String.fromCharCode(m))}if(t){let c=u.length,l=-1;for(let f=c-1;f>=0;f--)if(u.charCodeAt(f)!==0){l=f;break}l!==-1?u=u.slice(0,l+1):u=""}return u}o(Ip,"fromBase64");function Qg(r){let e="",t=new Uint8Array(r);for(let n of t)e+=String.fromCharCode(n);return e}o(Qg,"arrayBufferToString");function Cl(r){let e=r.length,t=new ArrayBuffer(e),n=new Uint8Array(t);for(let s=0;s<e;s++)n[s]=r.charCodeAt(s);return t}o(Cl,"stringToArrayBuffer");var Fue=Math.log(2);function X9(r){let e=Math.log(r)/Fue,t=Math.floor(e),n=Math.round(e);return t===n?t:n}o(X9,"nearestPowerOf2");function Ce(r,e){for(let t of e)delete r[t]}o(Ce,"clearProps");function Zw(){if(typeof BigInt>"u")throw new Error("BigInt is not defined. Your environment doesn't implement BigInt.")}o(Zw,"assertBigInt");function NB(r){let e=0,t=0;for(let s=0;s<r.length;s++){let i=r[s];e+=i.byteLength}let n=new Uint8Array(e);for(let s=0;s<r.length;s++){let i=r[s];n.set(new Uint8Array(i),t),t+=i.byteLength}return n.buffer}o(NB,"concat");function ao(r,e,t,n){return e instanceof Uint8Array?e.byteLength?t<0?(r.error="Wrong parameter: inputOffset less than zero",!1):n<0?(r.error="Wrong parameter: inputLength less than zero",!1):e.byteLength-t-n<0?(r.error="End of input reached before message was fully decoded (inconsistent offset and length values)",!1):!0:(r.error="Wrong parameter: inputBuffer has zero length",!1):(r.error="Wrong parameter: inputBuffer must be 'Uint8Array'",!1)}o(ao,"checkBufferParams");var TB=class{static{o(this,"ViewWriter")}constructor(){this.items=[]}write(e){this.items.push(e)}final(){return NB(this.items)}},Zg=[new Uint8Array([1])],z9="0123456789",SB="name",W9="valueHexView",Uue="isHexOnly",Vue="idBlock",Mue="tagClass",jue="tagNumber",que="isConstructed",Hue="fromBER",Kue="toBER",$ue="local",Ss="",xa=new ArrayBuffer(0),eb=new Uint8Array(0),ty="EndOfContent",Y9="OCTET STRING",Q9="BIT STRING";function oo(r){var e;return e=class extends r{static{o(this,"Some")}get valueHex(){return this.valueHexView.slice().buffer}set valueHex(n){this.valueHexView=new Uint8Array(n)}constructor(...n){var s;super(...n);let i=n[0]||{};this.isHexOnly=(s=i.isHexOnly)!==null&&s!==void 0?s:!1,this.valueHexView=i.valueHex?Ze.toUint8Array(i.valueHex):eb}fromBER(n,s,i){let a=n instanceof ArrayBuffer?new Uint8Array(n):n;if(!ao(this,a,s,i))return-1;let u=s+i;return this.valueHexView=a.subarray(s,u),this.valueHexView.length?(this.blockLength=i,u):(this.warnings.push("Zero buffer length"),s)}toBER(n=!1){return this.isHexOnly?n?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",xa)}toJSON(){return{...super.toJSON(),isHexOnly:this.isHexOnly,valueHex:ut.ToHex(this.valueHexView)}}},e.NAME="hexBlock",e}o(oo,"HexBlock");var Nl=class{static{o(this,"LocalBaseBlock")}static blockName(){return this.NAME}get valueBeforeDecode(){return this.valueBeforeDecodeView.slice().buffer}set valueBeforeDecode(e){this.valueBeforeDecodeView=new Uint8Array(e)}constructor({blockLength:e=0,error:t=Ss,warnings:n=[],valueBeforeDecode:s=eb}={}){this.blockLength=e,this.error=t,this.warnings=n,this.valueBeforeDecodeView=Ze.toUint8Array(s)}toJSON(){return{blockName:this.constructor.NAME,blockLength:this.blockLength,error:this.error,warnings:this.warnings,valueBeforeDecode:ut.ToHex(this.valueBeforeDecodeView)}}};Nl.NAME="baseBlock";var As=class extends Nl{static{o(this,"ValueBlock")}fromBER(e,t,n){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}toBER(e,t){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}};As.NAME="valueBlock";var Z9=class extends oo(Nl){static{o(this,"LocalIdentificationBlock")}constructor({idBlock:e={}}={}){var t,n,s,i;super(),e?(this.isHexOnly=(t=e.isHexOnly)!==null&&t!==void 0?t:!1,this.valueHexView=e.valueHex?Ze.toUint8Array(e.valueHex):eb,this.tagClass=(n=e.tagClass)!==null&&n!==void 0?n:-1,this.tagNumber=(s=e.tagNumber)!==null&&s!==void 0?s:-1,this.isConstructed=(i=e.isConstructed)!==null&&i!==void 0?i:!1):(this.tagClass=-1,this.tagNumber=-1,this.isConstructed=!1)}toBER(e=!1){let t=0;switch(this.tagClass){case 1:t|=0;break;case 2:t|=64;break;case 3:t|=128;break;case 4:t|=192;break;default:return this.error="Unknown tag class",xa}if(this.isConstructed&&(t|=32),this.tagNumber<31&&!this.isHexOnly){let s=new Uint8Array(1);if(!e){let i=this.tagNumber;i&=31,t|=i,s[0]=t}return s.buffer}if(!this.isHexOnly){let s=_i(this.tagNumber,7),i=new Uint8Array(s),a=s.byteLength,u=new Uint8Array(a+1);if(u[0]=t|31,!e){for(let c=0;c<a-1;c++)u[c+1]=i[c]|128;u[a]=i[a-1]}return u.buffer}let n=new Uint8Array(this.valueHexView.byteLength+1);if(n[0]=t|31,!e){let s=this.valueHexView;for(let i=0;i<s.length-1;i++)n[i+1]=s[i]|128;n[this.valueHexView.byteLength]=s[s.length-1]}return n.buffer}fromBER(e,t,n){let s=Ze.toUint8Array(e);if(!ao(this,s,t,n))return-1;let i=s.subarray(t,t+n);if(i.length===0)return this.error="Zero buffer length",-1;switch(i[0]&192){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=(i[0]&32)===32,this.isHexOnly=!1;let u=i[0]&31;if(u!==31)this.tagNumber=u,this.blockLength=1;else{let c=1,l=this.valueHexView=new Uint8Array(255),f=255;for(;i[c]&128;){if(l[c-1]=i[c]&127,c++,c>=i.length)return this.error="End of input reached before message was fully decoded",-1;if(c===f){f+=255;let d=new Uint8Array(f);for(let g=0;g<l.length;g++)d[g]=l[g];l=this.valueHexView=new Uint8Array(f)}}this.blockLength=c+1,l[c-1]=i[c]&127;let h=new Uint8Array(c);for(let d=0;d<c;d++)h[d]=l[d];l=this.valueHexView=new Uint8Array(c),l.set(h),this.blockLength<=9?this.tagNumber=io(l,7):(this.isHexOnly=!0,this.warnings.push("Tag too long, represented as hex-coded"))}if(this.tagClass===1&&this.isConstructed)switch(this.tagNumber){case 1:case 2:case 5:case 6:case 9:case 13:case 14:case 23:case 24:case 31:case 32:case 33:case 34:return this.error="Constructed encoding used for primitive type",-1}return t+this.blockLength}toJSON(){return{...super.toJSON(),tagClass:this.tagClass,tagNumber:this.tagNumber,isConstructed:this.isConstructed}}};Z9.NAME="identificationBlock";var eq=class extends Nl{static{o(this,"LocalLengthBlock")}constructor({lenBlock:e={}}={}){var t,n,s;super(),this.isIndefiniteForm=(t=e.isIndefiniteForm)!==null&&t!==void 0?t:!1,this.longFormUsed=(n=e.longFormUsed)!==null&&n!==void 0?n:!1,this.length=(s=e.length)!==null&&s!==void 0?s:0}fromBER(e,t,n){let s=Ze.toUint8Array(e);if(!ao(this,s,t,n))return-1;let i=s.subarray(t,t+n);if(i.length===0)return this.error="Zero buffer length",-1;if(i[0]===255)return this.error="Length block 0xFF is reserved by standard",-1;if(this.isIndefiniteForm=i[0]===128,this.isIndefiniteForm)return this.blockLength=1,t+this.blockLength;if(this.longFormUsed=!!(i[0]&128),this.longFormUsed===!1)return this.length=i[0],this.blockLength=1,t+this.blockLength;let a=i[0]&127;if(a>8)return this.error="Too big integer",-1;if(a+1>i.length)return this.error="End of input reached before message was fully decoded",-1;let u=t+1,c=s.subarray(u,u+a);return c[a-1]===0&&this.warnings.push("Needlessly long encoded length"),this.length=io(c,8),this.longFormUsed&&this.length<=127&&this.warnings.push("Unnecessary usage of long length form"),this.blockLength=a+1,t+this.blockLength}toBER(e=!1){let t,n;if(this.length>127&&(this.longFormUsed=!0),this.isIndefiniteForm)return t=new ArrayBuffer(1),e===!1&&(n=new Uint8Array(t),n[0]=128),t;if(this.longFormUsed){let s=_i(this.length,8);if(s.byteLength>127)return this.error="Too big length",xa;if(t=new ArrayBuffer(s.byteLength+1),e)return t;let i=new Uint8Array(s);n=new Uint8Array(t),n[0]=s.byteLength|128;for(let a=0;a<s.byteLength;a++)n[a+1]=i[a];return t}return t=new ArrayBuffer(1),e===!1&&(n=new Uint8Array(t),n[0]=this.length),t}toJSON(){return{...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,longFormUsed:this.longFormUsed,length:this.length}}};eq.NAME="lengthBlock";var ze={},ts=class extends Nl{static{o(this,"BaseBlock")}constructor({name:e=Ss,optional:t=!1,primitiveSchema:n,...s}={},i){super(s),this.name=e,this.optional=t,n&&(this.primitiveSchema=n),this.idBlock=new Z9(s),this.lenBlock=new eq(s),this.valueBlock=i?new i(s):new As(s)}fromBER(e,t,n){let s=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return s===-1?(this.error=this.valueBlock.error,s):(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),s)}toBER(e,t){let n=t||new TB;t||tq(this);let s=this.idBlock.toBER(e);if(n.write(s),this.lenBlock.isIndefiniteForm)n.write(new Uint8Array([128]).buffer),this.valueBlock.toBER(e,n),n.write(new ArrayBuffer(2));else{let i=this.valueBlock.toBER(e);this.lenBlock.length=i.byteLength;let a=this.lenBlock.toBER(e);n.write(a),n.write(i)}return t?xa:n.final()}toJSON(){let e={...super.toJSON(),idBlock:this.idBlock.toJSON(),lenBlock:this.lenBlock.toJSON(),valueBlock:this.valueBlock.toJSON(),name:this.name,optional:this.optional};return this.primitiveSchema&&(e.primitiveSchema=this.primitiveSchema.toJSON()),e}toString(e="ascii"){return e==="ascii"?this.onAsciiEncoding():ut.ToHex(this.toBER())}onAsciiEncoding(){let e=this.constructor.NAME,t=ut.ToHex(this.valueBlock.valueBeforeDecodeView);return`${e} : ${t}`}isEqual(e){if(this===e)return!0;if(!(e instanceof this.constructor))return!1;let t=this.toBER(),n=e.toBER();return Bu(t,n)}};ts.NAME="BaseBlock";function tq(r){var e;if(r instanceof ze.Constructed)for(let t of r.valueBlock.value)tq(t)&&(r.lenBlock.isIndefiniteForm=!0);return!!(!((e=r.lenBlock)===null||e===void 0)&&e.isIndefiniteForm)}o(tq,"prepareIndefiniteForm");var rq=class extends ts{static{o(this,"BaseStringBlock")}getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}constructor({value:e=Ss,...t}={},n){super(t,n),e&&this.fromString(e)}fromBER(e,t,n){let s=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return s===-1?(this.error=this.valueBlock.error,s):(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),s)}onAsciiEncoding(){return`${this.constructor.NAME} : '${this.valueBlock.value}'`}};rq.NAME="BaseStringBlock";var nq=class extends oo(As){static{o(this,"LocalPrimitiveValueBlock")}constructor({isHexOnly:e=!0,...t}={}){super(t),this.isHexOnly=e}};nq.NAME="PrimitiveValueBlock";var sq,tt=class extends ts{static{o(this,"Primitive")}constructor(e={}){super(e,nq),this.idBlock.isConstructed=!1}};sq=tt;ze.Primitive=sq;tt.NAME="PRIMITIVE";function Xue(r,e){if(r instanceof e)return r;let t=new e;return t.idBlock=r.idBlock,t.lenBlock=r.lenBlock,t.warnings=r.warnings,t.valueBeforeDecodeView=r.valueBeforeDecodeView,t}o(Xue,"localChangeType");function ry(r,e=0,t=r.length){let n=e,s=new ts({},As),i=new Nl;if(!ao(i,r,e,t))return s.error=i.error,{offset:-1,result:s};if(!r.subarray(e,e+t).length)return s.error="Zero buffer length",{offset:-1,result:s};let u=s.idBlock.fromBER(r,e,t);if(s.idBlock.warnings.length&&s.warnings.concat(s.idBlock.warnings),u===-1)return s.error=s.idBlock.error,{offset:-1,result:s};if(e=u,t-=s.idBlock.blockLength,u=s.lenBlock.fromBER(r,e,t),s.lenBlock.warnings.length&&s.warnings.concat(s.lenBlock.warnings),u===-1)return s.error=s.lenBlock.error,{offset:-1,result:s};if(e=u,t-=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 c=ts;switch(s.idBlock.tagClass){case 1:if(s.idBlock.tagNumber>=37&&s.idBlock.isHexOnly===!1)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};c=ze.EndOfContent;break;case 1:c=ze.Boolean;break;case 2:c=ze.Integer;break;case 3:c=ze.BitString;break;case 4:c=ze.OctetString;break;case 5:c=ze.Null;break;case 6:c=ze.ObjectIdentifier;break;case 10:c=ze.Enumerated;break;case 12:c=ze.Utf8String;break;case 13:c=ze.RelativeObjectIdentifier;break;case 14:c=ze.TIME;break;case 15:return s.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:s};case 16:c=ze.Sequence;break;case 17:c=ze.Set;break;case 18:c=ze.NumericString;break;case 19:c=ze.PrintableString;break;case 20:c=ze.TeletexString;break;case 21:c=ze.VideotexString;break;case 22:c=ze.IA5String;break;case 23:c=ze.UTCTime;break;case 24:c=ze.GeneralizedTime;break;case 25:c=ze.GraphicString;break;case 26:c=ze.VisibleString;break;case 27:c=ze.GeneralString;break;case 28:c=ze.UniversalString;break;case 29:c=ze.CharacterString;break;case 30:c=ze.BmpString;break;case 31:c=ze.DATE;break;case 32:c=ze.TimeOfDay;break;case 33:c=ze.DateTime;break;case 34:c=ze.Duration;break;default:{let l=s.idBlock.isConstructed?new ze.Constructed:new ze.Primitive;l.idBlock=s.idBlock,l.lenBlock=s.lenBlock,l.warnings=s.warnings,s=l}}break;case 2:case 3:case 4:default:c=s.idBlock.isConstructed?ze.Constructed:ze.Primitive}return s=Xue(s,c),u=s.fromBER(r,e,s.lenBlock.isIndefiniteForm?t:s.lenBlock.length),s.valueBeforeDecodeView=r.subarray(n,n+s.blockLength),{offset:u,result:s}}o(ry,"localFromBER");function Or(r){if(!r.byteLength){let e=new ts({},As);return e.error="Input buffer has zero length",{offset:-1,result:e}}return ry(Ze.toUint8Array(r).slice(),0,r.byteLength)}o(Or,"fromBER");function Gue(r,e){return r?1:e}o(Gue,"checkLen");var Ru=class extends As{static{o(this,"LocalConstructedValueBlock")}constructor({value:e=[],isIndefiniteForm:t=!1,...n}={}){super(n),this.value=e,this.isIndefiniteForm=t}fromBER(e,t,n){let s=Ze.toUint8Array(e);if(!ao(this,s,t,n))return-1;if(this.valueBeforeDecodeView=s.subarray(t,t+n),this.valueBeforeDecodeView.length===0)return this.warnings.push("Zero buffer length"),t;let i=t;for(;Gue(this.isIndefiniteForm,n)>0;){let a=ry(s,i,n);if(a.offset===-1)return this.error=a.result.error,this.warnings.concat(a.result.warnings),-1;if(i=a.offset,this.blockLength+=a.result.blockLength,n-=a.result.blockLength,this.value.push(a.result),this.isIndefiniteForm&&a.result.constructor.NAME===ty)break}return this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.NAME===ty?this.value.pop():this.warnings.push("No EndOfContent block encoded")),i}toBER(e,t){let n=t||new TB;for(let s=0;s<this.value.length;s++)this.value[s].toBER(e,n);return t?xa:n.final()}toJSON(){let e={...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,value:[]};for(let t of this.value)e.value.push(t.toJSON());return e}};Ru.NAME="ConstructedValueBlock";var iq,ae=class extends ts{static{o(this,"Constructed")}constructor(e={}){super(e,Ru),this.idBlock.isConstructed=!0}fromBER(e,t,n){this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm;let s=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return s===-1?(this.error=this.valueBlock.error,s):(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),s)}onAsciiEncoding(){let e=[];for(let n of this.valueBlock.value)e.push(n.toString("ascii").split(`
|
|
100
|
+
`);let e;return typeof DOMParser<"u"?e=DOMParser:e=Ap("DOMParser"),new e().parseFromString(r,P9)}o(zg,"Parse");function Sp(r){let e;return typeof XMLSerializer<"u"?e=XMLSerializer:e=Ap("XMLSerializer"),new e().serializeToString(r)}o(Sp,"Stringify");function zw(r,e){let t=k9(r,e);return t&&t.length>0?t[0]:null}o(zw,"SelectSingleNode");function L9(r,e){return r&&r.nodeType===e}o(L9,"isNodeType");function Vs(r){return L9(r,xt.Element)}o(Vs,"isElement");function Sl(r){return L9(r,xt.Document)}o(Sl,"isDocument");var F9=new Map;function U9(r){for(let e in r)F9.set(e,r[e])}o(U9,"setNodeDependencies");function Ap(r){let e=F9.get(r);if(!e)throw new Error(`Node dependency not found: ${r}. Please use 'setNodeDependencies' to register it.`);return e}o(Ap,"getNodeDependency");var Wg="element",Jg="attribute",Ww="content";var Due=1e9;function vB(r,...e){let t=r;for(let n=0;n<e.length;n++){let s=e[n];for(let i in s)Object.prototype.hasOwnProperty.call(s,i)&&(t[i]=s[i])}return t}o(vB,"assign");function Et(r){return e=>{let t=e;t.localName=r.localName||t.name,t.namespaceURI=r.namespaceURI||t.namespaceURI||null,t.prefix=r.prefix||t.prefix||null,t.parser=r.parser||t.parser,t.target!==t&&(t.items=vB({},t.items)),t.target=e}}o(Et,"XmlElement");function Dt(r={}){return(e,t)=>{let n=e.constructor,s=t;n.items||(n.items={}),n.target!==n&&(n.items=vB({},n.items)),n.target=e;let i;r.parser?i={parser:r.parser,required:r.required||!1,maxOccurs:r.maxOccurs||Due,minOccurs:r.minOccurs===void 0?0:r.minOccurs,noRoot:r.noRoot||!1}:i={namespaceURI:r.namespaceURI||null,required:r.required||!1,prefix:r.prefix||null,defaultValue:r.defaultValue,converter:r.converter,noRoot:r.noRoot||!1},r.localName=r.localName||r.parser&&r.parser.localName||s;let a=n.items,u=r.parser&&r.parser.namespaceURI;a[s]={...i,namespaceURI:r.namespaceURI||u||null,prefix:r.prefix||r.parser&&r.parser.prefix||null,localName:r.localName,type:Wg},M9(e,s,r)}}o(Dt,"XmlChildElement");function wr(r={required:!1,namespaceURI:null}){return(e,t)=>{let n=e.constructor,s=t;r.localName||(r.localName=t),n.items||(n.items={}),n.target!==n&&(n.items=vB({},n.items)),n.target=e;let i=n.items;i[t]=r,i[t].type=Jg,M9(e,s,r)}}o(wr,"XmlAttribute");function M9(r,e,t){let n=`_${e}`,s={set:o(function(i){this[n]!==i&&(this.element=null,this[n]=i)},"set"),get:o(function(){if(this[n]===void 0){let i=t.defaultValue;t.parser&&(i=new t.parser,i.localName=t.localName),this[n]=i}return this[n]},"get")};Object.defineProperty(r,n,{writable:!0,enumerable:!1}),Object.defineProperty(r,e,s)}o(M9,"defineProperty");var Du=class r{static{o(this,"Collection")}constructor(e){this.items=[],e&&(this.items=e)}get Count(){return this.items.length}Item(e){return this.items[e]||null}Add(e){this.items.push(e)}Pop(){return this.items.pop()}RemoveAt(e){this.items=this.items.filter((t,n)=>n!==e)}Clear(){this.items=[]}GetIterator(){return this.items}ForEach(e){this.GetIterator().forEach(e)}Map(e){return new r(this.GetIterator().map(e))}Filter(e){return new r(this.GetIterator().filter(e))}Sort(e){return new r(this.GetIterator().sort(e))}Every(e){return this.GetIterator().every(e)}Some(e){return this.GetIterator().some(e)}IsEmpty(){return this.Count===0}};function Bue(r,...e){let t=r.replace(/%([1-9]\d*)/g,(n,s)=>{let i=parseInt(s,10)-1;return e[i]!==void 0?e[i]:""});return t=t.replace(/%%/g,"%"),t}o(Bue,"printf");function Rue(r,e){let t=r+"";for(;t.length<e;)t="0"+t;return t}o(Rue,"padNum");var _e=class{static{o(this,"XmlError")}constructor(e,...t){this.prefix="XMLJS",this.code=e,this.name=this.constructor.name;let n=Bue(Jr[e],...t);this.message=`${this.prefix}${Rue(e,4)}: ${n}`,this.stack=new Error(this.message).stack}},we;(function(r){r[r.NONE=0]="NONE",r[r.NULL_REFERENCE=1]="NULL_REFERENCE",r[r.NULL_PARAM=2]="NULL_PARAM",r[r.DECORATOR_NULL_PARAM=3]="DECORATOR_NULL_PARAM",r[r.COLLECTION_LIMIT=4]="COLLECTION_LIMIT",r[r.METHOD_NOT_IMPLEMENTED=5]="METHOD_NOT_IMPLEMENTED",r[r.METHOD_NOT_SUPPORTED=6]="METHOD_NOT_SUPPORTED",r[r.PARAM_REQUIRED=7]="PARAM_REQUIRED",r[r.CONVERTER_UNSUPPORTED=8]="CONVERTER_UNSUPPORTED",r[r.ELEMENT_MALFORMED=9]="ELEMENT_MALFORMED",r[r.ELEMENT_MISSING=10]="ELEMENT_MISSING",r[r.ATTRIBUTE_MISSING=11]="ATTRIBUTE_MISSING",r[r.CONTENT_MISSING=12]="CONTENT_MISSING",r[r.CRYPTOGRAPHIC=13]="CRYPTOGRAPHIC",r[r.CRYPTOGRAPHIC_NO_MODULE=14]="CRYPTOGRAPHIC_NO_MODULE",r[r.CRYPTOGRAPHIC_UNKNOWN_TRANSFORM=15]="CRYPTOGRAPHIC_UNKNOWN_TRANSFORM",r[r.ALGORITHM_NOT_SUPPORTED=16]="ALGORITHM_NOT_SUPPORTED",r[r.ALGORITHM_WRONG_NAME=17]="ALGORITHM_WRONG_NAME",r[r.XML_EXCEPTION=18]="XML_EXCEPTION",r[r.KEY_INFO_CLAUSE_NOT_SUPPORTED=19]="KEY_INFO_CLAUSE_NOT_SUPPORTED"})(we||(we={}));var Jr={};Jr[we.NONE]="No description";Jr[we.NULL_REFERENCE]="Null reference";Jr[we.NULL_PARAM]="'%1' has empty '%2' object";Jr[we.DECORATOR_NULL_PARAM]="Decorator '%1' has empty '%2' parameter";Jr[we.COLLECTION_LIMIT]="Collection of '%1' in element '%2' has wrong amount of items";Jr[we.METHOD_NOT_IMPLEMENTED]="Method is not implemented";Jr[we.METHOD_NOT_SUPPORTED]="Method is not supported";Jr[we.PARAM_REQUIRED]="Required parameter is missing '%1'";Jr[we.CONVERTER_UNSUPPORTED]="Converter is not supported";Jr[we.ELEMENT_MALFORMED]="Malformed element '%1'";Jr[we.ELEMENT_MISSING]="Element '%1' is missing in '%2'";Jr[we.ATTRIBUTE_MISSING]="Attribute '%1' is missing in '%2'";Jr[we.CONTENT_MISSING]="Content is missing in '%1'";Jr[we.CRYPTOGRAPHIC]="Cryptographic error: %1";Jr[we.CRYPTOGRAPHIC_NO_MODULE]="WebCrypto module is not found";Jr[we.CRYPTOGRAPHIC_UNKNOWN_TRANSFORM]="Unknown transform %1";Jr[we.ALGORITHM_NOT_SUPPORTED]="Algorithm is not supported '%1'";Jr[we.ALGORITHM_WRONG_NAME]="Algorithm wrong name in use '%1'";Jr[we.XML_EXCEPTION]="XML exception: %1";Jr[we.KEY_INFO_CLAUSE_NOT_SUPPORTED]="KeyInfoClause type '%1' is not supported";var ir=class{static{o(this,"Convert")}static ToString(e,t="utf8"){let n=new Uint8Array(e);switch(t.toLowerCase()){case"utf8":return this.ToUtf8String(n);case"binary":return this.ToBinary(n);case"hex":return this.ToHex(n);case"base64":return this.ToBase64(n);case"base64url":return this.ToBase64Url(n);default:throw new _e(we.CONVERTER_UNSUPPORTED)}}static FromString(e,t="utf8"){switch(t.toLowerCase()){case"utf8":return this.FromUtf8String(e);case"binary":return this.FromBinary(e);case"hex":return this.FromHex(e);case"base64":return this.FromBase64(e);case"base64url":return this.FromBase64Url(e);default:throw new _e(we.CONVERTER_UNSUPPORTED)}}static ToBase64(e){if(typeof btoa<"u"){let t=this.ToString(e,"binary");return btoa(t)}else{if(typeof Buffer<"u")return Buffer.from(e).toString("base64");throw new _e(we.CONVERTER_UNSUPPORTED)}}static FromBase64(e){if(e=e.replace(/\n/g,"").replace(/\r/g,"").replace(/\t/g,"").replace(/\s/g,""),typeof atob<"u")return this.FromBinary(atob(e));if(typeof Buffer<"u")return new Uint8Array(Buffer.from(e,"base64"));throw new _e(we.CONVERTER_UNSUPPORTED)}static FromBase64Url(e){return this.FromBase64(this.Base64Padding(e.replace(/-/g,"+").replace(/_/g,"/")))}static ToBase64Url(e){return this.ToBase64(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}static FromUtf8String(e){let t=unescape(encodeURIComponent(e)),n=new Uint8Array(t.length);for(let s=0;s<t.length;s++)n[s]=t.charCodeAt(s);return n}static ToUtf8String(e){let t=String.fromCharCode.apply(null,e);return decodeURIComponent(escape(t))}static FromBinary(e){let t=e.length,n=new Uint8Array(t);for(let s=0;s<t;s++)n[s]=e.charCodeAt(s);return n}static ToBinary(e){let t="";for(let n=0;n<e.length;n++)t=t+String.fromCharCode(e[n]);return t}static ToHex(e){let n=[];for(let s=0;s<e.length;s++){let i=e[s].toString(16);n.push(i.length===1?"0"+i:i)}return n.join("")}static FromHex(e){let t=new Uint8Array(e.length/2);for(let n=0;n<e.length;n=n+2){let s=e.slice(n,n+2);t[n/2]=parseInt(s,16)}return t}static ToDateTime(e){return new Date(e)}static FromDateTime(e){return e.toISOString()}static Base64Padding(e){let t=4-e.length%4;if(t<4)for(let n=0;n<t;n++)e+="=";return e}};var oi={get:o(r=>{if(r)return ir.ToBase64(r)},"get"),set:o(r=>ir.FromBase64(r),"set")},Yg={get:o(r=>r?r.toString():"0","get"),set:o(r=>Number(r),"set")};var _ue="xml_root",ws=class r{static{o(this,"XmlObject")}static LoadXml(e){let t=new this;return t.LoadXml(e),t}static GetElement(e,t,n=!0){let s=e.getElementsByTagName(t);if(n&&s.length===0)throw new _e(we.ELEMENT_MISSING,t,e.localName);return s[0]||null}static GetAttribute(e,t,n,s=!0){if(e.hasAttribute(t))return e.getAttribute(t);if(s)throw new _e(we.ATTRIBUTE_MISSING,t,e.localName);return n}static GetElementById(e,t){if(e==null||t==null)return null;let n=null;return Sl(e)&&(n=e.getElementById(t)),n==null&&(n=zw(e,`//*[@*[local-name()='Id']='${t}']`),n==null&&(n=zw(e,`//*[@*[local-name()='ID']='${t}']`),n==null&&(n=zw(e,`//*[@*[local-name()='id']='${t}']`)))),n}static CreateDocument(e=_ue,t=null,n=null){if(n&&!t)throw new _e(we.PARAM_REQUIRED,"namespaceUri",`Prefix '${n}' requires namespaceUri`);let s="",i="",a="";n&&(s=n+":",i=":"+n),t&&(a=` xmlns${i}="${t}"`);let u=`${s}${e}`;return zg(`<${u}${a}></${u}>`)}static GetChildren(e,t,n){e=Sl(e)?e.documentElement:e;let s=[];for(let i=0;i<e.childNodes.length;i++){let a=e.childNodes[i];Vs(a)&&a.localName===t&&(a.namespaceURI===n||!n)&&s.push(a)}return s}static GetFirstChild(e,t,n){e=Sl(e)?e.documentElement:e;for(let s=0;s<e.childNodes.length;s++){let i=e.childNodes[s];if(Vs(i)&&i.localName===t&&(i.namespaceURI===n||!n))return i}return null}static GetChild(e,t,n,s=!0){for(let i=0;i<e.childNodes.length;i++){let a=e.childNodes[i];if(Vs(a)&&a.localName===t&&(a.namespaceURI===n||!n))return a}if(s)throw new _e(we.ELEMENT_MISSING,t,e.localName);return null}constructor(e={}){if(this.prefix=this.GetStatic().prefix||null,this.localName=this.GetStatic().localName,this.namespaceURI=this.GetStatic().namespaceURI,e)for(let[t,n]of Object.entries(e))n!==void 0&&(this[t]=n)}get Element(){return this.element}get Prefix(){return this.prefix}set Prefix(e){this.prefix=e}get LocalName(){return this.localName||""}get NamespaceURI(){return this.namespaceURI||null}HasChanged(){let e=this.GetStatic();if(e.items)for(let t in e.items){if(!Object.prototype.hasOwnProperty.call(e.items,t))continue;let n=e.items[t],s=this[t];if(n.parser&&s&&s.HasChanged())return!0}return this.element===null}GetXml(e){if(!(e||this.HasChanged()))return this.element||null;let t=this,n=this.CreateDocument(),s=this.CreateElement(),i=this.GetStatic(),a=this.localName||"";if(i.items)for(let u in i.items){if(!Object.prototype.hasOwnProperty.call(i.items,u))continue;let c=t[u],l=i.items[u];switch(l.type){case Ww:{let f=l,h=f.converter?f.converter.get(c):c;if(f.required&&h==null)throw new _e(we.CONTENT_MISSING,a);(f.defaultValue!==c||f.required)&&(s.textContent=h);break}case Jg:{let f=l,h=f.converter?f.converter.get(c):c;if(f.required&&h==null)throw new _e(we.ATTRIBUTE_MISSING,f.localName,a);(f.defaultValue!==c||f.required)&&(f.namespaceURI?s.setAttributeNS(f.namespaceURI,f.localName||"",h):s.setAttribute(f.localName||"",h));break}case Wg:{let f=l,h=null;if(f.parser){if(f.required&&!c||f.minOccurs&&!c.Count){let d=c?.localName||f.localName;throw new _e(we.ELEMENT_MISSING,d,a)}c&&(h=c.GetXml(c.element===void 0&&(f.required||c.Count)))}else{let d=f.converter?f.converter.get(c):c;if(f.required&&d===void 0)throw new _e(we.ELEMENT_MISSING,f.localName,a);if(c!==f.defaultValue||f.required)if(f.namespaceURI?h=n.createElementNS(f.namespaceURI,`${f.prefix?f.prefix+":":""}${f.localName}`):h=n.createElement(`${f.prefix?f.prefix+":":""}${f.localName}`),Array.isArray(d))for(let g of d){let m=g instanceof r?g.GetXml(!0):g;m!==null&&h&&h.appendChild(m)}else if(d instanceof r){let g=d.GetXml(!0);g&&h&&h.appendChild(g)}else h&&(h.textContent=d)}if(h)if(f.noRoot){let d=[];for(let v=0;v<h.childNodes.length;v++){let y=h.childNodes.item(v);Vs(y)&&d.push(y)}let g=f.minOccurs||0,m=f.maxOccurs||1/0;if(d.length<g||d.length>m)throw new _e(we.COLLECTION_LIMIT,c.localName,i.localName);d.forEach(v=>s.appendChild(v.cloneNode(!0)))}else{if(h.childNodes.length<(f.minOccurs||0)||h.childNodes.length>(f.maxOccurs||1/0))throw new _e(we.COLLECTION_LIMIT,c.localName,i.localName);s.appendChild(h)}break}}}return this.OnGetXml(s),this.element=s,s}LoadXml(e){let t,n=this;if(typeof e=="string"?t=zg(e).documentElement:t=e,!t)throw new _e(we.PARAM_REQUIRED,"element");let s=this.GetStatic(),i=this.localName||"";if(!(t.localName===i&&t.namespaceURI==this.NamespaceURI))throw new _e(we.ELEMENT_MALFORMED,i);if(s.items)for(let a in s.items){if(!Object.prototype.hasOwnProperty.call(s.items,a))continue;let u=s.items[a];switch(u.type){case Ww:{let c=u;if(c.required&&!t.textContent)throw new _e(we.CONTENT_MISSING,i);if(!t.textContent)n[a]=c.defaultValue;else{let l=c.converter?c.converter.set(t.textContent):t.textContent;n[a]=l}break}case Jg:{let c=u,l,f;if(!c.localName)throw new _e(we.PARAM_REQUIRED,"localName");if(c.namespaceURI?(l=t.hasAttributeNS.bind(t,c.namespaceURI,c.localName),f=t.getAttributeNS.bind(t,c.namespaceURI,c.localName)):(l=t.hasAttribute.bind(t,c.localName),f=t.getAttribute.bind(t,c.localName)),c.required&&!l())throw new _e(we.ATTRIBUTE_MISSING,c.localName,i);if(!l())n[a]=c.defaultValue;else{let h=f(),d=c.converter&&h?c.converter.set(h):h;n[a]=d}break}case Wg:{let c=u;if(c.noRoot){if(!c.parser)throw new _e(we.XML_EXCEPTION,`Schema for '${c.localName}' with flag noRoot must have 'parser'`);let f=new c.parser;if(!(f instanceof Cp))throw new _e(we.XML_EXCEPTION,`Schema for '${c.localName}' with flag noRoot must have 'parser' like instance of XmlCollection`);f.OnLoadXml(t),delete f.element;let h=c.minOccurs||0,d=c.maxOccurs||1/0;if(f.Count<h||f.Count>d)throw new _e(we.COLLECTION_LIMIT,c.parser.localName,i);n[a]=f;continue}let l=null;for(let f=0;f<t.childNodes.length;f++){let h=t.childNodes.item(f);if(!Vs(h))continue;let d=h;if(d.localName===c.localName&&d.namespaceURI==c.namespaceURI){l=d;break}}if(c.required&&!l)throw new _e(we.ELEMENT_MISSING,c.parser?c.parser.localName:c.localName,i);if(c.parser){if(l){let f=new c.parser;f.localName=c.localName,f.namespaceURI=c.namespaceURI,n[a]=f,f.LoadXml(l)}}else if(!l)n[a]=c.defaultValue;else{let f=l.textContent||"",h=c.converter?c.converter.set(f):f;n[a]=h}break}}}this.OnLoadXml(t),this.prefix=t.prefix||"",this.element=t}toString(){let e=this.GetXml();return e?Sp(e):""}GetElement(e,t=!0){if(!this.element)throw new _e(we.NULL_PARAM,this.localName);return r.GetElement(this.element,e,t)}GetChildren(e,t){if(!this.element)throw new _e(we.NULL_PARAM,this.localName);return r.GetChildren(this.element,e,t||this.NamespaceURI||void 0)}GetChild(e,t=!0){if(!this.element)throw new _e(we.NULL_PARAM,this.localName);return r.GetChild(this.element,e,this.NamespaceURI||void 0,t)}GetFirstChild(e,t){if(!this.element)throw new _e(we.NULL_PARAM,this.localName);return r.GetFirstChild(this.element,e,t)}GetAttribute(e,t,n=!0){if(!this.element)throw new _e(we.NULL_PARAM,this.localName);return r.GetAttribute(this.element,e,t,n)}IsEmpty(){return this.Element===void 0}OnLoadXml(e){}GetStatic(){return this.constructor}GetPrefix(){return this.Prefix?this.prefix+":":""}OnGetXml(e){}CreateElement(e,t,n=null,s=null){if(!e){let u=this.CreateDocument();if(u)e=u;else throw new _e(we.XML_EXCEPTION,"Document not created")}t=t||this.localName,n=n||this.NamespaceURI,s=s||this.prefix;let i=(s?`${s}:`:"")+t,a=n&&e?e.createElementNS(n,i):e?.createElement(i);return e&&a&&e.importNode(a,!0),a}CreateDocument(){return r.CreateDocument(this.localName,this.NamespaceURI,this.Prefix)}};var Cp=class extends ws{static{o(this,"XmlCollection")}constructor(){super(...arguments),this.MaxOccurs=Number.MAX_VALUE,this.MinOccurs=0,this.items=[]}HasChanged(){let e=super.HasChanged(),t=this.Some(n=>n.HasChanged());return e||t}get Count(){return this.items.length}Item(e){return this.items[e]||null}Add(e){this.items.push(e),this.element=null}Pop(){return this.element=null,this.items.pop()}RemoveAt(e){this.items=this.items.filter((t,n)=>n!==e),this.element=null}Clear(){this.items=[],this.element=null}GetIterator(){return this.items}ForEach(e){this.GetIterator().forEach(e)}Map(e){return new Du(this.GetIterator().map(e))}Filter(e){return new Du(this.GetIterator().filter(e))}Sort(e){return new Du(this.GetIterator().sort(e))}Every(e){return this.GetIterator().every(e)}Some(e){return this.GetIterator().some(e)}IsEmpty(){return this.Count===0}OnGetXml(e){for(let t of this.GetIterator()){let n=t.GetXml();n&&e.appendChild(n)}}OnLoadXml(e){let t=this.GetStatic();if(!t.parser)throw new _e(we.XML_EXCEPTION,`${t.localName} doesn't have required 'parser' in @XmlElement`);for(let n=0;n<e.childNodes.length;n++){let s=e.childNodes.item(n);if(!(Vs(s)&&s.localName===t.parser.localName&&s.namespaceURI==t.namespaceURI))continue;let i=s,a=new t.parser;a.LoadXml(i),this.Add(a)}}};var Np=class extends Du{static{o(this,"NamespaceManager")}Add(e){e.prefix=e.prefix||"",e.namespace=e.namespace||"",super.Add(e)}GetPrefix(e,t=this.Count-1){let n=this.Count-1;e=e||"",t>n&&(t=n);for(let s=t;s>=0;s--){let i=this.items[s];if(i.prefix===e)return i}return null}GetNamespace(e,t=this.Count-1){let n=this.Count-1;e=e||"",t>n&&(t=n);for(let s=t;s>=0;s--){let i=this.items[s];if(i.namespace===e)return i}return null}};var Oue="[object ArrayBuffer]",Ze=class wB{static{o(this,"BufferSourceConverter")}static isArrayBuffer(e){return Object.prototype.toString.call(e)===Oue}static toArrayBuffer(e){return this.isArrayBuffer(e)?e:e.byteLength===e.buffer.byteLength||e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer:this.toUint8Array(e.buffer).slice(e.byteOffset,e.byteOffset+e.byteLength).buffer}static toUint8Array(e){return this.toView(e,Uint8Array)}static toView(e,t){if(e.constructor===t)return e;if(this.isArrayBuffer(e))return new t(e);if(this.isArrayBufferView(e))return new t(e.buffer,e.byteOffset,e.byteLength);throw new TypeError("The provided value is not of type '(ArrayBuffer or ArrayBufferView)'")}static isBufferSource(e){return this.isArrayBufferView(e)||this.isArrayBuffer(e)}static isArrayBufferView(e){return ArrayBuffer.isView(e)||e&&this.isArrayBuffer(e.buffer)}static isEqual(e,t){let n=wB.toUint8Array(e),s=wB.toUint8Array(t);if(n.length!==s.byteLength)return!1;for(let i=0;i<n.length;i++)if(n[i]!==s[i])return!1;return!0}static concat(...e){let t;Array.isArray(e[0])&&!(e[1]instanceof Function)||Array.isArray(e[0])&&e[1]instanceof Function?t=e[0]:e[e.length-1]instanceof Function?t=e.slice(0,e.length-1):t=e;let n=0;for(let a of t)n+=a.byteLength;let s=new Uint8Array(n),i=0;for(let a of t){let u=this.toUint8Array(a);s.set(u,i),i+=u.length}return e[e.length-1]instanceof Function?this.toView(s,e[e.length-1]):s.buffer}},EB="string",Pue=/^[0-9a-f\s]+$/i,kue=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,Lue=/^[a-zA-Z0-9-_]+$/,j9=class{static{o(this,"Utf8Converter")}static fromString(e){let t=unescape(encodeURIComponent(e)),n=new Uint8Array(t.length);for(let s=0;s<t.length;s++)n[s]=t.charCodeAt(s);return n.buffer}static toString(e){let t=Ze.toUint8Array(e),n="";for(let i=0;i<t.length;i++)n+=String.fromCharCode(t[i]);return decodeURIComponent(escape(n))}},va=class{static{o(this,"Utf16Converter")}static toString(e,t=!1){let n=Ze.toArrayBuffer(e),s=new DataView(n),i="";for(let a=0;a<n.byteLength;a+=2){let u=s.getUint16(a,t);i+=String.fromCharCode(u)}return i}static fromString(e,t=!1){let n=new ArrayBuffer(e.length*2),s=new DataView(n);for(let i=0;i<e.length;i++)s.setUint16(i*2,e.charCodeAt(i),t);return n}},ut=class Tp{static{o(this,"Convert")}static isHex(e){return typeof e===EB&&Pue.test(e)}static isBase64(e){return typeof e===EB&&kue.test(e)}static isBase64Url(e){return typeof e===EB&&Lue.test(e)}static ToString(e,t="utf8"){let n=Ze.toUint8Array(e);switch(t.toLowerCase()){case"utf8":return this.ToUtf8String(n);case"binary":return this.ToBinary(n);case"hex":return this.ToHex(n);case"base64":return this.ToBase64(n);case"base64url":return this.ToBase64Url(n);case"utf16le":return va.toString(n,!0);case"utf16":case"utf16be":return va.toString(n);default:throw new Error(`Unknown type of encoding '${t}'`)}}static FromString(e,t="utf8"){if(!e)return new ArrayBuffer(0);switch(t.toLowerCase()){case"utf8":return this.FromUtf8String(e);case"binary":return this.FromBinary(e);case"hex":return this.FromHex(e);case"base64":return this.FromBase64(e);case"base64url":return this.FromBase64Url(e);case"utf16le":return va.fromString(e,!0);case"utf16":case"utf16be":return va.fromString(e);default:throw new Error(`Unknown type of encoding '${t}'`)}}static ToBase64(e){let t=Ze.toUint8Array(e);if(typeof btoa<"u"){let n=this.ToString(t,"binary");return btoa(n)}else return Buffer.from(t).toString("base64")}static FromBase64(e){let t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!Tp.isBase64(t))throw new TypeError("Argument 'base64Text' is not Base64 encoded");return typeof atob<"u"?this.FromBinary(atob(t)):new Uint8Array(Buffer.from(t,"base64")).buffer}static FromBase64Url(e){let t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!Tp.isBase64Url(t))throw new TypeError("Argument 'base64url' is not Base64Url encoded");return this.FromBase64(this.Base64Padding(t.replace(/\-/g,"+").replace(/\_/g,"/")))}static ToBase64Url(e){return this.ToBase64(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}static FromUtf8String(e,t=Tp.DEFAULT_UTF8_ENCODING){switch(t){case"ascii":return this.FromBinary(e);case"utf8":return j9.fromString(e);case"utf16":case"utf16be":return va.fromString(e);case"utf16le":case"usc2":return va.fromString(e,!0);default:throw new Error(`Unknown type of encoding '${t}'`)}}static ToUtf8String(e,t=Tp.DEFAULT_UTF8_ENCODING){switch(t){case"ascii":return this.ToBinary(e);case"utf8":return j9.toString(e);case"utf16":case"utf16be":return va.toString(e);case"utf16le":case"usc2":return va.toString(e,!0);default:throw new Error(`Unknown type of encoding '${t}'`)}}static FromBinary(e){let t=e.length,n=new Uint8Array(t);for(let s=0;s<t;s++)n[s]=e.charCodeAt(s);return n.buffer}static ToBinary(e){let t=Ze.toUint8Array(e),n="";for(let s=0;s<t.length;s++)n+=String.fromCharCode(t[s]);return n}static ToHex(e){let t=Ze.toUint8Array(e),n="",s=t.length;for(let i=0;i<s;i++){let a=t[i];a<16&&(n+="0"),n+=a.toString(16)}return n}static FromHex(e){let t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!Tp.isHex(t))throw new TypeError("Argument 'hexString' is not HEX encoded");t.length%2&&(t=`0${t}`);let n=new Uint8Array(t.length/2);for(let s=0;s<t.length;s=s+2){let i=t.slice(s,s+2);n[s/2]=parseInt(i,16)}return n.buffer}static ToUtf16String(e,t=!1){return va.toString(e,t)}static FromUtf16String(e,t=!1){return va.fromString(e,t)}static Base64Padding(e){let t=4-e.length%4;if(t<4)for(let n=0;n<t;n++)e+="=";return e}static formatString(e){return e?.replace(/[\n\r\t ]/g,"")||""}};ut.DEFAULT_UTF8_ENCODING="utf8";function B(r,e,t){var n;return r instanceof Object&&(n=r[e])!==null&&n!==void 0?n:t}o(B,"getParametersValue");function Jw(r,e=0,t=r.byteLength-e,n=!1){let s="";for(let i of new Uint8Array(r,e,t)){let a=i.toString(16).toUpperCase();a.length===1&&(s+="0"),s+=a,n&&(s+=" ")}return s.trim()}o(Jw,"bufferToHexCodes");function io(r,e){let t=0;if(r.length===1)return r[0];for(let n=r.length-1;n>=0;n--)t+=r[r.length-1-n]*Math.pow(2,e*n);return t}o(io,"utilFromBase");function _i(r,e,t=-1){let n=t,s=r,i=0,a=Math.pow(2,e);for(let u=1;u<8;u++){if(r<a){let c;if(n<0)c=new ArrayBuffer(u),i=u;else{if(n<u)return new ArrayBuffer(0);c=new ArrayBuffer(n),i=n}let l=new Uint8Array(c);for(let f=u-1;f>=0;f--){let h=Math.pow(2,f*e);l[i-f-1]=Math.floor(s/h),s-=l[i-f-1]*h}return c}a*=Math.pow(2,e)}return new ArrayBuffer(0)}o(_i,"utilToBase");function Al(...r){let e=0,t=0;for(let i of r)e+=i.byteLength;let n=new ArrayBuffer(e),s=new Uint8Array(n);for(let i of r)s.set(new Uint8Array(i),t),t+=i.byteLength;return n}o(Al,"utilConcatBuf");function Yw(...r){let e=0,t=0;for(let i of r)e+=i.length;let n=new ArrayBuffer(e),s=new Uint8Array(n);for(let i of r)s.set(i,t),t+=i.length;return s}o(Yw,"utilConcatView");function bB(){let r=new Uint8Array(this.valueHex);if(this.valueHex.byteLength>=2){let u=r[0]===255&&r[1]&128,c=r[0]===0&&(r[1]&128)===0;(u||c)&&this.warnings.push("Needlessly long format")}let e=new ArrayBuffer(this.valueHex.byteLength),t=new Uint8Array(e);for(let u=0;u<this.valueHex.byteLength;u++)t[u]=0;t[0]=r[0]&128;let n=io(t,8),s=new ArrayBuffer(this.valueHex.byteLength),i=new Uint8Array(s);for(let u=0;u<this.valueHex.byteLength;u++)i[u]=r[u];return i[0]&=127,io(i,8)-n}o(bB,"utilDecodeTC");function H9(r){let e=r<0?r*-1:r,t=128;for(let n=1;n<8;n++){if(e<=t){if(r<0){let a=t-e,u=_i(a,8,n),c=new Uint8Array(u);return c[0]|=128,u}let s=_i(e,8,n),i=new Uint8Array(s);if(i[0]&128){let a=s.slice(0),u=new Uint8Array(a);s=new ArrayBuffer(s.byteLength+1),i=new Uint8Array(s);for(let c=0;c<a.byteLength;c++)i[c+1]=u[c];i[0]=0}return s}t*=Math.pow(2,8)}return new ArrayBuffer(0)}o(H9,"utilEncodeTC");function Bu(r,e){if(r.byteLength!==e.byteLength)return!1;let t=new Uint8Array(r),n=new Uint8Array(e);for(let s=0;s<t.length;s++)if(t[s]!==n[s])return!1;return!0}o(Bu,"isEqualBuffer");function bs(r,e){let t=r.toString(10);if(e<t.length)return"";let n=e-t.length,s=new Array(n);for(let a=0;a<n;a++)s[a]="0";return s.join("").concat(t)}o(bs,"padNumber");var K9="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",$9="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=";function Qw(r,e=!1,t=!1,n=!1){let s=0,i=0,a=0,u="",c=e?$9:K9;if(n){let l=0;for(let f=0;f<r.length;f++)if(r.charCodeAt(f)!==0){l=f;break}r=r.slice(l)}for(;s<r.length;){let l=r.charCodeAt(s++);s>=r.length&&(i=1);let f=r.charCodeAt(s++);s>=r.length&&(a=1);let h=r.charCodeAt(s++),d=l>>2,g=(l&3)<<4|f>>4,m=(f&15)<<2|h>>6,v=h&63;i===1?m=v=64:a===1&&(v=64),t?m===64?u+=`${c.charAt(d)}${c.charAt(g)}`:v===64?u+=`${c.charAt(d)}${c.charAt(g)}${c.charAt(m)}`:u+=`${c.charAt(d)}${c.charAt(g)}${c.charAt(m)}${c.charAt(v)}`:u+=`${c.charAt(d)}${c.charAt(g)}${c.charAt(m)}${c.charAt(v)}`}return u}o(Qw,"toBase64");function Ip(r,e=!1,t=!1){let n=e?$9:K9;function s(c){for(let l=0;l<64;l++)if(n.charAt(l)===c)return l;return 64}o(s,"indexOf");function i(c){return c===64?0:c}o(i,"test");let a=0,u="";for(;a<r.length;){let c=s(r.charAt(a++)),l=a>=r.length?0:s(r.charAt(a++)),f=a>=r.length?0:s(r.charAt(a++)),h=a>=r.length?0:s(r.charAt(a++)),d=i(c)<<2|i(l)>>4,g=(i(l)&15)<<4|i(f)>>2,m=(i(f)&3)<<6|i(h);u+=String.fromCharCode(d),f!==64&&(u+=String.fromCharCode(g)),h!==64&&(u+=String.fromCharCode(m))}if(t){let c=u.length,l=-1;for(let f=c-1;f>=0;f--)if(u.charCodeAt(f)!==0){l=f;break}l!==-1?u=u.slice(0,l+1):u=""}return u}o(Ip,"fromBase64");function Qg(r){let e="",t=new Uint8Array(r);for(let n of t)e+=String.fromCharCode(n);return e}o(Qg,"arrayBufferToString");function Cl(r){let e=r.length,t=new ArrayBuffer(e),n=new Uint8Array(t);for(let s=0;s<e;s++)n[s]=r.charCodeAt(s);return t}o(Cl,"stringToArrayBuffer");var Fue=Math.log(2);function X9(r){let e=Math.log(r)/Fue,t=Math.floor(e),n=Math.round(e);return t===n?t:n}o(X9,"nearestPowerOf2");function Ce(r,e){for(let t of e)delete r[t]}o(Ce,"clearProps");function Zw(){if(typeof BigInt>"u")throw new Error("BigInt is not defined. Your environment doesn't implement BigInt.")}o(Zw,"assertBigInt");function NB(r){let e=0,t=0;for(let s=0;s<r.length;s++){let i=r[s];e+=i.byteLength}let n=new Uint8Array(e);for(let s=0;s<r.length;s++){let i=r[s];n.set(new Uint8Array(i),t),t+=i.byteLength}return n.buffer}o(NB,"concat");function ao(r,e,t,n){return e instanceof Uint8Array?e.byteLength?t<0?(r.error="Wrong parameter: inputOffset less than zero",!1):n<0?(r.error="Wrong parameter: inputLength less than zero",!1):e.byteLength-t-n<0?(r.error="End of input reached before message was fully decoded (inconsistent offset and length values)",!1):!0:(r.error="Wrong parameter: inputBuffer has zero length",!1):(r.error="Wrong parameter: inputBuffer must be 'Uint8Array'",!1)}o(ao,"checkBufferParams");var TB=class{static{o(this,"ViewWriter")}constructor(){this.items=[]}write(e){this.items.push(e)}final(){return NB(this.items)}},Zg=[new Uint8Array([1])],z9="0123456789",SB="name",W9="valueHexView",Uue="isHexOnly",Vue="idBlock",Mue="tagClass",jue="tagNumber",que="isConstructed",Hue="fromBER",Kue="toBER",$ue="local",Ss="",xa=new ArrayBuffer(0),eb=new Uint8Array(0),ty="EndOfContent",Y9="OCTET STRING",Q9="BIT STRING";function oo(r){var e;return e=class extends r{static{o(this,"Some")}get valueHex(){return this.valueHexView.slice().buffer}set valueHex(n){this.valueHexView=new Uint8Array(n)}constructor(...n){var s;super(...n);let i=n[0]||{};this.isHexOnly=(s=i.isHexOnly)!==null&&s!==void 0?s:!1,this.valueHexView=i.valueHex?Ze.toUint8Array(i.valueHex):eb}fromBER(n,s,i){let a=n instanceof ArrayBuffer?new Uint8Array(n):n;if(!ao(this,a,s,i))return-1;let u=s+i;return this.valueHexView=a.subarray(s,u),this.valueHexView.length?(this.blockLength=i,u):(this.warnings.push("Zero buffer length"),s)}toBER(n=!1){return this.isHexOnly?n?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",xa)}toJSON(){return{...super.toJSON(),isHexOnly:this.isHexOnly,valueHex:ut.ToHex(this.valueHexView)}}},e.NAME="hexBlock",e}o(oo,"HexBlock");var Nl=class{static{o(this,"LocalBaseBlock")}static blockName(){return this.NAME}get valueBeforeDecode(){return this.valueBeforeDecodeView.slice().buffer}set valueBeforeDecode(e){this.valueBeforeDecodeView=new Uint8Array(e)}constructor({blockLength:e=0,error:t=Ss,warnings:n=[],valueBeforeDecode:s=eb}={}){this.blockLength=e,this.error=t,this.warnings=n,this.valueBeforeDecodeView=Ze.toUint8Array(s)}toJSON(){return{blockName:this.constructor.NAME,blockLength:this.blockLength,error:this.error,warnings:this.warnings,valueBeforeDecode:ut.ToHex(this.valueBeforeDecodeView)}}};Nl.NAME="baseBlock";var As=class extends Nl{static{o(this,"ValueBlock")}fromBER(e,t,n){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}toBER(e,t){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}};As.NAME="valueBlock";var Z9=class extends oo(Nl){static{o(this,"LocalIdentificationBlock")}constructor({idBlock:e={}}={}){var t,n,s,i;super(),e?(this.isHexOnly=(t=e.isHexOnly)!==null&&t!==void 0?t:!1,this.valueHexView=e.valueHex?Ze.toUint8Array(e.valueHex):eb,this.tagClass=(n=e.tagClass)!==null&&n!==void 0?n:-1,this.tagNumber=(s=e.tagNumber)!==null&&s!==void 0?s:-1,this.isConstructed=(i=e.isConstructed)!==null&&i!==void 0?i:!1):(this.tagClass=-1,this.tagNumber=-1,this.isConstructed=!1)}toBER(e=!1){let t=0;switch(this.tagClass){case 1:t|=0;break;case 2:t|=64;break;case 3:t|=128;break;case 4:t|=192;break;default:return this.error="Unknown tag class",xa}if(this.isConstructed&&(t|=32),this.tagNumber<31&&!this.isHexOnly){let s=new Uint8Array(1);if(!e){let i=this.tagNumber;i&=31,t|=i,s[0]=t}return s.buffer}if(!this.isHexOnly){let s=_i(this.tagNumber,7),i=new Uint8Array(s),a=s.byteLength,u=new Uint8Array(a+1);if(u[0]=t|31,!e){for(let c=0;c<a-1;c++)u[c+1]=i[c]|128;u[a]=i[a-1]}return u.buffer}let n=new Uint8Array(this.valueHexView.byteLength+1);if(n[0]=t|31,!e){let s=this.valueHexView;for(let i=0;i<s.length-1;i++)n[i+1]=s[i]|128;n[this.valueHexView.byteLength]=s[s.length-1]}return n.buffer}fromBER(e,t,n){let s=Ze.toUint8Array(e);if(!ao(this,s,t,n))return-1;let i=s.subarray(t,t+n);if(i.length===0)return this.error="Zero buffer length",-1;switch(i[0]&192){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=(i[0]&32)===32,this.isHexOnly=!1;let u=i[0]&31;if(u!==31)this.tagNumber=u,this.blockLength=1;else{let c=1,l=this.valueHexView=new Uint8Array(255),f=255;for(;i[c]&128;){if(l[c-1]=i[c]&127,c++,c>=i.length)return this.error="End of input reached before message was fully decoded",-1;if(c===f){f+=255;let d=new Uint8Array(f);for(let g=0;g<l.length;g++)d[g]=l[g];l=this.valueHexView=new Uint8Array(f)}}this.blockLength=c+1,l[c-1]=i[c]&127;let h=new Uint8Array(c);for(let d=0;d<c;d++)h[d]=l[d];l=this.valueHexView=new Uint8Array(c),l.set(h),this.blockLength<=9?this.tagNumber=io(l,7):(this.isHexOnly=!0,this.warnings.push("Tag too long, represented as hex-coded"))}if(this.tagClass===1&&this.isConstructed)switch(this.tagNumber){case 1:case 2:case 5:case 6:case 9:case 13:case 14:case 23:case 24:case 31:case 32:case 33:case 34:return this.error="Constructed encoding used for primitive type",-1}return t+this.blockLength}toJSON(){return{...super.toJSON(),tagClass:this.tagClass,tagNumber:this.tagNumber,isConstructed:this.isConstructed}}};Z9.NAME="identificationBlock";var eq=class extends Nl{static{o(this,"LocalLengthBlock")}constructor({lenBlock:e={}}={}){var t,n,s;super(),this.isIndefiniteForm=(t=e.isIndefiniteForm)!==null&&t!==void 0?t:!1,this.longFormUsed=(n=e.longFormUsed)!==null&&n!==void 0?n:!1,this.length=(s=e.length)!==null&&s!==void 0?s:0}fromBER(e,t,n){let s=Ze.toUint8Array(e);if(!ao(this,s,t,n))return-1;let i=s.subarray(t,t+n);if(i.length===0)return this.error="Zero buffer length",-1;if(i[0]===255)return this.error="Length block 0xFF is reserved by standard",-1;if(this.isIndefiniteForm=i[0]===128,this.isIndefiniteForm)return this.blockLength=1,t+this.blockLength;if(this.longFormUsed=!!(i[0]&128),this.longFormUsed===!1)return this.length=i[0],this.blockLength=1,t+this.blockLength;let a=i[0]&127;if(a>8)return this.error="Too big integer",-1;if(a+1>i.length)return this.error="End of input reached before message was fully decoded",-1;let u=t+1,c=s.subarray(u,u+a);return c[a-1]===0&&this.warnings.push("Needlessly long encoded length"),this.length=io(c,8),this.longFormUsed&&this.length<=127&&this.warnings.push("Unnecessary usage of long length form"),this.blockLength=a+1,t+this.blockLength}toBER(e=!1){let t,n;if(this.length>127&&(this.longFormUsed=!0),this.isIndefiniteForm)return t=new ArrayBuffer(1),e===!1&&(n=new Uint8Array(t),n[0]=128),t;if(this.longFormUsed){let s=_i(this.length,8);if(s.byteLength>127)return this.error="Too big length",xa;if(t=new ArrayBuffer(s.byteLength+1),e)return t;let i=new Uint8Array(s);n=new Uint8Array(t),n[0]=s.byteLength|128;for(let a=0;a<s.byteLength;a++)n[a+1]=i[a];return t}return t=new ArrayBuffer(1),e===!1&&(n=new Uint8Array(t),n[0]=this.length),t}toJSON(){return{...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,longFormUsed:this.longFormUsed,length:this.length}}};eq.NAME="lengthBlock";var ze={},ts=class extends Nl{static{o(this,"BaseBlock")}constructor({name:e=Ss,optional:t=!1,primitiveSchema:n,...s}={},i){super(s),this.name=e,this.optional=t,n&&(this.primitiveSchema=n),this.idBlock=new Z9(s),this.lenBlock=new eq(s),this.valueBlock=i?new i(s):new As(s)}fromBER(e,t,n){let s=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return s===-1?(this.error=this.valueBlock.error,s):(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),s)}toBER(e,t){let n=t||new TB;t||tq(this);let s=this.idBlock.toBER(e);if(n.write(s),this.lenBlock.isIndefiniteForm)n.write(new Uint8Array([128]).buffer),this.valueBlock.toBER(e,n),n.write(new ArrayBuffer(2));else{let i=this.valueBlock.toBER(e);this.lenBlock.length=i.byteLength;let a=this.lenBlock.toBER(e);n.write(a),n.write(i)}return t?xa:n.final()}toJSON(){let e={...super.toJSON(),idBlock:this.idBlock.toJSON(),lenBlock:this.lenBlock.toJSON(),valueBlock:this.valueBlock.toJSON(),name:this.name,optional:this.optional};return this.primitiveSchema&&(e.primitiveSchema=this.primitiveSchema.toJSON()),e}toString(e="ascii"){return e==="ascii"?this.onAsciiEncoding():ut.ToHex(this.toBER())}onAsciiEncoding(){let e=this.constructor.NAME,t=ut.ToHex(this.valueBlock.valueBeforeDecodeView);return`${e} : ${t}`}isEqual(e){if(this===e)return!0;if(!(e instanceof this.constructor))return!1;let t=this.toBER(),n=e.toBER();return Bu(t,n)}};ts.NAME="BaseBlock";function tq(r){var e;if(r instanceof ze.Constructed)for(let t of r.valueBlock.value)tq(t)&&(r.lenBlock.isIndefiniteForm=!0);return!!(!((e=r.lenBlock)===null||e===void 0)&&e.isIndefiniteForm)}o(tq,"prepareIndefiniteForm");var rq=class extends ts{static{o(this,"BaseStringBlock")}getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}constructor({value:e=Ss,...t}={},n){super(t,n),e&&this.fromString(e)}fromBER(e,t,n){let s=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return s===-1?(this.error=this.valueBlock.error,s):(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),s)}onAsciiEncoding(){return`${this.constructor.NAME} : '${this.valueBlock.value}'`}};rq.NAME="BaseStringBlock";var nq=class extends oo(As){static{o(this,"LocalPrimitiveValueBlock")}constructor({isHexOnly:e=!0,...t}={}){super(t),this.isHexOnly=e}};nq.NAME="PrimitiveValueBlock";var sq,tt=class extends ts{static{o(this,"Primitive")}constructor(e={}){super(e,nq),this.idBlock.isConstructed=!1}};sq=tt;ze.Primitive=sq;tt.NAME="PRIMITIVE";function Xue(r,e){if(r instanceof e)return r;let t=new e;return t.idBlock=r.idBlock,t.lenBlock=r.lenBlock,t.warnings=r.warnings,t.valueBeforeDecodeView=r.valueBeforeDecodeView,t}o(Xue,"localChangeType");function ry(r,e=0,t=r.length){let n=e,s=new ts({},As),i=new Nl;if(!ao(i,r,e,t))return s.error=i.error,{offset:-1,result:s};if(!r.subarray(e,e+t).length)return s.error="Zero buffer length",{offset:-1,result:s};let u=s.idBlock.fromBER(r,e,t);if(s.idBlock.warnings.length&&s.warnings.concat(s.idBlock.warnings),u===-1)return s.error=s.idBlock.error,{offset:-1,result:s};if(e=u,t-=s.idBlock.blockLength,u=s.lenBlock.fromBER(r,e,t),s.lenBlock.warnings.length&&s.warnings.concat(s.lenBlock.warnings),u===-1)return s.error=s.lenBlock.error,{offset:-1,result:s};if(e=u,t-=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 c=ts;switch(s.idBlock.tagClass){case 1:if(s.idBlock.tagNumber>=37&&s.idBlock.isHexOnly===!1)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};c=ze.EndOfContent;break;case 1:c=ze.Boolean;break;case 2:c=ze.Integer;break;case 3:c=ze.BitString;break;case 4:c=ze.OctetString;break;case 5:c=ze.Null;break;case 6:c=ze.ObjectIdentifier;break;case 10:c=ze.Enumerated;break;case 12:c=ze.Utf8String;break;case 13:c=ze.RelativeObjectIdentifier;break;case 14:c=ze.TIME;break;case 15:return s.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:s};case 16:c=ze.Sequence;break;case 17:c=ze.Set;break;case 18:c=ze.NumericString;break;case 19:c=ze.PrintableString;break;case 20:c=ze.TeletexString;break;case 21:c=ze.VideotexString;break;case 22:c=ze.IA5String;break;case 23:c=ze.UTCTime;break;case 24:c=ze.GeneralizedTime;break;case 25:c=ze.GraphicString;break;case 26:c=ze.VisibleString;break;case 27:c=ze.GeneralString;break;case 28:c=ze.UniversalString;break;case 29:c=ze.CharacterString;break;case 30:c=ze.BmpString;break;case 31:c=ze.DATE;break;case 32:c=ze.TimeOfDay;break;case 33:c=ze.DateTime;break;case 34:c=ze.Duration;break;default:{let l=s.idBlock.isConstructed?new ze.Constructed:new ze.Primitive;l.idBlock=s.idBlock,l.lenBlock=s.lenBlock,l.warnings=s.warnings,s=l}}break;case 2:case 3:case 4:default:c=s.idBlock.isConstructed?ze.Constructed:ze.Primitive}return s=Xue(s,c),u=s.fromBER(r,e,s.lenBlock.isIndefiniteForm?t:s.lenBlock.length),s.valueBeforeDecodeView=r.subarray(n,n+s.blockLength),{offset:u,result:s}}o(ry,"localFromBER");function Or(r){if(!r.byteLength){let e=new ts({},As);return e.error="Input buffer has zero length",{offset:-1,result:e}}return ry(Ze.toUint8Array(r).slice(),0,r.byteLength)}o(Or,"fromBER");function Gue(r,e){return r?1:e}o(Gue,"checkLen");var Ru=class extends As{static{o(this,"LocalConstructedValueBlock")}constructor({value:e=[],isIndefiniteForm:t=!1,...n}={}){super(n),this.value=e,this.isIndefiniteForm=t}fromBER(e,t,n){let s=Ze.toUint8Array(e);if(!ao(this,s,t,n))return-1;if(this.valueBeforeDecodeView=s.subarray(t,t+n),this.valueBeforeDecodeView.length===0)return this.warnings.push("Zero buffer length"),t;let i=t;for(;Gue(this.isIndefiniteForm,n)>0;){let a=ry(s,i,n);if(a.offset===-1)return this.error=a.result.error,this.warnings.concat(a.result.warnings),-1;if(i=a.offset,this.blockLength+=a.result.blockLength,n-=a.result.blockLength,this.value.push(a.result),this.isIndefiniteForm&&a.result.constructor.NAME===ty)break}return this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.NAME===ty?this.value.pop():this.warnings.push("No EndOfContent block encoded")),i}toBER(e,t){let n=t||new TB;for(let s=0;s<this.value.length;s++)this.value[s].toBER(e,n);return t?xa:n.final()}toJSON(){let e={...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,value:[]};for(let t of this.value)e.value.push(t.toJSON());return e}};Ru.NAME="ConstructedValueBlock";var iq,ae=class extends ts{static{o(this,"Constructed")}constructor(e={}){super(e,Ru),this.idBlock.isConstructed=!0}fromBER(e,t,n){this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm;let s=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return s===-1?(this.error=this.valueBlock.error,s):(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),s)}onAsciiEncoding(){let e=[];for(let n of this.valueBlock.value)e.push(n.toString("ascii").split(`
|
|
101
101
|
`).map(s=>` ${s}`).join(`
|
|
102
102
|
`));let t=this.idBlock.tagClass===3?`[${this.idBlock.tagNumber}]`:this.constructor.NAME;return e.length?`${t} :
|
|
103
103
|
${e.join(`
|
|
104
|
-
`)}`:`${t} :`}};iq=ae;ze.Constructed=iq;ae.NAME="CONSTRUCTED";var aq=class extends As{static{o(this,"LocalEndOfContentValueBlock")}fromBER(e,t,n){return t}toBER(e){return xa}};aq.override="EndOfContentValueBlock";var oq,uq=class extends ts{static{o(this,"EndOfContent")}constructor(e={}){super(e,aq),this.idBlock.tagClass=1,this.idBlock.tagNumber=0}};oq=uq;ze.EndOfContent=oq;uq.NAME=ty;var cq,Pr=class extends ts{static{o(this,"Null")}constructor(e={}){super(e,As),this.idBlock.tagClass=1,this.idBlock.tagNumber=5}fromBER(e,t,n){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+=n,t+n>e.byteLength?(this.error="End of input reached before message was fully decoded (inconsistent offset and length values)",-1):t+n}toBER(e,t){let n=new ArrayBuffer(2);if(!e){let s=new Uint8Array(n);s[0]=5,s[1]=0}return t&&t.write(n),n}onAsciiEncoding(){return`${this.constructor.NAME}`}};cq=Pr;ze.Null=cq;Pr.NAME="NULL";var lq=class extends oo(As){static{o(this,"LocalBooleanValueBlock")}get value(){for(let e of this.valueHexView)if(e>0)return!0;return!1}set value(e){this.valueHexView[0]=e?255:0}constructor({value:e,...t}={}){super(t),t.valueHex?this.valueHexView=Ze.toUint8Array(t.valueHex):this.valueHexView=new Uint8Array(1),e&&(this.value=e)}fromBER(e,t,n){let s=Ze.toUint8Array(e);return ao(this,s,t,n)?(this.valueHexView=s.subarray(t,t+n),n>1&&this.warnings.push("Boolean value encoded in more then 1 octet"),this.isHexOnly=!0,bB.call(this),this.blockLength=n,t+n):-1}toBER(){return this.valueHexView.slice()}toJSON(){return{...super.toJSON(),value:this.value}}};lq.NAME="BooleanValueBlock";var fq,Oi=class extends ts{static{o(this,"Boolean")}getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}constructor(e={}){super(e,lq),this.idBlock.tagClass=1,this.idBlock.tagNumber=1}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.getValue}`}};fq=Oi;ze.Boolean=fq;Oi.NAME="BOOLEAN";var hq=class extends oo(Ru){static{o(this,"LocalOctetStringValueBlock")}constructor({isConstructed:e=!1,...t}={}){super(t),this.isConstructed=e}fromBER(e,t,n){let s=0;if(this.isConstructed){if(this.isHexOnly=!1,s=Ru.prototype.fromBER.call(this,e,t,n),s===-1)return s;for(let i=0;i<this.value.length;i++){let a=this.value[i].constructor.NAME;if(a===ty){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, OCTET STRING may consists of OCTET STRINGs only",-1}if(a!==Y9)return this.error="OCTET STRING may consists of OCTET STRINGs only",-1}}else this.isHexOnly=!0,s=super.fromBER(e,t,n),this.blockLength=n;return s}toBER(e,t){return this.isConstructed?Ru.prototype.toBER.call(this,e,t):e?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),isConstructed:this.isConstructed}}};hq.NAME="OctetStringValueBlock";var IB,Be=class extends ts{static{o(this,"OctetString")}constructor({idBlock:e={},lenBlock:t={},...n}={}){var s,i;(s=n.isConstructed)!==null&&s!==void 0||(n.isConstructed=!!(!((i=n.value)===null||i===void 0)&&i.length)),super({idBlock:{isConstructed:n.isConstructed,...e},lenBlock:{...t,isIndefiniteForm:!!n.isIndefiniteForm},...n},hq),this.idBlock.tagClass=1,this.idBlock.tagNumber=4}fromBER(e,t,n){if(this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,n===0)return this.idBlock.error.length===0&&(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length===0&&(this.blockLength+=this.lenBlock.blockLength),t;if(!this.valueBlock.isConstructed){let i=(e instanceof ArrayBuffer?new Uint8Array(e):e).subarray(t,t+n);try{if(i.byteLength){let a=ry(i,0,i.byteLength);a.offset!==-1&&a.offset===n&&(this.valueBlock.value=[a.result])}}catch{}}return super.fromBER(e,t,n)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return ae.prototype.onAsciiEncoding.call(this);let e=this.constructor.NAME,t=ut.ToHex(this.valueBlock.valueHexView);return`${e} : ${t}`}getValue(){if(!this.idBlock.isConstructed)return this.valueBlock.valueHexView.slice().buffer;let e=[];for(let t of this.valueBlock.value)t instanceof IB&&e.push(t.valueBlock.valueHexView);return Ze.concat(e)}};IB=Be;ze.OctetString=IB;Be.NAME=Y9;var pq=class extends oo(Ru){static{o(this,"LocalBitStringValueBlock")}constructor({unusedBits:e=0,isConstructed:t=!1,...n}={}){super(n),this.unusedBits=e,this.isConstructed=t,this.blockLength=this.valueHexView.byteLength}fromBER(e,t,n){if(!n)return t;let s=-1;if(this.isConstructed){if(s=Ru.prototype.fromBER.call(this,e,t,n),s===-1)return s;for(let u of this.value){let c=u.constructor.NAME;if(c===ty){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, BIT STRING may consists of BIT STRINGs only",-1}if(c!==Q9)return this.error="BIT STRING may consists of BIT STRINGs only",-1;let l=u.valueBlock;if(this.unusedBits>0&&l.unusedBits>0)return this.error='Using of "unused bits" inside constructive BIT STRING allowed for least one only',-1;this.unusedBits=l.unusedBits}return s}let i=Ze.toUint8Array(e);if(!ao(this,i,t,n))return-1;let a=i.subarray(t,t+n);if(this.unusedBits=a[0],this.unusedBits>7)return this.error="Unused bits for BitString must be in range 0-7",-1;if(!this.unusedBits){let u=a.subarray(1);try{if(u.byteLength){let c=ry(u,0,u.byteLength);c.offset!==-1&&c.offset===n-1&&(this.value=[c.result])}}catch{}}return this.valueHexView=a.subarray(1),this.blockLength=a.length,t+n}toBER(e,t){if(this.isConstructed)return Ru.prototype.toBER.call(this,e,t);if(e)return new ArrayBuffer(this.valueHexView.byteLength+1);if(!this.valueHexView.byteLength){let s=new Uint8Array(1);return s[0]=0,s.buffer}let n=new Uint8Array(this.valueHexView.length+1);return n[0]=this.unusedBits,n.set(this.valueHexView,1),n.buffer}toJSON(){return{...super.toJSON(),unusedBits:this.unusedBits,isConstructed:this.isConstructed}}};pq.NAME="BitStringValueBlock";var dq,Ct=class extends ts{static{o(this,"BitString")}constructor({idBlock:e={},lenBlock:t={},...n}={}){var s,i;(s=n.isConstructed)!==null&&s!==void 0||(n.isConstructed=!!(!((i=n.value)===null||i===void 0)&&i.length)),super({idBlock:{isConstructed:n.isConstructed,...e},lenBlock:{...t,isIndefiniteForm:!!n.isIndefiniteForm},...n},pq),this.idBlock.tagClass=1,this.idBlock.tagNumber=3}fromBER(e,t,n){return this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,super.fromBER(e,t,n)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return ae.prototype.onAsciiEncoding.call(this);{let e=[],t=this.valueBlock.valueHexView;for(let a of t)e.push(a.toString(2).padStart(8,"0"));let n=e.join(""),s=this.constructor.NAME,i=n.substring(0,n.length-this.valueBlock.unusedBits);return`${s} : ${i}`}}};dq=Ct;ze.BitString=dq;Ct.NAME=Q9;var mq;function zue(r,e){let t=new Uint8Array([0]),n=new Uint8Array(r),s=new Uint8Array(e),i=n.slice(0),a=i.length-1,u=s.slice(0),c=u.length-1,l=0,f=c<a?a:c,h=0;for(let d=f;d>=0;d--,h++){switch(!0){case h<u.length:l=i[a-h]+u[c-h]+t[0];break;default:l=i[a-h]+t[0]}switch(t[0]=l/10,!0){case h>=i.length:i=Yw(new Uint8Array([l%10]),i);break;default:i[a-h]=l%10}}return t[0]>0&&(i=Yw(t,i)),i}o(zue,"viewAdd");function J9(r){if(r>=Zg.length)for(let e=Zg.length;e<=r;e++){let t=new Uint8Array([0]),n=Zg[e-1].slice(0);for(let s=n.length-1;s>=0;s--){let i=new Uint8Array([(n[s]<<1)+t[0]]);t[0]=i[0]/10,n[s]=i[0]%10}t[0]>0&&(n=Yw(t,n)),Zg.push(n)}return Zg[r]}o(J9,"power2");function Wue(r,e){let t=0,n=new Uint8Array(r),s=new Uint8Array(e),i=n.slice(0),a=i.length-1,u=s.slice(0),c=u.length-1,l,f=0;for(let h=c;h>=0;h--,f++)switch(l=i[a-f]-u[c-f]-t,!0){case l<0:t=1,i[a-f]=l+10;break;default:t=0,i[a-f]=l}if(t>0)for(let h=a-c+1;h>=0;h--,f++)if(l=i[a-f]-t,l<0)t=1,i[a-f]=l+10;else{t=0,i[a-f]=l;break}return i.slice()}o(Wue,"viewSub");var DB=class extends oo(As){static{o(this,"LocalIntegerValueBlock")}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=bB.call(this)))}constructor({value:e,...t}={}){super(t),this._valueDec=0,t.valueHex&&this.setValueHex(),e!==void 0&&(this.valueDec=e)}set valueDec(e){this._valueDec=e,this.isHexOnly=!1,this.valueHexView=new Uint8Array(H9(e))}get valueDec(){return this._valueDec}fromDER(e,t,n,s=0){let i=this.fromBER(e,t,n);if(i===-1)return i;let a=this.valueHexView;return a[0]===0&&(a[1]&128)!==0?this.valueHexView=a.subarray(1):s!==0&&a.length<s&&(s-a.length>1&&(s=a.length+1),this.valueHexView=a.subarray(s-a.length)),i}toDER(e=!1){let t=this.valueHexView;switch(!0){case(t[0]&128)!==0:{let n=new Uint8Array(this.valueHexView.length+1);n[0]=0,n.set(t,1),this.valueHexView=n}break;case(t[0]===0&&(t[1]&128)===0):this.valueHexView=this.valueHexView.subarray(1);break}return this.toBER(e)}fromBER(e,t,n){let s=super.fromBER(e,t,n);return s===-1||this.setValueHex(),s}toBER(e){return e?new ArrayBuffer(this.valueHexView.length):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}toString(){let e=this.valueHexView.length*8-1,t=new Uint8Array(this.valueHexView.length*8/3),n=0,s,i=this.valueHexView,a="",u=!1;for(let c=i.byteLength-1;c>=0;c--){s=i[c];for(let l=0;l<8;l++){if((s&1)===1)switch(n){case e:t=Wue(J9(n),t),a="-";break;default:t=zue(t,J9(n))}n++,s>>=1}}for(let c=0;c<t.length;c++)t[c]&&(u=!0),u&&(a+=z9.charAt(t[c]));return u===!1&&(a+=z9.charAt(0)),a}};mq=DB;DB.NAME="IntegerValueBlock";Object.defineProperty(mq.prototype,"valueHex",{set:o(function(r){this.valueHexView=new Uint8Array(r),this.setValueHex()},"set"),get:o(function(){return this.valueHexView.slice().buffer},"get")});var ey,he=class extends ts{static{o(this,"Integer")}constructor(e={}){super(e,DB),this.idBlock.tagClass=1,this.idBlock.tagNumber=2}toBigInt(){return Zw(),BigInt(this.valueBlock.toString())}static fromBigInt(e){Zw();let t=BigInt(e),n=new TB,s=t.toString(16).replace(/^-/,""),i=new Uint8Array(ut.FromHex(s));if(t<0){let u=new Uint8Array(i.length+(i[0]&128?1:0));u[0]|=128;let l=BigInt(`0x${ut.ToHex(u)}`)+t,f=Ze.toUint8Array(ut.FromHex(l.toString(16)));f[0]|=128,n.write(f)}else i[0]&128&&n.write(new Uint8Array([0])),n.write(i);return new ey({valueHex:n.final()})}convertToDER(){let e=new ey({valueHex:this.valueBlock.valueHexView});return e.valueBlock.toDER(),e}convertFromDER(){return new ey({valueHex:this.valueBlock.valueHexView[0]===0?this.valueBlock.valueHexView.subarray(1):this.valueBlock.valueHexView})}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()}`}};ey=he;ze.Integer=ey;he.NAME="INTEGER";var gq,_u=class extends he{static{o(this,"Enumerated")}constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=10}};gq=_u;ze.Enumerated=gq;_u.NAME="ENUMERATED";var AB=class extends oo(As){static{o(this,"LocalSidValueBlock")}constructor({valueDec:e=-1,isFirstSid:t=!1,...n}={}){super(n),this.valueDec=e,this.isFirstSid=t}fromBER(e,t,n){if(!n)return t;let s=Ze.toUint8Array(e);if(!ao(this,s,t,n))return-1;let i=s.subarray(t,t+n);this.valueHexView=new Uint8Array(n);for(let u=0;u<n&&(this.valueHexView[u]=i[u]&127,this.blockLength++,(i[u]&128)!==0);u++);let a=new Uint8Array(this.blockLength);for(let u=0;u<this.blockLength;u++)a[u]=this.valueHexView[u];return this.valueHexView=a,(i[this.blockLength-1]&128)!==0?(this.error="End of input reached before message was fully decoded",-1):(this.valueHexView[0]===0&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=io(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),t+this.blockLength)}set valueBigInt(e){Zw();let t=BigInt(e).toString(2);for(;t.length%7;)t="0"+t;let n=new Uint8Array(t.length/7);for(let s=0;s<n.length;s++)n[s]=parseInt(t.slice(s*7,s*7+7),2)+(s+1<n.length?128:0);this.fromBER(n.buffer,0,n.length)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);let s=this.valueHexView,i=new Uint8Array(this.blockLength);for(let a=0;a<this.blockLength-1;a++)i[a]=s[a]|128;return i[this.blockLength-1]=s[this.blockLength-1],i.buffer}let t=_i(this.valueDec,7);if(t.byteLength===0)return this.error="Error during encoding SID value",xa;let n=new Uint8Array(t.byteLength);if(!e){let s=new Uint8Array(t),i=t.byteLength-1;for(let a=0;a<i;a++)n[a]=s[a]|128;n[i]=s[i]}return n}toString(){let e="";if(this.isHexOnly)e=ut.ToHex(this.valueHexView);else if(this.isFirstSid){let t=this.valueDec;this.valueDec<=39?e="0.":this.valueDec<=79?(e="1.",t-=40):(e="2.",t-=80),e+=t.toString()}else e=this.valueDec.toString();return e}toJSON(){return{...super.toJSON(),valueDec:this.valueDec,isFirstSid:this.isFirstSid}}};AB.NAME="sidBlock";var yq=class extends As{static{o(this,"LocalObjectIdentifierValueBlock")}constructor({value:e=Ss,...t}={}){super(t),this.value=[],e&&this.fromString(e)}fromBER(e,t,n){let s=t;for(;n>0;){let i=new AB;if(s=i.fromBER(e,s,n),s===-1)return this.blockLength=0,this.error=i.error,s;this.value.length===0&&(i.isFirstSid=!0),this.blockLength+=i.blockLength,n-=i.blockLength,this.value.push(i)}return s}toBER(e){let t=[];for(let n=0;n<this.value.length;n++){let s=this.value[n].toBER(e);if(s.byteLength===0)return this.error=this.value[n].error,xa;t.push(s)}return NB(t)}fromString(e){this.value=[];let t=0,n=0,s="",i=!1;do if(n=e.indexOf(".",t),n===-1?s=e.substring(t):s=e.substring(t,n),t=n+1,i){let a=this.value[0],u=0;switch(a.valueDec){case 0:break;case 1:u=40;break;case 2:u=80;break;default:this.value=[];return}let c=parseInt(s,10);if(isNaN(c))return;a.valueDec=c+u,i=!1}else{let a=new AB;if(s>Number.MAX_SAFE_INTEGER){Zw();let u=BigInt(s);a.valueBigInt=u}else if(a.valueDec=parseInt(s,10),isNaN(a.valueDec))return;this.value.length||(a.isFirstSid=!0,i=!0),this.value.push(a)}while(n!==-1)}toString(){let e="",t=!1;for(let n=0;n<this.value.length;n++){t=this.value[n].isHexOnly;let s=this.value[n].toString();n!==0&&(e=`${e}.`),t?(s=`{${s}}`,this.value[n].isFirstSid?e=`2.{${s} - 80}`:e+=s):e+=s}return e}toJSON(){let e={...super.toJSON(),value:this.toString(),sidArray:[]};for(let t=0;t<this.value.length;t++)e.sidArray.push(this.value[t].toJSON());return e}};yq.NAME="ObjectIdentifierValueBlock";var vq,He=class extends ts{static{o(this,"ObjectIdentifier")}getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}constructor(e={}){super(e,yq),this.idBlock.tagClass=1,this.idBlock.tagNumber=6}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}};vq=He;ze.ObjectIdentifier=vq;He.NAME="OBJECT IDENTIFIER";var CB=class extends oo(Nl){static{o(this,"LocalRelativeSidValueBlock")}constructor({valueDec:e=0,...t}={}){super(t),this.valueDec=e}fromBER(e,t,n){if(n===0)return t;let s=Ze.toUint8Array(e);if(!ao(this,s,t,n))return-1;let i=s.subarray(t,t+n);this.valueHexView=new Uint8Array(n);for(let u=0;u<n&&(this.valueHexView[u]=i[u]&127,this.blockLength++,(i[u]&128)!==0);u++);let a=new Uint8Array(this.blockLength);for(let u=0;u<this.blockLength;u++)a[u]=this.valueHexView[u];return this.valueHexView=a,(i[this.blockLength-1]&128)!==0?(this.error="End of input reached before message was fully decoded",-1):(this.valueHexView[0]===0&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=io(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),t+this.blockLength)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);let s=this.valueHexView,i=new Uint8Array(this.blockLength);for(let a=0;a<this.blockLength-1;a++)i[a]=s[a]|128;return i[this.blockLength-1]=s[this.blockLength-1],i.buffer}let t=_i(this.valueDec,7);if(t.byteLength===0)return this.error="Error during encoding SID value",xa;let n=new Uint8Array(t.byteLength);if(!e){let s=new Uint8Array(t),i=t.byteLength-1;for(let a=0;a<i;a++)n[a]=s[a]|128;n[i]=s[i]}return n.buffer}toString(){let e="";return this.isHexOnly?e=ut.ToHex(this.valueHexView):e=this.valueDec.toString(),e}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}};CB.NAME="relativeSidBlock";var xq=class extends As{static{o(this,"LocalRelativeObjectIdentifierValueBlock")}constructor({value:e=Ss,...t}={}){super(t),this.value=[],e&&this.fromString(e)}fromBER(e,t,n){let s=t;for(;n>0;){let i=new CB;if(s=i.fromBER(e,s,n),s===-1)return this.blockLength=0,this.error=i.error,s;this.blockLength+=i.blockLength,n-=i.blockLength,this.value.push(i)}return s}toBER(e,t){let n=[];for(let s=0;s<this.value.length;s++){let i=this.value[s].toBER(e);if(i.byteLength===0)return this.error=this.value[s].error,xa;n.push(i)}return NB(n)}fromString(e){this.value=[];let t=0,n=0,s="";do{n=e.indexOf(".",t),n===-1?s=e.substring(t):s=e.substring(t,n),t=n+1;let i=new CB;if(i.valueDec=parseInt(s,10),isNaN(i.valueDec))return!0;this.value.push(i)}while(n!==-1);return!0}toString(){let e="",t=!1;for(let n=0;n<this.value.length;n++){t=this.value[n].isHexOnly;let s=this.value[n].toString();n!==0&&(e=`${e}.`),t&&(s=`{${s}}`),e+=s}return e}toJSON(){let e={...super.toJSON(),value:this.toString(),sidArray:[]};for(let t=0;t<this.value.length;t++)e.sidArray.push(this.value[t].toJSON());return e}};xq.NAME="RelativeObjectIdentifierValueBlock";var Eq,wq=class extends ts{static{o(this,"RelativeObjectIdentifier")}getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}constructor(e={}){super(e,xq),this.idBlock.tagClass=1,this.idBlock.tagNumber=13}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}};Eq=wq;ze.RelativeObjectIdentifier=Eq;wq.NAME="RelativeObjectIdentifier";var bq,K=class extends ae{static{o(this,"Sequence")}constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=16}};bq=K;ze.Sequence=bq;K.NAME="SEQUENCE";var Sq,kr=class extends ae{static{o(this,"Set")}constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=17}};Sq=kr;ze.Set=Sq;kr.NAME="SET";var Aq=class extends oo(As){static{o(this,"LocalStringValueBlock")}constructor({...e}={}){super(e),this.isHexOnly=!0,this.value=Ss}toJSON(){return{...super.toJSON(),value:this.value}}};Aq.NAME="StringValueBlock";var Cq=class extends Aq{static{o(this,"LocalSimpleStringValueBlock")}};Cq.NAME="SimpleStringValueBlock";var Ms=class extends rq{static{o(this,"LocalSimpleStringBlock")}constructor({...e}={}){super(e,Cq)}fromBuffer(e){this.valueBlock.value=String.fromCharCode.apply(null,Ze.toUint8Array(e))}fromString(e){let t=e.length,n=this.valueBlock.valueHexView=new Uint8Array(t);for(let s=0;s<t;s++)n[s]=e.charCodeAt(s);this.valueBlock.value=e}};Ms.NAME="SIMPLE STRING";var Nq=class extends Ms{static{o(this,"LocalUtf8StringValueBlock")}fromBuffer(e){this.valueBlock.valueHexView=Ze.toUint8Array(e);try{this.valueBlock.value=ut.ToUtf8String(e)}catch(t){this.warnings.push(`Error during "decodeURIComponent": ${t}, using raw string`),this.valueBlock.value=ut.ToBinary(e)}}fromString(e){this.valueBlock.valueHexView=new Uint8Array(ut.FromUtf8String(e)),this.valueBlock.value=e}};Nq.NAME="Utf8StringValueBlock";var Tq,ui=class extends Nq{static{o(this,"Utf8String")}constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=12}};Tq=ui;ze.Utf8String=Tq;ui.NAME="UTF8String";var Iq=class extends Ms{static{o(this,"LocalBmpStringValueBlock")}fromBuffer(e){this.valueBlock.value=ut.ToUtf16String(e),this.valueBlock.valueHexView=Ze.toUint8Array(e)}fromString(e){this.valueBlock.value=e,this.valueBlock.valueHexView=new Uint8Array(ut.FromUtf16String(e))}};Iq.NAME="BmpStringValueBlock";var Dq,Dp=class extends Iq{static{o(this,"BmpString")}constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=30}};Dq=Dp;ze.BmpString=Dq;Dp.NAME="BMPString";var Bq=class extends Ms{static{o(this,"LocalUniversalStringValueBlock")}fromBuffer(e){let t=ArrayBuffer.isView(e)?e.slice().buffer:e.slice(0),n=new Uint8Array(t);for(let s=0;s<n.length;s+=4)n[s]=n[s+3],n[s+1]=n[s+2],n[s+2]=0,n[s+3]=0;this.valueBlock.value=String.fromCharCode.apply(null,new Uint32Array(t))}fromString(e){let t=e.length,n=this.valueBlock.valueHexView=new Uint8Array(t*4);for(let s=0;s<t;s++){let i=_i(e.charCodeAt(s),8),a=new Uint8Array(i);if(a.length>4)continue;let u=4-a.length;for(let c=a.length-1;c>=0;c--)n[s*4+c+u]=a[c]}this.valueBlock.value=e}};Bq.NAME="UniversalStringValueBlock";var Rq,Bp=class extends Bq{static{o(this,"UniversalString")}constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=28}};Rq=Bp;ze.UniversalString=Rq;Bp.NAME="UniversalString";var _q,Tl=class extends Ms{static{o(this,"NumericString")}constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=18}};_q=Tl;ze.NumericString=_q;Tl.NAME="NumericString";var Oq,ci=class extends Ms{static{o(this,"PrintableString")}constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=19}};Oq=ci;ze.PrintableString=Oq;ci.NAME="PrintableString";var Pq,Rp=class extends Ms{static{o(this,"TeletexString")}constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=20}};Pq=Rp;ze.TeletexString=Pq;Rp.NAME="TeletexString";var kq,tb=class extends Ms{static{o(this,"VideotexString")}constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=21}};kq=tb;ze.VideotexString=kq;tb.NAME="VideotexString";var Lq,ny=class extends Ms{static{o(this,"IA5String")}constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=22}};Lq=ny;ze.IA5String=Lq;ny.NAME="IA5String";var Fq,rb=class extends Ms{static{o(this,"GraphicString")}constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=25}};Fq=rb;ze.GraphicString=Fq;rb.NAME="GraphicString";var Uq,sy=class extends Ms{static{o(this,"VisibleString")}constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=26}};Uq=sy;ze.VisibleString=Uq;sy.NAME="VisibleString";var Vq,nb=class extends Ms{static{o(this,"GeneralString")}constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=27}};Vq=nb;ze.GeneralString=Vq;nb.NAME="GeneralString";var Mq,sb=class extends Ms{static{o(this,"CharacterString")}constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=29}};Mq=sb;ze.CharacterString=Mq;sb.NAME="CharacterString";var jq,Il=class extends sy{static{o(this,"UTCTime")}constructor({value:e,valueDate:t,...n}={}){if(super(n),this.year=0,this.month=0,this.day=0,this.hour=0,this.minute=0,this.second=0,e){this.fromString(e),this.valueBlock.valueHexView=new Uint8Array(e.length);for(let s=0;s<e.length;s++)this.valueBlock.valueHexView[s]=e.charCodeAt(s)}t&&(this.fromDate(t),this.valueBlock.valueHexView=new Uint8Array(this.toBuffer())),this.idBlock.tagClass=1,this.idBlock.tagNumber=23}fromBuffer(e){this.fromString(String.fromCharCode.apply(null,Ze.toUint8Array(e)))}toBuffer(){let e=this.toString(),t=new ArrayBuffer(e.length),n=new Uint8Array(t);for(let s=0;s<e.length;s++)n[s]=e.charCodeAt(s);return t}fromDate(e){this.year=e.getUTCFullYear(),this.month=e.getUTCMonth()+1,this.day=e.getUTCDate(),this.hour=e.getUTCHours(),this.minute=e.getUTCMinutes(),this.second=e.getUTCSeconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second))}fromString(e){let n=/(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})Z/ig.exec(e);if(n===null){this.error="Wrong input string for conversion";return}let s=parseInt(n[1],10);s>=50?this.year=1900+s:this.year=2e3+s,this.month=parseInt(n[2],10),this.day=parseInt(n[3],10),this.hour=parseInt(n[4],10),this.minute=parseInt(n[5],10),this.second=parseInt(n[6],10)}toString(e="iso"){if(e==="iso"){let t=new Array(7);return t[0]=bs(this.year<2e3?this.year-1900:this.year-2e3,2),t[1]=bs(this.month,2),t[2]=bs(this.day,2),t[3]=bs(this.hour,2),t[4]=bs(this.minute,2),t[5]=bs(this.second,2),t[6]="Z",t.join("")}return super.toString(e)}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}}};jq=Il;ze.UTCTime=jq;Il.NAME="UTCTime";var qq,br=class extends Il{static{o(this,"GeneralizedTime")}constructor(e={}){var t;super(e),(t=this.millisecond)!==null&&t!==void 0||(this.millisecond=0),this.idBlock.tagClass=1,this.idBlock.tagNumber=24}fromDate(e){super.fromDate(e),this.millisecond=e.getUTCMilliseconds()}toDate(){let e=Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second,this.millisecond);return new Date(e)}fromString(e){let t=!1,n="",s="",i=0,a,u=0,c=0;if(e[e.length-1]==="Z")n=e.substring(0,e.length-1),t=!0;else{let h=new Number(e[e.length-1]);if(isNaN(h.valueOf()))throw new Error("Wrong input string for conversion");n=e}if(t){if(n.indexOf("+")!==-1)throw new Error("Wrong input string for conversion");if(n.indexOf("-")!==-1)throw new Error("Wrong input string for conversion")}else{let h=1,d=n.indexOf("+"),g="";if(d===-1&&(d=n.indexOf("-"),h=-1),d!==-1){if(g=n.substring(d+1),n=n.substring(0,d),g.length!==2&&g.length!==4)throw new Error("Wrong input string for conversion");let m=parseInt(g.substring(0,2),10);if(isNaN(m.valueOf()))throw new Error("Wrong input string for conversion");if(u=h*m,g.length===4){if(m=parseInt(g.substring(2,4),10),isNaN(m.valueOf()))throw new Error("Wrong input string for conversion");c=h*m}}}let l=n.indexOf(".");if(l===-1&&(l=n.indexOf(",")),l!==-1){let h=new Number(`0${n.substring(l)}`);if(isNaN(h.valueOf()))throw new Error("Wrong input string for conversion");i=h.valueOf(),s=n.substring(0,l)}else s=n;switch(!0){case s.length===8:if(a=/(\d{4})(\d{2})(\d{2})/ig,l!==-1)throw new Error("Wrong input string for conversion");break;case s.length===10:if(a=/(\d{4})(\d{2})(\d{2})(\d{2})/ig,l!==-1){let h=60*i;this.minute=Math.floor(h),h=60*(h-this.minute),this.second=Math.floor(h),h=1e3*(h-this.second),this.millisecond=Math.floor(h)}break;case s.length===12:if(a=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/ig,l!==-1){let h=60*i;this.second=Math.floor(h),h=1e3*(h-this.second),this.millisecond=Math.floor(h)}break;case s.length===14:if(a=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/ig,l!==-1){let h=1e3*i;this.millisecond=Math.floor(h)}break;default:throw new Error("Wrong input string for conversion")}let f=a.exec(s);if(f===null)throw new Error("Wrong input string for conversion");for(let h=1;h<f.length;h++)switch(h){case 1:this.year=parseInt(f[h],10);break;case 2:this.month=parseInt(f[h],10);break;case 3:this.day=parseInt(f[h],10);break;case 4:this.hour=parseInt(f[h],10)+u;break;case 5:this.minute=parseInt(f[h],10)+c;break;case 6:this.second=parseInt(f[h],10);break;default:throw new Error("Wrong input string for conversion")}if(t===!1){let h=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond);this.year=h.getUTCFullYear(),this.month=h.getUTCMonth(),this.day=h.getUTCDay(),this.hour=h.getUTCHours(),this.minute=h.getUTCMinutes(),this.second=h.getUTCSeconds(),this.millisecond=h.getUTCMilliseconds()}}toString(e="iso"){if(e==="iso"){let t=[];return t.push(bs(this.year,4)),t.push(bs(this.month,2)),t.push(bs(this.day,2)),t.push(bs(this.hour,2)),t.push(bs(this.minute,2)),t.push(bs(this.second,2)),this.millisecond!==0&&(t.push("."),t.push(bs(this.millisecond,3))),t.push("Z"),t.join("")}return super.toString(e)}toJSON(){return{...super.toJSON(),millisecond:this.millisecond}}};qq=br;ze.GeneralizedTime=qq;br.NAME="GeneralizedTime";var Hq,Kq=class extends ui{static{o(this,"DATE")}constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=31}};Hq=Kq;ze.DATE=Hq;Kq.NAME="DATE";var $q,Xq=class extends ui{static{o(this,"TimeOfDay")}constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=32}};$q=Xq;ze.TimeOfDay=$q;Xq.NAME="TimeOfDay";var Gq,zq=class extends ui{static{o(this,"DateTime")}constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=33}};Gq=zq;ze.DateTime=Gq;zq.NAME="DateTime";var Wq,Jq=class extends ui{static{o(this,"Duration")}constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=34}};Wq=Jq;ze.Duration=Wq;Jq.NAME="Duration";var Yq,Qq=class extends ui{static{o(this,"TIME")}constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=14}};Yq=Qq;ze.TIME=Yq;Qq.NAME="TIME";var it=class{static{o(this,"Any")}constructor({name:e=Ss,optional:t=!1}={}){this.name=e,this.optional=t}},Sr=class extends it{static{o(this,"Choice")}constructor({value:e=[],...t}={}){super(t),this.value=e}},lt=class extends it{static{o(this,"Repeated")}constructor({value:e=new it,local:t=!1,...n}={}){super(n),this.value=e,this.local=t}},iy=class{static{o(this,"RawData")}get data(){return this.dataView.slice().buffer}set data(e){this.dataView=Ze.toUint8Array(e)}constructor({data:e=eb}={}){this.dataView=Ze.toUint8Array(e)}fromBER(e,t,n){let s=t+n;return this.dataView=Ze.toUint8Array(e).subarray(t,s),s}toBER(e){return this.dataView.slice().buffer}};function be(r,e,t){if(t instanceof Sr){for(let i of t.value)if(be(r,e,i).verified)return{verified:!0,result:r};{let i={verified:!1,result:{error:"Wrong values for Choice type"}};return t.hasOwnProperty(SB)&&(i.name=t.name),i}}if(t instanceof it)return t.hasOwnProperty(SB)&&(r[t.name]=e),{verified:!0,result:r};if(!(r instanceof Object))return{verified:!1,result:{error:"Wrong root object"}};if(!(e instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 data"}};if(!(t instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(Vue in t))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(Hue in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(Kue in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};let n=t.idBlock.toBER(!1);if(n.byteLength===0)return{verified:!1,result:{error:"Error encoding idBlock for ASN.1 schema"}};if(t.idBlock.fromBER(n,0,n.byteLength)===-1)return{verified:!1,result:{error:"Error decoding idBlock for ASN.1 schema"}};if(t.idBlock.hasOwnProperty(Mue)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.tagClass!==e.idBlock.tagClass)return{verified:!1,result:r};if(t.idBlock.hasOwnProperty(jue)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.tagNumber!==e.idBlock.tagNumber)return{verified:!1,result:r};if(t.idBlock.hasOwnProperty(que)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.isConstructed!==e.idBlock.isConstructed)return{verified:!1,result:r};if(!(Uue in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.isHexOnly!==e.idBlock.isHexOnly)return{verified:!1,result:r};if(t.idBlock.isHexOnly){if(!(W9 in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};let i=t.idBlock.valueHexView,a=e.idBlock.valueHexView;if(i.length!==a.length)return{verified:!1,result:r};for(let u=0;u<i.length;u++)if(i[u]!==a[1])return{verified:!1,result:r}}if(t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Ss),t.name&&(r[t.name]=e)),t instanceof ze.Constructed){let i=0,a={verified:!1,result:{error:"Unknown error"}},u=t.valueBlock.value.length;if(u>0&&t.valueBlock.value[0]instanceof lt&&(u=e.valueBlock.value.length),u===0)return{verified:!0,result:r};if(e.valueBlock.value.length===0&&t.valueBlock.value.length!==0){let c=!0;for(let l=0;l<t.valueBlock.value.length;l++)c=c&&(t.valueBlock.value[l].optional||!1);return c?{verified:!0,result:r}:(t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Ss),t.name&&delete r[t.name]),r.error="Inconsistent object length",{verified:!1,result:r})}for(let c=0;c<u;c++)if(c-i>=e.valueBlock.value.length){if(t.valueBlock.value[c].optional===!1){let l={verified:!1,result:r};return r.error="Inconsistent length between ASN.1 data and schema",t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Ss),t.name&&(delete r[t.name],l.name=t.name)),l}}else if(t.valueBlock.value[0]instanceof lt){if(a=be(r,e.valueBlock.value[c],t.valueBlock.value[0].value),a.verified===!1)if(t.valueBlock.value[0].optional)i++;else return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Ss),t.name&&delete r[t.name]),a;if(SB in t.valueBlock.value[0]&&t.valueBlock.value[0].name.length>0){let l={};$ue in t.valueBlock.value[0]&&t.valueBlock.value[0].local?l=e:l=r,typeof l[t.valueBlock.value[0].name]>"u"&&(l[t.valueBlock.value[0].name]=[]),l[t.valueBlock.value[0].name].push(e.valueBlock.value[c])}}else if(a=be(r,e.valueBlock.value[c-i],t.valueBlock.value[c]),a.verified===!1)if(t.valueBlock.value[c].optional)i++;else return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Ss),t.name&&delete r[t.name]),a;if(a.verified===!1){let c={verified:!1,result:r};return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Ss),t.name&&(delete r[t.name],c.name=t.name)),c}return{verified:!0,result:r}}if(t.primitiveSchema&&W9 in e.valueBlock){let i=ry(e.valueBlock.valueHexView);if(i.offset===-1){let a={verified:!1,result:i.result};return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Ss),t.name&&(delete r[t.name],a.name=t.name)),a}return be(r,i.result,t.primitiveSchema)}return{verified:!0,result:r}}o(be,"compareSchema");var On=class r{static{o(this,"ByteStream")}constructor(e={}){if("view"in e)this.fromUint8Array(e.view);else if("buffer"in e)this.fromArrayBuffer(e.buffer);else if("string"in e)this.fromString(e.string);else if("hexstring"in e)this.fromHexString(e.hexstring);else if("length"in e&&e.length>0){if(this.length=e.length,e.stub)for(let t=0;t<this._view.length;t++)this._view[t]=e.stub}else this.length=0}set buffer(e){this._buffer=e,this._view=new Uint8Array(this._buffer)}get buffer(){return this._buffer}set view(e){this._buffer=new ArrayBuffer(e.length),this._view=new Uint8Array(this._buffer),this._view.set(e)}get view(){return this._view}get length(){return this.view.byteLength}set length(e){this._buffer=new ArrayBuffer(e),this._view=new Uint8Array(this._buffer)}clear(){this._buffer=new ArrayBuffer(0),this._view=new Uint8Array(this._buffer)}fromArrayBuffer(e){this._buffer=e,this._view=new Uint8Array(this._buffer)}fromUint8Array(e){this.fromArrayBuffer(new Uint8Array(e).buffer)}fromString(e){let t=e.length;this.length=t;for(let n=0;n<t;n++)this.view[n]=e.charCodeAt(n)}toString(e=0,t=this.view.length-e){let n="";(e>=this.view.length||e<0)&&(e=0),(t>=this.view.length||t<0)&&(t=this.view.length-e);for(let s=e;s<e+t;s++)n+=String.fromCharCode(this.view[s]);return n}fromHexString(e){let t=e.length;this.buffer=new ArrayBuffer(t>>1),this.view=new Uint8Array(this.buffer);let n=new Map;n.set("0",0),n.set("1",1),n.set("2",2),n.set("3",3),n.set("4",4),n.set("5",5),n.set("6",6),n.set("7",7),n.set("8",8),n.set("9",9),n.set("A",10),n.set("a",10),n.set("B",11),n.set("b",11),n.set("C",12),n.set("c",12),n.set("D",13),n.set("d",13),n.set("E",14),n.set("e",14),n.set("F",15),n.set("f",15);let s=0,i=0;for(let a=0;a<t;a++)a%2?(i|=n.get(e.charAt(a)),this.view[s]=i,s++):i=n.get(e.charAt(a))<<4}toHexString(e=0,t=this.view.length-e){let n="";(e>=this.view.length||e<0)&&(e=0),(t>=this.view.length||t<0)&&(t=this.view.length-e);for(let s=e;s<e+t;s++){let i=this.view[s].toString(16).toUpperCase();n=n+(i.length==1?"0":"")+i}return n}copy(e=0,t=this.length-e){if(!e&&!this.length)return new r;if(e<0||e>this.length-1)throw new Error(`Wrong start position: ${e}`);return new r({buffer:this._buffer.slice(e,e+t)})}slice(e=0,t=this.length){if(!e&&!this.length)return new r;if(e<0||e>this.length-1)throw new Error(`Wrong start position: ${e}`);return new r({buffer:this._buffer.slice(e,t)})}realloc(e){let t=new ArrayBuffer(e),n=new Uint8Array(t);e>this._view.length?n.set(this._view):n.set(new Uint8Array(this._buffer,0,e)),this._buffer=t,this._view=new Uint8Array(this._buffer)}append(e){let t=this.length,n=e.length,s=e._view.subarray();this.realloc(t+n),this._view.set(s,t)}insert(e,t=0,n=this.length-t){return t>this.length-1?!1:(n>this.length-t&&(n=this.length-t),n>e.length&&(n=e.length),n==e.length?this._view.set(e._view,t):this._view.set(e._view.subarray(0,n),t),!0)}isEqual(e){if(this.length!=e.length)return!1;for(let t=0;t<e.length;t++)if(this.view[t]!=e.view[t])return!1;return!0}isEqualView(e){if(e.length!=this.view.length)return!1;for(let t=0;t<e.length;t++)if(this.view[t]!=e[t])return!1;return!0}findPattern(e,t,n,s){let{start:i,length:a,backward:u}=this.prepareFindParameters(t,n,s),c=e.length;if(c>a)return-1;let l=[];for(let f=0;f<c;f++)l.push(e.view[f]);for(let f=0;f<=a-c;f++){let h=!0,d=u?i-c-f:i+f;for(let g=0;g<c;g++)if(this.view[g+d]!=l[g]){h=!1;break}if(h)return u?i-c-f:i+c+f}return-1}findFirstIn(e,t,n,s){let{start:i,length:a,backward:u}=this.prepareFindParameters(t,n,s),c={id:-1,position:u?0:i+a,length:0};for(let l=0;l<e.length;l++){let f=this.findPattern(e[l],i,a,u);if(f!=-1){let h=!1,d=e[l].length;u?f-d>=c.position-c.length&&(h=!0):f-d<=c.position-c.length&&(h=!0),h&&(c.position=f,c.id=l,c.length=d)}}return c}findAllIn(e,t,n){let{start:s,length:i}=this.prepareFindParameters(t,n),a=[],u={id:-1,position:s};do{let c=u.position;if(u=this.findFirstIn(e,u.position,i),u.id==-1)break;i-=u.position-c,a.push({id:u.id,position:u.position})}while(!0);return a}findAllPatternIn(e,t,n){let{start:s,length:i}=this.prepareFindParameters(t,n),a=[],u=e.length;if(u>i)return-1;let c=Array.from(e.view);for(let l=0;l<=i-u;l++){let f=!0,h=s+l;for(let d=0;d<u;d++)if(this.view[d+h]!=c[d]){f=!1;break}f&&(a.push(s+u+l),l+=u-1)}return a}findFirstNotIn(e,t,n,s){let{start:i,length:a,backward:u}=this.prepareFindParameters(t,n,s),c={left:{id:-1,position:i},right:{id:-1,position:0},value:new r},l=a;for(;l>0;){if(c.right=this.findFirstIn(e,u?i-a+l:i+a-l,l,u),c.right.id==-1){a=l,u?i-=a:i=c.left.position,c.value=new r({buffer:this._buffer.slice(i,i+a)});break}if(c.right.position!=(u?c.left.position-e[c.right.id].length:c.left.position+e[c.right.id].length)){u?(i=c.right.position+e[c.right.id].length,a=c.left.position-c.right.position-e[c.right.id].length):(i=c.left.position,a=c.right.position-c.left.position-e[c.right.id].length),c.value=new r({buffer:this._buffer.slice(i,i+a)});break}c.left=c.right,l-=e[c.right.id].length}if(u){let f=c.right;c.right=c.left,c.left=f}return c}findAllNotIn(e,t,n){let{start:s,length:i}=this.prepareFindParameters(t,n),a=[],u={left:{id:-1,position:s},right:{id:-1,position:s},value:new r};do{let c=u.right.position;u=this.findFirstNotIn(e,u.right.position,i),i-=u.right.position-c,a.push({left:{id:u.left.id,position:u.left.position},right:{id:u.right.id,position:u.right.position},value:u.value})}while(u.right.id!=-1);return a}findFirstSequence(e,t,n,s){let{start:i,length:a,backward:u}=this.prepareFindParameters(t,n,s),c=this.skipNotPatterns(e,i,a,u);if(c==-1)return{position:-1,value:new r};let l=this.skipPatterns(e,c,a-(u?i-c:c-i),u);u?(i=l,a=c-l):(i=c,a=l-c);let f=new r({buffer:this._buffer.slice(i,i+a)});return{position:l,value:f}}findAllSequences(e,t,n){let{start:s,length:i}=this.prepareFindParameters(t,n),a=[],u={position:s,value:new r};do{let c=u.position;u=this.findFirstSequence(e,u.position,i),u.position!=-1&&(i-=u.position-c,a.push({position:u.position,value:u.value}))}while(u.position!=-1);return a}findPairedPatterns(e,t,n,s){let i=[];if(e.isEqual(t))return i;let{start:a,length:u}=this.prepareFindParameters(n,s),c=0,l=this.findAllPatternIn(e,a,u);if(!Array.isArray(l)||l.length==0)return i;let f=this.findAllPatternIn(t,a,u);if(!Array.isArray(f)||f.length==0)return i;for(;c<l.length&&f.length!=0;){if(l[0]==f[0]){i.push({left:l[0],right:f[0]}),l.splice(0,1),f.splice(0,1);continue}if(l[c]>f[0])break;for(;l[c]<f[0]&&(c++,!(c>=l.length)););i.push({left:l[c-1],right:f[0]}),l.splice(c-1,1),f.splice(0,1),c=0}return i.sort((h,d)=>h.left-d.left),i}findPairedArrays(e,t,n,s){let{start:i,length:a}=this.prepareFindParameters(n,s),u=[],c=0,l=this.findAllIn(e,i,a);if(l.length==0)return u;let f=this.findAllIn(t,i,a);if(f.length==0)return u;for(;c<l.length&&f.length!=0;){if(l[0].position==f[0].position){u.push({left:l[0],right:f[0]}),l.splice(0,1),f.splice(0,1);continue}if(l[c].position>f[0].position)break;for(;l[c].position<f[0].position&&(c++,!(c>=l.length)););u.push({left:l[c-1],right:f[0]}),l.splice(c-1,1),f.splice(0,1),c=0}return u.sort((h,d)=>h.left.position-d.left.position),u}replacePattern(e,t,n,s,i=null){let a=[],u,c={status:-1,searchPatternPositions:[],replacePatternPositions:[]},{start:l,length:f}=this.prepareFindParameters(n,s);if(i==null){if(a=this.findAllIn([e],l,f),a.length==0)return c}else a=i;c.searchPatternPositions.push(...Array.from(a,m=>m.position));let h=e.length-t.length,d=new ArrayBuffer(this.view.length-a.length*h),g=new Uint8Array(d);for(g.set(new Uint8Array(this.buffer,0,l)),u=0;u<a.length;u++){let m=u==0?l:a[u-1].position;g.set(new Uint8Array(this.buffer,m,a[u].position-e.length-m),m-u*h),g.set(t.view,a[u].position-e.length-u*h),c.replacePatternPositions.push(a[u].position-e.length-u*h)}return u--,g.set(new Uint8Array(this.buffer,a[u].position,this.length-a[u].position),a[u].position-e.length+t.length-u*h),this.buffer=d,this.view=new Uint8Array(this.buffer),c.status=1,c}skipPatterns(e,t,n,s){let{start:i,length:a,backward:u}=this.prepareFindParameters(t,n,s),c=i;for(let l=0;l<e.length;l++){let f=e[l].length,h=u?c-f:c,d=!0;for(let g=0;g<f;g++)if(this.view[g+h]!=e[l].view[g]){d=!1;break}if(d){if(l=-1,u){if(c-=f,c<=0)return c}else if(c+=f,c>=i+a)return c}}return c}skipNotPatterns(e,t,n,s){let{start:i,length:a,backward:u}=this.prepareFindParameters(t,n,s),c=-1;for(let l=0;l<a;l++){for(let f=0;f<e.length;f++){let h=e[f].length,d=u?i-l-h:i+l,g=!0;for(let m=0;m<h;m++)if(this.view[m+d]!=e[f].view[m]){g=!1;break}if(g){c=u?i-l:i+l;break}}if(c!=-1)break}return c}prepareFindParameters(e=null,t=null,n=!1){return e===null&&(e=n?this.length:0),e>this.length&&(e=this.length),n?(t===null&&(t=e),t>e&&(t=e)):(t===null&&(t=this.length-e),t>this.length-e&&(t=this.length-e)),{start:e,length:t,backward:n}}};var Jue=16777216,uo=class r{static{o(this,"SeqStream")}constructor(e={}){this._stream=new On,this._length=0,this._start=0,this.backward=!1,this.appendBlock=0,this.prevLength=0,this.prevStart=0,"view"in e?this.stream=new On({view:e.view}):"buffer"in e?this.stream=new On({buffer:e.buffer}):"string"in e?this.stream=new On({string:e.string}):"hexstring"in e?this.stream=new On({hexstring:e.hexstring}):"stream"in e?this.stream=e.stream.slice():this.stream=new On,"backward"in e&&e.backward&&(this.backward=e.backward,this._start=this.stream.length),"length"in e&&e.length>0&&(this._length=e.length),"start"in e&&e.start&&e.start>0&&(this._start=e.start),"appendBlock"in e&&e.appendBlock&&e.appendBlock>0&&(this.appendBlock=e.appendBlock)}set stream(e){this._stream=e,this.prevLength=this._length,this._length=e.length,this.prevStart=this._start,this._start=0}get stream(){return this._stream}set length(e){this.prevLength=this._length,this._length=e}get length(){return this.appendBlock?this.start:this._length}set start(e){e>this.stream.length||(this.prevStart=this._start,this.prevLength=this._length,this._length-=this.backward?this._start-e:e-this._start,this._start=e)}get start(){return this._start}get buffer(){return this._stream.buffer.slice(0,this._length)}resetPosition(){this._start=this.prevStart,this._length=this.prevLength}findPattern(e,t=null){(t==null||t>this.length)&&(t=this.length);let n=this.stream.findPattern(e,this.start,this.length,this.backward);if(n==-1)return n;if(this.backward){if(n<this.start-e.length-t)return-1}else if(n>this.start+e.length+t)return-1;return this.start=n,n}findFirstIn(e,t=null){(t==null||t>this.length)&&(t=this.length);let n=this.stream.findFirstIn(e,this.start,this.length,this.backward);if(n.id==-1)return n;if(this.backward){if(n.position<this.start-e[n.id].length-t)return{id:-1,position:this.backward?0:this.start+this.length}}else if(n.position>this.start+e[n.id].length+t)return{id:-1,position:this.backward?0:this.start+this.length};return this.start=n.position,n}findAllIn(e){let t=this.backward?this.start-this.length:this.start;return this.stream.findAllIn(e,t,this.length)}findFirstNotIn(e,t=null){(t==null||t>this._length)&&(t=this._length);let n=this._stream.findFirstNotIn(e,this._start,this._length,this.backward);if(n.left.id==-1&&n.right.id==-1)return n;if(this.backward){if(n.right.id!=-1&&n.right.position<this._start-e[n.right.id].length-t)return{left:{id:-1,position:this._start},right:{id:-1,position:0},value:new On}}else if(n.left.id!=-1&&n.left.position>this._start+e[n.left.id].length+t)return{left:{id:-1,position:this._start},right:{id:-1,position:0},value:new On};return this.backward?n.left.id==-1?this.start=0:this.start=n.left.position:n.right.id==-1?this.start=this._start+this._length:this.start=n.right.position,n}findAllNotIn(e){let t=this.backward?this._start-this._length:this._start;return this._stream.findAllNotIn(e,t,this._length)}findFirstSequence(e,t=null,n=null){(t==null||t>this._length)&&(t=this._length),(n==null||n>t)&&(n=t);let s=this._stream.findFirstSequence(e,this._start,t,this.backward);if(s.value.length==0)return s;if(this.backward){if(s.position<this._start-s.value.length-n)return{position:-1,value:new On}}else if(s.position>this._start+s.value.length+n)return{position:-1,value:new On};return this.start=s.position,s}findAllSequences(e){let t=this.backward?this.start-this.length:this.start;return this.stream.findAllSequences(e,t,this.length)}findPairedPatterns(e,t,n=null){(n==null||n>this.length)&&(n=this.length);let s=this.backward?this.start-this.length:this.start,i=this.stream.findPairedPatterns(e,t,s,this.length);if(i.length){if(this.backward){if(i[0].right<this.start-t.length-n)return[]}else if(i[0].left>this.start+e.length+n)return[]}return i}findPairedArrays(e,t,n=null){(n==null||n>this.length)&&(n=this.length);let s=this.backward?this.start-this.length:this.start,i=this.stream.findPairedArrays(e,t,s,this.length);if(i.length){if(this.backward){if(i[0].right.position<this.start-t[i[0].right.id].length-n)return[]}else if(i[0].left.position>this.start+e[i[0].left.id].length+n)return[]}return i}replacePattern(e,t){let n=this.backward?this.start-this.length:this.start;return this.stream.replacePattern(e,t,n,this.length)}skipPatterns(e){let t=this.stream.skipPatterns(e,this.start,this.length,this.backward);return this.start=t,t}skipNotPatterns(e){let t=this.stream.skipNotPatterns(e,this.start,this.length,this.backward);return t==-1?-1:(this.start=t,t)}append(e){this.beforeAppend(e.length),this._stream.view.set(e.view,this._start),this._length+=e.length*2,this.start=this._start+e.length,this.prevLength-=e.length*2}appendView(e){this.beforeAppend(e.length),this._stream.view.set(e,this._start),this._length+=e.length*2,this.start=this._start+e.length,this.prevLength-=e.length*2}appendChar(e){this.beforeAppend(1),this._stream.view[this._start]=e,this._length+=2,this.start=this._start+1,this.prevLength-=2}appendUint16(e){this.beforeAppend(2);let t=new Uint16Array([e]),n=new Uint8Array(t.buffer);this.stream.view[this._start]=n[1],this._stream.view[this._start+1]=n[0],this._length+=4,this.start=this._start+2,this.prevLength-=4}appendUint24(e){this.beforeAppend(3);let t=new Uint32Array([e]),n=new Uint8Array(t.buffer);this._stream.view[this._start]=n[2],this._stream.view[this._start+1]=n[1],this._stream.view[this._start+2]=n[0],this._length+=6,this.start=this._start+3,this.prevLength-=6}appendUint32(e){this.beforeAppend(4);let t=new Uint32Array([e]),n=new Uint8Array(t.buffer);this._stream.view[this._start]=n[3],this._stream.view[this._start+1]=n[2],this._stream.view[this._start+2]=n[1],this._stream.view[this._start+3]=n[0],this._length+=8,this.start=this._start+4,this.prevLength-=8}appendInt16(e){this.beforeAppend(2);let t=new Int16Array([e]),n=new Uint8Array(t.buffer);this._stream.view[this._start]=n[1],this._stream.view[this._start+1]=n[0],this._length+=4,this.start=this._start+2,this.prevLength-=4}appendInt32(e){this.beforeAppend(4);let t=new Int32Array([e]),n=new Uint8Array(t.buffer);this._stream.view[this._start]=n[3],this._stream.view[this._start+1]=n[2],this._stream.view[this._start+2]=n[1],this._stream.view[this._start+3]=n[0],this._length+=8,this.start=this._start+4,this.prevLength-=8}getBlock(e,t=!0){if(this._length<=0)return new Uint8Array(0);this._length<e&&(e=this._length);let n;if(this.backward){let s=this._stream.view.subarray(this._length-e,this._length);n=new Uint8Array(e);for(let i=0;i<e;i++)n[e-1-i]=s[i]}else n=this._stream.view.subarray(this._start,this._start+e);return t&&(this.start+=this.backward?-1*e:e),n}getUint16(e=!0){let t=this.getBlock(2,e);return t.length<2?0:t[0]<<8|t[1]}getInt16(e=!0){let t=this.getUint16(e),n=32768;return t&n?-(n-(t^n)):t}getUint24(e=!0){let t=this.getBlock(4,e);return t.length<3?0:t[0]<<16|t[1]<<8|t[2]}getUint32(e=!0){let t=this.getBlock(4,e);return t.length<4?0:t[0]*Jue+(t[1]<<16)+(t[2]<<8)+t[3]}getInt32(e=!0){let t=this.getUint32(e),n=2147483648;return t&n?-(n-(t^n)):t}beforeAppend(e){this._start+e>this._stream.length&&(e>this.appendBlock&&(this.appendBlock=e+r.APPEND_BLOCK),this._stream.realloc(this._stream.length+this.appendBlock))}};uo.APPEND_BLOCK=1e3;function Que(r){return r instanceof Uint8Array||r!=null&&typeof r=="object"&&r.constructor.name==="Uint8Array"}o(Que,"isBytes");function BB(r,...e){if(!Que(r))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(r.length))throw new Error(`Uint8Array expected of length ${e}, not of length=${r.length}`)}o(BB,"bytes");function RB(r,e=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(e&&r.finished)throw new Error("Hash#digest() has already been called")}o(RB,"exists");function e7(r,e){BB(r);let t=e.outputLen;if(r.length<t)throw new Error(`digestInto() expects output buffer of length at least ${t}`)}o(e7,"output");var ab=o(r=>new DataView(r.buffer,r.byteOffset,r.byteLength),"createView"),Pi=o((r,e)=>r<<32-e|r>>>e,"rotr"),ob=o((r,e)=>r<<e|r>>>32-e>>>0,"rotl"),qDe=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Zue(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}o(Zue,"utf8ToBytes");function _B(r){return typeof r=="string"&&(r=Zue(r)),BB(r),r}o(_B,"toBytes");var ib=class{static{o(this,"Hash")}clone(){return this._cloneInto()}},HDe={}.toString;function Dl(r){let e=o(n=>r().update(_B(n)).digest(),"hashC"),t=r();return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=()=>r(),e}o(Dl,"wrapConstructor");function ece(r,e,t,n){if(typeof r.setBigUint64=="function")return r.setBigUint64(e,t,n);let s=BigInt(32),i=BigInt(4294967295),a=Number(t>>s&i),u=Number(t&i),c=n?4:0,l=n?0:4;r.setUint32(e+c,a,n),r.setUint32(e+l,u,n)}o(ece,"setBigUint64");var ub=o((r,e,t)=>r&e^~r&t,"Chi"),cb=o((r,e,t)=>r&e^r&t^e&t,"Maj"),Ou=class extends ib{static{o(this,"HashMD")}constructor(e,t,n,s){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=s,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=ab(this.buffer)}update(e){RB(this);let{view:t,buffer:n,blockLen:s}=this;e=_B(e);let i=e.length;for(let a=0;a<i;){let u=Math.min(s-this.pos,i-a);if(u===s){let c=ab(e);for(;s<=i-a;a+=s)this.process(c,a);continue}n.set(e.subarray(a,a+u),this.pos),this.pos+=u,a+=u,this.pos===s&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){RB(this),e7(e,this),this.finished=!0;let{buffer:t,view:n,blockLen:s,isLE:i}=this,{pos:a}=this;t[a++]=128,this.buffer.subarray(a).fill(0),this.padOffset>s-a&&(this.process(n,0),a=0);for(let h=a;h<s;h++)t[h]=0;ece(n,s-8,BigInt(this.length*8),i),this.process(n,0);let u=ab(e),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let l=c/4,f=this.get();if(l>f.length)throw new Error("_sha2: outputLen bigger than state");for(let h=0;h<l;h++)u.setUint32(4*h,f[h],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:t,buffer:n,length:s,finished:i,destroyed:a,pos:u}=this;return e.length=s,e.pos=u,e.finished=i,e.destroyed=a,s%t&&e.buffer.set(n),e}};var ay=new Uint32Array([1732584193,4023233417,2562383102,271733878,3285377520]),Pu=new Uint32Array(80),tce=class extends Ou{static{o(this,"SHA1")}constructor(){super(64,20,8,!1),this.A=ay[0]|0,this.B=ay[1]|0,this.C=ay[2]|0,this.D=ay[3]|0,this.E=ay[4]|0}get(){let{A:e,B:t,C:n,D:s,E:i}=this;return[e,t,n,s,i]}set(e,t,n,s,i){this.A=e|0,this.B=t|0,this.C=n|0,this.D=s|0,this.E=i|0}process(e,t){for(let c=0;c<16;c++,t+=4)Pu[c]=e.getUint32(t,!1);for(let c=16;c<80;c++)Pu[c]=ob(Pu[c-3]^Pu[c-8]^Pu[c-14]^Pu[c-16],1);let{A:n,B:s,C:i,D:a,E:u}=this;for(let c=0;c<80;c++){let l,f;c<20?(l=ub(s,i,a),f=1518500249):c<40?(l=s^i^a,f=1859775393):c<60?(l=cb(s,i,a),f=2400959708):(l=s^i^a,f=3395469782);let h=ob(n,5)+l+u+f+Pu[c]|0;u=a,a=i,i=ob(s,30),s=n,n=h}n=n+this.A|0,s=s+this.B|0,i=i+this.C|0,a=a+this.D|0,u=u+this.E|0,this.set(n,s,i,a,u)}roundClean(){Pu.fill(0)}destroy(){this.set(0,0,0,0,0),this.buffer.fill(0)}},t7=Dl(()=>new tce);var rce=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),ku=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Lu=new Uint32Array(64),nce=class extends Ou{static{o(this,"SHA256")}constructor(){super(64,32,8,!1),this.A=ku[0]|0,this.B=ku[1]|0,this.C=ku[2]|0,this.D=ku[3]|0,this.E=ku[4]|0,this.F=ku[5]|0,this.G=ku[6]|0,this.H=ku[7]|0}get(){let{A:e,B:t,C:n,D:s,E:i,F:a,G:u,H:c}=this;return[e,t,n,s,i,a,u,c]}set(e,t,n,s,i,a,u,c){this.A=e|0,this.B=t|0,this.C=n|0,this.D=s|0,this.E=i|0,this.F=a|0,this.G=u|0,this.H=c|0}process(e,t){for(let h=0;h<16;h++,t+=4)Lu[h]=e.getUint32(t,!1);for(let h=16;h<64;h++){let d=Lu[h-15],g=Lu[h-2],m=Pi(d,7)^Pi(d,18)^d>>>3,v=Pi(g,17)^Pi(g,19)^g>>>10;Lu[h]=v+Lu[h-7]+m+Lu[h-16]|0}let{A:n,B:s,C:i,D:a,E:u,F:c,G:l,H:f}=this;for(let h=0;h<64;h++){let d=Pi(u,6)^Pi(u,11)^Pi(u,25),g=f+d+ub(u,c,l)+rce[h]+Lu[h]|0,v=(Pi(n,2)^Pi(n,13)^Pi(n,22))+cb(n,s,i)|0;f=l,l=c,c=u,u=a+g|0,a=i,i=s,s=n,n=g+v|0}n=n+this.A|0,s=s+this.B|0,i=i+this.C|0,a=a+this.D|0,u=u+this.E|0,c=c+this.F|0,l=l+this.G|0,f=f+this.H|0,this.set(n,s,i,a,u,c,l,f)}roundClean(){Lu.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var OB=Dl(()=>new nce);var lb=BigInt(4294967295),PB=BigInt(32);function r7(r,e=!1){return e?{h:Number(r&lb),l:Number(r>>PB&lb)}:{h:Number(r>>PB&lb)|0,l:Number(r&lb)|0}}o(r7,"fromBig");function sce(r,e=!1){let t=new Uint32Array(r.length),n=new Uint32Array(r.length);for(let s=0;s<r.length;s++){let{h:i,l:a}=r7(r[s],e);[t[s],n[s]]=[i,a]}return[t,n]}o(sce,"split");var ice=o((r,e)=>BigInt(r>>>0)<<PB|BigInt(e>>>0),"toBig"),ace=o((r,e,t)=>r>>>t,"shrSH"),oce=o((r,e,t)=>r<<32-t|e>>>t,"shrSL"),uce=o((r,e,t)=>r>>>t|e<<32-t,"rotrSH"),cce=o((r,e,t)=>r<<32-t|e>>>t,"rotrSL"),lce=o((r,e,t)=>r<<64-t|e>>>t-32,"rotrBH"),fce=o((r,e,t)=>r>>>t-32|e<<64-t,"rotrBL"),hce=o((r,e)=>e,"rotr32H"),pce=o((r,e)=>r,"rotr32L"),dce=o((r,e,t)=>r<<t|e>>>32-t,"rotlSH"),mce=o((r,e,t)=>e<<t|r>>>32-t,"rotlSL"),gce=o((r,e,t)=>e<<t-32|r>>>64-t,"rotlBH"),yce=o((r,e,t)=>r<<t-32|e>>>64-t,"rotlBL");function vce(r,e,t,n){let s=(e>>>0)+(n>>>0);return{h:r+t+(s/2**32|0)|0,l:s|0}}o(vce,"add");var xce=o((r,e,t)=>(r>>>0)+(e>>>0)+(t>>>0),"add3L"),Ece=o((r,e,t,n)=>e+t+n+(r/2**32|0)|0,"add3H"),wce=o((r,e,t,n)=>(r>>>0)+(e>>>0)+(t>>>0)+(n>>>0),"add4L"),bce=o((r,e,t,n,s)=>e+t+n+s+(r/2**32|0)|0,"add4H"),Sce=o((r,e,t,n,s)=>(r>>>0)+(e>>>0)+(t>>>0)+(n>>>0)+(s>>>0),"add5L"),Ace=o((r,e,t,n,s,i)=>e+t+n+s+i+(r/2**32|0)|0,"add5H");var Cce={fromBig:r7,split:sce,toBig:ice,shrSH:ace,shrSL:oce,rotrSH:uce,rotrSL:cce,rotrBH:lce,rotrBL:fce,rotr32H:hce,rotr32L:pce,rotlSH:dce,rotlSL:mce,rotlBH:gce,rotlBL:yce,add:vce,add3L:xce,add3H:Ece,add4L:wce,add4H:bce,add5H:Ace,add5L:Sce},Nt=Cce;var[Nce,Tce]=Nt.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(r=>BigInt(r))),Fu=new Uint32Array(80),Uu=new Uint32Array(80),fb=class extends Ou{static{o(this,"SHA512")}constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){let{Ah:e,Al:t,Bh:n,Bl:s,Ch:i,Cl:a,Dh:u,Dl:c,Eh:l,El:f,Fh:h,Fl:d,Gh:g,Gl:m,Hh:v,Hl:y}=this;return[e,t,n,s,i,a,u,c,l,f,h,d,g,m,v,y]}set(e,t,n,s,i,a,u,c,l,f,h,d,g,m,v,y){this.Ah=e|0,this.Al=t|0,this.Bh=n|0,this.Bl=s|0,this.Ch=i|0,this.Cl=a|0,this.Dh=u|0,this.Dl=c|0,this.Eh=l|0,this.El=f|0,this.Fh=h|0,this.Fl=d|0,this.Gh=g|0,this.Gl=m|0,this.Hh=v|0,this.Hl=y|0}process(e,t){for(let E=0;E<16;E++,t+=4)Fu[E]=e.getUint32(t),Uu[E]=e.getUint32(t+=4);for(let E=16;E<80;E++){let x=Fu[E-15]|0,b=Uu[E-15]|0,A=Nt.rotrSH(x,b,1)^Nt.rotrSH(x,b,8)^Nt.shrSH(x,b,7),k=Nt.rotrSL(x,b,1)^Nt.rotrSL(x,b,8)^Nt.shrSL(x,b,7),I=Fu[E-2]|0,T=Uu[E-2]|0,V=Nt.rotrSH(I,T,19)^Nt.rotrBH(I,T,61)^Nt.shrSH(I,T,6),U=Nt.rotrSL(I,T,19)^Nt.rotrBL(I,T,61)^Nt.shrSL(I,T,6),M=Nt.add4L(k,U,Uu[E-7],Uu[E-16]),ie=Nt.add4H(M,A,V,Fu[E-7],Fu[E-16]);Fu[E]=ie|0,Uu[E]=M|0}let{Ah:n,Al:s,Bh:i,Bl:a,Ch:u,Cl:c,Dh:l,Dl:f,Eh:h,El:d,Fh:g,Fl:m,Gh:v,Gl:y,Hh:w,Hl:S}=this;for(let E=0;E<80;E++){let x=Nt.rotrSH(h,d,14)^Nt.rotrSH(h,d,18)^Nt.rotrBH(h,d,41),b=Nt.rotrSL(h,d,14)^Nt.rotrSL(h,d,18)^Nt.rotrBL(h,d,41),A=h&g^~h&v,k=d&m^~d&y,I=Nt.add5L(S,b,k,Tce[E],Uu[E]),T=Nt.add5H(I,w,x,A,Nce[E],Fu[E]),V=I|0,U=Nt.rotrSH(n,s,28)^Nt.rotrBH(n,s,34)^Nt.rotrBH(n,s,39),M=Nt.rotrSL(n,s,28)^Nt.rotrBL(n,s,34)^Nt.rotrBL(n,s,39),ie=n&i^n&u^i&u,Z=s&a^s&c^a&c;w=v|0,S=y|0,v=g|0,y=m|0,g=h|0,m=d|0,{h,l:d}=Nt.add(l|0,f|0,T|0,V|0),l=u|0,f=c|0,u=i|0,c=a|0,i=n|0,a=s|0;let ue=Nt.add3L(V,M,Z);n=Nt.add3H(ue,T,U,ie),s=ue|0}({h:n,l:s}=Nt.add(this.Ah|0,this.Al|0,n|0,s|0)),{h:i,l:a}=Nt.add(this.Bh|0,this.Bl|0,i|0,a|0),{h:u,l:c}=Nt.add(this.Ch|0,this.Cl|0,u|0,c|0),{h:l,l:f}=Nt.add(this.Dh|0,this.Dl|0,l|0,f|0),{h,l:d}=Nt.add(this.Eh|0,this.El|0,h|0,d|0),{h:g,l:m}=Nt.add(this.Fh|0,this.Fl|0,g|0,m|0),{h:v,l:y}=Nt.add(this.Gh|0,this.Gl|0,v|0,y|0),{h:w,l:S}=Nt.add(this.Hh|0,this.Hl|0,w|0,S|0),this.set(n,s,i,a,u,c,l,f,h,d,g,m,v,y,w,S)}roundClean(){Fu.fill(0),Uu.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};var Ice=class extends fb{static{o(this,"SHA384")}constructor(){super(),this.Ah=-876896931,this.Al=-1056596264,this.Bh=1654270250,this.Bl=914150663,this.Ch=-1856437926,this.Cl=812702999,this.Dh=355462360,this.Dl=-150054599,this.Eh=1731405415,this.El=-4191439,this.Fh=-1900787065,this.Fl=1750603025,this.Gh=-619958771,this.Gl=1694076839,this.Hh=1203062813,this.Hl=-1090891868,this.outputLen=48}},kB=Dl(()=>new fb);var LB=Dl(()=>new Ice);var Kr=new ArrayBuffer(0),P="",hr=class hR extends TypeError{static{o(this,"ArgumentError")}constructor(){super(...arguments),this.name=hR.NAME}static isType(e,t){if(typeof t=="string"){if(t==="Array"&&Array.isArray(e))return!0;if(t==="ArrayBuffer"&&e instanceof ArrayBuffer)return!0;if(t==="ArrayBufferView"&&ArrayBuffer.isView(e))return!0;if(typeof e===t)return!0}else if(e instanceof t)return!0;return!1}static assert(e,t,...n){for(let i of n)if(this.isType(e,i))return;let s=n.map(i=>i instanceof Function&&"name"in i?i.name:`${i}`);throw new hR(`Parameter '${t}' is not of type ${s.length>1?`(${s.join(" or ")})`:s[0]}`)}};hr.NAME="ArgumentError";var Jt=class Ub extends TypeError{static{o(this,"ParameterError")}static assert(...e){let t=null,n,s;typeof e[0]=="string"?(t=e[0],n=e[1],s=e.slice(2)):(n=e[0],s=e.slice(1)),hr.assert(n,"parameters","object");for(let i of s){let a=n[i];if(a==null)throw new Ub(i,t)}}static assertEmpty(e,t,n){if(e==null)throw new Ub(t,n)}constructor(e,t=null,n){super(),this.name=Ub.NAME,this.field=e,t&&(this.target=t),n?this.message=n:this.message=`Absent mandatory parameter '${e}' ${t?` in '${t}'`:P}`}};Jt.NAME="ParameterError";var ye=class T7 extends Error{static{o(this,"AsnError")}static assertSchema(e,t){if(!e.verified)throw new Error(`Object's schema was not verified against input data for ${t}`)}static assert(e,t){if(e.offset===-1)throw new T7(`Error during parsing of ASN.1 data. Data is not correct for '${t}'.`)}constructor(e){super(e),this.name="AsnError"}},Se=class{static{o(this,"PkiObject")}static blockName(){return this.CLASS_NAME}static fromBER(e){let t=Or(e);ye.assert(t,this.name);try{return new this({schema:t.result})}catch{throw new ye(`Cannot create '${this.CLASS_NAME}' from ASN.1 object`)}}static defaultValues(e){throw new Error(`Invalid member name for ${this.CLASS_NAME} class: ${e}`)}static schema(e={}){throw new Error(`Method '${this.CLASS_NAME}.schema' should be overridden`)}get className(){return this.constructor.CLASS_NAME}toString(e="hex"){let t;try{t=this.toSchema()}catch{t=this.toSchema(!0)}return ut.ToString(t.toBER(),e)}};Se.CLASS_NAME="PkiObject";function Rc(r){let e=!1,t=P,n=r.trim();for(let s=0;s<n.length;s++)n.charCodeAt(s)===32?e===!1&&(e=!0):(e&&(t+=" ",e=!1),t+=n[s]);return t.toLowerCase()}o(Rc,"stringPrep");var oy="type",FB="value",pR=class Ey extends Se{static{o(this,"AttributeTypeAndValue")}constructor(e={}){super(),this.type=B(e,oy,Ey.defaultValues(oy)),this.value=B(e,FB,Ey.defaultValues(FB)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case oy:return P;case FB:return{};default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new He({name:t.type||P}),new it({name:t.value||P})]})}fromSchema(e){Ce(e,[oy,"typeValue"]);let t=be(e,e,Ey.schema({names:{type:oy,value:"typeValue"}}));ye.assertSchema(t,this.className),this.type=t.result.type.valueBlock.toString(),this.value=t.result.typeValue}toSchema(){return new K({value:[new He({value:this.type}),this.value]})}toJSON(){let e={type:this.type};return Object.keys(this.value).length!==0?e.value=this.value.toJSON():e.value=this.value,e}isEqual(e){let t=[ui.blockName(),Dp.blockName(),Bp.blockName(),Tl.blockName(),ci.blockName(),Rp.blockName(),tb.blockName(),ny.blockName(),rb.blockName(),sy.blockName(),nb.blockName(),sb.blockName()];if(e instanceof ArrayBuffer)return Ze.isEqual(this.value.valueBeforeDecodeView,e);if(e.constructor.blockName()===Ey.blockName()){if(this.type!==e.type)return!1;let n=[!1,!1],s=this.value.constructor.blockName();for(let a of t)s===a&&(n[0]=!0),e.value.constructor.blockName()===a&&(n[1]=!0);if(n[0]!==n[1])return!1;if(n[0]&&n[1]){let a=Rc(this.value.valueBlock.value),u=Rc(e.value.valueBlock.value);if(a.localeCompare(u)!==0)return!1}else if(!Ze.isEqual(this.value.valueBeforeDecodeView,e.value.valueBeforeDecodeView))return!1;return!0}return!1}};pR.CLASS_NAME="AttributeTypeAndValue";var Bl="typesAndValues",hb="valueBeforeDecode",n7="RDN",Ar=class wy extends Se{static{o(this,"RelativeDistinguishedNames")}constructor(e={}){super(),this.typesAndValues=B(e,Bl,wy.defaultValues(Bl)),this.valueBeforeDecode=B(e,hb,wy.defaultValues(hb)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Bl:return[];case hb:return Kr;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Bl:return t.length===0;case hb:return t.byteLength===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new lt({name:t.repeatedSequence||P,value:new kr({value:[new lt({name:t.repeatedSet||P,value:pR.schema(t.typeAndValue||{})})]})})]})}fromSchema(e){Ce(e,[n7,Bl]);let t=be(e,e,wy.schema({names:{blockName:n7,repeatedSet:Bl}}));ye.assertSchema(t,this.className),Bl in t.result&&(this.typesAndValues=Array.from(t.result.typesAndValues,n=>new pR({schema:n}))),this.valueBeforeDecode=t.result.RDN.valueBeforeDecodeView.slice().buffer}toSchema(){if(this.valueBeforeDecode.byteLength===0)return new K({value:[new kr({value:Array.from(this.typesAndValues,t=>t.toSchema())})]});let e=Or(this.valueBeforeDecode);if(ye.assert(e,"RelativeDistinguishedNames"),!(e.result instanceof K))throw new Error("ASN.1 result should be SEQUENCE");return e.result}toJSON(){return{typesAndValues:Array.from(this.typesAndValues,e=>e.toJSON())}}isEqual(e){if(e instanceof wy){if(this.typesAndValues.length!==e.typesAndValues.length)return!1;for(let[t,n]of this.typesAndValues.entries())if(n.isEqual(e.typesAndValues[t])===!1)return!1;return!0}return e instanceof ArrayBuffer?Bu(this.valueBeforeDecode,e):!1}};Ar.CLASS_NAME="RelativeDistinguishedNames";var by="type",Sy="value";function Dce(r={},e=!1){let t=B(r,"names",{});return new K({optional:e,value:[new ae({optional:!0,idBlock:{tagClass:2,tagNumber:1},name:t.country_name||P,value:[new Sr({value:[new Tl,new ci]})]}),new ae({optional:!0,idBlock:{tagClass:2,tagNumber:2},name:t.administration_domain_name||P,value:[new Sr({value:[new Tl,new ci]})]}),new tt({optional:!0,idBlock:{tagClass:3,tagNumber:0},name:t.network_address||P,isHexOnly:!0}),new tt({optional:!0,idBlock:{tagClass:3,tagNumber:1},name:t.terminal_identifier||P,isHexOnly:!0}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:2},name:t.private_domain_name||P,value:[new Sr({value:[new Tl,new ci]})]}),new tt({optional:!0,idBlock:{tagClass:3,tagNumber:3},name:t.organization_name||P,isHexOnly:!0}),new tt({optional:!0,name:t.numeric_user_identifier||P,idBlock:{tagClass:3,tagNumber:4},isHexOnly:!0}),new ae({optional:!0,name:t.personal_name||P,idBlock:{tagClass:3,tagNumber:5},value:[new tt({idBlock:{tagClass:3,tagNumber:0},isHexOnly:!0}),new tt({optional:!0,idBlock:{tagClass:3,tagNumber:1},isHexOnly:!0}),new tt({optional:!0,idBlock:{tagClass:3,tagNumber:2},isHexOnly:!0}),new tt({optional:!0,idBlock:{tagClass:3,tagNumber:3},isHexOnly:!0})]}),new ae({optional:!0,name:t.organizational_unit_names||P,idBlock:{tagClass:3,tagNumber:6},value:[new lt({value:new ci})]})]})}o(Dce,"builtInStandardAttributes");function Bce(r=!1){return new K({optional:r,value:[new ci,new ci]})}o(Bce,"builtInDomainDefinedAttributes");function Rce(r=!1){return new kr({optional:r,value:[new tt({optional:!0,idBlock:{tagClass:3,tagNumber:0},isHexOnly:!0}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:1},value:[new it]})]})}o(Rce,"extensionAttributes");var pr=class Vp extends Se{static{o(this,"GeneralName")}constructor(e={}){super(),this.type=B(e,by,Vp.defaultValues(by)),this.value=B(e,Sy,Vp.defaultValues(Sy)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case by:return 9;case Sy:return{};default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case by:return t===Vp.defaultValues(e);case Sy:return Object.keys(t).length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new Sr({value:[new ae({idBlock:{tagClass:3,tagNumber:0},name:t.blockName||P,value:[new He,new ae({idBlock:{tagClass:3,tagNumber:0},value:[new it]})]}),new tt({name:t.blockName||P,idBlock:{tagClass:3,tagNumber:1}}),new tt({name:t.blockName||P,idBlock:{tagClass:3,tagNumber:2}}),new ae({idBlock:{tagClass:3,tagNumber:3},name:t.blockName||P,value:[Dce(t.builtInStandardAttributes||{},!1),Bce(!0),Rce(!0)]}),new ae({idBlock:{tagClass:3,tagNumber:4},name:t.blockName||P,value:[Ar.schema(t.directoryName||{})]}),new ae({idBlock:{tagClass:3,tagNumber:5},name:t.blockName||P,value:[new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new Sr({value:[new Rp,new ci,new Bp,new ui,new Dp]})]}),new ae({idBlock:{tagClass:3,tagNumber:1},value:[new Sr({value:[new Rp,new ci,new Bp,new ui,new Dp]})]})]}),new tt({name:t.blockName||P,idBlock:{tagClass:3,tagNumber:6}}),new tt({name:t.blockName||P,idBlock:{tagClass:3,tagNumber:7}}),new tt({name:t.blockName||P,idBlock:{tagClass:3,tagNumber:8}})]})}fromSchema(e){Ce(e,["blockName","otherName","rfc822Name","dNSName","x400Address","directoryName","ediPartyName","uniformResourceIdentifier","iPAddress","registeredID"]);let t=be(e,e,Vp.schema({names:{blockName:"blockName",otherName:"otherName",rfc822Name:"rfc822Name",dNSName:"dNSName",x400Address:"x400Address",directoryName:{names:{blockName:"directoryName"}},ediPartyName:"ediPartyName",uniformResourceIdentifier:"uniformResourceIdentifier",iPAddress:"iPAddress",registeredID:"registeredID"}}));switch(ye.assertSchema(t,this.className),this.type=t.result.blockName.idBlock.tagNumber,this.type){case 0:this.value=t.result.blockName;break;case 1:case 2:case 6:{let n=t.result.blockName;n.idBlock.tagClass=1,n.idBlock.tagNumber=22;let s=n.toBER(!1),i=Or(s);ye.assert(i,"GeneralName value"),this.value=i.result.valueBlock.value}break;case 3:this.value=t.result.blockName;break;case 4:this.value=new Ar({schema:t.result.directoryName});break;case 5:this.value=t.result.ediPartyName;break;case 7:this.value=new Be({valueHex:t.result.blockName.valueBlock.valueHex});break;case 8:{let n=t.result.blockName;n.idBlock.tagClass=1,n.idBlock.tagNumber=6;let s=n.toBER(!1),i=Or(s);ye.assert(i,"GeneralName registeredID"),this.value=i.result.valueBlock.toString()}break}}toSchema(){switch(this.type){case 0:case 3:case 5:return new ae({idBlock:{tagClass:3,tagNumber:this.type},value:[this.value]});case 1:case 2:case 6:{let e=new ny({value:this.value});return e.idBlock.tagClass=3,e.idBlock.tagNumber=this.type,e}case 4:return new ae({idBlock:{tagClass:3,tagNumber:4},value:[this.value.toSchema()]});case 7:{let e=this.value;return e.idBlock.tagClass=3,e.idBlock.tagNumber=this.type,e}case 8:{let e=new He({value:this.value});return e.idBlock.tagClass=3,e.idBlock.tagNumber=this.type,e}default:return Vp.schema()}}toJSON(){let e={type:this.type,value:P};if(typeof this.value=="string")e.value=this.value;else try{e.value=this.value.toJSON()}catch{}return e}};pr.CLASS_NAME="GeneralName";var Ay="accessMethod",Cy="accessLocation",_ce=[Ay,Cy],dR=class Vb extends Se{static{o(this,"AccessDescription")}constructor(e={}){super(),this.accessMethod=B(e,Ay,Vb.defaultValues(Ay)),this.accessLocation=B(e,Cy,Vb.defaultValues(Cy)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Ay:return P;case Cy:return new pr;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new He({name:t.accessMethod||P}),pr.schema(t.accessLocation||{})]})}fromSchema(e){Ce(e,_ce);let t=be(e,e,Vb.schema({names:{accessMethod:Ay,accessLocation:{names:{blockName:Cy}}}}));ye.assertSchema(t,this.className),this.accessMethod=t.result.accessMethod.valueBlock.toString(),this.accessLocation=new pr({schema:t.result.accessLocation})}toSchema(){return new K({value:[new He({value:this.accessMethod}),this.accessLocation.toSchema()]})}toJSON(){return{accessMethod:this.accessMethod,accessLocation:this.accessLocation.toJSON()}}};dR.CLASS_NAME="AccessDescription";var Mu="seconds",ju="millis",qu="micros",Pl=class Mp extends Se{static{o(this,"Accuracy")}constructor(e={}){super(),Mu in e&&(this.seconds=B(e,Mu,Mp.defaultValues(Mu))),ju in e&&(this.millis=B(e,ju,Mp.defaultValues(ju))),qu in e&&(this.micros=B(e,qu,Mp.defaultValues(qu))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Mu:case ju:case qu:return 0;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Mu:case ju:case qu:return t===Mp.defaultValues(e);default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,optional:!0,value:[new he({optional:!0,name:t.seconds||P}),new tt({name:t.millis||P,optional:!0,idBlock:{tagClass:3,tagNumber:0}}),new tt({name:t.micros||P,optional:!0,idBlock:{tagClass:3,tagNumber:1}})]})}fromSchema(e){Ce(e,[Mu,ju,qu]);let t=be(e,e,Mp.schema({names:{seconds:Mu,millis:ju,micros:qu}}));if(ye.assertSchema(t,this.className),"seconds"in t.result&&(this.seconds=t.result.seconds.valueBlock.valueDec),"millis"in t.result){let n=new he({valueHex:t.result.millis.valueBlock.valueHex});this.millis=n.valueBlock.valueDec}if("micros"in t.result){let n=new he({valueHex:t.result.micros.valueBlock.valueHex});this.micros=n.valueBlock.valueDec}}toSchema(){let e=[];if(this.seconds!==void 0&&e.push(new he({value:this.seconds})),this.millis!==void 0){let t=new he({value:this.millis});e.push(new tt({idBlock:{tagClass:3,tagNumber:0},valueHex:t.valueBlock.valueHexView}))}if(this.micros!==void 0){let t=new he({value:this.micros});e.push(new tt({idBlock:{tagClass:3,tagNumber:1},valueHex:t.valueBlock.valueHexView}))}return new K({value:e})}toJSON(){let e={};return this.seconds!==void 0&&(e.seconds=this.seconds),this.millis!==void 0&&(e.millis=this.millis),this.micros!==void 0&&(e.micros=this.micros),e}};Pl.CLASS_NAME="Accuracy";var pb="algorithmId",uy="algorithmParams",I7="algorithm",mR="params",Oce=[I7,mR],pe=class Ny extends Se{static{o(this,"AlgorithmIdentifier")}constructor(e={}){super(),this.algorithmId=B(e,pb,Ny.defaultValues(pb)),uy in e&&(this.algorithmParams=B(e,uy,Ny.defaultValues(uy))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case pb:return P;case uy:return new it;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case pb:return t===P;case uy:return t instanceof it;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,optional:t.optional||!1,value:[new He({name:t.algorithmIdentifier||P}),new it({name:t.algorithmParams||P,optional:!0})]})}fromSchema(e){Ce(e,Oce);let t=be(e,e,Ny.schema({names:{algorithmIdentifier:I7,algorithmParams:mR}}));ye.assertSchema(t,this.className),this.algorithmId=t.result.algorithm.valueBlock.toString(),mR in t.result&&(this.algorithmParams=t.result.params)}toSchema(){let e=[];return e.push(new He({value:this.algorithmId})),this.algorithmParams&&!(this.algorithmParams instanceof it)&&e.push(this.algorithmParams),new K({value:e})}toJSON(){let e={algorithmId:this.algorithmId};return this.algorithmParams&&!(this.algorithmParams instanceof it)&&(e.algorithmParams=this.algorithmParams.toJSON()),e}isEqual(e){return!(e instanceof Ny)||this.algorithmId!==e.algorithmId?!1:this.algorithmParams?e.algorithmParams?JSON.stringify(this.algorithmParams)===JSON.stringify(e.algorithmParams):!1:!e.algorithmParams}};pe.CLASS_NAME="AlgorithmIdentifier";var jp="altNames",Pce=[jp],gR=class yR extends Se{static{o(this,"AltName")}constructor(e={}){super(),this.altNames=B(e,jp,yR.defaultValues(jp)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case jp:return[];default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new lt({name:t.altNames||P,value:pr.schema()})]})}fromSchema(e){Ce(e,Pce);let t=be(e,e,yR.schema({names:{altNames:jp}}));ye.assertSchema(t,this.className),jp in t.result&&(this.altNames=Array.from(t.result.altNames,n=>new pr({schema:n})))}toSchema(){return new K({value:Array.from(this.altNames,e=>e.toSchema())})}toJSON(){return{altNames:Array.from(this.altNames,e=>e.toJSON())}}};gR.CLASS_NAME="AltName";var qp="type",Hp="values",kce=[qp,Hp],$r=class Mb extends Se{static{o(this,"Attribute")}constructor(e={}){super(),this.type=B(e,qp,Mb.defaultValues(qp)),this.values=B(e,Hp,Mb.defaultValues(Hp)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case qp:return P;case Hp:return[];default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case qp:return t===P;case Hp:return t.length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new He({name:t.type||P}),new kr({name:t.setName||P,value:[new lt({name:t.values||P,value:new it})]})]})}fromSchema(e){Ce(e,kce);let t=be(e,e,Mb.schema({names:{type:qp,values:Hp}}));ye.assertSchema(t,this.className),this.type=t.result.type.valueBlock.toString(),this.values=t.result.values}toSchema(){return new K({value:[new He({value:this.type}),new kr({value:this.values})]})}toJSON(){return{type:this.type,values:Array.from(this.values,e=>e.toJSON())}}};$r.CLASS_NAME="Attribute";var Ty="notBeforeTime",Iy="notAfterTime",Lce=[Ty,Iy],Jf=class jb extends Se{static{o(this,"AttCertValidityPeriod")}constructor(e={}){super(),this.notBeforeTime=B(e,Ty,jb.defaultValues(Ty)),this.notAfterTime=B(e,Iy,jb.defaultValues(Iy)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Ty:case Iy:return new Date(0,0,0);default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new br({name:t.notBeforeTime||P}),new br({name:t.notAfterTime||P})]})}fromSchema(e){Ce(e,Lce);let t=be(e,e,jb.schema({names:{notBeforeTime:Ty,notAfterTime:Iy}}));ye.assertSchema(t,this.className),this.notBeforeTime=t.result.notBeforeTime.toDate(),this.notAfterTime=t.result.notAfterTime.toDate()}toSchema(){return new K({value:[new br({valueDate:this.notBeforeTime}),new br({valueDate:this.notAfterTime})]})}toJSON(){return{notBeforeTime:this.notBeforeTime,notAfterTime:this.notAfterTime}}};Jf.CLASS_NAME="AttCertValidityPeriod";var cy="names",s7="generalNames",Pn=class vR extends Se{static{o(this,"GeneralNames")}constructor(e={}){super(),this.names=B(e,cy,vR.defaultValues(cy)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"names":return[];default:return super.defaultValues(e)}}static schema(e={},t=!1){let n=B(e,cy,{});return new K({optional:t,name:n.blockName||P,value:[new lt({name:n.generalNames||P,value:pr.schema()})]})}fromSchema(e){Ce(e,[cy,s7]);let t=be(e,e,vR.schema({names:{blockName:cy,generalNames:s7}}));ye.assertSchema(t,this.className),this.names=Array.from(t.result.generalNames,n=>new pr({schema:n}))}toSchema(){return new K({value:Array.from(this.names,e=>e.toSchema())})}toJSON(){return{names:Array.from(this.names,e=>e.toJSON())}}};Pn.CLASS_NAME="GeneralNames";var Fce="2.5.29.9",Uce="2.5.29.14",Vce="2.5.29.15",Mce="2.5.29.16",D7="2.5.29.17",B7="2.5.29.18",x_="2.5.29.19",jce="2.5.29.20",qce="2.5.29.27",Hce="2.5.29.21",Kce="2.5.29.24",R7="2.5.29.28",_7="2.5.29.29",O7="2.5.29.30",P7="2.5.29.31",E_="2.5.29.46",k7="2.5.29.32",li="2.5.29.32.0",$ce="1.3.6.1.4.1.311.21.10",L7="2.5.29.33",w_="2.5.29.35",F7="2.5.29.36",Xce="2.5.29.37",Gce="2.5.29.54",b_="1.3.6.1.5.5.7.1.1",zce="1.3.6.1.5.5.7.1.11",Wce="1.3.6.1.4.1.11129.2.4.2";var Jce="1.3.6.1.4.1.311.21.7",Yce="1.3.6.1.4.1.311.21.1",Qce="1.3.6.1.5.5.7.1.3",S_="1.2.840.113549.1.7.1",U7="1.2.840.113549.1.7.2",V7="1.2.840.113549.1.7.3",M7="1.2.840.113549.1.7.6",Zce="1.2.840.113549.1.9.16.1.4",i7="1.2.840.113549.1.9.22.1",ele="1.2.840.113549.1.9.22.2",a7="1.2.840.113549.1.9.22.3",o7="1.2.840.113549.1.9.23.1",tle="1.3.6.1.5.5.7",A_=`${tle}.48`,qb=`${A_}.1.1`,ABe=`${A_}.2`,CBe=`${A_}.1`;var kl="keyIdentifier",Ll="authorityCertIssuer",Fl="authorityCertSerialNumber",rle=[kl,Ll,Fl],C_=class Dy extends Se{static{o(this,"AuthorityKeyIdentifier")}constructor(e={}){super(),kl in e&&(this.keyIdentifier=B(e,kl,Dy.defaultValues(kl))),Ll in e&&(this.authorityCertIssuer=B(e,Ll,Dy.defaultValues(Ll))),Fl in e&&(this.authorityCertSerialNumber=B(e,Fl,Dy.defaultValues(Fl))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case kl:return new Be;case Ll:return[];case Fl:return new he;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new tt({name:t.keyIdentifier||P,optional:!0,idBlock:{tagClass:3,tagNumber:0}}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:1},value:[new lt({name:t.authorityCertIssuer||P,value:pr.schema()})]}),new tt({name:t.authorityCertSerialNumber||P,optional:!0,idBlock:{tagClass:3,tagNumber:2}})]})}fromSchema(e){Ce(e,rle);let t=be(e,e,Dy.schema({names:{keyIdentifier:kl,authorityCertIssuer:Ll,authorityCertSerialNumber:Fl}}));ye.assertSchema(t,this.className),kl in t.result&&(this.keyIdentifier=new Be({valueHex:t.result.keyIdentifier.valueBlock.valueHex})),Ll in t.result&&(this.authorityCertIssuer=Array.from(t.result.authorityCertIssuer,n=>new pr({schema:n}))),Fl in t.result&&(this.authorityCertSerialNumber=new he({valueHex:t.result.authorityCertSerialNumber.valueBlock.valueHex}))}toSchema(){let e=[];return this.keyIdentifier&&e.push(new tt({idBlock:{tagClass:3,tagNumber:0},valueHex:this.keyIdentifier.valueBlock.valueHexView})),this.authorityCertIssuer&&e.push(new ae({idBlock:{tagClass:3,tagNumber:1},value:Array.from(this.authorityCertIssuer,t=>t.toSchema())})),this.authorityCertSerialNumber&&e.push(new tt({idBlock:{tagClass:3,tagNumber:2},valueHex:this.authorityCertSerialNumber.valueBlock.valueHexView})),new K({value:e})}toJSON(){let e={};return this.keyIdentifier&&(e.keyIdentifier=this.keyIdentifier.toJSON()),this.authorityCertIssuer&&(e.authorityCertIssuer=Array.from(this.authorityCertIssuer,t=>t.toJSON())),this.authorityCertSerialNumber&&(e.authorityCertSerialNumber=this.authorityCertSerialNumber.toJSON()),e}};C_.CLASS_NAME="AuthorityKeyIdentifier";var Rl="pathLenConstraint",_l="cA",N_=class Hb extends Se{static{o(this,"BasicConstraints")}constructor(e={}){super(),this.cA=B(e,_l,!1),Rl in e&&(this.pathLenConstraint=B(e,Rl,0)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case _l:return!1;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new Oi({optional:!0,name:t.cA||P}),new he({optional:!0,name:t.pathLenConstraint||P})]})}fromSchema(e){Ce(e,[_l,Rl]);let t=be(e,e,Hb.schema({names:{cA:_l,pathLenConstraint:Rl}}));ye.assertSchema(t,this.className),_l in t.result&&(this.cA=t.result.cA.valueBlock.value),Rl in t.result&&(t.result.pathLenConstraint.valueBlock.isHexOnly?this.pathLenConstraint=t.result.pathLenConstraint:this.pathLenConstraint=t.result.pathLenConstraint.valueBlock.valueDec)}toSchema(){let e=[];return this.cA!==Hb.defaultValues(_l)&&e.push(new Oi({value:this.cA})),Rl in this&&(this.pathLenConstraint instanceof he?e.push(this.pathLenConstraint):e.push(new he({value:this.pathLenConstraint}))),new K({value:e})}toJSON(){let e={};return this.cA!==Hb.defaultValues(_l)&&(e.cA=this.cA),Rl in this&&(this.pathLenConstraint instanceof he?e.pathLenConstraint=this.pathLenConstraint.toJSON():e.pathLenConstraint=this.pathLenConstraint),e}};N_.CLASS_NAME="BasicConstraints";var UB="certificateIndex",VB="keyIndex",j7=class xR extends Se{static{o(this,"CAVersion")}constructor(e={}){super(),this.certificateIndex=B(e,UB,xR.defaultValues(UB)),this.keyIndex=B(e,VB,xR.defaultValues(VB)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case UB:case VB:return 0;default:return super.defaultValues(e)}}static schema(){return new he}fromSchema(e){if(e.constructor.blockName()!==he.blockName())throw new Error("Object's schema was not verified against input data for CAVersion");let t=e.valueBlock.valueHex.slice(0),n=new Uint8Array(t);switch(!0){case t.byteLength<4:{let h=new ArrayBuffer(4);new Uint8Array(h).set(n,4-t.byteLength),t=h.slice(0)}break;case t.byteLength>4:{let h=new ArrayBuffer(4);new Uint8Array(h).set(n.slice(0,4)),t=h.slice(0)}break}let s=t.slice(0,2),i=new Uint8Array(s),a=i[0];i[0]=i[1],i[1]=a;let u=new Uint16Array(s);this.keyIndex=u[0];let c=t.slice(2),l=new Uint8Array(c);a=l[0],l[0]=l[1],l[1]=a;let f=new Uint16Array(c);this.certificateIndex=f[0]}toSchema(){let e=new ArrayBuffer(2),t=new Uint16Array(e);t[0]=this.certificateIndex;let n=new Uint8Array(e),s=n[0];n[0]=n[1],n[1]=s;let i=new ArrayBuffer(2),a=new Uint16Array(i);a[0]=this.keyIndex;let u=new Uint8Array(i);return s=u[0],u[0]=u[1],u[1]=s,new he({valueHex:Al(i,e)})}toJSON(){return{certificateIndex:this.certificateIndex,keyIndex:this.keyIndex}}};j7.CLASS_NAME="CAVersion";var By="policyQualifierId",Ry="qualifier",nle=[By,Ry],ER=class Kb extends Se{static{o(this,"PolicyQualifierInfo")}constructor(e={}){super(),this.policyQualifierId=B(e,By,Kb.defaultValues(By)),this.qualifier=B(e,Ry,Kb.defaultValues(Ry)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case By:return P;case Ry:return new it;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new He({name:t.policyQualifierId||P}),new it({name:t.qualifier||P})]})}fromSchema(e){Ce(e,nle);let t=be(e,e,Kb.schema({names:{policyQualifierId:By,qualifier:Ry}}));ye.assertSchema(t,this.className),this.policyQualifierId=t.result.policyQualifierId.valueBlock.toString(),this.qualifier=t.result.qualifier}toSchema(){return new K({value:[new He({value:this.policyQualifierId}),this.qualifier]})}toJSON(){return{policyQualifierId:this.policyQualifierId,qualifier:this.qualifier.toJSON()}}};ER.CLASS_NAME="PolicyQualifierInfo";var _y="policyIdentifier",Ul="policyQualifiers",sle=[_y,Ul],wR=class $b extends Se{static{o(this,"PolicyInformation")}constructor(e={}){super(),this.policyIdentifier=B(e,_y,$b.defaultValues(_y)),Ul in e&&(this.policyQualifiers=B(e,Ul,$b.defaultValues(Ul))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case _y:return P;case Ul:return[];default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new He({name:t.policyIdentifier||P}),new K({optional:!0,value:[new lt({name:t.policyQualifiers||P,value:ER.schema()})]})]})}fromSchema(e){Ce(e,sle);let t=be(e,e,$b.schema({names:{policyIdentifier:_y,policyQualifiers:Ul}}));ye.assertSchema(t,this.className),this.policyIdentifier=t.result.policyIdentifier.valueBlock.toString(),Ul in t.result&&(this.policyQualifiers=Array.from(t.result.policyQualifiers,n=>new ER({schema:n})))}toSchema(){let e=[];return e.push(new He({value:this.policyIdentifier})),this.policyQualifiers&&e.push(new K({value:Array.from(this.policyQualifiers,t=>t.toSchema())})),new K({value:e})}toJSON(){let e={policyIdentifier:this.policyIdentifier};return this.policyQualifiers&&(e.policyQualifiers=Array.from(this.policyQualifiers,t=>t.toJSON())),e}};wR.CLASS_NAME="PolicyInformation";var Oy="certificatePolicies",ile=[Oy],bR=class SR extends Se{static{o(this,"CertificatePolicies")}constructor(e={}){super(),this.certificatePolicies=B(e,Oy,SR.defaultValues(Oy)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Oy:return[];default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new lt({name:t.certificatePolicies||P,value:wR.schema()})]})}fromSchema(e){Ce(e,ile);let t=be(e,e,SR.schema({names:{certificatePolicies:Oy}}));ye.assertSchema(t,this.className),this.certificatePolicies=Array.from(t.result.certificatePolicies,n=>new wR({schema:n}))}toSchema(){return new K({value:Array.from(this.certificatePolicies,e=>e.toSchema())})}toJSON(){return{certificatePolicies:Array.from(this.certificatePolicies,e=>e.toJSON())}}};bR.CLASS_NAME="CertificatePolicies";var Py="templateID",lo="templateMajorVersion",fo="templateMinorVersion",ale=[Py,lo,fo],ole=class ky extends Se{static{o(this,"CertificateTemplate")}constructor(e={}){super(),this.templateID=B(e,Py,ky.defaultValues(Py)),lo in e&&(this.templateMajorVersion=B(e,lo,ky.defaultValues(lo))),fo in e&&(this.templateMinorVersion=B(e,fo,ky.defaultValues(fo))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Py:return P;case lo:case fo:return 0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new He({name:t.templateID||P}),new he({name:t.templateMajorVersion||P,optional:!0}),new he({name:t.templateMinorVersion||P,optional:!0})]})}fromSchema(e){Ce(e,ale);let t=be(e,e,ky.schema({names:{templateID:Py,templateMajorVersion:lo,templateMinorVersion:fo}}));ye.assertSchema(t,this.className),this.templateID=t.result.templateID.valueBlock.toString(),lo in t.result&&(this.templateMajorVersion=t.result.templateMajorVersion.valueBlock.valueDec),fo in t.result&&(this.templateMinorVersion=t.result.templateMinorVersion.valueBlock.valueDec)}toSchema(){let e=[];return e.push(new He({value:this.templateID})),lo in this&&e.push(new he({value:this.templateMajorVersion})),fo in this&&e.push(new he({value:this.templateMinorVersion})),new K({value:e})}toJSON(){let e={templateID:this.templateID};return lo in this&&(e.templateMajorVersion=this.templateMajorVersion),fo in this&&(e.templateMinorVersion=this.templateMinorVersion),e}},Vl="distributionPoint",q7="distributionPointNames",Ml="reasons",jl="cRLIssuer",H7="cRLIssuerNames",ule=[Vl,q7,Ml,jl,H7],AR=class Ly extends Se{static{o(this,"DistributionPoint")}constructor(e={}){super(),Vl in e&&(this.distributionPoint=B(e,Vl,Ly.defaultValues(Vl))),Ml in e&&(this.reasons=B(e,Ml,Ly.defaultValues(Ml))),jl in e&&(this.cRLIssuer=B(e,jl,Ly.defaultValues(jl))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Vl:return[];case Ml:return new Ct;case jl:return[];default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new Sr({value:[new ae({name:t.distributionPoint||P,optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new lt({name:t.distributionPointNames||P,value:pr.schema()})]}),new ae({name:t.distributionPoint||P,optional:!0,idBlock:{tagClass:3,tagNumber:1},value:Ar.schema().valueBlock.value})]})]}),new tt({name:t.reasons||P,optional:!0,idBlock:{tagClass:3,tagNumber:1}}),new ae({name:t.cRLIssuer||P,optional:!0,idBlock:{tagClass:3,tagNumber:2},value:[new lt({name:t.cRLIssuerNames||P,value:pr.schema()})]})]})}fromSchema(e){Ce(e,ule);let t=be(e,e,Ly.schema({names:{distributionPoint:Vl,distributionPointNames:q7,reasons:Ml,cRLIssuer:jl,cRLIssuerNames:H7}}));ye.assertSchema(t,this.className),Vl in t.result&&(t.result.distributionPoint.idBlock.tagNumber===0&&(this.distributionPoint=Array.from(t.result.distributionPointNames,n=>new pr({schema:n}))),t.result.distributionPoint.idBlock.tagNumber===1&&(this.distributionPoint=new Ar({schema:new K({value:t.result.distributionPoint.valueBlock.value})}))),Ml in t.result&&(this.reasons=new Ct({valueHex:t.result.reasons.valueBlock.valueHex})),jl in t.result&&(this.cRLIssuer=Array.from(t.result.cRLIssuerNames,n=>new pr({schema:n})))}toSchema(){let e=[];if(this.distributionPoint){let t;this.distributionPoint instanceof Array?t=new ae({idBlock:{tagClass:3,tagNumber:0},value:Array.from(this.distributionPoint,n=>n.toSchema())}):t=new ae({idBlock:{tagClass:3,tagNumber:1},value:[this.distributionPoint.toSchema()]}),e.push(new ae({idBlock:{tagClass:3,tagNumber:0},value:[t]}))}return this.reasons&&e.push(new tt({idBlock:{tagClass:3,tagNumber:1},valueHex:this.reasons.valueBlock.valueHexView})),this.cRLIssuer&&e.push(new ae({idBlock:{tagClass:3,tagNumber:2},value:Array.from(this.cRLIssuer,t=>t.toSchema())})),new K({value:e})}toJSON(){let e={};return this.distributionPoint&&(this.distributionPoint instanceof Array?e.distributionPoint=Array.from(this.distributionPoint,t=>t.toJSON()):e.distributionPoint=this.distributionPoint.toJSON()),this.reasons&&(e.reasons=this.reasons.toJSON()),this.cRLIssuer&&(e.cRLIssuer=Array.from(this.cRLIssuer,t=>t.toJSON())),e}};AR.CLASS_NAME="DistributionPoint";var Fy="distributionPoints",cle=[Fy],CR=class NR extends Se{static{o(this,"CRLDistributionPoints")}constructor(e={}){super(),this.distributionPoints=B(e,Fy,NR.defaultValues(Fy)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Fy:return[];default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new lt({name:t.distributionPoints||P,value:AR.schema()})]})}fromSchema(e){Ce(e,cle);let t=be(e,e,NR.schema({names:{distributionPoints:Fy}}));ye.assertSchema(t,this.className),this.distributionPoints=Array.from(t.result.distributionPoints,n=>new AR({schema:n}))}toSchema(){return new K({value:Array.from(this.distributionPoints,e=>e.toSchema())})}toJSON(){return{distributionPoints:Array.from(this.distributionPoints,e=>e.toJSON())}}};CR.CLASS_NAME="CRLDistributionPoints";var Uy="keyPurposes",lle=[Uy],K7=class TR extends Se{static{o(this,"ExtKeyUsage")}constructor(e={}){super(),this.keyPurposes=B(e,Uy,TR.defaultValues(Uy)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Uy:return[];default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new lt({name:t.keyPurposes||P,value:new He})]})}fromSchema(e){Ce(e,lle);let t=be(e,e,TR.schema({names:{keyPurposes:Uy}}));ye.assertSchema(t,this.className),this.keyPurposes=Array.from(t.result.keyPurposes,n=>n.valueBlock.toString())}toSchema(){return new K({value:Array.from(this.keyPurposes,e=>new He({value:e}))})}toJSON(){return{keyPurposes:Array.from(this.keyPurposes)}}};K7.CLASS_NAME="ExtKeyUsage";var ly="accessDescriptions",IR=class DR extends Se{static{o(this,"InfoAccess")}constructor(e={}){super(),this.accessDescriptions=B(e,ly,DR.defaultValues(ly)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case ly:return[];default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new lt({name:t.accessDescriptions||P,value:dR.schema()})]})}fromSchema(e){Ce(e,[ly]);let t=be(e,e,DR.schema({names:{accessDescriptions:ly}}));ye.assertSchema(t,this.className),this.accessDescriptions=Array.from(t.result.accessDescriptions,n=>new dR({schema:n}))}toSchema(){return new K({value:Array.from(this.accessDescriptions,e=>e.toSchema())})}toJSON(){return{accessDescriptions:Array.from(this.accessDescriptions,e=>e.toJSON())}}};IR.CLASS_NAME="InfoAccess";var ql="distributionPoint",$7="distributionPointNames",Hu="onlyContainsUserCerts",Ku="onlyContainsCACerts",$u="onlySomeReasons",Xu="indirectCRL",Gu="onlyContainsAttributeCerts",fle=[ql,$7,Hu,Ku,$u,Xu,Gu],X7=class $n extends Se{static{o(this,"IssuingDistributionPoint")}constructor(e={}){super(),ql in e&&(this.distributionPoint=B(e,ql,$n.defaultValues(ql))),this.onlyContainsUserCerts=B(e,Hu,$n.defaultValues(Hu)),this.onlyContainsCACerts=B(e,Ku,$n.defaultValues(Ku)),$u in e&&(this.onlySomeReasons=B(e,$u,$n.defaultValues($u))),this.indirectCRL=B(e,Xu,$n.defaultValues(Xu)),this.onlyContainsAttributeCerts=B(e,Gu,$n.defaultValues(Gu)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case ql:return[];case Hu:return!1;case Ku:return!1;case $u:return 0;case Xu:return!1;case Gu:return!1;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new Sr({value:[new ae({name:t.distributionPoint||P,idBlock:{tagClass:3,tagNumber:0},value:[new lt({name:t.distributionPointNames||P,value:pr.schema()})]}),new ae({name:t.distributionPoint||P,idBlock:{tagClass:3,tagNumber:1},value:Ar.schema().valueBlock.value})]})]}),new tt({name:t.onlyContainsUserCerts||P,optional:!0,idBlock:{tagClass:3,tagNumber:1}}),new tt({name:t.onlyContainsCACerts||P,optional:!0,idBlock:{tagClass:3,tagNumber:2}}),new tt({name:t.onlySomeReasons||P,optional:!0,idBlock:{tagClass:3,tagNumber:3}}),new tt({name:t.indirectCRL||P,optional:!0,idBlock:{tagClass:3,tagNumber:4}}),new tt({name:t.onlyContainsAttributeCerts||P,optional:!0,idBlock:{tagClass:3,tagNumber:5}})]})}fromSchema(e){Ce(e,fle);let t=be(e,e,$n.schema({names:{distributionPoint:ql,distributionPointNames:$7,onlyContainsUserCerts:Hu,onlyContainsCACerts:Ku,onlySomeReasons:$u,indirectCRL:Xu,onlyContainsAttributeCerts:Gu}}));if(ye.assertSchema(t,this.className),ql in t.result)switch(!0){case t.result.distributionPoint.idBlock.tagNumber===0:this.distributionPoint=Array.from(t.result.distributionPointNames,n=>new pr({schema:n}));break;case t.result.distributionPoint.idBlock.tagNumber===1:this.distributionPoint=new Ar({schema:new K({value:t.result.distributionPoint.valueBlock.value})});break;default:throw new Error("Unknown tagNumber for distributionPoint: {$asn1.result.distributionPoint.idBlock.tagNumber}")}if(Hu in t.result){let n=new Uint8Array(t.result.onlyContainsUserCerts.valueBlock.valueHex);this.onlyContainsUserCerts=n[0]!==0}if(Ku in t.result){let n=new Uint8Array(t.result.onlyContainsCACerts.valueBlock.valueHex);this.onlyContainsCACerts=n[0]!==0}if($u in t.result){let n=new Uint8Array(t.result.onlySomeReasons.valueBlock.valueHex);this.onlySomeReasons=n[0]}if(Xu in t.result){let n=new Uint8Array(t.result.indirectCRL.valueBlock.valueHex);this.indirectCRL=n[0]!==0}if(Gu in t.result){let n=new Uint8Array(t.result.onlyContainsAttributeCerts.valueBlock.valueHex);this.onlyContainsAttributeCerts=n[0]!==0}}toSchema(){let e=[];if(this.distributionPoint){let t;this.distributionPoint instanceof Array?t=new ae({idBlock:{tagClass:3,tagNumber:0},value:Array.from(this.distributionPoint,n=>n.toSchema())}):(t=this.distributionPoint.toSchema(),t.idBlock.tagClass=3,t.idBlock.tagNumber=1),e.push(new ae({idBlock:{tagClass:3,tagNumber:0},value:[t]}))}if(this.onlyContainsUserCerts!==$n.defaultValues(Hu)&&e.push(new tt({idBlock:{tagClass:3,tagNumber:1},valueHex:new Uint8Array([255]).buffer})),this.onlyContainsCACerts!==$n.defaultValues(Ku)&&e.push(new tt({idBlock:{tagClass:3,tagNumber:2},valueHex:new Uint8Array([255]).buffer})),this.onlySomeReasons!==void 0){let t=new ArrayBuffer(1),n=new Uint8Array(t);n[0]=this.onlySomeReasons,e.push(new tt({idBlock:{tagClass:3,tagNumber:3},valueHex:t}))}return this.indirectCRL!==$n.defaultValues(Xu)&&e.push(new tt({idBlock:{tagClass:3,tagNumber:4},valueHex:new Uint8Array([255]).buffer})),this.onlyContainsAttributeCerts!==$n.defaultValues(Gu)&&e.push(new tt({idBlock:{tagClass:3,tagNumber:5},valueHex:new Uint8Array([255]).buffer})),new K({value:e})}toJSON(){let e={};return this.distributionPoint&&(this.distributionPoint instanceof Array?e.distributionPoint=Array.from(this.distributionPoint,t=>t.toJSON()):e.distributionPoint=this.distributionPoint.toJSON()),this.onlyContainsUserCerts!==$n.defaultValues(Hu)&&(e.onlyContainsUserCerts=this.onlyContainsUserCerts),this.onlyContainsCACerts!==$n.defaultValues(Ku)&&(e.onlyContainsCACerts=this.onlyContainsCACerts),$u in this&&(e.onlySomeReasons=this.onlySomeReasons),this.indirectCRL!==$n.defaultValues(Xu)&&(e.indirectCRL=this.indirectCRL),this.onlyContainsAttributeCerts!==$n.defaultValues(Gu)&&(e.onlyContainsAttributeCerts=this.onlyContainsAttributeCerts),e}};X7.CLASS_NAME="IssuingDistributionPoint";var Vy="base",Kp="minimum",zu="maximum",hle=[Vy,Kp,zu],My=class jy extends Se{static{o(this,"GeneralSubtree")}constructor(e={}){super(),this.base=B(e,Vy,jy.defaultValues(Vy)),this.minimum=B(e,Kp,jy.defaultValues(Kp)),zu in e&&(this.maximum=B(e,zu,jy.defaultValues(zu))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Vy:return new pr;case Kp:return 0;case zu:return 0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[pr.schema(t.base||{}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new he({name:t.minimum||P})]}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:1},value:[new he({name:t.maximum||P})]})]})}fromSchema(e){Ce(e,hle);let t=be(e,e,jy.schema({names:{base:{names:{blockName:Vy}},minimum:Kp,maximum:zu}}));ye.assertSchema(t,this.className),this.base=new pr({schema:t.result.base}),Kp in t.result&&(t.result.minimum.valueBlock.isHexOnly?this.minimum=t.result.minimum:this.minimum=t.result.minimum.valueBlock.valueDec),zu in t.result&&(t.result.maximum.valueBlock.isHexOnly?this.maximum=t.result.maximum:this.maximum=t.result.maximum.valueBlock.valueDec)}toSchema(){let e=[];if(e.push(this.base.toSchema()),this.minimum!==0){let t=0;this.minimum instanceof he?t=this.minimum:t=new he({value:this.minimum}),e.push(new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[t]}))}if(zu in this){let t=0;this.maximum instanceof he?t=this.maximum:t=new he({value:this.maximum}),e.push(new ae({optional:!0,idBlock:{tagClass:3,tagNumber:1},value:[t]}))}return new K({value:e})}toJSON(){let e={base:this.base.toJSON()};return this.minimum!==0&&(typeof this.minimum=="number"?e.minimum=this.minimum:e.minimum=this.minimum.toJSON()),this.maximum!==void 0&&(typeof this.maximum=="number"?e.maximum=this.maximum:e.maximum=this.maximum.toJSON()),e}};My.CLASS_NAME="GeneralSubtree";var Hl="permittedSubtrees",Kl="excludedSubtrees",ple=[Hl,Kl],G7=class Xb extends Se{static{o(this,"NameConstraints")}constructor(e={}){super(),Hl in e&&(this.permittedSubtrees=B(e,Hl,Xb.defaultValues(Hl))),Kl in e&&(this.excludedSubtrees=B(e,Kl,Xb.defaultValues(Kl))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Hl:case Kl:return[];default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new lt({name:t.permittedSubtrees||P,value:My.schema()})]}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:1},value:[new lt({name:t.excludedSubtrees||P,value:My.schema()})]})]})}fromSchema(e){Ce(e,ple);let t=be(e,e,Xb.schema({names:{permittedSubtrees:Hl,excludedSubtrees:Kl}}));ye.assertSchema(t,this.className),Hl in t.result&&(this.permittedSubtrees=Array.from(t.result.permittedSubtrees,n=>new My({schema:n}))),Kl in t.result&&(this.excludedSubtrees=Array.from(t.result.excludedSubtrees,n=>new My({schema:n})))}toSchema(){let e=[];return this.permittedSubtrees&&e.push(new ae({idBlock:{tagClass:3,tagNumber:0},value:Array.from(this.permittedSubtrees,t=>t.toSchema())})),this.excludedSubtrees&&e.push(new ae({idBlock:{tagClass:3,tagNumber:1},value:Array.from(this.excludedSubtrees,t=>t.toSchema())})),new K({value:e})}toJSON(){let e={};return this.permittedSubtrees&&(e.permittedSubtrees=Array.from(this.permittedSubtrees,t=>t.toJSON())),this.excludedSubtrees&&(e.excludedSubtrees=Array.from(this.excludedSubtrees,t=>t.toJSON())),e}};G7.CLASS_NAME="NameConstraints";var ho="requireExplicitPolicy",po="inhibitPolicyMapping",dle=[ho,po],z7=class Gb extends Se{static{o(this,"PolicyConstraints")}constructor(e={}){super(),ho in e&&(this.requireExplicitPolicy=B(e,ho,Gb.defaultValues(ho))),po in e&&(this.inhibitPolicyMapping=B(e,po,Gb.defaultValues(po))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case ho:return 0;case po:return 0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new tt({name:t.requireExplicitPolicy||P,optional:!0,idBlock:{tagClass:3,tagNumber:0}}),new tt({name:t.inhibitPolicyMapping||P,optional:!0,idBlock:{tagClass:3,tagNumber:1}})]})}fromSchema(e){Ce(e,dle);let t=be(e,e,Gb.schema({names:{requireExplicitPolicy:ho,inhibitPolicyMapping:po}}));if(ye.assertSchema(t,this.className),ho in t.result){let n=t.result.requireExplicitPolicy;n.idBlock.tagClass=1,n.idBlock.tagNumber=2;let s=n.toBER(!1),i=Or(s);ye.assert(i,"Integer"),this.requireExplicitPolicy=i.result.valueBlock.valueDec}if(po in t.result){let n=t.result.inhibitPolicyMapping;n.idBlock.tagClass=1,n.idBlock.tagNumber=2;let s=n.toBER(!1),i=Or(s);ye.assert(i,"Integer"),this.inhibitPolicyMapping=i.result.valueBlock.valueDec}}toSchema(){let e=[];if(ho in this){let t=new he({value:this.requireExplicitPolicy});t.idBlock.tagClass=3,t.idBlock.tagNumber=0,e.push(t)}if(po in this){let t=new he({value:this.inhibitPolicyMapping});t.idBlock.tagClass=3,t.idBlock.tagNumber=1,e.push(t)}return new K({value:e})}toJSON(){let e={};return ho in this&&(e.requireExplicitPolicy=this.requireExplicitPolicy),po in this&&(e.inhibitPolicyMapping=this.inhibitPolicyMapping),e}};z7.CLASS_NAME="PolicyConstraints";var qy="issuerDomainPolicy",Hy="subjectDomainPolicy",mle=[qy,Hy],BR=class zb extends Se{static{o(this,"PolicyMapping")}constructor(e={}){super(),this.issuerDomainPolicy=B(e,qy,zb.defaultValues(qy)),this.subjectDomainPolicy=B(e,Hy,zb.defaultValues(Hy)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case qy:return P;case Hy:return P;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new He({name:t.issuerDomainPolicy||P}),new He({name:t.subjectDomainPolicy||P})]})}fromSchema(e){Ce(e,mle);let t=be(e,e,zb.schema({names:{issuerDomainPolicy:qy,subjectDomainPolicy:Hy}}));ye.assertSchema(t,this.className),this.issuerDomainPolicy=t.result.issuerDomainPolicy.valueBlock.toString(),this.subjectDomainPolicy=t.result.subjectDomainPolicy.valueBlock.toString()}toSchema(){return new K({value:[new He({value:this.issuerDomainPolicy}),new He({value:this.subjectDomainPolicy})]})}toJSON(){return{issuerDomainPolicy:this.issuerDomainPolicy,subjectDomainPolicy:this.subjectDomainPolicy}}};BR.CLASS_NAME="PolicyMapping";var Ky="mappings",gle=[Ky],W7=class RR extends Se{static{o(this,"PolicyMappings")}constructor(e={}){super(),this.mappings=B(e,Ky,RR.defaultValues(Ky)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Ky:return[];default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new lt({name:t.mappings||P,value:BR.schema()})]})}fromSchema(e){Ce(e,gle);let t=be(e,e,RR.schema({names:{mappings:Ky}}));ye.assertSchema(t,this.className),this.mappings=Array.from(t.result.mappings,n=>new BR({schema:n}))}toSchema(){return new K({value:Array.from(this.mappings,e=>e.toSchema())})}toJSON(){return{mappings:Array.from(this.mappings,e=>e.toJSON())}}};W7.CLASS_NAME="PolicyMappings";var Wu="notBefore",Ju="notAfter",yle=[Wu,Ju],J7=class Wb extends Se{static{o(this,"PrivateKeyUsagePeriod")}constructor(e={}){super(),Wu in e&&(this.notBefore=B(e,Wu,Wb.defaultValues(Wu))),Ju in e&&(this.notAfter=B(e,Ju,Wb.defaultValues(Ju))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Wu:return new Date;case Ju:return new Date;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new tt({name:t.notBefore||P,optional:!0,idBlock:{tagClass:3,tagNumber:0}}),new tt({name:t.notAfter||P,optional:!0,idBlock:{tagClass:3,tagNumber:1}})]})}fromSchema(e){Ce(e,yle);let t=be(e,e,Wb.schema({names:{notBefore:Wu,notAfter:Ju}}));if(ye.assertSchema(t,this.className),Wu in t.result){let n=new br;n.fromBuffer(t.result.notBefore.valueBlock.valueHex),this.notBefore=n.toDate()}if(Ju in t.result){let n=new br({valueHex:t.result.notAfter.valueBlock.valueHex});n.fromBuffer(t.result.notAfter.valueBlock.valueHex),this.notAfter=n.toDate()}}toSchema(){let e=[];return Wu in this&&e.push(new tt({idBlock:{tagClass:3,tagNumber:0},valueHex:new br({valueDate:this.notBefore}).valueBlock.valueHexView})),Ju in this&&e.push(new tt({idBlock:{tagClass:3,tagNumber:1},valueHex:new br({valueDate:this.notAfter}).valueBlock.valueHexView})),new K({value:e})}toJSON(){let e={};return this.notBefore&&(e.notBefore=this.notBefore),this.notAfter&&(e.notAfter=this.notAfter),e}};J7.CLASS_NAME="PrivateKeyUsagePeriod";var $p="id",mo="type",Xp="values",vle=[$p,mo],xle=[Xp],_R=class Jb extends Se{static{o(this,"QCStatement")}constructor(e={}){super(),this.id=B(e,$p,Jb.defaultValues($p)),mo in e&&(this.type=B(e,mo,Jb.defaultValues(mo))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case $p:return P;case mo:return new Pr;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case $p:return t===P;case mo:return t instanceof Pr;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new He({name:t.id||P}),new it({name:t.type||P,optional:!0})]})}fromSchema(e){Ce(e,vle);let t=be(e,e,Jb.schema({names:{id:$p,type:mo}}));ye.assertSchema(t,this.className),this.id=t.result.id.valueBlock.toString(),mo in t.result&&(this.type=t.result.type)}toSchema(){let e=[new He({value:this.id})];return mo in this&&e.push(this.type),new K({value:e})}toJSON(){let e={id:this.id};return this.type&&(e.type=this.type.toJSON()),e}};_R.CLASS_NAME="QCStatement";var Y7=class OR extends Se{static{o(this,"QCStatements")}constructor(e={}){super(),this.values=B(e,Xp,OR.defaultValues(Xp)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Xp:return[];default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Xp:return t.length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new lt({name:t.values||P,value:_R.schema(t.value||{})})]})}fromSchema(e){Ce(e,xle);let t=be(e,e,OR.schema({names:{values:Xp}}));ye.assertSchema(t,this.className),this.values=Array.from(t.result.values,n=>new _R({schema:n}))}toSchema(){return new K({value:Array.from(this.values,e=>e.toSchema())})}toJSON(){return{values:Array.from(this.values,e=>e.toJSON())}}};Y7.CLASS_NAME="QCStatements";var $l,Oc=class{static{o(this,"ECNamedCurves")}static register(e,t,n){this.namedCurves[e.toLowerCase()]=this.namedCurves[t]={name:e,id:t,size:n}}static find(e){return this.namedCurves[e.toLowerCase()]||null}};$l=Oc;Oc.namedCurves={};$l.register("P-256","1.2.840.10045.3.1.7",32),$l.register("P-384","1.3.132.0.34",48),$l.register("P-521","1.3.132.0.35",66),$l.register("brainpoolP256r1","1.3.36.3.3.2.8.1.1.7",32),$l.register("brainpoolP384r1","1.3.36.3.3.2.8.1.1.11",48),$l.register("brainpoolP512r1","1.3.36.3.3.2.8.1.1.13",64);var db="x",mb="y",gb="namedCurve",Do=class Gp extends Se{static{o(this,"ECPublicKey")}constructor(e={}){super(),this.x=B(e,db,Gp.defaultValues(db)),this.y=B(e,mb,Gp.defaultValues(mb)),this.namedCurve=B(e,gb,Gp.defaultValues(gb)),e.json&&this.fromJSON(e.json),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case db:case mb:return Kr;case gb:return P;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case db:case mb:return t instanceof ArrayBuffer&&Bu(t,Gp.defaultValues(e));case gb:return typeof t=="string"&&t===Gp.defaultValues(e);default:return super.defaultValues(e)}}static schema(){return new iy}fromSchema(e){let t=Ze.toUint8Array(e);if(t[0]!==4)throw new Error("Object's schema was not verified against input data for ECPublicKey");let n=Oc.find(this.namedCurve);if(!n)throw new Error(`Incorrect curve OID: ${this.namedCurve}`);let s=n.size;if(t.byteLength!==s*2+1)throw new Error("Object's schema was not verified against input data for ECPublicKey");this.namedCurve=n.name,this.x=t.slice(1,s+1).buffer,this.y=t.slice(1+s,s*2+1).buffer}toSchema(){return new iy({data:Al(new Uint8Array([4]).buffer,this.x,this.y)})}toJSON(){let e=Oc.find(this.namedCurve);return{crv:e?e.name:this.namedCurve,x:Qw(Qg(this.x),!0,!0,!1),y:Qw(Qg(this.y),!0,!0,!1)}}fromJSON(e){Jt.assert("json",e,"crv","x","y");let t=0,n=Oc.find(e.crv);n&&(this.namedCurve=n.id,t=n.size);let s=Cl(Ip(e.x,!0));if(s.byteLength<t){this.x=new ArrayBuffer(t);let a=new Uint8Array(this.x),u=new Uint8Array(s);a.set(u,1)}else this.x=s.slice(0,t);let i=Cl(Ip(e.y,!0));if(i.byteLength<t){this.y=new ArrayBuffer(t);let a=new Uint8Array(this.y),u=new Uint8Array(i);a.set(u,1)}else this.y=i.slice(0,t)}};Do.CLASS_NAME="ECPublicKey";var $y="modulus",Xy="publicExponent",Ele=[$y,Xy],PR=class Yb extends Se{static{o(this,"RSAPublicKey")}constructor(e={}){super(),this.modulus=B(e,$y,Yb.defaultValues($y)),this.publicExponent=B(e,Xy,Yb.defaultValues(Xy)),e.json&&this.fromJSON(e.json),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case $y:return new he;case Xy:return new he;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new he({name:t.modulus||P}),new he({name:t.publicExponent||P})]})}fromSchema(e){Ce(e,Ele);let t=be(e,e,Yb.schema({names:{modulus:$y,publicExponent:Xy}}));ye.assertSchema(t,this.className),this.modulus=t.result.modulus.convertFromDER(256),this.publicExponent=t.result.publicExponent}toSchema(){return new K({value:[this.modulus.convertToDER(),this.publicExponent]})}toJSON(){return{n:ut.ToBase64Url(this.modulus.valueBlock.valueHexView),e:ut.ToBase64Url(this.publicExponent.valueBlock.valueHexView)}}fromJSON(e){Jt.assert("json",e,"n","e");let t=Cl(Ip(e.n,!0));this.modulus=new he({valueHex:t.slice(0,Math.pow(2,X9(t.byteLength)))}),this.publicExponent=new he({valueHex:Cl(Ip(e.e,!0)).slice(0,3)})}};PR.CLASS_NAME="RSAPublicKey";var Gy="algorithm",zy="subjectPublicKey",wle=[Gy,zy],qi=class Qb extends Se{static{o(this,"PublicKeyInfo")}get parsedKey(){if(this._parsedKey===void 0){switch(this.algorithm.algorithmId){case"1.2.840.10045.2.1":if("algorithmParams"in this.algorithm&&this.algorithm.algorithmParams.constructor.blockName()===He.blockName())try{this._parsedKey=new Do({namedCurve:this.algorithm.algorithmParams.valueBlock.toString(),schema:this.subjectPublicKey.valueBlock.valueHexView})}catch{}break;case"1.2.840.113549.1.1.1":case"1.2.840.113549.1.1.10":{let e=Or(this.subjectPublicKey.valueBlock.valueHexView);if(e.offset!==-1)try{this._parsedKey=new PR({schema:e.result})}catch{}}break}this._parsedKey||(this._parsedKey=null)}return this._parsedKey||void 0}set parsedKey(e){this._parsedKey=e}constructor(e={}){super(),this.algorithm=B(e,Gy,Qb.defaultValues(Gy)),this.subjectPublicKey=B(e,zy,Qb.defaultValues(zy));let t=B(e,"parsedKey",null);t&&(this.parsedKey=t),e.json&&this.fromJSON(e.json),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Gy:return new pe;case zy:return new Ct;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[pe.schema(t.algorithm||{}),new Ct({name:t.subjectPublicKey||P})]})}fromSchema(e){Ce(e,wle);let t=be(e,e,Qb.schema({names:{algorithm:{names:{blockName:Gy}},subjectPublicKey:zy}}));ye.assertSchema(t,this.className),this.algorithm=new pe({schema:t.result.algorithm}),this.subjectPublicKey=t.result.subjectPublicKey}toSchema(){return new K({value:[this.algorithm.toSchema(),this.subjectPublicKey]})}toJSON(){if(!this.parsedKey)return{algorithm:this.algorithm.toJSON(),subjectPublicKey:this.subjectPublicKey.toJSON()};let e={};switch(this.algorithm.algorithmId){case"1.2.840.10045.2.1":e.kty="EC";break;case"1.2.840.113549.1.1.1":case"1.2.840.113549.1.1.10":e.kty="RSA";break}let t=this.parsedKey.toJSON();return Object.assign(e,t),e}fromJSON(e){if("kty"in e){switch(e.kty.toUpperCase()){case"EC":this.parsedKey=new Do({json:e}),this.algorithm=new pe({algorithmId:"1.2.840.10045.2.1",algorithmParams:new He({value:this.parsedKey.namedCurve})});break;case"RSA":this.parsedKey=new PR({json:e}),this.algorithm=new pe({algorithmId:"1.2.840.113549.1.1.1",algorithmParams:new Pr});break;default:throw new Error(`Invalid value for "kty" parameter: ${e.kty}`)}this.subjectPublicKey=new Ct({valueHex:this.parsedKey.toSchema().toBER(!1)})}}async importKey(e,t=mt(!0)){try{if(!e)throw new Error("Need to provide publicKey input parameter");let n=await t.exportKey("spki",e),s=Or(n);try{this.fromSchema(s.result)}catch{throw new Error("Error during initializing object from schema")}}catch(n){let s=n instanceof Error?n.message:`${n}`;throw new Error(`Error during exporting public key: ${s}`)}}};qi.CLASS_NAME="PublicKeyInfo";var zp="version",Wp="privateKey",ki="namedCurve",Yu="publicKey",ble=[zp,Wp,ki,Yu],kR=class go extends Se{static{o(this,"ECPrivateKey")}constructor(e={}){super(),this.version=B(e,zp,go.defaultValues(zp)),this.privateKey=B(e,Wp,go.defaultValues(Wp)),ki in e&&(this.namedCurve=B(e,ki,go.defaultValues(ki))),Yu in e&&(this.publicKey=B(e,Yu,go.defaultValues(Yu))),e.json&&this.fromJSON(e.json),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case zp:return 1;case Wp:return new Be;case ki:return P;case Yu:return new Do;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case zp:return t===go.defaultValues(e);case Wp:return t.isEqual(go.defaultValues(e));case ki:return t===P;case Yu:return Do.compareWithDefault(ki,t.namedCurve)&&Do.compareWithDefault("x",t.x)&&Do.compareWithDefault("y",t.y);default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new he({name:t.version||P}),new Be({name:t.privateKey||P}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new He({name:t.namedCurve||P})]}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:1},value:[new Ct({name:t.publicKey||P})]})]})}fromSchema(e){Ce(e,ble);let t=be(e,e,go.schema({names:{version:zp,privateKey:Wp,namedCurve:ki,publicKey:Yu}}));if(ye.assertSchema(t,this.className),this.version=t.result.version.valueBlock.valueDec,this.privateKey=t.result.privateKey,ki in t.result&&(this.namedCurve=t.result.namedCurve.valueBlock.toString()),Yu in t.result){let n={schema:t.result.publicKey.valueBlock.valueHex};ki in this&&(n.namedCurve=this.namedCurve),this.publicKey=new Do(n)}}toSchema(){let e=[new he({value:this.version}),this.privateKey];return this.namedCurve&&e.push(new ae({idBlock:{tagClass:3,tagNumber:0},value:[new He({value:this.namedCurve})]})),this.publicKey&&e.push(new ae({idBlock:{tagClass:3,tagNumber:1},value:[new Ct({valueHex:this.publicKey.toSchema().toBER(!1)})]})),new K({value:e})}toJSON(){if(!this.namedCurve||go.compareWithDefault(ki,this.namedCurve))throw new Error('Not enough information for making JSON: absent "namedCurve" value');let e=Oc.find(this.namedCurve),t={crv:e?e.name:this.namedCurve,d:ut.ToBase64Url(this.privateKey.valueBlock.valueHexView)};if(this.publicKey){let n=this.publicKey.toJSON();t.x=n.x,t.y=n.y}return t}fromJSON(e){Jt.assert("json",e,"crv","d");let t=0,n=Oc.find(e.crv);n&&(this.namedCurve=n.id,t=n.size);let s=ut.FromBase64Url(e.d);if(s.byteLength<t){let i=new ArrayBuffer(t),a=new Uint8Array(i),u=new Uint8Array(s);a.set(u,1),this.privateKey=new Be({valueHex:i})}else this.privateKey=new Be({valueHex:s.slice(0,t)});e.x&&e.y&&(this.publicKey=new Do({json:e}))}};kR.CLASS_NAME="ECPrivateKey";var Wy="prime",Jy="exponent",Yy="coefficient",Sle=[Wy,Jy,Yy],Zb=class Qy extends Se{static{o(this,"OtherPrimeInfo")}constructor(e={}){super(),this.prime=B(e,Wy,Qy.defaultValues(Wy)),this.exponent=B(e,Jy,Qy.defaultValues(Jy)),this.coefficient=B(e,Yy,Qy.defaultValues(Yy)),e.json&&this.fromJSON(e.json),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Wy:return new he;case Jy:return new he;case Yy:return new he;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new he({name:t.prime||P}),new he({name:t.exponent||P}),new he({name:t.coefficient||P})]})}fromSchema(e){Ce(e,Sle);let t=be(e,e,Qy.schema({names:{prime:Wy,exponent:Jy,coefficient:Yy}}));ye.assertSchema(t,this.className),this.prime=t.result.prime.convertFromDER(),this.exponent=t.result.exponent.convertFromDER(),this.coefficient=t.result.coefficient.convertFromDER()}toSchema(){return new K({value:[this.prime.convertToDER(),this.exponent.convertToDER(),this.coefficient.convertToDER()]})}toJSON(){return{r:ut.ToBase64Url(this.prime.valueBlock.valueHexView),d:ut.ToBase64Url(this.exponent.valueBlock.valueHexView),t:ut.ToBase64Url(this.coefficient.valueBlock.valueHexView)}}fromJSON(e){Jt.assert("json",e,"r","d","r"),this.prime=new he({valueHex:ut.FromBase64Url(e.r)}),this.exponent=new he({valueHex:ut.FromBase64Url(e.d)}),this.coefficient=new he({valueHex:ut.FromBase64Url(e.t)})}};Zb.CLASS_NAME="OtherPrimeInfo";var Zy="version",e1="modulus",t1="publicExponent",r1="privateExponent",n1="prime1",s1="prime2",i1="exponent1",a1="exponent2",o1="coefficient",Xl="otherPrimeInfos",Ale=[Zy,e1,t1,r1,n1,s1,i1,a1,o1,Xl],LR=class fi extends Se{static{o(this,"RSAPrivateKey")}constructor(e={}){super(),this.version=B(e,Zy,fi.defaultValues(Zy)),this.modulus=B(e,e1,fi.defaultValues(e1)),this.publicExponent=B(e,t1,fi.defaultValues(t1)),this.privateExponent=B(e,r1,fi.defaultValues(r1)),this.prime1=B(e,n1,fi.defaultValues(n1)),this.prime2=B(e,s1,fi.defaultValues(s1)),this.exponent1=B(e,i1,fi.defaultValues(i1)),this.exponent2=B(e,a1,fi.defaultValues(a1)),this.coefficient=B(e,o1,fi.defaultValues(o1)),Xl in e&&(this.otherPrimeInfos=B(e,Xl,fi.defaultValues(Xl))),e.json&&this.fromJSON(e.json),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Zy:return 0;case e1:return new he;case t1:return new he;case r1:return new he;case n1:return new he;case s1:return new he;case i1:return new he;case a1:return new he;case o1:return new he;case Xl:return[];default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new he({name:t.version||P}),new he({name:t.modulus||P}),new he({name:t.publicExponent||P}),new he({name:t.privateExponent||P}),new he({name:t.prime1||P}),new he({name:t.prime2||P}),new he({name:t.exponent1||P}),new he({name:t.exponent2||P}),new he({name:t.coefficient||P}),new K({optional:!0,value:[new lt({name:t.otherPrimeInfosName||P,value:Zb.schema(t.otherPrimeInfo||{})})]})]})}fromSchema(e){Ce(e,Ale);let t=be(e,e,fi.schema({names:{version:Zy,modulus:e1,publicExponent:t1,privateExponent:r1,prime1:n1,prime2:s1,exponent1:i1,exponent2:a1,coefficient:o1,otherPrimeInfo:{names:{blockName:Xl}}}}));ye.assertSchema(t,this.className),this.version=t.result.version.valueBlock.valueDec,this.modulus=t.result.modulus.convertFromDER(256),this.publicExponent=t.result.publicExponent,this.privateExponent=t.result.privateExponent.convertFromDER(256),this.prime1=t.result.prime1.convertFromDER(128),this.prime2=t.result.prime2.convertFromDER(128),this.exponent1=t.result.exponent1.convertFromDER(128),this.exponent2=t.result.exponent2.convertFromDER(128),this.coefficient=t.result.coefficient.convertFromDER(128),Xl in t.result&&(this.otherPrimeInfos=Array.from(t.result.otherPrimeInfos,n=>new Zb({schema:n})))}toSchema(){let e=[];return e.push(new he({value:this.version})),e.push(this.modulus.convertToDER()),e.push(this.publicExponent),e.push(this.privateExponent.convertToDER()),e.push(this.prime1.convertToDER()),e.push(this.prime2.convertToDER()),e.push(this.exponent1.convertToDER()),e.push(this.exponent2.convertToDER()),e.push(this.coefficient.convertToDER()),this.otherPrimeInfos&&e.push(new K({value:Array.from(this.otherPrimeInfos,t=>t.toSchema())})),new K({value:e})}toJSON(){let e={n:ut.ToBase64Url(this.modulus.valueBlock.valueHexView),e:ut.ToBase64Url(this.publicExponent.valueBlock.valueHexView),d:ut.ToBase64Url(this.privateExponent.valueBlock.valueHexView),p:ut.ToBase64Url(this.prime1.valueBlock.valueHexView),q:ut.ToBase64Url(this.prime2.valueBlock.valueHexView),dp:ut.ToBase64Url(this.exponent1.valueBlock.valueHexView),dq:ut.ToBase64Url(this.exponent2.valueBlock.valueHexView),qi:ut.ToBase64Url(this.coefficient.valueBlock.valueHexView)};return this.otherPrimeInfos&&(e.oth=Array.from(this.otherPrimeInfos,t=>t.toJSON())),e}fromJSON(e){Jt.assert("json",e,"n","e","d","p","q","dp","dq","qi"),this.modulus=new he({valueHex:ut.FromBase64Url(e.n)}),this.publicExponent=new he({valueHex:ut.FromBase64Url(e.e)}),this.privateExponent=new he({valueHex:ut.FromBase64Url(e.d)}),this.prime1=new he({valueHex:ut.FromBase64Url(e.p)}),this.prime2=new he({valueHex:ut.FromBase64Url(e.q)}),this.exponent1=new he({valueHex:ut.FromBase64Url(e.dp)}),this.exponent2=new he({valueHex:ut.FromBase64Url(e.dq)}),this.coefficient=new he({valueHex:ut.FromBase64Url(e.qi)}),e.oth&&(this.otherPrimeInfos=Array.from(e.oth,t=>new Zb({json:t})))}};LR.CLASS_NAME="RSAPrivateKey";var u1="version",c1="privateKeyAlgorithm",l1="privateKey",Gl="attributes",yb="parsedKey",Cle=[u1,c1,l1,Gl],Yv=class zl extends Se{static{o(this,"PrivateKeyInfo")}constructor(e={}){super(),this.version=B(e,u1,zl.defaultValues(u1)),this.privateKeyAlgorithm=B(e,c1,zl.defaultValues(c1)),this.privateKey=B(e,l1,zl.defaultValues(l1)),Gl in e&&(this.attributes=B(e,Gl,zl.defaultValues(Gl))),yb in e&&(this.parsedKey=B(e,yb,zl.defaultValues(yb))),e.json&&this.fromJSON(e.json),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case u1:return 0;case c1:return new pe;case l1:return new Be;case Gl:return[];case yb:return{};default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new he({name:t.version||P}),pe.schema(t.privateKeyAlgorithm||{}),new Be({name:t.privateKey||P}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new lt({name:t.attributes||P,value:$r.schema()})]})]})}fromSchema(e){Ce(e,Cle);let t=be(e,e,zl.schema({names:{version:u1,privateKeyAlgorithm:{names:{blockName:c1}},privateKey:l1,attributes:Gl}}));switch(ye.assertSchema(t,this.className),this.version=t.result.version.valueBlock.valueDec,this.privateKeyAlgorithm=new pe({schema:t.result.privateKeyAlgorithm}),this.privateKey=t.result.privateKey,Gl in t.result&&(this.attributes=Array.from(t.result.attributes,n=>new $r({schema:n}))),this.privateKeyAlgorithm.algorithmId){case"1.2.840.113549.1.1.1":{let n=Or(this.privateKey.valueBlock.valueHexView);n.offset!==-1&&(this.parsedKey=new LR({schema:n.result}))}break;case"1.2.840.10045.2.1":if("algorithmParams"in this.privateKeyAlgorithm&&this.privateKeyAlgorithm.algorithmParams instanceof He){let n=Or(this.privateKey.valueBlock.valueHexView);n.offset!==-1&&(this.parsedKey=new kR({namedCurve:this.privateKeyAlgorithm.algorithmParams.valueBlock.toString(),schema:n.result}))}break}}toSchema(){let e=[new he({value:this.version}),this.privateKeyAlgorithm.toSchema(),this.privateKey];return this.attributes&&e.push(new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:Array.from(this.attributes,t=>t.toSchema())})),new K({value:e})}toJSON(){if(!this.parsedKey){let n={version:this.version,privateKeyAlgorithm:this.privateKeyAlgorithm.toJSON(),privateKey:this.privateKey.toJSON()};return this.attributes&&(n.attributes=Array.from(this.attributes,s=>s.toJSON())),n}let e={};switch(this.privateKeyAlgorithm.algorithmId){case"1.2.840.10045.2.1":e.kty="EC";break;case"1.2.840.113549.1.1.1":e.kty="RSA";break}let t=this.parsedKey.toJSON();return Object.assign(e,t),e}fromJSON(e){if("kty"in e){switch(e.kty.toUpperCase()){case"EC":this.parsedKey=new kR({json:e}),this.privateKeyAlgorithm=new pe({algorithmId:"1.2.840.10045.2.1",algorithmParams:new He({value:this.parsedKey.namedCurve})});break;case"RSA":this.parsedKey=new LR({json:e}),this.privateKeyAlgorithm=new pe({algorithmId:"1.2.840.113549.1.1.1",algorithmParams:new Pr});break;default:throw new Error(`Invalid value for "kty" parameter: ${e.kty}`)}this.privateKey=new Be({valueHex:this.parsedKey.toSchema().toBER(!1)})}}};Yv.CLASS_NAME="PrivateKeyInfo";var Jp="contentType",Yp="contentEncryptionAlgorithm",Wl="encryptedContent",Nle=[Jp,Yp,Wl],u7=1024,Xn=class f1 extends Se{static{o(this,"EncryptedContentInfo")}constructor(e={}){if(super(),this.contentType=B(e,Jp,f1.defaultValues(Jp)),this.contentEncryptionAlgorithm=B(e,Yp,f1.defaultValues(Yp)),Wl in e&&e.encryptedContent&&(this.encryptedContent=e.encryptedContent,this.encryptedContent.idBlock.tagClass===1&&this.encryptedContent.idBlock.tagNumber===4&&this.encryptedContent.idBlock.isConstructed===!1&&!e.disableSplit)){let t=new Be({idBlock:{isConstructed:!0},isConstructed:!0}),n=0,s=this.encryptedContent.valueBlock.valueHexView.slice().buffer,i=s.byteLength;for(;i>0;){let a=new Uint8Array(s,n,n+u7>s.byteLength?s.byteLength-n:u7),u=new ArrayBuffer(a.length),c=new Uint8Array(u);for(let l=0;l<c.length;l++)c[l]=a[l];t.valueBlock.value.push(new Be({valueHex:u})),i-=a.length,n+=a.length}this.encryptedContent=t}e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Jp:return P;case Yp:return new pe;case Wl:return new Be;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Jp:return t===P;case Yp:return t.algorithmId===P&&!("algorithmParams"in t);case Wl:return t.isEqual(f1.defaultValues(Wl));default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new He({name:t.contentType||P}),pe.schema(t.contentEncryptionAlgorithm||{}),new Sr({value:[new ae({name:t.encryptedContent||P,idBlock:{tagClass:3,tagNumber:0},value:[new lt({value:new Be})]}),new tt({name:t.encryptedContent||P,idBlock:{tagClass:3,tagNumber:0}})]})]})}fromSchema(e){Ce(e,Nle);let t=be(e,e,f1.schema({names:{contentType:Jp,contentEncryptionAlgorithm:{names:{blockName:Yp}},encryptedContent:Wl}}));ye.assertSchema(t,this.className),this.contentType=t.result.contentType.valueBlock.toString(),this.contentEncryptionAlgorithm=new pe({schema:t.result.contentEncryptionAlgorithm}),Wl in t.result&&(this.encryptedContent=t.result.encryptedContent,this.encryptedContent.idBlock.tagClass=1,this.encryptedContent.idBlock.tagNumber=4)}toSchema(){let e={isIndefiniteForm:!1},t=[];if(t.push(new He({value:this.contentType})),t.push(this.contentEncryptionAlgorithm.toSchema()),this.encryptedContent){e.isIndefiniteForm=this.encryptedContent.idBlock.isConstructed;let n=this.encryptedContent;n.idBlock.tagClass=3,n.idBlock.tagNumber=0,n.lenBlock.isIndefiniteForm=this.encryptedContent.idBlock.isConstructed,t.push(n)}return new K({lenBlock:e,value:t})}toJSON(){let e={contentType:this.contentType,contentEncryptionAlgorithm:this.contentEncryptionAlgorithm.toJSON()};return this.encryptedContent&&(e.encryptedContent=this.encryptedContent.toJSON()),e}getEncryptedContent(){if(!this.encryptedContent)throw new Error("Parameter 'encryptedContent' is undefined");return Be.prototype.getValue.call(this.encryptedContent)}};Xn.CLASS_NAME="EncryptedContentInfo";var Qu="hashAlgorithm",Zu="maskGenAlgorithm",ec="saltLength",tc="trailerField",Tle=[Qu,Zu,ec,tc],eS=class Cs extends Se{static{o(this,"RSASSAPSSParams")}constructor(e={}){super(),this.hashAlgorithm=B(e,Qu,Cs.defaultValues(Qu)),this.maskGenAlgorithm=B(e,Zu,Cs.defaultValues(Zu)),this.saltLength=B(e,ec,Cs.defaultValues(ec)),this.trailerField=B(e,tc,Cs.defaultValues(tc)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Qu:return new pe({algorithmId:"1.3.14.3.2.26",algorithmParams:new Pr});case Zu:return new pe({algorithmId:"1.2.840.113549.1.1.8",algorithmParams:new pe({algorithmId:"1.3.14.3.2.26",algorithmParams:new Pr}).toSchema()});case ec:return 20;case tc:return 1;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new ae({idBlock:{tagClass:3,tagNumber:0},optional:!0,value:[pe.schema(t.hashAlgorithm||{})]}),new ae({idBlock:{tagClass:3,tagNumber:1},optional:!0,value:[pe.schema(t.maskGenAlgorithm||{})]}),new ae({idBlock:{tagClass:3,tagNumber:2},optional:!0,value:[new he({name:t.saltLength||P})]}),new ae({idBlock:{tagClass:3,tagNumber:3},optional:!0,value:[new he({name:t.trailerField||P})]})]})}fromSchema(e){Ce(e,Tle);let t=be(e,e,Cs.schema({names:{hashAlgorithm:{names:{blockName:Qu}},maskGenAlgorithm:{names:{blockName:Zu}},saltLength:ec,trailerField:tc}}));ye.assertSchema(t,this.className),Qu in t.result&&(this.hashAlgorithm=new pe({schema:t.result.hashAlgorithm})),Zu in t.result&&(this.maskGenAlgorithm=new pe({schema:t.result.maskGenAlgorithm})),ec in t.result&&(this.saltLength=t.result.saltLength.valueBlock.valueDec),tc in t.result&&(this.trailerField=t.result.trailerField.valueBlock.valueDec)}toSchema(){let e=[];return this.hashAlgorithm.isEqual(Cs.defaultValues(Qu))||e.push(new ae({idBlock:{tagClass:3,tagNumber:0},value:[this.hashAlgorithm.toSchema()]})),this.maskGenAlgorithm.isEqual(Cs.defaultValues(Zu))||e.push(new ae({idBlock:{tagClass:3,tagNumber:1},value:[this.maskGenAlgorithm.toSchema()]})),this.saltLength!==Cs.defaultValues(ec)&&e.push(new ae({idBlock:{tagClass:3,tagNumber:2},value:[new he({value:this.saltLength})]})),this.trailerField!==Cs.defaultValues(tc)&&e.push(new ae({idBlock:{tagClass:3,tagNumber:3},value:[new he({value:this.trailerField})]})),new K({value:e})}toJSON(){let e={};return this.hashAlgorithm.isEqual(Cs.defaultValues(Qu))||(e.hashAlgorithm=this.hashAlgorithm.toJSON()),this.maskGenAlgorithm.isEqual(Cs.defaultValues(Zu))||(e.maskGenAlgorithm=this.maskGenAlgorithm.toJSON()),this.saltLength!==Cs.defaultValues(ec)&&(e.saltLength=this.saltLength),this.trailerField!==Cs.defaultValues(tc)&&(e.trailerField=this.trailerField),e}};eS.CLASS_NAME="RSASSAPSSParams";var Qp="salt",h1="iterationCount",Li="keyLength",yo="prf",Ile=[Qp,h1,Li,yo],vm=class Ea extends Se{static{o(this,"PBKDF2Params")}constructor(e={}){super(),this.salt=B(e,Qp,Ea.defaultValues(Qp)),this.iterationCount=B(e,h1,Ea.defaultValues(h1)),Li in e&&(this.keyLength=B(e,Li,Ea.defaultValues(Li))),yo in e&&(this.prf=B(e,yo,Ea.defaultValues(yo))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Qp:return{};case h1:return-1;case Li:return 0;case yo:return new pe({algorithmId:"1.3.14.3.2.26",algorithmParams:new Pr});default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new Sr({value:[new Be({name:t.saltPrimitive||P}),pe.schema(t.saltConstructed||{})]}),new he({name:t.iterationCount||P}),new he({name:t.keyLength||P,optional:!0}),pe.schema(t.prf||{names:{optional:!0}})]})}fromSchema(e){Ce(e,Ile);let t=be(e,e,Ea.schema({names:{saltPrimitive:Qp,saltConstructed:{names:{blockName:Qp}},iterationCount:h1,keyLength:Li,prf:{names:{blockName:yo,optional:!0}}}}));ye.assertSchema(t,this.className),this.salt=t.result.salt,this.iterationCount=t.result.iterationCount.valueBlock.valueDec,Li in t.result&&(this.keyLength=t.result.keyLength.valueBlock.valueDec),yo in t.result&&(this.prf=new pe({schema:t.result.prf}))}toSchema(){let e=[];return e.push(this.salt),e.push(new he({value:this.iterationCount})),Li in this&&Ea.defaultValues(Li)!==this.keyLength&&e.push(new he({value:this.keyLength})),this.prf&&Ea.defaultValues(yo).isEqual(this.prf)===!1&&e.push(this.prf.toSchema()),new K({value:e})}toJSON(){let e={salt:this.salt.toJSON(),iterationCount:this.iterationCount};return Li in this&&Ea.defaultValues(Li)!==this.keyLength&&(e.keyLength=this.keyLength),this.prf&&Ea.defaultValues(yo).isEqual(this.prf)===!1&&(e.prf=this.prf.toJSON()),e}};vm.CLASS_NAME="PBKDF2Params";var p1="keyDerivationFunc",d1="encryptionScheme",Dle=[p1,d1],FR=class tS extends Se{static{o(this,"PBES2Params")}constructor(e={}){super(),this.keyDerivationFunc=B(e,p1,tS.defaultValues(p1)),this.encryptionScheme=B(e,d1,tS.defaultValues(d1)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case p1:return new pe;case d1:return new pe;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[pe.schema(t.keyDerivationFunc||{}),pe.schema(t.encryptionScheme||{})]})}fromSchema(e){Ce(e,Dle);let t=be(e,e,tS.schema({names:{keyDerivationFunc:{names:{blockName:p1}},encryptionScheme:{names:{blockName:d1}}}}));ye.assertSchema(t,this.className),this.keyDerivationFunc=new pe({schema:t.result.keyDerivationFunc}),this.encryptionScheme=new pe({schema:t.result.encryptionScheme})}toSchema(){return new K({value:[this.keyDerivationFunc.toSchema(),this.encryptionScheme.toSchema()]})}toJSON(){return{keyDerivationFunc:this.keyDerivationFunc.toJSON(),encryptionScheme:this.encryptionScheme.toJSON()}}};FR.CLASS_NAME="PBES2Params";var Ble=class{static{o(this,"AbstractCryptoEngine")}constructor(e){this.crypto=e.crypto,this.subtle="webkitSubtle"in e.crypto?e.crypto.webkitSubtle:e.crypto.subtle,this.name=B(e,"name",P)}async encrypt(...e){return this.subtle.encrypt(...e)}async decrypt(...e){return this.subtle.decrypt(...e)}sign(...e){return this.subtle.sign(...e)}async verify(...e){return this.subtle.verify(...e)}async digest(...e){return this.subtle.digest(...e)}async generateKey(...e){return this.subtle.generateKey(...e)}async deriveKey(...e){return this.subtle.deriveKey(...e)}async deriveBits(...e){return this.subtle.deriveBits(...e)}async wrapKey(...e){return this.subtle.wrapKey(...e)}async unwrapKey(...e){return this.subtle.unwrapKey(...e)}exportKey(...e){return this.subtle.exportKey(...e)}importKey(...e){return this.subtle.importKey(...e)}getRandomValues(e){if(e===null)throw new Error('Argument "array" must not be null');return this.crypto.getRandomValues(e)}};async function c7(r,e,t,n,s){let i,a,u;switch(r.toUpperCase()){case"SHA-1":i=20,a=64,u=t7;break;case"SHA-256":i=32,a=64,u=OB;break;case"SHA-384":i=48,a=128,u=LB;break;case"SHA-512":i=64,a=128,u=kB;break;default:throw new Error("Unsupported hashing algorithm")}let c=new Uint8Array(t),l=new TextDecoder().decode(t);new TextEncoder().encode(l).some((x,b)=>x!==c[b])&&(l=String.fromCharCode(...c));let h=new Uint8Array(l.length*2+2),d=new DataView(h.buffer);for(let x=0;x<l.length;x++)d.setUint16(x*2,l.charCodeAt(x),!1);d.setUint16(l.length*2,0,!1);let g=new Uint8Array(a).fill(3),m=new Uint8Array(n),v=new Uint8Array(a*Math.ceil(m.length/a)).map((x,b)=>m[b%m.length]),y=new Uint8Array(a*Math.ceil(h.length/a)).map((x,b)=>h[b%h.length]),w=new Uint8Array(v.length+y.length);w.set(v),w.set(y,v.length);let S=Math.ceil((e>>3)/i),E=[];for(let x=0;x<S;x++){let b=new Uint8Array(g.length+w.length);b.set(g),b.set(w,g.length);for(let T=0;T<s;T++)b=u(b);let A=new Uint8Array(a).map((T,V)=>b[V%b.length]),k=Math.ceil(m.length/a)+Math.ceil(h.length/a),I=[];for(let T=0;T<k;T++){let V=Array.from(w.slice(T*a,(T+1)*a)),U=511;for(let M=A.length-1;M>=0;M--)U>>=8,U+=A[M]+(V[M]||0),V[M]=U&255;I.push(...V)}w=new Uint8Array(I),E.push(...b)}return new Uint8Array(E.slice(0,e>>3)).buffer}o(c7,"makePKCS12B2Key");function Q7(r){let e=typeof r=="string"?{name:r}:r;return"hash"in e?{...e,hash:Q7(e.hash)}:e}o(Q7,"prepareAlgorithm");var Em=class extends Ble{static{o(this,"CryptoEngine")}async importKey(e,t,n,s,i){var a,u,c,l,f,h;let d={},g=Q7(n);switch(e.toLowerCase()){case"raw":return this.subtle.importKey("raw",t,n,s,i);case"spki":{let m=Or(Ze.toArrayBuffer(t));ye.assert(m,"keyData");let v=new qi;try{v.fromSchema(m.result)}catch{throw new hr("Incorrect keyData")}switch(g.name.toUpperCase()){case"RSA-PSS":{if(i=["verify"],d.kty="RSA",d.ext=s,d.key_ops=i,!["1.2.840.113549.1.1.1","1.2.840.113549.1.1.10"].includes(v.algorithm.algorithmId))throw new Error(`Incorrect public key algorithm: ${v.algorithm.algorithmId}`);if(!g.hash)throw new Jt("hash","algorithm.hash","Incorrect hash algorithm: Hash algorithm is missed");switch(g.hash.name.toUpperCase()){case"SHA-1":d.alg="PS1";break;case"SHA-256":d.alg="PS256";break;case"SHA-384":d.alg="PS384";break;case"SHA-512":d.alg="PS512";break;default:throw new Error(`Incorrect hash algorithm: ${g.hash.name.toUpperCase()}`)}let y=v.toJSON();Object.assign(d,y)}break;case"RSASSA-PKCS1-V1_5":{if(i=["verify"],d.kty="RSA",d.ext=s,d.key_ops=i,v.algorithm.algorithmId!=="1.2.840.113549.1.1.1")throw new Error(`Incorrect public key algorithm: ${v.algorithm.algorithmId}`);if(!g.hash)throw new Jt("hash","algorithm.hash","Incorrect hash algorithm: Hash algorithm is missed");switch(g.hash.name.toUpperCase()){case"SHA-1":d.alg="RS1";break;case"SHA-256":d.alg="RS256";break;case"SHA-384":d.alg="RS384";break;case"SHA-512":d.alg="RS512";break;default:throw new Error(`Incorrect hash algorithm: ${g.hash.name.toUpperCase()}`)}let y=v.toJSON();Object.assign(d,y)}break;case"ECDSA":i=["verify"];case"ECDH":{if(d={kty:"EC",ext:s,key_ops:i},v.algorithm.algorithmId!=="1.2.840.10045.2.1")throw new Error(`Incorrect public key algorithm: ${v.algorithm.algorithmId}`);let y=v.toJSON();Object.assign(d,y)}break;case"RSA-OAEP":{if(d.kty="RSA",d.ext=s,d.key_ops=i,this.name.toLowerCase()==="safari")d.alg="RSA-OAEP";else{if(!g.hash)throw new Jt("hash","algorithm.hash","Incorrect hash algorithm: Hash algorithm is missed");switch(g.hash.name.toUpperCase()){case"SHA-1":d.alg="RSA-OAEP";break;case"SHA-256":d.alg="RSA-OAEP-256";break;case"SHA-384":d.alg="RSA-OAEP-384";break;case"SHA-512":d.alg="RSA-OAEP-512";break;default:throw new Error(`Incorrect hash algorithm: ${g.hash.name.toUpperCase()}`)}}let y=v.toJSON();Object.assign(d,y)}break;case"RSAES-PKCS1-V1_5":{d.kty="RSA",d.ext=s,d.key_ops=i,d.alg="PS1";let y=v.toJSON();Object.assign(d,y)}break;default:throw new Error(`Incorrect algorithm name: ${g.name.toUpperCase()}`)}}break;case"pkcs8":{let m=new Yv,v=Or(Ze.toArrayBuffer(t));ye.assert(v,"keyData");try{m.fromSchema(v.result)}catch{throw new Error("Incorrect keyData")}if(!m.parsedKey)throw new Error("Incorrect keyData");switch(g.name.toUpperCase()){case"RSA-PSS":switch((a=g.hash)===null||a===void 0?void 0:a.name.toUpperCase()){case"SHA-1":d.alg="PS1";break;case"SHA-256":d.alg="PS256";break;case"SHA-384":d.alg="PS384";break;case"SHA-512":d.alg="PS512";break;default:throw new Error(`Incorrect hash algorithm: ${(u=g.hash)===null||u===void 0?void 0:u.name.toUpperCase()}`)}case"RSASSA-PKCS1-V1_5":{if(i=["sign"],d.kty="RSA",d.ext=s,d.key_ops=i,m.privateKeyAlgorithm.algorithmId!=="1.2.840.113549.1.1.1")throw new Error(`Incorrect private key algorithm: ${m.privateKeyAlgorithm.algorithmId}`);if(!("alg"in d))switch((c=g.hash)===null||c===void 0?void 0:c.name.toUpperCase()){case"SHA-1":d.alg="RS1";break;case"SHA-256":d.alg="RS256";break;case"SHA-384":d.alg="RS384";break;case"SHA-512":d.alg="RS512";break;default:throw new Error(`Incorrect hash algorithm: ${(l=g.hash)===null||l===void 0?void 0:l.name.toUpperCase()}`)}let y=m.toJSON();Object.assign(d,y)}break;case"ECDSA":i=["sign"];case"ECDH":{if(d={kty:"EC",ext:s,key_ops:i},m.privateKeyAlgorithm.algorithmId!=="1.2.840.10045.2.1")throw new Error(`Incorrect algorithm: ${m.privateKeyAlgorithm.algorithmId}`);let y=m.toJSON();Object.assign(d,y)}break;case"RSA-OAEP":{if(d.kty="RSA",d.ext=s,d.key_ops=i,this.name.toLowerCase()==="safari")d.alg="RSA-OAEP";else switch((f=g.hash)===null||f===void 0?void 0:f.name.toUpperCase()){case"SHA-1":d.alg="RSA-OAEP";break;case"SHA-256":d.alg="RSA-OAEP-256";break;case"SHA-384":d.alg="RSA-OAEP-384";break;case"SHA-512":d.alg="RSA-OAEP-512";break;default:throw new Error(`Incorrect hash algorithm: ${(h=g.hash)===null||h===void 0?void 0:h.name.toUpperCase()}`)}let y=m.toJSON();Object.assign(d,y)}break;case"RSAES-PKCS1-V1_5":{i=["decrypt"],d.kty="RSA",d.ext=s,d.key_ops=i,d.alg="PS1";let y=m.toJSON();Object.assign(d,y)}break;default:throw new Error(`Incorrect algorithm name: ${g.name.toUpperCase()}`)}}break;case"jwk":d=t;break;default:throw new Error(`Incorrect format: ${e}`)}if(this.name.toLowerCase()==="safari")try{return this.subtle.importKey("jwk",Cl(JSON.stringify(d)),n,s,i)}catch{return this.subtle.importKey("jwk",d,n,s,i)}return this.subtle.importKey("jwk",d,n,s,i)}async exportKey(e,t){let n=await this.subtle.exportKey("jwk",t);switch(this.name.toLowerCase()==="safari"&&n instanceof ArrayBuffer&&(n=JSON.parse(Qg(n))),e.toLowerCase()){case"raw":return this.subtle.exportKey("raw",t);case"spki":{let s=new qi;try{s.fromJSON(n)}catch{throw new Error("Incorrect key data")}return s.toSchema().toBER(!1)}case"pkcs8":{let s=new Yv;try{s.fromJSON(n)}catch{throw new Error("Incorrect key data")}return s.toSchema().toBER(!1)}case"jwk":return n;default:throw new Error(`Incorrect format: ${e}`)}}async convert(e,t,n,s,i,a){if(e.toLowerCase()===t.toLowerCase())return n;let u=await this.importKey(e,n,s,i,a);return this.exportKey(t,u)}getAlgorithmByOID(e,t=!1,n){switch(e){case"1.2.840.113549.1.1.1":return{name:"RSAES-PKCS1-v1_5"};case"1.2.840.113549.1.1.5":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-1"}};case"1.2.840.113549.1.1.11":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"1.2.840.113549.1.1.12":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-384"}};case"1.2.840.113549.1.1.13":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-512"}};case"1.2.840.113549.1.1.10":return{name:"RSA-PSS"};case"1.2.840.113549.1.1.7":return{name:"RSA-OAEP"};case"1.2.840.10045.2.1":case"1.2.840.10045.4.1":return{name:"ECDSA",hash:{name:"SHA-1"}};case"1.2.840.10045.4.3.2":return{name:"ECDSA",hash:{name:"SHA-256"}};case"1.2.840.10045.4.3.3":return{name:"ECDSA",hash:{name:"SHA-384"}};case"1.2.840.10045.4.3.4":return{name:"ECDSA",hash:{name:"SHA-512"}};case"1.3.133.16.840.63.0.2":return{name:"ECDH",kdf:"SHA-1"};case"1.3.132.1.11.1":return{name:"ECDH",kdf:"SHA-256"};case"1.3.132.1.11.2":return{name:"ECDH",kdf:"SHA-384"};case"1.3.132.1.11.3":return{name:"ECDH",kdf:"SHA-512"};case"2.16.840.1.101.3.4.1.2":return{name:"AES-CBC",length:128};case"2.16.840.1.101.3.4.1.22":return{name:"AES-CBC",length:192};case"2.16.840.1.101.3.4.1.42":return{name:"AES-CBC",length:256};case"2.16.840.1.101.3.4.1.6":return{name:"AES-GCM",length:128};case"2.16.840.1.101.3.4.1.26":return{name:"AES-GCM",length:192};case"2.16.840.1.101.3.4.1.46":return{name:"AES-GCM",length:256};case"2.16.840.1.101.3.4.1.4":return{name:"AES-CFB",length:128};case"2.16.840.1.101.3.4.1.24":return{name:"AES-CFB",length:192};case"2.16.840.1.101.3.4.1.44":return{name:"AES-CFB",length:256};case"2.16.840.1.101.3.4.1.5":return{name:"AES-KW",length:128};case"2.16.840.1.101.3.4.1.25":return{name:"AES-KW",length:192};case"2.16.840.1.101.3.4.1.45":return{name:"AES-KW",length:256};case"1.2.840.113549.2.7":return{name:"HMAC",hash:{name:"SHA-1"}};case"1.2.840.113549.2.9":return{name:"HMAC",hash:{name:"SHA-256"}};case"1.2.840.113549.2.10":return{name:"HMAC",hash:{name:"SHA-384"}};case"1.2.840.113549.2.11":return{name:"HMAC",hash:{name:"SHA-512"}};case"1.2.840.113549.1.9.16.3.5":return{name:"DH"};case"1.3.14.3.2.26":return{name:"SHA-1"};case"2.16.840.1.101.3.4.2.1":return{name:"SHA-256"};case"2.16.840.1.101.3.4.2.2":return{name:"SHA-384"};case"2.16.840.1.101.3.4.2.3":return{name:"SHA-512"};case"1.2.840.113549.1.5.12":return{name:"PBKDF2"};case"1.2.840.10045.3.1.7":return{name:"P-256"};case"1.3.132.0.34":return{name:"P-384"};case"1.3.132.0.35":return{name:"P-521"}}if(t)throw new Error(`Unsupported algorithm identifier ${n?`for ${n} `:P}: ${e}`);return{}}getOIDByAlgorithm(e,t=!1,n){let s=P;switch(e.name.toUpperCase()){case"RSAES-PKCS1-V1_5":s="1.2.840.113549.1.1.1";break;case"RSASSA-PKCS1-V1_5":switch(e.hash.name.toUpperCase()){case"SHA-1":s="1.2.840.113549.1.1.5";break;case"SHA-256":s="1.2.840.113549.1.1.11";break;case"SHA-384":s="1.2.840.113549.1.1.12";break;case"SHA-512":s="1.2.840.113549.1.1.13";break}break;case"RSA-PSS":s="1.2.840.113549.1.1.10";break;case"RSA-OAEP":s="1.2.840.113549.1.1.7";break;case"ECDSA":switch(e.hash.name.toUpperCase()){case"SHA-1":s="1.2.840.10045.4.1";break;case"SHA-256":s="1.2.840.10045.4.3.2";break;case"SHA-384":s="1.2.840.10045.4.3.3";break;case"SHA-512":s="1.2.840.10045.4.3.4";break}break;case"ECDH":switch(e.kdf.toUpperCase()){case"SHA-1":s="1.3.133.16.840.63.0.2";break;case"SHA-256":s="1.3.132.1.11.1";break;case"SHA-384":s="1.3.132.1.11.2";break;case"SHA-512":s="1.3.132.1.11.3";break}break;case"AES-CTR":break;case"AES-CBC":switch(e.length){case 128:s="2.16.840.1.101.3.4.1.2";break;case 192:s="2.16.840.1.101.3.4.1.22";break;case 256:s="2.16.840.1.101.3.4.1.42";break}break;case"AES-CMAC":break;case"AES-GCM":switch(e.length){case 128:s="2.16.840.1.101.3.4.1.6";break;case 192:s="2.16.840.1.101.3.4.1.26";break;case 256:s="2.16.840.1.101.3.4.1.46";break}break;case"AES-CFB":switch(e.length){case 128:s="2.16.840.1.101.3.4.1.4";break;case 192:s="2.16.840.1.101.3.4.1.24";break;case 256:s="2.16.840.1.101.3.4.1.44";break}break;case"AES-KW":switch(e.length){case 128:s="2.16.840.1.101.3.4.1.5";break;case 192:s="2.16.840.1.101.3.4.1.25";break;case 256:s="2.16.840.1.101.3.4.1.45";break}break;case"HMAC":switch(e.hash.name.toUpperCase()){case"SHA-1":s="1.2.840.113549.2.7";break;case"SHA-256":s="1.2.840.113549.2.9";break;case"SHA-384":s="1.2.840.113549.2.10";break;case"SHA-512":s="1.2.840.113549.2.11";break}break;case"DH":s="1.2.840.113549.1.9.16.3.5";break;case"SHA-1":s="1.3.14.3.2.26";break;case"SHA-256":s="2.16.840.1.101.3.4.2.1";break;case"SHA-384":s="2.16.840.1.101.3.4.2.2";break;case"SHA-512":s="2.16.840.1.101.3.4.2.3";break;case"CONCAT":break;case"HKDF":break;case"PBKDF2":s="1.2.840.113549.1.5.12";break;case"P-256":s="1.2.840.10045.3.1.7";break;case"P-384":s="1.3.132.0.34";break;case"P-521":s="1.3.132.0.35";break}if(!s&&t)throw new Error(`Unsupported algorithm ${n?`for ${n} `:P}: ${e.name}`);return s}getAlgorithmParameters(e,t){let n={algorithm:{},usages:[]};switch(e.toUpperCase()){case"RSAES-PKCS1-V1_5":case"RSASSA-PKCS1-V1_5":switch(t.toLowerCase()){case"generatekey":n={algorithm:{name:"RSASSA-PKCS1-v1_5",modulusLength:2048,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},usages:["sign","verify"]};break;case"verify":case"sign":case"importkey":n={algorithm:{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},usages:["verify"]};break;case"exportkey":default:return{algorithm:{name:"RSASSA-PKCS1-v1_5"},usages:[]}}break;case"RSA-PSS":switch(t.toLowerCase()){case"sign":case"verify":n={algorithm:{name:"RSA-PSS",hash:{name:"SHA-1"},saltLength:20},usages:["sign","verify"]};break;case"generatekey":n={algorithm:{name:"RSA-PSS",modulusLength:2048,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-1"}},usages:["sign","verify"]};break;case"importkey":n={algorithm:{name:"RSA-PSS",hash:{name:"SHA-1"}},usages:["verify"]};break;case"exportkey":default:return{algorithm:{name:"RSA-PSS"},usages:[]}}break;case"RSA-OAEP":switch(t.toLowerCase()){case"encrypt":case"decrypt":n={algorithm:{name:"RSA-OAEP"},usages:["encrypt","decrypt"]};break;case"generatekey":n={algorithm:{name:"RSA-OAEP",modulusLength:2048,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},usages:["encrypt","decrypt","wrapKey","unwrapKey"]};break;case"importkey":n={algorithm:{name:"RSA-OAEP",hash:{name:"SHA-256"}},usages:["encrypt"]};break;case"exportkey":default:return{algorithm:{name:"RSA-OAEP"},usages:[]}}break;case"ECDSA":switch(t.toLowerCase()){case"generatekey":n={algorithm:{name:"ECDSA",namedCurve:"P-256"},usages:["sign","verify"]};break;case"importkey":n={algorithm:{name:"ECDSA",namedCurve:"P-256"},usages:["verify"]};break;case"verify":case"sign":n={algorithm:{name:"ECDSA",hash:{name:"SHA-256"}},usages:["sign"]};break;default:return{algorithm:{name:"ECDSA"},usages:[]}}break;case"ECDH":switch(t.toLowerCase()){case"exportkey":case"importkey":case"generatekey":n={algorithm:{name:"ECDH",namedCurve:"P-256"},usages:["deriveKey","deriveBits"]};break;case"derivekey":case"derivebits":n={algorithm:{name:"ECDH",namedCurve:"P-256",public:[]},usages:["encrypt","decrypt"]};break;default:return{algorithm:{name:"ECDH"},usages:[]}}break;case"AES-CTR":switch(t.toLowerCase()){case"importkey":case"exportkey":case"generatekey":n={algorithm:{name:"AES-CTR",length:256},usages:["encrypt","decrypt","wrapKey","unwrapKey"]};break;case"decrypt":case"encrypt":n={algorithm:{name:"AES-CTR",counter:new Uint8Array(16),length:10},usages:["encrypt","decrypt","wrapKey","unwrapKey"]};break;default:return{algorithm:{name:"AES-CTR"},usages:[]}}break;case"AES-CBC":switch(t.toLowerCase()){case"importkey":case"exportkey":case"generatekey":n={algorithm:{name:"AES-CBC",length:256},usages:["encrypt","decrypt","wrapKey","unwrapKey"]};break;case"decrypt":case"encrypt":n={algorithm:{name:"AES-CBC",iv:this.getRandomValues(new Uint8Array(16))},usages:["encrypt","decrypt","wrapKey","unwrapKey"]};break;default:return{algorithm:{name:"AES-CBC"},usages:[]}}break;case"AES-GCM":switch(t.toLowerCase()){case"importkey":case"exportkey":case"generatekey":n={algorithm:{name:"AES-GCM",length:256},usages:["encrypt","decrypt","wrapKey","unwrapKey"]};break;case"decrypt":case"encrypt":n={algorithm:{name:"AES-GCM",iv:this.getRandomValues(new Uint8Array(16))},usages:["encrypt","decrypt","wrapKey","unwrapKey"]};break;default:return{algorithm:{name:"AES-GCM"},usages:[]}}break;case"AES-KW":switch(t.toLowerCase()){case"importkey":case"exportkey":case"generatekey":case"wrapkey":case"unwrapkey":n={algorithm:{name:"AES-KW",length:256},usages:["wrapKey","unwrapKey"]};break;default:return{algorithm:{name:"AES-KW"},usages:[]}}break;case"HMAC":switch(t.toLowerCase()){case"sign":case"verify":n={algorithm:{name:"HMAC"},usages:["sign","verify"]};break;case"importkey":case"exportkey":case"generatekey":n={algorithm:{name:"HMAC",length:32,hash:{name:"SHA-256"}},usages:["sign","verify"]};break;default:return{algorithm:{name:"HMAC"},usages:[]}}break;case"HKDF":switch(t.toLowerCase()){case"derivekey":n={algorithm:{name:"HKDF",hash:"SHA-256",salt:new Uint8Array([]),info:new Uint8Array([])},usages:["encrypt","decrypt"]};break;default:return{algorithm:{name:"HKDF"},usages:[]}}break;case"PBKDF2":switch(t.toLowerCase()){case"derivekey":n={algorithm:{name:"PBKDF2",hash:{name:"SHA-256"},salt:new Uint8Array([]),iterations:1e4},usages:["encrypt","decrypt"]};break;default:return{algorithm:{name:"PBKDF2"},usages:[]}}break}return n}getHashAlgorithm(e){let t=P;switch(e.algorithmId){case"1.2.840.10045.4.1":case"1.2.840.113549.1.1.5":t="SHA-1";break;case"1.2.840.10045.4.3.2":case"1.2.840.113549.1.1.11":t="SHA-256";break;case"1.2.840.10045.4.3.3":case"1.2.840.113549.1.1.12":t="SHA-384";break;case"1.2.840.10045.4.3.4":case"1.2.840.113549.1.1.13":t="SHA-512";break;case"1.2.840.113549.1.1.10":try{let n=new eS({schema:e.algorithmParams});if(n.hashAlgorithm){let s=this.getAlgorithmByOID(n.hashAlgorithm.algorithmId);if("name"in s)t=s.name;else return P}else t="SHA-1"}catch{}break}return t}async encryptEncryptedContentInfo(e){Jt.assert(e,"password","contentEncryptionAlgorithm","hmacHashAlgorithm","iterationCount","contentToEncrypt","contentToEncrypt","contentType");let t=this.getOIDByAlgorithm(e.contentEncryptionAlgorithm,!0,"contentEncryptionAlgorithm"),n=this.getOIDByAlgorithm({name:"PBKDF2"},!0,"PBKDF2"),s=this.getOIDByAlgorithm({name:"HMAC",hash:{name:e.hmacHashAlgorithm}},!0,"hmacHashAlgorithm"),i=new ArrayBuffer(16),a=new Uint8Array(i);this.getRandomValues(a);let u=new ArrayBuffer(64),c=new Uint8Array(u);this.getRandomValues(c);let l=new Uint8Array(e.contentToEncrypt),f=new vm({salt:new Be({valueHex:u}),iterationCount:e.iterationCount,prf:new pe({algorithmId:s,algorithmParams:new Pr})}),h=new Uint8Array(e.password),d=await this.importKey("raw",h,"PBKDF2",!1,["deriveKey"]),g=await this.deriveKey({name:"PBKDF2",hash:{name:e.hmacHashAlgorithm},salt:c,iterations:e.iterationCount},d,e.contentEncryptionAlgorithm,!1,["encrypt"]),m=await this.encrypt({name:e.contentEncryptionAlgorithm.name,iv:a},g,l),v=new FR({keyDerivationFunc:new pe({algorithmId:n,algorithmParams:f.toSchema()}),encryptionScheme:new pe({algorithmId:t,algorithmParams:new Be({valueHex:i})})});return new Xn({contentType:e.contentType,contentEncryptionAlgorithm:new pe({algorithmId:"1.2.840.113549.1.5.13",algorithmParams:v.toSchema()}),encryptedContent:new Be({valueHex:m})})}async decryptEncryptedContentInfo(e){if(Jt.assert(e,"password","encryptedContentInfo"),e.encryptedContentInfo.contentEncryptionAlgorithm.algorithmId!=="1.2.840.113549.1.5.13")throw new Error(`Unknown "contentEncryptionAlgorithm": ${e.encryptedContentInfo.contentEncryptionAlgorithm.algorithmId}`);let t;try{t=new FR({schema:e.encryptedContentInfo.contentEncryptionAlgorithm.algorithmParams})}catch{throw new Error('Incorrectly encoded "pbes2Parameters"')}let n;try{n=new vm({schema:t.keyDerivationFunc.algorithmParams})}catch{throw new Error('Incorrectly encoded "pbkdf2Params"')}let s=this.getAlgorithmByOID(t.encryptionScheme.algorithmId,!0),i=t.encryptionScheme.algorithmParams.valueBlock.valueHex,a=new Uint8Array(i),u=n.salt.valueBlock.valueHex,c=new Uint8Array(u),l=n.iterationCount,f="SHA-1";n.prf&&(f=this.getAlgorithmByOID(n.prf.algorithmId,!0).hash.name);let h=await this.importKey("raw",e.password,"PBKDF2",!1,["deriveKey"]),d=await this.deriveKey({name:"PBKDF2",hash:{name:f},salt:c,iterations:l},h,s,!1,["decrypt"]),g=e.encryptedContentInfo.getEncryptedContent();return this.decrypt({name:s.name,iv:a},d,g)}async stampDataWithPassword(e){if(!(e instanceof Object))throw new Error('Parameters must have type "Object"');Jt.assert(e,"password","hashAlgorithm","iterationCount","salt","contentToStamp");let t;switch(e.hashAlgorithm.toLowerCase()){case"sha-1":t=160;break;case"sha-256":t=256;break;case"sha-384":t=384;break;case"sha-512":t=512;break;default:throw new Error(`Incorrect "parameters.hashAlgorithm" parameter: ${e.hashAlgorithm}`)}let n={name:"HMAC",length:t,hash:{name:e.hashAlgorithm}},s=await c7(e.hashAlgorithm,t,e.password,e.salt,e.iterationCount),i=await this.importKey("raw",new Uint8Array(s),n,!1,["sign"]);return this.sign(n,i,new Uint8Array(e.contentToStamp))}async verifyDataStampedWithPassword(e){Jt.assert(e,"password","hashAlgorithm","salt","iterationCount","contentToVerify","signatureToVerify");let t=0;switch(e.hashAlgorithm.toLowerCase()){case"sha-1":t=160;break;case"sha-256":t=256;break;case"sha-384":t=384;break;case"sha-512":t=512;break;default:throw new Error(`Incorrect "parameters.hashAlgorithm" parameter: ${e.hashAlgorithm}`)}let n={name:"HMAC",length:t,hash:{name:e.hashAlgorithm}},s=await c7(e.hashAlgorithm,t,e.password,e.salt,e.iterationCount),i=await this.importKey("raw",new Uint8Array(s),n,!1,["verify"]);return this.verify(n,i,new Uint8Array(e.signatureToVerify),new Uint8Array(e.contentToVerify))}async getSignatureParameters(e,t="SHA-1"){this.getOIDByAlgorithm({name:t},!0,"hashAlgorithm");let n=new pe,s=this.getAlgorithmParameters(e.algorithm.name,"sign");if(!Object.keys(s.algorithm).length)throw new Error("Parameter 'algorithm' is empty");let i=s.algorithm;switch("hash"in e.algorithm&&e.algorithm.hash&&e.algorithm.hash.name?i.hash.name=e.algorithm.hash.name:i.hash.name=t,e.algorithm.name.toUpperCase()){case"RSASSA-PKCS1-V1_5":case"ECDSA":n.algorithmId=this.getOIDByAlgorithm(i,!0);break;case"RSA-PSS":{switch(i.hash.name.toUpperCase()){case"SHA-256":i.saltLength=32;break;case"SHA-384":i.saltLength=48;break;case"SHA-512":i.saltLength=64;break}let a={};if(i.hash.name.toUpperCase()!=="SHA-1"){let c=this.getOIDByAlgorithm({name:i.hash.name},!0,"hashAlgorithm");a.hashAlgorithm=new pe({algorithmId:c,algorithmParams:new Pr}),a.maskGenAlgorithm=new pe({algorithmId:"1.2.840.113549.1.1.8",algorithmParams:a.hashAlgorithm.toSchema()})}i.saltLength!==20&&(a.saltLength=i.saltLength);let u=new eS(a);n.algorithmId="1.2.840.113549.1.1.10",n.algorithmParams=u.toSchema()}break;default:throw new Error(`Unsupported signature algorithm: ${e.algorithm.name}`)}return{signatureAlgorithm:n,parameters:s}}async signWithPrivateKey(e,t,n){let s=await this.sign(n.algorithm,t,e);return n.algorithm.name==="ECDSA"?_le(s):s}fillPublicKeyParameters(e,t){let n={},s=this.getHashAlgorithm(t);if(s===P)throw new Error(`Unsupported signature algorithm: ${t.algorithmId}`);let i;t.algorithmId==="1.2.840.113549.1.1.10"?i=t.algorithmId:i=e.algorithm.algorithmId;let a=this.getAlgorithmByOID(i,!0);if(n.algorithm=this.getAlgorithmParameters(a.name,"importKey"),"hash"in n.algorithm.algorithm&&(n.algorithm.algorithm.hash.name=s),a.name==="ECDSA"){let u=e.algorithm;if(!u.algorithmParams)throw new Error("Algorithm parameters for ECDSA public key are missed");let c=u.algorithmParams;if("idBlock"in u.algorithmParams&&!(c.idBlock.tagClass===1&&c.idBlock.tagNumber===6))throw new Error("Incorrect type for ECDSA public key parameters");let l=this.getAlgorithmByOID(c.valueBlock.toString(),!0);n.algorithm.algorithm.namedCurve=l.name}return n}async getPublicKey(e,t,n){n||(n=this.fillPublicKeyParameters(e,t));let s=e.toSchema().toBER(!1);return this.importKey("spki",s,n.algorithm.algorithm,!0,n.algorithm.usages)}async verifyWithPublicKey(e,t,n,s,i){let a;if(i){let l={},f;s.algorithmId==="1.2.840.113549.1.1.10"?f=s.algorithmId:f=n.algorithm.algorithmId;let h=this.getAlgorithmByOID(f,!0);if(l.algorithm=this.getAlgorithmParameters(h.name,"importKey"),"hash"in l.algorithm.algorithm&&(l.algorithm.algorithm.hash.name=i),h.name==="ECDSA"){let d=!1;if("algorithmParams"in n.algorithm&&"idBlock"in n.algorithm.algorithmParams&&n.algorithm.algorithmParams.idBlock.tagClass===1&&n.algorithm.algorithmParams.idBlock.tagNumber===6&&(d=!0),d===!1)throw new Error("Incorrect type for ECDSA public key parameters");let g=this.getAlgorithmByOID(n.algorithm.algorithmParams.valueBlock.toString(),!0);l.algorithm.algorithm.namedCurve=g.name}a=await this.getPublicKey(n,null,l)}else{if(i=this.getHashAlgorithm(s),!i)throw new Error(`Unsupported signature algorithm: ${s.algorithmId}`);a=await this.getPublicKey(n,s)}let u=this.getAlgorithmParameters(a.algorithm.name,"verify");"hash"in u.algorithm&&(u.algorithm.hash.name=i);let c=t.valueBlock.valueHexView;if(a.algorithm.name==="ECDSA"){let l=Oc.find(a.algorithm.namedCurve);if(!l)throw new Error("Unsupported named curve in use");let f=Or(c);ye.assert(f,"Signature value"),c=Ole(f.result,l.size)}if(a.algorithm.name==="RSA-PSS"){let l=new eS({schema:s.algorithmParams});"saltLength"in l?u.algorithm.saltLength=l.saltLength:u.algorithm.saltLength=20;let f="SHA-1";"hashAlgorithm"in l&&(f=this.getAlgorithmByOID(l.hashAlgorithm.algorithmId,!0).name),u.algorithm.hash.name=f}return this.verify(u.algorithm,a,c,e)}},Z7={name:"none",crypto:null};function l7(r){return!!(r&&typeof r=="object"&&"crypto"in r)}o(l7,"isCryptoEngine");function QS(r,...e){let t=null;if(e.length<2)e.length?t=e[0]:t=typeof self<"u"&&self.crypto?new Em({name:"browser",crypto:self.crypto}):null;else{let n=e[0],s=e[1];l7(s)?t=s:l7(n)?t=n:"subtle"in n&&"getRandomValues"in n&&(t=new Em({crypto:n}))}if(typeof process<"u"&&"pid"in process&&typeof global<"u"&&typeof window>"u"){if(typeof global[process.pid]>"u")global[process.pid]={};else if(typeof global[process.pid]!="object")throw new Error(`Name global.${process.pid} already exists and it is not an object`);if(typeof global[process.pid].pkijs>"u")global[process.pid].pkijs={};else if(typeof global[process.pid].pkijs!="object")throw new Error(`Name global.${process.pid}.pkijs already exists and it is not an object`);global[process.pid].pkijs.engine={name:r,crypto:t}}else Z7={name:r,crypto:t}}o(QS,"setEngine");function Rle(){if(typeof process<"u"&&"pid"in process&&typeof global<"u"&&typeof window>"u"){let r;try{r=global[process.pid].pkijs.engine}catch{throw new Error("Please call 'setEngine' before call to 'getEngine'")}return r}return Z7}o(Rle,"getEngine");function mt(r=!1){let e=Rle();if(!e.crypto&&r)throw new Error("Unable to create WebCrypto object");return e.crypto}o(mt,"getCrypto");function _le(r){if(r.byteLength%2!==0)return Kr;let e=r.byteLength/2,t=new ArrayBuffer(e);new Uint8Array(t).set(new Uint8Array(r,0,e));let s=new he({valueHex:t}),i=new ArrayBuffer(e);new Uint8Array(i).set(new Uint8Array(r,e,e));let u=new he({valueHex:i});return new K({value:[s.convertToDER(),u.convertToDER()]}).toBER(!1)}o(_le,"createCMSECDSASignature");function Ole(r,e){if(!(r instanceof K&&r.valueBlock.value.length===2&&r.valueBlock.value[0]instanceof he&&r.valueBlock.value[1]instanceof he))return Kr;let t=r.valueBlock.value[0].convertFromDER().valueBlock.valueHexView,n=r.valueBlock.value[1].convertFromDER().valueBlock.valueHexView,s=new Uint8Array(e*2);return s.set(t,e-t.byteLength),s.set(n,2*e-n.byteLength),s.buffer}o(Ole,"createECDSASignatureFromCMS");async function Ple(r,e,t,n,s){switch(r.toUpperCase()){case"SHA-1":case"SHA-256":case"SHA-384":case"SHA-512":break;default:throw new hr(`Unknown hash function: ${r}`)}if(hr.assert(e,"zBuffer","ArrayBuffer"),e.byteLength===0)throw new hr("'zBuffer' has zero length, error");if(hr.assert(n,"SharedInfo","ArrayBuffer"),t>255)throw new hr("Please set 'Counter' argument to value less or equal to 255");let i=new ArrayBuffer(4),a=new Uint8Array(i);a[0]=0,a[1]=0,a[2]=0,a[3]=t;let u=Kr;u=Al(u,e),u=Al(u,i),u=Al(u,n);let c=await s.digest({name:r},u);return{counter:t,result:c}}o(Ple,"kdfWithCounter");async function f7(r,e,t,n,s=mt(!0)){let i=0,a=1;switch(r.toUpperCase()){case"SHA-1":i=160;break;case"SHA-256":i=256;break;case"SHA-384":i=384;break;case"SHA-512":i=512;break;default:throw new hr(`Unknown hash function: ${r}`)}if(hr.assert(e,"Zbuffer","ArrayBuffer"),e.byteLength===0)throw new hr("'Zbuffer' has zero length, error");hr.assert(n,"SharedInfo","ArrayBuffer");let u=t/i;Math.floor(u)>0&&(a=Math.floor(u),u-a>0&&a++);let c=[];for(let d=1;d<=a;d++)c.push(await Ple(r,e,d,n,s));let l=Kr,f=1,h=!0;for(;h;){h=!1;for(let d of c)if(d.counter===f){l=Al(l,d.result),h=!0;break}f++}if(t>>=3,l.byteLength>t){let d=new ArrayBuffer(t),g=new Uint8Array(d),m=new Uint8Array(l);for(let v=0;v<t;v++)g[v]=m[v];return d}return l}o(f7,"kdf");var MB="version",jB="logID",qB="extensions",HB="timestamp",KB="hashAlgorithm",$B="signatureAlgorithm",XB="signature",h7="none",p7="md5",d7="sha1",m7="sha224",g7="sha256",y7="sha384",v7="sha512",x7="anonymous",E7="rsa",w7="dsa",b7="ecdsa",eH=class rc extends Se{static{o(this,"SignedCertificateTimestamp")}constructor(e={}){super(),this.version=B(e,MB,rc.defaultValues(MB)),this.logID=B(e,jB,rc.defaultValues(jB)),this.timestamp=B(e,HB,rc.defaultValues(HB)),this.extensions=B(e,qB,rc.defaultValues(qB)),this.hashAlgorithm=B(e,KB,rc.defaultValues(KB)),this.signatureAlgorithm=B(e,$B,rc.defaultValues($B)),this.signature=B(e,XB,rc.defaultValues(XB)),"stream"in e&&e.stream&&this.fromStream(e.stream),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case MB:return 0;case jB:case qB:return Kr;case HB:return new Date(0);case KB:case $B:return P;case XB:return Kr;default:return super.defaultValues(e)}}fromSchema(e){if(!(e instanceof iy))throw new Error("Object's schema was not verified against input data for SignedCertificateTimestamp");let t=new uo({stream:new On({buffer:e.data})});this.fromStream(t)}fromStream(e){let t=e.getUint16();if(this.version=e.getBlock(1)[0],this.version===0){this.logID=new Uint8Array(e.getBlock(32)).buffer.slice(0),this.timestamp=new Date(io(new Uint8Array(e.getBlock(8)),8));let n=e.getUint16();switch(this.extensions=new Uint8Array(e.getBlock(n)).buffer.slice(0),e.getBlock(1)[0]){case 0:this.hashAlgorithm=h7;break;case 1:this.hashAlgorithm=p7;break;case 2:this.hashAlgorithm=d7;break;case 3:this.hashAlgorithm=m7;break;case 4:this.hashAlgorithm=g7;break;case 5:this.hashAlgorithm=y7;break;case 6:this.hashAlgorithm=v7;break;default:throw new Error("Object's stream was not correct for SignedCertificateTimestamp")}switch(e.getBlock(1)[0]){case 0:this.signatureAlgorithm=x7;break;case 1:this.signatureAlgorithm=E7;break;case 2:this.signatureAlgorithm=w7;break;case 3:this.signatureAlgorithm=b7;break;default:throw new Error("Object's stream was not correct for SignedCertificateTimestamp")}let s=e.getUint16();if(this.signature=new Uint8Array(e.getBlock(s)).buffer.slice(0),t!==47+n+s)throw new Error("Object's stream was not correct for SignedCertificateTimestamp")}}toSchema(){let e=this.toStream();return new iy({data:e.stream.buffer})}toStream(){let e=new uo;e.appendUint16(47+this.extensions.byteLength+this.signature.byteLength),e.appendChar(this.version),e.appendView(new Uint8Array(this.logID));let t=new ArrayBuffer(8),n=new Uint8Array(t),s=_i(this.timestamp.valueOf(),8);n.set(new Uint8Array(s),8-s.byteLength),e.appendView(n),e.appendUint16(this.extensions.byteLength),this.extensions.byteLength&&e.appendView(new Uint8Array(this.extensions));let i;switch(this.hashAlgorithm.toLowerCase()){case h7:i=0;break;case p7:i=1;break;case d7:i=2;break;case m7:i=3;break;case g7:i=4;break;case y7:i=5;break;case v7:i=6;break;default:throw new Error(`Incorrect data for hashAlgorithm: ${this.hashAlgorithm}`)}e.appendChar(i);let a;switch(this.signatureAlgorithm.toLowerCase()){case x7:a=0;break;case E7:a=1;break;case w7:a=2;break;case b7:a=3;break;default:throw new Error(`Incorrect data for signatureAlgorithm: ${this.signatureAlgorithm}`)}return e.appendChar(a),e.appendUint16(this.signature.byteLength),e.appendView(new Uint8Array(this.signature)),e}toJSON(){return{version:this.version,logID:Jw(this.logID),timestamp:this.timestamp,extensions:Jw(this.extensions),hashAlgorithm:this.hashAlgorithm,signatureAlgorithm:this.signatureAlgorithm,signature:Jw(this.signature)}}async verify(e,t,n=0,s=mt(!0)){let i=Qw(Qg(this.logID)),a=null,u=new uo;for(let g of e)if(g.log_id===i){a=g.key;break}if(!a)throw new Error(`Public key not found for CT with logId: ${i}`);let c=Cl(Ip(a)),l=qi.fromBER(c);u.appendChar(0),u.appendChar(0);let f=new ArrayBuffer(8),h=new Uint8Array(f),d=_i(this.timestamp.valueOf(),8);return h.set(new Uint8Array(d),8-d.byteLength),u.appendView(h),u.appendUint16(n),n===0&&u.appendUint24(t.byteLength),u.appendView(new Uint8Array(t)),u.appendUint16(this.extensions.byteLength),this.extensions.byteLength!==0&&u.appendView(new Uint8Array(this.extensions)),s.verifyWithPublicKey(u.buffer.slice(0,u.length),new Be({valueHex:this.signature}),l,{algorithmId:P},"SHA-256")}};eH.CLASS_NAME="SignedCertificateTimestamp";var vb="timestamps",tH=class rH extends Se{static{o(this,"SignedCertificateTimestampList")}constructor(e={}){super(),this.timestamps=B(e,vb,rH.defaultValues(vb)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case vb:return[];default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case vb:return t.length===0;default:return super.defaultValues(e)}}static schema(e={}){var t;let n=B(e,"names",{});return(t=n.optional)!==null&&t!==void 0||(n.optional=!1),new Be({name:n.blockName||"SignedCertificateTimestampList",optional:n.optional})}fromSchema(e){if(!(e instanceof Be))throw new Error("Object's schema was not verified against input data for SignedCertificateTimestampList");let t=new uo({stream:new On({buffer:e.valueBlock.valueHex})});if(t.getUint16()!==t.length)throw new Error("Object's schema was not verified against input data for SignedCertificateTimestampList");for(;t.length;)this.timestamps.push(new eH({stream:t}))}toSchema(){let e=new uo,t=0,n=[];for(let s of this.timestamps){let i=s.toStream();n.push(i),t+=i.stream.buffer.byteLength}e.appendUint16(t);for(let s of n)e.appendView(s.stream.view);return new Be({valueHex:e.stream.buffer.slice(0)})}toJSON(){return{timestamps:Array.from(this.timestamps,e=>e.toJSON())}}};tH.CLASS_NAME="SignedCertificateTimestampList";var m1="attributes",kle=[m1],nH=class UR extends Se{static{o(this,"SubjectDirectoryAttributes")}constructor(e={}){super(),this.attributes=B(e,m1,UR.defaultValues(m1)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case m1:return[];default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new lt({name:t.attributes||P,value:$r.schema()})]})}fromSchema(e){Ce(e,kle);let t=be(e,e,UR.schema({names:{attributes:m1}}));ye.assertSchema(t,this.className),this.attributes=Array.from(t.result.attributes,n=>new $r({schema:n}))}toSchema(){return new K({value:Array.from(this.attributes,e=>e.toSchema())})}toJSON(){return{attributes:Array.from(this.attributes,e=>e.toJSON())}}};nH.CLASS_NAME="SubjectDirectoryAttributes";var Lle=class Lr{static{o(this,"ExtensionValueFactory")}static getItems(){return this.types||(this.types={},Lr.register(D7,"SubjectAltName",gR),Lr.register(B7,"IssuerAltName",gR),Lr.register(w_,"AuthorityKeyIdentifier",C_),Lr.register(x_,"BasicConstraints",N_),Lr.register(Yce,"MicrosoftCaVersion",j7),Lr.register(k7,"CertificatePolicies",bR),Lr.register($ce,"CertificatePoliciesMicrosoft",bR),Lr.register(Jce,"MicrosoftCertTemplateV2",ole),Lr.register(P7,"CRLDistributionPoints",CR),Lr.register(E_,"FreshestCRL",CR),Lr.register(Xce,"ExtKeyUsage",K7),Lr.register(_7,"CertificateIssuer",Pn),Lr.register(b_,"AuthorityInfoAccess",IR),Lr.register(zce,"SubjectInfoAccess",IR),Lr.register(R7,"IssuingDistributionPoint",X7),Lr.register(O7,"NameConstraints",G7),Lr.register(F7,"PolicyConstraints",z7),Lr.register(L7,"PolicyMappings",W7),Lr.register(Mce,"PrivateKeyUsagePeriod",J7),Lr.register(Qce,"QCStatements",Y7),Lr.register(Wce,"SignedCertificateTimestampList",tH),Lr.register(Fce,"SubjectDirectoryAttributes",nH)),this.types}static fromBER(e,t){let n=Or(t);if(n.offset===-1)return null;let s=this.find(e);if(s)try{return new s.type({schema:n.result})}catch{let i=new s.type;return i.parsingError=`Incorrectly formatted value of extension ${s.name} (${e})`,i}return n.result}static find(e){return this.getItems()[e]||null}static register(e,t,n){this.getItems()[e]={name:t,type:n}}},g1="extnID",nc="critical",y1="extnValue",xb="parsedValue",Fle=[g1,nc,y1],di=class sc extends Se{static{o(this,"Extension")}get parsedValue(){if(this._parsedValue===void 0){let e=Lle.fromBER(this.extnID,this.extnValue.valueBlock.valueHexView);this._parsedValue=e}return this._parsedValue||void 0}set parsedValue(e){this._parsedValue=e}constructor(e={}){super(),this.extnID=B(e,g1,sc.defaultValues(g1)),this.critical=B(e,nc,sc.defaultValues(nc)),y1 in e?this.extnValue=new Be({valueHex:e.extnValue}):this.extnValue=sc.defaultValues(y1),xb in e&&(this.parsedValue=B(e,xb,sc.defaultValues(xb))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case g1:return P;case nc:return!1;case y1:return new Be;case xb:return{};default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new He({name:t.extnID||P}),new Oi({name:t.critical||P,optional:!0}),new Be({name:t.extnValue||P})]})}fromSchema(e){Ce(e,Fle);let t=be(e,e,sc.schema({names:{extnID:g1,critical:nc,extnValue:y1}}));ye.assertSchema(t,this.className),this.extnID=t.result.extnID.valueBlock.toString(),nc in t.result&&(this.critical=t.result.critical.valueBlock.value),this.extnValue=t.result.extnValue}toSchema(){let e=[];return e.push(new He({value:this.extnID})),this.critical!==sc.defaultValues(nc)&&e.push(new Oi({value:this.critical})),e.push(this.extnValue),new K({value:e})}toJSON(){let e={extnID:this.extnID,extnValue:this.extnValue.toJSON()};return this.critical!==sc.defaultValues(nc)&&(e.critical=this.critical),this.parsedValue&&this.parsedValue.toJSON&&(e.parsedValue=this.parsedValue.toJSON()),e}};di.CLASS_NAME="Extension";var v1="extensions",Ule=[v1],un=class VR extends Se{static{o(this,"Extensions")}constructor(e={}){super(),this.extensions=B(e,v1,VR.defaultValues(v1)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case v1:return[];default:return super.defaultValues(e)}}static schema(e={},t=!1){let n=B(e,"names",{});return new K({optional:t,name:n.blockName||P,value:[new lt({name:n.extensions||P,value:di.schema(n.extension||{})})]})}fromSchema(e){Ce(e,Ule);let t=be(e,e,VR.schema({names:{extensions:v1}}));ye.assertSchema(t,this.className),this.extensions=Array.from(t.result.extensions,n=>new di({schema:n}))}toSchema(){return new K({value:Array.from(this.extensions,e=>e.toSchema())})}toJSON(){return{extensions:this.extensions.map(e=>e.toJSON())}}};un.CLASS_NAME="Extensions";var x1="issuer",E1="serialNumber",Jl="issuerUID",Vle=[x1,E1,Jl],Na=class w1 extends Se{static{o(this,"IssuerSerial")}constructor(e={}){super(),this.issuer=B(e,x1,w1.defaultValues(x1)),this.serialNumber=B(e,E1,w1.defaultValues(E1)),Jl in e&&(this.issuerUID=B(e,Jl,w1.defaultValues(Jl))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case x1:return new Pn;case E1:return new he;case Jl:return new Ct;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[Pn.schema(t.issuer||{}),new he({name:t.serialNumber||P}),new Ct({optional:!0,name:t.issuerUID||P})]})}fromSchema(e){Ce(e,Vle);let t=be(e,e,w1.schema({names:{issuer:{names:{blockName:x1}},serialNumber:E1,issuerUID:Jl}}));ye.assertSchema(t,this.className),this.issuer=new Pn({schema:t.result.issuer}),this.serialNumber=t.result.serialNumber,Jl in t.result&&(this.issuerUID=t.result.issuerUID)}toSchema(){let e=new K({value:[this.issuer.toSchema(),this.serialNumber]});return this.issuerUID&&e.valueBlock.value.push(this.issuerUID),e}toJSON(){let e={issuer:this.issuer.toJSON(),serialNumber:this.serialNumber.toJSON()};return this.issuerUID&&(e.issuerUID=this.issuerUID.toJSON()),e}};Na.CLASS_NAME="IssuerSerial";var b1="version",Yl="baseCertificateID",Ql="subjectName",S1="issuer",A1="signature",C1="serialNumber",N1="attrCertValidityPeriod",T1="attributes",Zl="issuerUniqueID",ef="extensions",Mle=[b1,Yl,Ql,S1,A1,C1,N1,T1,Zl,ef],rS=class hi extends Se{static{o(this,"AttributeCertificateInfoV1")}constructor(e={}){super(),this.version=B(e,b1,hi.defaultValues(b1)),Yl in e&&(this.baseCertificateID=B(e,Yl,hi.defaultValues(Yl))),Ql in e&&(this.subjectName=B(e,Ql,hi.defaultValues(Ql))),this.issuer=B(e,S1,hi.defaultValues(S1)),this.signature=B(e,A1,hi.defaultValues(A1)),this.serialNumber=B(e,C1,hi.defaultValues(C1)),this.attrCertValidityPeriod=B(e,N1,hi.defaultValues(N1)),this.attributes=B(e,T1,hi.defaultValues(T1)),Zl in e&&(this.issuerUniqueID=B(e,Zl,hi.defaultValues(Zl))),ef in e&&(this.extensions=B(e,ef,hi.defaultValues(ef))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case b1:return 0;case Yl:return new Na;case Ql:return new Pn;case S1:return new Pn;case A1:return new pe;case C1:return new he;case N1:return new Jf;case T1:return[];case Zl:return new Ct;case ef:return new un;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new he({name:t.version||P}),new Sr({value:[new ae({name:t.baseCertificateID||P,idBlock:{tagClass:3,tagNumber:0},value:Na.schema().valueBlock.value}),new ae({name:t.subjectName||P,idBlock:{tagClass:3,tagNumber:1},value:Pn.schema().valueBlock.value})]}),Pn.schema({names:{blockName:t.issuer||P}}),pe.schema(t.signature||{}),new he({name:t.serialNumber||P}),Jf.schema(t.attrCertValidityPeriod||{}),new K({name:t.attributes||P,value:[new lt({value:$r.schema()})]}),new Ct({optional:!0,name:t.issuerUniqueID||P}),un.schema(t.extensions||{},!0)]})}fromSchema(e){Ce(e,Mle);let t=be(e,e,hi.schema({names:{version:b1,baseCertificateID:Yl,subjectName:Ql,issuer:S1,signature:{names:{blockName:A1}},serialNumber:C1,attrCertValidityPeriod:{names:{blockName:N1}},attributes:T1,issuerUniqueID:Zl,extensions:{names:{blockName:ef}}}}));ye.assertSchema(t,this.className),this.version=t.result.version.valueBlock.valueDec,Yl in t.result&&(this.baseCertificateID=new Na({schema:new K({value:t.result.baseCertificateID.valueBlock.value})})),Ql in t.result&&(this.subjectName=new Pn({schema:new K({value:t.result.subjectName.valueBlock.value})})),this.issuer=t.result.issuer,this.signature=new pe({schema:t.result.signature}),this.serialNumber=t.result.serialNumber,this.attrCertValidityPeriod=new Jf({schema:t.result.attrCertValidityPeriod}),this.attributes=Array.from(t.result.attributes.valueBlock.value,n=>new $r({schema:n})),Zl in t.result&&(this.issuerUniqueID=t.result.issuerUniqueID),ef in t.result&&(this.extensions=new un({schema:t.result.extensions}))}toSchema(){let e=new K({value:[new he({value:this.version})]});return this.baseCertificateID&&e.valueBlock.value.push(new ae({idBlock:{tagClass:3,tagNumber:0},value:this.baseCertificateID.toSchema().valueBlock.value})),this.subjectName&&e.valueBlock.value.push(new ae({idBlock:{tagClass:3,tagNumber:1},value:this.subjectName.toSchema().valueBlock.value})),e.valueBlock.value.push(this.issuer.toSchema()),e.valueBlock.value.push(this.signature.toSchema()),e.valueBlock.value.push(this.serialNumber),e.valueBlock.value.push(this.attrCertValidityPeriod.toSchema()),e.valueBlock.value.push(new K({value:Array.from(this.attributes,t=>t.toSchema())})),this.issuerUniqueID&&e.valueBlock.value.push(this.issuerUniqueID),this.extensions&&e.valueBlock.value.push(this.extensions.toSchema()),e}toJSON(){let e={version:this.version};return this.baseCertificateID&&(e.baseCertificateID=this.baseCertificateID.toJSON()),this.subjectName&&(e.subjectName=this.subjectName.toJSON()),e.issuer=this.issuer.toJSON(),e.signature=this.signature.toJSON(),e.serialNumber=this.serialNumber.toJSON(),e.attrCertValidityPeriod=this.attrCertValidityPeriod.toJSON(),e.attributes=Array.from(this.attributes,t=>t.toJSON()),this.issuerUniqueID&&(e.issuerUniqueID=this.issuerUniqueID.toJSON()),this.extensions&&(e.extensions=this.extensions.toJSON()),e}};rS.CLASS_NAME="AttributeCertificateInfoV1";var I1="acinfo",D1="signatureAlgorithm",B1="signatureValue",jle=[I1,B1,D1],ZS=class R1 extends Se{static{o(this,"AttributeCertificateV1")}constructor(e={}){super(),this.acinfo=B(e,I1,R1.defaultValues(I1)),this.signatureAlgorithm=B(e,D1,R1.defaultValues(D1)),this.signatureValue=B(e,B1,R1.defaultValues(B1)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case I1:return new rS;case D1:return new pe;case B1:return new Ct;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[rS.schema(t.acinfo||{}),pe.schema(t.signatureAlgorithm||{}),new Ct({name:t.signatureValue||P})]})}fromSchema(e){Ce(e,jle);let t=be(e,e,R1.schema({names:{acinfo:{names:{blockName:I1}},signatureAlgorithm:{names:{blockName:D1}},signatureValue:B1}}));ye.assertSchema(t,this.className),this.acinfo=new rS({schema:t.result.acinfo}),this.signatureAlgorithm=new pe({schema:t.result.signatureAlgorithm}),this.signatureValue=t.result.signatureValue}toSchema(){return new K({value:[this.acinfo.toSchema(),this.signatureAlgorithm.toSchema(),this.signatureValue]})}toJSON(){return{acinfo:this.acinfo.toJSON(),signatureAlgorithm:this.signatureAlgorithm.toJSON(),signatureValue:this.signatureValue.toJSON()}}};ZS.CLASS_NAME="AttributeCertificateV1";var _1="digestedObjectType",tf="otherObjectTypeID",O1="digestAlgorithm",P1="objectDigest",qle=[_1,tf,O1,P1],Yf=class Zp extends Se{static{o(this,"ObjectDigestInfo")}constructor(e={}){super(),this.digestedObjectType=B(e,_1,Zp.defaultValues(_1)),tf in e&&(this.otherObjectTypeID=B(e,tf,Zp.defaultValues(tf))),this.digestAlgorithm=B(e,O1,Zp.defaultValues(O1)),this.objectDigest=B(e,P1,Zp.defaultValues(P1)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case _1:return new _u;case tf:return new He;case O1:return new pe;case P1:return new Ct;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new _u({name:t.digestedObjectType||P}),new He({optional:!0,name:t.otherObjectTypeID||P}),pe.schema(t.digestAlgorithm||{}),new Ct({name:t.objectDigest||P})]})}fromSchema(e){Ce(e,qle);let t=be(e,e,Zp.schema({names:{digestedObjectType:_1,otherObjectTypeID:tf,digestAlgorithm:{names:{blockName:O1}},objectDigest:P1}}));ye.assertSchema(t,this.className),this.digestedObjectType=t.result.digestedObjectType,tf in t.result&&(this.otherObjectTypeID=t.result.otherObjectTypeID),this.digestAlgorithm=new pe({schema:t.result.digestAlgorithm}),this.objectDigest=t.result.objectDigest}toSchema(){let e=new K({value:[this.digestedObjectType]});return this.otherObjectTypeID&&e.valueBlock.value.push(this.otherObjectTypeID),e.valueBlock.value.push(this.digestAlgorithm.toSchema()),e.valueBlock.value.push(this.objectDigest),e}toJSON(){let e={digestedObjectType:this.digestedObjectType.toJSON(),digestAlgorithm:this.digestAlgorithm.toJSON(),objectDigest:this.objectDigest.toJSON()};return this.otherObjectTypeID&&(e.otherObjectTypeID=this.otherObjectTypeID.toJSON()),e}};Yf.CLASS_NAME="ObjectDigestInfo";var rf="issuerName",nf="baseCertificateID",sf="objectDigestInfo",Hle=[rf,nf,sf],MR=class k1 extends Se{static{o(this,"V2Form")}constructor(e={}){super(),rf in e&&(this.issuerName=B(e,rf,k1.defaultValues(rf))),nf in e&&(this.baseCertificateID=B(e,nf,k1.defaultValues(nf))),sf in e&&(this.objectDigestInfo=B(e,sf,k1.defaultValues(sf))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case rf:return new Pn;case nf:return new Na;case sf:return new Yf;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[Pn.schema({names:{blockName:t.issuerName}},!0),new ae({optional:!0,name:t.baseCertificateID||P,idBlock:{tagClass:3,tagNumber:0},value:Na.schema().valueBlock.value}),new ae({optional:!0,name:t.objectDigestInfo||P,idBlock:{tagClass:3,tagNumber:1},value:Yf.schema().valueBlock.value})]})}fromSchema(e){Ce(e,Hle);let t=be(e,e,k1.schema({names:{issuerName:rf,baseCertificateID:nf,objectDigestInfo:sf}}));ye.assertSchema(t,this.className),rf in t.result&&(this.issuerName=new Pn({schema:t.result.issuerName})),nf in t.result&&(this.baseCertificateID=new Na({schema:new K({value:t.result.baseCertificateID.valueBlock.value})})),sf in t.result&&(this.objectDigestInfo=new Yf({schema:new K({value:t.result.objectDigestInfo.valueBlock.value})}))}toSchema(){let e=new K;return this.issuerName&&e.valueBlock.value.push(this.issuerName.toSchema()),this.baseCertificateID&&e.valueBlock.value.push(new ae({idBlock:{tagClass:3,tagNumber:0},value:this.baseCertificateID.toSchema().valueBlock.value})),this.objectDigestInfo&&e.valueBlock.value.push(new ae({idBlock:{tagClass:3,tagNumber:1},value:this.objectDigestInfo.toSchema().valueBlock.value})),e}toJSON(){let e={};return this.issuerName&&(e.issuerName=this.issuerName.toJSON()),this.baseCertificateID&&(e.baseCertificateID=this.baseCertificateID.toJSON()),this.objectDigestInfo&&(e.objectDigestInfo=this.objectDigestInfo.toJSON()),e}};MR.CLASS_NAME="V2Form";var af="baseCertificateID",of="entityName",uf="objectDigestInfo",Kle=[af,of,uf],nS=class L1 extends Se{static{o(this,"Holder")}constructor(e={}){super(),af in e&&(this.baseCertificateID=B(e,af,L1.defaultValues(af))),of in e&&(this.entityName=B(e,of,L1.defaultValues(of))),uf in e&&(this.objectDigestInfo=B(e,uf,L1.defaultValues(uf))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case af:return new Na;case of:return new Pn;case uf:return new Yf;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new ae({optional:!0,name:t.baseCertificateID||P,idBlock:{tagClass:3,tagNumber:0},value:Na.schema().valueBlock.value}),new ae({optional:!0,name:t.entityName||P,idBlock:{tagClass:3,tagNumber:1},value:Pn.schema().valueBlock.value}),new ae({optional:!0,name:t.objectDigestInfo||P,idBlock:{tagClass:3,tagNumber:2},value:Yf.schema().valueBlock.value})]})}fromSchema(e){Ce(e,Kle);let t=be(e,e,L1.schema({names:{baseCertificateID:af,entityName:of,objectDigestInfo:uf}}));ye.assertSchema(t,this.className),af in t.result&&(this.baseCertificateID=new Na({schema:new K({value:t.result.baseCertificateID.valueBlock.value})})),of in t.result&&(this.entityName=new Pn({schema:new K({value:t.result.entityName.valueBlock.value})})),uf in t.result&&(this.objectDigestInfo=new Yf({schema:new K({value:t.result.objectDigestInfo.valueBlock.value})}))}toSchema(){let e=new K;return this.baseCertificateID&&e.valueBlock.value.push(new ae({idBlock:{tagClass:3,tagNumber:0},value:this.baseCertificateID.toSchema().valueBlock.value})),this.entityName&&e.valueBlock.value.push(new ae({idBlock:{tagClass:3,tagNumber:1},value:this.entityName.toSchema().valueBlock.value})),this.objectDigestInfo&&e.valueBlock.value.push(new ae({idBlock:{tagClass:3,tagNumber:2},value:this.objectDigestInfo.toSchema().valueBlock.value})),e}toJSON(){let e={};return this.baseCertificateID&&(e.baseCertificateID=this.baseCertificateID.toJSON()),this.entityName&&(e.entityName=this.entityName.toJSON()),this.objectDigestInfo&&(e.objectDigestInfo=this.objectDigestInfo.toJSON()),e}};nS.CLASS_NAME="Holder";var F1="version",U1="holder",V1="issuer",M1="signature",j1="serialNumber",q1="attrCertValidityPeriod",H1="attributes",cf="issuerUniqueID",lf="extensions",$le=[F1,U1,V1,M1,j1,q1,H1,cf,lf],sS=class Fi extends Se{static{o(this,"AttributeCertificateInfoV2")}constructor(e={}){super(),this.version=B(e,F1,Fi.defaultValues(F1)),this.holder=B(e,U1,Fi.defaultValues(U1)),this.issuer=B(e,V1,Fi.defaultValues(V1)),this.signature=B(e,M1,Fi.defaultValues(M1)),this.serialNumber=B(e,j1,Fi.defaultValues(j1)),this.attrCertValidityPeriod=B(e,q1,Fi.defaultValues(q1)),this.attributes=B(e,H1,Fi.defaultValues(H1)),cf in e&&(this.issuerUniqueID=B(e,cf,Fi.defaultValues(cf))),lf in e&&(this.extensions=B(e,lf,Fi.defaultValues(lf))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case F1:return 1;case U1:return new nS;case V1:return{};case M1:return new pe;case j1:return new he;case q1:return new Jf;case H1:return[];case cf:return new Ct;case lf:return new un;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new he({name:t.version||P}),nS.schema(t.holder||{}),new Sr({value:[Pn.schema({names:{blockName:t.issuer||P}}),new ae({name:t.issuer||P,idBlock:{tagClass:3,tagNumber:0},value:MR.schema().valueBlock.value})]}),pe.schema(t.signature||{}),new he({name:t.serialNumber||P}),Jf.schema(t.attrCertValidityPeriod||{}),new K({name:t.attributes||P,value:[new lt({value:$r.schema()})]}),new Ct({optional:!0,name:t.issuerUniqueID||P}),un.schema(t.extensions||{},!0)]})}fromSchema(e){Ce(e,$le);let t=be(e,e,Fi.schema({names:{version:F1,holder:{names:{blockName:U1}},issuer:V1,signature:{names:{blockName:M1}},serialNumber:j1,attrCertValidityPeriod:{names:{blockName:q1}},attributes:H1,issuerUniqueID:cf,extensions:{names:{blockName:lf}}}}));switch(ye.assertSchema(t,this.className),this.version=t.result.version.valueBlock.valueDec,this.holder=new nS({schema:t.result.holder}),t.result.issuer.idBlock.tagClass){case 3:this.issuer=new MR({schema:new K({value:t.result.issuer.valueBlock.value})});break;case 1:default:throw new Error("Incorrect value for 'issuer' in AttributeCertificateInfoV2")}this.signature=new pe({schema:t.result.signature}),this.serialNumber=t.result.serialNumber,this.attrCertValidityPeriod=new Jf({schema:t.result.attrCertValidityPeriod}),this.attributes=Array.from(t.result.attributes.valueBlock.value,n=>new $r({schema:n})),cf in t.result&&(this.issuerUniqueID=t.result.issuerUniqueID),lf in t.result&&(this.extensions=new un({schema:t.result.extensions}))}toSchema(){let e=new K({value:[new he({value:this.version}),this.holder.toSchema(),new ae({idBlock:{tagClass:3,tagNumber:0},value:this.issuer.toSchema().valueBlock.value}),this.signature.toSchema(),this.serialNumber,this.attrCertValidityPeriod.toSchema(),new K({value:Array.from(this.attributes,t=>t.toSchema())})]});return this.issuerUniqueID&&e.valueBlock.value.push(this.issuerUniqueID),this.extensions&&e.valueBlock.value.push(this.extensions.toSchema()),e}toJSON(){let e={version:this.version,holder:this.holder.toJSON(),issuer:this.issuer.toJSON(),signature:this.signature.toJSON(),serialNumber:this.serialNumber.toJSON(),attrCertValidityPeriod:this.attrCertValidityPeriod.toJSON(),attributes:Array.from(this.attributes,t=>t.toJSON())};return this.issuerUniqueID&&(e.issuerUniqueID=this.issuerUniqueID.toJSON()),this.extensions&&(e.extensions=this.extensions.toJSON()),e}};sS.CLASS_NAME="AttributeCertificateInfoV2";var K1="acinfo",$1="signatureAlgorithm",X1="signatureValue",Xle=[K1,$1,X1],_c=class G1 extends Se{static{o(this,"AttributeCertificateV2")}constructor(e={}){super(),this.acinfo=B(e,K1,G1.defaultValues(K1)),this.signatureAlgorithm=B(e,$1,G1.defaultValues($1)),this.signatureValue=B(e,X1,G1.defaultValues(X1)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case K1:return new sS;case $1:return new pe;case X1:return new Ct;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[sS.schema(t.acinfo||{}),pe.schema(t.signatureAlgorithm||{}),new Ct({name:t.signatureValue||P})]})}fromSchema(e){Ce(e,Xle);let t=be(e,e,G1.schema({names:{acinfo:{names:{blockName:K1}},signatureAlgorithm:{names:{blockName:$1}},signatureValue:X1}}));ye.assertSchema(t,this.className),this.acinfo=new sS({schema:t.result.acinfo}),this.signatureAlgorithm=new pe({schema:t.result.signatureAlgorithm}),this.signatureValue=t.result.signatureValue}toSchema(){return new K({value:[this.acinfo.toSchema(),this.signatureAlgorithm.toSchema(),this.signatureValue]})}toJSON(){return{acinfo:this.acinfo.toJSON(),signatureAlgorithm:this.signatureAlgorithm.toJSON(),signatureValue:this.signatureValue.toJSON()}}};_c.CLASS_NAME="AttributeCertificateV2";var ff="contentType",ed="content",Gle=[ff,ed],Fr=class iS extends Se{static{o(this,"ContentInfo")}constructor(e={}){super(),this.contentType=B(e,ff,iS.defaultValues(ff)),this.content=B(e,ed,iS.defaultValues(ed)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case ff:return P;case ed:return new it;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case ff:return typeof t=="string"&&t===this.defaultValues(ff);case ed:return t instanceof it;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return"optional"in t||(t.optional=!1),new K({name:t.blockName||"ContentInfo",optional:t.optional,value:[new He({name:t.contentType||ff}),new ae({idBlock:{tagClass:3,tagNumber:0},value:[new it({name:t.content||ed})]})]})}fromSchema(e){Ce(e,Gle);let t=be(e,e,iS.schema());ye.assertSchema(t,this.className),this.contentType=t.result.contentType.valueBlock.toString(),this.content=t.result.content}toSchema(){return new K({value:[new He({value:this.contentType}),new ae({idBlock:{tagClass:3,tagNumber:0},value:[this.content]})]})}toJSON(){let e={contentType:this.contentType};return this.content instanceof it||(e.content=this.content.toJSON()),e}};Fr.CLASS_NAME="ContentInfo";Fr.DATA=S_;Fr.SIGNED_DATA=U7;Fr.ENVELOPED_DATA=V7;Fr.ENCRYPTED_DATA=M7;var GB="type",zB="value",jR="utcTimeName",qR="generalTimeName",zle=[jR,qR],S7;(function(r){r[r.UTCTime=0]="UTCTime",r[r.GeneralizedTime=1]="GeneralizedTime",r[r.empty=2]="empty"})(S7||(S7={}));var kn=class aS extends Se{static{o(this,"Time")}constructor(e={}){super(),this.type=B(e,GB,aS.defaultValues(GB)),this.value=B(e,zB,aS.defaultValues(zB)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case GB:return 0;case zB:return new Date(0,0,0);default:return super.defaultValues(e)}}static schema(e={},t=!1){let n=B(e,"names",{});return new Sr({optional:t,value:[new Il({name:n.utcTimeName||P}),new br({name:n.generalTimeName||P})]})}fromSchema(e){Ce(e,zle);let t=be(e,e,aS.schema({names:{utcTimeName:jR,generalTimeName:qR}}));ye.assertSchema(t,this.className),jR in t.result&&(this.type=0,this.value=t.result.utcTimeName.toDate()),qR in t.result&&(this.type=1,this.value=t.result.generalTimeName.toDate())}toSchema(){return this.type===0?new Il({valueDate:this.value}):this.type===1?new br({valueDate:this.value}):{}}toJSON(){return{type:this.type,value:this.value}}};kn.CLASS_NAME="Time";var WB="tbs",ic="version",oS="serialNumber",uS="signature",cS="issuer",lS="notBefore",fS="notAfter",hS="subject",pS="subjectPublicKeyInfo",z1="issuerUniqueID",W1="subjectUniqueID",J1="extensions",Y1="signatureAlgorithm",Q1="signatureValue",qs="tbsCertificate",eA=`${qs}.${ic}`,T_=`${qs}.${oS}`,I_=`${qs}.${uS}`,D_=`${qs}.${cS}`,tA=`${qs}.${lS}`,rA=`${qs}.${fS}`,B_=`${qs}.${hS}`,R_=`${qs}.${pS}`,nA=`${qs}.${z1}`,sA=`${qs}.${W1}`,Kv=`${qs}.${J1}`,Wle=[qs,eA,T_,I_,D_,tA,rA,B_,R_,nA,sA,Kv,Y1,Q1];function Jle(r={}){let e=B(r,"names",{});return new K({name:e.blockName||qs,value:[new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new he({name:e.tbsCertificateVersion||eA})]}),new he({name:e.tbsCertificateSerialNumber||T_}),pe.schema(e.signature||{names:{blockName:I_}}),Ar.schema(e.issuer||{names:{blockName:D_}}),new K({name:e.tbsCertificateValidity||"tbsCertificate.validity",value:[kn.schema(e.notBefore||{names:{utcTimeName:tA,generalTimeName:tA}}),kn.schema(e.notAfter||{names:{utcTimeName:rA,generalTimeName:rA}})]}),Ar.schema(e.subject||{names:{blockName:B_}}),qi.schema(e.subjectPublicKeyInfo||{names:{blockName:R_}}),new tt({name:e.tbsCertificateIssuerUniqueID||nA,optional:!0,idBlock:{tagClass:3,tagNumber:1}}),new tt({name:e.tbsCertificateSubjectUniqueID||sA,optional:!0,idBlock:{tagClass:3,tagNumber:2}}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:3},value:[un.schema(e.extensions||{names:{blockName:Kv}})]})]})}o(Jle,"tbsCertificate");var Gn=class on extends Se{static{o(this,"Certificate")}get tbs(){return Ze.toArrayBuffer(this.tbsView)}set tbs(e){this.tbsView=new Uint8Array(e)}constructor(e={}){super(),this.tbsView=new Uint8Array(B(e,WB,on.defaultValues(WB))),this.version=B(e,ic,on.defaultValues(ic)),this.serialNumber=B(e,oS,on.defaultValues(oS)),this.signature=B(e,uS,on.defaultValues(uS)),this.issuer=B(e,cS,on.defaultValues(cS)),this.notBefore=B(e,lS,on.defaultValues(lS)),this.notAfter=B(e,fS,on.defaultValues(fS)),this.subject=B(e,hS,on.defaultValues(hS)),this.subjectPublicKeyInfo=B(e,pS,on.defaultValues(pS)),z1 in e&&(this.issuerUniqueID=B(e,z1,on.defaultValues(z1))),W1 in e&&(this.subjectUniqueID=B(e,W1,on.defaultValues(W1))),J1 in e&&(this.extensions=B(e,J1,on.defaultValues(J1))),this.signatureAlgorithm=B(e,Y1,on.defaultValues(Y1)),this.signatureValue=B(e,Q1,on.defaultValues(Q1)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case WB:return Kr;case ic:return 0;case oS:return new he;case uS:return new pe;case cS:return new Ar;case lS:return new kn;case fS:return new kn;case hS:return new Ar;case pS:return new qi;case z1:return Kr;case W1:return Kr;case J1:return[];case Y1:return new pe;case Q1:return new Ct;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[Jle(t.tbsCertificate),pe.schema(t.signatureAlgorithm||{names:{blockName:Y1}}),new Ct({name:t.signatureValue||Q1})]})}fromSchema(e){Ce(e,Wle);let t=be(e,e,on.schema({names:{tbsCertificate:{names:{extensions:{names:{extensions:Kv}}}}}}));ye.assertSchema(t,this.className),this.tbsView=t.result.tbsCertificate.valueBeforeDecodeView,eA in t.result&&(this.version=t.result[eA].valueBlock.valueDec),this.serialNumber=t.result[T_],this.signature=new pe({schema:t.result[I_]}),this.issuer=new Ar({schema:t.result[D_]}),this.notBefore=new kn({schema:t.result[tA]}),this.notAfter=new kn({schema:t.result[rA]}),this.subject=new Ar({schema:t.result[B_]}),this.subjectPublicKeyInfo=new qi({schema:t.result[R_]}),nA in t.result&&(this.issuerUniqueID=t.result[nA].valueBlock.valueHex),sA in t.result&&(this.subjectUniqueID=t.result[sA].valueBlock.valueHex),Kv in t.result&&(this.extensions=Array.from(t.result[Kv],n=>new di({schema:n}))),this.signatureAlgorithm=new pe({schema:t.result.signatureAlgorithm}),this.signatureValue=t.result.signatureValue}encodeTBS(){let e=[];return ic in this&&this.version!==on.defaultValues(ic)&&e.push(new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new he({value:this.version})]})),e.push(this.serialNumber),e.push(this.signature.toSchema()),e.push(this.issuer.toSchema()),e.push(new K({value:[this.notBefore.toSchema(),this.notAfter.toSchema()]})),e.push(this.subject.toSchema()),e.push(this.subjectPublicKeyInfo.toSchema()),this.issuerUniqueID&&e.push(new tt({optional:!0,idBlock:{tagClass:3,tagNumber:1},valueHex:this.issuerUniqueID})),this.subjectUniqueID&&e.push(new tt({optional:!0,idBlock:{tagClass:3,tagNumber:2},valueHex:this.subjectUniqueID})),this.extensions&&e.push(new ae({optional:!0,idBlock:{tagClass:3,tagNumber:3},value:[new K({value:Array.from(this.extensions,t=>t.toSchema())})]})),new K({value:e})}toSchema(e=!1){let t;if(e===!1){if(!this.tbsView.byteLength)return on.schema().value[0];let n=Or(this.tbsView);ye.assert(n,"TBS Certificate"),t=n.result}else t=this.encodeTBS();return new K({value:[t,this.signatureAlgorithm.toSchema(),this.signatureValue]})}toJSON(){let e={tbs:ut.ToHex(this.tbsView),version:this.version,serialNumber:this.serialNumber.toJSON(),signature:this.signature.toJSON(),issuer:this.issuer.toJSON(),notBefore:this.notBefore.toJSON(),notAfter:this.notAfter.toJSON(),subject:this.subject.toJSON(),subjectPublicKeyInfo:this.subjectPublicKeyInfo.toJSON(),signatureAlgorithm:this.signatureAlgorithm.toJSON(),signatureValue:this.signatureValue.toJSON()};return ic in this&&this.version!==on.defaultValues(ic)&&(e.version=this.version),this.issuerUniqueID&&(e.issuerUniqueID=ut.ToHex(this.issuerUniqueID)),this.subjectUniqueID&&(e.subjectUniqueID=ut.ToHex(this.subjectUniqueID)),this.extensions&&(e.extensions=Array.from(this.extensions,t=>t.toJSON())),e}async getPublicKey(e,t=mt(!0)){return t.getPublicKey(this.subjectPublicKeyInfo,this.signatureAlgorithm,e)}async getKeyHash(e="SHA-1",t=mt(!0)){return t.digest({name:e},this.subjectPublicKeyInfo.subjectPublicKey.valueBlock.valueHexView)}async sign(e,t="SHA-1",n=mt(!0)){if(!e)throw new Error("Need to provide a private key for signing");let s=await n.getSignatureParameters(e,t),i=s.parameters;this.signature=s.signatureAlgorithm,this.signatureAlgorithm=s.signatureAlgorithm,this.tbsView=new Uint8Array(this.encodeTBS().toBER());let a=await n.signWithPrivateKey(this.tbsView,e,i);this.signatureValue=new Ct({valueHex:a})}async verify(e,t=mt(!0)){let n;if(e?n=e.subjectPublicKeyInfo:this.issuer.isEqual(this.subject)&&(n=this.subjectPublicKeyInfo),!(n instanceof qi))throw new Error("Please provide issuer certificate as a parameter");return t.verifyWithPublicKey(this.tbsView,this.signatureValue,n,this.signatureAlgorithm)}};Gn.CLASS_NAME="Certificate";function sH(r,e=null){if(e&&r.issuer.isEqual(e.issuer)&&r.serialNumber.isEqual(e.serialNumber))return null;let t=!1;if(r.extensions){for(let n of r.extensions)if(n.extnID===x_&&n.parsedValue instanceof N_&&n.parsedValue.cA){t=!0;break}}return t?r:null}o(sH,"checkCA");var td="certId",rd="certValue",_p="parsedValue",Yle=[td,rd],iH=class Z1 extends Se{static{o(this,"CertBag")}constructor(e={}){super(),this.certId=B(e,td,Z1.defaultValues(td)),this.certValue=B(e,rd,Z1.defaultValues(rd)),_p in e&&(this.parsedValue=B(e,_p,Z1.defaultValues(_p))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case td:return P;case rd:return new it;case _p:return{};default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case td:return t===P;case rd:return t instanceof it;case _p:return t instanceof Object&&Object.keys(t).length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new He({name:t.id||"id"}),new ae({idBlock:{tagClass:3,tagNumber:0},value:[new it({name:t.value||"value"})]})]})}fromSchema(e){Ce(e,Yle);let t=be(e,e,Z1.schema({names:{id:td,value:rd}}));ye.assertSchema(t,this.className),this.certId=t.result.certId.valueBlock.toString(),this.certValue=t.result.certValue;let n=this.certValue.valueBlock.valueHexView;switch(this.certId){case i7:try{this.parsedValue=Gn.fromBER(n)}catch{_c.fromBER(n)}break;case a7:this.parsedValue=_c.fromBER(n);break;case ele:default:throw new Error(`Incorrect CERT_ID value in CertBag: ${this.certId}`)}}toSchema(){return _p in this&&("acinfo"in this.parsedValue?this.certId=a7:this.certId=i7,this.certValue=new Be({valueHex:this.parsedValue.toSchema().toBER(!1)})),new K({value:[new He({value:this.certId}),new ae({idBlock:{tagClass:3,tagNumber:0},value:["toSchema"in this.certValue?this.certValue.toSchema():this.certValue]})]})}toJSON(){return{certId:this.certId,certValue:this.certValue.toJSON()}}};iH.CLASS_NAME="CertBag";var ev="userCertificate",nd="revocationDate",hf="crlEntryExtensions",Qle=[ev,nd,hf],aH=class tv extends Se{static{o(this,"RevokedCertificate")}constructor(e={}){super(),this.userCertificate=B(e,ev,tv.defaultValues(ev)),this.revocationDate=B(e,nd,tv.defaultValues(nd)),hf in e&&(this.crlEntryExtensions=B(e,hf,tv.defaultValues(hf))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case ev:return new he;case nd:return new kn;case hf:return new un;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new he({name:t.userCertificate||ev}),kn.schema({names:{utcTimeName:t.revocationDate||nd,generalTimeName:t.revocationDate||nd}}),un.schema({names:{blockName:t.crlEntryExtensions||hf}},!0)]})}fromSchema(e){Ce(e,Qle);let t=be(e,e,tv.schema());ye.assertSchema(t,this.className),this.userCertificate=t.result.userCertificate,this.revocationDate=new kn({schema:t.result.revocationDate}),hf in t.result&&(this.crlEntryExtensions=new un({schema:t.result.crlEntryExtensions}))}toSchema(){let e=[this.userCertificate,this.revocationDate.toSchema()];return this.crlEntryExtensions&&e.push(this.crlEntryExtensions.toSchema()),new K({value:e})}toJSON(){let e={userCertificate:this.userCertificate.toJSON(),revocationDate:this.revocationDate.toJSON()};return this.crlEntryExtensions&&(e.crlEntryExtensions=this.crlEntryExtensions.toJSON()),e}};aH.CLASS_NAME="RevokedCertificate";var JB="tbs",fy="version",YB="signature",QB="issuer",ZB="thisUpdate",Eb="nextUpdate",wb="revokedCertificates",bb="crlExtensions",rv="signatureAlgorithm",nv="signatureValue",Bo="tbsCertList",iA=`${Bo}.version`,__=`${Bo}.signature`,O_=`${Bo}.issuer`,aA=`${Bo}.thisUpdate`,Qv=`${Bo}.nextUpdate`,oA=`${Bo}.revokedCertificates`,uA=`${Bo}.extensions`,Zle=[Bo,iA,__,O_,aA,Qv,oA,uA,rv,nv];function efe(r={}){let e=B(r,"names",{});return new K({name:e.blockName||Bo,value:[new he({optional:!0,name:e.tbsCertListVersion||iA,value:2}),pe.schema(e.signature||{names:{blockName:__}}),Ar.schema(e.issuer||{names:{blockName:O_}}),kn.schema(e.tbsCertListThisUpdate||{names:{utcTimeName:aA,generalTimeName:aA}}),kn.schema(e.tbsCertListNextUpdate||{names:{utcTimeName:Qv,generalTimeName:Qv}},!0),new K({optional:!0,value:[new lt({name:e.tbsCertListRevokedCertificates||oA,value:new K({value:[new he,kn.schema(),un.schema({},!0)]})})]}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[un.schema(e.crlExtensions||{names:{blockName:uA}})]})]})}o(efe,"tbsCertList");var tfe=[w_,B7,jce,qce,R7,E_,b_,Hce,Kce,_7],Zv=class rs extends Se{static{o(this,"CertificateRevocationList")}get tbs(){return Ze.toArrayBuffer(this.tbsView)}set tbs(e){this.tbsView=new Uint8Array(e)}constructor(e={}){super(),this.tbsView=new Uint8Array(B(e,JB,rs.defaultValues(JB))),this.version=B(e,fy,rs.defaultValues(fy)),this.signature=B(e,YB,rs.defaultValues(YB)),this.issuer=B(e,QB,rs.defaultValues(QB)),this.thisUpdate=B(e,ZB,rs.defaultValues(ZB)),Eb in e&&(this.nextUpdate=B(e,Eb,rs.defaultValues(Eb))),wb in e&&(this.revokedCertificates=B(e,wb,rs.defaultValues(wb))),bb in e&&(this.crlExtensions=B(e,bb,rs.defaultValues(bb))),this.signatureAlgorithm=B(e,rv,rs.defaultValues(rv)),this.signatureValue=B(e,nv,rs.defaultValues(nv)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case JB:return Kr;case fy:return 0;case YB:return new pe;case QB:return new Ar;case ZB:return new kn;case Eb:return new kn;case wb:return[];case bb:return new un;case rv:return new pe;case nv:return new Ct;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||"CertificateList",value:[efe(e),pe.schema(t.signatureAlgorithm||{names:{blockName:rv}}),new Ct({name:t.signatureValue||nv})]})}fromSchema(e){Ce(e,Zle);let t=be(e,e,rs.schema());ye.assertSchema(t,this.className),this.tbsView=t.result.tbsCertList.valueBeforeDecodeView,iA in t.result&&(this.version=t.result[iA].valueBlock.valueDec),this.signature=new pe({schema:t.result[__]}),this.issuer=new Ar({schema:t.result[O_]}),this.thisUpdate=new kn({schema:t.result[aA]}),Qv in t.result&&(this.nextUpdate=new kn({schema:t.result[Qv]})),oA in t.result&&(this.revokedCertificates=Array.from(t.result[oA],n=>new aH({schema:n}))),uA in t.result&&(this.crlExtensions=new un({schema:t.result[uA]})),this.signatureAlgorithm=new pe({schema:t.result.signatureAlgorithm}),this.signatureValue=t.result.signatureValue}encodeTBS(){let e=[];return this.version!==rs.defaultValues(fy)&&e.push(new he({value:this.version})),e.push(this.signature.toSchema()),e.push(this.issuer.toSchema()),e.push(this.thisUpdate.toSchema()),this.nextUpdate&&e.push(this.nextUpdate.toSchema()),this.revokedCertificates&&e.push(new K({value:Array.from(this.revokedCertificates,t=>t.toSchema())})),this.crlExtensions&&e.push(new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[this.crlExtensions.toSchema()]})),new K({value:e})}toSchema(e=!1){let t;if(e)t=this.encodeTBS();else{if(!this.tbsView.byteLength)return rs.schema();let n=Or(this.tbsView);ye.assert(n,"TBS Certificate Revocation List"),t=n.result}return new K({value:[t,this.signatureAlgorithm.toSchema(),this.signatureValue]})}toJSON(){let e={tbs:ut.ToHex(this.tbsView),version:this.version,signature:this.signature.toJSON(),issuer:this.issuer.toJSON(),thisUpdate:this.thisUpdate.toJSON(),signatureAlgorithm:this.signatureAlgorithm.toJSON(),signatureValue:this.signatureValue.toJSON()};return this.version!==rs.defaultValues(fy)&&(e.version=this.version),this.nextUpdate&&(e.nextUpdate=this.nextUpdate.toJSON()),this.revokedCertificates&&(e.revokedCertificates=Array.from(this.revokedCertificates,t=>t.toJSON())),this.crlExtensions&&(e.crlExtensions=this.crlExtensions.toJSON()),e}isCertificateRevoked(e){if(!this.issuer.isEqual(e.issuer)||!this.revokedCertificates)return!1;for(let t of this.revokedCertificates)if(t.userCertificate.isEqual(e.serialNumber))return!0;return!1}async sign(e,t="SHA-1",n=mt(!0)){if(!e)throw new Error("Need to provide a private key for signing");let s=await n.getSignatureParameters(e,t),{parameters:i}=s;this.signature=s.signatureAlgorithm,this.signatureAlgorithm=s.signatureAlgorithm,this.tbsView=new Uint8Array(this.encodeTBS().toBER());let a=await n.signWithPrivateKey(this.tbsView,e,i);this.signatureValue=new Ct({valueHex:a})}async verify(e={},t=mt(!0)){let n;if(e.issuerCertificate&&(n=e.issuerCertificate.subjectPublicKeyInfo,!this.issuer.isEqual(e.issuerCertificate.subject)))return!1;if(e.publicKeyInfo&&(n=e.publicKeyInfo),!n)throw new Error("Issuer's certificate must be provided as an input parameter");if(this.crlExtensions){for(let s of this.crlExtensions.extensions)if(s.critical&&!tfe.includes(s.extnID))return!1}return t.verifyWithPublicKey(this.tbsView,this.signatureValue,n,this.signatureAlgorithm)}};Zv.CLASS_NAME="CertificateRevocationList";var sd="crlId",id="crlValue",hy="parsedValue",rfe=[sd,id],oH=class sv extends Se{static{o(this,"CRLBag")}constructor(e={}){super(),this.crlId=B(e,sd,sv.defaultValues(sd)),this.crlValue=B(e,id,sv.defaultValues(id)),hy in e&&(this.parsedValue=B(e,hy,sv.defaultValues(hy))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case sd:return P;case id:return new it;case hy:return{};default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case sd:return t===P;case id:return t instanceof it;case hy:return t instanceof Object&&Object.keys(t).length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new He({name:t.id||"id"}),new ae({idBlock:{tagClass:3,tagNumber:0},value:[new it({name:t.value||"value"})]})]})}fromSchema(e){Ce(e,rfe);let t=be(e,e,sv.schema({names:{id:sd,value:id}}));switch(ye.assertSchema(t,this.className),this.crlId=t.result.crlId.valueBlock.toString(),this.crlValue=t.result.crlValue,this.crlId){case o7:this.parsedValue=Zv.fromBER(this.certValue.valueBlock.valueHex);break;default:throw new Error(`Incorrect CRL_ID value in CRLBag: ${this.crlId}`)}}toSchema(){return this.parsedValue&&(this.crlId=o7,this.crlValue=new Be({valueHex:this.parsedValue.toSchema().toBER(!1)})),new K({value:[new He({value:this.crlId}),new ae({idBlock:{tagClass:3,tagNumber:0},value:[this.crlValue.toSchema()]})]})}toJSON(){return{crlId:this.crlId,crlValue:this.crlValue.toJSON()}}};oH.CLASS_NAME="CRLBag";var ad="version",od="encryptedContentInfo",ac="unprotectedAttrs",nfe=[ad,od,ac],ex=class iv extends Se{static{o(this,"EncryptedData")}constructor(e={}){super(),this.version=B(e,ad,iv.defaultValues(ad)),this.encryptedContentInfo=B(e,od,iv.defaultValues(od)),ac in e&&(this.unprotectedAttrs=B(e,ac,iv.defaultValues(ac))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case ad:return 0;case od:return new Xn;case ac:return[];default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case ad:return t===0;case od:return Xn.compareWithDefault("contentType",t.contentType)&&Xn.compareWithDefault("contentEncryptionAlgorithm",t.contentEncryptionAlgorithm)&&Xn.compareWithDefault("encryptedContent",t.encryptedContent);case ac:return t.length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new he({name:t.version||P}),Xn.schema(t.encryptedContentInfo||{}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:1},value:[new lt({name:t.unprotectedAttrs||P,value:$r.schema()})]})]})}fromSchema(e){Ce(e,nfe);let t=be(e,e,iv.schema({names:{version:ad,encryptedContentInfo:{names:{blockName:od}},unprotectedAttrs:ac}}));ye.assertSchema(t,this.className),this.version=t.result.version.valueBlock.valueDec,this.encryptedContentInfo=new Xn({schema:t.result.encryptedContentInfo}),ac in t.result&&(this.unprotectedAttrs=Array.from(t.result.unprotectedAttrs,n=>new $r({schema:n})))}toSchema(){let e=[];return e.push(new he({value:this.version})),e.push(this.encryptedContentInfo.toSchema()),this.unprotectedAttrs&&e.push(new ae({optional:!0,idBlock:{tagClass:3,tagNumber:1},value:Array.from(this.unprotectedAttrs,t=>t.toSchema())})),new K({value:e})}toJSON(){let e={version:this.version,encryptedContentInfo:this.encryptedContentInfo.toJSON()};return this.unprotectedAttrs&&(e.unprotectedAttrs=Array.from(this.unprotectedAttrs,t=>t.toJSON())),e}async encrypt(e,t=mt(!0)){hr.assert(e,"parameters","object");let n={...e,contentType:"1.2.840.113549.1.7.1"};this.encryptedContentInfo=await t.encryptEncryptedContentInfo(n)}async decrypt(e,t=mt(!0)){hr.assert(e,"parameters","object");let n={...e,encryptedContentInfo:this.encryptedContentInfo};return t.decryptEncryptedContentInfo(n)}};ex.CLASS_NAME="EncryptedData";var pf="encryptionAlgorithm",oc="encryptedData",py="parsedValue",sfe=[pf,oc],uH=class ud extends Se{static{o(this,"PKCS8ShroudedKeyBag")}constructor(e={}){super(),this.encryptionAlgorithm=B(e,pf,ud.defaultValues(pf)),this.encryptedData=B(e,oc,ud.defaultValues(oc)),py in e&&(this.parsedValue=B(e,py,ud.defaultValues(py))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case pf:return new pe;case oc:return new Be;case py:return{};default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case pf:return pe.compareWithDefault("algorithmId",t.algorithmId)&&!("algorithmParams"in t);case oc:return t.isEqual(ud.defaultValues(e));case py:return t instanceof Object&&Object.keys(t).length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[pe.schema(t.encryptionAlgorithm||{names:{blockName:pf}}),new Sr({value:[new Be({name:t.encryptedData||oc}),new Be({idBlock:{isConstructed:!0},name:t.encryptedData||oc})]})]})}fromSchema(e){Ce(e,sfe);let t=be(e,e,ud.schema({names:{encryptionAlgorithm:{names:{blockName:pf}},encryptedData:oc}}));ye.assertSchema(t,this.className),this.encryptionAlgorithm=new pe({schema:t.result.encryptionAlgorithm}),this.encryptedData=t.result.encryptedData}toSchema(){return new K({value:[this.encryptionAlgorithm.toSchema(),this.encryptedData]})}toJSON(){return{encryptionAlgorithm:this.encryptionAlgorithm.toJSON(),encryptedData:this.encryptedData.toJSON()}}async parseInternalValues(e,t=mt(!0)){let s=await new ex({encryptedContentInfo:new Xn({contentEncryptionAlgorithm:this.encryptionAlgorithm,encryptedContent:this.encryptedData})}).decrypt(e,t);this.parsedValue=Yv.fromBER(s)}async makeInternalValues(e,t=mt(!0)){if(!this.parsedValue)throw new Error('Please initialize "parsedValue" first');let n=new ex,s={...e,contentToEncrypt:this.parsedValue.toSchema().toBER(!1)};if(await n.encrypt(s,t),!n.encryptedContentInfo.encryptedContent)throw new Error("The filed `encryptedContent` in EncryptedContentInfo is empty");this.encryptionAlgorithm=n.encryptedContentInfo.contentEncryptionAlgorithm,this.encryptedData=n.encryptedContentInfo.encryptedContent}};uH.CLASS_NAME="PKCS8ShroudedKeyBag";var cd="secretTypeId",ld="secretValue",ife=[cd,ld],cH=class dS extends Se{static{o(this,"SecretBag")}constructor(e={}){super(),this.secretTypeId=B(e,cd,dS.defaultValues(cd)),this.secretValue=B(e,ld,dS.defaultValues(ld)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case cd:return P;case ld:return new it;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case cd:return t===P;case ld:return t instanceof it;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new He({name:t.id||"id"}),new ae({idBlock:{tagClass:3,tagNumber:0},value:[new it({name:t.value||"value"})]})]})}fromSchema(e){Ce(e,ife);let t=be(e,e,dS.schema({names:{id:cd,value:ld}}));ye.assertSchema(t,this.className),this.secretTypeId=t.result.secretTypeId.valueBlock.toString(),this.secretValue=t.result.secretValue}toSchema(){return new K({value:[new He({value:this.secretTypeId}),new ae({idBlock:{tagClass:3,tagNumber:0},value:[this.secretValue.toSchema()]})]})}toJSON(){return{secretTypeId:this.secretTypeId,secretValue:this.secretValue.toJSON()}}};cH.CLASS_NAME="SecretBag";var afe=class df{static{o(this,"SafeBagValueFactory")}static getItems(){return this.items||(this.items={},df.register("1.2.840.113549.1.12.10.1.1",Yv),df.register("1.2.840.113549.1.12.10.1.2",uH),df.register("1.2.840.113549.1.12.10.1.3",iH),df.register("1.2.840.113549.1.12.10.1.4",oH),df.register("1.2.840.113549.1.12.10.1.5",cH),df.register("1.2.840.113549.1.12.10.1.6",ym)),this.items}static register(e,t){this.getItems()[e]=t}static find(e){return this.getItems()[e]||null}},mf="bagId",gf="bagValue",vo="bagAttributes",ofe=[mf,gf,vo],HR=class av extends Se{static{o(this,"SafeBag")}constructor(e={}){super(),this.bagId=B(e,mf,av.defaultValues(mf)),this.bagValue=B(e,gf,av.defaultValues(gf)),vo in e&&(this.bagAttributes=B(e,vo,av.defaultValues(vo))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case mf:return P;case gf:return new it;case vo:return[];default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case mf:return t===P;case gf:return t instanceof it;case vo:return t.length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new He({name:t.bagId||mf}),new ae({idBlock:{tagClass:3,tagNumber:0},value:[new it({name:t.bagValue||gf})]}),new kr({optional:!0,value:[new lt({name:t.bagAttributes||vo,value:$r.schema()})]})]})}fromSchema(e){Ce(e,ofe);let t=be(e,e,av.schema({names:{bagId:mf,bagValue:gf,bagAttributes:vo}}));ye.assertSchema(t,this.className),this.bagId=t.result.bagId.valueBlock.toString();let n=afe.find(this.bagId);if(!n)throw new Error(`Invalid BAG_ID for SafeBag: ${this.bagId}`);this.bagValue=new n({schema:t.result.bagValue}),vo in t.result&&(this.bagAttributes=Array.from(t.result.bagAttributes,s=>new $r({schema:s})))}toSchema(){let e=[new He({value:this.bagId}),new ae({idBlock:{tagClass:3,tagNumber:0},value:[this.bagValue.toSchema()]})];return this.bagAttributes&&e.push(new kr({value:Array.from(this.bagAttributes,t=>t.toSchema())})),new K({value:e})}toJSON(){let e={bagId:this.bagId,bagValue:this.bagValue.toJSON()};return this.bagAttributes&&(e.bagAttributes=Array.from(this.bagAttributes,t=>t.toJSON())),e}};HR.CLASS_NAME="SafeBag";var Op="safeBags",ym=class KR extends Se{static{o(this,"SafeContents")}constructor(e={}){super(),this.safeBags=B(e,Op,KR.defaultValues(Op)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Op:return[];default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Op:return t.length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new lt({name:t.safeBags||P,value:HR.schema()})]})}fromSchema(e){Ce(e,[Op]);let t=be(e,e,KR.schema({names:{safeBags:Op}}));ye.assertSchema(t,this.className),this.safeBags=Array.from(t.result.safeBags,n=>new HR({schema:n}))}toSchema(){return new K({value:Array.from(this.safeBags,e=>e.toSchema())})}toJSON(){return{safeBags:Array.from(this.safeBags,e=>e.toJSON())}}};ym.CLASS_NAME="SafeContents";var ov="otherCertFormat",uv="otherCert",ufe=[ov,uv],mS=class gS extends Se{static{o(this,"OtherCertificateFormat")}constructor(e={}){super(),this.otherCertFormat=B(e,ov,gS.defaultValues(ov)),this.otherCert=B(e,uv,gS.defaultValues(uv)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case ov:return P;case uv:return new it;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new He({name:t.otherCertFormat||ov}),new it({name:t.otherCert||uv})]})}fromSchema(e){Ce(e,ufe);let t=be(e,e,gS.schema());ye.assertSchema(t,this.className),this.otherCertFormat=t.result.otherCertFormat.valueBlock.toString(),this.otherCert=t.result.otherCert}toSchema(){return new K({value:[new He({value:this.otherCertFormat}),this.otherCert]})}toJSON(){let e={otherCertFormat:this.otherCertFormat};return this.otherCert instanceof it||(e.otherCert=this.otherCert.toJSON()),e}},cv="certificates",cfe=[cv],Qf=class $R extends Se{static{o(this,"CertificateSet")}constructor(e={}){super(),this.certificates=B(e,cv,$R.defaultValues(cv)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case cv:return[];default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new kr({name:t.blockName||P,value:[new lt({name:t.certificates||cv,value:new Sr({value:[Gn.schema(),new ae({idBlock:{tagClass:3,tagNumber:0},value:[new it]}),new ae({idBlock:{tagClass:3,tagNumber:1},value:[new K]}),new ae({idBlock:{tagClass:3,tagNumber:2},value:_c.schema().valueBlock.value}),new ae({idBlock:{tagClass:3,tagNumber:3},value:mS.schema().valueBlock.value})]})})]})}fromSchema(e){Ce(e,cfe);let t=be(e,e,$R.schema());ye.assertSchema(t,this.className),this.certificates=Array.from(t.result.certificates||[],n=>{let s=n.idBlock.tagNumber;if(n.idBlock.tagClass===1)return new Gn({schema:n});let i=new K({value:n.valueBlock.value});switch(s){case 1:return i.valueBlock.value[0].valueBlock.value[0].valueBlock.valueDec===1?new _c({schema:i}):new ZS({schema:i});case 2:return new _c({schema:i});case 3:return new mS({schema:i})}return n})}toSchema(){return new kr({value:Array.from(this.certificates,e=>{switch(!0){case e instanceof Gn:return e.toSchema();case e instanceof ZS:return new ae({idBlock:{tagClass:3,tagNumber:1},value:e.toSchema().valueBlock.value});case e instanceof _c:return new ae({idBlock:{tagClass:3,tagNumber:2},value:e.toSchema().valueBlock.value});case e instanceof mS:return new ae({idBlock:{tagClass:3,tagNumber:3},value:e.toSchema().valueBlock.value})}return e.toSchema()})})}toJSON(){return{certificates:Array.from(this.certificates,e=>e.toJSON())}}};Qf.CLASS_NAME="CertificateSet";var lv="otherRevInfoFormat",fv="otherRevInfo",lfe=[lv,fv],$v=class yS extends Se{static{o(this,"OtherRevocationInfoFormat")}constructor(e={}){super(),this.otherRevInfoFormat=B(e,lv,yS.defaultValues(lv)),this.otherRevInfo=B(e,fv,yS.defaultValues(fv)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case lv:return P;case fv:return new it;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new He({name:t.otherRevInfoFormat||lv}),new it({name:t.otherRevInfo||fv})]})}fromSchema(e){Ce(e,lfe);let t=be(e,e,yS.schema());ye.assertSchema(t,this.className),this.otherRevInfoFormat=t.result.otherRevInfoFormat.valueBlock.toString(),this.otherRevInfo=t.result.otherRevInfo}toSchema(){return new K({value:[new He({value:this.otherRevInfoFormat}),this.otherRevInfo]})}toJSON(){let e={otherRevInfoFormat:this.otherRevInfoFormat};return this.otherRevInfo instanceof it||(e.otherRevInfo=this.otherRevInfo.toJSON()),e}};$v.CLASS_NAME="OtherRevocationInfoFormat";var hv="crls",eR="otherRevocationInfos",ffe=[hv],Xv=class vS extends Se{static{o(this,"RevocationInfoChoices")}constructor(e={}){super(),this.crls=B(e,hv,vS.defaultValues(hv)),this.otherRevocationInfos=B(e,eR,vS.defaultValues(eR)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case hv:return[];case eR:return[];default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new kr({name:t.blockName||P,value:[new lt({name:t.crls||P,value:new Sr({value:[Zv.schema(),new ae({idBlock:{tagClass:3,tagNumber:1},value:[new He,new it]})]})})]})}fromSchema(e){Ce(e,ffe);let t=be(e,e,vS.schema({names:{crls:hv}}));if(ye.assertSchema(t,this.className),t.result.crls)for(let n of t.result.crls)n.idBlock.tagClass===1?this.crls.push(new Zv({schema:n})):this.otherRevocationInfos.push(new $v({schema:n}))}toSchema(){let e=[];return e.push(...Array.from(this.crls,t=>t.toSchema())),e.push(...Array.from(this.otherRevocationInfos,t=>{let n=t.toSchema();return n.idBlock.tagClass=3,n.idBlock.tagNumber=1,n})),new kr({value:e})}toJSON(){return{crls:Array.from(this.crls,e=>e.toJSON()),otherRevocationInfos:Array.from(this.otherRevocationInfos,e=>e.toJSON())}}};Xv.CLASS_NAME="RevocationInfoChoices";var pv="certs",yf="crls",hfe=[pv,yf],xS=class XR extends Se{static{o(this,"OriginatorInfo")}constructor(e={}){super(),this.crls=B(e,yf,XR.defaultValues(yf)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case pv:return new Qf;case yf:return new Xv;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case pv:return t.certificates.length===0;case yf:return t.crls.length===0&&t.otherRevocationInfos.length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new ae({name:t.certs||P,optional:!0,idBlock:{tagClass:3,tagNumber:0},value:Qf.schema().valueBlock.value}),new ae({name:t.crls||P,optional:!0,idBlock:{tagClass:3,tagNumber:1},value:Xv.schema().valueBlock.value})]})}fromSchema(e){Ce(e,hfe);let t=be(e,e,XR.schema({names:{certs:pv,crls:yf}}));ye.assertSchema(t,this.className),pv in t.result&&(this.certs=new Qf({schema:new kr({value:t.result.certs.valueBlock.value})})),yf in t.result&&(this.crls=new Xv({schema:new kr({value:t.result.crls.valueBlock.value})}))}toSchema(){let e=[];return this.certs&&e.push(new ae({idBlock:{tagClass:3,tagNumber:0},value:this.certs.toSchema().valueBlock.value})),this.crls&&e.push(new ae({idBlock:{tagClass:3,tagNumber:1},value:this.crls.toSchema().valueBlock.value})),new K({value:e})}toJSON(){let e={};return this.certs&&(e.certs=this.certs.toJSON()),this.crls&&(e.crls=this.crls.toJSON()),e}};xS.CLASS_NAME="OriginatorInfo";var dv="issuer",mv="serialNumber",pfe=[dv,mv],Ln=class ES extends Se{static{o(this,"IssuerAndSerialNumber")}constructor(e={}){super(),this.issuer=B(e,dv,ES.defaultValues(dv)),this.serialNumber=B(e,mv,ES.defaultValues(mv)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case dv:return new Ar;case mv:return new he;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[Ar.schema(t.issuer||{}),new he({name:t.serialNumber||P})]})}fromSchema(e){Ce(e,pfe);let t=be(e,e,ES.schema({names:{issuer:{names:{blockName:dv}},serialNumber:mv}}));ye.assertSchema(t,this.className),this.issuer=new Ar({schema:t.result.issuer}),this.serialNumber=t.result.serialNumber}toSchema(){return new K({value:[this.issuer.toSchema(),this.serialNumber]})}toJSON(){return{issuer:this.issuer.toJSON(),serialNumber:this.serialNumber.toJSON()}}};Ln.CLASS_NAME="IssuerAndSerialNumber";var Sb="variant",dy="value",dfe=["blockName"],lH=class wS extends Se{static{o(this,"RecipientIdentifier")}constructor(e={}){super(),this.variant=B(e,Sb,wS.defaultValues(Sb)),dy in e&&(this.value=B(e,dy,wS.defaultValues(dy))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Sb:return-1;case dy:return{};default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Sb:return t===-1;case dy:return Object.keys(t).length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new Sr({value:[Ln.schema({names:{blockName:t.blockName||P}}),new tt({name:t.blockName||P,idBlock:{tagClass:3,tagNumber:0}})]})}fromSchema(e){Ce(e,dfe);let t=be(e,e,wS.schema({names:{blockName:"blockName"}}));ye.assertSchema(t,this.className),t.result.blockName.idBlock.tagClass===1?(this.variant=1,this.value=new Ln({schema:t.result.blockName})):(this.variant=2,this.value=new Be({valueHex:t.result.blockName.valueBlock.valueHex}))}toSchema(){switch(this.variant){case 1:if(!(this.value instanceof Ln))throw new Error("Incorrect type of RecipientIdentifier.value. It should be IssuerAndSerialNumber.");return this.value.toSchema();case 2:if(!(this.value instanceof Be))throw new Error("Incorrect type of RecipientIdentifier.value. It should be ASN.1 OctetString.");return new tt({idBlock:{tagClass:3,tagNumber:0},valueHex:this.value.valueBlock.valueHexView});default:return new it}}toJSON(){let e={variant:this.variant};return(this.variant===1||this.variant===2)&&this.value&&(e.value=this.value.toJSON()),e}};lH.CLASS_NAME="RecipientIdentifier";var vf="version",fd="rid",hd="keyEncryptionAlgorithm",pd="encryptedKey",Ab="recipientCertificate",mfe=[vf,fd,hd,pd],cA=class xo extends Se{static{o(this,"KeyTransRecipientInfo")}constructor(e={}){super(),this.version=B(e,vf,xo.defaultValues(vf)),this.rid=B(e,fd,xo.defaultValues(fd)),this.keyEncryptionAlgorithm=B(e,hd,xo.defaultValues(hd)),this.encryptedKey=B(e,pd,xo.defaultValues(pd)),this.recipientCertificate=B(e,Ab,xo.defaultValues(Ab)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case vf:return-1;case fd:return{};case hd:return new pe;case pd:return new Be;case Ab:return new Gn;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case vf:return t===xo.defaultValues(vf);case fd:return Object.keys(t).length===0;case hd:case pd:return t.isEqual(xo.defaultValues(e));case Ab:return!1;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new he({name:t.version||P}),lH.schema(t.rid||{}),pe.schema(t.keyEncryptionAlgorithm||{}),new Be({name:t.encryptedKey||P})]})}fromSchema(e){Ce(e,mfe);let t=be(e,e,xo.schema({names:{version:vf,rid:{names:{blockName:fd}},keyEncryptionAlgorithm:{names:{blockName:hd}},encryptedKey:pd}}));ye.assertSchema(t,this.className),this.version=t.result.version.valueBlock.valueDec,t.result.rid.idBlock.tagClass===3?this.rid=new Be({valueHex:t.result.rid.valueBlock.valueHex}):this.rid=new Ln({schema:t.result.rid}),this.keyEncryptionAlgorithm=new pe({schema:t.result.keyEncryptionAlgorithm}),this.encryptedKey=t.result.encryptedKey}toSchema(){let e=[];return this.rid instanceof Ln?(this.version=0,e.push(new he({value:this.version})),e.push(this.rid.toSchema())):(this.version=2,e.push(new he({value:this.version})),e.push(new tt({idBlock:{tagClass:3,tagNumber:0},valueHex:this.rid.valueBlock.valueHexView}))),e.push(this.keyEncryptionAlgorithm.toSchema()),e.push(this.encryptedKey),new K({value:e})}toJSON(){return{version:this.version,rid:this.rid.toJSON(),keyEncryptionAlgorithm:this.keyEncryptionAlgorithm.toJSON(),encryptedKey:this.encryptedKey.toJSON()}}};cA.CLASS_NAME="KeyTransRecipientInfo";var dd="algorithm",md="publicKey",gfe=[dd,md],lA=class gv extends Se{static{o(this,"OriginatorPublicKey")}constructor(e={}){super(),this.algorithm=B(e,dd,gv.defaultValues(dd)),this.publicKey=B(e,md,gv.defaultValues(md)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case dd:return new pe;case md:return new Ct;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case dd:case md:return t.isEqual(gv.defaultValues(e));default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[pe.schema(t.algorithm||{}),new Ct({name:t.publicKey||P})]})}fromSchema(e){Ce(e,gfe);let t=be(e,e,gv.schema({names:{algorithm:{names:{blockName:dd}},publicKey:md}}));ye.assertSchema(t,this.className),this.algorithm=new pe({schema:t.result.algorithm}),this.publicKey=t.result.publicKey}toSchema(){return new K({value:[this.algorithm.toSchema(),this.publicKey]})}toJSON(){return{algorithm:this.algorithm.toJSON(),publicKey:this.publicKey.toJSON()}}};lA.CLASS_NAME="OriginatorPublicKey";var Cb="variant",my="value",yfe=["blockName"],Gv=class bS extends Se{static{o(this,"OriginatorIdentifierOrKey")}constructor(e={}){super(),this.variant=B(e,Cb,bS.defaultValues(Cb)),my in e&&(this.value=B(e,my,bS.defaultValues(my))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Cb:return-1;case my:return{};default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Cb:return t===-1;case my:return Object.keys(t).length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new Sr({value:[Ln.schema({names:{blockName:t.blockName||P}}),new tt({idBlock:{tagClass:3,tagNumber:0},name:t.blockName||P}),new ae({idBlock:{tagClass:3,tagNumber:1},name:t.blockName||P,value:lA.schema().valueBlock.value})]})}fromSchema(e){Ce(e,yfe);let t=be(e,e,bS.schema({names:{blockName:"blockName"}}));ye.assertSchema(t,this.className),t.result.blockName.idBlock.tagClass===1?(this.variant=1,this.value=new Ln({schema:t.result.blockName})):t.result.blockName.idBlock.tagNumber===0?(t.result.blockName.idBlock.tagClass=1,t.result.blockName.idBlock.tagNumber=4,this.variant=2,this.value=t.result.blockName):(this.variant=3,this.value=new lA({schema:new K({value:t.result.blockName.valueBlock.value})}))}toSchema(){switch(this.variant){case 1:return this.value.toSchema();case 2:return this.value.idBlock.tagClass=3,this.value.idBlock.tagNumber=0,this.value;case 3:{let e=this.value.toSchema();return e.idBlock.tagClass=3,e.idBlock.tagNumber=1,e}default:return new it}}toJSON(){let e={variant:this.variant};return(this.variant===1||this.variant===2||this.variant===3)&&(e.value=this.value.toJSON()),e}};Gv.CLASS_NAME="OriginatorIdentifierOrKey";var gd="keyAttrId",wa="keyAttr",vfe=[gd,wa],Zf=class SS extends Se{static{o(this,"OtherKeyAttribute")}constructor(e={}){super(),this.keyAttrId=B(e,gd,SS.defaultValues(gd)),wa in e&&(this.keyAttr=B(e,wa,SS.defaultValues(wa))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case gd:return P;case wa:return{};default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case gd:return typeof t=="string"&&t===P;case wa:return Object.keys(t).length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({optional:t.optional||!0,name:t.blockName||P,value:[new He({name:t.keyAttrId||P}),new it({optional:!0,name:t.keyAttr||P})]})}fromSchema(e){Ce(e,vfe);let t=be(e,e,SS.schema({names:{keyAttrId:gd,keyAttr:wa}}));ye.assertSchema(t,this.className),this.keyAttrId=t.result.keyAttrId.valueBlock.toString(),wa in t.result&&(this.keyAttr=t.result.keyAttr)}toSchema(){let e=[];return e.push(new He({value:this.keyAttrId})),wa in this&&e.push(this.keyAttr),new K({value:e})}toJSON(){let e={keyAttrId:this.keyAttrId};return wa in this&&(e.keyAttr=this.keyAttr.toJSON()),e}};Zf.CLASS_NAME="OtherKeyAttribute";var xf="subjectKeyIdentifier",uc="date",cc="other",xfe=[xf,uc,cc],fA=class yd extends Se{static{o(this,"RecipientKeyIdentifier")}constructor(e={}){super(),this.subjectKeyIdentifier=B(e,xf,yd.defaultValues(xf)),uc in e&&(this.date=B(e,uc,yd.defaultValues(uc))),cc in e&&(this.other=B(e,cc,yd.defaultValues(cc))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case xf:return new Be;case uc:return new br;case cc:return new Zf;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case xf:return t.isEqual(yd.defaultValues(xf));case uc:return t.year===0&&t.month===0&&t.day===0&&t.hour===0&&t.minute===0&&t.second===0&&t.millisecond===0;case cc:return t.keyAttrId===P&&!("keyAttr"in t);default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new Be({name:t.subjectKeyIdentifier||P}),new br({optional:!0,name:t.date||P}),Zf.schema(t.other||{})]})}fromSchema(e){Ce(e,xfe);let t=be(e,e,yd.schema({names:{subjectKeyIdentifier:xf,date:uc,other:{names:{blockName:cc}}}}));ye.assertSchema(t,this.className),this.subjectKeyIdentifier=t.result.subjectKeyIdentifier,uc in t.result&&(this.date=t.result.date),cc in t.result&&(this.other=new Zf({schema:t.result.other}))}toSchema(){let e=[];return e.push(this.subjectKeyIdentifier),this.date&&e.push(this.date),this.other&&e.push(this.other.toSchema()),new K({value:e})}toJSON(){let e={subjectKeyIdentifier:this.subjectKeyIdentifier.toJSON()};return this.date&&(e.date=this.date.toJSON()),this.other&&(e.other=this.other.toJSON()),e}};fA.CLASS_NAME="RecipientKeyIdentifier";var Nb="variant",Tb="value",Efe=["blockName"],xm=class AS extends Se{static{o(this,"KeyAgreeRecipientIdentifier")}constructor(e={}){super(),this.variant=B(e,Nb,AS.defaultValues(Nb)),this.value=B(e,Tb,AS.defaultValues(Tb)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Nb:return-1;case Tb:return{};default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Nb:return t===-1;case Tb:return Object.keys(t).length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new Sr({value:[Ln.schema(t.issuerAndSerialNumber||{names:{blockName:t.blockName||P}}),new ae({name:t.blockName||P,idBlock:{tagClass:3,tagNumber:0},value:fA.schema(t.rKeyId||{names:{blockName:t.blockName||P}}).valueBlock.value})]})}fromSchema(e){Ce(e,Efe);let t=be(e,e,AS.schema({names:{blockName:"blockName"}}));ye.assertSchema(t,this.className),t.result.blockName.idBlock.tagClass===1?(this.variant=1,this.value=new Ln({schema:t.result.blockName})):(this.variant=2,this.value=new fA({schema:new K({value:t.result.blockName.valueBlock.value})}))}toSchema(){switch(this.variant){case 1:return this.value.toSchema();case 2:return new ae({idBlock:{tagClass:3,tagNumber:0},value:this.value.toSchema().valueBlock.value});default:return new it}}toJSON(){let e={variant:this.variant};return(this.variant===1||this.variant===2)&&(e.value=this.value.toJSON()),e}};xm.CLASS_NAME="KeyAgreeRecipientIdentifier";var vd="rid",Ef="encryptedKey",wfe=[vd,Ef],hA=class yv extends Se{static{o(this,"RecipientEncryptedKey")}constructor(e={}){super(),this.rid=B(e,vd,yv.defaultValues(vd)),this.encryptedKey=B(e,Ef,yv.defaultValues(Ef)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case vd:return new xm;case Ef:return new Be;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case vd:return t.variant===-1&&!("value"in t);case Ef:return t.isEqual(yv.defaultValues(Ef));default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[xm.schema(t.rid||{}),new Be({name:t.encryptedKey||P})]})}fromSchema(e){Ce(e,wfe);let t=be(e,e,yv.schema({names:{rid:{names:{blockName:vd}},encryptedKey:Ef}}));ye.assertSchema(t,this.className),this.rid=new xm({schema:t.result.rid}),this.encryptedKey=t.result.encryptedKey}toSchema(){return new K({value:[this.rid.toSchema(),this.encryptedKey]})}toJSON(){return{rid:this.rid.toJSON(),encryptedKey:this.encryptedKey.toJSON()}}};hA.CLASS_NAME="RecipientEncryptedKey";var Ib="encryptedKeys",fH="RecipientEncryptedKeys",bfe=[fH],zv=class GR extends Se{static{o(this,"RecipientEncryptedKeys")}constructor(e={}){super(),this.encryptedKeys=B(e,Ib,GR.defaultValues(Ib)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Ib:return[];default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Ib:return t.length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new lt({name:t.RecipientEncryptedKeys||P,value:hA.schema()})]})}fromSchema(e){Ce(e,bfe);let t=be(e,e,GR.schema({names:{RecipientEncryptedKeys:fH}}));ye.assertSchema(t,this.className),this.encryptedKeys=Array.from(t.result.RecipientEncryptedKeys,n=>new hA({schema:n}))}toSchema(){return new K({value:Array.from(this.encryptedKeys,e=>e.toSchema())})}toJSON(){return{encryptedKeys:Array.from(this.encryptedKeys,e=>e.toJSON())}}};zv.CLASS_NAME="RecipientEncryptedKeys";var xd="version",Ed="originator",Eo="ukm",wd="keyEncryptionAlgorithm",bd="recipientEncryptedKeys",Db="recipientCertificate",Bb="recipientPublicKey",Sfe=[xd,Ed,Eo,wd,bd],pA=class ba extends Se{static{o(this,"KeyAgreeRecipientInfo")}constructor(e={}){super(),this.version=B(e,xd,ba.defaultValues(xd)),this.originator=B(e,Ed,ba.defaultValues(Ed)),Eo in e&&(this.ukm=B(e,Eo,ba.defaultValues(Eo))),this.keyEncryptionAlgorithm=B(e,wd,ba.defaultValues(wd)),this.recipientEncryptedKeys=B(e,bd,ba.defaultValues(bd)),this.recipientCertificate=B(e,Db,ba.defaultValues(Db)),this.recipientPublicKey=B(e,Bb,ba.defaultValues(Bb)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case xd:return 0;case Ed:return new Gv;case Eo:return new Be;case wd:return new pe;case bd:return new zv;case Db:return new Gn;case Bb:return null;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case xd:return t===0;case Ed:return t.variant===-1&&!("value"in t);case Eo:return t.isEqual(ba.defaultValues(Eo));case wd:return t.algorithmId===P&&!("algorithmParams"in t);case bd:return t.encryptedKeys.length===0;case Db:return!1;case Bb:return!1;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new he({name:t.version||P}),new ae({idBlock:{tagClass:3,tagNumber:0},value:[Gv.schema(t.originator||{})]}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:1},value:[new Be({name:t.ukm||P})]}),pe.schema(t.keyEncryptionAlgorithm||{}),zv.schema(t.recipientEncryptedKeys||{})]})}fromSchema(e){Ce(e,Sfe);let t=be(e,e,ba.schema({names:{version:xd,originator:{names:{blockName:Ed}},ukm:Eo,keyEncryptionAlgorithm:{names:{blockName:wd}},recipientEncryptedKeys:{names:{blockName:bd}}}}));ye.assertSchema(t,this.className),this.version=t.result.version.valueBlock.valueDec,this.originator=new Gv({schema:t.result.originator}),Eo in t.result&&(this.ukm=t.result.ukm),this.keyEncryptionAlgorithm=new pe({schema:t.result.keyEncryptionAlgorithm}),this.recipientEncryptedKeys=new zv({schema:t.result.recipientEncryptedKeys})}toSchema(){let e=[];return e.push(new he({value:this.version})),e.push(new ae({idBlock:{tagClass:3,tagNumber:0},value:[this.originator.toSchema()]})),this.ukm&&e.push(new ae({optional:!0,idBlock:{tagClass:3,tagNumber:1},value:[this.ukm]})),e.push(this.keyEncryptionAlgorithm.toSchema()),e.push(this.recipientEncryptedKeys.toSchema()),new K({value:e})}toJSON(){let e={version:this.version,originator:this.originator.toJSON(),keyEncryptionAlgorithm:this.keyEncryptionAlgorithm.toJSON(),recipientEncryptedKeys:this.recipientEncryptedKeys.toJSON()};return this.ukm&&(e.ukm=this.ukm.toJSON()),e}};pA.CLASS_NAME="KeyAgreeRecipientInfo";var wf="keyIdentifier",lc="date",fc="other",Afe=[wf,lc,fc],Wv=class Sd extends Se{static{o(this,"KEKIdentifier")}constructor(e={}){super(),this.keyIdentifier=B(e,wf,Sd.defaultValues(wf)),lc in e&&(this.date=B(e,lc,Sd.defaultValues(lc))),fc in e&&(this.other=B(e,fc,Sd.defaultValues(fc))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case wf:return new Be;case lc:return new br;case fc:return new Zf;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case wf:return t.isEqual(Sd.defaultValues(wf));case lc:return t.year===0&&t.month===0&&t.day===0&&t.hour===0&&t.minute===0&&t.second===0&&t.millisecond===0;case fc:return t.compareWithDefault("keyAttrId",t.keyAttrId)&&!("keyAttr"in t);default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new Be({name:t.keyIdentifier||P}),new br({optional:!0,name:t.date||P}),Zf.schema(t.other||{})]})}fromSchema(e){Ce(e,Afe);let t=be(e,e,Sd.schema({names:{keyIdentifier:wf,date:lc,other:{names:{blockName:fc}}}}));ye.assertSchema(t,this.className),this.keyIdentifier=t.result.keyIdentifier,lc in t.result&&(this.date=t.result.date),fc in t.result&&(this.other=new Zf({schema:t.result.other}))}toSchema(){let e=[];return e.push(this.keyIdentifier),this.date&&e.push(this.date),this.other&&e.push(this.other.toSchema()),new K({value:e})}toJSON(){let e={keyIdentifier:this.keyIdentifier.toJSON()};return this.date&&(e.date=this.date),this.other&&(e.other=this.other.toJSON()),e}};Wv.CLASS_NAME="KEKIdentifier";var Ad="version",Cd="kekid",Nd="keyEncryptionAlgorithm",bf="encryptedKey",Rb="preDefinedKEK",Cfe=[Ad,Cd,Nd,bf],dA=class wo extends Se{static{o(this,"KEKRecipientInfo")}constructor(e={}){super(),this.version=B(e,Ad,wo.defaultValues(Ad)),this.kekid=B(e,Cd,wo.defaultValues(Cd)),this.keyEncryptionAlgorithm=B(e,Nd,wo.defaultValues(Nd)),this.encryptedKey=B(e,bf,wo.defaultValues(bf)),this.preDefinedKEK=B(e,Rb,wo.defaultValues(Rb)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Ad:return 0;case Cd:return new Wv;case Nd:return new pe;case bf:return new Be;case Rb:return Kr;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case"KEKRecipientInfo":return t===wo.defaultValues(Ad);case Cd:return t.compareWithDefault("keyIdentifier",t.keyIdentifier)&&!("date"in t)&&!("other"in t);case Nd:return t.algorithmId===P&&!("algorithmParams"in t);case bf:return t.isEqual(wo.defaultValues(bf));case Rb:return t.byteLength===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new he({name:t.version||P}),Wv.schema(t.kekid||{}),pe.schema(t.keyEncryptionAlgorithm||{}),new Be({name:t.encryptedKey||P})]})}fromSchema(e){Ce(e,Cfe);let t=be(e,e,wo.schema({names:{version:Ad,kekid:{names:{blockName:Cd}},keyEncryptionAlgorithm:{names:{blockName:Nd}},encryptedKey:bf}}));ye.assertSchema(t,this.className),this.version=t.result.version.valueBlock.valueDec,this.kekid=new Wv({schema:t.result.kekid}),this.keyEncryptionAlgorithm=new pe({schema:t.result.keyEncryptionAlgorithm}),this.encryptedKey=t.result.encryptedKey}toSchema(){return new K({value:[new he({value:this.version}),this.kekid.toSchema(),this.keyEncryptionAlgorithm.toSchema(),this.encryptedKey]})}toJSON(){return{version:this.version,kekid:this.kekid.toJSON(),keyEncryptionAlgorithm:this.keyEncryptionAlgorithm.toJSON(),encryptedKey:this.encryptedKey.toJSON()}}};dA.CLASS_NAME="KEKRecipientInfo";var Td="version",hc="keyDerivationAlgorithm",Id="keyEncryptionAlgorithm",Sf="encryptedKey",_b="password",Nfe=[Td,hc,Id,Sf],mA=class pc extends Se{static{o(this,"PasswordRecipientinfo")}constructor(e={}){super(),this.version=B(e,Td,pc.defaultValues(Td)),hc in e&&(this.keyDerivationAlgorithm=B(e,hc,pc.defaultValues(hc))),this.keyEncryptionAlgorithm=B(e,Id,pc.defaultValues(Id)),this.encryptedKey=B(e,Sf,pc.defaultValues(Sf)),this.password=B(e,_b,pc.defaultValues(_b)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Td:return-1;case hc:return new pe;case Id:return new pe;case Sf:return new Be;case _b:return Kr;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Td:return t===-1;case hc:case Id:return t.algorithmId===P&&!("algorithmParams"in t);case Sf:return t.isEqual(pc.defaultValues(Sf));case _b:return t.byteLength===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new he({name:t.version||P}),new ae({name:t.keyDerivationAlgorithm||P,optional:!0,idBlock:{tagClass:3,tagNumber:0},value:pe.schema().valueBlock.value}),pe.schema(t.keyEncryptionAlgorithm||{}),new Be({name:t.encryptedKey||P})]})}fromSchema(e){Ce(e,Nfe);let t=be(e,e,pc.schema({names:{version:Td,keyDerivationAlgorithm:hc,keyEncryptionAlgorithm:{names:{blockName:Id}},encryptedKey:Sf}}));ye.assertSchema(t,this.className),this.version=t.result.version.valueBlock.valueDec,hc in t.result&&(this.keyDerivationAlgorithm=new pe({schema:new K({value:t.result.keyDerivationAlgorithm.valueBlock.value})})),this.keyEncryptionAlgorithm=new pe({schema:t.result.keyEncryptionAlgorithm}),this.encryptedKey=t.result.encryptedKey}toSchema(){let e=[];return e.push(new he({value:this.version})),this.keyDerivationAlgorithm&&e.push(new ae({idBlock:{tagClass:3,tagNumber:0},value:this.keyDerivationAlgorithm.toSchema().valueBlock.value})),e.push(this.keyEncryptionAlgorithm.toSchema()),e.push(this.encryptedKey),new K({value:e})}toJSON(){let e={version:this.version,keyEncryptionAlgorithm:this.keyEncryptionAlgorithm.toJSON(),encryptedKey:this.encryptedKey.toJSON()};return this.keyDerivationAlgorithm&&(e.keyDerivationAlgorithm=this.keyDerivationAlgorithm.toJSON()),e}};mA.CLASS_NAME="PasswordRecipientInfo";var Dd="oriType",Af="oriValue",Tfe=[Dd,Af],zR=class vv extends Se{static{o(this,"OtherRecipientInfo")}constructor(e={}){super(),this.oriType=B(e,Dd,vv.defaultValues(Dd)),this.oriValue=B(e,Af,vv.defaultValues(Af)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Dd:return P;case Af:return{};default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Dd:return t===P;case Af:return Object.keys(t).length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new He({name:t.oriType||P}),new it({name:t.oriValue||P})]})}fromSchema(e){Ce(e,Tfe);let t=be(e,e,vv.schema({names:{oriType:Dd,oriValue:Af}}));ye.assertSchema(t,this.className),this.oriType=t.result.oriType.valueBlock.toString(),this.oriValue=t.result.oriValue}toSchema(){return new K({value:[new He({value:this.oriType}),this.oriValue]})}toJSON(){let e={oriType:this.oriType};return vv.compareWithDefault(Af,this.oriValue)||(e.oriValue=this.oriValue.toJSON()),e}};zR.CLASS_NAME="OtherRecipientInfo";var Ob="variant",gy="value",Ife=["blockName"],Cf=class xv extends Se{static{o(this,"RecipientInfo")}constructor(e={}){super(),this.variant=B(e,Ob,xv.defaultValues(Ob)),gy in e&&(this.value=B(e,gy,xv.defaultValues(gy))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Ob:return-1;case gy:return{};default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Ob:return t===xv.defaultValues(e);case gy:return Object.keys(t).length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new Sr({value:[cA.schema({names:{blockName:t.blockName||P}}),new ae({name:t.blockName||P,idBlock:{tagClass:3,tagNumber:1},value:pA.schema().valueBlock.value}),new ae({name:t.blockName||P,idBlock:{tagClass:3,tagNumber:2},value:dA.schema().valueBlock.value}),new ae({name:t.blockName||P,idBlock:{tagClass:3,tagNumber:3},value:mA.schema().valueBlock.value}),new ae({name:t.blockName||P,idBlock:{tagClass:3,tagNumber:4},value:zR.schema().valueBlock.value})]})}fromSchema(e){Ce(e,Ife);let t=be(e,e,xv.schema({names:{blockName:"blockName"}}));if(ye.assertSchema(t,this.className),t.result.blockName.idBlock.tagClass===1)this.variant=1,this.value=new cA({schema:t.result.blockName});else{let n=new K({value:t.result.blockName.valueBlock.value});switch(t.result.blockName.idBlock.tagNumber){case 1:this.variant=2,this.value=new pA({schema:n});break;case 2:this.variant=3,this.value=new dA({schema:n});break;case 3:this.variant=4,this.value=new mA({schema:n});break;case 4:this.variant=5,this.value=new zR({schema:n});break;default:throw new Error("Incorrect structure of RecipientInfo block")}}}toSchema(){Jt.assertEmpty(this.value,"value","RecipientInfo");let e=this.value.toSchema();switch(this.variant){case 1:return e;case 2:case 3:case 4:return e.idBlock.tagClass=3,e.idBlock.tagNumber=this.variant-1,e;default:return new it}}toJSON(){let e={variant:this.variant};return this.value&&this.variant>=1&&this.variant<=4&&(e.value=this.value.toJSON()),e}};Cf.CLASS_NAME="RecipientInfo";var dc="hashAlgorithm",mc="maskGenAlgorithm",gc="pSourceAlgorithm",Dfe=[dc,mc,gc],CS=class Ui extends Se{static{o(this,"RSAESOAEPParams")}constructor(e={}){super(),this.hashAlgorithm=B(e,dc,Ui.defaultValues(dc)),this.maskGenAlgorithm=B(e,mc,Ui.defaultValues(mc)),this.pSourceAlgorithm=B(e,gc,Ui.defaultValues(gc)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case dc:return new pe({algorithmId:"1.3.14.3.2.26",algorithmParams:new Pr});case mc:return new pe({algorithmId:"1.2.840.113549.1.1.8",algorithmParams:new pe({algorithmId:"1.3.14.3.2.26",algorithmParams:new Pr}).toSchema()});case gc:return new pe({algorithmId:"1.2.840.113549.1.1.9",algorithmParams:new Be({valueHex:new Uint8Array([218,57,163,238,94,107,75,13,50,85,191,239,149,96,24,144,175,216,7,9]).buffer})});default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new ae({idBlock:{tagClass:3,tagNumber:0},optional:!0,value:[pe.schema(t.hashAlgorithm||{})]}),new ae({idBlock:{tagClass:3,tagNumber:1},optional:!0,value:[pe.schema(t.maskGenAlgorithm||{})]}),new ae({idBlock:{tagClass:3,tagNumber:2},optional:!0,value:[pe.schema(t.pSourceAlgorithm||{})]})]})}fromSchema(e){Ce(e,Dfe);let t=be(e,e,Ui.schema({names:{hashAlgorithm:{names:{blockName:dc}},maskGenAlgorithm:{names:{blockName:mc}},pSourceAlgorithm:{names:{blockName:gc}}}}));ye.assertSchema(t,this.className),dc in t.result&&(this.hashAlgorithm=new pe({schema:t.result.hashAlgorithm})),mc in t.result&&(this.maskGenAlgorithm=new pe({schema:t.result.maskGenAlgorithm})),gc in t.result&&(this.pSourceAlgorithm=new pe({schema:t.result.pSourceAlgorithm}))}toSchema(){let e=[];return this.hashAlgorithm.isEqual(Ui.defaultValues(dc))||e.push(new ae({idBlock:{tagClass:3,tagNumber:0},value:[this.hashAlgorithm.toSchema()]})),this.maskGenAlgorithm.isEqual(Ui.defaultValues(mc))||e.push(new ae({idBlock:{tagClass:3,tagNumber:1},value:[this.maskGenAlgorithm.toSchema()]})),this.pSourceAlgorithm.isEqual(Ui.defaultValues(gc))||e.push(new ae({idBlock:{tagClass:3,tagNumber:2},value:[this.pSourceAlgorithm.toSchema()]})),new K({value:e})}toJSON(){let e={};return this.hashAlgorithm.isEqual(Ui.defaultValues(dc))||(e.hashAlgorithm=this.hashAlgorithm.toJSON()),this.maskGenAlgorithm.isEqual(Ui.defaultValues(mc))||(e.maskGenAlgorithm=this.maskGenAlgorithm.toJSON()),this.pSourceAlgorithm.isEqual(Ui.defaultValues(gc))||(e.pSourceAlgorithm=this.pSourceAlgorithm.toJSON()),e}};CS.CLASS_NAME="RSAESOAEPParams";var Bd="keyInfo",yc="entityUInfo",Rd="suppPubInfo",Bfe=[Bd,yc,Rd],WR=class _d extends Se{static{o(this,"ECCCMSSharedInfo")}constructor(e={}){super(),this.keyInfo=B(e,Bd,_d.defaultValues(Bd)),yc in e&&(this.entityUInfo=B(e,yc,_d.defaultValues(yc))),this.suppPubInfo=B(e,Rd,_d.defaultValues(Rd)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Bd:return new pe;case yc:return new Be;case Rd:return new Be;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Bd:case yc:case Rd:return t.isEqual(_d.defaultValues(e));default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[pe.schema(t.keyInfo||{}),new ae({name:t.entityUInfo||P,idBlock:{tagClass:3,tagNumber:0},optional:!0,value:[new Be]}),new ae({name:t.suppPubInfo||P,idBlock:{tagClass:3,tagNumber:2},value:[new Be]})]})}fromSchema(e){Ce(e,Bfe);let t=be(e,e,_d.schema({names:{keyInfo:{names:{blockName:Bd}},entityUInfo:yc,suppPubInfo:Rd}}));ye.assertSchema(t,this.className),this.keyInfo=new pe({schema:t.result.keyInfo}),yc in t.result&&(this.entityUInfo=t.result.entityUInfo.valueBlock.value[0]),this.suppPubInfo=t.result.suppPubInfo.valueBlock.value[0]}toSchema(){let e=[];return e.push(this.keyInfo.toSchema()),this.entityUInfo&&e.push(new ae({idBlock:{tagClass:3,tagNumber:0},value:[this.entityUInfo]})),e.push(new ae({idBlock:{tagClass:3,tagNumber:2},value:[this.suppPubInfo]})),new K({value:e})}toJSON(){let e={keyInfo:this.keyInfo.toJSON(),suppPubInfo:this.suppPubInfo.toJSON()};return this.entityUInfo&&(e.entityUInfo=this.entityUInfo.toJSON()),e}};WR.CLASS_NAME="ECCCMSSharedInfo";var Od="version",vc="originatorInfo",Pd="recipientInfos",kd="encryptedContentInfo",xc="unprotectedAttrs",Rfe=[Od,vc,Pd,kd,xc],A7={kdfAlgorithm:"SHA-512",kekEncryptionLength:256},_fe={"P-256":256,"P-384":384,"P-521":528},JR=class Ec extends Se{static{o(this,"EnvelopedData")}constructor(e={}){super(),this.version=B(e,Od,Ec.defaultValues(Od)),vc in e&&(this.originatorInfo=B(e,vc,Ec.defaultValues(vc))),this.recipientInfos=B(e,Pd,Ec.defaultValues(Pd)),this.encryptedContentInfo=B(e,kd,Ec.defaultValues(kd)),xc in e&&(this.unprotectedAttrs=B(e,xc,Ec.defaultValues(xc))),this.policy={disableSplit:!!e.disableSplit},e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Od:return 0;case vc:return new xS;case Pd:return[];case kd:return new Xn;case xc:return[];default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Od:return t===Ec.defaultValues(e);case vc:return t.certs.certificates.length===0&&t.crls.crls.length===0;case Pd:case xc:return t.length===0;case kd:return Xn.compareWithDefault("contentType",t.contentType)&&Xn.compareWithDefault("contentEncryptionAlgorithm",t.contentEncryptionAlgorithm)&&Xn.compareWithDefault("encryptedContent",t.encryptedContent);default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new he({name:t.version||P}),new ae({name:t.originatorInfo||P,optional:!0,idBlock:{tagClass:3,tagNumber:0},value:xS.schema().valueBlock.value}),new kr({value:[new lt({name:t.recipientInfos||P,value:Cf.schema()})]}),Xn.schema(t.encryptedContentInfo||{}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:1},value:[new lt({name:t.unprotectedAttrs||P,value:$r.schema()})]})]})}fromSchema(e){Ce(e,Rfe);let t=be(e,e,Ec.schema({names:{version:Od,originatorInfo:vc,recipientInfos:Pd,encryptedContentInfo:{names:{blockName:kd}},unprotectedAttrs:xc}}));ye.assertSchema(t,this.className),this.version=t.result.version.valueBlock.valueDec,vc in t.result&&(this.originatorInfo=new xS({schema:new K({value:t.result.originatorInfo.valueBlock.value})})),this.recipientInfos=Array.from(t.result.recipientInfos,n=>new Cf({schema:n})),this.encryptedContentInfo=new Xn({schema:t.result.encryptedContentInfo}),xc in t.result&&(this.unprotectedAttrs=Array.from(t.result.unprotectedAttrs,n=>new $r({schema:n})))}toSchema(){let e=[];return e.push(new he({value:this.version})),this.originatorInfo&&e.push(new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:this.originatorInfo.toSchema().valueBlock.value})),e.push(new kr({value:Array.from(this.recipientInfos,t=>t.toSchema())})),e.push(this.encryptedContentInfo.toSchema()),this.unprotectedAttrs&&e.push(new ae({optional:!0,idBlock:{tagClass:3,tagNumber:1},value:Array.from(this.unprotectedAttrs,t=>t.toSchema())})),new K({value:e})}toJSON(){let e={version:this.version,recipientInfos:Array.from(this.recipientInfos,t=>t.toJSON()),encryptedContentInfo:this.encryptedContentInfo.toJSON()};return this.originatorInfo&&(e.originatorInfo=this.originatorInfo.toJSON()),this.unprotectedAttrs&&(e.unprotectedAttrs=Array.from(this.unprotectedAttrs,t=>t.toJSON())),e}addRecipientByCertificate(e,t,n,s=mt(!0)){let i=Object.assign({useOAEP:!0,oaepHashAlgorithm:"SHA-512"},A7,t||{});if(e.subjectPublicKeyInfo.algorithm.algorithmId.indexOf("1.2.840.113549")!==-1)n=1;else if(e.subjectPublicKeyInfo.algorithm.algorithmId.indexOf("1.2.840.10045")!==-1)n=2;else throw new Error(`Unknown type of certificate's public key: ${e.subjectPublicKeyInfo.algorithm.algorithmId}`);switch(n){case 1:{let a,u;if(i.useOAEP===!0){a=s.getOIDByAlgorithm({name:"RSA-OAEP"},!0,"keyEncryptionAlgorithm");let l=s.getOIDByAlgorithm({name:i.oaepHashAlgorithm},!0,"RSAES-OAEP-params"),f=new pe({algorithmId:l,algorithmParams:new Pr});u=new CS({hashAlgorithm:f,maskGenAlgorithm:new pe({algorithmId:"1.2.840.113549.1.1.8",algorithmParams:f.toSchema()})}).toSchema()}else{if(a=s.getOIDByAlgorithm({name:"RSAES-PKCS1-v1_5"}),a===P)throw new Error("Can not find OID for RSAES-PKCS1-v1_5");u=new Pr}let c=new cA({version:0,rid:new Ln({issuer:e.issuer,serialNumber:e.serialNumber}),keyEncryptionAlgorithm:new pe({algorithmId:a,algorithmParams:u}),recipientCertificate:e});this.recipientInfos.push(new Cf({variant:1,value:c}))}break;case 2:{let a=new xm({variant:1,value:new Ln({issuer:e.issuer,serialNumber:e.serialNumber})});this._addKeyAgreeRecipientInfo(a,i,{recipientCertificate:e},s)}break;default:throw new Error(`Unknown "variant" value: ${n}`)}return!0}addRecipientByPreDefinedData(e,t={},n,s=mt(!0)){if(hr.assert(e,"preDefinedData","ArrayBuffer"),!e.byteLength)throw new Error("Pre-defined data could have zero length");if(!t.keyIdentifier){let i=new ArrayBuffer(16),a=new Uint8Array(i);s.getRandomValues(a),t.keyIdentifier=i}switch(t.hmacHashAlgorithm||(t.hmacHashAlgorithm="SHA-512"),t.iterationCount===void 0&&(t.iterationCount=2048),t.keyEncryptionAlgorithm||(t.keyEncryptionAlgorithm={name:"AES-KW",length:256}),t.keyEncryptionAlgorithmParams||(t.keyEncryptionAlgorithmParams=new Pr),n){case 1:{let i=s.getOIDByAlgorithm(t.keyEncryptionAlgorithm,!0,"keyEncryptionAlgorithm"),a=new dA({version:4,kekid:new Wv({keyIdentifier:new Be({valueHex:t.keyIdentifier})}),keyEncryptionAlgorithm:new pe({algorithmId:i,algorithmParams:t.keyEncryptionAlgorithmParams}),preDefinedKEK:e});this.recipientInfos.push(new Cf({variant:3,value:a}))}break;case 2:{let i=s.getOIDByAlgorithm({name:"PBKDF2"},!0,"keyDerivationAlgorithm"),a=new ArrayBuffer(64),u=new Uint8Array(a);s.getRandomValues(u);let c=s.getOIDByAlgorithm({name:"HMAC",hash:{name:t.hmacHashAlgorithm}},!0,"hmacHashAlgorithm"),l=new vm({salt:new Be({valueHex:a}),iterationCount:t.iterationCount,prf:new pe({algorithmId:c,algorithmParams:new Pr})}),f=s.getOIDByAlgorithm(t.keyEncryptionAlgorithm,!0,"keyEncryptionAlgorithm"),h=new mA({version:0,keyDerivationAlgorithm:new pe({algorithmId:i,algorithmParams:l.toSchema()}),keyEncryptionAlgorithm:new pe({algorithmId:f,algorithmParams:t.keyEncryptionAlgorithmParams}),password:e});this.recipientInfos.push(new Cf({variant:4,value:h}))}break;default:throw new Error(`Unknown value for "variant": ${n}`)}}addRecipientByKeyIdentifier(e,t,n,s=mt(!0)){let i=Object.assign({},A7,n||{}),a=new xm({variant:2,value:new fA({subjectKeyIdentifier:new Be({valueHex:t})})});this._addKeyAgreeRecipientInfo(a,i,{recipientPublicKey:e},s)}_addKeyAgreeRecipientInfo(e,t,n,s=mt(!0)){let i=new hA({rid:e}),a=s.getOIDByAlgorithm({name:"AES-KW",length:t.kekEncryptionLength},!0,"keyEncryptionAlgorithm"),u=new pe({algorithmId:a}),c=s.getOIDByAlgorithm({name:"ECDH",kdf:t.kdfAlgorithm},!0,"KeyAgreeRecipientInfo"),l=new ArrayBuffer(64),f=new Uint8Array(l);s.getRandomValues(f);let h={version:3,ukm:new Be({valueHex:l}),keyEncryptionAlgorithm:new pe({algorithmId:c,algorithmParams:u.toSchema()}),recipientEncryptedKeys:new zv({encryptedKeys:[i]})},d=new pA(Object.assign(h,n));this.recipientInfos.push(new Cf({variant:2,value:d}))}async encrypt(e,t,n=mt(!0)){let s=new ArrayBuffer(16),i=new Uint8Array(s);n.getRandomValues(i);let a=new Uint8Array(t),u=n.getOIDByAlgorithm(e,!0,"contentEncryptionAlgorithm"),c=await n.generateKey(e,!0,["encrypt"]),l=await n.encrypt({name:e.name,iv:i},c,a),f=await n.exportKey("raw",c);this.version=2,this.encryptedContentInfo=new Xn({disableSplit:this.policy.disableSplit,contentType:"1.2.840.113549.1.7.1",contentEncryptionAlgorithm:new pe({algorithmId:u,algorithmParams:new Be({valueHex:s})}),encryptedContent:new Be({valueHex:l})});let h=o(async y=>{let w=this.recipientInfos[y].value,S,E;if(w.recipientPublicKey)S=w.recipientPublicKey.algorithm.namedCurve,E=w.recipientPublicKey;else if(w.recipientCertificate){let me=w.recipientCertificate.subjectPublicKeyInfo.algorithm.algorithmParams;if(me.constructor.blockName()!==He.blockName())throw new Error(`Incorrect "recipientCertificate" for index ${y}`);switch(me.valueBlock.toString()){case"1.2.840.10045.3.1.7":S="P-256";break;case"1.3.132.0.34":S="P-384";break;case"1.3.132.0.35":S="P-521";break;default:throw new Error(`Incorrect curve OID for index ${y}`)}E=await w.recipientCertificate.getPublicKey({algorithm:{algorithm:{name:"ECDH",namedCurve:S},usages:[]}},n)}else throw new Error("Unsupported RecipientInfo");let x=_fe[S],b=await n.generateKey({name:"ECDH",namedCurve:S},!0,["deriveBits"]),A=await n.exportKey("spki",b.publicKey),k=await n.deriveBits({name:"ECDH",public:E},b.privateKey,x),I=new pe({schema:w.keyEncryptionAlgorithm.algorithmParams}),T=n.getAlgorithmByOID(I.algorithmId,!0,"aesKWAlgorithm"),V=T.length,U=new ArrayBuffer(4),M=new Uint8Array(U);for(let me=3;me>=0;me--)M[me]=V,V>>=8;let Z=new WR({keyInfo:new pe({algorithmId:I.algorithmId}),entityUInfo:w.ukm,suppPubInfo:new Be({valueHex:U})}).toSchema().toBER(!1),ue=n.getAlgorithmByOID(w.keyEncryptionAlgorithm.algorithmId,!0,"ecdhAlgorithm"),$=await f7(ue.kdf,k,T.length,Z,n),de=await n.importKey("raw",$,{name:"AES-KW"},!0,["wrapKey"]),xe=await n.wrapKey("raw",c,de,{name:"AES-KW"}),ve=new Gv;return ve.variant=3,ve.value=lA.fromBER(A),w.originator=ve,w.recipientEncryptedKeys.encryptedKeys[0].encryptedKey=new Be({valueHex:xe}),{ecdhPrivateKey:b.privateKey}},"SubKeyAgreeRecipientInfo"),d=o(async y=>{let w=this.recipientInfos[y].value,S=n.getAlgorithmByOID(w.keyEncryptionAlgorithm.algorithmId,!0,"keyEncryptionAlgorithm");if(S.name==="RSA-OAEP"){let E=w.keyEncryptionAlgorithm.algorithmParams,x=new CS({schema:E});if(S.hash=n.getAlgorithmByOID(x.hashAlgorithm.algorithmId),!("name"in S.hash))throw new Error(`Incorrect OID for hash algorithm: ${x.hashAlgorithm.algorithmId}`)}try{let E=await w.recipientCertificate.getPublicKey({algorithm:{algorithm:S,usages:["encrypt","wrapKey"]}},n),x=await n.encrypt(E.algorithm,E,f);w.encryptedKey=new Be({valueHex:x})}catch{}},"SubKeyTransRecipientInfo"),g=o(async y=>{let w=this.recipientInfos[y].value,S=n.getAlgorithmByOID(w.keyEncryptionAlgorithm.algorithmId,!0,"kekAlgorithm"),E=await n.importKey("raw",new Uint8Array(w.preDefinedKEK),S,!0,["wrapKey"]),x=await n.wrapKey("raw",c,E,S);w.encryptedKey=new Be({valueHex:x})},"SubKEKRecipientInfo"),m=o(async y=>{let w=this.recipientInfos[y].value,S;if(!w.keyDerivationAlgorithm)throw new Error('Please append encoded "keyDerivationAlgorithm"');if(!w.keyDerivationAlgorithm.algorithmParams)throw new Error('Incorrectly encoded "keyDerivationAlgorithm"');try{S=new vm({schema:w.keyDerivationAlgorithm.algorithmParams})}catch{throw new Error('Incorrectly encoded "keyDerivationAlgorithm"')}let E=new Uint8Array(w.password),x=await n.importKey("raw",E,"PBKDF2",!1,["deriveKey"]),b=n.getAlgorithmByOID(w.keyEncryptionAlgorithm.algorithmId,!0,"kekAlgorithm"),A="SHA-1";S.prf&&(A=n.getAlgorithmByOID(S.prf.algorithmId,!0,"prfAlgorithm").hash.name);let k=new Uint8Array(S.salt.valueBlock.valueHex),I=S.iterationCount,T=await n.deriveKey({name:"PBKDF2",hash:{name:A},salt:k,iterations:I},x,b,!0,["wrapKey"]),V=await n.wrapKey("raw",c,T,b);w.encryptedKey=new Be({valueHex:V})},"SubPasswordRecipientinfo"),v=[];for(let y=0;y<this.recipientInfos.length;y++)switch(this.recipientInfos[y].variant){case 1:v.push(await d(y));break;case 2:v.push(await h(y));break;case 3:v.push(await g(y));break;case 4:v.push(await m(y));break;default:throw new Error(`Unknown recipient type in array with index ${y}`)}return v}async decrypt(e,t,n=mt(!0)){let s=t||{};if(e+1>this.recipientInfos.length)throw new Error(`Maximum value for "index" is: ${this.recipientInfos.length-1}`);let i=o(async v=>{let y=this.recipientInfos[v].value,w,S,E,x=y.originator;if(s.recipientCertificate){let ue=s.recipientCertificate.subjectPublicKeyInfo.algorithm.algorithmParams;if(ue.constructor.blockName()!==He.blockName())throw new Error(`Incorrect "recipientCertificate" for index ${v}`);w=ue.valueBlock.toString()}else if(x.value.algorithm.algorithmParams){let ue=x.value.algorithm.algorithmParams;if(ue.constructor.blockName()!==He.blockName())throw new Error(`Incorrect originator for index ${v}`);w=ue.valueBlock.toString()}else throw new Error('Parameter "recipientCertificate" is mandatory for "KeyAgreeRecipientInfo" if algorithm params are missing from originator');if(!s.recipientPrivateKey)throw new Error('Parameter "recipientPrivateKey" is mandatory for "KeyAgreeRecipientInfo"');switch(w){case"1.2.840.10045.3.1.7":S="P-256",E=256;break;case"1.3.132.0.34":S="P-384",E=384;break;case"1.3.132.0.35":S="P-521",E=528;break;default:throw new Error(`Incorrect curve OID for index ${v}`)}let b,A=n;Ze.isBufferSource(s.recipientPrivateKey)?b=await n.importKey("pkcs8",s.recipientPrivateKey,{name:"ECDH",namedCurve:S},!0,["deriveBits"]):(b=s.recipientPrivateKey,"crypto"in s&&s.crypto&&(A=s.crypto.subtle)),"algorithmParams"in x.value.algorithm||(x.value.algorithm.algorithmParams=new He({value:w}));let k=x.value.toSchema().toBER(!1),I=await n.importKey("spki",k,{name:"ECDH",namedCurve:S},!0,[]),T=await A.deriveBits({name:"ECDH",public:I},b,E);async function V(ue){ue=ue||!1;let $=new pe({schema:y.keyEncryptionAlgorithm.algorithmParams}),de=n.getAlgorithmByOID($.algorithmId,!0,"kwAlgorithm"),xe=de.length,ve=new ArrayBuffer(4),me=new Uint8Array(ve);for(let Ie=3;Ie>=0;Ie--)me[Ie]=xe,xe>>=8;let z={algorithmId:$.algorithmId};ue&&(z.algorithmParams=new Pr);let le=new WR({keyInfo:new pe(z),entityUInfo:y.ukm,suppPubInfo:new Be({valueHex:ve})}).toSchema().toBER(!1),Ae=n.getAlgorithmByOID(y.keyEncryptionAlgorithm.algorithmId,!0,"ecdhAlgorithm");if(!Ae.name)throw new Error(`Incorrect OID for key encryption algorithm: ${y.keyEncryptionAlgorithm.algorithmId}`);return f7(Ae.kdf,T,de.length,le,n)}o(V,"applyKDF");let U=await V(),M=o(async ue=>n.importKey("raw",ue,{name:"AES-KW"},!0,["unwrapKey"]),"importAesKwKey"),ie=await M(U),Z=o(async ue=>{let $=this.encryptedContentInfo.contentEncryptionAlgorithm.algorithmId,de=n.getAlgorithmByOID($,!0,"contentEncryptionAlgorithm");return n.unwrapKey("raw",y.recipientEncryptedKeys.encryptedKeys[0].encryptedKey.valueBlock.valueHexView,ue,{name:"AES-KW"},de,!0,["decrypt"])},"unwrapSessionKey");try{return await Z(ie)}catch{let ue=await V(!0),$=await M(ue);return Z($)}},"SubKeyAgreeRecipientInfo"),a=o(async v=>{let y=this.recipientInfos[v].value;if(!s.recipientPrivateKey)throw new Error('Parameter "recipientPrivateKey" is mandatory for "KeyTransRecipientInfo"');let w=n.getAlgorithmByOID(y.keyEncryptionAlgorithm.algorithmId,!0,"keyEncryptionAlgorithm");if(w.name==="RSA-OAEP"){let k=y.keyEncryptionAlgorithm.algorithmParams,I=new CS({schema:k});if(w.hash=n.getAlgorithmByOID(I.hashAlgorithm.algorithmId),!("name"in w.hash))throw new Error(`Incorrect OID for hash algorithm: ${I.hashAlgorithm.algorithmId}`)}let S,E=n;Ze.isBufferSource(s.recipientPrivateKey)?S=await n.importKey("pkcs8",s.recipientPrivateKey,w,!0,["decrypt"]):(S=s.recipientPrivateKey,"crypto"in s&&s.crypto&&(E=s.crypto.subtle));let x=await E.decrypt(S.algorithm,S,y.encryptedKey.valueBlock.valueHexView),b=this.encryptedContentInfo.contentEncryptionAlgorithm.algorithmId,A=n.getAlgorithmByOID(b,!0,"contentEncryptionAlgorithm");if(!("name"in A))throw new Error(`Incorrect "contentEncryptionAlgorithm": ${b}`);return n.importKey("raw",x,A,!0,["decrypt"])},"SubKeyTransRecipientInfo"),u=o(async v=>{let y=this.recipientInfos[v].value;if(!s.preDefinedData)throw new Error('Parameter "preDefinedData" is mandatory for "KEKRecipientInfo"');let w=n.getAlgorithmByOID(y.keyEncryptionAlgorithm.algorithmId,!0,"kekAlgorithm"),S=await n.importKey("raw",s.preDefinedData,w,!0,["unwrapKey"]),E=this.encryptedContentInfo.contentEncryptionAlgorithm.algorithmId,x=n.getAlgorithmByOID(E,!0,"contentEncryptionAlgorithm");if(!x.name)throw new Error(`Incorrect "contentEncryptionAlgorithm": ${E}`);return n.unwrapKey("raw",y.encryptedKey.valueBlock.valueHexView,S,w,x,!0,["decrypt"])},"SubKEKRecipientInfo"),c=o(async v=>{let y=this.recipientInfos[v].value,w;if(!s.preDefinedData)throw new Error('Parameter "preDefinedData" is mandatory for "KEKRecipientInfo"');if(!y.keyDerivationAlgorithm)throw new Error('Please append encoded "keyDerivationAlgorithm"');if(!y.keyDerivationAlgorithm.algorithmParams)throw new Error('Incorrectly encoded "keyDerivationAlgorithm"');try{w=new vm({schema:y.keyDerivationAlgorithm.algorithmParams})}catch{throw new Error('Incorrectly encoded "keyDerivationAlgorithm"')}let S=await n.importKey("raw",s.preDefinedData,"PBKDF2",!1,["deriveKey"]),E=n.getAlgorithmByOID(y.keyEncryptionAlgorithm.algorithmId,!0,"keyEncryptionAlgorithm"),x=w.prf?n.getAlgorithmByOID(w.prf.algorithmId,!0,"prfAlgorithm").hash.name:"SHA-1",b=new Uint8Array(w.salt.valueBlock.valueHex),A=w.iterationCount,k=await n.deriveKey({name:"PBKDF2",hash:{name:x},salt:b,iterations:A},S,E,!0,["unwrapKey"]),I=this.encryptedContentInfo.contentEncryptionAlgorithm.algorithmId,T=n.getAlgorithmByOID(I,!0,"contentEncryptionAlgorithm");return n.unwrapKey("raw",y.encryptedKey.valueBlock.valueHexView,k,E,T,!0,["decrypt"])},"SubPasswordRecipientinfo"),l;switch(this.recipientInfos[e].variant){case 1:l=await a(e);break;case 2:l=await i(e);break;case 3:l=await u(e);break;case 4:l=await c(e);break;default:throw new Error(`Unknown recipient type in array with index ${e}`)}let f=this.encryptedContentInfo.contentEncryptionAlgorithm.algorithmId,h=n.getAlgorithmByOID(f,!0,"contentEncryptionAlgorithm"),d=this.encryptedContentInfo.contentEncryptionAlgorithm.algorithmParams.valueBlock.valueHex,g=new Uint8Array(d);if(!this.encryptedContentInfo.encryptedContent)throw new Error("Required property `encryptedContent` is empty");let m=this.encryptedContentInfo.getEncryptedContent();return n.decrypt({name:h.name,iv:g},l,m)}};JR.CLASS_NAME="EnvelopedData";var Pp="safeContents",yy="parsedValue",C7="contentInfos",YR=class NS extends Se{static{o(this,"AuthenticatedSafe")}constructor(e={}){super(),this.safeContents=B(e,Pp,NS.defaultValues(Pp)),yy in e&&(this.parsedValue=B(e,yy,NS.defaultValues(yy))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Pp:return[];case yy:return{};default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Pp:return t.length===0;case yy:return t instanceof Object&&Object.keys(t).length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new lt({name:t.contentInfos||P,value:Fr.schema()})]})}fromSchema(e){Ce(e,[C7]);let t=be(e,e,NS.schema({names:{contentInfos:C7}}));ye.assertSchema(t,this.className),this.safeContents=Array.from(t.result.contentInfos,n=>new Fr({schema:n}))}toSchema(){return new K({value:Array.from(this.safeContents,e=>e.toSchema())})}toJSON(){return{safeContents:Array.from(this.safeContents,e=>e.toJSON())}}async parseInternalValues(e,t=mt(!0)){if(Jt.assert(e,Pp),hr.assert(e.safeContents,Pp,"Array"),e.safeContents.length!==this.safeContents.length)throw new hr('Length of "parameters.safeContents" must be equal to "this.safeContents.length"');this.parsedValue={safeContents:[]};for(let[n,s]of this.safeContents.entries()){let i=e.safeContents[n],a=`parameters.safeContents[${n}]`;switch(s.contentType){case S_:{hr.assert(s.content,"this.safeContents[j].content",Be);let u=s.content.getValue();this.parsedValue.safeContents.push({privacyMode:0,value:ym.fromBER(u)})}break;case V7:{let u=new JR({schema:s.content});Jt.assert(a,i,"recipientCertificate","recipientKey");let c=i,l=c.recipientCertificate,f=c.recipientKey,h=await u.decrypt(0,{recipientCertificate:l,recipientPrivateKey:f},t);this.parsedValue.safeContents.push({privacyMode:2,value:ym.fromBER(h)})}break;case M7:{let u=new ex({schema:s.content});Jt.assert(a,i,"password");let c=i.password,l=await u.decrypt({password:c},t);this.parsedValue.safeContents.push({privacyMode:1,value:ym.fromBER(l)})}break;default:throw new Error(`Unknown "contentType" for AuthenticatedSafe: " ${s.contentType}`)}}}async makeInternalValues(e,t=mt(!0)){if(!this.parsedValue)throw new Error('Please run "parseValues" first or add "parsedValue" manually');if(hr.assert(this.parsedValue,"this.parsedValue","object"),hr.assert(this.parsedValue.safeContents,"this.parsedValue.safeContents","Array"),hr.assert(e,"parameters","object"),Jt.assert(e,"safeContents"),hr.assert(e.safeContents,"parameters.safeContents","Array"),e.safeContents.length!==this.parsedValue.safeContents.length)throw new hr('Length of "parameters.safeContents" must be equal to "this.parsedValue.safeContents"');this.safeContents=[];for(let[n,s]of this.parsedValue.safeContents.entries())switch(Jt.assert("content",s,"privacyMode","value"),hr.assert(s.value,"content.value",ym),s.privacyMode){case 0:{let i=s.value.toSchema().toBER(!1);this.safeContents.push(new Fr({contentType:"1.2.840.113549.1.7.1",content:new Be({valueHex:i})}))}break;case 1:{let i=new ex,a=e.safeContents[n];a.contentToEncrypt=s.value.toSchema().toBER(!1),await i.encrypt(a,t),this.safeContents.push(new Fr({contentType:"1.2.840.113549.1.7.6",content:i.toSchema()}))}break;case 2:{let i=new JR,a=s.value.toSchema().toBER(!1),u=e.safeContents[n];switch(Jt.assert(`parameters.safeContents[${n}]`,u,"encryptingCertificate","encryptionAlgorithm"),!0){case u.encryptionAlgorithm.name.toLowerCase()==="aes-cbc":case u.encryptionAlgorithm.name.toLowerCase()==="aes-gcm":break;default:throw new Error(`Incorrect parameter "encryptionAlgorithm" in "parameters.safeContents[i]": ${u.encryptionAlgorithm}`)}switch(!0){case u.encryptionAlgorithm.length===128:case u.encryptionAlgorithm.length===192:case u.encryptionAlgorithm.length===256:break;default:throw new Error(`Incorrect parameter "encryptionAlgorithm.length" in "parameters.safeContents[i]": ${u.encryptionAlgorithm.length}`)}let c=u.encryptionAlgorithm;i.addRecipientByCertificate(u.encryptingCertificate,{},void 0,t),await i.encrypt(c,a,t),this.safeContents.push(new Fr({contentType:"1.2.840.113549.1.7.3",content:i.toSchema()}))}break;default:throw new Error(`Incorrect value for "content.privacyMode": ${s.privacyMode}`)}return this}};YR.CLASS_NAME="AuthenticatedSafe";var Nf="hashAlgorithm",Ld="issuerNameHash",Fd="issuerKeyHash",Tf="serialNumber",Ofe=[Nf,Ld,Fd,Tf],js=class wc extends Se{static{o(this,"CertID")}static async create(e,t,n=mt(!0)){let s=new wc;return await s.createForCertificate(e,t,n),s}constructor(e={}){super(),this.hashAlgorithm=B(e,Nf,wc.defaultValues(Nf)),this.issuerNameHash=B(e,Ld,wc.defaultValues(Ld)),this.issuerKeyHash=B(e,Fd,wc.defaultValues(Fd)),this.serialNumber=B(e,Tf,wc.defaultValues(Tf)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Nf:return new pe;case Ld:case Fd:return new Be;case Tf:return new he;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Nf:return t.algorithmId===P&&!("algorithmParams"in t);case Ld:case Fd:case Tf:return t.isEqual(wc.defaultValues(Tf));default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[pe.schema(t.hashAlgorithmObject||{names:{blockName:t.hashAlgorithm||P}}),new Be({name:t.issuerNameHash||P}),new Be({name:t.issuerKeyHash||P}),new he({name:t.serialNumber||P})]})}fromSchema(e){Ce(e,Ofe);let t=be(e,e,wc.schema({names:{hashAlgorithm:Nf,issuerNameHash:Ld,issuerKeyHash:Fd,serialNumber:Tf}}));ye.assertSchema(t,this.className),this.hashAlgorithm=new pe({schema:t.result.hashAlgorithm}),this.issuerNameHash=t.result.issuerNameHash,this.issuerKeyHash=t.result.issuerKeyHash,this.serialNumber=t.result.serialNumber}toSchema(){return new K({value:[this.hashAlgorithm.toSchema(),this.issuerNameHash,this.issuerKeyHash,this.serialNumber]})}toJSON(){return{hashAlgorithm:this.hashAlgorithm.toJSON(),issuerNameHash:this.issuerNameHash.toJSON(),issuerKeyHash:this.issuerKeyHash.toJSON(),serialNumber:this.serialNumber.toJSON()}}isEqual(e){return!(this.hashAlgorithm.algorithmId!==e.hashAlgorithm.algorithmId||!Ze.isEqual(this.issuerNameHash.valueBlock.valueHexView,e.issuerNameHash.valueBlock.valueHexView)||!Ze.isEqual(this.issuerKeyHash.valueBlock.valueHexView,e.issuerKeyHash.valueBlock.valueHexView)||!this.serialNumber.isEqual(e.serialNumber))}async createForCertificate(e,t,n=mt(!0)){Jt.assert(t,Nf,"issuerCertificate");let s=n.getOIDByAlgorithm({name:t.hashAlgorithm},!0,"hashAlgorithm");this.hashAlgorithm=new pe({algorithmId:s,algorithmParams:new Pr});let i=t.issuerCertificate;this.serialNumber=e.serialNumber;let a=await n.digest({name:t.hashAlgorithm},i.subject.toSchema().toBER(!1));this.issuerNameHash=new Be({valueHex:a});let u=i.subjectPublicKeyInfo.subjectPublicKey.valueBlock.valueHexView,c=await n.digest({name:t.hashAlgorithm},u);this.issuerKeyHash=new Be({valueHex:c})}};js.CLASS_NAME="CertID";var Ud="certID",Vd="certStatus",Md="thisUpdate",bc="nextUpdate",If="singleExtensions",Pfe=[Ud,Vd,Md,bc,If],QR=class Sc extends Se{static{o(this,"SingleResponse")}constructor(e={}){super(),this.certID=B(e,Ud,Sc.defaultValues(Ud)),this.certStatus=B(e,Vd,Sc.defaultValues(Vd)),this.thisUpdate=B(e,Md,Sc.defaultValues(Md)),bc in e&&(this.nextUpdate=B(e,bc,Sc.defaultValues(bc))),If in e&&(this.singleExtensions=B(e,If,Sc.defaultValues(If))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Ud:return new js;case Vd:return{};case Md:case bc:return new Date(0,0,0);case If:return[];default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Ud:return js.compareWithDefault("hashAlgorithm",t.hashAlgorithm)&&js.compareWithDefault("issuerNameHash",t.issuerNameHash)&&js.compareWithDefault("issuerKeyHash",t.issuerKeyHash)&&js.compareWithDefault("serialNumber",t.serialNumber);case Vd:return Object.keys(t).length===0;case Md:case bc:return t===Sc.defaultValues(e);default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[js.schema(t.certID||{}),new Sr({value:[new tt({name:t.certStatus||P,idBlock:{tagClass:3,tagNumber:0}}),new ae({name:t.certStatus||P,idBlock:{tagClass:3,tagNumber:1},value:[new br,new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new _u]})]}),new tt({name:t.certStatus||P,idBlock:{tagClass:3,tagNumber:2},lenBlock:{length:1}})]}),new br({name:t.thisUpdate||P}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new br({name:t.nextUpdate||P})]}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:1},value:[un.schema(t.singleExtensions||{})]})]})}fromSchema(e){Ce(e,Pfe);let t=be(e,e,Sc.schema({names:{certID:{names:{blockName:Ud}},certStatus:Vd,thisUpdate:Md,nextUpdate:bc,singleExtensions:{names:{blockName:If}}}}));ye.assertSchema(t,this.className),this.certID=new js({schema:t.result.certID}),this.certStatus=t.result.certStatus,this.thisUpdate=t.result.thisUpdate.toDate(),bc in t.result&&(this.nextUpdate=t.result.nextUpdate.toDate()),If in t.result&&(this.singleExtensions=Array.from(t.result.singleExtensions.valueBlock.value,n=>new di({schema:n})))}toSchema(){let e=[];return e.push(this.certID.toSchema()),e.push(this.certStatus),e.push(new br({valueDate:this.thisUpdate})),this.nextUpdate&&e.push(new ae({idBlock:{tagClass:3,tagNumber:0},value:[new br({valueDate:this.nextUpdate})]})),this.singleExtensions&&e.push(new ae({idBlock:{tagClass:3,tagNumber:1},value:[new K({value:Array.from(this.singleExtensions,t=>t.toSchema())})]})),new K({value:e})}toJSON(){let e={certID:this.certID.toJSON(),certStatus:this.certStatus.toJSON(),thisUpdate:this.thisUpdate};return this.nextUpdate&&(e.nextUpdate=this.nextUpdate),this.singleExtensions&&(e.singleExtensions=Array.from(this.singleExtensions,t=>t.toJSON())),e}};QR.CLASS_NAME="SingleResponse";var Pb="tbs",Df="version",Ev="responderID",wv="producedAt",bv="responses",jd="responseExtensions",eh="ResponseData",TS=`${eh}.${Df}`,qd=`${eh}.${Ev}`,ZR=`${eh}.${wv}`,e_=`${eh}.${bv}`,IS=`${eh}.${jd}`,kfe=[eh,TS,qd,ZR,e_,IS],bo=class Sa extends Se{static{o(this,"ResponseData")}get tbs(){return Ze.toArrayBuffer(this.tbsView)}set tbs(e){this.tbsView=new Uint8Array(e)}constructor(e={}){super(),this.tbsView=new Uint8Array(B(e,Pb,Sa.defaultValues(Pb))),Df in e&&(this.version=B(e,Df,Sa.defaultValues(Df))),this.responderID=B(e,Ev,Sa.defaultValues(Ev)),this.producedAt=B(e,wv,Sa.defaultValues(wv)),this.responses=B(e,bv,Sa.defaultValues(bv)),jd in e&&(this.responseExtensions=B(e,jd,Sa.defaultValues(jd))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Df:return 0;case Pb:return Kr;case Ev:return{};case wv:return new Date(0,0,0);case bv:case jd:return[];default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Pb:return t.byteLength===0;case Ev:return Object.keys(t).length===0;case wv:return t===Sa.defaultValues(e);case bv:case jd:return t.length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||eh,value:[new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new he({name:t.version||TS})]}),new Sr({value:[new ae({name:t.responderID||qd,idBlock:{tagClass:3,tagNumber:1},value:[Ar.schema(t.ResponseDataByName||{names:{blockName:"ResponseData.byName"}})]}),new ae({name:t.responderID||qd,idBlock:{tagClass:3,tagNumber:2},value:[new Be({name:t.ResponseDataByKey||"ResponseData.byKey"})]})]}),new br({name:t.producedAt||ZR}),new K({value:[new lt({name:e_,value:QR.schema(t.response||{})})]}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:1},value:[un.schema(t.extensions||{names:{blockName:IS}})]})]})}fromSchema(e){Ce(e,kfe);let t=be(e,e,Sa.schema());ye.assertSchema(t,this.className),this.tbsView=t.result.ResponseData.valueBeforeDecodeView,TS in t.result&&(this.version=t.result[TS].valueBlock.valueDec),t.result[qd].idBlock.tagNumber===1?this.responderID=new Ar({schema:t.result[qd].valueBlock.value[0]}):this.responderID=t.result[qd].valueBlock.value[0],this.producedAt=t.result[ZR].toDate(),this.responses=Array.from(t.result[e_],n=>new QR({schema:n})),IS in t.result&&(this.responseExtensions=Array.from(t.result[IS].valueBlock.value,n=>new di({schema:n})))}toSchema(e=!1){let t;if(e===!1){if(!this.tbsView.byteLength)return Sa.schema();let n=Or(this.tbsView);ye.assert(n,"TBS Response Data"),t=n.result}else{let n=[];Df in this&&n.push(new ae({idBlock:{tagClass:3,tagNumber:0},value:[new he({value:this.version})]})),this.responderID instanceof Ar?n.push(new ae({idBlock:{tagClass:3,tagNumber:1},value:[this.responderID.toSchema()]})):n.push(new ae({idBlock:{tagClass:3,tagNumber:2},value:[this.responderID]})),n.push(new br({valueDate:this.producedAt})),n.push(new K({value:Array.from(this.responses,s=>s.toSchema())})),this.responseExtensions&&n.push(new ae({idBlock:{tagClass:3,tagNumber:1},value:[new K({value:Array.from(this.responseExtensions,s=>s.toSchema())})]})),t=new K({value:n})}return t}toJSON(){let e={};return Df in this&&(e.version=this.version),this.responderID&&(e.responderID=this.responderID),this.producedAt&&(e.producedAt=this.producedAt),this.responses&&(e.responses=Array.from(this.responses,t=>t.toJSON())),this.responseExtensions&&(e.responseExtensions=Array.from(this.responseExtensions,t=>t.toJSON())),e}};bo.CLASS_NAME="ResponseData";var tR="trustedCerts",rR="certs",nR="crls",sR="ocsps",iR="checkDate",aR="findOrigin",oR="findIssuer",$f;(function(r){r[r.unknown=-1]="unknown",r[r.success=0]="success",r[r.noRevocation=11]="noRevocation",r[r.noPath=60]="noPath",r[r.noValidPath=97]="noValidPath"})($f||($f={}));var Hd=class hH extends Error{static{o(this,"ChainValidationError")}constructor(e,t){super(t),this.name=hH.NAME,this.code=e,this.message=t}};Hd.NAME="ChainValidationError";function Lfe(r,e){for(let t=0;t<e.length;t++)if(Ze.isEqual(r.tbsView,e[t].tbsView))return!0;return!1}o(Lfe,"isTrusted");var pH=class dH{static{o(this,"CertificateChainValidationEngine")}constructor(e={}){this.trustedCerts=B(e,tR,this.defaultValues(tR)),this.certs=B(e,rR,this.defaultValues(rR)),this.crls=B(e,nR,this.defaultValues(nR)),this.ocsps=B(e,sR,this.defaultValues(sR)),this.checkDate=B(e,iR,this.defaultValues(iR)),this.findOrigin=B(e,aR,this.defaultValues(aR)),this.findIssuer=B(e,oR,this.defaultValues(oR))}static defaultFindOrigin(e,t){e.tbsView.byteLength===0&&(e.tbsView=new Uint8Array(e.encodeTBS().toBER()));for(let n of t.certs)if(n.tbsView.byteLength===0&&(n.tbsView=new Uint8Array(n.encodeTBS().toBER())),Ze.isEqual(e.tbsView,n.tbsView))return"Intermediate Certificates";for(let n of t.trustedCerts)if(n.tbsView.byteLength===0&&(n.tbsView=new Uint8Array(n.encodeTBS().toBER())),Ze.isEqual(e.tbsView,n.tbsView))return"Trusted Certificates";return"Unknown"}async defaultFindIssuer(e,t,n=mt(!0)){let s=[],i=null,a=null,u=null;if(e.subject.isEqual(e.issuer))try{if(await e.verify(void 0,n))return[e]}catch{}if(e.extensions){for(let l of e.extensions)if(l.extnID===w_&&l.parsedValue instanceof C_){l.parsedValue.keyIdentifier?i=l.parsedValue.keyIdentifier:(l.parsedValue.authorityCertIssuer&&(a=l.parsedValue.authorityCertIssuer),l.parsedValue.authorityCertSerialNumber&&(u=l.parsedValue.authorityCertSerialNumber));break}}function c(l){if(i!==null&&l.extensions){let h=!1;for(let d of l.extensions)if(d.extnID===Uce&&d.parsedValue){h=!0,Ze.isEqual(d.parsedValue.valueBlock.valueHex,i.valueBlock.valueHexView)&&s.push(l);break}if(h)return}let f=!1;u!==null&&(f=l.serialNumber.isEqual(u)),a!==null?l.subject.isEqual(a)&&f&&s.push(l):e.issuer.isEqual(l.subject)&&s.push(l)}o(c,"checkCertificate");for(let l of t.trustedCerts)c(l);for(let l of t.certs)c(l);for(let l=s.length-1;l>=0;l--)try{await e.verify(s[l],n)===!1&&s.splice(l,1)}catch{s.splice(l,1)}return s}defaultValues(e){switch(e){case tR:return[];case rR:return[];case nR:return[];case sR:return[];case iR:return new Date;case aR:return dH.defaultFindOrigin;case oR:return this.defaultFindIssuer;default:throw new Error(`Invalid member name for CertificateChainValidationEngine class: ${e}`)}}async sort(e=!1,t=mt(!0)){let n=[],s=o(async(m,v)=>{let y=[];function w(E){let x=!0;for(let b=0;b<E.length;b++){for(let A=0;A<E.length;A++)if(A!==b&&E[b]===E[A]){x=!1;break}if(!x)break}return x}if(o(w,"checkUnique"),Lfe(m,this.trustedCerts))return[[m]];let S=await this.findIssuer(m,this,v);if(S.length===0)throw new Error("No valid certificate paths found");for(let E=0;E<S.length;E++){if(Ze.isEqual(S[E].tbsView,m.tbsView)){y.push([S[E]]);continue}let x=await s(S[E],v);for(let b=0;b<x.length;b++){let A=x[b].slice();A.splice(0,0,S[E]),w(A)?y.push(A):y.push(x[b])}}return y},"buildPath"),i=o(async m=>{let v=[],y=[],w=[];if(v.push(...n.filter(S=>m.issuer.isEqual(S.subject))),v.length===0)return{status:1,statusMessage:"No certificate's issuers"};if(y.push(...this.crls.filter(S=>S.issuer.isEqual(m.issuer))),y.length===0)return{status:2,statusMessage:"No CRLs for specific certificate issuer"};for(let S=0;S<y.length;S++){let E=y[S];if(!(E.nextUpdate&&E.nextUpdate.value<this.checkDate))for(let x=0;x<v.length;x++)try{if(await y[S].verify({issuerCertificate:v[x]},t)){w.push({crl:y[S],certificate:v[x]});break}}catch{}}return w.length?{status:0,statusMessage:P,result:w}:{status:3,statusMessage:"No valid CRLs found"}},"findCRL"),a=o(async(m,v)=>{let y=t.getAlgorithmByOID(m.signatureAlgorithm.algorithmId);if(!y.name||!y.hash)return 1;for(let w=0;w<this.ocsps.length;w++){let E=await this.ocsps[w].getCertificateStatus(m,v,t);if(E.isForCertificate)return E.status===0?0:1}return 2},"findOCSP");async function u(m,v=!1){let y=!1,w=!1,S=!1,E=!1;if(m.extensions){for(let x=0;x<m.extensions.length;x++){let b=m.extensions[x];if(b.critical&&!b.parsedValue)return{result:!1,resultCode:6,resultMessage:`Unable to parse critical certificate extension: ${b.extnID}`};if(b.extnID===Vce){S=!0;let A=new Uint8Array(b.parsedValue.valueBlock.valueHex);(A[0]&4)===4&&(w=!0),(A[0]&2)===2&&(E=!0)}b.extnID===x_&&"cA"in b.parsedValue&&b.parsedValue.cA===!0&&(y=!0)}if(w===!0&&y===!1)return{result:!1,resultCode:3,resultMessage:'Unable to build certificate chain - using "keyCertSign" flag set without BasicConstraints'};if(S===!0&&y===!0&&w===!1)return{result:!1,resultCode:4,resultMessage:'Unable to build certificate chain - "keyCertSign" flag was not set'};if(y===!0&&S===!0&&v&&E===!1)return{result:!1,resultCode:5,resultMessage:'Unable to build certificate chain - intermediate certificate must have "cRLSign" key usage flag'}}return y===!1?{result:!1,resultCode:7,resultMessage:"Unable to build certificate chain - more than one possible end-user certificate"}:{result:!0,resultCode:0,resultMessage:P}}o(u,"checkForCA");let c=o(async(m,v)=>{for(let y=0;y<m.length;y++)if(m[y].notBefore.value>v||m[y].notAfter.value<v)return{result:!1,resultCode:8,resultMessage:"The certificate is either not yet valid or expired"};if(m.length<2)return{result:!1,resultCode:9,resultMessage:"Too short certificate path"};for(let y=m.length-2;y>=0;y--)if(m[y].issuer.isEqual(m[y].subject)===!1&&m[y].issuer.isEqual(m[y+1].subject)===!1)return{result:!1,resultCode:10,resultMessage:"Incorrect name chaining"};if(this.crls.length!==0||this.ocsps.length!==0)for(let y=0;y<m.length-1;y++){let w=2,S={status:0,statusMessage:P};if(this.ocsps.length!==0)switch(w=await a(m[y],m[y+1]),w){case 0:continue;case 1:return{result:!1,resultCode:12,resultMessage:"One of certificates was revoked via OCSP response"}}if(this.crls.length!==0){if(S=await i(m[y]),S.status===0&&S.result)for(let E=0;E<S.result.length;E++){if(S.result[E].crl.isCertificateRevoked(m[y]))return{result:!1,resultCode:12,resultMessage:"One of certificates had been revoked"};if((await u(S.result[E].certificate,!0)).result===!1)return{result:!1,resultCode:13,resultMessage:"CRL issuer certificate is not a CA certificate or does not have crlSign flag"}}else if(e===!1)throw new Hd($f.noRevocation,`No revocation values found for one of certificates: ${S.statusMessage}`)}else if(w===2)return{result:!1,resultCode:11,resultMessage:"No revocation values found for one of certificates"};if(w===2&&S.status===2&&e){let E=m[y+1],x=!1;if(E.extensions)for(let b of E.extensions)switch(b.extnID){case P7:case E_:case b_:x=!0;break}if(x)throw new Hd($f.noRevocation,`No revocation values found for one of certificates: ${S.statusMessage}`)}}for(let[y,w]of m.entries()){if(!y)continue;if(!(await u(w)).result)return{result:!1,resultCode:14,resultMessage:"One of intermediate certificates is not a CA certificate"}}return{result:!0}},"basicCheck");n.push(...this.trustedCerts),n.push(...this.certs);for(let m=0;m<n.length;m++)for(let v=0;v<n.length;v++)if(m!==v&&Ze.isEqual(n[m].tbsView,n[v].tbsView)){n.splice(v,1),m=0;break}let l=n[n.length-1],f,h=[l];if(f=await s(l,t),f.length===0)throw new Hd($f.noPath,"Unable to find certificate path");for(let m=f.length-1;m>=0;m--){let v=!1;for(let y=0;y<f[m].length;y++){let w=f[m][y];for(let S=0;S<this.trustedCerts.length;S++)if(Ze.isEqual(w.tbsView,this.trustedCerts[S].tbsView)){v=!0;break}if(v)break}v||f.splice(m,1)}if(f.length===0)throw new Hd($f.noValidPath,"No valid certificate paths found");let d=f[0].length,g=0;for(let m=0;m<f.length;m++)f[m].length<d&&(d=f[m].length,g=m);for(let m=0;m<f[g].length;m++)h.push(f[g][m]);if(f=await c(h,this.checkDate),f.result===!1)throw f;return h}async verify(e={},t=mt(!0)){function n(c,l){let f=Rc(c),h=Rc(l),d=f.split("."),g=h.split("."),m=d.length,v=g.length;if(m===0||v===0||m<v)return!1;for(let y=0;y<m;y++)if(d[y].length===0)return!1;for(let y=0;y<v;y++)if(g[y].length===0){if(y===0){if(v===1)return!1;continue}return!1}for(let y=0;y<v;y++)if(g[v-1-y].length!==0&&d[m-1-y].localeCompare(g[v-1-y])!==0)return!1;return!0}o(n,"compareDNSName");function s(c,l){let f=Rc(c),h=Rc(l),d=f.split("@"),g=h.split("@");if(d.length===0||g.length===0||d.length<g.length)return!1;if(g.length===1){if(n(d[1],g[0])){let v=d[1].split("."),y=g[0].split(".");return y[0].length===0?!0:v.length===y.length}return!1}return f.localeCompare(h)===0}o(s,"compareRFC822Name");function i(c,l){let f=Rc(c),h=Rc(l),d=f.split("/");if(h.split("/").length>1)return!1;if(d.length>1){for(let v=0;v<d.length;v++)if(d[v].length>0&&d[v].charAt(d[v].length-1)!==":"){f=d[v].split(":")[0];break}}if(n(f,h)){let v=f.split("."),y=h.split(".");return y[0].length===0?!0:v.length===y.length}return!1}o(i,"compareUniformResourceIdentifier");function a(c,l){let f=c.valueBlock.valueHexView,h=l.valueBlock.valueHexView;if(f.length===4&&h.length===8){for(let d=0;d<4;d++)if((f[d]^h[d])&h[d+4])return!1;return!0}if(f.length===16&&h.length===32){for(let d=0;d<16;d++)if((f[d]^h[d])&h[d+16])return!1;return!0}return!1}o(a,"compareIPAddress");function u(c,l){if(c.typesAndValues.length===0||l.typesAndValues.length===0)return!0;if(c.typesAndValues.length<l.typesAndValues.length)return!1;let f=!0,h=0;for(let d=0;d<l.typesAndValues.length;d++){let g=!1;for(let m=h;m<c.typesAndValues.length;m++)if(g=c.typesAndValues[m].isEqual(l.typesAndValues[d]),c.typesAndValues[m].type===l.typesAndValues[d].type&&(f=f&&g),g===!0)if(h===0||h===m){h=m+1;break}else return!1;if(g===!1)return!1}return h===0?!1:f}o(u,"compareDirectoryName");try{if(this.certs.length===0)throw new Error("Empty certificate array");let c=e.passedWhenNotRevValues||!1,l=e.initialPolicySet||[li],f=e.initialExplicitPolicy||!1,h=e.initialPolicyMappingInhibit||!1,d=e.initialInhibitPolicy||!1,g=e.initialPermittedSubtreesSet||[],m=e.initialExcludedSubtreesSet||[],v=e.initialRequiredNameForms||[],y=f,w=h,S=d,E=[!1,!1,!1],x=0,b=0,A=0,k=g,I=m,T=v,V=1;this.certs=await this.sort(c,t);let U=[];U.push(li);let M=[],ie=new Array(this.certs.length-1);for(let me=0;me<this.certs.length-1;me++)ie[me]=!0;M.push(ie);let Z=new Array(this.certs.length-1),ue=new Array(this.certs.length-1),$=y?this.certs.length-1:-1;for(let me=this.certs.length-2;me>=0;me--,V++){let z=this.certs[me];if(z.extensions){for(let ee=0;ee<z.extensions.length;ee++){let le=z.extensions[ee];if(le.extnID===k7){ue[me]=le.parsedValue;for(let Ae=0;Ae<U.length;Ae++)if(U[Ae]===li){delete M[Ae][me];break}for(let Ae=0;Ae<le.parsedValue.certificatePolicies.length;Ae++){let Ie=-1,_=le.parsedValue.certificatePolicies[Ae].policyIdentifier;for(let D=0;D<U.length;D++)if(_===U[D]){Ie=D;break}if(Ie===-1){U.push(_);let D=new Array(this.certs.length-1);D[me]=!0,M.push(D)}else M[Ie][me]=!0}}if(le.extnID===L7){if(w)return{result:!1,resultCode:98,resultMessage:"Policy mapping prohibited"};Z[me]=le.parsedValue}le.extnID===F7&&y===!1&&(le.parsedValue.requireExplicitPolicy===0?(y=!0,$=me):E[0]===!1?(E[0]=!0,x=le.parsedValue.requireExplicitPolicy):x=x>le.parsedValue.requireExplicitPolicy?le.parsedValue.requireExplicitPolicy:x,le.parsedValue.inhibitPolicyMapping===0?w=!0:E[1]===!1?(E[1]=!0,b=le.parsedValue.inhibitPolicyMapping+1):b=b>le.parsedValue.inhibitPolicyMapping+1?le.parsedValue.inhibitPolicyMapping+1:b),le.extnID===Gce&&S===!1&&(le.parsedValue.valueBlock.valueDec===0?S=!0:E[2]===!1?(E[2]=!0,A=le.parsedValue.valueBlock.valueDec):A=A>le.parsedValue.valueBlock.valueDec?le.parsedValue.valueBlock.valueDec:A)}if(S===!0){let ee=-1;for(let le=0;le<U.length;le++)if(U[le]===li){ee=le;break}ee!==-1&&delete M[0][me]}y===!1&&E[0]===!0&&(x--,x===0&&(y=!0,$=me,E[0]=!1)),w===!1&&E[1]===!0&&(b--,b===0&&(w=!0,E[1]=!1)),S===!1&&E[2]===!0&&(A--,A===0&&(S=!0,E[2]=!1))}}for(let me=0;me<this.certs.length-1;me++)if(me<this.certs.length-2&&typeof Z[me+1]<"u")for(let z=0;z<Z[me+1].mappings.length;z++){if(Z[me+1].mappings[z].issuerDomainPolicy===li||Z[me+1].mappings[z].subjectDomainPolicy===li)return{result:!1,resultCode:99,resultMessage:'The "anyPolicy" should not be a part of policy mapping scheme'};let ee=-1,le=-1;for(let Ae=0;Ae<U.length;Ae++)U[Ae]===Z[me+1].mappings[z].issuerDomainPolicy&&(ee=Ae),U[Ae]===Z[me+1].mappings[z].subjectDomainPolicy&&(le=Ae);typeof M[ee][me]<"u"&&delete M[ee][me];for(let Ae=0;Ae<ue[me].certificatePolicies.length;Ae++)if(Z[me+1].mappings[z].subjectDomainPolicy===ue[me].certificatePolicies[Ae].policyIdentifier&&ee!==-1&&le!==-1)for(let Ie=0;Ie<=me;Ie++)typeof M[le][Ie]<"u"&&(M[ee][Ie]=!0,delete M[le][Ie])}for(let me=0;me<U.length;me++)if(U[me]===li)for(let z=0;z<$;z++)delete M[me][z];let de=[];for(let me=0;me<M.length;me++){let z=!0;for(let ee=0;ee<this.certs.length-1;ee++){let le=!1;if(ee<$&&U[me]===li&&U.length>1){z=!1;break}if(typeof M[me][ee]>"u"){if(ee>=$){for(let Ae=0;Ae<U.length;Ae++)if(U[Ae]===li){M[Ae][ee]===!0&&(le=!0);break}}if(!le){z=!1;break}}}z===!0&&de.push(U[me])}let xe=[];if(l.length===1&&l[0]===li&&y===!1)xe=l;else if(de.length===1&&de[0]===li)xe=l;else for(let me=0;me<de.length;me++)for(let z=0;z<l.length;z++)if(l[z]===de[me]||l[z]===li){xe.push(de[me]);break}let ve={result:xe.length>0,resultCode:0,resultMessage:xe.length>0?P:'Zero "userConstrPolicies" array, no intersections with "authConstrPolicies"',authConstrPolicies:de,userConstrPolicies:xe,explicitPolicyIndicator:y,policyMappings:Z,certificatePath:this.certs};if(xe.length===0||ve.result===!1)return ve;V=1;for(let me=this.certs.length-2;me>=0;me--,V++){let z=this.certs[me],ee=[],le=[],Ae=[];if(z.extensions)for(let Y=0;Y<z.extensions.length;Y++){let q=z.extensions[Y];q.extnID===O7&&("permittedSubtrees"in q.parsedValue&&(le=le.concat(q.parsedValue.permittedSubtrees)),"excludedSubtrees"in q.parsedValue&&(Ae=Ae.concat(q.parsedValue.excludedSubtrees))),q.extnID===D7&&(ee=ee.concat(q.parsedValue.altNames))}let Ie=T.length<=0;for(let Y=0;Y<T.length;Y++)switch(T[Y].base.type){case 4:{if(T[Y].base.value.typesAndValues.length!==z.subject.typesAndValues.length)continue;Ie=!0;for(let q=0;q<z.subject.typesAndValues.length;q++)if(z.subject.typesAndValues[q].type!==T[Y].base.value.typesAndValues[q].type){Ie=!1;break}if(Ie===!0)break}break;default:}if(Ie===!1)throw ve.result=!1,ve.resultCode=21,ve.resultMessage="No necessary name form found",ve;let _=[[],[],[],[],[]];for(let Y=0;Y<k.length;Y++)switch(k[Y].base.type){case 1:_[0].push(k[Y]);break;case 2:_[1].push(k[Y]);break;case 4:_[2].push(k[Y]);break;case 6:_[3].push(k[Y]);break;case 7:_[4].push(k[Y]);break;default:}for(let Y=0;Y<5;Y++){let q=!1,Oe=!1,R=_[Y];for(let N=0;N<R.length;N++){switch(Y){case 0:if(ee.length>0)for(let te=0;te<ee.length;te++)ee[te].type===1&&(Oe=!0,q=q||s(ee[te].value,R[N].base.value));else for(let te=0;te<z.subject.typesAndValues.length;te++)(z.subject.typesAndValues[te].type==="1.2.840.113549.1.9.1"||z.subject.typesAndValues[te].type==="0.9.2342.19200300.100.1.3")&&(Oe=!0,q=q||s(z.subject.typesAndValues[te].value.valueBlock.value,R[N].base.value));break;case 1:if(ee.length>0)for(let te=0;te<ee.length;te++)ee[te].type===2&&(Oe=!0,q=q||n(ee[te].value,R[N].base.value));break;case 2:Oe=!0,q=u(z.subject,R[N].base.value);break;case 3:if(ee.length>0)for(let te=0;te<ee.length;te++)ee[te].type===6&&(Oe=!0,q=q||i(ee[te].value,R[N].base.value));break;case 4:if(ee.length>0)for(let te=0;te<ee.length;te++)ee[te].type===7&&(Oe=!0,q=q||a(ee[te].value,R[N].base.value));break;default:}if(q)break}if(q===!1&&R.length>0&&Oe)throw ve.result=!1,ve.resultCode=41,ve.resultMessage='Failed to meet "permitted sub-trees" name constraint',ve}let D=!1;for(let Y=0;Y<I.length;Y++){switch(I[Y].base.type){case 1:if(ee.length>=0)for(let q=0;q<ee.length;q++)ee[q].type===1&&(D=D||s(ee[q].value,I[Y].base.value));else for(let q=0;q<z.subject.typesAndValues.length;q++)(z.subject.typesAndValues[q].type==="1.2.840.113549.1.9.1"||z.subject.typesAndValues[q].type==="0.9.2342.19200300.100.1.3")&&(D=D||s(z.subject.typesAndValues[q].value.valueBlock.value,I[Y].base.value));break;case 2:if(ee.length>0)for(let q=0;q<ee.length;q++)ee[q].type===2&&(D=D||n(ee[q].value,I[Y].base.value));break;case 4:D=D||u(z.subject,I[Y].base.value);break;case 6:if(ee.length>0)for(let q=0;q<ee.length;q++)ee[q].type===6&&(D=D||i(ee[q].value,I[Y].base.value));break;case 7:if(ee.length>0)for(let q=0;q<ee.length;q++)ee[q].type===7&&(D=D||a(ee[q].value,I[Y].base.value));break;default:}if(D)break}if(D===!0)throw ve.result=!1,ve.resultCode=42,ve.resultMessage='Failed to meet "excluded sub-trees" name constraint',ve;k=k.concat(le),I=I.concat(Ae)}return ve}catch(c){return c instanceof Error?c instanceof Hd?{result:!1,resultCode:c.code,resultMessage:c.message,error:c}:{result:!1,resultCode:$f.unknown,resultMessage:c.message,error:c}:c&&typeof c=="object"&&"resultMessage"in c?c:{result:!1,resultCode:-1,resultMessage:`${c}`}}}},DS="tbsResponseData",Sv="signatureAlgorithm",Av="signature",Kd="certs",tx="BasicOCSPResponse",t_=`${tx}.${DS}`,r_=`${tx}.${Sv}`,n_=`${tx}.${Av}`,BS=`${tx}.${Kd}`,Ffe=[t_,r_,n_,BS],Jv=class Bf extends Se{static{o(this,"BasicOCSPResponse")}constructor(e={}){super(),this.tbsResponseData=B(e,DS,Bf.defaultValues(DS)),this.signatureAlgorithm=B(e,Sv,Bf.defaultValues(Sv)),this.signature=B(e,Av,Bf.defaultValues(Av)),Kd in e&&(this.certs=B(e,Kd,Bf.defaultValues(Kd))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case DS:return new bo;case Sv:return new pe;case Av:return new Ct;case Kd:return[];default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case"type":{let n=bo.compareWithDefault("tbs",t.tbs)&&bo.compareWithDefault("responderID",t.responderID)&&bo.compareWithDefault("producedAt",t.producedAt)&&bo.compareWithDefault("responses",t.responses);return"responseExtensions"in t&&(n=n&&bo.compareWithDefault("responseExtensions",t.responseExtensions)),n}case Sv:return t.algorithmId===P&&!("algorithmParams"in t);case Av:return t.isEqual(Bf.defaultValues(e));case Kd:return t.length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||tx,value:[bo.schema(t.tbsResponseData||{names:{blockName:t_}}),pe.schema(t.signatureAlgorithm||{names:{blockName:r_}}),new Ct({name:t.signature||n_}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new K({value:[new lt({name:BS,value:Gn.schema(t.certs||{})})]})]})]})}fromSchema(e){Ce(e,Ffe);let t=be(e,e,Bf.schema());ye.assertSchema(t,this.className),this.tbsResponseData=new bo({schema:t.result[t_]}),this.signatureAlgorithm=new pe({schema:t.result[r_]}),this.signature=t.result[n_],BS in t.result&&(this.certs=Array.from(t.result[BS],n=>new Gn({schema:n})))}toSchema(){let e=[];return e.push(this.tbsResponseData.toSchema()),e.push(this.signatureAlgorithm.toSchema()),e.push(this.signature),this.certs&&e.push(new ae({idBlock:{tagClass:3,tagNumber:0},value:[new K({value:Array.from(this.certs,t=>t.toSchema())})]})),new K({value:e})}toJSON(){let e={tbsResponseData:this.tbsResponseData.toJSON(),signatureAlgorithm:this.signatureAlgorithm.toJSON(),signature:this.signature.toJSON()};return this.certs&&(e.certs=Array.from(this.certs,t=>t.toJSON())),e}async getCertificateStatus(e,t,n=mt(!0)){let s={isForCertificate:!1,status:2},i={},a=[];for(let u of this.tbsResponseData.responses){let c=n.getAlgorithmByOID(u.certID.hashAlgorithm.algorithmId,!0,"CertID.hashAlgorithm");if(!i[c.name]){i[c.name]=1;let l=new js;a.push(l),await l.createForCertificate(e,{hashAlgorithm:c.name,issuerCertificate:t},n)}}for(let u of this.tbsResponseData.responses)for(let c of a)if(u.certID.isEqual(c)){s.isForCertificate=!0;try{switch(u.certStatus.idBlock.isConstructed){case!0:u.certStatus.idBlock.tagNumber===1&&(s.status=1);break;case!1:switch(u.certStatus.idBlock.tagNumber){case 0:s.status=0;break;case 2:s.status=2;break;default:}break;default:}}catch{}return s}return s}async sign(e,t="SHA-1",n=mt(!0)){if(!e)throw new Error("Need to provide a private key for signing");let s=await n.getSignatureParameters(e,t),i=s.parameters.algorithm;if(!("name"in i))throw new Error("Empty algorithm");this.signatureAlgorithm=s.signatureAlgorithm,this.tbsResponseData.tbsView=new Uint8Array(this.tbsResponseData.toSchema(!0).toBER());let a=await n.signWithPrivateKey(this.tbsResponseData.tbsView,e,{algorithm:i});this.signature=new Ct({valueHex:a})}async verify(e={},t=mt(!0)){let n=null,s=-1,i=e.trustedCerts||[];if(!this.certs)throw new Error("No certificates attached to the BasicOCSPResponse");switch(!0){case this.tbsResponseData.responderID instanceof Ar:for(let[l,f]of this.certs.entries())if(f.subject.isEqual(this.tbsResponseData.responderID)){s=l;break}break;case this.tbsResponseData.responderID instanceof Be:for(let[l,f]of this.certs.entries()){let h=await t.digest({name:"sha-1"},f.subjectPublicKeyInfo.subjectPublicKey.valueBlock.valueHexView);if(Bu(h,this.tbsResponseData.responderID.valueBlock.valueHex)){s=l;break}}break;default:throw new Error("Wrong value for responderID")}if(s===-1)throw new Error("Correct certificate was not found in OCSP response");n=this.certs[s];let a=[n];for(let l of this.certs){let f=await sH(l,n);f&&a.push(f)}if(!(await new pH({certs:a,trustedCerts:i}).verify({},t)).result)throw new Error("Validation of signer's certificate failed");return t.verifyWithPublicKey(this.tbsResponseData.tbsView,this.signature,this.certs[s].subjectPublicKeyInfo,this.signatureAlgorithm)}};Jv.CLASS_NAME="BasicOCSPResponse";var uR="tbs",cR="version",lR="subject",fR="subjectPublicKeyInfo",kp="attributes",Cv="signatureAlgorithm",Nv="signatureValue",bm="CertificationRequestInfo",P_=`${bm}.version`,k_=`${bm}.subject`,L_=`${bm}.subjectPublicKeyInfo`,gA=`${bm}.attributes`,Ufe=[bm,P_,k_,L_,gA,Cv,Nv];function Vfe(r={}){let e=B(r,"names",{});return new K({name:e.CertificationRequestInfo||bm,value:[new he({name:e.CertificationRequestInfoVersion||P_}),Ar.schema(e.subject||{names:{blockName:k_}}),qi.schema({names:{blockName:L_}}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new lt({optional:!0,name:e.CertificationRequestInfoAttributes||gA,value:$r.schema(e.attributes||{})})]})]})}o(Vfe,"CertificationRequestInfo");var Mfe=class Aa extends Se{static{o(this,"CertificationRequest")}get tbs(){return Ze.toArrayBuffer(this.tbsView)}set tbs(e){this.tbsView=new Uint8Array(e)}constructor(e={}){super(),this.tbsView=new Uint8Array(B(e,uR,Aa.defaultValues(uR))),this.version=B(e,cR,Aa.defaultValues(cR)),this.subject=B(e,lR,Aa.defaultValues(lR)),this.subjectPublicKeyInfo=B(e,fR,Aa.defaultValues(fR)),kp in e&&(this.attributes=B(e,kp,Aa.defaultValues(kp))),this.signatureAlgorithm=B(e,Cv,Aa.defaultValues(Cv)),this.signatureValue=B(e,Nv,Aa.defaultValues(Nv)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case uR:return Kr;case cR:return 0;case lR:return new Ar;case fR:return new qi;case kp:return[];case Cv:return new pe;case Nv:return new Ct;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({value:[Vfe(t.certificationRequestInfo||{}),new K({name:t.signatureAlgorithm||Cv,value:[new He,new it({optional:!0})]}),new Ct({name:t.signatureValue||Nv})]})}fromSchema(e){Ce(e,Ufe);let t=be(e,e,Aa.schema());ye.assertSchema(t,this.className),this.tbsView=t.result.CertificationRequestInfo.valueBeforeDecodeView,this.version=t.result[P_].valueBlock.valueDec,this.subject=new Ar({schema:t.result[k_]}),this.subjectPublicKeyInfo=new qi({schema:t.result[L_]}),gA in t.result&&(this.attributes=Array.from(t.result[gA],n=>new $r({schema:n}))),this.signatureAlgorithm=new pe({schema:t.result.signatureAlgorithm}),this.signatureValue=t.result.signatureValue}encodeTBS(){let e=[new he({value:this.version}),this.subject.toSchema(),this.subjectPublicKeyInfo.toSchema()];return kp in this&&e.push(new ae({idBlock:{tagClass:3,tagNumber:0},value:Array.from(this.attributes||[],t=>t.toSchema())})),new K({value:e})}toSchema(e=!1){let t;if(e===!1){if(this.tbsView.byteLength===0)return Aa.schema();let n=Or(this.tbsView);ye.assert(n,"PKCS#10 Certificate Request"),t=n.result}else t=this.encodeTBS();return new K({value:[t,this.signatureAlgorithm.toSchema(),this.signatureValue]})}toJSON(){let e={tbs:ut.ToHex(this.tbsView),version:this.version,subject:this.subject.toJSON(),subjectPublicKeyInfo:this.subjectPublicKeyInfo.toJSON(),signatureAlgorithm:this.signatureAlgorithm.toJSON(),signatureValue:this.signatureValue.toJSON()};return kp in this&&(e.attributes=Array.from(this.attributes||[],t=>t.toJSON())),e}async sign(e,t="SHA-1",n=mt(!0)){if(!e)throw new Error("Need to provide a private key for signing");let s=await n.getSignatureParameters(e,t),i=s.parameters;this.signatureAlgorithm=s.signatureAlgorithm,this.tbsView=new Uint8Array(this.encodeTBS().toBER());let a=await n.signWithPrivateKey(this.tbsView,e,i);this.signatureValue=new Ct({valueHex:a})}async verify(e=mt(!0)){return e.verifyWithPublicKey(this.tbsView,this.signatureValue,this.subjectPublicKeyInfo,this.signatureAlgorithm)}async getPublicKey(e,t=mt(!0)){return t.getPublicKey(this.subjectPublicKeyInfo,this.signatureAlgorithm,e)}};Mfe.CLASS_NAME="CertificationRequest";var Rf="digestAlgorithm",_f="digest",jfe=[Rf,_f],Xf=class Tv extends Se{static{o(this,"DigestInfo")}constructor(e={}){super(),this.digestAlgorithm=B(e,Rf,Tv.defaultValues(Rf)),this.digest=B(e,_f,Tv.defaultValues(_f)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Rf:return new pe;case _f:return new Be;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Rf:return pe.compareWithDefault("algorithmId",t.algorithmId)&&!("algorithmParams"in t);case _f:return t.isEqual(Tv.defaultValues(e));default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[pe.schema(t.digestAlgorithm||{names:{blockName:Rf}}),new Be({name:t.digest||_f})]})}fromSchema(e){Ce(e,jfe);let t=be(e,e,Tv.schema({names:{digestAlgorithm:{names:{blockName:Rf}},digest:_f}}));ye.assertSchema(t,this.className),this.digestAlgorithm=new pe({schema:t.result.digestAlgorithm}),this.digest=t.result.digest}toSchema(){return new K({value:[this.digestAlgorithm.toSchema(),this.digest]})}toJSON(){return{digestAlgorithm:this.digestAlgorithm.toJSON(),digest:this.digest.toJSON()}}};Xf.CLASS_NAME="DigestInfo";var $d="eContentType",Vi="eContent",qfe=[$d,Vi],Gf=class Of extends Se{static{o(this,"EncapsulatedContentInfo")}constructor(e={}){if(super(),this.eContentType=B(e,$d,Of.defaultValues($d)),Vi in e&&(this.eContent=B(e,Vi,Of.defaultValues(Vi)),this.eContent.idBlock.tagClass===1&&this.eContent.idBlock.tagNumber===4&&this.eContent.idBlock.isConstructed===!1)){let t=new Be({idBlock:{isConstructed:!0},isConstructed:!0}),n=0,s=this.eContent.valueBlock.valueHexView.slice().buffer,i=s.byteLength;for(;i>0;){let a=new Uint8Array(s,n,n+65536>s.byteLength?s.byteLength-n:65536),u=new ArrayBuffer(a.length),c=new Uint8Array(u);for(let l=0;l<c.length;l++)c[l]=a[l];t.valueBlock.value.push(new Be({valueHex:u})),i-=a.length,n+=a.length}this.eContent=t}e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case $d:return P;case Vi:return new Be;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case $d:return t===P;case Vi:return t.idBlock.tagClass===1&&t.idBlock.tagNumber===4?t.isEqual(Of.defaultValues(Vi)):!1;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new He({name:t.eContentType||P}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new it({name:t.eContent||P})]})]})}fromSchema(e){Ce(e,qfe);let t=be(e,e,Of.schema({names:{eContentType:$d,eContent:Vi}}));ye.assertSchema(t,this.className),this.eContentType=t.result.eContentType.valueBlock.toString(),Vi in t.result&&(this.eContent=t.result.eContent)}toSchema(){let e=[];return e.push(new He({value:this.eContentType})),this.eContent&&Of.compareWithDefault(Vi,this.eContent)===!1&&e.push(new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[this.eContent]})),new K({value:e})}toJSON(){let e={eContentType:this.eContentType};return this.eContent&&Of.compareWithDefault(Vi,this.eContent)===!1&&(e.eContent=this.eContent.toJSON()),e}};Gf.CLASS_NAME="EncapsulatedContentInfo";var Pf="mac",kf="macSalt",So="iterations",Hfe=[Pf,kf,So],Ac=class Lf extends Se{static{o(this,"MacData")}constructor(e={}){super(),this.mac=B(e,Pf,Lf.defaultValues(Pf)),this.macSalt=B(e,kf,Lf.defaultValues(kf)),So in e&&(this.iterations=B(e,So,Lf.defaultValues(So))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Pf:return new Xf;case kf:return new Be;case So:return 1;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Pf:return Xf.compareWithDefault("digestAlgorithm",t.digestAlgorithm)&&Xf.compareWithDefault("digest",t.digest);case kf:return t.isEqual(Lf.defaultValues(e));case So:return t===Lf.defaultValues(e);default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,optional:t.optional||!0,value:[Xf.schema(t.mac||{names:{blockName:Pf}}),new Be({name:t.macSalt||kf}),new he({optional:!0,name:t.iterations||So})]})}fromSchema(e){Ce(e,Hfe);let t=be(e,e,Lf.schema({names:{mac:{names:{blockName:Pf}},macSalt:kf,iterations:So}}));ye.assertSchema(t,this.className),this.mac=new Xf({schema:t.result.mac}),this.macSalt=t.result.macSalt,So in t.result&&(this.iterations=t.result.iterations.valueBlock.valueDec)}toSchema(){let e=[this.mac.toSchema(),this.macSalt];return this.iterations!==void 0&&e.push(new he({value:this.iterations})),new K({value:e})}toJSON(){let e={mac:this.mac.toJSON(),macSalt:this.macSalt.toJSON()};return this.iterations!==void 0&&(e.iterations=this.iterations),e}};Ac.CLASS_NAME="MacData";var zf="hashAlgorithm",Wf="hashedMessage",Kfe=[zf,Wf],ji=class Xd extends Se{static{o(this,"MessageImprint")}static async create(e,t,n=mt(!0)){let s=n.getOIDByAlgorithm({name:e},!0,"hashAlgorithm"),i=await n.digest(e,t);return new Xd({hashAlgorithm:new pe({algorithmId:s,algorithmParams:new Pr}),hashedMessage:new Be({valueHex:i})})}constructor(e={}){super(),this.hashAlgorithm=B(e,zf,Xd.defaultValues(zf)),this.hashedMessage=B(e,Wf,Xd.defaultValues(Wf)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case zf:return new pe;case Wf:return new Be;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case zf:return t.algorithmId===P&&!("algorithmParams"in t);case Wf:return t.isEqual(Xd.defaultValues(e))===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[pe.schema(t.hashAlgorithm||{}),new Be({name:t.hashedMessage||P})]})}fromSchema(e){Ce(e,Kfe);let t=be(e,e,Xd.schema({names:{hashAlgorithm:{names:{blockName:zf}},hashedMessage:Wf}}));ye.assertSchema(t,this.className),this.hashAlgorithm=new pe({schema:t.result.hashAlgorithm}),this.hashedMessage=t.result.hashedMessage}toSchema(){return new K({value:[this.hashAlgorithm.toSchema(),this.hashedMessage]})}toJSON(){return{hashAlgorithm:this.hashAlgorithm.toJSON(),hashedMessage:this.hashedMessage.toJSON()}}};ji.CLASS_NAME="MessageImprint";var Gd="reqCert",Cc="singleRequestExtensions",$fe=[Gd,Cc],yA=class Iv extends Se{static{o(this,"Request")}constructor(e={}){super(),this.reqCert=B(e,Gd,Iv.defaultValues(Gd)),Cc in e&&(this.singleRequestExtensions=B(e,Cc,Iv.defaultValues(Cc))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Gd:return new js;case Cc:return[];default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Gd:return t.isEqual(Iv.defaultValues(e));case Cc:return t.length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[js.schema(t.reqCert||{}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[un.schema(t.extensions||{names:{blockName:t.singleRequestExtensions||P}})]})]})}fromSchema(e){Ce(e,$fe);let t=be(e,e,Iv.schema({names:{reqCert:{names:{blockName:Gd}},extensions:{names:{blockName:Cc}}}}));ye.assertSchema(t,this.className),this.reqCert=new js({schema:t.result.reqCert}),Cc in t.result&&(this.singleRequestExtensions=Array.from(t.result.singleRequestExtensions.valueBlock.value,n=>new di({schema:n})))}toSchema(){let e=[];return e.push(this.reqCert.toSchema()),this.singleRequestExtensions&&e.push(new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new K({value:Array.from(this.singleRequestExtensions,t=>t.toSchema())})]})),new K({value:e})}toJSON(){let e={reqCert:this.reqCert.toJSON()};return this.singleRequestExtensions&&(e.singleRequestExtensions=Array.from(this.singleRequestExtensions,t=>t.toJSON())),e}};yA.CLASS_NAME="Request";var kb="tbs",zd="version",Wd="requestorName",Lb="requestList",Jd="requestExtensions",Sm="TBSRequest",RS=`${Sm}.${zd}`,_S=`${Sm}.${Wd}`,s_=`${Sm}.requests`,OS=`${Sm}.${Jd}`,Xfe=[Sm,RS,_S,s_,OS],Ao=class Co extends Se{static{o(this,"TBSRequest")}get tbs(){return Ze.toArrayBuffer(this.tbsView)}set tbs(e){this.tbsView=new Uint8Array(e)}constructor(e={}){super(),this.tbsView=new Uint8Array(B(e,kb,Co.defaultValues(kb))),zd in e&&(this.version=B(e,zd,Co.defaultValues(zd))),Wd in e&&(this.requestorName=B(e,Wd,Co.defaultValues(Wd))),this.requestList=B(e,Lb,Co.defaultValues(Lb)),Jd in e&&(this.requestExtensions=B(e,Jd,Co.defaultValues(Jd))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case kb:return Kr;case zd:return 0;case Wd:return new pr;case Lb:case Jd:return[];default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case kb:return t.byteLength===0;case zd:return t===Co.defaultValues(e);case Wd:return t.type===pr.defaultValues("type")&&Object.keys(t.value).length===0;case Lb:case Jd:return t.length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||Sm,value:[new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new he({name:t.TBSRequestVersion||RS})]}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:1},value:[pr.schema(t.requestorName||{names:{blockName:_S}})]}),new K({name:t.requestList||"TBSRequest.requestList",value:[new lt({name:t.requests||s_,value:yA.schema(t.requestNames||{})})]}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:2},value:[un.schema(t.extensions||{names:{blockName:t.requestExtensions||OS}})]})]})}fromSchema(e){Ce(e,Xfe);let t=be(e,e,Co.schema());ye.assertSchema(t,this.className),this.tbsView=t.result.TBSRequest.valueBeforeDecodeView,RS in t.result&&(this.version=t.result[RS].valueBlock.valueDec),_S in t.result&&(this.requestorName=new pr({schema:t.result[_S]})),this.requestList=Array.from(t.result[s_],n=>new yA({schema:n})),OS in t.result&&(this.requestExtensions=Array.from(t.result[OS].valueBlock.value,n=>new di({schema:n})))}toSchema(e=!1){let t;if(e===!1){if(this.tbsView.byteLength===0)return Co.schema();let n=Or(this.tbsView);if(ye.assert(n,"TBS Request"),!(n.result instanceof K))throw new Error("ASN.1 result should be SEQUENCE");t=n.result}else{let n=[];this.version!==void 0&&n.push(new ae({idBlock:{tagClass:3,tagNumber:0},value:[new he({value:this.version})]})),this.requestorName&&n.push(new ae({idBlock:{tagClass:3,tagNumber:1},value:[this.requestorName.toSchema()]})),n.push(new K({value:Array.from(this.requestList,s=>s.toSchema())})),this.requestExtensions&&n.push(new ae({idBlock:{tagClass:3,tagNumber:2},value:[new K({value:Array.from(this.requestExtensions,s=>s.toSchema())})]})),t=new K({value:n})}return t}toJSON(){let e={};return this.version!=null&&(e.version=this.version),this.requestorName&&(e.requestorName=this.requestorName.toJSON()),e.requestList=Array.from(this.requestList,t=>t.toJSON()),this.requestExtensions&&(e.requestExtensions=Array.from(this.requestExtensions,t=>t.toJSON())),e}};Ao.CLASS_NAME="TBSRequest";var Lp="signatureAlgorithm",Fp="signature",Vu="certs",Ff=class Yd extends Se{static{o(this,"Signature")}constructor(e={}){super(),this.signatureAlgorithm=B(e,Lp,Yd.defaultValues(Lp)),this.signature=B(e,Fp,Yd.defaultValues(Fp)),Vu in e&&(this.certs=B(e,Vu,Yd.defaultValues(Vu))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Lp:return new pe;case Fp:return new Ct;case Vu:return[];default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Lp:return t.algorithmId===P&&!("algorithmParams"in t);case Fp:return t.isEqual(Yd.defaultValues(e));case Vu:return t.length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[pe.schema(t.signatureAlgorithm||{}),new Ct({name:t.signature||P}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new K({value:[new lt({name:t.certs||P,value:Gn.schema({})})]})]})]})}fromSchema(e){Ce(e,[Lp,Fp,Vu]);let t=be(e,e,Yd.schema({names:{signatureAlgorithm:{names:{blockName:Lp}},signature:Fp,certs:Vu}}));ye.assertSchema(t,this.className),this.signatureAlgorithm=new pe({schema:t.result.signatureAlgorithm}),this.signature=t.result.signature,Vu in t.result&&(this.certs=Array.from(t.result.certs,n=>new Gn({schema:n})))}toSchema(){let e=[];return e.push(this.signatureAlgorithm.toSchema()),e.push(this.signature),this.certs&&e.push(new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new K({value:Array.from(this.certs,t=>t.toSchema())})]})),new K({value:e})}toJSON(){let e={signatureAlgorithm:this.signatureAlgorithm.toJSON(),signature:this.signature.toJSON()};return this.certs&&(e.certs=Array.from(this.certs,t=>t.toJSON())),e}};Ff.CLASS_NAME="Signature";var Qd="tbsRequest",Nc="optionalSignature",Gfe=[Qd,Nc],zfe=class PS extends Se{static{o(this,"OCSPRequest")}constructor(e={}){super(),this.tbsRequest=B(e,Qd,PS.defaultValues(Qd)),Nc in e&&(this.optionalSignature=B(e,Nc,PS.defaultValues(Nc))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Qd:return new Ao;case Nc:return new Ff;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Qd:return Ao.compareWithDefault("tbs",t.tbs)&&Ao.compareWithDefault("version",t.version)&&Ao.compareWithDefault("requestorName",t.requestorName)&&Ao.compareWithDefault("requestList",t.requestList)&&Ao.compareWithDefault("requestExtensions",t.requestExtensions);case Nc:return Ff.compareWithDefault("signatureAlgorithm",t.signatureAlgorithm)&&Ff.compareWithDefault("signature",t.signature)&&Ff.compareWithDefault("certs",t.certs);default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||"OCSPRequest",value:[Ao.schema(t.tbsRequest||{names:{blockName:Qd}}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[Ff.schema(t.optionalSignature||{names:{blockName:Nc}})]})]})}fromSchema(e){Ce(e,Gfe);let t=be(e,e,PS.schema());ye.assertSchema(t,this.className),this.tbsRequest=new Ao({schema:t.result.tbsRequest}),Nc in t.result&&(this.optionalSignature=new Ff({schema:t.result.optionalSignature}))}toSchema(e=!1){let t=[];return t.push(this.tbsRequest.toSchema(e)),this.optionalSignature&&t.push(new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[this.optionalSignature.toSchema()]})),new K({value:t})}toJSON(){let e={tbsRequest:this.tbsRequest.toJSON()};return this.optionalSignature&&(e.optionalSignature=this.optionalSignature.toJSON()),e}async createForCertificate(e,t,n=mt(!0)){let s=new js;await s.createForCertificate(e,t,n),this.tbsRequest.requestList.push(new yA({reqCert:s}))}async sign(e,t="SHA-1",n=mt(!0)){if(Jt.assertEmpty(e,"privateKey","OCSPRequest.sign method"),!this.optionalSignature)throw new Error('Need to create "optionalSignature" field before signing');let s=await n.getSignatureParameters(e,t),i=s.parameters;this.optionalSignature.signatureAlgorithm=s.signatureAlgorithm;let a=this.tbsRequest.toSchema(!0).toBER(!1),u=await n.signWithPrivateKey(a,e,i);this.optionalSignature.signature=new Ct({valueHex:u})}verify(){}};zfe.CLASS_NAME="OCSPRequest";var Zd="responseType",em="response",Wfe=[Zd,em],tm=class Dv extends Se{static{o(this,"ResponseBytes")}constructor(e={}){super(),this.responseType=B(e,Zd,Dv.defaultValues(Zd)),this.response=B(e,em,Dv.defaultValues(em)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Zd:return P;case em:return new Be;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Zd:return t===P;case em:return t.isEqual(Dv.defaultValues(e));default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new He({name:t.responseType||P}),new Be({name:t.response||P})]})}fromSchema(e){Ce(e,Wfe);let t=be(e,e,Dv.schema({names:{responseType:Zd,response:em}}));ye.assertSchema(t,this.className),this.responseType=t.result.responseType.valueBlock.toString(),this.response=t.result.response}toSchema(){return new K({value:[new He({value:this.responseType}),this.response]})}toJSON(){return{responseType:this.responseType,response:this.response.toJSON()}}};tm.CLASS_NAME="ResponseBytes";var Up="responseStatus",co="responseBytes",Jfe=class Bv extends Se{static{o(this,"OCSPResponse")}constructor(e={}){super(),this.responseStatus=B(e,Up,Bv.defaultValues(Up)),co in e&&(this.responseBytes=B(e,co,Bv.defaultValues(co))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Up:return new _u;case co:return new tm;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Up:return t.isEqual(Bv.defaultValues(e));case co:return tm.compareWithDefault("responseType",t.responseType)&&tm.compareWithDefault("response",t.response);default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||"OCSPResponse",value:[new _u({name:t.responseStatus||Up}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[tm.schema(t.responseBytes||{names:{blockName:co}})]})]})}fromSchema(e){Ce(e,[Up,co]);let t=be(e,e,Bv.schema());ye.assertSchema(t,this.className),this.responseStatus=t.result.responseStatus,co in t.result&&(this.responseBytes=new tm({schema:t.result.responseBytes}))}toSchema(){let e=[];return e.push(this.responseStatus),this.responseBytes&&e.push(new ae({idBlock:{tagClass:3,tagNumber:0},value:[this.responseBytes.toSchema()]})),new K({value:e})}toJSON(){let e={responseStatus:this.responseStatus.toJSON()};return this.responseBytes&&(e.responseBytes=this.responseBytes.toJSON()),e}async getCertificateStatus(e,t,n=mt(!0)){let s,i={isForCertificate:!1,status:2};if(!this.responseBytes||this.responseBytes.responseType!==qb)return i;try{let a=Or(this.responseBytes.response.valueBlock.valueHexView);ye.assert(a,"Basic OCSP response"),s=new Jv({schema:a.result})}catch{return i}return s.getCertificateStatus(e,t,n)}async sign(e,t,n=mt(!0)){var s;if(this.responseBytes&&this.responseBytes.responseType===qb)return Jv.fromBER(this.responseBytes.response.valueBlock.valueHexView).sign(e,t,n);throw new Error(`Unknown ResponseBytes type: ${((s=this.responseBytes)===null||s===void 0?void 0:s.responseType)||"Unknown"}`)}async verify(e=null,t=mt(!0)){var n;if(!(co in this))throw new Error("Empty ResponseBytes field");if(this.responseBytes&&this.responseBytes.responseType===qb){let s=Jv.fromBER(this.responseBytes.response.valueBlock.valueHexView);return e!==null&&(s.certs||(s.certs=[]),s.certs.push(e)),s.verify({},t)}throw new Error(`Unknown ResponseBytes type: ${((n=this.responseBytes)===null||n===void 0?void 0:n.responseType)||"Unknown"}`)}};Jfe.CLASS_NAME="OCSPResponse";var Ol="type",No="attributes",Fb="encodedValue",Yfe=[No],Ts=class Ca extends Se{static{o(this,"SignedAndUnsignedAttributes")}constructor(e={}){super(),this.type=B(e,Ol,Ca.defaultValues(Ol)),this.attributes=B(e,No,Ca.defaultValues(No)),this.encodedValue=B(e,Fb,Ca.defaultValues(Fb)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Ol:return-1;case No:return[];case Fb:return Kr;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Ol:return t===Ca.defaultValues(Ol);case No:return t.length===0;case Fb:return t.byteLength===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new ae({name:t.blockName||P,optional:!0,idBlock:{tagClass:3,tagNumber:t.tagNumber||0},value:[new lt({name:t.attributes||P,value:$r.schema()})]})}fromSchema(e){Ce(e,Yfe);let t=be(e,e,Ca.schema({names:{tagNumber:this.type,attributes:No}}));ye.assertSchema(t,this.className),this.type=t.result.idBlock.tagNumber,this.encodedValue=Ze.toArrayBuffer(t.result.valueBeforeDecodeView);let n=new Uint8Array(this.encodedValue);if(n[0]=49,!(No in t.result)){if(this.type===0)throw new Error("Wrong structure of SignedUnsignedAttributes");return}this.attributes=Array.from(t.result.attributes,s=>new $r({schema:s}))}toSchema(){if(Ca.compareWithDefault(Ol,this.type)||Ca.compareWithDefault(No,this.attributes))throw new Error('Incorrectly initialized "SignedAndUnsignedAttributes" class');return new ae({optional:!0,idBlock:{tagClass:3,tagNumber:this.type},value:Array.from(this.attributes,e=>e.toSchema())})}toJSON(){if(Ca.compareWithDefault(Ol,this.type)||Ca.compareWithDefault(No,this.attributes))throw new Error('Incorrectly initialized "SignedAndUnsignedAttributes" class');return{type:this.type,attributes:Array.from(this.attributes,e=>e.toJSON())}}};Ts.CLASS_NAME="SignedAndUnsignedAttributes";var rm="version",Uf="sid",nm="digestAlgorithm",Tc="signedAttrs",sm="signatureAlgorithm",Rv="signature",Ic="unsignedAttrs",Pc="SignerInfo",i_=`${Pc}.${rm}`,_v=`${Pc}.${Uf}`,a_=`${Pc}.${nm}`,kS=`${Pc}.${Tc}`,o_=`${Pc}.${sm}`,u_=`${Pc}.${Rv}`,LS=`${Pc}.${Ic}`,Qfe=[i_,_v,a_,kS,o_,u_,LS],vA=class An extends Se{static{o(this,"SignerInfo")}constructor(e={}){super(),this.version=B(e,rm,An.defaultValues(rm)),this.sid=B(e,Uf,An.defaultValues(Uf)),this.digestAlgorithm=B(e,nm,An.defaultValues(nm)),Tc in e&&(this.signedAttrs=B(e,Tc,An.defaultValues(Tc))),this.signatureAlgorithm=B(e,sm,An.defaultValues(sm)),this.signature=B(e,Rv,An.defaultValues(Rv)),Ic in e&&(this.unsignedAttrs=B(e,Ic,An.defaultValues(Ic))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case rm:return 0;case Uf:return new it;case nm:return new pe;case Tc:return new Ts({type:0});case sm:return new pe;case Rv:return new Be;case Ic:return new Ts({type:1});default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case rm:return An.defaultValues(rm)===t;case Uf:return t instanceof it;case nm:return t instanceof pe?t.isEqual(An.defaultValues(nm)):!1;case Tc:return Ts.compareWithDefault("type",t.type)&&Ts.compareWithDefault("attributes",t.attributes)&&Ts.compareWithDefault("encodedValue",t.encodedValue);case sm:return t instanceof pe?t.isEqual(An.defaultValues(sm)):!1;case Rv:case Ic:return Ts.compareWithDefault("type",t.type)&&Ts.compareWithDefault("attributes",t.attributes)&&Ts.compareWithDefault("encodedValue",t.encodedValue);default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:Pc,value:[new he({name:t.version||i_}),new Sr({value:[Ln.schema(t.sidSchema||{names:{blockName:_v}}),new Sr({value:[new ae({optional:!0,name:t.sid||_v,idBlock:{tagClass:3,tagNumber:0},value:[new Be]}),new tt({optional:!0,name:t.sid||_v,idBlock:{tagClass:3,tagNumber:0}})]})]}),pe.schema(t.digestAlgorithm||{names:{blockName:a_}}),Ts.schema(t.signedAttrs||{names:{blockName:kS,tagNumber:0}}),pe.schema(t.signatureAlgorithm||{names:{blockName:o_}}),new Be({name:t.signature||u_}),Ts.schema(t.unsignedAttrs||{names:{blockName:LS,tagNumber:1}})]})}fromSchema(e){Ce(e,Qfe);let t=be(e,e,An.schema());ye.assertSchema(t,this.className),this.version=t.result[i_].valueBlock.valueDec;let n=t.result[_v];n.idBlock.tagClass===1?this.sid=new Ln({schema:n}):this.sid=n,this.digestAlgorithm=new pe({schema:t.result[a_]}),kS in t.result&&(this.signedAttrs=new Ts({type:0,schema:t.result[kS]})),this.signatureAlgorithm=new pe({schema:t.result[o_]}),this.signature=t.result[u_],LS in t.result&&(this.unsignedAttrs=new Ts({type:1,schema:t.result[LS]}))}toSchema(){if(An.compareWithDefault(Uf,this.sid))throw new Error('Incorrectly initialized "SignerInfo" class');let e=[];return e.push(new he({value:this.version})),this.sid instanceof Ln?e.push(this.sid.toSchema()):e.push(this.sid),e.push(this.digestAlgorithm.toSchema()),this.signedAttrs&&An.compareWithDefault(Tc,this.signedAttrs)===!1&&e.push(this.signedAttrs.toSchema()),e.push(this.signatureAlgorithm.toSchema()),e.push(this.signature),this.unsignedAttrs&&An.compareWithDefault(Ic,this.unsignedAttrs)===!1&&e.push(this.unsignedAttrs.toSchema()),new K({value:e})}toJSON(){if(An.compareWithDefault(Uf,this.sid))throw new Error('Incorrectly initialized "SignerInfo" class');let e={version:this.version,digestAlgorithm:this.digestAlgorithm.toJSON(),signatureAlgorithm:this.signatureAlgorithm.toJSON(),signature:this.signature.toJSON()};return this.sid instanceof it||(e.sid=this.sid.toJSON()),this.signedAttrs&&An.compareWithDefault(Tc,this.signedAttrs)===!1&&(e.signedAttrs=this.signedAttrs.toJSON()),this.unsignedAttrs&&An.compareWithDefault(Ic,this.unsignedAttrs)===!1&&(e.unsignedAttrs=this.unsignedAttrs.toJSON()),e}};vA.CLASS_NAME="SignerInfo";var Ov="version",Pv="policy",kv="messageImprint",Lv="serialNumber",Fv="genTime",Vf="ordering",Mf="nonce",im="accuracy",am="tsa",om="extensions",Hi="TSTInfo",c_=`${Hi}.${Ov}`,l_=`${Hi}.${Pv}`,f_=`${Hi}.${kv}`,h_=`${Hi}.${Lv}`,p_=`${Hi}.${Fv}`,FS=`${Hi}.${im}`,US=`${Hi}.${Vf}`,VS=`${Hi}.${Mf}`,MS=`${Hi}.${am}`,jS=`${Hi}.${om}`,Zfe=[c_,l_,f_,h_,p_,FS,US,VS,MS,jS],mH=class Ns extends Se{static{o(this,"TSTInfo")}constructor(e={}){super(),this.version=B(e,Ov,Ns.defaultValues(Ov)),this.policy=B(e,Pv,Ns.defaultValues(Pv)),this.messageImprint=B(e,kv,Ns.defaultValues(kv)),this.serialNumber=B(e,Lv,Ns.defaultValues(Lv)),this.genTime=B(e,Fv,Ns.defaultValues(Fv)),im in e&&(this.accuracy=B(e,im,Ns.defaultValues(im))),Vf in e&&(this.ordering=B(e,Vf,Ns.defaultValues(Vf))),Mf in e&&(this.nonce=B(e,Mf,Ns.defaultValues(Mf))),am in e&&(this.tsa=B(e,am,Ns.defaultValues(am))),om in e&&(this.extensions=B(e,om,Ns.defaultValues(om))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Ov:return 0;case Pv:return P;case kv:return new ji;case Lv:return new he;case Fv:return new Date(0,0,0);case im:return new Pl;case Vf:return!1;case Mf:return new he;case am:return new pr;case om:return[];default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Ov:case Pv:case Fv:case Vf:return t===Ns.defaultValues(Vf);case kv:return ji.compareWithDefault(zf,t.hashAlgorithm)&&ji.compareWithDefault(Wf,t.hashedMessage);case Lv:case Mf:return t.isEqual(Ns.defaultValues(Mf));case im:return Pl.compareWithDefault(Mu,t.seconds)&&Pl.compareWithDefault(ju,t.millis)&&Pl.compareWithDefault(qu,t.micros);case am:return pr.compareWithDefault(by,t.type)&&pr.compareWithDefault(Sy,t.value);case om:return t.length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||Hi,value:[new he({name:t.version||c_}),new He({name:t.policy||l_}),ji.schema(t.messageImprint||{names:{blockName:f_}}),new he({name:t.serialNumber||h_}),new br({name:t.genTime||p_}),Pl.schema(t.accuracy||{names:{blockName:FS}}),new Oi({name:t.ordering||US,optional:!0}),new he({name:t.nonce||VS,optional:!0}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[pr.schema(t.tsa||{names:{blockName:MS}})]}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:1},value:[new lt({name:t.extensions||jS,value:di.schema(t.extension||{})})]})]})}fromSchema(e){Ce(e,Zfe);let t=be(e,e,Ns.schema());ye.assertSchema(t,this.className),this.version=t.result[c_].valueBlock.valueDec,this.policy=t.result[l_].valueBlock.toString(),this.messageImprint=new ji({schema:t.result[f_]}),this.serialNumber=t.result[h_],this.genTime=t.result[p_].toDate(),FS in t.result&&(this.accuracy=new Pl({schema:t.result[FS]})),US in t.result&&(this.ordering=t.result[US].valueBlock.value),VS in t.result&&(this.nonce=t.result[VS]),MS in t.result&&(this.tsa=new pr({schema:t.result[MS]})),jS in t.result&&(this.extensions=Array.from(t.result[jS],n=>new di({schema:n})))}toSchema(){let e=[];return e.push(new he({value:this.version})),e.push(new He({value:this.policy})),e.push(this.messageImprint.toSchema()),e.push(this.serialNumber),e.push(new br({valueDate:this.genTime})),this.accuracy&&e.push(this.accuracy.toSchema()),this.ordering!==void 0&&e.push(new Oi({value:this.ordering})),this.nonce&&e.push(this.nonce),this.tsa&&e.push(new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[this.tsa.toSchema()]})),this.extensions&&e.push(new ae({optional:!0,idBlock:{tagClass:3,tagNumber:1},value:Array.from(this.extensions,t=>t.toSchema())})),new K({value:e})}toJSON(){let e={version:this.version,policy:this.policy,messageImprint:this.messageImprint.toJSON(),serialNumber:this.serialNumber.toJSON(),genTime:this.genTime};return this.accuracy&&(e.accuracy=this.accuracy.toJSON()),this.ordering!==void 0&&(e.ordering=this.ordering),this.nonce&&(e.nonce=this.nonce.toJSON()),this.tsa&&(e.tsa=this.tsa.toJSON()),this.extensions&&(e.extensions=Array.from(this.extensions,t=>t.toJSON())),e}async verify(e,t=mt(!0)){if(!e.data)throw new Error('"data" is a mandatory attribute for TST_INFO verification');let n=e.data;if(e.notBefore&&this.genTime<e.notBefore)throw new Error("Generation time for TSTInfo object is less than notBefore value");if(e.notAfter&&this.genTime>e.notAfter)throw new Error("Generation time for TSTInfo object is more than notAfter value");let s=t.getAlgorithmByOID(this.messageImprint.hashAlgorithm.algorithmId,!0,"MessageImprint.hashAlgorithm"),i=await t.digest(s.name,new Uint8Array(n));return Ze.isEqual(i,this.messageImprint.hashedMessage.valueBlock.valueHexView)}};mH.CLASS_NAME="TSTInfo";var um="version",Uv="digestAlgorithms",Vv="encapContentInfo",cm="certificates",lm="crls",Mv="signerInfos",vy="ocsps",th="SignedData",d_=`${th}.${um}`,qS=`${th}.${Uv}`,m_=`${th}.${Vv}`,HS=`${th}.${cm}`,KS=`${th}.${lm}`,$S=`${th}.${Mv}`,ehe=[d_,qS,m_,HS,KS,$S],Kn=class extends Error{static{o(this,"SignedDataVerifyError")}constructor({message:e,code:t=0,date:n=new Date,signatureVerified:s=null,signerCertificate:i=null,signerCertificateVerified:a=null,timestampSerial:u=null,certificatePath:c=[]}){super(e),this.name="SignedDataVerifyError",this.date=n,this.code=t,this.timestampSerial=u,this.signatureVerified=s,this.signerCertificate=i,this.signerCertificateVerified=a,this.certificatePath=c}},wm=class Mi extends Se{static{o(this,"SignedData")}constructor(e={}){super(),this.version=B(e,um,Mi.defaultValues(um)),this.digestAlgorithms=B(e,Uv,Mi.defaultValues(Uv)),this.encapContentInfo=B(e,Vv,Mi.defaultValues(Vv)),cm in e&&(this.certificates=B(e,cm,Mi.defaultValues(cm))),lm in e&&(this.crls=B(e,lm,Mi.defaultValues(lm))),vy in e&&(this.ocsps=B(e,vy,Mi.defaultValues(vy))),this.signerInfos=B(e,Mv,Mi.defaultValues(Mv)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case um:return 0;case Uv:return[];case Vv:return new Gf;case cm:return[];case lm:return[];case vy:return[];case Mv:return[];default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case um:return t===Mi.defaultValues(um);case Vv:return Gf.compareWithDefault("eContentType",t.eContentType)&&Gf.compareWithDefault("eContent",t.eContent);case Uv:case cm:case lm:case vy:case Mv:return t.length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return t.optional===void 0&&(t.optional=!1),new K({name:t.blockName||th,optional:t.optional,value:[new he({name:t.version||d_}),new kr({value:[new lt({name:t.digestAlgorithms||qS,value:pe.schema()})]}),Gf.schema(t.encapContentInfo||{names:{blockName:m_}}),new ae({name:t.certificates||HS,optional:!0,idBlock:{tagClass:3,tagNumber:0},value:Qf.schema().valueBlock.value}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:1},value:Xv.schema(t.crls||{names:{crls:KS}}).valueBlock.value}),new kr({value:[new lt({name:t.signerInfos||$S,value:vA.schema()})]})]})}fromSchema(e){Ce(e,ehe);let t=be(e,e,Mi.schema());if(ye.assertSchema(t,this.className),this.version=t.result[d_].valueBlock.valueDec,qS in t.result&&(this.digestAlgorithms=Array.from(t.result[qS],n=>new pe({schema:n}))),this.encapContentInfo=new Gf({schema:t.result[m_]}),HS in t.result){let n=new Qf({schema:new kr({value:t.result[HS].valueBlock.value})});this.certificates=n.certificates.slice(0)}KS in t.result&&(this.crls=Array.from(t.result[KS],n=>n.idBlock.tagClass===1?new Zv({schema:n}):(n.idBlock.tagClass=1,n.idBlock.tagNumber=16,new $v({schema:n})))),$S in t.result&&(this.signerInfos=Array.from(t.result[$S],n=>new vA({schema:n})))}toSchema(e=!1){let t=[];if(this.certificates&&this.certificates.length&&this.certificates.some(n=>n instanceof mS)||this.crls&&this.crls.length&&this.crls.some(n=>n instanceof $v)?this.version=5:this.certificates&&this.certificates.length&&this.certificates.some(n=>n instanceof _c)?this.version=4:this.certificates&&this.certificates.length&&this.certificates.some(n=>n instanceof ZS)||this.signerInfos.some(n=>n.version===3)||this.encapContentInfo.eContentType!==Mi.ID_DATA?this.version=3:this.version=1,t.push(new he({value:this.version})),t.push(new kr({value:Array.from(this.digestAlgorithms,n=>n.toSchema())})),t.push(this.encapContentInfo.toSchema()),this.certificates){let s=new Qf({certificates:this.certificates}).toSchema();t.push(new ae({idBlock:{tagClass:3,tagNumber:0},value:s.valueBlock.value}))}return this.crls&&t.push(new ae({idBlock:{tagClass:3,tagNumber:1},value:Array.from(this.crls,n=>{if(n instanceof $v){let s=n.toSchema();return s.idBlock.tagClass=3,s.idBlock.tagNumber=1,s}return n.toSchema(e)})})),t.push(new kr({value:Array.from(this.signerInfos,n=>n.toSchema())})),new K({value:t})}toJSON(){let e={version:this.version,digestAlgorithms:Array.from(this.digestAlgorithms,t=>t.toJSON()),encapContentInfo:this.encapContentInfo.toJSON(),signerInfos:Array.from(this.signerInfos,t=>t.toJSON())};return this.certificates&&(e.certificates=Array.from(this.certificates,t=>t.toJSON())),this.crls&&(e.crls=Array.from(this.crls,t=>t.toJSON())),e}async verify({signer:e=-1,data:t=Kr,trustedCerts:n=[],checkDate:s=new Date,checkChain:i=!1,passedWhenNotRevValues:a=!1,extendedMode:u=!1,findOrigin:c=null,findIssuer:l=null}={},f=mt(!0)){let h=null,d=null;try{let g=Kr,m=P,v=[],y=this.signerInfos[e];if(!y)throw new Kn({date:s,code:1,message:"Unable to get signer by supplied index"});if(!this.certificates)throw new Kn({date:s,code:2,message:"No certificates attached to this signed data"});if(y.sid instanceof Ln){for(let x of this.certificates)if(x instanceof Gn&&x.issuer.isEqual(y.sid.issuer)&&x.serialNumber.isEqual(y.sid.serialNumber)){h=x;break}}else{let x=y.sid,b=x.idBlock.isConstructed?x.valueBlock.value[0].valueBlock.valueHex:x.valueBlock.valueHex;for(let A of this.certificates){if(!(A instanceof Gn))continue;let k=await f.digest({name:"sha-1"},A.subjectPublicKeyInfo.subjectPublicKey.valueBlock.valueHexView);if(Bu(k,b)){h=A;break}}}if(!h)throw new Kn({date:s,code:3,message:"Unable to find signer certificate"});if(this.encapContentInfo.eContentType===Zce){if(!this.encapContentInfo.eContent)throw new Kn({date:s,code:15,message:"Error during verification: TSTInfo eContent is empty",signatureVerified:null,signerCertificate:h,timestampSerial:d,signerCertificateVerified:!0});let x;try{x=mH.fromBER(this.encapContentInfo.eContent.valueBlock.valueHexView)}catch{throw new Kn({date:s,code:15,message:"Error during verification: TSTInfo wrong ASN.1 schema ",signatureVerified:null,signerCertificate:h,timestampSerial:d,signerCertificateVerified:!0})}if(s=x.genTime,d=x.serialNumber.valueBlock.valueHexView.slice().buffer,t.byteLength===0)throw new Kn({date:s,code:4,message:"Missed detached data input array"});if(!await x.verify({data:t},f))throw new Kn({date:s,code:15,message:"Error during verification: TSTInfo verification is failed",signatureVerified:!1,signerCertificate:h,timestampSerial:d,signerCertificateVerified:!0})}if(i){let x=this.certificates.filter(I=>I instanceof Gn&&!!sH(I,h)),b={checkDate:s,certs:x,trustedCerts:n};l&&(b.findIssuer=l),c&&(b.findOrigin=c);let A=new pH(b);if(A.certs.push(h),this.crls)for(let I of this.crls)"thisUpdate"in I?A.crls.push(I):I.otherRevInfoFormat===qb&&A.ocsps.push(new Jv({schema:I.otherRevInfo}));this.ocsps&&A.ocsps.push(...this.ocsps);let k=await A.verify({passedWhenNotRevValues:a},f).catch(I=>{throw new Kn({date:s,code:5,message:`Validation of signer's certificate failed with error: ${I instanceof Object?I.resultMessage:I}`,signerCertificate:h,signerCertificateVerified:!1})});if(k.certificatePath&&(v=k.certificatePath),!k.result)throw new Kn({date:s,code:5,message:`Validation of signer's certificate failed: ${k.resultMessage}`,signerCertificate:h,signerCertificateVerified:!1})}let w=f.getAlgorithmByOID(y.digestAlgorithm.algorithmId);if(!("name"in w))throw new Kn({date:s,code:7,message:`Unsupported signature algorithm: ${y.digestAlgorithm.algorithmId}`,signerCertificate:h,signerCertificateVerified:!0});m=w.name;let S=this.encapContentInfo.eContent;if(S)S.idBlock.tagClass===1&&S.idBlock.tagNumber===4?t=S.getValue():t=S.valueBlock.valueBeforeDecodeView.slice().buffer;else if(t.byteLength===0)throw new Kn({date:s,code:8,message:"Missed detached data input array",signerCertificate:h,signerCertificateVerified:!0});if(y.signedAttrs){let x=!1,b=!1;for(let A of y.signedAttrs.attributes)if(A.type==="1.2.840.113549.1.9.3"&&(x=!0),A.type==="1.2.840.113549.1.9.4"&&(b=!0,g=A.values[0].valueBlock.valueHex),x&&b)break;if(x===!1)throw new Kn({date:s,code:9,message:'Attribute "content-type" is a mandatory attribute for "signed attributes"',signerCertificate:h,signerCertificateVerified:!0});if(b===!1)throw new Kn({date:s,code:10,message:'Attribute "message-digest" is a mandatory attribute for "signed attributes"',signatureVerified:null,signerCertificate:h,signerCertificateVerified:!0})}if(y.signedAttrs){let x=await f.digest(m,new Uint8Array(t));if(!Bu(x,g))throw new Kn({date:s,code:15,message:"Error during verification: Message digest doesn't match",signatureVerified:null,signerCertificate:h,timestampSerial:d,signerCertificateVerified:!0});t=y.signedAttrs.encodedValue}let E=y.signatureAlgorithm.algorithmId==="1.2.840.113549.1.1.1"?await f.verifyWithPublicKey(t,y.signature,h.subjectPublicKeyInfo,y.signatureAlgorithm,m):await f.verifyWithPublicKey(t,y.signature,h.subjectPublicKeyInfo,y.signatureAlgorithm);return u?{date:s,code:14,message:P,signatureVerified:E,signerCertificate:h,timestampSerial:d,signerCertificateVerified:!0,certificatePath:v}:E}catch(g){throw g instanceof Kn?g:new Kn({date:s,code:15,message:`Error during verification: ${g instanceof Error?g.message:g}`,signatureVerified:null,signerCertificate:h,timestampSerial:d,signerCertificateVerified:!0})}}async sign(e,t,n="SHA-1",s=Kr,i=mt(!0)){var a;if(!e)throw new Error("Need to provide a private key for signing");let u=this.signerInfos[t];if(!u)throw new RangeError("SignerInfo index is out of range");!(!((a=u.signedAttrs)===null||a===void 0)&&a.attributes.length)&&"hash"in e.algorithm&&"hash"in e.algorithm&&e.algorithm.hash&&(n=e.algorithm.hash.name);let c=i.getOIDByAlgorithm({name:n},!0,"hashAlgorithm");this.digestAlgorithms.filter(d=>d.algorithmId===c).length===0&&this.digestAlgorithms.push(new pe({algorithmId:c,algorithmParams:new Pr})),u.digestAlgorithm=new pe({algorithmId:c,algorithmParams:new Pr});let l=await i.getSignatureParameters(e,n),f=l.parameters;if(u.signatureAlgorithm=l.signatureAlgorithm,u.signedAttrs)if(u.signedAttrs.encodedValue.byteLength!==0)s=u.signedAttrs.encodedValue;else{s=u.signedAttrs.toSchema().toBER();let d=Ze.toUint8Array(s);d[0]=49}else{let d=this.encapContentInfo.eContent;if(d)d.idBlock.tagClass===1&&d.idBlock.tagNumber===4?s=d.getValue():s=d.valueBlock.valueBeforeDecodeView.slice().buffer;else if(s.byteLength===0)throw new Error("Missed detached data input array")}let h=await i.signWithPrivateKey(s,e,f);u.signature=new Be({valueHex:h})}};wm.CLASS_NAME="SignedData";wm.ID_DATA=S_;var jf="version",qf="authSafe",To="macData",xy="parsedValue",the=[jf,qf,To],rhe=class Hf extends Se{static{o(this,"PFX")}constructor(e={}){super(),this.version=B(e,jf,Hf.defaultValues(jf)),this.authSafe=B(e,qf,Hf.defaultValues(qf)),To in e&&(this.macData=B(e,To,Hf.defaultValues(To))),xy in e&&(this.parsedValue=B(e,xy,Hf.defaultValues(xy))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case jf:return 3;case qf:return new Fr;case To:return new Ac;case xy:return{};default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case jf:return t===Hf.defaultValues(e);case qf:return Fr.compareWithDefault("contentType",t.contentType)&&Fr.compareWithDefault("content",t.content);case To:return Ac.compareWithDefault("mac",t.mac)&&Ac.compareWithDefault("macSalt",t.macSalt)&&Ac.compareWithDefault("iterations",t.iterations);case xy:return t instanceof Object&&Object.keys(t).length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new he({name:t.version||jf}),Fr.schema(t.authSafe||{names:{blockName:qf}}),Ac.schema(t.macData||{names:{blockName:To,optional:!0}})]})}fromSchema(e){Ce(e,the);let t=be(e,e,Hf.schema({names:{version:jf,authSafe:{names:{blockName:qf}},macData:{names:{blockName:To}}}}));ye.assertSchema(t,this.className),this.version=t.result.version.valueBlock.valueDec,this.authSafe=new Fr({schema:t.result.authSafe}),To in t.result&&(this.macData=new Ac({schema:t.result.macData}))}toSchema(){let e=[new he({value:this.version}),this.authSafe.toSchema()];return this.macData&&e.push(this.macData.toSchema()),new K({value:e})}toJSON(){let e={version:this.version,authSafe:this.authSafe.toJSON()};return this.macData&&(e.macData=this.macData.toJSON()),e}async makeInternalValues(e={},t=mt(!0)){if(hr.assert(e,"parameters","object"),!this.parsedValue)throw new Error('Please call "parseValues" function first in order to make "parsedValue" data');switch(Jt.assertEmpty(this.parsedValue.integrityMode,"integrityMode","parsedValue"),Jt.assertEmpty(this.parsedValue.authenticatedSafe,"authenticatedSafe","parsedValue"),this.parsedValue.integrityMode){case 0:{if(!("iterations"in e))throw new Jt("iterations");Jt.assertEmpty(e.pbkdf2HashAlgorithm,"pbkdf2HashAlgorithm"),Jt.assertEmpty(e.hmacHashAlgorithm,"hmacHashAlgorithm"),Jt.assertEmpty(e.password,"password");let n=new ArrayBuffer(64),s=new Uint8Array(n);t.getRandomValues(s);let i=this.parsedValue.authenticatedSafe.toSchema().toBER(!1);this.authSafe=new Fr({contentType:Fr.DATA,content:new Be({valueHex:i})});let a=await t.stampDataWithPassword({password:e.password,hashAlgorithm:e.hmacHashAlgorithm,salt:n,iterationCount:e.iterations,contentToStamp:i});this.macData=new Ac({mac:new Xf({digestAlgorithm:new pe({algorithmId:t.getOIDByAlgorithm({name:e.hmacHashAlgorithm},!0,"hmacHashAlgorithm")}),digest:new Be({valueHex:a})}),macSalt:new Be({valueHex:n}),iterations:e.iterations})}break;case 1:{if(!("signingCertificate"in e))throw new Jt("signingCertificate");Jt.assertEmpty(e.privateKey,"privateKey"),Jt.assertEmpty(e.hashAlgorithm,"hashAlgorithm");let n=this.parsedValue.authenticatedSafe.toSchema().toBER(!1),s=new wm({version:1,encapContentInfo:new Gf({eContentType:"1.2.840.113549.1.7.1",eContent:new Be({valueHex:n})}),certificates:[e.signingCertificate]}),i=await t.digest({name:e.hashAlgorithm},new Uint8Array(n)),a=[];a.push(new $r({type:"1.2.840.113549.1.9.3",values:[new He({value:"1.2.840.113549.1.7.1"})]})),a.push(new $r({type:"1.2.840.113549.1.9.5",values:[new Il({valueDate:new Date})]})),a.push(new $r({type:"1.2.840.113549.1.9.4",values:[new Be({valueHex:i})]})),s.signerInfos.push(new vA({version:1,sid:new Ln({issuer:e.signingCertificate.issuer,serialNumber:e.signingCertificate.serialNumber}),signedAttrs:new Ts({type:0,attributes:a})})),await s.sign(e.privateKey,0,e.hashAlgorithm,void 0,t),this.authSafe=new Fr({contentType:"1.2.840.113549.1.7.2",content:s.toSchema(!0)})}break;default:throw new Error(`Parameter "integrityMode" has unknown value: ${this.parsedValue.integrityMode}`)}}async parseInternalValues(e,t=mt(!0)){switch(hr.assert(e,"parameters","object"),e.checkIntegrity===void 0&&(e.checkIntegrity=!0),this.parsedValue={},this.authSafe.contentType){case Fr.DATA:{Jt.assertEmpty(e.password,"password"),this.parsedValue.integrityMode=0,hr.assert(this.authSafe.content,"authSafe.content",Be);let n=this.authSafe.content.getValue();if(this.parsedValue.authenticatedSafe=YR.fromBER(n),e.checkIntegrity){if(!this.macData)throw new Error('Absent "macData" value, can not check PKCS#12 data integrity');let s=t.getAlgorithmByOID(this.macData.mac.digestAlgorithm.algorithmId,!0,"digestAlgorithm");if(!await t.verifyDataStampedWithPassword({password:e.password,hashAlgorithm:s.name,salt:Ze.toArrayBuffer(this.macData.macSalt.valueBlock.valueHexView),iterationCount:this.macData.iterations||1,contentToVerify:n,signatureToVerify:Ze.toArrayBuffer(this.macData.mac.digest.valueBlock.valueHexView)}))throw new Error("Integrity for the PKCS#12 data is broken!")}}break;case Fr.SIGNED_DATA:{this.parsedValue.integrityMode=1;let n=new wm({schema:this.authSafe.content}),s=n.encapContentInfo.eContent;Jt.assert(s,"eContent","cmsSigned.encapContentInfo"),hr.assert(s,"eContent",Be);let i=s.getValue();if(this.parsedValue.authenticatedSafe=YR.fromBER(i),!await n.verify({signer:0,checkChain:!1},t))throw new Error("Integrity for the PKCS#12 data is broken!")}break;default:throw new Error(`Incorrect value for "this.authSafe.contentType": ${this.authSafe.contentType}`)}}};rhe.CLASS_NAME="PFX";var fm="status",Dc="statusStrings",Bc="failInfo",nhe=[fm,Dc,Bc],N7;(function(r){r[r.granted=0]="granted",r[r.grantedWithMods=1]="grantedWithMods",r[r.rejection=2]="rejection",r[r.waiting=3]="waiting",r[r.revocationWarning=4]="revocationWarning",r[r.revocationNotification=5]="revocationNotification"})(N7||(N7={}));var jv=class Kf extends Se{static{o(this,"PKIStatusInfo")}constructor(e={}){super(),this.status=B(e,fm,Kf.defaultValues(fm)),Dc in e&&(this.statusStrings=B(e,Dc,Kf.defaultValues(Dc))),Bc in e&&(this.failInfo=B(e,Bc,Kf.defaultValues(Bc))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case fm:return 2;case Dc:return[];case Bc:return new Ct;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case fm:return t===Kf.defaultValues(e);case Dc:return t.length===0;case Bc:return t.isEqual(Kf.defaultValues(e));default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new he({name:t.status||P}),new K({optional:!0,value:[new lt({name:t.statusStrings||P,value:new ui})]}),new Ct({name:t.failInfo||P,optional:!0})]})}fromSchema(e){Ce(e,nhe);let t=be(e,e,Kf.schema({names:{status:fm,statusStrings:Dc,failInfo:Bc}}));ye.assertSchema(t,this.className);let n=t.result.status;if(n.valueBlock.isHexOnly===!0||n.valueBlock.valueDec<0||n.valueBlock.valueDec>5)throw new Error('PKIStatusInfo "status" has invalid value');this.status=n.valueBlock.valueDec,Dc in t.result&&(this.statusStrings=t.result.statusStrings),Bc in t.result&&(this.failInfo=t.result.failInfo)}toSchema(){let e=[];return e.push(new he({value:this.status})),this.statusStrings&&e.push(new K({optional:!0,value:this.statusStrings})),this.failInfo&&e.push(this.failInfo),new K({value:e})}toJSON(){let e={status:this.status};return this.statusStrings&&(e.statusStrings=Array.from(this.statusStrings,t=>t.toJSON())),this.failInfo&&(e.failInfo=this.failInfo.toJSON()),e}};jv.CLASS_NAME="PKIStatusInfo";var qv="version",Hv="messageImprint",hm="reqPolicy",pm="nonce",Io="certReq",dm="extensions",rh="TimeStampReq",g_=`${rh}.${qv}`,y_=`${rh}.${Hv}`,XS=`${rh}.${hm}`,GS=`${rh}.${pm}`,zS=`${rh}.${Io}`,WS=`${rh}.${dm}`,she=[g_,y_,XS,GS,zS,WS],ihe=class pi extends Se{static{o(this,"TimeStampReq")}constructor(e={}){super(),this.version=B(e,qv,pi.defaultValues(qv)),this.messageImprint=B(e,Hv,pi.defaultValues(Hv)),hm in e&&(this.reqPolicy=B(e,hm,pi.defaultValues(hm))),pm in e&&(this.nonce=B(e,pm,pi.defaultValues(pm))),Io in e&&(this.certReq=B(e,Io,pi.defaultValues(Io))),dm in e&&(this.extensions=B(e,dm,pi.defaultValues(dm))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case qv:return 0;case Hv:return new ji;case hm:return P;case pm:return new he;case Io:return!1;case dm:return[];default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case qv:case hm:case Io:return t===pi.defaultValues(e);case Hv:return ji.compareWithDefault("hashAlgorithm",t.hashAlgorithm)&&ji.compareWithDefault("hashedMessage",t.hashedMessage);case pm:return t.isEqual(pi.defaultValues(e));case dm:return t.length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||rh,value:[new he({name:t.version||g_}),ji.schema(t.messageImprint||{names:{blockName:y_}}),new He({name:t.reqPolicy||XS,optional:!0}),new he({name:t.nonce||GS,optional:!0}),new Oi({name:t.certReq||zS,optional:!0}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new lt({name:t.extensions||WS,value:di.schema()})]})]})}fromSchema(e){Ce(e,she);let t=be(e,e,pi.schema());ye.assertSchema(t,this.className),this.version=t.result[g_].valueBlock.valueDec,this.messageImprint=new ji({schema:t.result[y_]}),XS in t.result&&(this.reqPolicy=t.result[XS].valueBlock.toString()),GS in t.result&&(this.nonce=t.result[GS]),zS in t.result&&(this.certReq=t.result[zS].valueBlock.value),WS in t.result&&(this.extensions=Array.from(t.result[WS],n=>new di({schema:n})))}toSchema(){let e=[];return e.push(new he({value:this.version})),e.push(this.messageImprint.toSchema()),this.reqPolicy&&e.push(new He({value:this.reqPolicy})),this.nonce&&e.push(this.nonce),Io in this&&pi.compareWithDefault(Io,this.certReq)===!1&&e.push(new Oi({value:this.certReq})),this.extensions&&e.push(new ae({idBlock:{tagClass:3,tagNumber:0},value:Array.from(this.extensions,t=>t.toSchema())})),new K({value:e})}toJSON(){let e={version:this.version,messageImprint:this.messageImprint.toJSON()};return this.reqPolicy!==void 0&&(e.reqPolicy=this.reqPolicy),this.nonce!==void 0&&(e.nonce=this.nonce.toJSON()),this.certReq!==void 0&&pi.compareWithDefault(Io,this.certReq)===!1&&(e.certReq=this.certReq),this.extensions&&(e.extensions=Array.from(this.extensions,t=>t.toJSON())),e}};ihe.CLASS_NAME="TimeStampReq";var mm="status",gm="timeStampToken",F_="TimeStampResp",v_=`${F_}.${mm}`,JS=`${F_}.${gm}`,ahe=[v_,JS],ohe=class YS extends Se{static{o(this,"TimeStampResp")}constructor(e={}){super(),this.status=B(e,mm,YS.defaultValues(mm)),gm in e&&(this.timeStampToken=B(e,gm,YS.defaultValues(gm))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case mm:return new jv;case gm:return new Fr;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case mm:return jv.compareWithDefault(mm,t.status)&&!("statusStrings"in t)&&!("failInfo"in t);case gm:return t.contentType===P&&t.content instanceof it;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||F_,value:[jv.schema(t.status||{names:{blockName:v_}}),Fr.schema(t.timeStampToken||{names:{blockName:JS,optional:!0}})]})}fromSchema(e){Ce(e,ahe);let t=be(e,e,YS.schema());ye.assertSchema(t,this.className),this.status=new jv({schema:t.result[v_]}),JS in t.result&&(this.timeStampToken=new Fr({schema:t.result[JS]}))}toSchema(){let e=[];return e.push(this.status.toSchema()),this.timeStampToken&&e.push(this.timeStampToken.toSchema()),new K({value:e})}toJSON(){let e={status:this.status.toJSON()};return this.timeStampToken&&(e.timeStampToken=this.timeStampToken.toJSON()),e}async sign(e,t,n=mt(!0)){return this.assertContentType(),new wm({schema:this.timeStampToken.content}).sign(e,0,t,void 0,n)}async verify(e={signer:0,trustedCerts:[],data:Kr},t=mt(!0)){return this.assertContentType(),new wm({schema:this.timeStampToken.content}).verify(e,t)}assertContentType(){if(!this.timeStampToken)throw new Error("timeStampToken is absent in TSP response");if(this.timeStampToken.contentType!==U7)throw new Error(`Wrong format of timeStampToken: ${this.timeStampToken.contentType}`)}};ohe.CLASS_NAME="TimeStampResp";function uhe(){if(typeof globalThis<"u"&&"crypto"in globalThis){let r="webcrypto";"webkitSubtle"in globalThis.crypto&&(r="safari"),QS(r,new Em({name:r,crypto:globalThis.crypto}))}else if(typeof crypto<"u"&&"webcrypto"in crypto){let r="NodeJS ^15",e=crypto.webcrypto;QS(r,new Em({name:r,crypto:e}))}}o(uhe,"initCryptoEngine");uhe();var U_=null,rn=class{static{o(this,"Application")}static setEngine(e,t){U_=Object.assign(t,{name:e}),QS(e,new Em({name:e,crypto:t}))}static get crypto(){if(!U_)throw new _e(we.CRYPTOGRAPHIC_NO_MODULE);return U_}static isNodePlugin(){return typeof self>"u"&&typeof window>"u"}};function che(){rn.isNodePlugin()||rn.setEngine("W3 WebCrypto module",self.crypto)}o(che,"init");che();var xA=class{static{o(this,"XmlAlgorithm")}getAlgorithmName(){return this.namespaceURI}},nh=class extends xA{static{o(this,"HashAlgorithm")}async Digest(e){let t;if(typeof e=="string")t=sr.FromString(e,"utf8");else if(ArrayBuffer.isView(e))t=new Uint8Array(e.buffer);else if(e instanceof ArrayBuffer)t=new Uint8Array(e);else{let s=Sp(e);t=sr.FromString(s,"utf8")}let n=await rn.crypto.subtle.digest(this.algorithm,t);return new Uint8Array(n)}},Yr=class extends xA{static{o(this,"SignatureAlgorithm")}async Sign(e,t,n){let s=sr.FromString(e,"utf8");return rn.crypto.subtle.sign(n,t,s)}async Verify(e,t,n){let s=this.algorithm,i=sr.FromString(e,"utf8");return rn.crypto.subtle.verify(s,t,n,i)}};var cn="SHA-1",Cn="SHA-256",Nn="SHA-384",Tn="SHA-512",Am="http://www.w3.org/2000/09/xmldsig#sha1",Cm="http://www.w3.org/2001/04/xmlenc#sha256",Nm="http://www.w3.org/2001/04/xmldsig-more#sha384",Tm="http://www.w3.org/2001/04/xmlenc#sha512",EA=class extends nh{static{o(this,"Sha1")}constructor(){super(...arguments),this.algorithm={name:cn},this.namespaceURI=Am}},rx=class extends nh{static{o(this,"Sha256")}constructor(){super(...arguments),this.algorithm={name:Cn},this.namespaceURI=Cm}},wA=class extends nh{static{o(this,"Sha384")}constructor(){super(...arguments),this.algorithm={name:Nn},this.namespaceURI=Nm}},bA=class extends nh{static{o(this,"Sha512")}constructor(){super(...arguments),this.algorithm={name:Tn},this.namespaceURI=Tm}};var Ro="ECDSA",SA="http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha1",AA="http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha256",CA="http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha384",NA="http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha512";function TA(r){if(r.name.toUpperCase()===Ro.toUpperCase())switch(r.hash.name.toUpperCase()){case cn:return new Im;case Cn:return new Dm;case Nn:return new Bm;case Tn:return new Rm}return null}o(TA,"fromAlgorithm");var Im=class extends Yr{static{o(this,"EcdsaSha1")}constructor(){super(...arguments),this.algorithm={name:Ro,hash:{name:cn}},this.namespaceURI=SA}static fromAlgorithm(e){return TA(e)}},Dm=class extends Yr{static{o(this,"EcdsaSha256")}constructor(){super(...arguments),this.algorithm={name:Ro,hash:{name:Cn}},this.namespaceURI=AA}static fromAlgorithm(e){return TA(e)}},Bm=class extends Yr{static{o(this,"EcdsaSha384")}constructor(){super(...arguments),this.algorithm={name:Ro,hash:{name:Nn}},this.namespaceURI=CA}static fromAlgorithm(e){return TA(e)}},Rm=class extends Yr{static{o(this,"EcdsaSha512")}constructor(){super(...arguments),this.algorithm={name:Ro,hash:{name:Tn}},this.namespaceURI=NA}static fromAlgorithm(e){return TA(e)}};var _m="HMAC",V_="http://www.w3.org/2000/09/xmldsig#hmac-sha1",M_="http://www.w3.org/2001/04/xmldsig-more#hmac-sha256",j_="http://www.w3.org/2001/04/xmldsig-more#hmac-sha384",q_="http://www.w3.org/2001/04/xmldsig-more#hmac-sha512";function IA(r){if(r.name.toUpperCase()===_m.toUpperCase())switch(r.hash.name.toUpperCase()){case cn:return new nx;case Cn:return new sx;case Nn:return new ix;case Tn:return new ax}return null}o(IA,"fromAlgorithm");var nx=class extends Yr{static{o(this,"HmacSha1")}constructor(){super(...arguments),this.algorithm={name:_m,hash:{name:cn}},this.namespaceURI=V_}static fromAlgorithm(e){return IA(e)}},sx=class extends Yr{static{o(this,"HmacSha256")}constructor(){super(...arguments),this.algorithm={name:_m,hash:{name:Cn}},this.namespaceURI=M_}static fromAlgorithm(e){return IA(e)}},ix=class extends Yr{static{o(this,"HmacSha384")}constructor(){super(...arguments),this.algorithm={name:_m,hash:{name:Nn}},this.namespaceURI=j_}static fromAlgorithm(e){return IA(e)}},ax=class extends Yr{static{o(this,"HmacSha512")}constructor(){super(...arguments),this.algorithm={name:_m,hash:{name:Tn}},this.namespaceURI=q_}static fromAlgorithm(e){return IA(e)}};var _o="RSASSA-PKCS1-v1_5",DA="http://www.w3.org/2000/09/xmldsig#rsa-sha1",BA="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256",RA="http://www.w3.org/2001/04/xmldsig-more#rsa-sha384",_A="http://www.w3.org/2001/04/xmldsig-more#rsa-sha512";function OA(r){if(r.name.toUpperCase()===_o.toUpperCase())switch(r.hash.name.toUpperCase()){case cn:return new Om;case Cn:return new Pm;case Nn:return new km;case Tn:return new Lm}return null}o(OA,"fromAlgorithm");var Om=class extends Yr{static{o(this,"RsaPkcs1Sha1")}constructor(){super(...arguments),this.algorithm={name:_o,hash:{name:cn}},this.namespaceURI=DA}static fromAlgorithm(e){return OA(e)}},Pm=class extends Yr{static{o(this,"RsaPkcs1Sha256")}constructor(){super(...arguments),this.algorithm={name:_o,hash:{name:Cn}},this.namespaceURI=BA}static fromAlgorithm(e){return OA(e)}},km=class extends Yr{static{o(this,"RsaPkcs1Sha384")}constructor(){super(...arguments),this.algorithm={name:_o,hash:{name:Nn}},this.namespaceURI=RA}static fromAlgorithm(e){return OA(e)}},Lm=class extends Yr{static{o(this,"RsaPkcs1Sha512")}constructor(){super(...arguments),this.algorithm={name:_o,hash:{name:Tn}},this.namespaceURI=_A}static fromAlgorithm(e){return OA(e)}};function Fe(r,e,t,n){var s=arguments.length,i=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(r,e,t,n);else for(var u=r.length-1;u>=0;u--)(a=r[u])&&(i=(s<3?a(i):s>3?a(e,t,i):a(e,t))||i);return s>3&&i&&Object.defineProperty(e,t,i),i}o(Fe,"__decorate");function Ye(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}o(Ye,"__metadata");var fe={DefaultCanonMethod:"http://www.w3.org/TR/2001/REC-xml-c14n-20010315",DefaultDigestMethod:"http://www.w3.org/2001/04/xmlenc#sha256",DefaultPrefix:"ds",ElementNames:{CanonicalizationMethod:"CanonicalizationMethod",DigestMethod:"DigestMethod",DigestValue:"DigestValue",DSAKeyValue:"DSAKeyValue",DomainParameters:"DomainParameters",EncryptedKey:"EncryptedKey",HMACOutputLength:"HMACOutputLength",RSAPSSParams:"RSAPSSParams",MaskGenerationFunction:"MaskGenerationFunction",SaltLength:"SaltLength",KeyInfo:"KeyInfo",KeyName:"KeyName",KeyValue:"KeyValue",Modulus:"Modulus",Exponent:"Exponent",Manifest:"Manifest",Object:"Object",Reference:"Reference",RetrievalMethod:"RetrievalMethod",RSAKeyValue:"RSAKeyValue",ECDSAKeyValue:"ECDSAKeyValue",NamedCurve:"NamedCurve",PublicKey:"PublicKey",Signature:"Signature",SignatureMethod:"SignatureMethod",SignatureValue:"SignatureValue",SignedInfo:"SignedInfo",Transform:"Transform",Transforms:"Transforms",X509Data:"X509Data",PGPData:"PGPData",SPKIData:"SPKIData",SPKIexp:"SPKIexp",MgmtData:"MgmtData",X509IssuerSerial:"X509IssuerSerial",X509IssuerName:"X509IssuerName",X509SerialNumber:"X509SerialNumber",X509SKI:"X509SKI",X509SubjectName:"X509SubjectName",X509Certificate:"X509Certificate",X509CRL:"X509CRL",XPath:"XPath",X:"X",Y:"Y"},AttributeNames:{Algorithm:"Algorithm",Encoding:"Encoding",Id:"Id",MimeType:"MimeType",Type:"Type",URI:"URI"},AlgorithmNamespaces:{XmlDsigBase64Transform:"http://www.w3.org/2000/09/xmldsig#base64",XmlDsigC14NTransform:"http://www.w3.org/TR/2001/REC-xml-c14n-20010315",XmlDsigC14NWithCommentsTransform:"http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments",XmlDsigEnvelopedSignatureTransform:"http://www.w3.org/2000/09/xmldsig#enveloped-signature",XmlDsigXPathTransform:"http://www.w3.org/TR/1999/REC-xpath-19991116",XmlDsigXsltTransform:"http://www.w3.org/TR/1999/REC-xslt-19991116",XmlDsigExcC14NTransform:"http://www.w3.org/2001/10/xml-exc-c14n#",XmlDsigExcC14NWithCommentsTransform:"http://www.w3.org/2001/10/xml-exc-c14n#WithComments",XmlDecryptionTransform:"http://www.w3.org/2002/07/decrypt#XML",XmlLicenseTransform:"urn:mpeg:mpeg21:2003:01-REL-R-NS:licenseTransform"},Uri:{Manifest:"http://www.w3.org/2000/09/xmldsig#Manifest"},NamespaceURI:"http://www.w3.org/2000/09/xmldsig#",NamespaceURIMore:"http://www.w3.org/2007/05/xmldsig-more#",NamespaceURIPss:"http://www.example.org/xmldsig-pss/#"};var Br=class extends ws{static{o(this,"XmlSignatureObject")}};Br=Fe([Et({localName:"xmldsig",namespaceURI:fe.NamespaceURI,prefix:fe.DefaultPrefix})],Br);var mi=class extends Cp{static{o(this,"XmlSignatureCollection")}};mi=Fe([Et({localName:"xmldsig_collection",namespaceURI:fe.NamespaceURI,prefix:fe.DefaultPrefix})],mi);var gi=class extends Br{static{o(this,"DigestMethod")}constructor(e){super(),e&&(this.Algorithm=e)}};Fe([wr({localName:fe.AttributeNames.Algorithm,required:!0,defaultValue:fe.DefaultDigestMethod}),Ye("design:type",String)],gi.prototype,"Algorithm",void 0);gi=Fe([Et({localName:fe.ElementNames.DigestMethod}),Ye("design:paramtypes",[String])],gi);var Hs=class extends Br{static{o(this,"KeyInfoClause")}static canImportCryptoKey(e){return!1}};var lhe={name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},Fm=class extends Hs{static{o(this,"RsaKeyValue")}constructor(){super(...arguments),this.key=null,this.jwk=null,this.keyUsage=[]}static canImportCryptoKey(e){let t=e.algorithm.name.toUpperCase();return t===_o.toUpperCase()||t===Ki.toUpperCase()}async importKey(e){let t=e.algorithm.name?e.algorithm.name.toUpperCase():"";if(t!==_o.toUpperCase()&&t!==Ki.toUpperCase())throw new _e(we.ALGORITHM_WRONG_NAME,e.algorithm.name);this.key=e;let n=await rn.crypto.subtle.exportKey("jwk",e);return this.jwk=n,this.Modulus=sr.FromBase64Url(n.n||""),this.Exponent=sr.FromBase64Url(n.e||""),this.keyUsage=e.usages,this}async exportKey(e=lhe){if(this.key)return this.key;if(!this.Modulus)throw new _e(we.CRYPTOGRAPHIC,"RsaKeyValue has no Modulus");let t=sr.ToBase64Url(this.Modulus);if(!this.Exponent)throw new _e(we.CRYPTOGRAPHIC,"RsaKeyValue has no Exponent");let n=sr.ToBase64Url(this.Exponent),s;switch(e.name.toUpperCase()){case _o.toUpperCase():s="R";break;case Ki.toUpperCase():s="P";break;default:throw new _e(we.ALGORITHM_NOT_SUPPORTED,e.name)}switch(e.hash.name.toUpperCase()){case cn:s+="S1";break;case Cn:s+="S256";break;case Nn:s+="S384";break;case Tn:s+="S512";break}let i={kty:"RSA",alg:s,n:t,e:n,ext:!0};return rn.crypto.subtle.importKey("jwk",i,e,!0,this.keyUsage)}LoadXml(e){super.LoadXml(e),this.keyUsage=["verify"]}};Fe([Dt({localName:fe.ElementNames.Modulus,prefix:fe.DefaultPrefix,namespaceURI:fe.NamespaceURI,required:!0,converter:oi}),Ye("design:type",Object)],Fm.prototype,"Modulus",void 0);Fe([Dt({localName:fe.ElementNames.Exponent,prefix:fe.DefaultPrefix,namespaceURI:fe.NamespaceURI,required:!0,converter:oi}),Ye("design:type",Object)],Fm.prototype,"Exponent",void 0);Fm=Fe([Et({localName:fe.ElementNames.RSAKeyValue})],Fm);var H_="http://www.w3.org/2007/05/xmldsig-more#",K_="pss",Um=class extends ws{static{o(this,"MaskGenerationFunction")}};Fe([Dt({parser:gi}),Ye("design:type",gi)],Um.prototype,"DigestMethod",void 0);Fe([wr({localName:fe.AttributeNames.Algorithm,defaultValue:"http://www.w3.org/2007/05/xmldsig-more#MGF1"}),Ye("design:type",String)],Um.prototype,"Algorithm",void 0);Um=Fe([Et({localName:fe.ElementNames.MaskGenerationFunction,prefix:K_,namespaceURI:H_})],Um);var $i=class extends ws{static{o(this,"PssAlgorithmParams")}};Fe([Dt({parser:gi}),Ye("design:type",gi)],$i.prototype,"DigestMethod",void 0);Fe([Dt({parser:Um}),Ye("design:type",Um)],$i.prototype,"MGF",void 0);Fe([Dt({converter:Yg,prefix:K_,namespaceURI:H_}),Ye("design:type",Number)],$i.prototype,"SaltLength",void 0);Fe([Dt({converter:Yg}),Ye("design:type",Number)],$i.prototype,"TrailerField",void 0);$i=Fe([Et({localName:fe.ElementNames.RSAPSSParams,prefix:K_,namespaceURI:H_})],$i);var Ki="RSA-PSS",$_="http://www.w3.org/2007/05/xmldsig-more#rsa-pss",PA=class r extends Yr{static{o(this,"RsaPssWithParams")}constructor(){super(...arguments),this.algorithm={name:Ki,hash:{name:cn}},this.namespaceURI=$_}static fromAlgorithm(e){let t=null;if(e.name.toUpperCase()===Ki.toUpperCase()){switch(e.hash.name.toUpperCase()){case cn:t=new r;break;case Cn:t=new r;break;case Nn:t=new r;break;case Tn:t=new r;break}if(t)return t.algorithm.hash.name=e.hash.name,e.saltLength&&(t.algorithm.saltLength=e.saltLength),t}return null}fromMethod(e){if(!e.Any.Some(t=>{if(t instanceof $i){switch(t.DigestMethod.Algorithm.toLowerCase()){case Am:this.algorithm.hash.name=cn;break;case Cm:this.algorithm.hash.name=Cn;break;case Nm:this.algorithm.hash.name=Nn;break;case Tm:this.algorithm.hash.name=Tn;break;default:throw new _e(we.CRYPTOGRAPHIC,`Unsupported hash algorithm: ${t.DigestMethod.Algorithm}`)}return t.SaltLength&&(this.algorithm.saltLength=t.SaltLength),!0}return!1}))throw new _e(we.CRYPTOGRAPHIC,"RSA-PSS parameters not found in SignatureMethod")}toMethod(e){let t=new $i;switch(this.algorithm.hash.name.toUpperCase()){case cn:t.DigestMethod.Algorithm=Am;break;case Cn:t.DigestMethod.Algorithm=Cm;break;case Nn:t.DigestMethod.Algorithm=Nm;break;case Tn:t.DigestMethod.Algorithm=Tm;break;default:throw new _e(we.CRYPTOGRAPHIC,`Unsupported hash algorithm: ${this.algorithm.hash.name}`)}this.algorithm.saltLength&&(t.SaltLength=this.algorithm.saltLength),e.Any.Add(t)}};var X_="http://www.w3.org/2007/05/xmldsig-more#sha1-rsa-MGF1",G_="http://www.w3.org/2007/05/xmldsig-more#sha256-rsa-MGF1",z_="http://www.w3.org/2007/05/xmldsig-more#sha384-rsa-MGF1",W_="http://www.w3.org/2007/05/xmldsig-more#sha512-rsa-MGF1",Vm=class extends Yr{static{o(this,"RsaPssWithoutParamsBase")}static fromAlgorithm(e){return null}},kA=class extends Vm{static{o(this,"RsaPssWithoutParamsSha1")}constructor(){super(...arguments),this.algorithm={name:Ki,hash:{name:cn},saltLength:20},this.namespaceURI=X_}},LA=class extends Vm{static{o(this,"RsaPssWithoutParamsSha256")}constructor(){super(...arguments),this.algorithm={name:Ki,hash:{name:Cn},saltLength:32},this.namespaceURI=G_}},FA=class extends Vm{static{o(this,"RsaPssWithoutParamsSha384")}constructor(){super(...arguments),this.algorithm={name:Ki,hash:{name:Nn},saltLength:48},this.namespaceURI=z_}},UA=class extends Vm{static{o(this,"RsaPssWithoutParamsSha512")}constructor(){super(...arguments),this.algorithm={name:Ki,hash:{name:Tn},saltLength:64},this.namespaceURI=W_}};var Ks;(function(r){r[r.BeforeDocElement=0]="BeforeDocElement",r[r.InsideDocElement=1]="InsideDocElement",r[r.AfterDocElement=2]="AfterDocElement"})(Ks||(Ks={}));var Ta=class{static{o(this,"XmlCanonicalizer")}constructor(e,t,n=new Np){this.propagatedNamespaces=new Np,this.result=[],this.visibleNamespaces=new Np,this.inclusiveNamespacesPrefixList=[],this.state=Ks.BeforeDocElement,this.withComments=e,this.exclusive=t,this.propagatedNamespaces=n}get InclusiveNamespacesPrefixList(){return this.inclusiveNamespacesPrefixList.join(" ")}set InclusiveNamespacesPrefixList(e){this.inclusiveNamespacesPrefixList=e.split(" ")}Canonicalize(e){if(!e)throw new _e(we.CRYPTOGRAPHIC,"Parameter 1 is not Node");return this.WriteNode(e),this.result.join("")}WriteNode(e){switch(e.nodeType){case xt.Document:case xt.DocumentFragment:this.WriteDocumentNode(e);break;case xt.Element:this.WriteElementNode(e);break;case xt.CDATA:case xt.SignificantWhitespace:case xt.Text:Sl(e.parentNode)||this.WriteTextNode(e);break;case xt.Whitespace:this.state===Ks.InsideDocElement&&this.WriteTextNode(e);break;case xt.Comment:this.WriteCommentNode(e);break;case xt.ProcessingInstruction:this.WriteProcessingInstructionNode(e);break;case xt.EntityReference:for(let t=0;t<e.childNodes.length;t++)this.WriteNode(e.childNodes[t]);break;case xt.Attribute:throw new _e(we.CRYPTOGRAPHIC,"Attribute node is impossible here");case xt.EndElement:throw new _e(we.CRYPTOGRAPHIC,"Attribute node is impossible here");case xt.EndEntity:throw new _e(we.CRYPTOGRAPHIC,"Attribute node is impossible here");case xt.DocumentType:case xt.Entity:case xt.Notation:case xt.XmlDeclaration:break}}WriteDocumentNode(e){this.state=Ks.BeforeDocElement;for(let t=e.firstChild;t!=null;t=t.nextSibling)this.WriteNode(t)}WriteCommentNode(e){this.withComments&&(this.state===Ks.AfterDocElement?this.result.push(`
|
|
104
|
+
`)}`:`${t} :`}};iq=ae;ze.Constructed=iq;ae.NAME="CONSTRUCTED";var aq=class extends As{static{o(this,"LocalEndOfContentValueBlock")}fromBER(e,t,n){return t}toBER(e){return xa}};aq.override="EndOfContentValueBlock";var oq,uq=class extends ts{static{o(this,"EndOfContent")}constructor(e={}){super(e,aq),this.idBlock.tagClass=1,this.idBlock.tagNumber=0}};oq=uq;ze.EndOfContent=oq;uq.NAME=ty;var cq,Pr=class extends ts{static{o(this,"Null")}constructor(e={}){super(e,As),this.idBlock.tagClass=1,this.idBlock.tagNumber=5}fromBER(e,t,n){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+=n,t+n>e.byteLength?(this.error="End of input reached before message was fully decoded (inconsistent offset and length values)",-1):t+n}toBER(e,t){let n=new ArrayBuffer(2);if(!e){let s=new Uint8Array(n);s[0]=5,s[1]=0}return t&&t.write(n),n}onAsciiEncoding(){return`${this.constructor.NAME}`}};cq=Pr;ze.Null=cq;Pr.NAME="NULL";var lq=class extends oo(As){static{o(this,"LocalBooleanValueBlock")}get value(){for(let e of this.valueHexView)if(e>0)return!0;return!1}set value(e){this.valueHexView[0]=e?255:0}constructor({value:e,...t}={}){super(t),t.valueHex?this.valueHexView=Ze.toUint8Array(t.valueHex):this.valueHexView=new Uint8Array(1),e&&(this.value=e)}fromBER(e,t,n){let s=Ze.toUint8Array(e);return ao(this,s,t,n)?(this.valueHexView=s.subarray(t,t+n),n>1&&this.warnings.push("Boolean value encoded in more then 1 octet"),this.isHexOnly=!0,bB.call(this),this.blockLength=n,t+n):-1}toBER(){return this.valueHexView.slice()}toJSON(){return{...super.toJSON(),value:this.value}}};lq.NAME="BooleanValueBlock";var fq,Oi=class extends ts{static{o(this,"Boolean")}getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}constructor(e={}){super(e,lq),this.idBlock.tagClass=1,this.idBlock.tagNumber=1}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.getValue}`}};fq=Oi;ze.Boolean=fq;Oi.NAME="BOOLEAN";var hq=class extends oo(Ru){static{o(this,"LocalOctetStringValueBlock")}constructor({isConstructed:e=!1,...t}={}){super(t),this.isConstructed=e}fromBER(e,t,n){let s=0;if(this.isConstructed){if(this.isHexOnly=!1,s=Ru.prototype.fromBER.call(this,e,t,n),s===-1)return s;for(let i=0;i<this.value.length;i++){let a=this.value[i].constructor.NAME;if(a===ty){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, OCTET STRING may consists of OCTET STRINGs only",-1}if(a!==Y9)return this.error="OCTET STRING may consists of OCTET STRINGs only",-1}}else this.isHexOnly=!0,s=super.fromBER(e,t,n),this.blockLength=n;return s}toBER(e,t){return this.isConstructed?Ru.prototype.toBER.call(this,e,t):e?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),isConstructed:this.isConstructed}}};hq.NAME="OctetStringValueBlock";var IB,Be=class extends ts{static{o(this,"OctetString")}constructor({idBlock:e={},lenBlock:t={},...n}={}){var s,i;(s=n.isConstructed)!==null&&s!==void 0||(n.isConstructed=!!(!((i=n.value)===null||i===void 0)&&i.length)),super({idBlock:{isConstructed:n.isConstructed,...e},lenBlock:{...t,isIndefiniteForm:!!n.isIndefiniteForm},...n},hq),this.idBlock.tagClass=1,this.idBlock.tagNumber=4}fromBER(e,t,n){if(this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,n===0)return this.idBlock.error.length===0&&(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length===0&&(this.blockLength+=this.lenBlock.blockLength),t;if(!this.valueBlock.isConstructed){let i=(e instanceof ArrayBuffer?new Uint8Array(e):e).subarray(t,t+n);try{if(i.byteLength){let a=ry(i,0,i.byteLength);a.offset!==-1&&a.offset===n&&(this.valueBlock.value=[a.result])}}catch{}}return super.fromBER(e,t,n)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return ae.prototype.onAsciiEncoding.call(this);let e=this.constructor.NAME,t=ut.ToHex(this.valueBlock.valueHexView);return`${e} : ${t}`}getValue(){if(!this.idBlock.isConstructed)return this.valueBlock.valueHexView.slice().buffer;let e=[];for(let t of this.valueBlock.value)t instanceof IB&&e.push(t.valueBlock.valueHexView);return Ze.concat(e)}};IB=Be;ze.OctetString=IB;Be.NAME=Y9;var pq=class extends oo(Ru){static{o(this,"LocalBitStringValueBlock")}constructor({unusedBits:e=0,isConstructed:t=!1,...n}={}){super(n),this.unusedBits=e,this.isConstructed=t,this.blockLength=this.valueHexView.byteLength}fromBER(e,t,n){if(!n)return t;let s=-1;if(this.isConstructed){if(s=Ru.prototype.fromBER.call(this,e,t,n),s===-1)return s;for(let u of this.value){let c=u.constructor.NAME;if(c===ty){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, BIT STRING may consists of BIT STRINGs only",-1}if(c!==Q9)return this.error="BIT STRING may consists of BIT STRINGs only",-1;let l=u.valueBlock;if(this.unusedBits>0&&l.unusedBits>0)return this.error='Using of "unused bits" inside constructive BIT STRING allowed for least one only',-1;this.unusedBits=l.unusedBits}return s}let i=Ze.toUint8Array(e);if(!ao(this,i,t,n))return-1;let a=i.subarray(t,t+n);if(this.unusedBits=a[0],this.unusedBits>7)return this.error="Unused bits for BitString must be in range 0-7",-1;if(!this.unusedBits){let u=a.subarray(1);try{if(u.byteLength){let c=ry(u,0,u.byteLength);c.offset!==-1&&c.offset===n-1&&(this.value=[c.result])}}catch{}}return this.valueHexView=a.subarray(1),this.blockLength=a.length,t+n}toBER(e,t){if(this.isConstructed)return Ru.prototype.toBER.call(this,e,t);if(e)return new ArrayBuffer(this.valueHexView.byteLength+1);if(!this.valueHexView.byteLength){let s=new Uint8Array(1);return s[0]=0,s.buffer}let n=new Uint8Array(this.valueHexView.length+1);return n[0]=this.unusedBits,n.set(this.valueHexView,1),n.buffer}toJSON(){return{...super.toJSON(),unusedBits:this.unusedBits,isConstructed:this.isConstructed}}};pq.NAME="BitStringValueBlock";var dq,Ct=class extends ts{static{o(this,"BitString")}constructor({idBlock:e={},lenBlock:t={},...n}={}){var s,i;(s=n.isConstructed)!==null&&s!==void 0||(n.isConstructed=!!(!((i=n.value)===null||i===void 0)&&i.length)),super({idBlock:{isConstructed:n.isConstructed,...e},lenBlock:{...t,isIndefiniteForm:!!n.isIndefiniteForm},...n},pq),this.idBlock.tagClass=1,this.idBlock.tagNumber=3}fromBER(e,t,n){return this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,super.fromBER(e,t,n)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return ae.prototype.onAsciiEncoding.call(this);{let e=[],t=this.valueBlock.valueHexView;for(let a of t)e.push(a.toString(2).padStart(8,"0"));let n=e.join(""),s=this.constructor.NAME,i=n.substring(0,n.length-this.valueBlock.unusedBits);return`${s} : ${i}`}}};dq=Ct;ze.BitString=dq;Ct.NAME=Q9;var mq;function zue(r,e){let t=new Uint8Array([0]),n=new Uint8Array(r),s=new Uint8Array(e),i=n.slice(0),a=i.length-1,u=s.slice(0),c=u.length-1,l=0,f=c<a?a:c,h=0;for(let d=f;d>=0;d--,h++){switch(!0){case h<u.length:l=i[a-h]+u[c-h]+t[0];break;default:l=i[a-h]+t[0]}switch(t[0]=l/10,!0){case h>=i.length:i=Yw(new Uint8Array([l%10]),i);break;default:i[a-h]=l%10}}return t[0]>0&&(i=Yw(t,i)),i}o(zue,"viewAdd");function J9(r){if(r>=Zg.length)for(let e=Zg.length;e<=r;e++){let t=new Uint8Array([0]),n=Zg[e-1].slice(0);for(let s=n.length-1;s>=0;s--){let i=new Uint8Array([(n[s]<<1)+t[0]]);t[0]=i[0]/10,n[s]=i[0]%10}t[0]>0&&(n=Yw(t,n)),Zg.push(n)}return Zg[r]}o(J9,"power2");function Wue(r,e){let t=0,n=new Uint8Array(r),s=new Uint8Array(e),i=n.slice(0),a=i.length-1,u=s.slice(0),c=u.length-1,l,f=0;for(let h=c;h>=0;h--,f++)switch(l=i[a-f]-u[c-f]-t,!0){case l<0:t=1,i[a-f]=l+10;break;default:t=0,i[a-f]=l}if(t>0)for(let h=a-c+1;h>=0;h--,f++)if(l=i[a-f]-t,l<0)t=1,i[a-f]=l+10;else{t=0,i[a-f]=l;break}return i.slice()}o(Wue,"viewSub");var DB=class extends oo(As){static{o(this,"LocalIntegerValueBlock")}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=bB.call(this)))}constructor({value:e,...t}={}){super(t),this._valueDec=0,t.valueHex&&this.setValueHex(),e!==void 0&&(this.valueDec=e)}set valueDec(e){this._valueDec=e,this.isHexOnly=!1,this.valueHexView=new Uint8Array(H9(e))}get valueDec(){return this._valueDec}fromDER(e,t,n,s=0){let i=this.fromBER(e,t,n);if(i===-1)return i;let a=this.valueHexView;return a[0]===0&&(a[1]&128)!==0?this.valueHexView=a.subarray(1):s!==0&&a.length<s&&(s-a.length>1&&(s=a.length+1),this.valueHexView=a.subarray(s-a.length)),i}toDER(e=!1){let t=this.valueHexView;switch(!0){case(t[0]&128)!==0:{let n=new Uint8Array(this.valueHexView.length+1);n[0]=0,n.set(t,1),this.valueHexView=n}break;case(t[0]===0&&(t[1]&128)===0):this.valueHexView=this.valueHexView.subarray(1);break}return this.toBER(e)}fromBER(e,t,n){let s=super.fromBER(e,t,n);return s===-1||this.setValueHex(),s}toBER(e){return e?new ArrayBuffer(this.valueHexView.length):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}toString(){let e=this.valueHexView.length*8-1,t=new Uint8Array(this.valueHexView.length*8/3),n=0,s,i=this.valueHexView,a="",u=!1;for(let c=i.byteLength-1;c>=0;c--){s=i[c];for(let l=0;l<8;l++){if((s&1)===1)switch(n){case e:t=Wue(J9(n),t),a="-";break;default:t=zue(t,J9(n))}n++,s>>=1}}for(let c=0;c<t.length;c++)t[c]&&(u=!0),u&&(a+=z9.charAt(t[c]));return u===!1&&(a+=z9.charAt(0)),a}};mq=DB;DB.NAME="IntegerValueBlock";Object.defineProperty(mq.prototype,"valueHex",{set:o(function(r){this.valueHexView=new Uint8Array(r),this.setValueHex()},"set"),get:o(function(){return this.valueHexView.slice().buffer},"get")});var ey,he=class extends ts{static{o(this,"Integer")}constructor(e={}){super(e,DB),this.idBlock.tagClass=1,this.idBlock.tagNumber=2}toBigInt(){return Zw(),BigInt(this.valueBlock.toString())}static fromBigInt(e){Zw();let t=BigInt(e),n=new TB,s=t.toString(16).replace(/^-/,""),i=new Uint8Array(ut.FromHex(s));if(t<0){let u=new Uint8Array(i.length+(i[0]&128?1:0));u[0]|=128;let l=BigInt(`0x${ut.ToHex(u)}`)+t,f=Ze.toUint8Array(ut.FromHex(l.toString(16)));f[0]|=128,n.write(f)}else i[0]&128&&n.write(new Uint8Array([0])),n.write(i);return new ey({valueHex:n.final()})}convertToDER(){let e=new ey({valueHex:this.valueBlock.valueHexView});return e.valueBlock.toDER(),e}convertFromDER(){return new ey({valueHex:this.valueBlock.valueHexView[0]===0?this.valueBlock.valueHexView.subarray(1):this.valueBlock.valueHexView})}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()}`}};ey=he;ze.Integer=ey;he.NAME="INTEGER";var gq,_u=class extends he{static{o(this,"Enumerated")}constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=10}};gq=_u;ze.Enumerated=gq;_u.NAME="ENUMERATED";var AB=class extends oo(As){static{o(this,"LocalSidValueBlock")}constructor({valueDec:e=-1,isFirstSid:t=!1,...n}={}){super(n),this.valueDec=e,this.isFirstSid=t}fromBER(e,t,n){if(!n)return t;let s=Ze.toUint8Array(e);if(!ao(this,s,t,n))return-1;let i=s.subarray(t,t+n);this.valueHexView=new Uint8Array(n);for(let u=0;u<n&&(this.valueHexView[u]=i[u]&127,this.blockLength++,(i[u]&128)!==0);u++);let a=new Uint8Array(this.blockLength);for(let u=0;u<this.blockLength;u++)a[u]=this.valueHexView[u];return this.valueHexView=a,(i[this.blockLength-1]&128)!==0?(this.error="End of input reached before message was fully decoded",-1):(this.valueHexView[0]===0&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=io(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),t+this.blockLength)}set valueBigInt(e){Zw();let t=BigInt(e).toString(2);for(;t.length%7;)t="0"+t;let n=new Uint8Array(t.length/7);for(let s=0;s<n.length;s++)n[s]=parseInt(t.slice(s*7,s*7+7),2)+(s+1<n.length?128:0);this.fromBER(n.buffer,0,n.length)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);let s=this.valueHexView,i=new Uint8Array(this.blockLength);for(let a=0;a<this.blockLength-1;a++)i[a]=s[a]|128;return i[this.blockLength-1]=s[this.blockLength-1],i.buffer}let t=_i(this.valueDec,7);if(t.byteLength===0)return this.error="Error during encoding SID value",xa;let n=new Uint8Array(t.byteLength);if(!e){let s=new Uint8Array(t),i=t.byteLength-1;for(let a=0;a<i;a++)n[a]=s[a]|128;n[i]=s[i]}return n}toString(){let e="";if(this.isHexOnly)e=ut.ToHex(this.valueHexView);else if(this.isFirstSid){let t=this.valueDec;this.valueDec<=39?e="0.":this.valueDec<=79?(e="1.",t-=40):(e="2.",t-=80),e+=t.toString()}else e=this.valueDec.toString();return e}toJSON(){return{...super.toJSON(),valueDec:this.valueDec,isFirstSid:this.isFirstSid}}};AB.NAME="sidBlock";var yq=class extends As{static{o(this,"LocalObjectIdentifierValueBlock")}constructor({value:e=Ss,...t}={}){super(t),this.value=[],e&&this.fromString(e)}fromBER(e,t,n){let s=t;for(;n>0;){let i=new AB;if(s=i.fromBER(e,s,n),s===-1)return this.blockLength=0,this.error=i.error,s;this.value.length===0&&(i.isFirstSid=!0),this.blockLength+=i.blockLength,n-=i.blockLength,this.value.push(i)}return s}toBER(e){let t=[];for(let n=0;n<this.value.length;n++){let s=this.value[n].toBER(e);if(s.byteLength===0)return this.error=this.value[n].error,xa;t.push(s)}return NB(t)}fromString(e){this.value=[];let t=0,n=0,s="",i=!1;do if(n=e.indexOf(".",t),n===-1?s=e.substring(t):s=e.substring(t,n),t=n+1,i){let a=this.value[0],u=0;switch(a.valueDec){case 0:break;case 1:u=40;break;case 2:u=80;break;default:this.value=[];return}let c=parseInt(s,10);if(isNaN(c))return;a.valueDec=c+u,i=!1}else{let a=new AB;if(s>Number.MAX_SAFE_INTEGER){Zw();let u=BigInt(s);a.valueBigInt=u}else if(a.valueDec=parseInt(s,10),isNaN(a.valueDec))return;this.value.length||(a.isFirstSid=!0,i=!0),this.value.push(a)}while(n!==-1)}toString(){let e="",t=!1;for(let n=0;n<this.value.length;n++){t=this.value[n].isHexOnly;let s=this.value[n].toString();n!==0&&(e=`${e}.`),t?(s=`{${s}}`,this.value[n].isFirstSid?e=`2.{${s} - 80}`:e+=s):e+=s}return e}toJSON(){let e={...super.toJSON(),value:this.toString(),sidArray:[]};for(let t=0;t<this.value.length;t++)e.sidArray.push(this.value[t].toJSON());return e}};yq.NAME="ObjectIdentifierValueBlock";var vq,He=class extends ts{static{o(this,"ObjectIdentifier")}getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}constructor(e={}){super(e,yq),this.idBlock.tagClass=1,this.idBlock.tagNumber=6}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}};vq=He;ze.ObjectIdentifier=vq;He.NAME="OBJECT IDENTIFIER";var CB=class extends oo(Nl){static{o(this,"LocalRelativeSidValueBlock")}constructor({valueDec:e=0,...t}={}){super(t),this.valueDec=e}fromBER(e,t,n){if(n===0)return t;let s=Ze.toUint8Array(e);if(!ao(this,s,t,n))return-1;let i=s.subarray(t,t+n);this.valueHexView=new Uint8Array(n);for(let u=0;u<n&&(this.valueHexView[u]=i[u]&127,this.blockLength++,(i[u]&128)!==0);u++);let a=new Uint8Array(this.blockLength);for(let u=0;u<this.blockLength;u++)a[u]=this.valueHexView[u];return this.valueHexView=a,(i[this.blockLength-1]&128)!==0?(this.error="End of input reached before message was fully decoded",-1):(this.valueHexView[0]===0&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=io(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),t+this.blockLength)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);let s=this.valueHexView,i=new Uint8Array(this.blockLength);for(let a=0;a<this.blockLength-1;a++)i[a]=s[a]|128;return i[this.blockLength-1]=s[this.blockLength-1],i.buffer}let t=_i(this.valueDec,7);if(t.byteLength===0)return this.error="Error during encoding SID value",xa;let n=new Uint8Array(t.byteLength);if(!e){let s=new Uint8Array(t),i=t.byteLength-1;for(let a=0;a<i;a++)n[a]=s[a]|128;n[i]=s[i]}return n.buffer}toString(){let e="";return this.isHexOnly?e=ut.ToHex(this.valueHexView):e=this.valueDec.toString(),e}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}};CB.NAME="relativeSidBlock";var xq=class extends As{static{o(this,"LocalRelativeObjectIdentifierValueBlock")}constructor({value:e=Ss,...t}={}){super(t),this.value=[],e&&this.fromString(e)}fromBER(e,t,n){let s=t;for(;n>0;){let i=new CB;if(s=i.fromBER(e,s,n),s===-1)return this.blockLength=0,this.error=i.error,s;this.blockLength+=i.blockLength,n-=i.blockLength,this.value.push(i)}return s}toBER(e,t){let n=[];for(let s=0;s<this.value.length;s++){let i=this.value[s].toBER(e);if(i.byteLength===0)return this.error=this.value[s].error,xa;n.push(i)}return NB(n)}fromString(e){this.value=[];let t=0,n=0,s="";do{n=e.indexOf(".",t),n===-1?s=e.substring(t):s=e.substring(t,n),t=n+1;let i=new CB;if(i.valueDec=parseInt(s,10),isNaN(i.valueDec))return!0;this.value.push(i)}while(n!==-1);return!0}toString(){let e="",t=!1;for(let n=0;n<this.value.length;n++){t=this.value[n].isHexOnly;let s=this.value[n].toString();n!==0&&(e=`${e}.`),t&&(s=`{${s}}`),e+=s}return e}toJSON(){let e={...super.toJSON(),value:this.toString(),sidArray:[]};for(let t=0;t<this.value.length;t++)e.sidArray.push(this.value[t].toJSON());return e}};xq.NAME="RelativeObjectIdentifierValueBlock";var Eq,wq=class extends ts{static{o(this,"RelativeObjectIdentifier")}getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}constructor(e={}){super(e,xq),this.idBlock.tagClass=1,this.idBlock.tagNumber=13}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}};Eq=wq;ze.RelativeObjectIdentifier=Eq;wq.NAME="RelativeObjectIdentifier";var bq,K=class extends ae{static{o(this,"Sequence")}constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=16}};bq=K;ze.Sequence=bq;K.NAME="SEQUENCE";var Sq,kr=class extends ae{static{o(this,"Set")}constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=17}};Sq=kr;ze.Set=Sq;kr.NAME="SET";var Aq=class extends oo(As){static{o(this,"LocalStringValueBlock")}constructor({...e}={}){super(e),this.isHexOnly=!0,this.value=Ss}toJSON(){return{...super.toJSON(),value:this.value}}};Aq.NAME="StringValueBlock";var Cq=class extends Aq{static{o(this,"LocalSimpleStringValueBlock")}};Cq.NAME="SimpleStringValueBlock";var Ms=class extends rq{static{o(this,"LocalSimpleStringBlock")}constructor({...e}={}){super(e,Cq)}fromBuffer(e){this.valueBlock.value=String.fromCharCode.apply(null,Ze.toUint8Array(e))}fromString(e){let t=e.length,n=this.valueBlock.valueHexView=new Uint8Array(t);for(let s=0;s<t;s++)n[s]=e.charCodeAt(s);this.valueBlock.value=e}};Ms.NAME="SIMPLE STRING";var Nq=class extends Ms{static{o(this,"LocalUtf8StringValueBlock")}fromBuffer(e){this.valueBlock.valueHexView=Ze.toUint8Array(e);try{this.valueBlock.value=ut.ToUtf8String(e)}catch(t){this.warnings.push(`Error during "decodeURIComponent": ${t}, using raw string`),this.valueBlock.value=ut.ToBinary(e)}}fromString(e){this.valueBlock.valueHexView=new Uint8Array(ut.FromUtf8String(e)),this.valueBlock.value=e}};Nq.NAME="Utf8StringValueBlock";var Tq,ui=class extends Nq{static{o(this,"Utf8String")}constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=12}};Tq=ui;ze.Utf8String=Tq;ui.NAME="UTF8String";var Iq=class extends Ms{static{o(this,"LocalBmpStringValueBlock")}fromBuffer(e){this.valueBlock.value=ut.ToUtf16String(e),this.valueBlock.valueHexView=Ze.toUint8Array(e)}fromString(e){this.valueBlock.value=e,this.valueBlock.valueHexView=new Uint8Array(ut.FromUtf16String(e))}};Iq.NAME="BmpStringValueBlock";var Dq,Dp=class extends Iq{static{o(this,"BmpString")}constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=30}};Dq=Dp;ze.BmpString=Dq;Dp.NAME="BMPString";var Bq=class extends Ms{static{o(this,"LocalUniversalStringValueBlock")}fromBuffer(e){let t=ArrayBuffer.isView(e)?e.slice().buffer:e.slice(0),n=new Uint8Array(t);for(let s=0;s<n.length;s+=4)n[s]=n[s+3],n[s+1]=n[s+2],n[s+2]=0,n[s+3]=0;this.valueBlock.value=String.fromCharCode.apply(null,new Uint32Array(t))}fromString(e){let t=e.length,n=this.valueBlock.valueHexView=new Uint8Array(t*4);for(let s=0;s<t;s++){let i=_i(e.charCodeAt(s),8),a=new Uint8Array(i);if(a.length>4)continue;let u=4-a.length;for(let c=a.length-1;c>=0;c--)n[s*4+c+u]=a[c]}this.valueBlock.value=e}};Bq.NAME="UniversalStringValueBlock";var Rq,Bp=class extends Bq{static{o(this,"UniversalString")}constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=28}};Rq=Bp;ze.UniversalString=Rq;Bp.NAME="UniversalString";var _q,Tl=class extends Ms{static{o(this,"NumericString")}constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=18}};_q=Tl;ze.NumericString=_q;Tl.NAME="NumericString";var Oq,ci=class extends Ms{static{o(this,"PrintableString")}constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=19}};Oq=ci;ze.PrintableString=Oq;ci.NAME="PrintableString";var Pq,Rp=class extends Ms{static{o(this,"TeletexString")}constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=20}};Pq=Rp;ze.TeletexString=Pq;Rp.NAME="TeletexString";var kq,tb=class extends Ms{static{o(this,"VideotexString")}constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=21}};kq=tb;ze.VideotexString=kq;tb.NAME="VideotexString";var Lq,ny=class extends Ms{static{o(this,"IA5String")}constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=22}};Lq=ny;ze.IA5String=Lq;ny.NAME="IA5String";var Fq,rb=class extends Ms{static{o(this,"GraphicString")}constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=25}};Fq=rb;ze.GraphicString=Fq;rb.NAME="GraphicString";var Uq,sy=class extends Ms{static{o(this,"VisibleString")}constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=26}};Uq=sy;ze.VisibleString=Uq;sy.NAME="VisibleString";var Vq,nb=class extends Ms{static{o(this,"GeneralString")}constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=27}};Vq=nb;ze.GeneralString=Vq;nb.NAME="GeneralString";var Mq,sb=class extends Ms{static{o(this,"CharacterString")}constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=29}};Mq=sb;ze.CharacterString=Mq;sb.NAME="CharacterString";var jq,Il=class extends sy{static{o(this,"UTCTime")}constructor({value:e,valueDate:t,...n}={}){if(super(n),this.year=0,this.month=0,this.day=0,this.hour=0,this.minute=0,this.second=0,e){this.fromString(e),this.valueBlock.valueHexView=new Uint8Array(e.length);for(let s=0;s<e.length;s++)this.valueBlock.valueHexView[s]=e.charCodeAt(s)}t&&(this.fromDate(t),this.valueBlock.valueHexView=new Uint8Array(this.toBuffer())),this.idBlock.tagClass=1,this.idBlock.tagNumber=23}fromBuffer(e){this.fromString(String.fromCharCode.apply(null,Ze.toUint8Array(e)))}toBuffer(){let e=this.toString(),t=new ArrayBuffer(e.length),n=new Uint8Array(t);for(let s=0;s<e.length;s++)n[s]=e.charCodeAt(s);return t}fromDate(e){this.year=e.getUTCFullYear(),this.month=e.getUTCMonth()+1,this.day=e.getUTCDate(),this.hour=e.getUTCHours(),this.minute=e.getUTCMinutes(),this.second=e.getUTCSeconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second))}fromString(e){let n=/(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})Z/ig.exec(e);if(n===null){this.error="Wrong input string for conversion";return}let s=parseInt(n[1],10);s>=50?this.year=1900+s:this.year=2e3+s,this.month=parseInt(n[2],10),this.day=parseInt(n[3],10),this.hour=parseInt(n[4],10),this.minute=parseInt(n[5],10),this.second=parseInt(n[6],10)}toString(e="iso"){if(e==="iso"){let t=new Array(7);return t[0]=bs(this.year<2e3?this.year-1900:this.year-2e3,2),t[1]=bs(this.month,2),t[2]=bs(this.day,2),t[3]=bs(this.hour,2),t[4]=bs(this.minute,2),t[5]=bs(this.second,2),t[6]="Z",t.join("")}return super.toString(e)}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}}};jq=Il;ze.UTCTime=jq;Il.NAME="UTCTime";var qq,br=class extends Il{static{o(this,"GeneralizedTime")}constructor(e={}){var t;super(e),(t=this.millisecond)!==null&&t!==void 0||(this.millisecond=0),this.idBlock.tagClass=1,this.idBlock.tagNumber=24}fromDate(e){super.fromDate(e),this.millisecond=e.getUTCMilliseconds()}toDate(){let e=Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second,this.millisecond);return new Date(e)}fromString(e){let t=!1,n="",s="",i=0,a,u=0,c=0;if(e[e.length-1]==="Z")n=e.substring(0,e.length-1),t=!0;else{let h=new Number(e[e.length-1]);if(isNaN(h.valueOf()))throw new Error("Wrong input string for conversion");n=e}if(t){if(n.indexOf("+")!==-1)throw new Error("Wrong input string for conversion");if(n.indexOf("-")!==-1)throw new Error("Wrong input string for conversion")}else{let h=1,d=n.indexOf("+"),g="";if(d===-1&&(d=n.indexOf("-"),h=-1),d!==-1){if(g=n.substring(d+1),n=n.substring(0,d),g.length!==2&&g.length!==4)throw new Error("Wrong input string for conversion");let m=parseInt(g.substring(0,2),10);if(isNaN(m.valueOf()))throw new Error("Wrong input string for conversion");if(u=h*m,g.length===4){if(m=parseInt(g.substring(2,4),10),isNaN(m.valueOf()))throw new Error("Wrong input string for conversion");c=h*m}}}let l=n.indexOf(".");if(l===-1&&(l=n.indexOf(",")),l!==-1){let h=new Number(`0${n.substring(l)}`);if(isNaN(h.valueOf()))throw new Error("Wrong input string for conversion");i=h.valueOf(),s=n.substring(0,l)}else s=n;switch(!0){case s.length===8:if(a=/(\d{4})(\d{2})(\d{2})/ig,l!==-1)throw new Error("Wrong input string for conversion");break;case s.length===10:if(a=/(\d{4})(\d{2})(\d{2})(\d{2})/ig,l!==-1){let h=60*i;this.minute=Math.floor(h),h=60*(h-this.minute),this.second=Math.floor(h),h=1e3*(h-this.second),this.millisecond=Math.floor(h)}break;case s.length===12:if(a=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/ig,l!==-1){let h=60*i;this.second=Math.floor(h),h=1e3*(h-this.second),this.millisecond=Math.floor(h)}break;case s.length===14:if(a=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/ig,l!==-1){let h=1e3*i;this.millisecond=Math.floor(h)}break;default:throw new Error("Wrong input string for conversion")}let f=a.exec(s);if(f===null)throw new Error("Wrong input string for conversion");for(let h=1;h<f.length;h++)switch(h){case 1:this.year=parseInt(f[h],10);break;case 2:this.month=parseInt(f[h],10);break;case 3:this.day=parseInt(f[h],10);break;case 4:this.hour=parseInt(f[h],10)+u;break;case 5:this.minute=parseInt(f[h],10)+c;break;case 6:this.second=parseInt(f[h],10);break;default:throw new Error("Wrong input string for conversion")}if(t===!1){let h=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond);this.year=h.getUTCFullYear(),this.month=h.getUTCMonth(),this.day=h.getUTCDay(),this.hour=h.getUTCHours(),this.minute=h.getUTCMinutes(),this.second=h.getUTCSeconds(),this.millisecond=h.getUTCMilliseconds()}}toString(e="iso"){if(e==="iso"){let t=[];return t.push(bs(this.year,4)),t.push(bs(this.month,2)),t.push(bs(this.day,2)),t.push(bs(this.hour,2)),t.push(bs(this.minute,2)),t.push(bs(this.second,2)),this.millisecond!==0&&(t.push("."),t.push(bs(this.millisecond,3))),t.push("Z"),t.join("")}return super.toString(e)}toJSON(){return{...super.toJSON(),millisecond:this.millisecond}}};qq=br;ze.GeneralizedTime=qq;br.NAME="GeneralizedTime";var Hq,Kq=class extends ui{static{o(this,"DATE")}constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=31}};Hq=Kq;ze.DATE=Hq;Kq.NAME="DATE";var $q,Xq=class extends ui{static{o(this,"TimeOfDay")}constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=32}};$q=Xq;ze.TimeOfDay=$q;Xq.NAME="TimeOfDay";var Gq,zq=class extends ui{static{o(this,"DateTime")}constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=33}};Gq=zq;ze.DateTime=Gq;zq.NAME="DateTime";var Wq,Jq=class extends ui{static{o(this,"Duration")}constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=34}};Wq=Jq;ze.Duration=Wq;Jq.NAME="Duration";var Yq,Qq=class extends ui{static{o(this,"TIME")}constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=14}};Yq=Qq;ze.TIME=Yq;Qq.NAME="TIME";var it=class{static{o(this,"Any")}constructor({name:e=Ss,optional:t=!1}={}){this.name=e,this.optional=t}},Sr=class extends it{static{o(this,"Choice")}constructor({value:e=[],...t}={}){super(t),this.value=e}},lt=class extends it{static{o(this,"Repeated")}constructor({value:e=new it,local:t=!1,...n}={}){super(n),this.value=e,this.local=t}},iy=class{static{o(this,"RawData")}get data(){return this.dataView.slice().buffer}set data(e){this.dataView=Ze.toUint8Array(e)}constructor({data:e=eb}={}){this.dataView=Ze.toUint8Array(e)}fromBER(e,t,n){let s=t+n;return this.dataView=Ze.toUint8Array(e).subarray(t,s),s}toBER(e){return this.dataView.slice().buffer}};function be(r,e,t){if(t instanceof Sr){for(let i of t.value)if(be(r,e,i).verified)return{verified:!0,result:r};{let i={verified:!1,result:{error:"Wrong values for Choice type"}};return t.hasOwnProperty(SB)&&(i.name=t.name),i}}if(t instanceof it)return t.hasOwnProperty(SB)&&(r[t.name]=e),{verified:!0,result:r};if(!(r instanceof Object))return{verified:!1,result:{error:"Wrong root object"}};if(!(e instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 data"}};if(!(t instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(Vue in t))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(Hue in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(Kue in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};let n=t.idBlock.toBER(!1);if(n.byteLength===0)return{verified:!1,result:{error:"Error encoding idBlock for ASN.1 schema"}};if(t.idBlock.fromBER(n,0,n.byteLength)===-1)return{verified:!1,result:{error:"Error decoding idBlock for ASN.1 schema"}};if(t.idBlock.hasOwnProperty(Mue)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.tagClass!==e.idBlock.tagClass)return{verified:!1,result:r};if(t.idBlock.hasOwnProperty(jue)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.tagNumber!==e.idBlock.tagNumber)return{verified:!1,result:r};if(t.idBlock.hasOwnProperty(que)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.isConstructed!==e.idBlock.isConstructed)return{verified:!1,result:r};if(!(Uue in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.isHexOnly!==e.idBlock.isHexOnly)return{verified:!1,result:r};if(t.idBlock.isHexOnly){if(!(W9 in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};let i=t.idBlock.valueHexView,a=e.idBlock.valueHexView;if(i.length!==a.length)return{verified:!1,result:r};for(let u=0;u<i.length;u++)if(i[u]!==a[1])return{verified:!1,result:r}}if(t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Ss),t.name&&(r[t.name]=e)),t instanceof ze.Constructed){let i=0,a={verified:!1,result:{error:"Unknown error"}},u=t.valueBlock.value.length;if(u>0&&t.valueBlock.value[0]instanceof lt&&(u=e.valueBlock.value.length),u===0)return{verified:!0,result:r};if(e.valueBlock.value.length===0&&t.valueBlock.value.length!==0){let c=!0;for(let l=0;l<t.valueBlock.value.length;l++)c=c&&(t.valueBlock.value[l].optional||!1);return c?{verified:!0,result:r}:(t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Ss),t.name&&delete r[t.name]),r.error="Inconsistent object length",{verified:!1,result:r})}for(let c=0;c<u;c++)if(c-i>=e.valueBlock.value.length){if(t.valueBlock.value[c].optional===!1){let l={verified:!1,result:r};return r.error="Inconsistent length between ASN.1 data and schema",t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Ss),t.name&&(delete r[t.name],l.name=t.name)),l}}else if(t.valueBlock.value[0]instanceof lt){if(a=be(r,e.valueBlock.value[c],t.valueBlock.value[0].value),a.verified===!1)if(t.valueBlock.value[0].optional)i++;else return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Ss),t.name&&delete r[t.name]),a;if(SB in t.valueBlock.value[0]&&t.valueBlock.value[0].name.length>0){let l={};$ue in t.valueBlock.value[0]&&t.valueBlock.value[0].local?l=e:l=r,typeof l[t.valueBlock.value[0].name]>"u"&&(l[t.valueBlock.value[0].name]=[]),l[t.valueBlock.value[0].name].push(e.valueBlock.value[c])}}else if(a=be(r,e.valueBlock.value[c-i],t.valueBlock.value[c]),a.verified===!1)if(t.valueBlock.value[c].optional)i++;else return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Ss),t.name&&delete r[t.name]),a;if(a.verified===!1){let c={verified:!1,result:r};return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Ss),t.name&&(delete r[t.name],c.name=t.name)),c}return{verified:!0,result:r}}if(t.primitiveSchema&&W9 in e.valueBlock){let i=ry(e.valueBlock.valueHexView);if(i.offset===-1){let a={verified:!1,result:i.result};return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Ss),t.name&&(delete r[t.name],a.name=t.name)),a}return be(r,i.result,t.primitiveSchema)}return{verified:!0,result:r}}o(be,"compareSchema");var On=class r{static{o(this,"ByteStream")}constructor(e={}){if("view"in e)this.fromUint8Array(e.view);else if("buffer"in e)this.fromArrayBuffer(e.buffer);else if("string"in e)this.fromString(e.string);else if("hexstring"in e)this.fromHexString(e.hexstring);else if("length"in e&&e.length>0){if(this.length=e.length,e.stub)for(let t=0;t<this._view.length;t++)this._view[t]=e.stub}else this.length=0}set buffer(e){this._buffer=e,this._view=new Uint8Array(this._buffer)}get buffer(){return this._buffer}set view(e){this._buffer=new ArrayBuffer(e.length),this._view=new Uint8Array(this._buffer),this._view.set(e)}get view(){return this._view}get length(){return this.view.byteLength}set length(e){this._buffer=new ArrayBuffer(e),this._view=new Uint8Array(this._buffer)}clear(){this._buffer=new ArrayBuffer(0),this._view=new Uint8Array(this._buffer)}fromArrayBuffer(e){this._buffer=e,this._view=new Uint8Array(this._buffer)}fromUint8Array(e){this.fromArrayBuffer(new Uint8Array(e).buffer)}fromString(e){let t=e.length;this.length=t;for(let n=0;n<t;n++)this.view[n]=e.charCodeAt(n)}toString(e=0,t=this.view.length-e){let n="";(e>=this.view.length||e<0)&&(e=0),(t>=this.view.length||t<0)&&(t=this.view.length-e);for(let s=e;s<e+t;s++)n+=String.fromCharCode(this.view[s]);return n}fromHexString(e){let t=e.length;this.buffer=new ArrayBuffer(t>>1),this.view=new Uint8Array(this.buffer);let n=new Map;n.set("0",0),n.set("1",1),n.set("2",2),n.set("3",3),n.set("4",4),n.set("5",5),n.set("6",6),n.set("7",7),n.set("8",8),n.set("9",9),n.set("A",10),n.set("a",10),n.set("B",11),n.set("b",11),n.set("C",12),n.set("c",12),n.set("D",13),n.set("d",13),n.set("E",14),n.set("e",14),n.set("F",15),n.set("f",15);let s=0,i=0;for(let a=0;a<t;a++)a%2?(i|=n.get(e.charAt(a)),this.view[s]=i,s++):i=n.get(e.charAt(a))<<4}toHexString(e=0,t=this.view.length-e){let n="";(e>=this.view.length||e<0)&&(e=0),(t>=this.view.length||t<0)&&(t=this.view.length-e);for(let s=e;s<e+t;s++){let i=this.view[s].toString(16).toUpperCase();n=n+(i.length==1?"0":"")+i}return n}copy(e=0,t=this.length-e){if(!e&&!this.length)return new r;if(e<0||e>this.length-1)throw new Error(`Wrong start position: ${e}`);return new r({buffer:this._buffer.slice(e,e+t)})}slice(e=0,t=this.length){if(!e&&!this.length)return new r;if(e<0||e>this.length-1)throw new Error(`Wrong start position: ${e}`);return new r({buffer:this._buffer.slice(e,t)})}realloc(e){let t=new ArrayBuffer(e),n=new Uint8Array(t);e>this._view.length?n.set(this._view):n.set(new Uint8Array(this._buffer,0,e)),this._buffer=t,this._view=new Uint8Array(this._buffer)}append(e){let t=this.length,n=e.length,s=e._view.subarray();this.realloc(t+n),this._view.set(s,t)}insert(e,t=0,n=this.length-t){return t>this.length-1?!1:(n>this.length-t&&(n=this.length-t),n>e.length&&(n=e.length),n==e.length?this._view.set(e._view,t):this._view.set(e._view.subarray(0,n),t),!0)}isEqual(e){if(this.length!=e.length)return!1;for(let t=0;t<e.length;t++)if(this.view[t]!=e.view[t])return!1;return!0}isEqualView(e){if(e.length!=this.view.length)return!1;for(let t=0;t<e.length;t++)if(this.view[t]!=e[t])return!1;return!0}findPattern(e,t,n,s){let{start:i,length:a,backward:u}=this.prepareFindParameters(t,n,s),c=e.length;if(c>a)return-1;let l=[];for(let f=0;f<c;f++)l.push(e.view[f]);for(let f=0;f<=a-c;f++){let h=!0,d=u?i-c-f:i+f;for(let g=0;g<c;g++)if(this.view[g+d]!=l[g]){h=!1;break}if(h)return u?i-c-f:i+c+f}return-1}findFirstIn(e,t,n,s){let{start:i,length:a,backward:u}=this.prepareFindParameters(t,n,s),c={id:-1,position:u?0:i+a,length:0};for(let l=0;l<e.length;l++){let f=this.findPattern(e[l],i,a,u);if(f!=-1){let h=!1,d=e[l].length;u?f-d>=c.position-c.length&&(h=!0):f-d<=c.position-c.length&&(h=!0),h&&(c.position=f,c.id=l,c.length=d)}}return c}findAllIn(e,t,n){let{start:s,length:i}=this.prepareFindParameters(t,n),a=[],u={id:-1,position:s};do{let c=u.position;if(u=this.findFirstIn(e,u.position,i),u.id==-1)break;i-=u.position-c,a.push({id:u.id,position:u.position})}while(!0);return a}findAllPatternIn(e,t,n){let{start:s,length:i}=this.prepareFindParameters(t,n),a=[],u=e.length;if(u>i)return-1;let c=Array.from(e.view);for(let l=0;l<=i-u;l++){let f=!0,h=s+l;for(let d=0;d<u;d++)if(this.view[d+h]!=c[d]){f=!1;break}f&&(a.push(s+u+l),l+=u-1)}return a}findFirstNotIn(e,t,n,s){let{start:i,length:a,backward:u}=this.prepareFindParameters(t,n,s),c={left:{id:-1,position:i},right:{id:-1,position:0},value:new r},l=a;for(;l>0;){if(c.right=this.findFirstIn(e,u?i-a+l:i+a-l,l,u),c.right.id==-1){a=l,u?i-=a:i=c.left.position,c.value=new r({buffer:this._buffer.slice(i,i+a)});break}if(c.right.position!=(u?c.left.position-e[c.right.id].length:c.left.position+e[c.right.id].length)){u?(i=c.right.position+e[c.right.id].length,a=c.left.position-c.right.position-e[c.right.id].length):(i=c.left.position,a=c.right.position-c.left.position-e[c.right.id].length),c.value=new r({buffer:this._buffer.slice(i,i+a)});break}c.left=c.right,l-=e[c.right.id].length}if(u){let f=c.right;c.right=c.left,c.left=f}return c}findAllNotIn(e,t,n){let{start:s,length:i}=this.prepareFindParameters(t,n),a=[],u={left:{id:-1,position:s},right:{id:-1,position:s},value:new r};do{let c=u.right.position;u=this.findFirstNotIn(e,u.right.position,i),i-=u.right.position-c,a.push({left:{id:u.left.id,position:u.left.position},right:{id:u.right.id,position:u.right.position},value:u.value})}while(u.right.id!=-1);return a}findFirstSequence(e,t,n,s){let{start:i,length:a,backward:u}=this.prepareFindParameters(t,n,s),c=this.skipNotPatterns(e,i,a,u);if(c==-1)return{position:-1,value:new r};let l=this.skipPatterns(e,c,a-(u?i-c:c-i),u);u?(i=l,a=c-l):(i=c,a=l-c);let f=new r({buffer:this._buffer.slice(i,i+a)});return{position:l,value:f}}findAllSequences(e,t,n){let{start:s,length:i}=this.prepareFindParameters(t,n),a=[],u={position:s,value:new r};do{let c=u.position;u=this.findFirstSequence(e,u.position,i),u.position!=-1&&(i-=u.position-c,a.push({position:u.position,value:u.value}))}while(u.position!=-1);return a}findPairedPatterns(e,t,n,s){let i=[];if(e.isEqual(t))return i;let{start:a,length:u}=this.prepareFindParameters(n,s),c=0,l=this.findAllPatternIn(e,a,u);if(!Array.isArray(l)||l.length==0)return i;let f=this.findAllPatternIn(t,a,u);if(!Array.isArray(f)||f.length==0)return i;for(;c<l.length&&f.length!=0;){if(l[0]==f[0]){i.push({left:l[0],right:f[0]}),l.splice(0,1),f.splice(0,1);continue}if(l[c]>f[0])break;for(;l[c]<f[0]&&(c++,!(c>=l.length)););i.push({left:l[c-1],right:f[0]}),l.splice(c-1,1),f.splice(0,1),c=0}return i.sort((h,d)=>h.left-d.left),i}findPairedArrays(e,t,n,s){let{start:i,length:a}=this.prepareFindParameters(n,s),u=[],c=0,l=this.findAllIn(e,i,a);if(l.length==0)return u;let f=this.findAllIn(t,i,a);if(f.length==0)return u;for(;c<l.length&&f.length!=0;){if(l[0].position==f[0].position){u.push({left:l[0],right:f[0]}),l.splice(0,1),f.splice(0,1);continue}if(l[c].position>f[0].position)break;for(;l[c].position<f[0].position&&(c++,!(c>=l.length)););u.push({left:l[c-1],right:f[0]}),l.splice(c-1,1),f.splice(0,1),c=0}return u.sort((h,d)=>h.left.position-d.left.position),u}replacePattern(e,t,n,s,i=null){let a=[],u,c={status:-1,searchPatternPositions:[],replacePatternPositions:[]},{start:l,length:f}=this.prepareFindParameters(n,s);if(i==null){if(a=this.findAllIn([e],l,f),a.length==0)return c}else a=i;c.searchPatternPositions.push(...Array.from(a,m=>m.position));let h=e.length-t.length,d=new ArrayBuffer(this.view.length-a.length*h),g=new Uint8Array(d);for(g.set(new Uint8Array(this.buffer,0,l)),u=0;u<a.length;u++){let m=u==0?l:a[u-1].position;g.set(new Uint8Array(this.buffer,m,a[u].position-e.length-m),m-u*h),g.set(t.view,a[u].position-e.length-u*h),c.replacePatternPositions.push(a[u].position-e.length-u*h)}return u--,g.set(new Uint8Array(this.buffer,a[u].position,this.length-a[u].position),a[u].position-e.length+t.length-u*h),this.buffer=d,this.view=new Uint8Array(this.buffer),c.status=1,c}skipPatterns(e,t,n,s){let{start:i,length:a,backward:u}=this.prepareFindParameters(t,n,s),c=i;for(let l=0;l<e.length;l++){let f=e[l].length,h=u?c-f:c,d=!0;for(let g=0;g<f;g++)if(this.view[g+h]!=e[l].view[g]){d=!1;break}if(d){if(l=-1,u){if(c-=f,c<=0)return c}else if(c+=f,c>=i+a)return c}}return c}skipNotPatterns(e,t,n,s){let{start:i,length:a,backward:u}=this.prepareFindParameters(t,n,s),c=-1;for(let l=0;l<a;l++){for(let f=0;f<e.length;f++){let h=e[f].length,d=u?i-l-h:i+l,g=!0;for(let m=0;m<h;m++)if(this.view[m+d]!=e[f].view[m]){g=!1;break}if(g){c=u?i-l:i+l;break}}if(c!=-1)break}return c}prepareFindParameters(e=null,t=null,n=!1){return e===null&&(e=n?this.length:0),e>this.length&&(e=this.length),n?(t===null&&(t=e),t>e&&(t=e)):(t===null&&(t=this.length-e),t>this.length-e&&(t=this.length-e)),{start:e,length:t,backward:n}}};var Jue=16777216,uo=class r{static{o(this,"SeqStream")}constructor(e={}){this._stream=new On,this._length=0,this._start=0,this.backward=!1,this.appendBlock=0,this.prevLength=0,this.prevStart=0,"view"in e?this.stream=new On({view:e.view}):"buffer"in e?this.stream=new On({buffer:e.buffer}):"string"in e?this.stream=new On({string:e.string}):"hexstring"in e?this.stream=new On({hexstring:e.hexstring}):"stream"in e?this.stream=e.stream.slice():this.stream=new On,"backward"in e&&e.backward&&(this.backward=e.backward,this._start=this.stream.length),"length"in e&&e.length>0&&(this._length=e.length),"start"in e&&e.start&&e.start>0&&(this._start=e.start),"appendBlock"in e&&e.appendBlock&&e.appendBlock>0&&(this.appendBlock=e.appendBlock)}set stream(e){this._stream=e,this.prevLength=this._length,this._length=e.length,this.prevStart=this._start,this._start=0}get stream(){return this._stream}set length(e){this.prevLength=this._length,this._length=e}get length(){return this.appendBlock?this.start:this._length}set start(e){e>this.stream.length||(this.prevStart=this._start,this.prevLength=this._length,this._length-=this.backward?this._start-e:e-this._start,this._start=e)}get start(){return this._start}get buffer(){return this._stream.buffer.slice(0,this._length)}resetPosition(){this._start=this.prevStart,this._length=this.prevLength}findPattern(e,t=null){(t==null||t>this.length)&&(t=this.length);let n=this.stream.findPattern(e,this.start,this.length,this.backward);if(n==-1)return n;if(this.backward){if(n<this.start-e.length-t)return-1}else if(n>this.start+e.length+t)return-1;return this.start=n,n}findFirstIn(e,t=null){(t==null||t>this.length)&&(t=this.length);let n=this.stream.findFirstIn(e,this.start,this.length,this.backward);if(n.id==-1)return n;if(this.backward){if(n.position<this.start-e[n.id].length-t)return{id:-1,position:this.backward?0:this.start+this.length}}else if(n.position>this.start+e[n.id].length+t)return{id:-1,position:this.backward?0:this.start+this.length};return this.start=n.position,n}findAllIn(e){let t=this.backward?this.start-this.length:this.start;return this.stream.findAllIn(e,t,this.length)}findFirstNotIn(e,t=null){(t==null||t>this._length)&&(t=this._length);let n=this._stream.findFirstNotIn(e,this._start,this._length,this.backward);if(n.left.id==-1&&n.right.id==-1)return n;if(this.backward){if(n.right.id!=-1&&n.right.position<this._start-e[n.right.id].length-t)return{left:{id:-1,position:this._start},right:{id:-1,position:0},value:new On}}else if(n.left.id!=-1&&n.left.position>this._start+e[n.left.id].length+t)return{left:{id:-1,position:this._start},right:{id:-1,position:0},value:new On};return this.backward?n.left.id==-1?this.start=0:this.start=n.left.position:n.right.id==-1?this.start=this._start+this._length:this.start=n.right.position,n}findAllNotIn(e){let t=this.backward?this._start-this._length:this._start;return this._stream.findAllNotIn(e,t,this._length)}findFirstSequence(e,t=null,n=null){(t==null||t>this._length)&&(t=this._length),(n==null||n>t)&&(n=t);let s=this._stream.findFirstSequence(e,this._start,t,this.backward);if(s.value.length==0)return s;if(this.backward){if(s.position<this._start-s.value.length-n)return{position:-1,value:new On}}else if(s.position>this._start+s.value.length+n)return{position:-1,value:new On};return this.start=s.position,s}findAllSequences(e){let t=this.backward?this.start-this.length:this.start;return this.stream.findAllSequences(e,t,this.length)}findPairedPatterns(e,t,n=null){(n==null||n>this.length)&&(n=this.length);let s=this.backward?this.start-this.length:this.start,i=this.stream.findPairedPatterns(e,t,s,this.length);if(i.length){if(this.backward){if(i[0].right<this.start-t.length-n)return[]}else if(i[0].left>this.start+e.length+n)return[]}return i}findPairedArrays(e,t,n=null){(n==null||n>this.length)&&(n=this.length);let s=this.backward?this.start-this.length:this.start,i=this.stream.findPairedArrays(e,t,s,this.length);if(i.length){if(this.backward){if(i[0].right.position<this.start-t[i[0].right.id].length-n)return[]}else if(i[0].left.position>this.start+e[i[0].left.id].length+n)return[]}return i}replacePattern(e,t){let n=this.backward?this.start-this.length:this.start;return this.stream.replacePattern(e,t,n,this.length)}skipPatterns(e){let t=this.stream.skipPatterns(e,this.start,this.length,this.backward);return this.start=t,t}skipNotPatterns(e){let t=this.stream.skipNotPatterns(e,this.start,this.length,this.backward);return t==-1?-1:(this.start=t,t)}append(e){this.beforeAppend(e.length),this._stream.view.set(e.view,this._start),this._length+=e.length*2,this.start=this._start+e.length,this.prevLength-=e.length*2}appendView(e){this.beforeAppend(e.length),this._stream.view.set(e,this._start),this._length+=e.length*2,this.start=this._start+e.length,this.prevLength-=e.length*2}appendChar(e){this.beforeAppend(1),this._stream.view[this._start]=e,this._length+=2,this.start=this._start+1,this.prevLength-=2}appendUint16(e){this.beforeAppend(2);let t=new Uint16Array([e]),n=new Uint8Array(t.buffer);this.stream.view[this._start]=n[1],this._stream.view[this._start+1]=n[0],this._length+=4,this.start=this._start+2,this.prevLength-=4}appendUint24(e){this.beforeAppend(3);let t=new Uint32Array([e]),n=new Uint8Array(t.buffer);this._stream.view[this._start]=n[2],this._stream.view[this._start+1]=n[1],this._stream.view[this._start+2]=n[0],this._length+=6,this.start=this._start+3,this.prevLength-=6}appendUint32(e){this.beforeAppend(4);let t=new Uint32Array([e]),n=new Uint8Array(t.buffer);this._stream.view[this._start]=n[3],this._stream.view[this._start+1]=n[2],this._stream.view[this._start+2]=n[1],this._stream.view[this._start+3]=n[0],this._length+=8,this.start=this._start+4,this.prevLength-=8}appendInt16(e){this.beforeAppend(2);let t=new Int16Array([e]),n=new Uint8Array(t.buffer);this._stream.view[this._start]=n[1],this._stream.view[this._start+1]=n[0],this._length+=4,this.start=this._start+2,this.prevLength-=4}appendInt32(e){this.beforeAppend(4);let t=new Int32Array([e]),n=new Uint8Array(t.buffer);this._stream.view[this._start]=n[3],this._stream.view[this._start+1]=n[2],this._stream.view[this._start+2]=n[1],this._stream.view[this._start+3]=n[0],this._length+=8,this.start=this._start+4,this.prevLength-=8}getBlock(e,t=!0){if(this._length<=0)return new Uint8Array(0);this._length<e&&(e=this._length);let n;if(this.backward){let s=this._stream.view.subarray(this._length-e,this._length);n=new Uint8Array(e);for(let i=0;i<e;i++)n[e-1-i]=s[i]}else n=this._stream.view.subarray(this._start,this._start+e);return t&&(this.start+=this.backward?-1*e:e),n}getUint16(e=!0){let t=this.getBlock(2,e);return t.length<2?0:t[0]<<8|t[1]}getInt16(e=!0){let t=this.getUint16(e),n=32768;return t&n?-(n-(t^n)):t}getUint24(e=!0){let t=this.getBlock(4,e);return t.length<3?0:t[0]<<16|t[1]<<8|t[2]}getUint32(e=!0){let t=this.getBlock(4,e);return t.length<4?0:t[0]*Jue+(t[1]<<16)+(t[2]<<8)+t[3]}getInt32(e=!0){let t=this.getUint32(e),n=2147483648;return t&n?-(n-(t^n)):t}beforeAppend(e){this._start+e>this._stream.length&&(e>this.appendBlock&&(this.appendBlock=e+r.APPEND_BLOCK),this._stream.realloc(this._stream.length+this.appendBlock))}};uo.APPEND_BLOCK=1e3;function Que(r){return r instanceof Uint8Array||r!=null&&typeof r=="object"&&r.constructor.name==="Uint8Array"}o(Que,"isBytes");function BB(r,...e){if(!Que(r))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(r.length))throw new Error(`Uint8Array expected of length ${e}, not of length=${r.length}`)}o(BB,"bytes");function RB(r,e=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(e&&r.finished)throw new Error("Hash#digest() has already been called")}o(RB,"exists");function e7(r,e){BB(r);let t=e.outputLen;if(r.length<t)throw new Error(`digestInto() expects output buffer of length at least ${t}`)}o(e7,"output");var ab=o(r=>new DataView(r.buffer,r.byteOffset,r.byteLength),"createView"),Pi=o((r,e)=>r<<32-e|r>>>e,"rotr"),ob=o((r,e)=>r<<e|r>>>32-e>>>0,"rotl"),qDe=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Zue(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}o(Zue,"utf8ToBytes");function _B(r){return typeof r=="string"&&(r=Zue(r)),BB(r),r}o(_B,"toBytes");var ib=class{static{o(this,"Hash")}clone(){return this._cloneInto()}},HDe={}.toString;function Dl(r){let e=o(n=>r().update(_B(n)).digest(),"hashC"),t=r();return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=()=>r(),e}o(Dl,"wrapConstructor");function ece(r,e,t,n){if(typeof r.setBigUint64=="function")return r.setBigUint64(e,t,n);let s=BigInt(32),i=BigInt(4294967295),a=Number(t>>s&i),u=Number(t&i),c=n?4:0,l=n?0:4;r.setUint32(e+c,a,n),r.setUint32(e+l,u,n)}o(ece,"setBigUint64");var ub=o((r,e,t)=>r&e^~r&t,"Chi"),cb=o((r,e,t)=>r&e^r&t^e&t,"Maj"),Ou=class extends ib{static{o(this,"HashMD")}constructor(e,t,n,s){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=s,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=ab(this.buffer)}update(e){RB(this);let{view:t,buffer:n,blockLen:s}=this;e=_B(e);let i=e.length;for(let a=0;a<i;){let u=Math.min(s-this.pos,i-a);if(u===s){let c=ab(e);for(;s<=i-a;a+=s)this.process(c,a);continue}n.set(e.subarray(a,a+u),this.pos),this.pos+=u,a+=u,this.pos===s&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){RB(this),e7(e,this),this.finished=!0;let{buffer:t,view:n,blockLen:s,isLE:i}=this,{pos:a}=this;t[a++]=128,this.buffer.subarray(a).fill(0),this.padOffset>s-a&&(this.process(n,0),a=0);for(let h=a;h<s;h++)t[h]=0;ece(n,s-8,BigInt(this.length*8),i),this.process(n,0);let u=ab(e),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let l=c/4,f=this.get();if(l>f.length)throw new Error("_sha2: outputLen bigger than state");for(let h=0;h<l;h++)u.setUint32(4*h,f[h],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:t,buffer:n,length:s,finished:i,destroyed:a,pos:u}=this;return e.length=s,e.pos=u,e.finished=i,e.destroyed=a,s%t&&e.buffer.set(n),e}};var ay=new Uint32Array([1732584193,4023233417,2562383102,271733878,3285377520]),Pu=new Uint32Array(80),tce=class extends Ou{static{o(this,"SHA1")}constructor(){super(64,20,8,!1),this.A=ay[0]|0,this.B=ay[1]|0,this.C=ay[2]|0,this.D=ay[3]|0,this.E=ay[4]|0}get(){let{A:e,B:t,C:n,D:s,E:i}=this;return[e,t,n,s,i]}set(e,t,n,s,i){this.A=e|0,this.B=t|0,this.C=n|0,this.D=s|0,this.E=i|0}process(e,t){for(let c=0;c<16;c++,t+=4)Pu[c]=e.getUint32(t,!1);for(let c=16;c<80;c++)Pu[c]=ob(Pu[c-3]^Pu[c-8]^Pu[c-14]^Pu[c-16],1);let{A:n,B:s,C:i,D:a,E:u}=this;for(let c=0;c<80;c++){let l,f;c<20?(l=ub(s,i,a),f=1518500249):c<40?(l=s^i^a,f=1859775393):c<60?(l=cb(s,i,a),f=2400959708):(l=s^i^a,f=3395469782);let h=ob(n,5)+l+u+f+Pu[c]|0;u=a,a=i,i=ob(s,30),s=n,n=h}n=n+this.A|0,s=s+this.B|0,i=i+this.C|0,a=a+this.D|0,u=u+this.E|0,this.set(n,s,i,a,u)}roundClean(){Pu.fill(0)}destroy(){this.set(0,0,0,0,0),this.buffer.fill(0)}},t7=Dl(()=>new tce);var rce=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),ku=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Lu=new Uint32Array(64),nce=class extends Ou{static{o(this,"SHA256")}constructor(){super(64,32,8,!1),this.A=ku[0]|0,this.B=ku[1]|0,this.C=ku[2]|0,this.D=ku[3]|0,this.E=ku[4]|0,this.F=ku[5]|0,this.G=ku[6]|0,this.H=ku[7]|0}get(){let{A:e,B:t,C:n,D:s,E:i,F:a,G:u,H:c}=this;return[e,t,n,s,i,a,u,c]}set(e,t,n,s,i,a,u,c){this.A=e|0,this.B=t|0,this.C=n|0,this.D=s|0,this.E=i|0,this.F=a|0,this.G=u|0,this.H=c|0}process(e,t){for(let h=0;h<16;h++,t+=4)Lu[h]=e.getUint32(t,!1);for(let h=16;h<64;h++){let d=Lu[h-15],g=Lu[h-2],m=Pi(d,7)^Pi(d,18)^d>>>3,v=Pi(g,17)^Pi(g,19)^g>>>10;Lu[h]=v+Lu[h-7]+m+Lu[h-16]|0}let{A:n,B:s,C:i,D:a,E:u,F:c,G:l,H:f}=this;for(let h=0;h<64;h++){let d=Pi(u,6)^Pi(u,11)^Pi(u,25),g=f+d+ub(u,c,l)+rce[h]+Lu[h]|0,v=(Pi(n,2)^Pi(n,13)^Pi(n,22))+cb(n,s,i)|0;f=l,l=c,c=u,u=a+g|0,a=i,i=s,s=n,n=g+v|0}n=n+this.A|0,s=s+this.B|0,i=i+this.C|0,a=a+this.D|0,u=u+this.E|0,c=c+this.F|0,l=l+this.G|0,f=f+this.H|0,this.set(n,s,i,a,u,c,l,f)}roundClean(){Lu.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var OB=Dl(()=>new nce);var lb=BigInt(4294967295),PB=BigInt(32);function r7(r,e=!1){return e?{h:Number(r&lb),l:Number(r>>PB&lb)}:{h:Number(r>>PB&lb)|0,l:Number(r&lb)|0}}o(r7,"fromBig");function sce(r,e=!1){let t=new Uint32Array(r.length),n=new Uint32Array(r.length);for(let s=0;s<r.length;s++){let{h:i,l:a}=r7(r[s],e);[t[s],n[s]]=[i,a]}return[t,n]}o(sce,"split");var ice=o((r,e)=>BigInt(r>>>0)<<PB|BigInt(e>>>0),"toBig"),ace=o((r,e,t)=>r>>>t,"shrSH"),oce=o((r,e,t)=>r<<32-t|e>>>t,"shrSL"),uce=o((r,e,t)=>r>>>t|e<<32-t,"rotrSH"),cce=o((r,e,t)=>r<<32-t|e>>>t,"rotrSL"),lce=o((r,e,t)=>r<<64-t|e>>>t-32,"rotrBH"),fce=o((r,e,t)=>r>>>t-32|e<<64-t,"rotrBL"),hce=o((r,e)=>e,"rotr32H"),pce=o((r,e)=>r,"rotr32L"),dce=o((r,e,t)=>r<<t|e>>>32-t,"rotlSH"),mce=o((r,e,t)=>e<<t|r>>>32-t,"rotlSL"),gce=o((r,e,t)=>e<<t-32|r>>>64-t,"rotlBH"),yce=o((r,e,t)=>r<<t-32|e>>>64-t,"rotlBL");function vce(r,e,t,n){let s=(e>>>0)+(n>>>0);return{h:r+t+(s/2**32|0)|0,l:s|0}}o(vce,"add");var xce=o((r,e,t)=>(r>>>0)+(e>>>0)+(t>>>0),"add3L"),Ece=o((r,e,t,n)=>e+t+n+(r/2**32|0)|0,"add3H"),wce=o((r,e,t,n)=>(r>>>0)+(e>>>0)+(t>>>0)+(n>>>0),"add4L"),bce=o((r,e,t,n,s)=>e+t+n+s+(r/2**32|0)|0,"add4H"),Sce=o((r,e,t,n,s)=>(r>>>0)+(e>>>0)+(t>>>0)+(n>>>0)+(s>>>0),"add5L"),Ace=o((r,e,t,n,s,i)=>e+t+n+s+i+(r/2**32|0)|0,"add5H");var Cce={fromBig:r7,split:sce,toBig:ice,shrSH:ace,shrSL:oce,rotrSH:uce,rotrSL:cce,rotrBH:lce,rotrBL:fce,rotr32H:hce,rotr32L:pce,rotlSH:dce,rotlSL:mce,rotlBH:gce,rotlBL:yce,add:vce,add3L:xce,add3H:Ece,add4L:wce,add4H:bce,add5H:Ace,add5L:Sce},Nt=Cce;var[Nce,Tce]=Nt.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(r=>BigInt(r))),Fu=new Uint32Array(80),Uu=new Uint32Array(80),fb=class extends Ou{static{o(this,"SHA512")}constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){let{Ah:e,Al:t,Bh:n,Bl:s,Ch:i,Cl:a,Dh:u,Dl:c,Eh:l,El:f,Fh:h,Fl:d,Gh:g,Gl:m,Hh:v,Hl:y}=this;return[e,t,n,s,i,a,u,c,l,f,h,d,g,m,v,y]}set(e,t,n,s,i,a,u,c,l,f,h,d,g,m,v,y){this.Ah=e|0,this.Al=t|0,this.Bh=n|0,this.Bl=s|0,this.Ch=i|0,this.Cl=a|0,this.Dh=u|0,this.Dl=c|0,this.Eh=l|0,this.El=f|0,this.Fh=h|0,this.Fl=d|0,this.Gh=g|0,this.Gl=m|0,this.Hh=v|0,this.Hl=y|0}process(e,t){for(let E=0;E<16;E++,t+=4)Fu[E]=e.getUint32(t),Uu[E]=e.getUint32(t+=4);for(let E=16;E<80;E++){let x=Fu[E-15]|0,b=Uu[E-15]|0,A=Nt.rotrSH(x,b,1)^Nt.rotrSH(x,b,8)^Nt.shrSH(x,b,7),k=Nt.rotrSL(x,b,1)^Nt.rotrSL(x,b,8)^Nt.shrSL(x,b,7),I=Fu[E-2]|0,T=Uu[E-2]|0,V=Nt.rotrSH(I,T,19)^Nt.rotrBH(I,T,61)^Nt.shrSH(I,T,6),U=Nt.rotrSL(I,T,19)^Nt.rotrBL(I,T,61)^Nt.shrSL(I,T,6),M=Nt.add4L(k,U,Uu[E-7],Uu[E-16]),ie=Nt.add4H(M,A,V,Fu[E-7],Fu[E-16]);Fu[E]=ie|0,Uu[E]=M|0}let{Ah:n,Al:s,Bh:i,Bl:a,Ch:u,Cl:c,Dh:l,Dl:f,Eh:h,El:d,Fh:g,Fl:m,Gh:v,Gl:y,Hh:w,Hl:S}=this;for(let E=0;E<80;E++){let x=Nt.rotrSH(h,d,14)^Nt.rotrSH(h,d,18)^Nt.rotrBH(h,d,41),b=Nt.rotrSL(h,d,14)^Nt.rotrSL(h,d,18)^Nt.rotrBL(h,d,41),A=h&g^~h&v,k=d&m^~d&y,I=Nt.add5L(S,b,k,Tce[E],Uu[E]),T=Nt.add5H(I,w,x,A,Nce[E],Fu[E]),V=I|0,U=Nt.rotrSH(n,s,28)^Nt.rotrBH(n,s,34)^Nt.rotrBH(n,s,39),M=Nt.rotrSL(n,s,28)^Nt.rotrBL(n,s,34)^Nt.rotrBL(n,s,39),ie=n&i^n&u^i&u,Z=s&a^s&c^a&c;w=v|0,S=y|0,v=g|0,y=m|0,g=h|0,m=d|0,{h,l:d}=Nt.add(l|0,f|0,T|0,V|0),l=u|0,f=c|0,u=i|0,c=a|0,i=n|0,a=s|0;let ue=Nt.add3L(V,M,Z);n=Nt.add3H(ue,T,U,ie),s=ue|0}({h:n,l:s}=Nt.add(this.Ah|0,this.Al|0,n|0,s|0)),{h:i,l:a}=Nt.add(this.Bh|0,this.Bl|0,i|0,a|0),{h:u,l:c}=Nt.add(this.Ch|0,this.Cl|0,u|0,c|0),{h:l,l:f}=Nt.add(this.Dh|0,this.Dl|0,l|0,f|0),{h,l:d}=Nt.add(this.Eh|0,this.El|0,h|0,d|0),{h:g,l:m}=Nt.add(this.Fh|0,this.Fl|0,g|0,m|0),{h:v,l:y}=Nt.add(this.Gh|0,this.Gl|0,v|0,y|0),{h:w,l:S}=Nt.add(this.Hh|0,this.Hl|0,w|0,S|0),this.set(n,s,i,a,u,c,l,f,h,d,g,m,v,y,w,S)}roundClean(){Fu.fill(0),Uu.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};var Ice=class extends fb{static{o(this,"SHA384")}constructor(){super(),this.Ah=-876896931,this.Al=-1056596264,this.Bh=1654270250,this.Bl=914150663,this.Ch=-1856437926,this.Cl=812702999,this.Dh=355462360,this.Dl=-150054599,this.Eh=1731405415,this.El=-4191439,this.Fh=-1900787065,this.Fl=1750603025,this.Gh=-619958771,this.Gl=1694076839,this.Hh=1203062813,this.Hl=-1090891868,this.outputLen=48}},kB=Dl(()=>new fb);var LB=Dl(()=>new Ice);var Kr=new ArrayBuffer(0),P="",hr=class hR extends TypeError{static{o(this,"ArgumentError")}constructor(){super(...arguments),this.name=hR.NAME}static isType(e,t){if(typeof t=="string"){if(t==="Array"&&Array.isArray(e))return!0;if(t==="ArrayBuffer"&&e instanceof ArrayBuffer)return!0;if(t==="ArrayBufferView"&&ArrayBuffer.isView(e))return!0;if(typeof e===t)return!0}else if(e instanceof t)return!0;return!1}static assert(e,t,...n){for(let i of n)if(this.isType(e,i))return;let s=n.map(i=>i instanceof Function&&"name"in i?i.name:`${i}`);throw new hR(`Parameter '${t}' is not of type ${s.length>1?`(${s.join(" or ")})`:s[0]}`)}};hr.NAME="ArgumentError";var Jt=class Ub extends TypeError{static{o(this,"ParameterError")}static assert(...e){let t=null,n,s;typeof e[0]=="string"?(t=e[0],n=e[1],s=e.slice(2)):(n=e[0],s=e.slice(1)),hr.assert(n,"parameters","object");for(let i of s){let a=n[i];if(a==null)throw new Ub(i,t)}}static assertEmpty(e,t,n){if(e==null)throw new Ub(t,n)}constructor(e,t=null,n){super(),this.name=Ub.NAME,this.field=e,t&&(this.target=t),n?this.message=n:this.message=`Absent mandatory parameter '${e}' ${t?` in '${t}'`:P}`}};Jt.NAME="ParameterError";var ye=class T7 extends Error{static{o(this,"AsnError")}static assertSchema(e,t){if(!e.verified)throw new Error(`Object's schema was not verified against input data for ${t}`)}static assert(e,t){if(e.offset===-1)throw new T7(`Error during parsing of ASN.1 data. Data is not correct for '${t}'.`)}constructor(e){super(e),this.name="AsnError"}},Se=class{static{o(this,"PkiObject")}static blockName(){return this.CLASS_NAME}static fromBER(e){let t=Or(e);ye.assert(t,this.name);try{return new this({schema:t.result})}catch{throw new ye(`Cannot create '${this.CLASS_NAME}' from ASN.1 object`)}}static defaultValues(e){throw new Error(`Invalid member name for ${this.CLASS_NAME} class: ${e}`)}static schema(e={}){throw new Error(`Method '${this.CLASS_NAME}.schema' should be overridden`)}get className(){return this.constructor.CLASS_NAME}toString(e="hex"){let t;try{t=this.toSchema()}catch{t=this.toSchema(!0)}return ut.ToString(t.toBER(),e)}};Se.CLASS_NAME="PkiObject";function Rc(r){let e=!1,t=P,n=r.trim();for(let s=0;s<n.length;s++)n.charCodeAt(s)===32?e===!1&&(e=!0):(e&&(t+=" ",e=!1),t+=n[s]);return t.toLowerCase()}o(Rc,"stringPrep");var oy="type",FB="value",pR=class Ey extends Se{static{o(this,"AttributeTypeAndValue")}constructor(e={}){super(),this.type=B(e,oy,Ey.defaultValues(oy)),this.value=B(e,FB,Ey.defaultValues(FB)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case oy:return P;case FB:return{};default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new He({name:t.type||P}),new it({name:t.value||P})]})}fromSchema(e){Ce(e,[oy,"typeValue"]);let t=be(e,e,Ey.schema({names:{type:oy,value:"typeValue"}}));ye.assertSchema(t,this.className),this.type=t.result.type.valueBlock.toString(),this.value=t.result.typeValue}toSchema(){return new K({value:[new He({value:this.type}),this.value]})}toJSON(){let e={type:this.type};return Object.keys(this.value).length!==0?e.value=this.value.toJSON():e.value=this.value,e}isEqual(e){let t=[ui.blockName(),Dp.blockName(),Bp.blockName(),Tl.blockName(),ci.blockName(),Rp.blockName(),tb.blockName(),ny.blockName(),rb.blockName(),sy.blockName(),nb.blockName(),sb.blockName()];if(e instanceof ArrayBuffer)return Ze.isEqual(this.value.valueBeforeDecodeView,e);if(e.constructor.blockName()===Ey.blockName()){if(this.type!==e.type)return!1;let n=[!1,!1],s=this.value.constructor.blockName();for(let a of t)s===a&&(n[0]=!0),e.value.constructor.blockName()===a&&(n[1]=!0);if(n[0]!==n[1])return!1;if(n[0]&&n[1]){let a=Rc(this.value.valueBlock.value),u=Rc(e.value.valueBlock.value);if(a.localeCompare(u)!==0)return!1}else if(!Ze.isEqual(this.value.valueBeforeDecodeView,e.value.valueBeforeDecodeView))return!1;return!0}return!1}};pR.CLASS_NAME="AttributeTypeAndValue";var Bl="typesAndValues",hb="valueBeforeDecode",n7="RDN",Ar=class wy extends Se{static{o(this,"RelativeDistinguishedNames")}constructor(e={}){super(),this.typesAndValues=B(e,Bl,wy.defaultValues(Bl)),this.valueBeforeDecode=B(e,hb,wy.defaultValues(hb)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Bl:return[];case hb:return Kr;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Bl:return t.length===0;case hb:return t.byteLength===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new lt({name:t.repeatedSequence||P,value:new kr({value:[new lt({name:t.repeatedSet||P,value:pR.schema(t.typeAndValue||{})})]})})]})}fromSchema(e){Ce(e,[n7,Bl]);let t=be(e,e,wy.schema({names:{blockName:n7,repeatedSet:Bl}}));ye.assertSchema(t,this.className),Bl in t.result&&(this.typesAndValues=Array.from(t.result.typesAndValues,n=>new pR({schema:n}))),this.valueBeforeDecode=t.result.RDN.valueBeforeDecodeView.slice().buffer}toSchema(){if(this.valueBeforeDecode.byteLength===0)return new K({value:[new kr({value:Array.from(this.typesAndValues,t=>t.toSchema())})]});let e=Or(this.valueBeforeDecode);if(ye.assert(e,"RelativeDistinguishedNames"),!(e.result instanceof K))throw new Error("ASN.1 result should be SEQUENCE");return e.result}toJSON(){return{typesAndValues:Array.from(this.typesAndValues,e=>e.toJSON())}}isEqual(e){if(e instanceof wy){if(this.typesAndValues.length!==e.typesAndValues.length)return!1;for(let[t,n]of this.typesAndValues.entries())if(n.isEqual(e.typesAndValues[t])===!1)return!1;return!0}return e instanceof ArrayBuffer?Bu(this.valueBeforeDecode,e):!1}};Ar.CLASS_NAME="RelativeDistinguishedNames";var by="type",Sy="value";function Dce(r={},e=!1){let t=B(r,"names",{});return new K({optional:e,value:[new ae({optional:!0,idBlock:{tagClass:2,tagNumber:1},name:t.country_name||P,value:[new Sr({value:[new Tl,new ci]})]}),new ae({optional:!0,idBlock:{tagClass:2,tagNumber:2},name:t.administration_domain_name||P,value:[new Sr({value:[new Tl,new ci]})]}),new tt({optional:!0,idBlock:{tagClass:3,tagNumber:0},name:t.network_address||P,isHexOnly:!0}),new tt({optional:!0,idBlock:{tagClass:3,tagNumber:1},name:t.terminal_identifier||P,isHexOnly:!0}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:2},name:t.private_domain_name||P,value:[new Sr({value:[new Tl,new ci]})]}),new tt({optional:!0,idBlock:{tagClass:3,tagNumber:3},name:t.organization_name||P,isHexOnly:!0}),new tt({optional:!0,name:t.numeric_user_identifier||P,idBlock:{tagClass:3,tagNumber:4},isHexOnly:!0}),new ae({optional:!0,name:t.personal_name||P,idBlock:{tagClass:3,tagNumber:5},value:[new tt({idBlock:{tagClass:3,tagNumber:0},isHexOnly:!0}),new tt({optional:!0,idBlock:{tagClass:3,tagNumber:1},isHexOnly:!0}),new tt({optional:!0,idBlock:{tagClass:3,tagNumber:2},isHexOnly:!0}),new tt({optional:!0,idBlock:{tagClass:3,tagNumber:3},isHexOnly:!0})]}),new ae({optional:!0,name:t.organizational_unit_names||P,idBlock:{tagClass:3,tagNumber:6},value:[new lt({value:new ci})]})]})}o(Dce,"builtInStandardAttributes");function Bce(r=!1){return new K({optional:r,value:[new ci,new ci]})}o(Bce,"builtInDomainDefinedAttributes");function Rce(r=!1){return new kr({optional:r,value:[new tt({optional:!0,idBlock:{tagClass:3,tagNumber:0},isHexOnly:!0}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:1},value:[new it]})]})}o(Rce,"extensionAttributes");var pr=class Vp extends Se{static{o(this,"GeneralName")}constructor(e={}){super(),this.type=B(e,by,Vp.defaultValues(by)),this.value=B(e,Sy,Vp.defaultValues(Sy)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case by:return 9;case Sy:return{};default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case by:return t===Vp.defaultValues(e);case Sy:return Object.keys(t).length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new Sr({value:[new ae({idBlock:{tagClass:3,tagNumber:0},name:t.blockName||P,value:[new He,new ae({idBlock:{tagClass:3,tagNumber:0},value:[new it]})]}),new tt({name:t.blockName||P,idBlock:{tagClass:3,tagNumber:1}}),new tt({name:t.blockName||P,idBlock:{tagClass:3,tagNumber:2}}),new ae({idBlock:{tagClass:3,tagNumber:3},name:t.blockName||P,value:[Dce(t.builtInStandardAttributes||{},!1),Bce(!0),Rce(!0)]}),new ae({idBlock:{tagClass:3,tagNumber:4},name:t.blockName||P,value:[Ar.schema(t.directoryName||{})]}),new ae({idBlock:{tagClass:3,tagNumber:5},name:t.blockName||P,value:[new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new Sr({value:[new Rp,new ci,new Bp,new ui,new Dp]})]}),new ae({idBlock:{tagClass:3,tagNumber:1},value:[new Sr({value:[new Rp,new ci,new Bp,new ui,new Dp]})]})]}),new tt({name:t.blockName||P,idBlock:{tagClass:3,tagNumber:6}}),new tt({name:t.blockName||P,idBlock:{tagClass:3,tagNumber:7}}),new tt({name:t.blockName||P,idBlock:{tagClass:3,tagNumber:8}})]})}fromSchema(e){Ce(e,["blockName","otherName","rfc822Name","dNSName","x400Address","directoryName","ediPartyName","uniformResourceIdentifier","iPAddress","registeredID"]);let t=be(e,e,Vp.schema({names:{blockName:"blockName",otherName:"otherName",rfc822Name:"rfc822Name",dNSName:"dNSName",x400Address:"x400Address",directoryName:{names:{blockName:"directoryName"}},ediPartyName:"ediPartyName",uniformResourceIdentifier:"uniformResourceIdentifier",iPAddress:"iPAddress",registeredID:"registeredID"}}));switch(ye.assertSchema(t,this.className),this.type=t.result.blockName.idBlock.tagNumber,this.type){case 0:this.value=t.result.blockName;break;case 1:case 2:case 6:{let n=t.result.blockName;n.idBlock.tagClass=1,n.idBlock.tagNumber=22;let s=n.toBER(!1),i=Or(s);ye.assert(i,"GeneralName value"),this.value=i.result.valueBlock.value}break;case 3:this.value=t.result.blockName;break;case 4:this.value=new Ar({schema:t.result.directoryName});break;case 5:this.value=t.result.ediPartyName;break;case 7:this.value=new Be({valueHex:t.result.blockName.valueBlock.valueHex});break;case 8:{let n=t.result.blockName;n.idBlock.tagClass=1,n.idBlock.tagNumber=6;let s=n.toBER(!1),i=Or(s);ye.assert(i,"GeneralName registeredID"),this.value=i.result.valueBlock.toString()}break}}toSchema(){switch(this.type){case 0:case 3:case 5:return new ae({idBlock:{tagClass:3,tagNumber:this.type},value:[this.value]});case 1:case 2:case 6:{let e=new ny({value:this.value});return e.idBlock.tagClass=3,e.idBlock.tagNumber=this.type,e}case 4:return new ae({idBlock:{tagClass:3,tagNumber:4},value:[this.value.toSchema()]});case 7:{let e=this.value;return e.idBlock.tagClass=3,e.idBlock.tagNumber=this.type,e}case 8:{let e=new He({value:this.value});return e.idBlock.tagClass=3,e.idBlock.tagNumber=this.type,e}default:return Vp.schema()}}toJSON(){let e={type:this.type,value:P};if(typeof this.value=="string")e.value=this.value;else try{e.value=this.value.toJSON()}catch{}return e}};pr.CLASS_NAME="GeneralName";var Ay="accessMethod",Cy="accessLocation",_ce=[Ay,Cy],dR=class Vb extends Se{static{o(this,"AccessDescription")}constructor(e={}){super(),this.accessMethod=B(e,Ay,Vb.defaultValues(Ay)),this.accessLocation=B(e,Cy,Vb.defaultValues(Cy)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Ay:return P;case Cy:return new pr;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new He({name:t.accessMethod||P}),pr.schema(t.accessLocation||{})]})}fromSchema(e){Ce(e,_ce);let t=be(e,e,Vb.schema({names:{accessMethod:Ay,accessLocation:{names:{blockName:Cy}}}}));ye.assertSchema(t,this.className),this.accessMethod=t.result.accessMethod.valueBlock.toString(),this.accessLocation=new pr({schema:t.result.accessLocation})}toSchema(){return new K({value:[new He({value:this.accessMethod}),this.accessLocation.toSchema()]})}toJSON(){return{accessMethod:this.accessMethod,accessLocation:this.accessLocation.toJSON()}}};dR.CLASS_NAME="AccessDescription";var Mu="seconds",ju="millis",qu="micros",Pl=class Mp extends Se{static{o(this,"Accuracy")}constructor(e={}){super(),Mu in e&&(this.seconds=B(e,Mu,Mp.defaultValues(Mu))),ju in e&&(this.millis=B(e,ju,Mp.defaultValues(ju))),qu in e&&(this.micros=B(e,qu,Mp.defaultValues(qu))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Mu:case ju:case qu:return 0;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Mu:case ju:case qu:return t===Mp.defaultValues(e);default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,optional:!0,value:[new he({optional:!0,name:t.seconds||P}),new tt({name:t.millis||P,optional:!0,idBlock:{tagClass:3,tagNumber:0}}),new tt({name:t.micros||P,optional:!0,idBlock:{tagClass:3,tagNumber:1}})]})}fromSchema(e){Ce(e,[Mu,ju,qu]);let t=be(e,e,Mp.schema({names:{seconds:Mu,millis:ju,micros:qu}}));if(ye.assertSchema(t,this.className),"seconds"in t.result&&(this.seconds=t.result.seconds.valueBlock.valueDec),"millis"in t.result){let n=new he({valueHex:t.result.millis.valueBlock.valueHex});this.millis=n.valueBlock.valueDec}if("micros"in t.result){let n=new he({valueHex:t.result.micros.valueBlock.valueHex});this.micros=n.valueBlock.valueDec}}toSchema(){let e=[];if(this.seconds!==void 0&&e.push(new he({value:this.seconds})),this.millis!==void 0){let t=new he({value:this.millis});e.push(new tt({idBlock:{tagClass:3,tagNumber:0},valueHex:t.valueBlock.valueHexView}))}if(this.micros!==void 0){let t=new he({value:this.micros});e.push(new tt({idBlock:{tagClass:3,tagNumber:1},valueHex:t.valueBlock.valueHexView}))}return new K({value:e})}toJSON(){let e={};return this.seconds!==void 0&&(e.seconds=this.seconds),this.millis!==void 0&&(e.millis=this.millis),this.micros!==void 0&&(e.micros=this.micros),e}};Pl.CLASS_NAME="Accuracy";var pb="algorithmId",uy="algorithmParams",I7="algorithm",mR="params",Oce=[I7,mR],pe=class Ny extends Se{static{o(this,"AlgorithmIdentifier")}constructor(e={}){super(),this.algorithmId=B(e,pb,Ny.defaultValues(pb)),uy in e&&(this.algorithmParams=B(e,uy,Ny.defaultValues(uy))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case pb:return P;case uy:return new it;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case pb:return t===P;case uy:return t instanceof it;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,optional:t.optional||!1,value:[new He({name:t.algorithmIdentifier||P}),new it({name:t.algorithmParams||P,optional:!0})]})}fromSchema(e){Ce(e,Oce);let t=be(e,e,Ny.schema({names:{algorithmIdentifier:I7,algorithmParams:mR}}));ye.assertSchema(t,this.className),this.algorithmId=t.result.algorithm.valueBlock.toString(),mR in t.result&&(this.algorithmParams=t.result.params)}toSchema(){let e=[];return e.push(new He({value:this.algorithmId})),this.algorithmParams&&!(this.algorithmParams instanceof it)&&e.push(this.algorithmParams),new K({value:e})}toJSON(){let e={algorithmId:this.algorithmId};return this.algorithmParams&&!(this.algorithmParams instanceof it)&&(e.algorithmParams=this.algorithmParams.toJSON()),e}isEqual(e){return!(e instanceof Ny)||this.algorithmId!==e.algorithmId?!1:this.algorithmParams?e.algorithmParams?JSON.stringify(this.algorithmParams)===JSON.stringify(e.algorithmParams):!1:!e.algorithmParams}};pe.CLASS_NAME="AlgorithmIdentifier";var jp="altNames",Pce=[jp],gR=class yR extends Se{static{o(this,"AltName")}constructor(e={}){super(),this.altNames=B(e,jp,yR.defaultValues(jp)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case jp:return[];default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new lt({name:t.altNames||P,value:pr.schema()})]})}fromSchema(e){Ce(e,Pce);let t=be(e,e,yR.schema({names:{altNames:jp}}));ye.assertSchema(t,this.className),jp in t.result&&(this.altNames=Array.from(t.result.altNames,n=>new pr({schema:n})))}toSchema(){return new K({value:Array.from(this.altNames,e=>e.toSchema())})}toJSON(){return{altNames:Array.from(this.altNames,e=>e.toJSON())}}};gR.CLASS_NAME="AltName";var qp="type",Hp="values",kce=[qp,Hp],$r=class Mb extends Se{static{o(this,"Attribute")}constructor(e={}){super(),this.type=B(e,qp,Mb.defaultValues(qp)),this.values=B(e,Hp,Mb.defaultValues(Hp)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case qp:return P;case Hp:return[];default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case qp:return t===P;case Hp:return t.length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new He({name:t.type||P}),new kr({name:t.setName||P,value:[new lt({name:t.values||P,value:new it})]})]})}fromSchema(e){Ce(e,kce);let t=be(e,e,Mb.schema({names:{type:qp,values:Hp}}));ye.assertSchema(t,this.className),this.type=t.result.type.valueBlock.toString(),this.values=t.result.values}toSchema(){return new K({value:[new He({value:this.type}),new kr({value:this.values})]})}toJSON(){return{type:this.type,values:Array.from(this.values,e=>e.toJSON())}}};$r.CLASS_NAME="Attribute";var Ty="notBeforeTime",Iy="notAfterTime",Lce=[Ty,Iy],Jf=class jb extends Se{static{o(this,"AttCertValidityPeriod")}constructor(e={}){super(),this.notBeforeTime=B(e,Ty,jb.defaultValues(Ty)),this.notAfterTime=B(e,Iy,jb.defaultValues(Iy)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Ty:case Iy:return new Date(0,0,0);default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new br({name:t.notBeforeTime||P}),new br({name:t.notAfterTime||P})]})}fromSchema(e){Ce(e,Lce);let t=be(e,e,jb.schema({names:{notBeforeTime:Ty,notAfterTime:Iy}}));ye.assertSchema(t,this.className),this.notBeforeTime=t.result.notBeforeTime.toDate(),this.notAfterTime=t.result.notAfterTime.toDate()}toSchema(){return new K({value:[new br({valueDate:this.notBeforeTime}),new br({valueDate:this.notAfterTime})]})}toJSON(){return{notBeforeTime:this.notBeforeTime,notAfterTime:this.notAfterTime}}};Jf.CLASS_NAME="AttCertValidityPeriod";var cy="names",s7="generalNames",Pn=class vR extends Se{static{o(this,"GeneralNames")}constructor(e={}){super(),this.names=B(e,cy,vR.defaultValues(cy)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case"names":return[];default:return super.defaultValues(e)}}static schema(e={},t=!1){let n=B(e,cy,{});return new K({optional:t,name:n.blockName||P,value:[new lt({name:n.generalNames||P,value:pr.schema()})]})}fromSchema(e){Ce(e,[cy,s7]);let t=be(e,e,vR.schema({names:{blockName:cy,generalNames:s7}}));ye.assertSchema(t,this.className),this.names=Array.from(t.result.generalNames,n=>new pr({schema:n}))}toSchema(){return new K({value:Array.from(this.names,e=>e.toSchema())})}toJSON(){return{names:Array.from(this.names,e=>e.toJSON())}}};Pn.CLASS_NAME="GeneralNames";var Fce="2.5.29.9",Uce="2.5.29.14",Vce="2.5.29.15",Mce="2.5.29.16",D7="2.5.29.17",B7="2.5.29.18",x_="2.5.29.19",jce="2.5.29.20",qce="2.5.29.27",Hce="2.5.29.21",Kce="2.5.29.24",R7="2.5.29.28",_7="2.5.29.29",O7="2.5.29.30",P7="2.5.29.31",E_="2.5.29.46",k7="2.5.29.32",li="2.5.29.32.0",$ce="1.3.6.1.4.1.311.21.10",L7="2.5.29.33",w_="2.5.29.35",F7="2.5.29.36",Xce="2.5.29.37",Gce="2.5.29.54",b_="1.3.6.1.5.5.7.1.1",zce="1.3.6.1.5.5.7.1.11",Wce="1.3.6.1.4.1.11129.2.4.2";var Jce="1.3.6.1.4.1.311.21.7",Yce="1.3.6.1.4.1.311.21.1",Qce="1.3.6.1.5.5.7.1.3",S_="1.2.840.113549.1.7.1",U7="1.2.840.113549.1.7.2",V7="1.2.840.113549.1.7.3",M7="1.2.840.113549.1.7.6",Zce="1.2.840.113549.1.9.16.1.4",i7="1.2.840.113549.1.9.22.1",ele="1.2.840.113549.1.9.22.2",a7="1.2.840.113549.1.9.22.3",o7="1.2.840.113549.1.9.23.1",tle="1.3.6.1.5.5.7",A_=`${tle}.48`,qb=`${A_}.1.1`,ABe=`${A_}.2`,CBe=`${A_}.1`;var kl="keyIdentifier",Ll="authorityCertIssuer",Fl="authorityCertSerialNumber",rle=[kl,Ll,Fl],C_=class Dy extends Se{static{o(this,"AuthorityKeyIdentifier")}constructor(e={}){super(),kl in e&&(this.keyIdentifier=B(e,kl,Dy.defaultValues(kl))),Ll in e&&(this.authorityCertIssuer=B(e,Ll,Dy.defaultValues(Ll))),Fl in e&&(this.authorityCertSerialNumber=B(e,Fl,Dy.defaultValues(Fl))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case kl:return new Be;case Ll:return[];case Fl:return new he;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new tt({name:t.keyIdentifier||P,optional:!0,idBlock:{tagClass:3,tagNumber:0}}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:1},value:[new lt({name:t.authorityCertIssuer||P,value:pr.schema()})]}),new tt({name:t.authorityCertSerialNumber||P,optional:!0,idBlock:{tagClass:3,tagNumber:2}})]})}fromSchema(e){Ce(e,rle);let t=be(e,e,Dy.schema({names:{keyIdentifier:kl,authorityCertIssuer:Ll,authorityCertSerialNumber:Fl}}));ye.assertSchema(t,this.className),kl in t.result&&(this.keyIdentifier=new Be({valueHex:t.result.keyIdentifier.valueBlock.valueHex})),Ll in t.result&&(this.authorityCertIssuer=Array.from(t.result.authorityCertIssuer,n=>new pr({schema:n}))),Fl in t.result&&(this.authorityCertSerialNumber=new he({valueHex:t.result.authorityCertSerialNumber.valueBlock.valueHex}))}toSchema(){let e=[];return this.keyIdentifier&&e.push(new tt({idBlock:{tagClass:3,tagNumber:0},valueHex:this.keyIdentifier.valueBlock.valueHexView})),this.authorityCertIssuer&&e.push(new ae({idBlock:{tagClass:3,tagNumber:1},value:Array.from(this.authorityCertIssuer,t=>t.toSchema())})),this.authorityCertSerialNumber&&e.push(new tt({idBlock:{tagClass:3,tagNumber:2},valueHex:this.authorityCertSerialNumber.valueBlock.valueHexView})),new K({value:e})}toJSON(){let e={};return this.keyIdentifier&&(e.keyIdentifier=this.keyIdentifier.toJSON()),this.authorityCertIssuer&&(e.authorityCertIssuer=Array.from(this.authorityCertIssuer,t=>t.toJSON())),this.authorityCertSerialNumber&&(e.authorityCertSerialNumber=this.authorityCertSerialNumber.toJSON()),e}};C_.CLASS_NAME="AuthorityKeyIdentifier";var Rl="pathLenConstraint",_l="cA",N_=class Hb extends Se{static{o(this,"BasicConstraints")}constructor(e={}){super(),this.cA=B(e,_l,!1),Rl in e&&(this.pathLenConstraint=B(e,Rl,0)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case _l:return!1;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new Oi({optional:!0,name:t.cA||P}),new he({optional:!0,name:t.pathLenConstraint||P})]})}fromSchema(e){Ce(e,[_l,Rl]);let t=be(e,e,Hb.schema({names:{cA:_l,pathLenConstraint:Rl}}));ye.assertSchema(t,this.className),_l in t.result&&(this.cA=t.result.cA.valueBlock.value),Rl in t.result&&(t.result.pathLenConstraint.valueBlock.isHexOnly?this.pathLenConstraint=t.result.pathLenConstraint:this.pathLenConstraint=t.result.pathLenConstraint.valueBlock.valueDec)}toSchema(){let e=[];return this.cA!==Hb.defaultValues(_l)&&e.push(new Oi({value:this.cA})),Rl in this&&(this.pathLenConstraint instanceof he?e.push(this.pathLenConstraint):e.push(new he({value:this.pathLenConstraint}))),new K({value:e})}toJSON(){let e={};return this.cA!==Hb.defaultValues(_l)&&(e.cA=this.cA),Rl in this&&(this.pathLenConstraint instanceof he?e.pathLenConstraint=this.pathLenConstraint.toJSON():e.pathLenConstraint=this.pathLenConstraint),e}};N_.CLASS_NAME="BasicConstraints";var UB="certificateIndex",VB="keyIndex",j7=class xR extends Se{static{o(this,"CAVersion")}constructor(e={}){super(),this.certificateIndex=B(e,UB,xR.defaultValues(UB)),this.keyIndex=B(e,VB,xR.defaultValues(VB)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case UB:case VB:return 0;default:return super.defaultValues(e)}}static schema(){return new he}fromSchema(e){if(e.constructor.blockName()!==he.blockName())throw new Error("Object's schema was not verified against input data for CAVersion");let t=e.valueBlock.valueHex.slice(0),n=new Uint8Array(t);switch(!0){case t.byteLength<4:{let h=new ArrayBuffer(4);new Uint8Array(h).set(n,4-t.byteLength),t=h.slice(0)}break;case t.byteLength>4:{let h=new ArrayBuffer(4);new Uint8Array(h).set(n.slice(0,4)),t=h.slice(0)}break}let s=t.slice(0,2),i=new Uint8Array(s),a=i[0];i[0]=i[1],i[1]=a;let u=new Uint16Array(s);this.keyIndex=u[0];let c=t.slice(2),l=new Uint8Array(c);a=l[0],l[0]=l[1],l[1]=a;let f=new Uint16Array(c);this.certificateIndex=f[0]}toSchema(){let e=new ArrayBuffer(2),t=new Uint16Array(e);t[0]=this.certificateIndex;let n=new Uint8Array(e),s=n[0];n[0]=n[1],n[1]=s;let i=new ArrayBuffer(2),a=new Uint16Array(i);a[0]=this.keyIndex;let u=new Uint8Array(i);return s=u[0],u[0]=u[1],u[1]=s,new he({valueHex:Al(i,e)})}toJSON(){return{certificateIndex:this.certificateIndex,keyIndex:this.keyIndex}}};j7.CLASS_NAME="CAVersion";var By="policyQualifierId",Ry="qualifier",nle=[By,Ry],ER=class Kb extends Se{static{o(this,"PolicyQualifierInfo")}constructor(e={}){super(),this.policyQualifierId=B(e,By,Kb.defaultValues(By)),this.qualifier=B(e,Ry,Kb.defaultValues(Ry)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case By:return P;case Ry:return new it;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new He({name:t.policyQualifierId||P}),new it({name:t.qualifier||P})]})}fromSchema(e){Ce(e,nle);let t=be(e,e,Kb.schema({names:{policyQualifierId:By,qualifier:Ry}}));ye.assertSchema(t,this.className),this.policyQualifierId=t.result.policyQualifierId.valueBlock.toString(),this.qualifier=t.result.qualifier}toSchema(){return new K({value:[new He({value:this.policyQualifierId}),this.qualifier]})}toJSON(){return{policyQualifierId:this.policyQualifierId,qualifier:this.qualifier.toJSON()}}};ER.CLASS_NAME="PolicyQualifierInfo";var _y="policyIdentifier",Ul="policyQualifiers",sle=[_y,Ul],wR=class $b extends Se{static{o(this,"PolicyInformation")}constructor(e={}){super(),this.policyIdentifier=B(e,_y,$b.defaultValues(_y)),Ul in e&&(this.policyQualifiers=B(e,Ul,$b.defaultValues(Ul))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case _y:return P;case Ul:return[];default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new He({name:t.policyIdentifier||P}),new K({optional:!0,value:[new lt({name:t.policyQualifiers||P,value:ER.schema()})]})]})}fromSchema(e){Ce(e,sle);let t=be(e,e,$b.schema({names:{policyIdentifier:_y,policyQualifiers:Ul}}));ye.assertSchema(t,this.className),this.policyIdentifier=t.result.policyIdentifier.valueBlock.toString(),Ul in t.result&&(this.policyQualifiers=Array.from(t.result.policyQualifiers,n=>new ER({schema:n})))}toSchema(){let e=[];return e.push(new He({value:this.policyIdentifier})),this.policyQualifiers&&e.push(new K({value:Array.from(this.policyQualifiers,t=>t.toSchema())})),new K({value:e})}toJSON(){let e={policyIdentifier:this.policyIdentifier};return this.policyQualifiers&&(e.policyQualifiers=Array.from(this.policyQualifiers,t=>t.toJSON())),e}};wR.CLASS_NAME="PolicyInformation";var Oy="certificatePolicies",ile=[Oy],bR=class SR extends Se{static{o(this,"CertificatePolicies")}constructor(e={}){super(),this.certificatePolicies=B(e,Oy,SR.defaultValues(Oy)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Oy:return[];default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new lt({name:t.certificatePolicies||P,value:wR.schema()})]})}fromSchema(e){Ce(e,ile);let t=be(e,e,SR.schema({names:{certificatePolicies:Oy}}));ye.assertSchema(t,this.className),this.certificatePolicies=Array.from(t.result.certificatePolicies,n=>new wR({schema:n}))}toSchema(){return new K({value:Array.from(this.certificatePolicies,e=>e.toSchema())})}toJSON(){return{certificatePolicies:Array.from(this.certificatePolicies,e=>e.toJSON())}}};bR.CLASS_NAME="CertificatePolicies";var Py="templateID",lo="templateMajorVersion",fo="templateMinorVersion",ale=[Py,lo,fo],ole=class ky extends Se{static{o(this,"CertificateTemplate")}constructor(e={}){super(),this.templateID=B(e,Py,ky.defaultValues(Py)),lo in e&&(this.templateMajorVersion=B(e,lo,ky.defaultValues(lo))),fo in e&&(this.templateMinorVersion=B(e,fo,ky.defaultValues(fo))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Py:return P;case lo:case fo:return 0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new He({name:t.templateID||P}),new he({name:t.templateMajorVersion||P,optional:!0}),new he({name:t.templateMinorVersion||P,optional:!0})]})}fromSchema(e){Ce(e,ale);let t=be(e,e,ky.schema({names:{templateID:Py,templateMajorVersion:lo,templateMinorVersion:fo}}));ye.assertSchema(t,this.className),this.templateID=t.result.templateID.valueBlock.toString(),lo in t.result&&(this.templateMajorVersion=t.result.templateMajorVersion.valueBlock.valueDec),fo in t.result&&(this.templateMinorVersion=t.result.templateMinorVersion.valueBlock.valueDec)}toSchema(){let e=[];return e.push(new He({value:this.templateID})),lo in this&&e.push(new he({value:this.templateMajorVersion})),fo in this&&e.push(new he({value:this.templateMinorVersion})),new K({value:e})}toJSON(){let e={templateID:this.templateID};return lo in this&&(e.templateMajorVersion=this.templateMajorVersion),fo in this&&(e.templateMinorVersion=this.templateMinorVersion),e}},Vl="distributionPoint",q7="distributionPointNames",Ml="reasons",jl="cRLIssuer",H7="cRLIssuerNames",ule=[Vl,q7,Ml,jl,H7],AR=class Ly extends Se{static{o(this,"DistributionPoint")}constructor(e={}){super(),Vl in e&&(this.distributionPoint=B(e,Vl,Ly.defaultValues(Vl))),Ml in e&&(this.reasons=B(e,Ml,Ly.defaultValues(Ml))),jl in e&&(this.cRLIssuer=B(e,jl,Ly.defaultValues(jl))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Vl:return[];case Ml:return new Ct;case jl:return[];default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new Sr({value:[new ae({name:t.distributionPoint||P,optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new lt({name:t.distributionPointNames||P,value:pr.schema()})]}),new ae({name:t.distributionPoint||P,optional:!0,idBlock:{tagClass:3,tagNumber:1},value:Ar.schema().valueBlock.value})]})]}),new tt({name:t.reasons||P,optional:!0,idBlock:{tagClass:3,tagNumber:1}}),new ae({name:t.cRLIssuer||P,optional:!0,idBlock:{tagClass:3,tagNumber:2},value:[new lt({name:t.cRLIssuerNames||P,value:pr.schema()})]})]})}fromSchema(e){Ce(e,ule);let t=be(e,e,Ly.schema({names:{distributionPoint:Vl,distributionPointNames:q7,reasons:Ml,cRLIssuer:jl,cRLIssuerNames:H7}}));ye.assertSchema(t,this.className),Vl in t.result&&(t.result.distributionPoint.idBlock.tagNumber===0&&(this.distributionPoint=Array.from(t.result.distributionPointNames,n=>new pr({schema:n}))),t.result.distributionPoint.idBlock.tagNumber===1&&(this.distributionPoint=new Ar({schema:new K({value:t.result.distributionPoint.valueBlock.value})}))),Ml in t.result&&(this.reasons=new Ct({valueHex:t.result.reasons.valueBlock.valueHex})),jl in t.result&&(this.cRLIssuer=Array.from(t.result.cRLIssuerNames,n=>new pr({schema:n})))}toSchema(){let e=[];if(this.distributionPoint){let t;this.distributionPoint instanceof Array?t=new ae({idBlock:{tagClass:3,tagNumber:0},value:Array.from(this.distributionPoint,n=>n.toSchema())}):t=new ae({idBlock:{tagClass:3,tagNumber:1},value:[this.distributionPoint.toSchema()]}),e.push(new ae({idBlock:{tagClass:3,tagNumber:0},value:[t]}))}return this.reasons&&e.push(new tt({idBlock:{tagClass:3,tagNumber:1},valueHex:this.reasons.valueBlock.valueHexView})),this.cRLIssuer&&e.push(new ae({idBlock:{tagClass:3,tagNumber:2},value:Array.from(this.cRLIssuer,t=>t.toSchema())})),new K({value:e})}toJSON(){let e={};return this.distributionPoint&&(this.distributionPoint instanceof Array?e.distributionPoint=Array.from(this.distributionPoint,t=>t.toJSON()):e.distributionPoint=this.distributionPoint.toJSON()),this.reasons&&(e.reasons=this.reasons.toJSON()),this.cRLIssuer&&(e.cRLIssuer=Array.from(this.cRLIssuer,t=>t.toJSON())),e}};AR.CLASS_NAME="DistributionPoint";var Fy="distributionPoints",cle=[Fy],CR=class NR extends Se{static{o(this,"CRLDistributionPoints")}constructor(e={}){super(),this.distributionPoints=B(e,Fy,NR.defaultValues(Fy)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Fy:return[];default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new lt({name:t.distributionPoints||P,value:AR.schema()})]})}fromSchema(e){Ce(e,cle);let t=be(e,e,NR.schema({names:{distributionPoints:Fy}}));ye.assertSchema(t,this.className),this.distributionPoints=Array.from(t.result.distributionPoints,n=>new AR({schema:n}))}toSchema(){return new K({value:Array.from(this.distributionPoints,e=>e.toSchema())})}toJSON(){return{distributionPoints:Array.from(this.distributionPoints,e=>e.toJSON())}}};CR.CLASS_NAME="CRLDistributionPoints";var Uy="keyPurposes",lle=[Uy],K7=class TR extends Se{static{o(this,"ExtKeyUsage")}constructor(e={}){super(),this.keyPurposes=B(e,Uy,TR.defaultValues(Uy)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Uy:return[];default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new lt({name:t.keyPurposes||P,value:new He})]})}fromSchema(e){Ce(e,lle);let t=be(e,e,TR.schema({names:{keyPurposes:Uy}}));ye.assertSchema(t,this.className),this.keyPurposes=Array.from(t.result.keyPurposes,n=>n.valueBlock.toString())}toSchema(){return new K({value:Array.from(this.keyPurposes,e=>new He({value:e}))})}toJSON(){return{keyPurposes:Array.from(this.keyPurposes)}}};K7.CLASS_NAME="ExtKeyUsage";var ly="accessDescriptions",IR=class DR extends Se{static{o(this,"InfoAccess")}constructor(e={}){super(),this.accessDescriptions=B(e,ly,DR.defaultValues(ly)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case ly:return[];default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new lt({name:t.accessDescriptions||P,value:dR.schema()})]})}fromSchema(e){Ce(e,[ly]);let t=be(e,e,DR.schema({names:{accessDescriptions:ly}}));ye.assertSchema(t,this.className),this.accessDescriptions=Array.from(t.result.accessDescriptions,n=>new dR({schema:n}))}toSchema(){return new K({value:Array.from(this.accessDescriptions,e=>e.toSchema())})}toJSON(){return{accessDescriptions:Array.from(this.accessDescriptions,e=>e.toJSON())}}};IR.CLASS_NAME="InfoAccess";var ql="distributionPoint",$7="distributionPointNames",Hu="onlyContainsUserCerts",Ku="onlyContainsCACerts",$u="onlySomeReasons",Xu="indirectCRL",Gu="onlyContainsAttributeCerts",fle=[ql,$7,Hu,Ku,$u,Xu,Gu],X7=class $n extends Se{static{o(this,"IssuingDistributionPoint")}constructor(e={}){super(),ql in e&&(this.distributionPoint=B(e,ql,$n.defaultValues(ql))),this.onlyContainsUserCerts=B(e,Hu,$n.defaultValues(Hu)),this.onlyContainsCACerts=B(e,Ku,$n.defaultValues(Ku)),$u in e&&(this.onlySomeReasons=B(e,$u,$n.defaultValues($u))),this.indirectCRL=B(e,Xu,$n.defaultValues(Xu)),this.onlyContainsAttributeCerts=B(e,Gu,$n.defaultValues(Gu)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case ql:return[];case Hu:return!1;case Ku:return!1;case $u:return 0;case Xu:return!1;case Gu:return!1;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new Sr({value:[new ae({name:t.distributionPoint||P,idBlock:{tagClass:3,tagNumber:0},value:[new lt({name:t.distributionPointNames||P,value:pr.schema()})]}),new ae({name:t.distributionPoint||P,idBlock:{tagClass:3,tagNumber:1},value:Ar.schema().valueBlock.value})]})]}),new tt({name:t.onlyContainsUserCerts||P,optional:!0,idBlock:{tagClass:3,tagNumber:1}}),new tt({name:t.onlyContainsCACerts||P,optional:!0,idBlock:{tagClass:3,tagNumber:2}}),new tt({name:t.onlySomeReasons||P,optional:!0,idBlock:{tagClass:3,tagNumber:3}}),new tt({name:t.indirectCRL||P,optional:!0,idBlock:{tagClass:3,tagNumber:4}}),new tt({name:t.onlyContainsAttributeCerts||P,optional:!0,idBlock:{tagClass:3,tagNumber:5}})]})}fromSchema(e){Ce(e,fle);let t=be(e,e,$n.schema({names:{distributionPoint:ql,distributionPointNames:$7,onlyContainsUserCerts:Hu,onlyContainsCACerts:Ku,onlySomeReasons:$u,indirectCRL:Xu,onlyContainsAttributeCerts:Gu}}));if(ye.assertSchema(t,this.className),ql in t.result)switch(!0){case t.result.distributionPoint.idBlock.tagNumber===0:this.distributionPoint=Array.from(t.result.distributionPointNames,n=>new pr({schema:n}));break;case t.result.distributionPoint.idBlock.tagNumber===1:this.distributionPoint=new Ar({schema:new K({value:t.result.distributionPoint.valueBlock.value})});break;default:throw new Error("Unknown tagNumber for distributionPoint: {$asn1.result.distributionPoint.idBlock.tagNumber}")}if(Hu in t.result){let n=new Uint8Array(t.result.onlyContainsUserCerts.valueBlock.valueHex);this.onlyContainsUserCerts=n[0]!==0}if(Ku in t.result){let n=new Uint8Array(t.result.onlyContainsCACerts.valueBlock.valueHex);this.onlyContainsCACerts=n[0]!==0}if($u in t.result){let n=new Uint8Array(t.result.onlySomeReasons.valueBlock.valueHex);this.onlySomeReasons=n[0]}if(Xu in t.result){let n=new Uint8Array(t.result.indirectCRL.valueBlock.valueHex);this.indirectCRL=n[0]!==0}if(Gu in t.result){let n=new Uint8Array(t.result.onlyContainsAttributeCerts.valueBlock.valueHex);this.onlyContainsAttributeCerts=n[0]!==0}}toSchema(){let e=[];if(this.distributionPoint){let t;this.distributionPoint instanceof Array?t=new ae({idBlock:{tagClass:3,tagNumber:0},value:Array.from(this.distributionPoint,n=>n.toSchema())}):(t=this.distributionPoint.toSchema(),t.idBlock.tagClass=3,t.idBlock.tagNumber=1),e.push(new ae({idBlock:{tagClass:3,tagNumber:0},value:[t]}))}if(this.onlyContainsUserCerts!==$n.defaultValues(Hu)&&e.push(new tt({idBlock:{tagClass:3,tagNumber:1},valueHex:new Uint8Array([255]).buffer})),this.onlyContainsCACerts!==$n.defaultValues(Ku)&&e.push(new tt({idBlock:{tagClass:3,tagNumber:2},valueHex:new Uint8Array([255]).buffer})),this.onlySomeReasons!==void 0){let t=new ArrayBuffer(1),n=new Uint8Array(t);n[0]=this.onlySomeReasons,e.push(new tt({idBlock:{tagClass:3,tagNumber:3},valueHex:t}))}return this.indirectCRL!==$n.defaultValues(Xu)&&e.push(new tt({idBlock:{tagClass:3,tagNumber:4},valueHex:new Uint8Array([255]).buffer})),this.onlyContainsAttributeCerts!==$n.defaultValues(Gu)&&e.push(new tt({idBlock:{tagClass:3,tagNumber:5},valueHex:new Uint8Array([255]).buffer})),new K({value:e})}toJSON(){let e={};return this.distributionPoint&&(this.distributionPoint instanceof Array?e.distributionPoint=Array.from(this.distributionPoint,t=>t.toJSON()):e.distributionPoint=this.distributionPoint.toJSON()),this.onlyContainsUserCerts!==$n.defaultValues(Hu)&&(e.onlyContainsUserCerts=this.onlyContainsUserCerts),this.onlyContainsCACerts!==$n.defaultValues(Ku)&&(e.onlyContainsCACerts=this.onlyContainsCACerts),$u in this&&(e.onlySomeReasons=this.onlySomeReasons),this.indirectCRL!==$n.defaultValues(Xu)&&(e.indirectCRL=this.indirectCRL),this.onlyContainsAttributeCerts!==$n.defaultValues(Gu)&&(e.onlyContainsAttributeCerts=this.onlyContainsAttributeCerts),e}};X7.CLASS_NAME="IssuingDistributionPoint";var Vy="base",Kp="minimum",zu="maximum",hle=[Vy,Kp,zu],My=class jy extends Se{static{o(this,"GeneralSubtree")}constructor(e={}){super(),this.base=B(e,Vy,jy.defaultValues(Vy)),this.minimum=B(e,Kp,jy.defaultValues(Kp)),zu in e&&(this.maximum=B(e,zu,jy.defaultValues(zu))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Vy:return new pr;case Kp:return 0;case zu:return 0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[pr.schema(t.base||{}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new he({name:t.minimum||P})]}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:1},value:[new he({name:t.maximum||P})]})]})}fromSchema(e){Ce(e,hle);let t=be(e,e,jy.schema({names:{base:{names:{blockName:Vy}},minimum:Kp,maximum:zu}}));ye.assertSchema(t,this.className),this.base=new pr({schema:t.result.base}),Kp in t.result&&(t.result.minimum.valueBlock.isHexOnly?this.minimum=t.result.minimum:this.minimum=t.result.minimum.valueBlock.valueDec),zu in t.result&&(t.result.maximum.valueBlock.isHexOnly?this.maximum=t.result.maximum:this.maximum=t.result.maximum.valueBlock.valueDec)}toSchema(){let e=[];if(e.push(this.base.toSchema()),this.minimum!==0){let t=0;this.minimum instanceof he?t=this.minimum:t=new he({value:this.minimum}),e.push(new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[t]}))}if(zu in this){let t=0;this.maximum instanceof he?t=this.maximum:t=new he({value:this.maximum}),e.push(new ae({optional:!0,idBlock:{tagClass:3,tagNumber:1},value:[t]}))}return new K({value:e})}toJSON(){let e={base:this.base.toJSON()};return this.minimum!==0&&(typeof this.minimum=="number"?e.minimum=this.minimum:e.minimum=this.minimum.toJSON()),this.maximum!==void 0&&(typeof this.maximum=="number"?e.maximum=this.maximum:e.maximum=this.maximum.toJSON()),e}};My.CLASS_NAME="GeneralSubtree";var Hl="permittedSubtrees",Kl="excludedSubtrees",ple=[Hl,Kl],G7=class Xb extends Se{static{o(this,"NameConstraints")}constructor(e={}){super(),Hl in e&&(this.permittedSubtrees=B(e,Hl,Xb.defaultValues(Hl))),Kl in e&&(this.excludedSubtrees=B(e,Kl,Xb.defaultValues(Kl))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Hl:case Kl:return[];default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new lt({name:t.permittedSubtrees||P,value:My.schema()})]}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:1},value:[new lt({name:t.excludedSubtrees||P,value:My.schema()})]})]})}fromSchema(e){Ce(e,ple);let t=be(e,e,Xb.schema({names:{permittedSubtrees:Hl,excludedSubtrees:Kl}}));ye.assertSchema(t,this.className),Hl in t.result&&(this.permittedSubtrees=Array.from(t.result.permittedSubtrees,n=>new My({schema:n}))),Kl in t.result&&(this.excludedSubtrees=Array.from(t.result.excludedSubtrees,n=>new My({schema:n})))}toSchema(){let e=[];return this.permittedSubtrees&&e.push(new ae({idBlock:{tagClass:3,tagNumber:0},value:Array.from(this.permittedSubtrees,t=>t.toSchema())})),this.excludedSubtrees&&e.push(new ae({idBlock:{tagClass:3,tagNumber:1},value:Array.from(this.excludedSubtrees,t=>t.toSchema())})),new K({value:e})}toJSON(){let e={};return this.permittedSubtrees&&(e.permittedSubtrees=Array.from(this.permittedSubtrees,t=>t.toJSON())),this.excludedSubtrees&&(e.excludedSubtrees=Array.from(this.excludedSubtrees,t=>t.toJSON())),e}};G7.CLASS_NAME="NameConstraints";var ho="requireExplicitPolicy",po="inhibitPolicyMapping",dle=[ho,po],z7=class Gb extends Se{static{o(this,"PolicyConstraints")}constructor(e={}){super(),ho in e&&(this.requireExplicitPolicy=B(e,ho,Gb.defaultValues(ho))),po in e&&(this.inhibitPolicyMapping=B(e,po,Gb.defaultValues(po))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case ho:return 0;case po:return 0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new tt({name:t.requireExplicitPolicy||P,optional:!0,idBlock:{tagClass:3,tagNumber:0}}),new tt({name:t.inhibitPolicyMapping||P,optional:!0,idBlock:{tagClass:3,tagNumber:1}})]})}fromSchema(e){Ce(e,dle);let t=be(e,e,Gb.schema({names:{requireExplicitPolicy:ho,inhibitPolicyMapping:po}}));if(ye.assertSchema(t,this.className),ho in t.result){let n=t.result.requireExplicitPolicy;n.idBlock.tagClass=1,n.idBlock.tagNumber=2;let s=n.toBER(!1),i=Or(s);ye.assert(i,"Integer"),this.requireExplicitPolicy=i.result.valueBlock.valueDec}if(po in t.result){let n=t.result.inhibitPolicyMapping;n.idBlock.tagClass=1,n.idBlock.tagNumber=2;let s=n.toBER(!1),i=Or(s);ye.assert(i,"Integer"),this.inhibitPolicyMapping=i.result.valueBlock.valueDec}}toSchema(){let e=[];if(ho in this){let t=new he({value:this.requireExplicitPolicy});t.idBlock.tagClass=3,t.idBlock.tagNumber=0,e.push(t)}if(po in this){let t=new he({value:this.inhibitPolicyMapping});t.idBlock.tagClass=3,t.idBlock.tagNumber=1,e.push(t)}return new K({value:e})}toJSON(){let e={};return ho in this&&(e.requireExplicitPolicy=this.requireExplicitPolicy),po in this&&(e.inhibitPolicyMapping=this.inhibitPolicyMapping),e}};z7.CLASS_NAME="PolicyConstraints";var qy="issuerDomainPolicy",Hy="subjectDomainPolicy",mle=[qy,Hy],BR=class zb extends Se{static{o(this,"PolicyMapping")}constructor(e={}){super(),this.issuerDomainPolicy=B(e,qy,zb.defaultValues(qy)),this.subjectDomainPolicy=B(e,Hy,zb.defaultValues(Hy)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case qy:return P;case Hy:return P;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new He({name:t.issuerDomainPolicy||P}),new He({name:t.subjectDomainPolicy||P})]})}fromSchema(e){Ce(e,mle);let t=be(e,e,zb.schema({names:{issuerDomainPolicy:qy,subjectDomainPolicy:Hy}}));ye.assertSchema(t,this.className),this.issuerDomainPolicy=t.result.issuerDomainPolicy.valueBlock.toString(),this.subjectDomainPolicy=t.result.subjectDomainPolicy.valueBlock.toString()}toSchema(){return new K({value:[new He({value:this.issuerDomainPolicy}),new He({value:this.subjectDomainPolicy})]})}toJSON(){return{issuerDomainPolicy:this.issuerDomainPolicy,subjectDomainPolicy:this.subjectDomainPolicy}}};BR.CLASS_NAME="PolicyMapping";var Ky="mappings",gle=[Ky],W7=class RR extends Se{static{o(this,"PolicyMappings")}constructor(e={}){super(),this.mappings=B(e,Ky,RR.defaultValues(Ky)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Ky:return[];default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new lt({name:t.mappings||P,value:BR.schema()})]})}fromSchema(e){Ce(e,gle);let t=be(e,e,RR.schema({names:{mappings:Ky}}));ye.assertSchema(t,this.className),this.mappings=Array.from(t.result.mappings,n=>new BR({schema:n}))}toSchema(){return new K({value:Array.from(this.mappings,e=>e.toSchema())})}toJSON(){return{mappings:Array.from(this.mappings,e=>e.toJSON())}}};W7.CLASS_NAME="PolicyMappings";var Wu="notBefore",Ju="notAfter",yle=[Wu,Ju],J7=class Wb extends Se{static{o(this,"PrivateKeyUsagePeriod")}constructor(e={}){super(),Wu in e&&(this.notBefore=B(e,Wu,Wb.defaultValues(Wu))),Ju in e&&(this.notAfter=B(e,Ju,Wb.defaultValues(Ju))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Wu:return new Date;case Ju:return new Date;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new tt({name:t.notBefore||P,optional:!0,idBlock:{tagClass:3,tagNumber:0}}),new tt({name:t.notAfter||P,optional:!0,idBlock:{tagClass:3,tagNumber:1}})]})}fromSchema(e){Ce(e,yle);let t=be(e,e,Wb.schema({names:{notBefore:Wu,notAfter:Ju}}));if(ye.assertSchema(t,this.className),Wu in t.result){let n=new br;n.fromBuffer(t.result.notBefore.valueBlock.valueHex),this.notBefore=n.toDate()}if(Ju in t.result){let n=new br({valueHex:t.result.notAfter.valueBlock.valueHex});n.fromBuffer(t.result.notAfter.valueBlock.valueHex),this.notAfter=n.toDate()}}toSchema(){let e=[];return Wu in this&&e.push(new tt({idBlock:{tagClass:3,tagNumber:0},valueHex:new br({valueDate:this.notBefore}).valueBlock.valueHexView})),Ju in this&&e.push(new tt({idBlock:{tagClass:3,tagNumber:1},valueHex:new br({valueDate:this.notAfter}).valueBlock.valueHexView})),new K({value:e})}toJSON(){let e={};return this.notBefore&&(e.notBefore=this.notBefore),this.notAfter&&(e.notAfter=this.notAfter),e}};J7.CLASS_NAME="PrivateKeyUsagePeriod";var $p="id",mo="type",Xp="values",vle=[$p,mo],xle=[Xp],_R=class Jb extends Se{static{o(this,"QCStatement")}constructor(e={}){super(),this.id=B(e,$p,Jb.defaultValues($p)),mo in e&&(this.type=B(e,mo,Jb.defaultValues(mo))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case $p:return P;case mo:return new Pr;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case $p:return t===P;case mo:return t instanceof Pr;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new He({name:t.id||P}),new it({name:t.type||P,optional:!0})]})}fromSchema(e){Ce(e,vle);let t=be(e,e,Jb.schema({names:{id:$p,type:mo}}));ye.assertSchema(t,this.className),this.id=t.result.id.valueBlock.toString(),mo in t.result&&(this.type=t.result.type)}toSchema(){let e=[new He({value:this.id})];return mo in this&&e.push(this.type),new K({value:e})}toJSON(){let e={id:this.id};return this.type&&(e.type=this.type.toJSON()),e}};_R.CLASS_NAME="QCStatement";var Y7=class OR extends Se{static{o(this,"QCStatements")}constructor(e={}){super(),this.values=B(e,Xp,OR.defaultValues(Xp)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Xp:return[];default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Xp:return t.length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new lt({name:t.values||P,value:_R.schema(t.value||{})})]})}fromSchema(e){Ce(e,xle);let t=be(e,e,OR.schema({names:{values:Xp}}));ye.assertSchema(t,this.className),this.values=Array.from(t.result.values,n=>new _R({schema:n}))}toSchema(){return new K({value:Array.from(this.values,e=>e.toSchema())})}toJSON(){return{values:Array.from(this.values,e=>e.toJSON())}}};Y7.CLASS_NAME="QCStatements";var $l,Oc=class{static{o(this,"ECNamedCurves")}static register(e,t,n){this.namedCurves[e.toLowerCase()]=this.namedCurves[t]={name:e,id:t,size:n}}static find(e){return this.namedCurves[e.toLowerCase()]||null}};$l=Oc;Oc.namedCurves={};$l.register("P-256","1.2.840.10045.3.1.7",32),$l.register("P-384","1.3.132.0.34",48),$l.register("P-521","1.3.132.0.35",66),$l.register("brainpoolP256r1","1.3.36.3.3.2.8.1.1.7",32),$l.register("brainpoolP384r1","1.3.36.3.3.2.8.1.1.11",48),$l.register("brainpoolP512r1","1.3.36.3.3.2.8.1.1.13",64);var db="x",mb="y",gb="namedCurve",Do=class Gp extends Se{static{o(this,"ECPublicKey")}constructor(e={}){super(),this.x=B(e,db,Gp.defaultValues(db)),this.y=B(e,mb,Gp.defaultValues(mb)),this.namedCurve=B(e,gb,Gp.defaultValues(gb)),e.json&&this.fromJSON(e.json),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case db:case mb:return Kr;case gb:return P;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case db:case mb:return t instanceof ArrayBuffer&&Bu(t,Gp.defaultValues(e));case gb:return typeof t=="string"&&t===Gp.defaultValues(e);default:return super.defaultValues(e)}}static schema(){return new iy}fromSchema(e){let t=Ze.toUint8Array(e);if(t[0]!==4)throw new Error("Object's schema was not verified against input data for ECPublicKey");let n=Oc.find(this.namedCurve);if(!n)throw new Error(`Incorrect curve OID: ${this.namedCurve}`);let s=n.size;if(t.byteLength!==s*2+1)throw new Error("Object's schema was not verified against input data for ECPublicKey");this.namedCurve=n.name,this.x=t.slice(1,s+1).buffer,this.y=t.slice(1+s,s*2+1).buffer}toSchema(){return new iy({data:Al(new Uint8Array([4]).buffer,this.x,this.y)})}toJSON(){let e=Oc.find(this.namedCurve);return{crv:e?e.name:this.namedCurve,x:Qw(Qg(this.x),!0,!0,!1),y:Qw(Qg(this.y),!0,!0,!1)}}fromJSON(e){Jt.assert("json",e,"crv","x","y");let t=0,n=Oc.find(e.crv);n&&(this.namedCurve=n.id,t=n.size);let s=Cl(Ip(e.x,!0));if(s.byteLength<t){this.x=new ArrayBuffer(t);let a=new Uint8Array(this.x),u=new Uint8Array(s);a.set(u,1)}else this.x=s.slice(0,t);let i=Cl(Ip(e.y,!0));if(i.byteLength<t){this.y=new ArrayBuffer(t);let a=new Uint8Array(this.y),u=new Uint8Array(i);a.set(u,1)}else this.y=i.slice(0,t)}};Do.CLASS_NAME="ECPublicKey";var $y="modulus",Xy="publicExponent",Ele=[$y,Xy],PR=class Yb extends Se{static{o(this,"RSAPublicKey")}constructor(e={}){super(),this.modulus=B(e,$y,Yb.defaultValues($y)),this.publicExponent=B(e,Xy,Yb.defaultValues(Xy)),e.json&&this.fromJSON(e.json),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case $y:return new he;case Xy:return new he;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new he({name:t.modulus||P}),new he({name:t.publicExponent||P})]})}fromSchema(e){Ce(e,Ele);let t=be(e,e,Yb.schema({names:{modulus:$y,publicExponent:Xy}}));ye.assertSchema(t,this.className),this.modulus=t.result.modulus.convertFromDER(256),this.publicExponent=t.result.publicExponent}toSchema(){return new K({value:[this.modulus.convertToDER(),this.publicExponent]})}toJSON(){return{n:ut.ToBase64Url(this.modulus.valueBlock.valueHexView),e:ut.ToBase64Url(this.publicExponent.valueBlock.valueHexView)}}fromJSON(e){Jt.assert("json",e,"n","e");let t=Cl(Ip(e.n,!0));this.modulus=new he({valueHex:t.slice(0,Math.pow(2,X9(t.byteLength)))}),this.publicExponent=new he({valueHex:Cl(Ip(e.e,!0)).slice(0,3)})}};PR.CLASS_NAME="RSAPublicKey";var Gy="algorithm",zy="subjectPublicKey",wle=[Gy,zy],qi=class Qb extends Se{static{o(this,"PublicKeyInfo")}get parsedKey(){if(this._parsedKey===void 0){switch(this.algorithm.algorithmId){case"1.2.840.10045.2.1":if("algorithmParams"in this.algorithm&&this.algorithm.algorithmParams.constructor.blockName()===He.blockName())try{this._parsedKey=new Do({namedCurve:this.algorithm.algorithmParams.valueBlock.toString(),schema:this.subjectPublicKey.valueBlock.valueHexView})}catch{}break;case"1.2.840.113549.1.1.1":case"1.2.840.113549.1.1.10":{let e=Or(this.subjectPublicKey.valueBlock.valueHexView);if(e.offset!==-1)try{this._parsedKey=new PR({schema:e.result})}catch{}}break}this._parsedKey||(this._parsedKey=null)}return this._parsedKey||void 0}set parsedKey(e){this._parsedKey=e}constructor(e={}){super(),this.algorithm=B(e,Gy,Qb.defaultValues(Gy)),this.subjectPublicKey=B(e,zy,Qb.defaultValues(zy));let t=B(e,"parsedKey",null);t&&(this.parsedKey=t),e.json&&this.fromJSON(e.json),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Gy:return new pe;case zy:return new Ct;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[pe.schema(t.algorithm||{}),new Ct({name:t.subjectPublicKey||P})]})}fromSchema(e){Ce(e,wle);let t=be(e,e,Qb.schema({names:{algorithm:{names:{blockName:Gy}},subjectPublicKey:zy}}));ye.assertSchema(t,this.className),this.algorithm=new pe({schema:t.result.algorithm}),this.subjectPublicKey=t.result.subjectPublicKey}toSchema(){return new K({value:[this.algorithm.toSchema(),this.subjectPublicKey]})}toJSON(){if(!this.parsedKey)return{algorithm:this.algorithm.toJSON(),subjectPublicKey:this.subjectPublicKey.toJSON()};let e={};switch(this.algorithm.algorithmId){case"1.2.840.10045.2.1":e.kty="EC";break;case"1.2.840.113549.1.1.1":case"1.2.840.113549.1.1.10":e.kty="RSA";break}let t=this.parsedKey.toJSON();return Object.assign(e,t),e}fromJSON(e){if("kty"in e){switch(e.kty.toUpperCase()){case"EC":this.parsedKey=new Do({json:e}),this.algorithm=new pe({algorithmId:"1.2.840.10045.2.1",algorithmParams:new He({value:this.parsedKey.namedCurve})});break;case"RSA":this.parsedKey=new PR({json:e}),this.algorithm=new pe({algorithmId:"1.2.840.113549.1.1.1",algorithmParams:new Pr});break;default:throw new Error(`Invalid value for "kty" parameter: ${e.kty}`)}this.subjectPublicKey=new Ct({valueHex:this.parsedKey.toSchema().toBER(!1)})}}async importKey(e,t=mt(!0)){try{if(!e)throw new Error("Need to provide publicKey input parameter");let n=await t.exportKey("spki",e),s=Or(n);try{this.fromSchema(s.result)}catch{throw new Error("Error during initializing object from schema")}}catch(n){let s=n instanceof Error?n.message:`${n}`;throw new Error(`Error during exporting public key: ${s}`)}}};qi.CLASS_NAME="PublicKeyInfo";var zp="version",Wp="privateKey",ki="namedCurve",Yu="publicKey",ble=[zp,Wp,ki,Yu],kR=class go extends Se{static{o(this,"ECPrivateKey")}constructor(e={}){super(),this.version=B(e,zp,go.defaultValues(zp)),this.privateKey=B(e,Wp,go.defaultValues(Wp)),ki in e&&(this.namedCurve=B(e,ki,go.defaultValues(ki))),Yu in e&&(this.publicKey=B(e,Yu,go.defaultValues(Yu))),e.json&&this.fromJSON(e.json),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case zp:return 1;case Wp:return new Be;case ki:return P;case Yu:return new Do;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case zp:return t===go.defaultValues(e);case Wp:return t.isEqual(go.defaultValues(e));case ki:return t===P;case Yu:return Do.compareWithDefault(ki,t.namedCurve)&&Do.compareWithDefault("x",t.x)&&Do.compareWithDefault("y",t.y);default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new he({name:t.version||P}),new Be({name:t.privateKey||P}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new He({name:t.namedCurve||P})]}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:1},value:[new Ct({name:t.publicKey||P})]})]})}fromSchema(e){Ce(e,ble);let t=be(e,e,go.schema({names:{version:zp,privateKey:Wp,namedCurve:ki,publicKey:Yu}}));if(ye.assertSchema(t,this.className),this.version=t.result.version.valueBlock.valueDec,this.privateKey=t.result.privateKey,ki in t.result&&(this.namedCurve=t.result.namedCurve.valueBlock.toString()),Yu in t.result){let n={schema:t.result.publicKey.valueBlock.valueHex};ki in this&&(n.namedCurve=this.namedCurve),this.publicKey=new Do(n)}}toSchema(){let e=[new he({value:this.version}),this.privateKey];return this.namedCurve&&e.push(new ae({idBlock:{tagClass:3,tagNumber:0},value:[new He({value:this.namedCurve})]})),this.publicKey&&e.push(new ae({idBlock:{tagClass:3,tagNumber:1},value:[new Ct({valueHex:this.publicKey.toSchema().toBER(!1)})]})),new K({value:e})}toJSON(){if(!this.namedCurve||go.compareWithDefault(ki,this.namedCurve))throw new Error('Not enough information for making JSON: absent "namedCurve" value');let e=Oc.find(this.namedCurve),t={crv:e?e.name:this.namedCurve,d:ut.ToBase64Url(this.privateKey.valueBlock.valueHexView)};if(this.publicKey){let n=this.publicKey.toJSON();t.x=n.x,t.y=n.y}return t}fromJSON(e){Jt.assert("json",e,"crv","d");let t=0,n=Oc.find(e.crv);n&&(this.namedCurve=n.id,t=n.size);let s=ut.FromBase64Url(e.d);if(s.byteLength<t){let i=new ArrayBuffer(t),a=new Uint8Array(i),u=new Uint8Array(s);a.set(u,1),this.privateKey=new Be({valueHex:i})}else this.privateKey=new Be({valueHex:s.slice(0,t)});e.x&&e.y&&(this.publicKey=new Do({json:e}))}};kR.CLASS_NAME="ECPrivateKey";var Wy="prime",Jy="exponent",Yy="coefficient",Sle=[Wy,Jy,Yy],Zb=class Qy extends Se{static{o(this,"OtherPrimeInfo")}constructor(e={}){super(),this.prime=B(e,Wy,Qy.defaultValues(Wy)),this.exponent=B(e,Jy,Qy.defaultValues(Jy)),this.coefficient=B(e,Yy,Qy.defaultValues(Yy)),e.json&&this.fromJSON(e.json),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Wy:return new he;case Jy:return new he;case Yy:return new he;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new he({name:t.prime||P}),new he({name:t.exponent||P}),new he({name:t.coefficient||P})]})}fromSchema(e){Ce(e,Sle);let t=be(e,e,Qy.schema({names:{prime:Wy,exponent:Jy,coefficient:Yy}}));ye.assertSchema(t,this.className),this.prime=t.result.prime.convertFromDER(),this.exponent=t.result.exponent.convertFromDER(),this.coefficient=t.result.coefficient.convertFromDER()}toSchema(){return new K({value:[this.prime.convertToDER(),this.exponent.convertToDER(),this.coefficient.convertToDER()]})}toJSON(){return{r:ut.ToBase64Url(this.prime.valueBlock.valueHexView),d:ut.ToBase64Url(this.exponent.valueBlock.valueHexView),t:ut.ToBase64Url(this.coefficient.valueBlock.valueHexView)}}fromJSON(e){Jt.assert("json",e,"r","d","r"),this.prime=new he({valueHex:ut.FromBase64Url(e.r)}),this.exponent=new he({valueHex:ut.FromBase64Url(e.d)}),this.coefficient=new he({valueHex:ut.FromBase64Url(e.t)})}};Zb.CLASS_NAME="OtherPrimeInfo";var Zy="version",e1="modulus",t1="publicExponent",r1="privateExponent",n1="prime1",s1="prime2",i1="exponent1",a1="exponent2",o1="coefficient",Xl="otherPrimeInfos",Ale=[Zy,e1,t1,r1,n1,s1,i1,a1,o1,Xl],LR=class fi extends Se{static{o(this,"RSAPrivateKey")}constructor(e={}){super(),this.version=B(e,Zy,fi.defaultValues(Zy)),this.modulus=B(e,e1,fi.defaultValues(e1)),this.publicExponent=B(e,t1,fi.defaultValues(t1)),this.privateExponent=B(e,r1,fi.defaultValues(r1)),this.prime1=B(e,n1,fi.defaultValues(n1)),this.prime2=B(e,s1,fi.defaultValues(s1)),this.exponent1=B(e,i1,fi.defaultValues(i1)),this.exponent2=B(e,a1,fi.defaultValues(a1)),this.coefficient=B(e,o1,fi.defaultValues(o1)),Xl in e&&(this.otherPrimeInfos=B(e,Xl,fi.defaultValues(Xl))),e.json&&this.fromJSON(e.json),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Zy:return 0;case e1:return new he;case t1:return new he;case r1:return new he;case n1:return new he;case s1:return new he;case i1:return new he;case a1:return new he;case o1:return new he;case Xl:return[];default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new he({name:t.version||P}),new he({name:t.modulus||P}),new he({name:t.publicExponent||P}),new he({name:t.privateExponent||P}),new he({name:t.prime1||P}),new he({name:t.prime2||P}),new he({name:t.exponent1||P}),new he({name:t.exponent2||P}),new he({name:t.coefficient||P}),new K({optional:!0,value:[new lt({name:t.otherPrimeInfosName||P,value:Zb.schema(t.otherPrimeInfo||{})})]})]})}fromSchema(e){Ce(e,Ale);let t=be(e,e,fi.schema({names:{version:Zy,modulus:e1,publicExponent:t1,privateExponent:r1,prime1:n1,prime2:s1,exponent1:i1,exponent2:a1,coefficient:o1,otherPrimeInfo:{names:{blockName:Xl}}}}));ye.assertSchema(t,this.className),this.version=t.result.version.valueBlock.valueDec,this.modulus=t.result.modulus.convertFromDER(256),this.publicExponent=t.result.publicExponent,this.privateExponent=t.result.privateExponent.convertFromDER(256),this.prime1=t.result.prime1.convertFromDER(128),this.prime2=t.result.prime2.convertFromDER(128),this.exponent1=t.result.exponent1.convertFromDER(128),this.exponent2=t.result.exponent2.convertFromDER(128),this.coefficient=t.result.coefficient.convertFromDER(128),Xl in t.result&&(this.otherPrimeInfos=Array.from(t.result.otherPrimeInfos,n=>new Zb({schema:n})))}toSchema(){let e=[];return e.push(new he({value:this.version})),e.push(this.modulus.convertToDER()),e.push(this.publicExponent),e.push(this.privateExponent.convertToDER()),e.push(this.prime1.convertToDER()),e.push(this.prime2.convertToDER()),e.push(this.exponent1.convertToDER()),e.push(this.exponent2.convertToDER()),e.push(this.coefficient.convertToDER()),this.otherPrimeInfos&&e.push(new K({value:Array.from(this.otherPrimeInfos,t=>t.toSchema())})),new K({value:e})}toJSON(){let e={n:ut.ToBase64Url(this.modulus.valueBlock.valueHexView),e:ut.ToBase64Url(this.publicExponent.valueBlock.valueHexView),d:ut.ToBase64Url(this.privateExponent.valueBlock.valueHexView),p:ut.ToBase64Url(this.prime1.valueBlock.valueHexView),q:ut.ToBase64Url(this.prime2.valueBlock.valueHexView),dp:ut.ToBase64Url(this.exponent1.valueBlock.valueHexView),dq:ut.ToBase64Url(this.exponent2.valueBlock.valueHexView),qi:ut.ToBase64Url(this.coefficient.valueBlock.valueHexView)};return this.otherPrimeInfos&&(e.oth=Array.from(this.otherPrimeInfos,t=>t.toJSON())),e}fromJSON(e){Jt.assert("json",e,"n","e","d","p","q","dp","dq","qi"),this.modulus=new he({valueHex:ut.FromBase64Url(e.n)}),this.publicExponent=new he({valueHex:ut.FromBase64Url(e.e)}),this.privateExponent=new he({valueHex:ut.FromBase64Url(e.d)}),this.prime1=new he({valueHex:ut.FromBase64Url(e.p)}),this.prime2=new he({valueHex:ut.FromBase64Url(e.q)}),this.exponent1=new he({valueHex:ut.FromBase64Url(e.dp)}),this.exponent2=new he({valueHex:ut.FromBase64Url(e.dq)}),this.coefficient=new he({valueHex:ut.FromBase64Url(e.qi)}),e.oth&&(this.otherPrimeInfos=Array.from(e.oth,t=>new Zb({json:t})))}};LR.CLASS_NAME="RSAPrivateKey";var u1="version",c1="privateKeyAlgorithm",l1="privateKey",Gl="attributes",yb="parsedKey",Cle=[u1,c1,l1,Gl],Yv=class zl extends Se{static{o(this,"PrivateKeyInfo")}constructor(e={}){super(),this.version=B(e,u1,zl.defaultValues(u1)),this.privateKeyAlgorithm=B(e,c1,zl.defaultValues(c1)),this.privateKey=B(e,l1,zl.defaultValues(l1)),Gl in e&&(this.attributes=B(e,Gl,zl.defaultValues(Gl))),yb in e&&(this.parsedKey=B(e,yb,zl.defaultValues(yb))),e.json&&this.fromJSON(e.json),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case u1:return 0;case c1:return new pe;case l1:return new Be;case Gl:return[];case yb:return{};default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new he({name:t.version||P}),pe.schema(t.privateKeyAlgorithm||{}),new Be({name:t.privateKey||P}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new lt({name:t.attributes||P,value:$r.schema()})]})]})}fromSchema(e){Ce(e,Cle);let t=be(e,e,zl.schema({names:{version:u1,privateKeyAlgorithm:{names:{blockName:c1}},privateKey:l1,attributes:Gl}}));switch(ye.assertSchema(t,this.className),this.version=t.result.version.valueBlock.valueDec,this.privateKeyAlgorithm=new pe({schema:t.result.privateKeyAlgorithm}),this.privateKey=t.result.privateKey,Gl in t.result&&(this.attributes=Array.from(t.result.attributes,n=>new $r({schema:n}))),this.privateKeyAlgorithm.algorithmId){case"1.2.840.113549.1.1.1":{let n=Or(this.privateKey.valueBlock.valueHexView);n.offset!==-1&&(this.parsedKey=new LR({schema:n.result}))}break;case"1.2.840.10045.2.1":if("algorithmParams"in this.privateKeyAlgorithm&&this.privateKeyAlgorithm.algorithmParams instanceof He){let n=Or(this.privateKey.valueBlock.valueHexView);n.offset!==-1&&(this.parsedKey=new kR({namedCurve:this.privateKeyAlgorithm.algorithmParams.valueBlock.toString(),schema:n.result}))}break}}toSchema(){let e=[new he({value:this.version}),this.privateKeyAlgorithm.toSchema(),this.privateKey];return this.attributes&&e.push(new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:Array.from(this.attributes,t=>t.toSchema())})),new K({value:e})}toJSON(){if(!this.parsedKey){let n={version:this.version,privateKeyAlgorithm:this.privateKeyAlgorithm.toJSON(),privateKey:this.privateKey.toJSON()};return this.attributes&&(n.attributes=Array.from(this.attributes,s=>s.toJSON())),n}let e={};switch(this.privateKeyAlgorithm.algorithmId){case"1.2.840.10045.2.1":e.kty="EC";break;case"1.2.840.113549.1.1.1":e.kty="RSA";break}let t=this.parsedKey.toJSON();return Object.assign(e,t),e}fromJSON(e){if("kty"in e){switch(e.kty.toUpperCase()){case"EC":this.parsedKey=new kR({json:e}),this.privateKeyAlgorithm=new pe({algorithmId:"1.2.840.10045.2.1",algorithmParams:new He({value:this.parsedKey.namedCurve})});break;case"RSA":this.parsedKey=new LR({json:e}),this.privateKeyAlgorithm=new pe({algorithmId:"1.2.840.113549.1.1.1",algorithmParams:new Pr});break;default:throw new Error(`Invalid value for "kty" parameter: ${e.kty}`)}this.privateKey=new Be({valueHex:this.parsedKey.toSchema().toBER(!1)})}}};Yv.CLASS_NAME="PrivateKeyInfo";var Jp="contentType",Yp="contentEncryptionAlgorithm",Wl="encryptedContent",Nle=[Jp,Yp,Wl],u7=1024,Xn=class f1 extends Se{static{o(this,"EncryptedContentInfo")}constructor(e={}){if(super(),this.contentType=B(e,Jp,f1.defaultValues(Jp)),this.contentEncryptionAlgorithm=B(e,Yp,f1.defaultValues(Yp)),Wl in e&&e.encryptedContent&&(this.encryptedContent=e.encryptedContent,this.encryptedContent.idBlock.tagClass===1&&this.encryptedContent.idBlock.tagNumber===4&&this.encryptedContent.idBlock.isConstructed===!1&&!e.disableSplit)){let t=new Be({idBlock:{isConstructed:!0},isConstructed:!0}),n=0,s=this.encryptedContent.valueBlock.valueHexView.slice().buffer,i=s.byteLength;for(;i>0;){let a=new Uint8Array(s,n,n+u7>s.byteLength?s.byteLength-n:u7),u=new ArrayBuffer(a.length),c=new Uint8Array(u);for(let l=0;l<c.length;l++)c[l]=a[l];t.valueBlock.value.push(new Be({valueHex:u})),i-=a.length,n+=a.length}this.encryptedContent=t}e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Jp:return P;case Yp:return new pe;case Wl:return new Be;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Jp:return t===P;case Yp:return t.algorithmId===P&&!("algorithmParams"in t);case Wl:return t.isEqual(f1.defaultValues(Wl));default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new He({name:t.contentType||P}),pe.schema(t.contentEncryptionAlgorithm||{}),new Sr({value:[new ae({name:t.encryptedContent||P,idBlock:{tagClass:3,tagNumber:0},value:[new lt({value:new Be})]}),new tt({name:t.encryptedContent||P,idBlock:{tagClass:3,tagNumber:0}})]})]})}fromSchema(e){Ce(e,Nle);let t=be(e,e,f1.schema({names:{contentType:Jp,contentEncryptionAlgorithm:{names:{blockName:Yp}},encryptedContent:Wl}}));ye.assertSchema(t,this.className),this.contentType=t.result.contentType.valueBlock.toString(),this.contentEncryptionAlgorithm=new pe({schema:t.result.contentEncryptionAlgorithm}),Wl in t.result&&(this.encryptedContent=t.result.encryptedContent,this.encryptedContent.idBlock.tagClass=1,this.encryptedContent.idBlock.tagNumber=4)}toSchema(){let e={isIndefiniteForm:!1},t=[];if(t.push(new He({value:this.contentType})),t.push(this.contentEncryptionAlgorithm.toSchema()),this.encryptedContent){e.isIndefiniteForm=this.encryptedContent.idBlock.isConstructed;let n=this.encryptedContent;n.idBlock.tagClass=3,n.idBlock.tagNumber=0,n.lenBlock.isIndefiniteForm=this.encryptedContent.idBlock.isConstructed,t.push(n)}return new K({lenBlock:e,value:t})}toJSON(){let e={contentType:this.contentType,contentEncryptionAlgorithm:this.contentEncryptionAlgorithm.toJSON()};return this.encryptedContent&&(e.encryptedContent=this.encryptedContent.toJSON()),e}getEncryptedContent(){if(!this.encryptedContent)throw new Error("Parameter 'encryptedContent' is undefined");return Be.prototype.getValue.call(this.encryptedContent)}};Xn.CLASS_NAME="EncryptedContentInfo";var Qu="hashAlgorithm",Zu="maskGenAlgorithm",ec="saltLength",tc="trailerField",Tle=[Qu,Zu,ec,tc],eS=class Cs extends Se{static{o(this,"RSASSAPSSParams")}constructor(e={}){super(),this.hashAlgorithm=B(e,Qu,Cs.defaultValues(Qu)),this.maskGenAlgorithm=B(e,Zu,Cs.defaultValues(Zu)),this.saltLength=B(e,ec,Cs.defaultValues(ec)),this.trailerField=B(e,tc,Cs.defaultValues(tc)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Qu:return new pe({algorithmId:"1.3.14.3.2.26",algorithmParams:new Pr});case Zu:return new pe({algorithmId:"1.2.840.113549.1.1.8",algorithmParams:new pe({algorithmId:"1.3.14.3.2.26",algorithmParams:new Pr}).toSchema()});case ec:return 20;case tc:return 1;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new ae({idBlock:{tagClass:3,tagNumber:0},optional:!0,value:[pe.schema(t.hashAlgorithm||{})]}),new ae({idBlock:{tagClass:3,tagNumber:1},optional:!0,value:[pe.schema(t.maskGenAlgorithm||{})]}),new ae({idBlock:{tagClass:3,tagNumber:2},optional:!0,value:[new he({name:t.saltLength||P})]}),new ae({idBlock:{tagClass:3,tagNumber:3},optional:!0,value:[new he({name:t.trailerField||P})]})]})}fromSchema(e){Ce(e,Tle);let t=be(e,e,Cs.schema({names:{hashAlgorithm:{names:{blockName:Qu}},maskGenAlgorithm:{names:{blockName:Zu}},saltLength:ec,trailerField:tc}}));ye.assertSchema(t,this.className),Qu in t.result&&(this.hashAlgorithm=new pe({schema:t.result.hashAlgorithm})),Zu in t.result&&(this.maskGenAlgorithm=new pe({schema:t.result.maskGenAlgorithm})),ec in t.result&&(this.saltLength=t.result.saltLength.valueBlock.valueDec),tc in t.result&&(this.trailerField=t.result.trailerField.valueBlock.valueDec)}toSchema(){let e=[];return this.hashAlgorithm.isEqual(Cs.defaultValues(Qu))||e.push(new ae({idBlock:{tagClass:3,tagNumber:0},value:[this.hashAlgorithm.toSchema()]})),this.maskGenAlgorithm.isEqual(Cs.defaultValues(Zu))||e.push(new ae({idBlock:{tagClass:3,tagNumber:1},value:[this.maskGenAlgorithm.toSchema()]})),this.saltLength!==Cs.defaultValues(ec)&&e.push(new ae({idBlock:{tagClass:3,tagNumber:2},value:[new he({value:this.saltLength})]})),this.trailerField!==Cs.defaultValues(tc)&&e.push(new ae({idBlock:{tagClass:3,tagNumber:3},value:[new he({value:this.trailerField})]})),new K({value:e})}toJSON(){let e={};return this.hashAlgorithm.isEqual(Cs.defaultValues(Qu))||(e.hashAlgorithm=this.hashAlgorithm.toJSON()),this.maskGenAlgorithm.isEqual(Cs.defaultValues(Zu))||(e.maskGenAlgorithm=this.maskGenAlgorithm.toJSON()),this.saltLength!==Cs.defaultValues(ec)&&(e.saltLength=this.saltLength),this.trailerField!==Cs.defaultValues(tc)&&(e.trailerField=this.trailerField),e}};eS.CLASS_NAME="RSASSAPSSParams";var Qp="salt",h1="iterationCount",Li="keyLength",yo="prf",Ile=[Qp,h1,Li,yo],vm=class Ea extends Se{static{o(this,"PBKDF2Params")}constructor(e={}){super(),this.salt=B(e,Qp,Ea.defaultValues(Qp)),this.iterationCount=B(e,h1,Ea.defaultValues(h1)),Li in e&&(this.keyLength=B(e,Li,Ea.defaultValues(Li))),yo in e&&(this.prf=B(e,yo,Ea.defaultValues(yo))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Qp:return{};case h1:return-1;case Li:return 0;case yo:return new pe({algorithmId:"1.3.14.3.2.26",algorithmParams:new Pr});default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new Sr({value:[new Be({name:t.saltPrimitive||P}),pe.schema(t.saltConstructed||{})]}),new he({name:t.iterationCount||P}),new he({name:t.keyLength||P,optional:!0}),pe.schema(t.prf||{names:{optional:!0}})]})}fromSchema(e){Ce(e,Ile);let t=be(e,e,Ea.schema({names:{saltPrimitive:Qp,saltConstructed:{names:{blockName:Qp}},iterationCount:h1,keyLength:Li,prf:{names:{blockName:yo,optional:!0}}}}));ye.assertSchema(t,this.className),this.salt=t.result.salt,this.iterationCount=t.result.iterationCount.valueBlock.valueDec,Li in t.result&&(this.keyLength=t.result.keyLength.valueBlock.valueDec),yo in t.result&&(this.prf=new pe({schema:t.result.prf}))}toSchema(){let e=[];return e.push(this.salt),e.push(new he({value:this.iterationCount})),Li in this&&Ea.defaultValues(Li)!==this.keyLength&&e.push(new he({value:this.keyLength})),this.prf&&Ea.defaultValues(yo).isEqual(this.prf)===!1&&e.push(this.prf.toSchema()),new K({value:e})}toJSON(){let e={salt:this.salt.toJSON(),iterationCount:this.iterationCount};return Li in this&&Ea.defaultValues(Li)!==this.keyLength&&(e.keyLength=this.keyLength),this.prf&&Ea.defaultValues(yo).isEqual(this.prf)===!1&&(e.prf=this.prf.toJSON()),e}};vm.CLASS_NAME="PBKDF2Params";var p1="keyDerivationFunc",d1="encryptionScheme",Dle=[p1,d1],FR=class tS extends Se{static{o(this,"PBES2Params")}constructor(e={}){super(),this.keyDerivationFunc=B(e,p1,tS.defaultValues(p1)),this.encryptionScheme=B(e,d1,tS.defaultValues(d1)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case p1:return new pe;case d1:return new pe;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[pe.schema(t.keyDerivationFunc||{}),pe.schema(t.encryptionScheme||{})]})}fromSchema(e){Ce(e,Dle);let t=be(e,e,tS.schema({names:{keyDerivationFunc:{names:{blockName:p1}},encryptionScheme:{names:{blockName:d1}}}}));ye.assertSchema(t,this.className),this.keyDerivationFunc=new pe({schema:t.result.keyDerivationFunc}),this.encryptionScheme=new pe({schema:t.result.encryptionScheme})}toSchema(){return new K({value:[this.keyDerivationFunc.toSchema(),this.encryptionScheme.toSchema()]})}toJSON(){return{keyDerivationFunc:this.keyDerivationFunc.toJSON(),encryptionScheme:this.encryptionScheme.toJSON()}}};FR.CLASS_NAME="PBES2Params";var Ble=class{static{o(this,"AbstractCryptoEngine")}constructor(e){this.crypto=e.crypto,this.subtle="webkitSubtle"in e.crypto?e.crypto.webkitSubtle:e.crypto.subtle,this.name=B(e,"name",P)}async encrypt(...e){return this.subtle.encrypt(...e)}async decrypt(...e){return this.subtle.decrypt(...e)}sign(...e){return this.subtle.sign(...e)}async verify(...e){return this.subtle.verify(...e)}async digest(...e){return this.subtle.digest(...e)}async generateKey(...e){return this.subtle.generateKey(...e)}async deriveKey(...e){return this.subtle.deriveKey(...e)}async deriveBits(...e){return this.subtle.deriveBits(...e)}async wrapKey(...e){return this.subtle.wrapKey(...e)}async unwrapKey(...e){return this.subtle.unwrapKey(...e)}exportKey(...e){return this.subtle.exportKey(...e)}importKey(...e){return this.subtle.importKey(...e)}getRandomValues(e){if(e===null)throw new Error('Argument "array" must not be null');return this.crypto.getRandomValues(e)}};async function c7(r,e,t,n,s){let i,a,u;switch(r.toUpperCase()){case"SHA-1":i=20,a=64,u=t7;break;case"SHA-256":i=32,a=64,u=OB;break;case"SHA-384":i=48,a=128,u=LB;break;case"SHA-512":i=64,a=128,u=kB;break;default:throw new Error("Unsupported hashing algorithm")}let c=new Uint8Array(t),l=new TextDecoder().decode(t);new TextEncoder().encode(l).some((x,b)=>x!==c[b])&&(l=String.fromCharCode(...c));let h=new Uint8Array(l.length*2+2),d=new DataView(h.buffer);for(let x=0;x<l.length;x++)d.setUint16(x*2,l.charCodeAt(x),!1);d.setUint16(l.length*2,0,!1);let g=new Uint8Array(a).fill(3),m=new Uint8Array(n),v=new Uint8Array(a*Math.ceil(m.length/a)).map((x,b)=>m[b%m.length]),y=new Uint8Array(a*Math.ceil(h.length/a)).map((x,b)=>h[b%h.length]),w=new Uint8Array(v.length+y.length);w.set(v),w.set(y,v.length);let S=Math.ceil((e>>3)/i),E=[];for(let x=0;x<S;x++){let b=new Uint8Array(g.length+w.length);b.set(g),b.set(w,g.length);for(let T=0;T<s;T++)b=u(b);let A=new Uint8Array(a).map((T,V)=>b[V%b.length]),k=Math.ceil(m.length/a)+Math.ceil(h.length/a),I=[];for(let T=0;T<k;T++){let V=Array.from(w.slice(T*a,(T+1)*a)),U=511;for(let M=A.length-1;M>=0;M--)U>>=8,U+=A[M]+(V[M]||0),V[M]=U&255;I.push(...V)}w=new Uint8Array(I),E.push(...b)}return new Uint8Array(E.slice(0,e>>3)).buffer}o(c7,"makePKCS12B2Key");function Q7(r){let e=typeof r=="string"?{name:r}:r;return"hash"in e?{...e,hash:Q7(e.hash)}:e}o(Q7,"prepareAlgorithm");var Em=class extends Ble{static{o(this,"CryptoEngine")}async importKey(e,t,n,s,i){var a,u,c,l,f,h;let d={},g=Q7(n);switch(e.toLowerCase()){case"raw":return this.subtle.importKey("raw",t,n,s,i);case"spki":{let m=Or(Ze.toArrayBuffer(t));ye.assert(m,"keyData");let v=new qi;try{v.fromSchema(m.result)}catch{throw new hr("Incorrect keyData")}switch(g.name.toUpperCase()){case"RSA-PSS":{if(i=["verify"],d.kty="RSA",d.ext=s,d.key_ops=i,!["1.2.840.113549.1.1.1","1.2.840.113549.1.1.10"].includes(v.algorithm.algorithmId))throw new Error(`Incorrect public key algorithm: ${v.algorithm.algorithmId}`);if(!g.hash)throw new Jt("hash","algorithm.hash","Incorrect hash algorithm: Hash algorithm is missed");switch(g.hash.name.toUpperCase()){case"SHA-1":d.alg="PS1";break;case"SHA-256":d.alg="PS256";break;case"SHA-384":d.alg="PS384";break;case"SHA-512":d.alg="PS512";break;default:throw new Error(`Incorrect hash algorithm: ${g.hash.name.toUpperCase()}`)}let y=v.toJSON();Object.assign(d,y)}break;case"RSASSA-PKCS1-V1_5":{if(i=["verify"],d.kty="RSA",d.ext=s,d.key_ops=i,v.algorithm.algorithmId!=="1.2.840.113549.1.1.1")throw new Error(`Incorrect public key algorithm: ${v.algorithm.algorithmId}`);if(!g.hash)throw new Jt("hash","algorithm.hash","Incorrect hash algorithm: Hash algorithm is missed");switch(g.hash.name.toUpperCase()){case"SHA-1":d.alg="RS1";break;case"SHA-256":d.alg="RS256";break;case"SHA-384":d.alg="RS384";break;case"SHA-512":d.alg="RS512";break;default:throw new Error(`Incorrect hash algorithm: ${g.hash.name.toUpperCase()}`)}let y=v.toJSON();Object.assign(d,y)}break;case"ECDSA":i=["verify"];case"ECDH":{if(d={kty:"EC",ext:s,key_ops:i},v.algorithm.algorithmId!=="1.2.840.10045.2.1")throw new Error(`Incorrect public key algorithm: ${v.algorithm.algorithmId}`);let y=v.toJSON();Object.assign(d,y)}break;case"RSA-OAEP":{if(d.kty="RSA",d.ext=s,d.key_ops=i,this.name.toLowerCase()==="safari")d.alg="RSA-OAEP";else{if(!g.hash)throw new Jt("hash","algorithm.hash","Incorrect hash algorithm: Hash algorithm is missed");switch(g.hash.name.toUpperCase()){case"SHA-1":d.alg="RSA-OAEP";break;case"SHA-256":d.alg="RSA-OAEP-256";break;case"SHA-384":d.alg="RSA-OAEP-384";break;case"SHA-512":d.alg="RSA-OAEP-512";break;default:throw new Error(`Incorrect hash algorithm: ${g.hash.name.toUpperCase()}`)}}let y=v.toJSON();Object.assign(d,y)}break;case"RSAES-PKCS1-V1_5":{d.kty="RSA",d.ext=s,d.key_ops=i,d.alg="PS1";let y=v.toJSON();Object.assign(d,y)}break;default:throw new Error(`Incorrect algorithm name: ${g.name.toUpperCase()}`)}}break;case"pkcs8":{let m=new Yv,v=Or(Ze.toArrayBuffer(t));ye.assert(v,"keyData");try{m.fromSchema(v.result)}catch{throw new Error("Incorrect keyData")}if(!m.parsedKey)throw new Error("Incorrect keyData");switch(g.name.toUpperCase()){case"RSA-PSS":switch((a=g.hash)===null||a===void 0?void 0:a.name.toUpperCase()){case"SHA-1":d.alg="PS1";break;case"SHA-256":d.alg="PS256";break;case"SHA-384":d.alg="PS384";break;case"SHA-512":d.alg="PS512";break;default:throw new Error(`Incorrect hash algorithm: ${(u=g.hash)===null||u===void 0?void 0:u.name.toUpperCase()}`)}case"RSASSA-PKCS1-V1_5":{if(i=["sign"],d.kty="RSA",d.ext=s,d.key_ops=i,m.privateKeyAlgorithm.algorithmId!=="1.2.840.113549.1.1.1")throw new Error(`Incorrect private key algorithm: ${m.privateKeyAlgorithm.algorithmId}`);if(!("alg"in d))switch((c=g.hash)===null||c===void 0?void 0:c.name.toUpperCase()){case"SHA-1":d.alg="RS1";break;case"SHA-256":d.alg="RS256";break;case"SHA-384":d.alg="RS384";break;case"SHA-512":d.alg="RS512";break;default:throw new Error(`Incorrect hash algorithm: ${(l=g.hash)===null||l===void 0?void 0:l.name.toUpperCase()}`)}let y=m.toJSON();Object.assign(d,y)}break;case"ECDSA":i=["sign"];case"ECDH":{if(d={kty:"EC",ext:s,key_ops:i},m.privateKeyAlgorithm.algorithmId!=="1.2.840.10045.2.1")throw new Error(`Incorrect algorithm: ${m.privateKeyAlgorithm.algorithmId}`);let y=m.toJSON();Object.assign(d,y)}break;case"RSA-OAEP":{if(d.kty="RSA",d.ext=s,d.key_ops=i,this.name.toLowerCase()==="safari")d.alg="RSA-OAEP";else switch((f=g.hash)===null||f===void 0?void 0:f.name.toUpperCase()){case"SHA-1":d.alg="RSA-OAEP";break;case"SHA-256":d.alg="RSA-OAEP-256";break;case"SHA-384":d.alg="RSA-OAEP-384";break;case"SHA-512":d.alg="RSA-OAEP-512";break;default:throw new Error(`Incorrect hash algorithm: ${(h=g.hash)===null||h===void 0?void 0:h.name.toUpperCase()}`)}let y=m.toJSON();Object.assign(d,y)}break;case"RSAES-PKCS1-V1_5":{i=["decrypt"],d.kty="RSA",d.ext=s,d.key_ops=i,d.alg="PS1";let y=m.toJSON();Object.assign(d,y)}break;default:throw new Error(`Incorrect algorithm name: ${g.name.toUpperCase()}`)}}break;case"jwk":d=t;break;default:throw new Error(`Incorrect format: ${e}`)}if(this.name.toLowerCase()==="safari")try{return this.subtle.importKey("jwk",Cl(JSON.stringify(d)),n,s,i)}catch{return this.subtle.importKey("jwk",d,n,s,i)}return this.subtle.importKey("jwk",d,n,s,i)}async exportKey(e,t){let n=await this.subtle.exportKey("jwk",t);switch(this.name.toLowerCase()==="safari"&&n instanceof ArrayBuffer&&(n=JSON.parse(Qg(n))),e.toLowerCase()){case"raw":return this.subtle.exportKey("raw",t);case"spki":{let s=new qi;try{s.fromJSON(n)}catch{throw new Error("Incorrect key data")}return s.toSchema().toBER(!1)}case"pkcs8":{let s=new Yv;try{s.fromJSON(n)}catch{throw new Error("Incorrect key data")}return s.toSchema().toBER(!1)}case"jwk":return n;default:throw new Error(`Incorrect format: ${e}`)}}async convert(e,t,n,s,i,a){if(e.toLowerCase()===t.toLowerCase())return n;let u=await this.importKey(e,n,s,i,a);return this.exportKey(t,u)}getAlgorithmByOID(e,t=!1,n){switch(e){case"1.2.840.113549.1.1.1":return{name:"RSAES-PKCS1-v1_5"};case"1.2.840.113549.1.1.5":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-1"}};case"1.2.840.113549.1.1.11":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"1.2.840.113549.1.1.12":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-384"}};case"1.2.840.113549.1.1.13":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-512"}};case"1.2.840.113549.1.1.10":return{name:"RSA-PSS"};case"1.2.840.113549.1.1.7":return{name:"RSA-OAEP"};case"1.2.840.10045.2.1":case"1.2.840.10045.4.1":return{name:"ECDSA",hash:{name:"SHA-1"}};case"1.2.840.10045.4.3.2":return{name:"ECDSA",hash:{name:"SHA-256"}};case"1.2.840.10045.4.3.3":return{name:"ECDSA",hash:{name:"SHA-384"}};case"1.2.840.10045.4.3.4":return{name:"ECDSA",hash:{name:"SHA-512"}};case"1.3.133.16.840.63.0.2":return{name:"ECDH",kdf:"SHA-1"};case"1.3.132.1.11.1":return{name:"ECDH",kdf:"SHA-256"};case"1.3.132.1.11.2":return{name:"ECDH",kdf:"SHA-384"};case"1.3.132.1.11.3":return{name:"ECDH",kdf:"SHA-512"};case"2.16.840.1.101.3.4.1.2":return{name:"AES-CBC",length:128};case"2.16.840.1.101.3.4.1.22":return{name:"AES-CBC",length:192};case"2.16.840.1.101.3.4.1.42":return{name:"AES-CBC",length:256};case"2.16.840.1.101.3.4.1.6":return{name:"AES-GCM",length:128};case"2.16.840.1.101.3.4.1.26":return{name:"AES-GCM",length:192};case"2.16.840.1.101.3.4.1.46":return{name:"AES-GCM",length:256};case"2.16.840.1.101.3.4.1.4":return{name:"AES-CFB",length:128};case"2.16.840.1.101.3.4.1.24":return{name:"AES-CFB",length:192};case"2.16.840.1.101.3.4.1.44":return{name:"AES-CFB",length:256};case"2.16.840.1.101.3.4.1.5":return{name:"AES-KW",length:128};case"2.16.840.1.101.3.4.1.25":return{name:"AES-KW",length:192};case"2.16.840.1.101.3.4.1.45":return{name:"AES-KW",length:256};case"1.2.840.113549.2.7":return{name:"HMAC",hash:{name:"SHA-1"}};case"1.2.840.113549.2.9":return{name:"HMAC",hash:{name:"SHA-256"}};case"1.2.840.113549.2.10":return{name:"HMAC",hash:{name:"SHA-384"}};case"1.2.840.113549.2.11":return{name:"HMAC",hash:{name:"SHA-512"}};case"1.2.840.113549.1.9.16.3.5":return{name:"DH"};case"1.3.14.3.2.26":return{name:"SHA-1"};case"2.16.840.1.101.3.4.2.1":return{name:"SHA-256"};case"2.16.840.1.101.3.4.2.2":return{name:"SHA-384"};case"2.16.840.1.101.3.4.2.3":return{name:"SHA-512"};case"1.2.840.113549.1.5.12":return{name:"PBKDF2"};case"1.2.840.10045.3.1.7":return{name:"P-256"};case"1.3.132.0.34":return{name:"P-384"};case"1.3.132.0.35":return{name:"P-521"}}if(t)throw new Error(`Unsupported algorithm identifier ${n?`for ${n} `:P}: ${e}`);return{}}getOIDByAlgorithm(e,t=!1,n){let s=P;switch(e.name.toUpperCase()){case"RSAES-PKCS1-V1_5":s="1.2.840.113549.1.1.1";break;case"RSASSA-PKCS1-V1_5":switch(e.hash.name.toUpperCase()){case"SHA-1":s="1.2.840.113549.1.1.5";break;case"SHA-256":s="1.2.840.113549.1.1.11";break;case"SHA-384":s="1.2.840.113549.1.1.12";break;case"SHA-512":s="1.2.840.113549.1.1.13";break}break;case"RSA-PSS":s="1.2.840.113549.1.1.10";break;case"RSA-OAEP":s="1.2.840.113549.1.1.7";break;case"ECDSA":switch(e.hash.name.toUpperCase()){case"SHA-1":s="1.2.840.10045.4.1";break;case"SHA-256":s="1.2.840.10045.4.3.2";break;case"SHA-384":s="1.2.840.10045.4.3.3";break;case"SHA-512":s="1.2.840.10045.4.3.4";break}break;case"ECDH":switch(e.kdf.toUpperCase()){case"SHA-1":s="1.3.133.16.840.63.0.2";break;case"SHA-256":s="1.3.132.1.11.1";break;case"SHA-384":s="1.3.132.1.11.2";break;case"SHA-512":s="1.3.132.1.11.3";break}break;case"AES-CTR":break;case"AES-CBC":switch(e.length){case 128:s="2.16.840.1.101.3.4.1.2";break;case 192:s="2.16.840.1.101.3.4.1.22";break;case 256:s="2.16.840.1.101.3.4.1.42";break}break;case"AES-CMAC":break;case"AES-GCM":switch(e.length){case 128:s="2.16.840.1.101.3.4.1.6";break;case 192:s="2.16.840.1.101.3.4.1.26";break;case 256:s="2.16.840.1.101.3.4.1.46";break}break;case"AES-CFB":switch(e.length){case 128:s="2.16.840.1.101.3.4.1.4";break;case 192:s="2.16.840.1.101.3.4.1.24";break;case 256:s="2.16.840.1.101.3.4.1.44";break}break;case"AES-KW":switch(e.length){case 128:s="2.16.840.1.101.3.4.1.5";break;case 192:s="2.16.840.1.101.3.4.1.25";break;case 256:s="2.16.840.1.101.3.4.1.45";break}break;case"HMAC":switch(e.hash.name.toUpperCase()){case"SHA-1":s="1.2.840.113549.2.7";break;case"SHA-256":s="1.2.840.113549.2.9";break;case"SHA-384":s="1.2.840.113549.2.10";break;case"SHA-512":s="1.2.840.113549.2.11";break}break;case"DH":s="1.2.840.113549.1.9.16.3.5";break;case"SHA-1":s="1.3.14.3.2.26";break;case"SHA-256":s="2.16.840.1.101.3.4.2.1";break;case"SHA-384":s="2.16.840.1.101.3.4.2.2";break;case"SHA-512":s="2.16.840.1.101.3.4.2.3";break;case"CONCAT":break;case"HKDF":break;case"PBKDF2":s="1.2.840.113549.1.5.12";break;case"P-256":s="1.2.840.10045.3.1.7";break;case"P-384":s="1.3.132.0.34";break;case"P-521":s="1.3.132.0.35";break}if(!s&&t)throw new Error(`Unsupported algorithm ${n?`for ${n} `:P}: ${e.name}`);return s}getAlgorithmParameters(e,t){let n={algorithm:{},usages:[]};switch(e.toUpperCase()){case"RSAES-PKCS1-V1_5":case"RSASSA-PKCS1-V1_5":switch(t.toLowerCase()){case"generatekey":n={algorithm:{name:"RSASSA-PKCS1-v1_5",modulusLength:2048,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},usages:["sign","verify"]};break;case"verify":case"sign":case"importkey":n={algorithm:{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},usages:["verify"]};break;case"exportkey":default:return{algorithm:{name:"RSASSA-PKCS1-v1_5"},usages:[]}}break;case"RSA-PSS":switch(t.toLowerCase()){case"sign":case"verify":n={algorithm:{name:"RSA-PSS",hash:{name:"SHA-1"},saltLength:20},usages:["sign","verify"]};break;case"generatekey":n={algorithm:{name:"RSA-PSS",modulusLength:2048,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-1"}},usages:["sign","verify"]};break;case"importkey":n={algorithm:{name:"RSA-PSS",hash:{name:"SHA-1"}},usages:["verify"]};break;case"exportkey":default:return{algorithm:{name:"RSA-PSS"},usages:[]}}break;case"RSA-OAEP":switch(t.toLowerCase()){case"encrypt":case"decrypt":n={algorithm:{name:"RSA-OAEP"},usages:["encrypt","decrypt"]};break;case"generatekey":n={algorithm:{name:"RSA-OAEP",modulusLength:2048,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},usages:["encrypt","decrypt","wrapKey","unwrapKey"]};break;case"importkey":n={algorithm:{name:"RSA-OAEP",hash:{name:"SHA-256"}},usages:["encrypt"]};break;case"exportkey":default:return{algorithm:{name:"RSA-OAEP"},usages:[]}}break;case"ECDSA":switch(t.toLowerCase()){case"generatekey":n={algorithm:{name:"ECDSA",namedCurve:"P-256"},usages:["sign","verify"]};break;case"importkey":n={algorithm:{name:"ECDSA",namedCurve:"P-256"},usages:["verify"]};break;case"verify":case"sign":n={algorithm:{name:"ECDSA",hash:{name:"SHA-256"}},usages:["sign"]};break;default:return{algorithm:{name:"ECDSA"},usages:[]}}break;case"ECDH":switch(t.toLowerCase()){case"exportkey":case"importkey":case"generatekey":n={algorithm:{name:"ECDH",namedCurve:"P-256"},usages:["deriveKey","deriveBits"]};break;case"derivekey":case"derivebits":n={algorithm:{name:"ECDH",namedCurve:"P-256",public:[]},usages:["encrypt","decrypt"]};break;default:return{algorithm:{name:"ECDH"},usages:[]}}break;case"AES-CTR":switch(t.toLowerCase()){case"importkey":case"exportkey":case"generatekey":n={algorithm:{name:"AES-CTR",length:256},usages:["encrypt","decrypt","wrapKey","unwrapKey"]};break;case"decrypt":case"encrypt":n={algorithm:{name:"AES-CTR",counter:new Uint8Array(16),length:10},usages:["encrypt","decrypt","wrapKey","unwrapKey"]};break;default:return{algorithm:{name:"AES-CTR"},usages:[]}}break;case"AES-CBC":switch(t.toLowerCase()){case"importkey":case"exportkey":case"generatekey":n={algorithm:{name:"AES-CBC",length:256},usages:["encrypt","decrypt","wrapKey","unwrapKey"]};break;case"decrypt":case"encrypt":n={algorithm:{name:"AES-CBC",iv:this.getRandomValues(new Uint8Array(16))},usages:["encrypt","decrypt","wrapKey","unwrapKey"]};break;default:return{algorithm:{name:"AES-CBC"},usages:[]}}break;case"AES-GCM":switch(t.toLowerCase()){case"importkey":case"exportkey":case"generatekey":n={algorithm:{name:"AES-GCM",length:256},usages:["encrypt","decrypt","wrapKey","unwrapKey"]};break;case"decrypt":case"encrypt":n={algorithm:{name:"AES-GCM",iv:this.getRandomValues(new Uint8Array(16))},usages:["encrypt","decrypt","wrapKey","unwrapKey"]};break;default:return{algorithm:{name:"AES-GCM"},usages:[]}}break;case"AES-KW":switch(t.toLowerCase()){case"importkey":case"exportkey":case"generatekey":case"wrapkey":case"unwrapkey":n={algorithm:{name:"AES-KW",length:256},usages:["wrapKey","unwrapKey"]};break;default:return{algorithm:{name:"AES-KW"},usages:[]}}break;case"HMAC":switch(t.toLowerCase()){case"sign":case"verify":n={algorithm:{name:"HMAC"},usages:["sign","verify"]};break;case"importkey":case"exportkey":case"generatekey":n={algorithm:{name:"HMAC",length:32,hash:{name:"SHA-256"}},usages:["sign","verify"]};break;default:return{algorithm:{name:"HMAC"},usages:[]}}break;case"HKDF":switch(t.toLowerCase()){case"derivekey":n={algorithm:{name:"HKDF",hash:"SHA-256",salt:new Uint8Array([]),info:new Uint8Array([])},usages:["encrypt","decrypt"]};break;default:return{algorithm:{name:"HKDF"},usages:[]}}break;case"PBKDF2":switch(t.toLowerCase()){case"derivekey":n={algorithm:{name:"PBKDF2",hash:{name:"SHA-256"},salt:new Uint8Array([]),iterations:1e4},usages:["encrypt","decrypt"]};break;default:return{algorithm:{name:"PBKDF2"},usages:[]}}break}return n}getHashAlgorithm(e){let t=P;switch(e.algorithmId){case"1.2.840.10045.4.1":case"1.2.840.113549.1.1.5":t="SHA-1";break;case"1.2.840.10045.4.3.2":case"1.2.840.113549.1.1.11":t="SHA-256";break;case"1.2.840.10045.4.3.3":case"1.2.840.113549.1.1.12":t="SHA-384";break;case"1.2.840.10045.4.3.4":case"1.2.840.113549.1.1.13":t="SHA-512";break;case"1.2.840.113549.1.1.10":try{let n=new eS({schema:e.algorithmParams});if(n.hashAlgorithm){let s=this.getAlgorithmByOID(n.hashAlgorithm.algorithmId);if("name"in s)t=s.name;else return P}else t="SHA-1"}catch{}break}return t}async encryptEncryptedContentInfo(e){Jt.assert(e,"password","contentEncryptionAlgorithm","hmacHashAlgorithm","iterationCount","contentToEncrypt","contentToEncrypt","contentType");let t=this.getOIDByAlgorithm(e.contentEncryptionAlgorithm,!0,"contentEncryptionAlgorithm"),n=this.getOIDByAlgorithm({name:"PBKDF2"},!0,"PBKDF2"),s=this.getOIDByAlgorithm({name:"HMAC",hash:{name:e.hmacHashAlgorithm}},!0,"hmacHashAlgorithm"),i=new ArrayBuffer(16),a=new Uint8Array(i);this.getRandomValues(a);let u=new ArrayBuffer(64),c=new Uint8Array(u);this.getRandomValues(c);let l=new Uint8Array(e.contentToEncrypt),f=new vm({salt:new Be({valueHex:u}),iterationCount:e.iterationCount,prf:new pe({algorithmId:s,algorithmParams:new Pr})}),h=new Uint8Array(e.password),d=await this.importKey("raw",h,"PBKDF2",!1,["deriveKey"]),g=await this.deriveKey({name:"PBKDF2",hash:{name:e.hmacHashAlgorithm},salt:c,iterations:e.iterationCount},d,e.contentEncryptionAlgorithm,!1,["encrypt"]),m=await this.encrypt({name:e.contentEncryptionAlgorithm.name,iv:a},g,l),v=new FR({keyDerivationFunc:new pe({algorithmId:n,algorithmParams:f.toSchema()}),encryptionScheme:new pe({algorithmId:t,algorithmParams:new Be({valueHex:i})})});return new Xn({contentType:e.contentType,contentEncryptionAlgorithm:new pe({algorithmId:"1.2.840.113549.1.5.13",algorithmParams:v.toSchema()}),encryptedContent:new Be({valueHex:m})})}async decryptEncryptedContentInfo(e){if(Jt.assert(e,"password","encryptedContentInfo"),e.encryptedContentInfo.contentEncryptionAlgorithm.algorithmId!=="1.2.840.113549.1.5.13")throw new Error(`Unknown "contentEncryptionAlgorithm": ${e.encryptedContentInfo.contentEncryptionAlgorithm.algorithmId}`);let t;try{t=new FR({schema:e.encryptedContentInfo.contentEncryptionAlgorithm.algorithmParams})}catch{throw new Error('Incorrectly encoded "pbes2Parameters"')}let n;try{n=new vm({schema:t.keyDerivationFunc.algorithmParams})}catch{throw new Error('Incorrectly encoded "pbkdf2Params"')}let s=this.getAlgorithmByOID(t.encryptionScheme.algorithmId,!0),i=t.encryptionScheme.algorithmParams.valueBlock.valueHex,a=new Uint8Array(i),u=n.salt.valueBlock.valueHex,c=new Uint8Array(u),l=n.iterationCount,f="SHA-1";n.prf&&(f=this.getAlgorithmByOID(n.prf.algorithmId,!0).hash.name);let h=await this.importKey("raw",e.password,"PBKDF2",!1,["deriveKey"]),d=await this.deriveKey({name:"PBKDF2",hash:{name:f},salt:c,iterations:l},h,s,!1,["decrypt"]),g=e.encryptedContentInfo.getEncryptedContent();return this.decrypt({name:s.name,iv:a},d,g)}async stampDataWithPassword(e){if(!(e instanceof Object))throw new Error('Parameters must have type "Object"');Jt.assert(e,"password","hashAlgorithm","iterationCount","salt","contentToStamp");let t;switch(e.hashAlgorithm.toLowerCase()){case"sha-1":t=160;break;case"sha-256":t=256;break;case"sha-384":t=384;break;case"sha-512":t=512;break;default:throw new Error(`Incorrect "parameters.hashAlgorithm" parameter: ${e.hashAlgorithm}`)}let n={name:"HMAC",length:t,hash:{name:e.hashAlgorithm}},s=await c7(e.hashAlgorithm,t,e.password,e.salt,e.iterationCount),i=await this.importKey("raw",new Uint8Array(s),n,!1,["sign"]);return this.sign(n,i,new Uint8Array(e.contentToStamp))}async verifyDataStampedWithPassword(e){Jt.assert(e,"password","hashAlgorithm","salt","iterationCount","contentToVerify","signatureToVerify");let t=0;switch(e.hashAlgorithm.toLowerCase()){case"sha-1":t=160;break;case"sha-256":t=256;break;case"sha-384":t=384;break;case"sha-512":t=512;break;default:throw new Error(`Incorrect "parameters.hashAlgorithm" parameter: ${e.hashAlgorithm}`)}let n={name:"HMAC",length:t,hash:{name:e.hashAlgorithm}},s=await c7(e.hashAlgorithm,t,e.password,e.salt,e.iterationCount),i=await this.importKey("raw",new Uint8Array(s),n,!1,["verify"]);return this.verify(n,i,new Uint8Array(e.signatureToVerify),new Uint8Array(e.contentToVerify))}async getSignatureParameters(e,t="SHA-1"){this.getOIDByAlgorithm({name:t},!0,"hashAlgorithm");let n=new pe,s=this.getAlgorithmParameters(e.algorithm.name,"sign");if(!Object.keys(s.algorithm).length)throw new Error("Parameter 'algorithm' is empty");let i=s.algorithm;switch("hash"in e.algorithm&&e.algorithm.hash&&e.algorithm.hash.name?i.hash.name=e.algorithm.hash.name:i.hash.name=t,e.algorithm.name.toUpperCase()){case"RSASSA-PKCS1-V1_5":case"ECDSA":n.algorithmId=this.getOIDByAlgorithm(i,!0);break;case"RSA-PSS":{switch(i.hash.name.toUpperCase()){case"SHA-256":i.saltLength=32;break;case"SHA-384":i.saltLength=48;break;case"SHA-512":i.saltLength=64;break}let a={};if(i.hash.name.toUpperCase()!=="SHA-1"){let c=this.getOIDByAlgorithm({name:i.hash.name},!0,"hashAlgorithm");a.hashAlgorithm=new pe({algorithmId:c,algorithmParams:new Pr}),a.maskGenAlgorithm=new pe({algorithmId:"1.2.840.113549.1.1.8",algorithmParams:a.hashAlgorithm.toSchema()})}i.saltLength!==20&&(a.saltLength=i.saltLength);let u=new eS(a);n.algorithmId="1.2.840.113549.1.1.10",n.algorithmParams=u.toSchema()}break;default:throw new Error(`Unsupported signature algorithm: ${e.algorithm.name}`)}return{signatureAlgorithm:n,parameters:s}}async signWithPrivateKey(e,t,n){let s=await this.sign(n.algorithm,t,e);return n.algorithm.name==="ECDSA"?_le(s):s}fillPublicKeyParameters(e,t){let n={},s=this.getHashAlgorithm(t);if(s===P)throw new Error(`Unsupported signature algorithm: ${t.algorithmId}`);let i;t.algorithmId==="1.2.840.113549.1.1.10"?i=t.algorithmId:i=e.algorithm.algorithmId;let a=this.getAlgorithmByOID(i,!0);if(n.algorithm=this.getAlgorithmParameters(a.name,"importKey"),"hash"in n.algorithm.algorithm&&(n.algorithm.algorithm.hash.name=s),a.name==="ECDSA"){let u=e.algorithm;if(!u.algorithmParams)throw new Error("Algorithm parameters for ECDSA public key are missed");let c=u.algorithmParams;if("idBlock"in u.algorithmParams&&!(c.idBlock.tagClass===1&&c.idBlock.tagNumber===6))throw new Error("Incorrect type for ECDSA public key parameters");let l=this.getAlgorithmByOID(c.valueBlock.toString(),!0);n.algorithm.algorithm.namedCurve=l.name}return n}async getPublicKey(e,t,n){n||(n=this.fillPublicKeyParameters(e,t));let s=e.toSchema().toBER(!1);return this.importKey("spki",s,n.algorithm.algorithm,!0,n.algorithm.usages)}async verifyWithPublicKey(e,t,n,s,i){let a;if(i){let l={},f;s.algorithmId==="1.2.840.113549.1.1.10"?f=s.algorithmId:f=n.algorithm.algorithmId;let h=this.getAlgorithmByOID(f,!0);if(l.algorithm=this.getAlgorithmParameters(h.name,"importKey"),"hash"in l.algorithm.algorithm&&(l.algorithm.algorithm.hash.name=i),h.name==="ECDSA"){let d=!1;if("algorithmParams"in n.algorithm&&"idBlock"in n.algorithm.algorithmParams&&n.algorithm.algorithmParams.idBlock.tagClass===1&&n.algorithm.algorithmParams.idBlock.tagNumber===6&&(d=!0),d===!1)throw new Error("Incorrect type for ECDSA public key parameters");let g=this.getAlgorithmByOID(n.algorithm.algorithmParams.valueBlock.toString(),!0);l.algorithm.algorithm.namedCurve=g.name}a=await this.getPublicKey(n,null,l)}else{if(i=this.getHashAlgorithm(s),!i)throw new Error(`Unsupported signature algorithm: ${s.algorithmId}`);a=await this.getPublicKey(n,s)}let u=this.getAlgorithmParameters(a.algorithm.name,"verify");"hash"in u.algorithm&&(u.algorithm.hash.name=i);let c=t.valueBlock.valueHexView;if(a.algorithm.name==="ECDSA"){let l=Oc.find(a.algorithm.namedCurve);if(!l)throw new Error("Unsupported named curve in use");let f=Or(c);ye.assert(f,"Signature value"),c=Ole(f.result,l.size)}if(a.algorithm.name==="RSA-PSS"){let l=new eS({schema:s.algorithmParams});"saltLength"in l?u.algorithm.saltLength=l.saltLength:u.algorithm.saltLength=20;let f="SHA-1";"hashAlgorithm"in l&&(f=this.getAlgorithmByOID(l.hashAlgorithm.algorithmId,!0).name),u.algorithm.hash.name=f}return this.verify(u.algorithm,a,c,e)}},Z7={name:"none",crypto:null};function l7(r){return!!(r&&typeof r=="object"&&"crypto"in r)}o(l7,"isCryptoEngine");function QS(r,...e){let t=null;if(e.length<2)e.length?t=e[0]:t=typeof self<"u"&&self.crypto?new Em({name:"browser",crypto:self.crypto}):null;else{let n=e[0],s=e[1];l7(s)?t=s:l7(n)?t=n:"subtle"in n&&"getRandomValues"in n&&(t=new Em({crypto:n}))}if(typeof process<"u"&&"pid"in process&&typeof global<"u"&&typeof window>"u"){if(typeof global[process.pid]>"u")global[process.pid]={};else if(typeof global[process.pid]!="object")throw new Error(`Name global.${process.pid} already exists and it is not an object`);if(typeof global[process.pid].pkijs>"u")global[process.pid].pkijs={};else if(typeof global[process.pid].pkijs!="object")throw new Error(`Name global.${process.pid}.pkijs already exists and it is not an object`);global[process.pid].pkijs.engine={name:r,crypto:t}}else Z7={name:r,crypto:t}}o(QS,"setEngine");function Rle(){if(typeof process<"u"&&"pid"in process&&typeof global<"u"&&typeof window>"u"){let r;try{r=global[process.pid].pkijs.engine}catch{throw new Error("Please call 'setEngine' before call to 'getEngine'")}return r}return Z7}o(Rle,"getEngine");function mt(r=!1){let e=Rle();if(!e.crypto&&r)throw new Error("Unable to create WebCrypto object");return e.crypto}o(mt,"getCrypto");function _le(r){if(r.byteLength%2!==0)return Kr;let e=r.byteLength/2,t=new ArrayBuffer(e);new Uint8Array(t).set(new Uint8Array(r,0,e));let s=new he({valueHex:t}),i=new ArrayBuffer(e);new Uint8Array(i).set(new Uint8Array(r,e,e));let u=new he({valueHex:i});return new K({value:[s.convertToDER(),u.convertToDER()]}).toBER(!1)}o(_le,"createCMSECDSASignature");function Ole(r,e){if(!(r instanceof K&&r.valueBlock.value.length===2&&r.valueBlock.value[0]instanceof he&&r.valueBlock.value[1]instanceof he))return Kr;let t=r.valueBlock.value[0].convertFromDER().valueBlock.valueHexView,n=r.valueBlock.value[1].convertFromDER().valueBlock.valueHexView,s=new Uint8Array(e*2);return s.set(t,e-t.byteLength),s.set(n,2*e-n.byteLength),s.buffer}o(Ole,"createECDSASignatureFromCMS");async function Ple(r,e,t,n,s){switch(r.toUpperCase()){case"SHA-1":case"SHA-256":case"SHA-384":case"SHA-512":break;default:throw new hr(`Unknown hash function: ${r}`)}if(hr.assert(e,"zBuffer","ArrayBuffer"),e.byteLength===0)throw new hr("'zBuffer' has zero length, error");if(hr.assert(n,"SharedInfo","ArrayBuffer"),t>255)throw new hr("Please set 'Counter' argument to value less or equal to 255");let i=new ArrayBuffer(4),a=new Uint8Array(i);a[0]=0,a[1]=0,a[2]=0,a[3]=t;let u=Kr;u=Al(u,e),u=Al(u,i),u=Al(u,n);let c=await s.digest({name:r},u);return{counter:t,result:c}}o(Ple,"kdfWithCounter");async function f7(r,e,t,n,s=mt(!0)){let i=0,a=1;switch(r.toUpperCase()){case"SHA-1":i=160;break;case"SHA-256":i=256;break;case"SHA-384":i=384;break;case"SHA-512":i=512;break;default:throw new hr(`Unknown hash function: ${r}`)}if(hr.assert(e,"Zbuffer","ArrayBuffer"),e.byteLength===0)throw new hr("'Zbuffer' has zero length, error");hr.assert(n,"SharedInfo","ArrayBuffer");let u=t/i;Math.floor(u)>0&&(a=Math.floor(u),u-a>0&&a++);let c=[];for(let d=1;d<=a;d++)c.push(await Ple(r,e,d,n,s));let l=Kr,f=1,h=!0;for(;h;){h=!1;for(let d of c)if(d.counter===f){l=Al(l,d.result),h=!0;break}f++}if(t>>=3,l.byteLength>t){let d=new ArrayBuffer(t),g=new Uint8Array(d),m=new Uint8Array(l);for(let v=0;v<t;v++)g[v]=m[v];return d}return l}o(f7,"kdf");var MB="version",jB="logID",qB="extensions",HB="timestamp",KB="hashAlgorithm",$B="signatureAlgorithm",XB="signature",h7="none",p7="md5",d7="sha1",m7="sha224",g7="sha256",y7="sha384",v7="sha512",x7="anonymous",E7="rsa",w7="dsa",b7="ecdsa",eH=class rc extends Se{static{o(this,"SignedCertificateTimestamp")}constructor(e={}){super(),this.version=B(e,MB,rc.defaultValues(MB)),this.logID=B(e,jB,rc.defaultValues(jB)),this.timestamp=B(e,HB,rc.defaultValues(HB)),this.extensions=B(e,qB,rc.defaultValues(qB)),this.hashAlgorithm=B(e,KB,rc.defaultValues(KB)),this.signatureAlgorithm=B(e,$B,rc.defaultValues($B)),this.signature=B(e,XB,rc.defaultValues(XB)),"stream"in e&&e.stream&&this.fromStream(e.stream),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case MB:return 0;case jB:case qB:return Kr;case HB:return new Date(0);case KB:case $B:return P;case XB:return Kr;default:return super.defaultValues(e)}}fromSchema(e){if(!(e instanceof iy))throw new Error("Object's schema was not verified against input data for SignedCertificateTimestamp");let t=new uo({stream:new On({buffer:e.data})});this.fromStream(t)}fromStream(e){let t=e.getUint16();if(this.version=e.getBlock(1)[0],this.version===0){this.logID=new Uint8Array(e.getBlock(32)).buffer.slice(0),this.timestamp=new Date(io(new Uint8Array(e.getBlock(8)),8));let n=e.getUint16();switch(this.extensions=new Uint8Array(e.getBlock(n)).buffer.slice(0),e.getBlock(1)[0]){case 0:this.hashAlgorithm=h7;break;case 1:this.hashAlgorithm=p7;break;case 2:this.hashAlgorithm=d7;break;case 3:this.hashAlgorithm=m7;break;case 4:this.hashAlgorithm=g7;break;case 5:this.hashAlgorithm=y7;break;case 6:this.hashAlgorithm=v7;break;default:throw new Error("Object's stream was not correct for SignedCertificateTimestamp")}switch(e.getBlock(1)[0]){case 0:this.signatureAlgorithm=x7;break;case 1:this.signatureAlgorithm=E7;break;case 2:this.signatureAlgorithm=w7;break;case 3:this.signatureAlgorithm=b7;break;default:throw new Error("Object's stream was not correct for SignedCertificateTimestamp")}let s=e.getUint16();if(this.signature=new Uint8Array(e.getBlock(s)).buffer.slice(0),t!==47+n+s)throw new Error("Object's stream was not correct for SignedCertificateTimestamp")}}toSchema(){let e=this.toStream();return new iy({data:e.stream.buffer})}toStream(){let e=new uo;e.appendUint16(47+this.extensions.byteLength+this.signature.byteLength),e.appendChar(this.version),e.appendView(new Uint8Array(this.logID));let t=new ArrayBuffer(8),n=new Uint8Array(t),s=_i(this.timestamp.valueOf(),8);n.set(new Uint8Array(s),8-s.byteLength),e.appendView(n),e.appendUint16(this.extensions.byteLength),this.extensions.byteLength&&e.appendView(new Uint8Array(this.extensions));let i;switch(this.hashAlgorithm.toLowerCase()){case h7:i=0;break;case p7:i=1;break;case d7:i=2;break;case m7:i=3;break;case g7:i=4;break;case y7:i=5;break;case v7:i=6;break;default:throw new Error(`Incorrect data for hashAlgorithm: ${this.hashAlgorithm}`)}e.appendChar(i);let a;switch(this.signatureAlgorithm.toLowerCase()){case x7:a=0;break;case E7:a=1;break;case w7:a=2;break;case b7:a=3;break;default:throw new Error(`Incorrect data for signatureAlgorithm: ${this.signatureAlgorithm}`)}return e.appendChar(a),e.appendUint16(this.signature.byteLength),e.appendView(new Uint8Array(this.signature)),e}toJSON(){return{version:this.version,logID:Jw(this.logID),timestamp:this.timestamp,extensions:Jw(this.extensions),hashAlgorithm:this.hashAlgorithm,signatureAlgorithm:this.signatureAlgorithm,signature:Jw(this.signature)}}async verify(e,t,n=0,s=mt(!0)){let i=Qw(Qg(this.logID)),a=null,u=new uo;for(let g of e)if(g.log_id===i){a=g.key;break}if(!a)throw new Error(`Public key not found for CT with logId: ${i}`);let c=Cl(Ip(a)),l=qi.fromBER(c);u.appendChar(0),u.appendChar(0);let f=new ArrayBuffer(8),h=new Uint8Array(f),d=_i(this.timestamp.valueOf(),8);return h.set(new Uint8Array(d),8-d.byteLength),u.appendView(h),u.appendUint16(n),n===0&&u.appendUint24(t.byteLength),u.appendView(new Uint8Array(t)),u.appendUint16(this.extensions.byteLength),this.extensions.byteLength!==0&&u.appendView(new Uint8Array(this.extensions)),s.verifyWithPublicKey(u.buffer.slice(0,u.length),new Be({valueHex:this.signature}),l,{algorithmId:P},"SHA-256")}};eH.CLASS_NAME="SignedCertificateTimestamp";var vb="timestamps",tH=class rH extends Se{static{o(this,"SignedCertificateTimestampList")}constructor(e={}){super(),this.timestamps=B(e,vb,rH.defaultValues(vb)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case vb:return[];default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case vb:return t.length===0;default:return super.defaultValues(e)}}static schema(e={}){var t;let n=B(e,"names",{});return(t=n.optional)!==null&&t!==void 0||(n.optional=!1),new Be({name:n.blockName||"SignedCertificateTimestampList",optional:n.optional})}fromSchema(e){if(!(e instanceof Be))throw new Error("Object's schema was not verified against input data for SignedCertificateTimestampList");let t=new uo({stream:new On({buffer:e.valueBlock.valueHex})});if(t.getUint16()!==t.length)throw new Error("Object's schema was not verified against input data for SignedCertificateTimestampList");for(;t.length;)this.timestamps.push(new eH({stream:t}))}toSchema(){let e=new uo,t=0,n=[];for(let s of this.timestamps){let i=s.toStream();n.push(i),t+=i.stream.buffer.byteLength}e.appendUint16(t);for(let s of n)e.appendView(s.stream.view);return new Be({valueHex:e.stream.buffer.slice(0)})}toJSON(){return{timestamps:Array.from(this.timestamps,e=>e.toJSON())}}};tH.CLASS_NAME="SignedCertificateTimestampList";var m1="attributes",kle=[m1],nH=class UR extends Se{static{o(this,"SubjectDirectoryAttributes")}constructor(e={}){super(),this.attributes=B(e,m1,UR.defaultValues(m1)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case m1:return[];default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new lt({name:t.attributes||P,value:$r.schema()})]})}fromSchema(e){Ce(e,kle);let t=be(e,e,UR.schema({names:{attributes:m1}}));ye.assertSchema(t,this.className),this.attributes=Array.from(t.result.attributes,n=>new $r({schema:n}))}toSchema(){return new K({value:Array.from(this.attributes,e=>e.toSchema())})}toJSON(){return{attributes:Array.from(this.attributes,e=>e.toJSON())}}};nH.CLASS_NAME="SubjectDirectoryAttributes";var Lle=class Lr{static{o(this,"ExtensionValueFactory")}static getItems(){return this.types||(this.types={},Lr.register(D7,"SubjectAltName",gR),Lr.register(B7,"IssuerAltName",gR),Lr.register(w_,"AuthorityKeyIdentifier",C_),Lr.register(x_,"BasicConstraints",N_),Lr.register(Yce,"MicrosoftCaVersion",j7),Lr.register(k7,"CertificatePolicies",bR),Lr.register($ce,"CertificatePoliciesMicrosoft",bR),Lr.register(Jce,"MicrosoftCertTemplateV2",ole),Lr.register(P7,"CRLDistributionPoints",CR),Lr.register(E_,"FreshestCRL",CR),Lr.register(Xce,"ExtKeyUsage",K7),Lr.register(_7,"CertificateIssuer",Pn),Lr.register(b_,"AuthorityInfoAccess",IR),Lr.register(zce,"SubjectInfoAccess",IR),Lr.register(R7,"IssuingDistributionPoint",X7),Lr.register(O7,"NameConstraints",G7),Lr.register(F7,"PolicyConstraints",z7),Lr.register(L7,"PolicyMappings",W7),Lr.register(Mce,"PrivateKeyUsagePeriod",J7),Lr.register(Qce,"QCStatements",Y7),Lr.register(Wce,"SignedCertificateTimestampList",tH),Lr.register(Fce,"SubjectDirectoryAttributes",nH)),this.types}static fromBER(e,t){let n=Or(t);if(n.offset===-1)return null;let s=this.find(e);if(s)try{return new s.type({schema:n.result})}catch{let i=new s.type;return i.parsingError=`Incorrectly formatted value of extension ${s.name} (${e})`,i}return n.result}static find(e){return this.getItems()[e]||null}static register(e,t,n){this.getItems()[e]={name:t,type:n}}},g1="extnID",nc="critical",y1="extnValue",xb="parsedValue",Fle=[g1,nc,y1],di=class sc extends Se{static{o(this,"Extension")}get parsedValue(){if(this._parsedValue===void 0){let e=Lle.fromBER(this.extnID,this.extnValue.valueBlock.valueHexView);this._parsedValue=e}return this._parsedValue||void 0}set parsedValue(e){this._parsedValue=e}constructor(e={}){super(),this.extnID=B(e,g1,sc.defaultValues(g1)),this.critical=B(e,nc,sc.defaultValues(nc)),y1 in e?this.extnValue=new Be({valueHex:e.extnValue}):this.extnValue=sc.defaultValues(y1),xb in e&&(this.parsedValue=B(e,xb,sc.defaultValues(xb))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case g1:return P;case nc:return!1;case y1:return new Be;case xb:return{};default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new He({name:t.extnID||P}),new Oi({name:t.critical||P,optional:!0}),new Be({name:t.extnValue||P})]})}fromSchema(e){Ce(e,Fle);let t=be(e,e,sc.schema({names:{extnID:g1,critical:nc,extnValue:y1}}));ye.assertSchema(t,this.className),this.extnID=t.result.extnID.valueBlock.toString(),nc in t.result&&(this.critical=t.result.critical.valueBlock.value),this.extnValue=t.result.extnValue}toSchema(){let e=[];return e.push(new He({value:this.extnID})),this.critical!==sc.defaultValues(nc)&&e.push(new Oi({value:this.critical})),e.push(this.extnValue),new K({value:e})}toJSON(){let e={extnID:this.extnID,extnValue:this.extnValue.toJSON()};return this.critical!==sc.defaultValues(nc)&&(e.critical=this.critical),this.parsedValue&&this.parsedValue.toJSON&&(e.parsedValue=this.parsedValue.toJSON()),e}};di.CLASS_NAME="Extension";var v1="extensions",Ule=[v1],un=class VR extends Se{static{o(this,"Extensions")}constructor(e={}){super(),this.extensions=B(e,v1,VR.defaultValues(v1)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case v1:return[];default:return super.defaultValues(e)}}static schema(e={},t=!1){let n=B(e,"names",{});return new K({optional:t,name:n.blockName||P,value:[new lt({name:n.extensions||P,value:di.schema(n.extension||{})})]})}fromSchema(e){Ce(e,Ule);let t=be(e,e,VR.schema({names:{extensions:v1}}));ye.assertSchema(t,this.className),this.extensions=Array.from(t.result.extensions,n=>new di({schema:n}))}toSchema(){return new K({value:Array.from(this.extensions,e=>e.toSchema())})}toJSON(){return{extensions:this.extensions.map(e=>e.toJSON())}}};un.CLASS_NAME="Extensions";var x1="issuer",E1="serialNumber",Jl="issuerUID",Vle=[x1,E1,Jl],Na=class w1 extends Se{static{o(this,"IssuerSerial")}constructor(e={}){super(),this.issuer=B(e,x1,w1.defaultValues(x1)),this.serialNumber=B(e,E1,w1.defaultValues(E1)),Jl in e&&(this.issuerUID=B(e,Jl,w1.defaultValues(Jl))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case x1:return new Pn;case E1:return new he;case Jl:return new Ct;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[Pn.schema(t.issuer||{}),new he({name:t.serialNumber||P}),new Ct({optional:!0,name:t.issuerUID||P})]})}fromSchema(e){Ce(e,Vle);let t=be(e,e,w1.schema({names:{issuer:{names:{blockName:x1}},serialNumber:E1,issuerUID:Jl}}));ye.assertSchema(t,this.className),this.issuer=new Pn({schema:t.result.issuer}),this.serialNumber=t.result.serialNumber,Jl in t.result&&(this.issuerUID=t.result.issuerUID)}toSchema(){let e=new K({value:[this.issuer.toSchema(),this.serialNumber]});return this.issuerUID&&e.valueBlock.value.push(this.issuerUID),e}toJSON(){let e={issuer:this.issuer.toJSON(),serialNumber:this.serialNumber.toJSON()};return this.issuerUID&&(e.issuerUID=this.issuerUID.toJSON()),e}};Na.CLASS_NAME="IssuerSerial";var b1="version",Yl="baseCertificateID",Ql="subjectName",S1="issuer",A1="signature",C1="serialNumber",N1="attrCertValidityPeriod",T1="attributes",Zl="issuerUniqueID",ef="extensions",Mle=[b1,Yl,Ql,S1,A1,C1,N1,T1,Zl,ef],rS=class hi extends Se{static{o(this,"AttributeCertificateInfoV1")}constructor(e={}){super(),this.version=B(e,b1,hi.defaultValues(b1)),Yl in e&&(this.baseCertificateID=B(e,Yl,hi.defaultValues(Yl))),Ql in e&&(this.subjectName=B(e,Ql,hi.defaultValues(Ql))),this.issuer=B(e,S1,hi.defaultValues(S1)),this.signature=B(e,A1,hi.defaultValues(A1)),this.serialNumber=B(e,C1,hi.defaultValues(C1)),this.attrCertValidityPeriod=B(e,N1,hi.defaultValues(N1)),this.attributes=B(e,T1,hi.defaultValues(T1)),Zl in e&&(this.issuerUniqueID=B(e,Zl,hi.defaultValues(Zl))),ef in e&&(this.extensions=B(e,ef,hi.defaultValues(ef))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case b1:return 0;case Yl:return new Na;case Ql:return new Pn;case S1:return new Pn;case A1:return new pe;case C1:return new he;case N1:return new Jf;case T1:return[];case Zl:return new Ct;case ef:return new un;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new he({name:t.version||P}),new Sr({value:[new ae({name:t.baseCertificateID||P,idBlock:{tagClass:3,tagNumber:0},value:Na.schema().valueBlock.value}),new ae({name:t.subjectName||P,idBlock:{tagClass:3,tagNumber:1},value:Pn.schema().valueBlock.value})]}),Pn.schema({names:{blockName:t.issuer||P}}),pe.schema(t.signature||{}),new he({name:t.serialNumber||P}),Jf.schema(t.attrCertValidityPeriod||{}),new K({name:t.attributes||P,value:[new lt({value:$r.schema()})]}),new Ct({optional:!0,name:t.issuerUniqueID||P}),un.schema(t.extensions||{},!0)]})}fromSchema(e){Ce(e,Mle);let t=be(e,e,hi.schema({names:{version:b1,baseCertificateID:Yl,subjectName:Ql,issuer:S1,signature:{names:{blockName:A1}},serialNumber:C1,attrCertValidityPeriod:{names:{blockName:N1}},attributes:T1,issuerUniqueID:Zl,extensions:{names:{blockName:ef}}}}));ye.assertSchema(t,this.className),this.version=t.result.version.valueBlock.valueDec,Yl in t.result&&(this.baseCertificateID=new Na({schema:new K({value:t.result.baseCertificateID.valueBlock.value})})),Ql in t.result&&(this.subjectName=new Pn({schema:new K({value:t.result.subjectName.valueBlock.value})})),this.issuer=t.result.issuer,this.signature=new pe({schema:t.result.signature}),this.serialNumber=t.result.serialNumber,this.attrCertValidityPeriod=new Jf({schema:t.result.attrCertValidityPeriod}),this.attributes=Array.from(t.result.attributes.valueBlock.value,n=>new $r({schema:n})),Zl in t.result&&(this.issuerUniqueID=t.result.issuerUniqueID),ef in t.result&&(this.extensions=new un({schema:t.result.extensions}))}toSchema(){let e=new K({value:[new he({value:this.version})]});return this.baseCertificateID&&e.valueBlock.value.push(new ae({idBlock:{tagClass:3,tagNumber:0},value:this.baseCertificateID.toSchema().valueBlock.value})),this.subjectName&&e.valueBlock.value.push(new ae({idBlock:{tagClass:3,tagNumber:1},value:this.subjectName.toSchema().valueBlock.value})),e.valueBlock.value.push(this.issuer.toSchema()),e.valueBlock.value.push(this.signature.toSchema()),e.valueBlock.value.push(this.serialNumber),e.valueBlock.value.push(this.attrCertValidityPeriod.toSchema()),e.valueBlock.value.push(new K({value:Array.from(this.attributes,t=>t.toSchema())})),this.issuerUniqueID&&e.valueBlock.value.push(this.issuerUniqueID),this.extensions&&e.valueBlock.value.push(this.extensions.toSchema()),e}toJSON(){let e={version:this.version};return this.baseCertificateID&&(e.baseCertificateID=this.baseCertificateID.toJSON()),this.subjectName&&(e.subjectName=this.subjectName.toJSON()),e.issuer=this.issuer.toJSON(),e.signature=this.signature.toJSON(),e.serialNumber=this.serialNumber.toJSON(),e.attrCertValidityPeriod=this.attrCertValidityPeriod.toJSON(),e.attributes=Array.from(this.attributes,t=>t.toJSON()),this.issuerUniqueID&&(e.issuerUniqueID=this.issuerUniqueID.toJSON()),this.extensions&&(e.extensions=this.extensions.toJSON()),e}};rS.CLASS_NAME="AttributeCertificateInfoV1";var I1="acinfo",D1="signatureAlgorithm",B1="signatureValue",jle=[I1,B1,D1],ZS=class R1 extends Se{static{o(this,"AttributeCertificateV1")}constructor(e={}){super(),this.acinfo=B(e,I1,R1.defaultValues(I1)),this.signatureAlgorithm=B(e,D1,R1.defaultValues(D1)),this.signatureValue=B(e,B1,R1.defaultValues(B1)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case I1:return new rS;case D1:return new pe;case B1:return new Ct;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[rS.schema(t.acinfo||{}),pe.schema(t.signatureAlgorithm||{}),new Ct({name:t.signatureValue||P})]})}fromSchema(e){Ce(e,jle);let t=be(e,e,R1.schema({names:{acinfo:{names:{blockName:I1}},signatureAlgorithm:{names:{blockName:D1}},signatureValue:B1}}));ye.assertSchema(t,this.className),this.acinfo=new rS({schema:t.result.acinfo}),this.signatureAlgorithm=new pe({schema:t.result.signatureAlgorithm}),this.signatureValue=t.result.signatureValue}toSchema(){return new K({value:[this.acinfo.toSchema(),this.signatureAlgorithm.toSchema(),this.signatureValue]})}toJSON(){return{acinfo:this.acinfo.toJSON(),signatureAlgorithm:this.signatureAlgorithm.toJSON(),signatureValue:this.signatureValue.toJSON()}}};ZS.CLASS_NAME="AttributeCertificateV1";var _1="digestedObjectType",tf="otherObjectTypeID",O1="digestAlgorithm",P1="objectDigest",qle=[_1,tf,O1,P1],Yf=class Zp extends Se{static{o(this,"ObjectDigestInfo")}constructor(e={}){super(),this.digestedObjectType=B(e,_1,Zp.defaultValues(_1)),tf in e&&(this.otherObjectTypeID=B(e,tf,Zp.defaultValues(tf))),this.digestAlgorithm=B(e,O1,Zp.defaultValues(O1)),this.objectDigest=B(e,P1,Zp.defaultValues(P1)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case _1:return new _u;case tf:return new He;case O1:return new pe;case P1:return new Ct;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new _u({name:t.digestedObjectType||P}),new He({optional:!0,name:t.otherObjectTypeID||P}),pe.schema(t.digestAlgorithm||{}),new Ct({name:t.objectDigest||P})]})}fromSchema(e){Ce(e,qle);let t=be(e,e,Zp.schema({names:{digestedObjectType:_1,otherObjectTypeID:tf,digestAlgorithm:{names:{blockName:O1}},objectDigest:P1}}));ye.assertSchema(t,this.className),this.digestedObjectType=t.result.digestedObjectType,tf in t.result&&(this.otherObjectTypeID=t.result.otherObjectTypeID),this.digestAlgorithm=new pe({schema:t.result.digestAlgorithm}),this.objectDigest=t.result.objectDigest}toSchema(){let e=new K({value:[this.digestedObjectType]});return this.otherObjectTypeID&&e.valueBlock.value.push(this.otherObjectTypeID),e.valueBlock.value.push(this.digestAlgorithm.toSchema()),e.valueBlock.value.push(this.objectDigest),e}toJSON(){let e={digestedObjectType:this.digestedObjectType.toJSON(),digestAlgorithm:this.digestAlgorithm.toJSON(),objectDigest:this.objectDigest.toJSON()};return this.otherObjectTypeID&&(e.otherObjectTypeID=this.otherObjectTypeID.toJSON()),e}};Yf.CLASS_NAME="ObjectDigestInfo";var rf="issuerName",nf="baseCertificateID",sf="objectDigestInfo",Hle=[rf,nf,sf],MR=class k1 extends Se{static{o(this,"V2Form")}constructor(e={}){super(),rf in e&&(this.issuerName=B(e,rf,k1.defaultValues(rf))),nf in e&&(this.baseCertificateID=B(e,nf,k1.defaultValues(nf))),sf in e&&(this.objectDigestInfo=B(e,sf,k1.defaultValues(sf))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case rf:return new Pn;case nf:return new Na;case sf:return new Yf;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[Pn.schema({names:{blockName:t.issuerName}},!0),new ae({optional:!0,name:t.baseCertificateID||P,idBlock:{tagClass:3,tagNumber:0},value:Na.schema().valueBlock.value}),new ae({optional:!0,name:t.objectDigestInfo||P,idBlock:{tagClass:3,tagNumber:1},value:Yf.schema().valueBlock.value})]})}fromSchema(e){Ce(e,Hle);let t=be(e,e,k1.schema({names:{issuerName:rf,baseCertificateID:nf,objectDigestInfo:sf}}));ye.assertSchema(t,this.className),rf in t.result&&(this.issuerName=new Pn({schema:t.result.issuerName})),nf in t.result&&(this.baseCertificateID=new Na({schema:new K({value:t.result.baseCertificateID.valueBlock.value})})),sf in t.result&&(this.objectDigestInfo=new Yf({schema:new K({value:t.result.objectDigestInfo.valueBlock.value})}))}toSchema(){let e=new K;return this.issuerName&&e.valueBlock.value.push(this.issuerName.toSchema()),this.baseCertificateID&&e.valueBlock.value.push(new ae({idBlock:{tagClass:3,tagNumber:0},value:this.baseCertificateID.toSchema().valueBlock.value})),this.objectDigestInfo&&e.valueBlock.value.push(new ae({idBlock:{tagClass:3,tagNumber:1},value:this.objectDigestInfo.toSchema().valueBlock.value})),e}toJSON(){let e={};return this.issuerName&&(e.issuerName=this.issuerName.toJSON()),this.baseCertificateID&&(e.baseCertificateID=this.baseCertificateID.toJSON()),this.objectDigestInfo&&(e.objectDigestInfo=this.objectDigestInfo.toJSON()),e}};MR.CLASS_NAME="V2Form";var af="baseCertificateID",of="entityName",uf="objectDigestInfo",Kle=[af,of,uf],nS=class L1 extends Se{static{o(this,"Holder")}constructor(e={}){super(),af in e&&(this.baseCertificateID=B(e,af,L1.defaultValues(af))),of in e&&(this.entityName=B(e,of,L1.defaultValues(of))),uf in e&&(this.objectDigestInfo=B(e,uf,L1.defaultValues(uf))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case af:return new Na;case of:return new Pn;case uf:return new Yf;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new ae({optional:!0,name:t.baseCertificateID||P,idBlock:{tagClass:3,tagNumber:0},value:Na.schema().valueBlock.value}),new ae({optional:!0,name:t.entityName||P,idBlock:{tagClass:3,tagNumber:1},value:Pn.schema().valueBlock.value}),new ae({optional:!0,name:t.objectDigestInfo||P,idBlock:{tagClass:3,tagNumber:2},value:Yf.schema().valueBlock.value})]})}fromSchema(e){Ce(e,Kle);let t=be(e,e,L1.schema({names:{baseCertificateID:af,entityName:of,objectDigestInfo:uf}}));ye.assertSchema(t,this.className),af in t.result&&(this.baseCertificateID=new Na({schema:new K({value:t.result.baseCertificateID.valueBlock.value})})),of in t.result&&(this.entityName=new Pn({schema:new K({value:t.result.entityName.valueBlock.value})})),uf in t.result&&(this.objectDigestInfo=new Yf({schema:new K({value:t.result.objectDigestInfo.valueBlock.value})}))}toSchema(){let e=new K;return this.baseCertificateID&&e.valueBlock.value.push(new ae({idBlock:{tagClass:3,tagNumber:0},value:this.baseCertificateID.toSchema().valueBlock.value})),this.entityName&&e.valueBlock.value.push(new ae({idBlock:{tagClass:3,tagNumber:1},value:this.entityName.toSchema().valueBlock.value})),this.objectDigestInfo&&e.valueBlock.value.push(new ae({idBlock:{tagClass:3,tagNumber:2},value:this.objectDigestInfo.toSchema().valueBlock.value})),e}toJSON(){let e={};return this.baseCertificateID&&(e.baseCertificateID=this.baseCertificateID.toJSON()),this.entityName&&(e.entityName=this.entityName.toJSON()),this.objectDigestInfo&&(e.objectDigestInfo=this.objectDigestInfo.toJSON()),e}};nS.CLASS_NAME="Holder";var F1="version",U1="holder",V1="issuer",M1="signature",j1="serialNumber",q1="attrCertValidityPeriod",H1="attributes",cf="issuerUniqueID",lf="extensions",$le=[F1,U1,V1,M1,j1,q1,H1,cf,lf],sS=class Fi extends Se{static{o(this,"AttributeCertificateInfoV2")}constructor(e={}){super(),this.version=B(e,F1,Fi.defaultValues(F1)),this.holder=B(e,U1,Fi.defaultValues(U1)),this.issuer=B(e,V1,Fi.defaultValues(V1)),this.signature=B(e,M1,Fi.defaultValues(M1)),this.serialNumber=B(e,j1,Fi.defaultValues(j1)),this.attrCertValidityPeriod=B(e,q1,Fi.defaultValues(q1)),this.attributes=B(e,H1,Fi.defaultValues(H1)),cf in e&&(this.issuerUniqueID=B(e,cf,Fi.defaultValues(cf))),lf in e&&(this.extensions=B(e,lf,Fi.defaultValues(lf))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case F1:return 1;case U1:return new nS;case V1:return{};case M1:return new pe;case j1:return new he;case q1:return new Jf;case H1:return[];case cf:return new Ct;case lf:return new un;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new he({name:t.version||P}),nS.schema(t.holder||{}),new Sr({value:[Pn.schema({names:{blockName:t.issuer||P}}),new ae({name:t.issuer||P,idBlock:{tagClass:3,tagNumber:0},value:MR.schema().valueBlock.value})]}),pe.schema(t.signature||{}),new he({name:t.serialNumber||P}),Jf.schema(t.attrCertValidityPeriod||{}),new K({name:t.attributes||P,value:[new lt({value:$r.schema()})]}),new Ct({optional:!0,name:t.issuerUniqueID||P}),un.schema(t.extensions||{},!0)]})}fromSchema(e){Ce(e,$le);let t=be(e,e,Fi.schema({names:{version:F1,holder:{names:{blockName:U1}},issuer:V1,signature:{names:{blockName:M1}},serialNumber:j1,attrCertValidityPeriod:{names:{blockName:q1}},attributes:H1,issuerUniqueID:cf,extensions:{names:{blockName:lf}}}}));switch(ye.assertSchema(t,this.className),this.version=t.result.version.valueBlock.valueDec,this.holder=new nS({schema:t.result.holder}),t.result.issuer.idBlock.tagClass){case 3:this.issuer=new MR({schema:new K({value:t.result.issuer.valueBlock.value})});break;case 1:default:throw new Error("Incorrect value for 'issuer' in AttributeCertificateInfoV2")}this.signature=new pe({schema:t.result.signature}),this.serialNumber=t.result.serialNumber,this.attrCertValidityPeriod=new Jf({schema:t.result.attrCertValidityPeriod}),this.attributes=Array.from(t.result.attributes.valueBlock.value,n=>new $r({schema:n})),cf in t.result&&(this.issuerUniqueID=t.result.issuerUniqueID),lf in t.result&&(this.extensions=new un({schema:t.result.extensions}))}toSchema(){let e=new K({value:[new he({value:this.version}),this.holder.toSchema(),new ae({idBlock:{tagClass:3,tagNumber:0},value:this.issuer.toSchema().valueBlock.value}),this.signature.toSchema(),this.serialNumber,this.attrCertValidityPeriod.toSchema(),new K({value:Array.from(this.attributes,t=>t.toSchema())})]});return this.issuerUniqueID&&e.valueBlock.value.push(this.issuerUniqueID),this.extensions&&e.valueBlock.value.push(this.extensions.toSchema()),e}toJSON(){let e={version:this.version,holder:this.holder.toJSON(),issuer:this.issuer.toJSON(),signature:this.signature.toJSON(),serialNumber:this.serialNumber.toJSON(),attrCertValidityPeriod:this.attrCertValidityPeriod.toJSON(),attributes:Array.from(this.attributes,t=>t.toJSON())};return this.issuerUniqueID&&(e.issuerUniqueID=this.issuerUniqueID.toJSON()),this.extensions&&(e.extensions=this.extensions.toJSON()),e}};sS.CLASS_NAME="AttributeCertificateInfoV2";var K1="acinfo",$1="signatureAlgorithm",X1="signatureValue",Xle=[K1,$1,X1],_c=class G1 extends Se{static{o(this,"AttributeCertificateV2")}constructor(e={}){super(),this.acinfo=B(e,K1,G1.defaultValues(K1)),this.signatureAlgorithm=B(e,$1,G1.defaultValues($1)),this.signatureValue=B(e,X1,G1.defaultValues(X1)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case K1:return new sS;case $1:return new pe;case X1:return new Ct;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[sS.schema(t.acinfo||{}),pe.schema(t.signatureAlgorithm||{}),new Ct({name:t.signatureValue||P})]})}fromSchema(e){Ce(e,Xle);let t=be(e,e,G1.schema({names:{acinfo:{names:{blockName:K1}},signatureAlgorithm:{names:{blockName:$1}},signatureValue:X1}}));ye.assertSchema(t,this.className),this.acinfo=new sS({schema:t.result.acinfo}),this.signatureAlgorithm=new pe({schema:t.result.signatureAlgorithm}),this.signatureValue=t.result.signatureValue}toSchema(){return new K({value:[this.acinfo.toSchema(),this.signatureAlgorithm.toSchema(),this.signatureValue]})}toJSON(){return{acinfo:this.acinfo.toJSON(),signatureAlgorithm:this.signatureAlgorithm.toJSON(),signatureValue:this.signatureValue.toJSON()}}};_c.CLASS_NAME="AttributeCertificateV2";var ff="contentType",ed="content",Gle=[ff,ed],Fr=class iS extends Se{static{o(this,"ContentInfo")}constructor(e={}){super(),this.contentType=B(e,ff,iS.defaultValues(ff)),this.content=B(e,ed,iS.defaultValues(ed)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case ff:return P;case ed:return new it;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case ff:return typeof t=="string"&&t===this.defaultValues(ff);case ed:return t instanceof it;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return"optional"in t||(t.optional=!1),new K({name:t.blockName||"ContentInfo",optional:t.optional,value:[new He({name:t.contentType||ff}),new ae({idBlock:{tagClass:3,tagNumber:0},value:[new it({name:t.content||ed})]})]})}fromSchema(e){Ce(e,Gle);let t=be(e,e,iS.schema());ye.assertSchema(t,this.className),this.contentType=t.result.contentType.valueBlock.toString(),this.content=t.result.content}toSchema(){return new K({value:[new He({value:this.contentType}),new ae({idBlock:{tagClass:3,tagNumber:0},value:[this.content]})]})}toJSON(){let e={contentType:this.contentType};return this.content instanceof it||(e.content=this.content.toJSON()),e}};Fr.CLASS_NAME="ContentInfo";Fr.DATA=S_;Fr.SIGNED_DATA=U7;Fr.ENVELOPED_DATA=V7;Fr.ENCRYPTED_DATA=M7;var GB="type",zB="value",jR="utcTimeName",qR="generalTimeName",zle=[jR,qR],S7;(function(r){r[r.UTCTime=0]="UTCTime",r[r.GeneralizedTime=1]="GeneralizedTime",r[r.empty=2]="empty"})(S7||(S7={}));var kn=class aS extends Se{static{o(this,"Time")}constructor(e={}){super(),this.type=B(e,GB,aS.defaultValues(GB)),this.value=B(e,zB,aS.defaultValues(zB)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case GB:return 0;case zB:return new Date(0,0,0);default:return super.defaultValues(e)}}static schema(e={},t=!1){let n=B(e,"names",{});return new Sr({optional:t,value:[new Il({name:n.utcTimeName||P}),new br({name:n.generalTimeName||P})]})}fromSchema(e){Ce(e,zle);let t=be(e,e,aS.schema({names:{utcTimeName:jR,generalTimeName:qR}}));ye.assertSchema(t,this.className),jR in t.result&&(this.type=0,this.value=t.result.utcTimeName.toDate()),qR in t.result&&(this.type=1,this.value=t.result.generalTimeName.toDate())}toSchema(){return this.type===0?new Il({valueDate:this.value}):this.type===1?new br({valueDate:this.value}):{}}toJSON(){return{type:this.type,value:this.value}}};kn.CLASS_NAME="Time";var WB="tbs",ic="version",oS="serialNumber",uS="signature",cS="issuer",lS="notBefore",fS="notAfter",hS="subject",pS="subjectPublicKeyInfo",z1="issuerUniqueID",W1="subjectUniqueID",J1="extensions",Y1="signatureAlgorithm",Q1="signatureValue",qs="tbsCertificate",eA=`${qs}.${ic}`,T_=`${qs}.${oS}`,I_=`${qs}.${uS}`,D_=`${qs}.${cS}`,tA=`${qs}.${lS}`,rA=`${qs}.${fS}`,B_=`${qs}.${hS}`,R_=`${qs}.${pS}`,nA=`${qs}.${z1}`,sA=`${qs}.${W1}`,Kv=`${qs}.${J1}`,Wle=[qs,eA,T_,I_,D_,tA,rA,B_,R_,nA,sA,Kv,Y1,Q1];function Jle(r={}){let e=B(r,"names",{});return new K({name:e.blockName||qs,value:[new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new he({name:e.tbsCertificateVersion||eA})]}),new he({name:e.tbsCertificateSerialNumber||T_}),pe.schema(e.signature||{names:{blockName:I_}}),Ar.schema(e.issuer||{names:{blockName:D_}}),new K({name:e.tbsCertificateValidity||"tbsCertificate.validity",value:[kn.schema(e.notBefore||{names:{utcTimeName:tA,generalTimeName:tA}}),kn.schema(e.notAfter||{names:{utcTimeName:rA,generalTimeName:rA}})]}),Ar.schema(e.subject||{names:{blockName:B_}}),qi.schema(e.subjectPublicKeyInfo||{names:{blockName:R_}}),new tt({name:e.tbsCertificateIssuerUniqueID||nA,optional:!0,idBlock:{tagClass:3,tagNumber:1}}),new tt({name:e.tbsCertificateSubjectUniqueID||sA,optional:!0,idBlock:{tagClass:3,tagNumber:2}}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:3},value:[un.schema(e.extensions||{names:{blockName:Kv}})]})]})}o(Jle,"tbsCertificate");var Gn=class on extends Se{static{o(this,"Certificate")}get tbs(){return Ze.toArrayBuffer(this.tbsView)}set tbs(e){this.tbsView=new Uint8Array(e)}constructor(e={}){super(),this.tbsView=new Uint8Array(B(e,WB,on.defaultValues(WB))),this.version=B(e,ic,on.defaultValues(ic)),this.serialNumber=B(e,oS,on.defaultValues(oS)),this.signature=B(e,uS,on.defaultValues(uS)),this.issuer=B(e,cS,on.defaultValues(cS)),this.notBefore=B(e,lS,on.defaultValues(lS)),this.notAfter=B(e,fS,on.defaultValues(fS)),this.subject=B(e,hS,on.defaultValues(hS)),this.subjectPublicKeyInfo=B(e,pS,on.defaultValues(pS)),z1 in e&&(this.issuerUniqueID=B(e,z1,on.defaultValues(z1))),W1 in e&&(this.subjectUniqueID=B(e,W1,on.defaultValues(W1))),J1 in e&&(this.extensions=B(e,J1,on.defaultValues(J1))),this.signatureAlgorithm=B(e,Y1,on.defaultValues(Y1)),this.signatureValue=B(e,Q1,on.defaultValues(Q1)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case WB:return Kr;case ic:return 0;case oS:return new he;case uS:return new pe;case cS:return new Ar;case lS:return new kn;case fS:return new kn;case hS:return new Ar;case pS:return new qi;case z1:return Kr;case W1:return Kr;case J1:return[];case Y1:return new pe;case Q1:return new Ct;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[Jle(t.tbsCertificate),pe.schema(t.signatureAlgorithm||{names:{blockName:Y1}}),new Ct({name:t.signatureValue||Q1})]})}fromSchema(e){Ce(e,Wle);let t=be(e,e,on.schema({names:{tbsCertificate:{names:{extensions:{names:{extensions:Kv}}}}}}));ye.assertSchema(t,this.className),this.tbsView=t.result.tbsCertificate.valueBeforeDecodeView,eA in t.result&&(this.version=t.result[eA].valueBlock.valueDec),this.serialNumber=t.result[T_],this.signature=new pe({schema:t.result[I_]}),this.issuer=new Ar({schema:t.result[D_]}),this.notBefore=new kn({schema:t.result[tA]}),this.notAfter=new kn({schema:t.result[rA]}),this.subject=new Ar({schema:t.result[B_]}),this.subjectPublicKeyInfo=new qi({schema:t.result[R_]}),nA in t.result&&(this.issuerUniqueID=t.result[nA].valueBlock.valueHex),sA in t.result&&(this.subjectUniqueID=t.result[sA].valueBlock.valueHex),Kv in t.result&&(this.extensions=Array.from(t.result[Kv],n=>new di({schema:n}))),this.signatureAlgorithm=new pe({schema:t.result.signatureAlgorithm}),this.signatureValue=t.result.signatureValue}encodeTBS(){let e=[];return ic in this&&this.version!==on.defaultValues(ic)&&e.push(new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new he({value:this.version})]})),e.push(this.serialNumber),e.push(this.signature.toSchema()),e.push(this.issuer.toSchema()),e.push(new K({value:[this.notBefore.toSchema(),this.notAfter.toSchema()]})),e.push(this.subject.toSchema()),e.push(this.subjectPublicKeyInfo.toSchema()),this.issuerUniqueID&&e.push(new tt({optional:!0,idBlock:{tagClass:3,tagNumber:1},valueHex:this.issuerUniqueID})),this.subjectUniqueID&&e.push(new tt({optional:!0,idBlock:{tagClass:3,tagNumber:2},valueHex:this.subjectUniqueID})),this.extensions&&e.push(new ae({optional:!0,idBlock:{tagClass:3,tagNumber:3},value:[new K({value:Array.from(this.extensions,t=>t.toSchema())})]})),new K({value:e})}toSchema(e=!1){let t;if(e===!1){if(!this.tbsView.byteLength)return on.schema().value[0];let n=Or(this.tbsView);ye.assert(n,"TBS Certificate"),t=n.result}else t=this.encodeTBS();return new K({value:[t,this.signatureAlgorithm.toSchema(),this.signatureValue]})}toJSON(){let e={tbs:ut.ToHex(this.tbsView),version:this.version,serialNumber:this.serialNumber.toJSON(),signature:this.signature.toJSON(),issuer:this.issuer.toJSON(),notBefore:this.notBefore.toJSON(),notAfter:this.notAfter.toJSON(),subject:this.subject.toJSON(),subjectPublicKeyInfo:this.subjectPublicKeyInfo.toJSON(),signatureAlgorithm:this.signatureAlgorithm.toJSON(),signatureValue:this.signatureValue.toJSON()};return ic in this&&this.version!==on.defaultValues(ic)&&(e.version=this.version),this.issuerUniqueID&&(e.issuerUniqueID=ut.ToHex(this.issuerUniqueID)),this.subjectUniqueID&&(e.subjectUniqueID=ut.ToHex(this.subjectUniqueID)),this.extensions&&(e.extensions=Array.from(this.extensions,t=>t.toJSON())),e}async getPublicKey(e,t=mt(!0)){return t.getPublicKey(this.subjectPublicKeyInfo,this.signatureAlgorithm,e)}async getKeyHash(e="SHA-1",t=mt(!0)){return t.digest({name:e},this.subjectPublicKeyInfo.subjectPublicKey.valueBlock.valueHexView)}async sign(e,t="SHA-1",n=mt(!0)){if(!e)throw new Error("Need to provide a private key for signing");let s=await n.getSignatureParameters(e,t),i=s.parameters;this.signature=s.signatureAlgorithm,this.signatureAlgorithm=s.signatureAlgorithm,this.tbsView=new Uint8Array(this.encodeTBS().toBER());let a=await n.signWithPrivateKey(this.tbsView,e,i);this.signatureValue=new Ct({valueHex:a})}async verify(e,t=mt(!0)){let n;if(e?n=e.subjectPublicKeyInfo:this.issuer.isEqual(this.subject)&&(n=this.subjectPublicKeyInfo),!(n instanceof qi))throw new Error("Please provide issuer certificate as a parameter");return t.verifyWithPublicKey(this.tbsView,this.signatureValue,n,this.signatureAlgorithm)}};Gn.CLASS_NAME="Certificate";function sH(r,e=null){if(e&&r.issuer.isEqual(e.issuer)&&r.serialNumber.isEqual(e.serialNumber))return null;let t=!1;if(r.extensions){for(let n of r.extensions)if(n.extnID===x_&&n.parsedValue instanceof N_&&n.parsedValue.cA){t=!0;break}}return t?r:null}o(sH,"checkCA");var td="certId",rd="certValue",_p="parsedValue",Yle=[td,rd],iH=class Z1 extends Se{static{o(this,"CertBag")}constructor(e={}){super(),this.certId=B(e,td,Z1.defaultValues(td)),this.certValue=B(e,rd,Z1.defaultValues(rd)),_p in e&&(this.parsedValue=B(e,_p,Z1.defaultValues(_p))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case td:return P;case rd:return new it;case _p:return{};default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case td:return t===P;case rd:return t instanceof it;case _p:return t instanceof Object&&Object.keys(t).length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new He({name:t.id||"id"}),new ae({idBlock:{tagClass:3,tagNumber:0},value:[new it({name:t.value||"value"})]})]})}fromSchema(e){Ce(e,Yle);let t=be(e,e,Z1.schema({names:{id:td,value:rd}}));ye.assertSchema(t,this.className),this.certId=t.result.certId.valueBlock.toString(),this.certValue=t.result.certValue;let n=this.certValue.valueBlock.valueHexView;switch(this.certId){case i7:try{this.parsedValue=Gn.fromBER(n)}catch{_c.fromBER(n)}break;case a7:this.parsedValue=_c.fromBER(n);break;case ele:default:throw new Error(`Incorrect CERT_ID value in CertBag: ${this.certId}`)}}toSchema(){return _p in this&&("acinfo"in this.parsedValue?this.certId=a7:this.certId=i7,this.certValue=new Be({valueHex:this.parsedValue.toSchema().toBER(!1)})),new K({value:[new He({value:this.certId}),new ae({idBlock:{tagClass:3,tagNumber:0},value:["toSchema"in this.certValue?this.certValue.toSchema():this.certValue]})]})}toJSON(){return{certId:this.certId,certValue:this.certValue.toJSON()}}};iH.CLASS_NAME="CertBag";var ev="userCertificate",nd="revocationDate",hf="crlEntryExtensions",Qle=[ev,nd,hf],aH=class tv extends Se{static{o(this,"RevokedCertificate")}constructor(e={}){super(),this.userCertificate=B(e,ev,tv.defaultValues(ev)),this.revocationDate=B(e,nd,tv.defaultValues(nd)),hf in e&&(this.crlEntryExtensions=B(e,hf,tv.defaultValues(hf))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case ev:return new he;case nd:return new kn;case hf:return new un;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new he({name:t.userCertificate||ev}),kn.schema({names:{utcTimeName:t.revocationDate||nd,generalTimeName:t.revocationDate||nd}}),un.schema({names:{blockName:t.crlEntryExtensions||hf}},!0)]})}fromSchema(e){Ce(e,Qle);let t=be(e,e,tv.schema());ye.assertSchema(t,this.className),this.userCertificate=t.result.userCertificate,this.revocationDate=new kn({schema:t.result.revocationDate}),hf in t.result&&(this.crlEntryExtensions=new un({schema:t.result.crlEntryExtensions}))}toSchema(){let e=[this.userCertificate,this.revocationDate.toSchema()];return this.crlEntryExtensions&&e.push(this.crlEntryExtensions.toSchema()),new K({value:e})}toJSON(){let e={userCertificate:this.userCertificate.toJSON(),revocationDate:this.revocationDate.toJSON()};return this.crlEntryExtensions&&(e.crlEntryExtensions=this.crlEntryExtensions.toJSON()),e}};aH.CLASS_NAME="RevokedCertificate";var JB="tbs",fy="version",YB="signature",QB="issuer",ZB="thisUpdate",Eb="nextUpdate",wb="revokedCertificates",bb="crlExtensions",rv="signatureAlgorithm",nv="signatureValue",Bo="tbsCertList",iA=`${Bo}.version`,__=`${Bo}.signature`,O_=`${Bo}.issuer`,aA=`${Bo}.thisUpdate`,Qv=`${Bo}.nextUpdate`,oA=`${Bo}.revokedCertificates`,uA=`${Bo}.extensions`,Zle=[Bo,iA,__,O_,aA,Qv,oA,uA,rv,nv];function efe(r={}){let e=B(r,"names",{});return new K({name:e.blockName||Bo,value:[new he({optional:!0,name:e.tbsCertListVersion||iA,value:2}),pe.schema(e.signature||{names:{blockName:__}}),Ar.schema(e.issuer||{names:{blockName:O_}}),kn.schema(e.tbsCertListThisUpdate||{names:{utcTimeName:aA,generalTimeName:aA}}),kn.schema(e.tbsCertListNextUpdate||{names:{utcTimeName:Qv,generalTimeName:Qv}},!0),new K({optional:!0,value:[new lt({name:e.tbsCertListRevokedCertificates||oA,value:new K({value:[new he,kn.schema(),un.schema({},!0)]})})]}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[un.schema(e.crlExtensions||{names:{blockName:uA}})]})]})}o(efe,"tbsCertList");var tfe=[w_,B7,jce,qce,R7,E_,b_,Hce,Kce,_7],Zv=class rs extends Se{static{o(this,"CertificateRevocationList")}get tbs(){return Ze.toArrayBuffer(this.tbsView)}set tbs(e){this.tbsView=new Uint8Array(e)}constructor(e={}){super(),this.tbsView=new Uint8Array(B(e,JB,rs.defaultValues(JB))),this.version=B(e,fy,rs.defaultValues(fy)),this.signature=B(e,YB,rs.defaultValues(YB)),this.issuer=B(e,QB,rs.defaultValues(QB)),this.thisUpdate=B(e,ZB,rs.defaultValues(ZB)),Eb in e&&(this.nextUpdate=B(e,Eb,rs.defaultValues(Eb))),wb in e&&(this.revokedCertificates=B(e,wb,rs.defaultValues(wb))),bb in e&&(this.crlExtensions=B(e,bb,rs.defaultValues(bb))),this.signatureAlgorithm=B(e,rv,rs.defaultValues(rv)),this.signatureValue=B(e,nv,rs.defaultValues(nv)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case JB:return Kr;case fy:return 0;case YB:return new pe;case QB:return new Ar;case ZB:return new kn;case Eb:return new kn;case wb:return[];case bb:return new un;case rv:return new pe;case nv:return new Ct;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||"CertificateList",value:[efe(e),pe.schema(t.signatureAlgorithm||{names:{blockName:rv}}),new Ct({name:t.signatureValue||nv})]})}fromSchema(e){Ce(e,Zle);let t=be(e,e,rs.schema());ye.assertSchema(t,this.className),this.tbsView=t.result.tbsCertList.valueBeforeDecodeView,iA in t.result&&(this.version=t.result[iA].valueBlock.valueDec),this.signature=new pe({schema:t.result[__]}),this.issuer=new Ar({schema:t.result[O_]}),this.thisUpdate=new kn({schema:t.result[aA]}),Qv in t.result&&(this.nextUpdate=new kn({schema:t.result[Qv]})),oA in t.result&&(this.revokedCertificates=Array.from(t.result[oA],n=>new aH({schema:n}))),uA in t.result&&(this.crlExtensions=new un({schema:t.result[uA]})),this.signatureAlgorithm=new pe({schema:t.result.signatureAlgorithm}),this.signatureValue=t.result.signatureValue}encodeTBS(){let e=[];return this.version!==rs.defaultValues(fy)&&e.push(new he({value:this.version})),e.push(this.signature.toSchema()),e.push(this.issuer.toSchema()),e.push(this.thisUpdate.toSchema()),this.nextUpdate&&e.push(this.nextUpdate.toSchema()),this.revokedCertificates&&e.push(new K({value:Array.from(this.revokedCertificates,t=>t.toSchema())})),this.crlExtensions&&e.push(new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[this.crlExtensions.toSchema()]})),new K({value:e})}toSchema(e=!1){let t;if(e)t=this.encodeTBS();else{if(!this.tbsView.byteLength)return rs.schema();let n=Or(this.tbsView);ye.assert(n,"TBS Certificate Revocation List"),t=n.result}return new K({value:[t,this.signatureAlgorithm.toSchema(),this.signatureValue]})}toJSON(){let e={tbs:ut.ToHex(this.tbsView),version:this.version,signature:this.signature.toJSON(),issuer:this.issuer.toJSON(),thisUpdate:this.thisUpdate.toJSON(),signatureAlgorithm:this.signatureAlgorithm.toJSON(),signatureValue:this.signatureValue.toJSON()};return this.version!==rs.defaultValues(fy)&&(e.version=this.version),this.nextUpdate&&(e.nextUpdate=this.nextUpdate.toJSON()),this.revokedCertificates&&(e.revokedCertificates=Array.from(this.revokedCertificates,t=>t.toJSON())),this.crlExtensions&&(e.crlExtensions=this.crlExtensions.toJSON()),e}isCertificateRevoked(e){if(!this.issuer.isEqual(e.issuer)||!this.revokedCertificates)return!1;for(let t of this.revokedCertificates)if(t.userCertificate.isEqual(e.serialNumber))return!0;return!1}async sign(e,t="SHA-1",n=mt(!0)){if(!e)throw new Error("Need to provide a private key for signing");let s=await n.getSignatureParameters(e,t),{parameters:i}=s;this.signature=s.signatureAlgorithm,this.signatureAlgorithm=s.signatureAlgorithm,this.tbsView=new Uint8Array(this.encodeTBS().toBER());let a=await n.signWithPrivateKey(this.tbsView,e,i);this.signatureValue=new Ct({valueHex:a})}async verify(e={},t=mt(!0)){let n;if(e.issuerCertificate&&(n=e.issuerCertificate.subjectPublicKeyInfo,!this.issuer.isEqual(e.issuerCertificate.subject)))return!1;if(e.publicKeyInfo&&(n=e.publicKeyInfo),!n)throw new Error("Issuer's certificate must be provided as an input parameter");if(this.crlExtensions){for(let s of this.crlExtensions.extensions)if(s.critical&&!tfe.includes(s.extnID))return!1}return t.verifyWithPublicKey(this.tbsView,this.signatureValue,n,this.signatureAlgorithm)}};Zv.CLASS_NAME="CertificateRevocationList";var sd="crlId",id="crlValue",hy="parsedValue",rfe=[sd,id],oH=class sv extends Se{static{o(this,"CRLBag")}constructor(e={}){super(),this.crlId=B(e,sd,sv.defaultValues(sd)),this.crlValue=B(e,id,sv.defaultValues(id)),hy in e&&(this.parsedValue=B(e,hy,sv.defaultValues(hy))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case sd:return P;case id:return new it;case hy:return{};default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case sd:return t===P;case id:return t instanceof it;case hy:return t instanceof Object&&Object.keys(t).length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new He({name:t.id||"id"}),new ae({idBlock:{tagClass:3,tagNumber:0},value:[new it({name:t.value||"value"})]})]})}fromSchema(e){Ce(e,rfe);let t=be(e,e,sv.schema({names:{id:sd,value:id}}));switch(ye.assertSchema(t,this.className),this.crlId=t.result.crlId.valueBlock.toString(),this.crlValue=t.result.crlValue,this.crlId){case o7:this.parsedValue=Zv.fromBER(this.certValue.valueBlock.valueHex);break;default:throw new Error(`Incorrect CRL_ID value in CRLBag: ${this.crlId}`)}}toSchema(){return this.parsedValue&&(this.crlId=o7,this.crlValue=new Be({valueHex:this.parsedValue.toSchema().toBER(!1)})),new K({value:[new He({value:this.crlId}),new ae({idBlock:{tagClass:3,tagNumber:0},value:[this.crlValue.toSchema()]})]})}toJSON(){return{crlId:this.crlId,crlValue:this.crlValue.toJSON()}}};oH.CLASS_NAME="CRLBag";var ad="version",od="encryptedContentInfo",ac="unprotectedAttrs",nfe=[ad,od,ac],ex=class iv extends Se{static{o(this,"EncryptedData")}constructor(e={}){super(),this.version=B(e,ad,iv.defaultValues(ad)),this.encryptedContentInfo=B(e,od,iv.defaultValues(od)),ac in e&&(this.unprotectedAttrs=B(e,ac,iv.defaultValues(ac))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case ad:return 0;case od:return new Xn;case ac:return[];default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case ad:return t===0;case od:return Xn.compareWithDefault("contentType",t.contentType)&&Xn.compareWithDefault("contentEncryptionAlgorithm",t.contentEncryptionAlgorithm)&&Xn.compareWithDefault("encryptedContent",t.encryptedContent);case ac:return t.length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new he({name:t.version||P}),Xn.schema(t.encryptedContentInfo||{}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:1},value:[new lt({name:t.unprotectedAttrs||P,value:$r.schema()})]})]})}fromSchema(e){Ce(e,nfe);let t=be(e,e,iv.schema({names:{version:ad,encryptedContentInfo:{names:{blockName:od}},unprotectedAttrs:ac}}));ye.assertSchema(t,this.className),this.version=t.result.version.valueBlock.valueDec,this.encryptedContentInfo=new Xn({schema:t.result.encryptedContentInfo}),ac in t.result&&(this.unprotectedAttrs=Array.from(t.result.unprotectedAttrs,n=>new $r({schema:n})))}toSchema(){let e=[];return e.push(new he({value:this.version})),e.push(this.encryptedContentInfo.toSchema()),this.unprotectedAttrs&&e.push(new ae({optional:!0,idBlock:{tagClass:3,tagNumber:1},value:Array.from(this.unprotectedAttrs,t=>t.toSchema())})),new K({value:e})}toJSON(){let e={version:this.version,encryptedContentInfo:this.encryptedContentInfo.toJSON()};return this.unprotectedAttrs&&(e.unprotectedAttrs=Array.from(this.unprotectedAttrs,t=>t.toJSON())),e}async encrypt(e,t=mt(!0)){hr.assert(e,"parameters","object");let n={...e,contentType:"1.2.840.113549.1.7.1"};this.encryptedContentInfo=await t.encryptEncryptedContentInfo(n)}async decrypt(e,t=mt(!0)){hr.assert(e,"parameters","object");let n={...e,encryptedContentInfo:this.encryptedContentInfo};return t.decryptEncryptedContentInfo(n)}};ex.CLASS_NAME="EncryptedData";var pf="encryptionAlgorithm",oc="encryptedData",py="parsedValue",sfe=[pf,oc],uH=class ud extends Se{static{o(this,"PKCS8ShroudedKeyBag")}constructor(e={}){super(),this.encryptionAlgorithm=B(e,pf,ud.defaultValues(pf)),this.encryptedData=B(e,oc,ud.defaultValues(oc)),py in e&&(this.parsedValue=B(e,py,ud.defaultValues(py))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case pf:return new pe;case oc:return new Be;case py:return{};default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case pf:return pe.compareWithDefault("algorithmId",t.algorithmId)&&!("algorithmParams"in t);case oc:return t.isEqual(ud.defaultValues(e));case py:return t instanceof Object&&Object.keys(t).length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[pe.schema(t.encryptionAlgorithm||{names:{blockName:pf}}),new Sr({value:[new Be({name:t.encryptedData||oc}),new Be({idBlock:{isConstructed:!0},name:t.encryptedData||oc})]})]})}fromSchema(e){Ce(e,sfe);let t=be(e,e,ud.schema({names:{encryptionAlgorithm:{names:{blockName:pf}},encryptedData:oc}}));ye.assertSchema(t,this.className),this.encryptionAlgorithm=new pe({schema:t.result.encryptionAlgorithm}),this.encryptedData=t.result.encryptedData}toSchema(){return new K({value:[this.encryptionAlgorithm.toSchema(),this.encryptedData]})}toJSON(){return{encryptionAlgorithm:this.encryptionAlgorithm.toJSON(),encryptedData:this.encryptedData.toJSON()}}async parseInternalValues(e,t=mt(!0)){let s=await new ex({encryptedContentInfo:new Xn({contentEncryptionAlgorithm:this.encryptionAlgorithm,encryptedContent:this.encryptedData})}).decrypt(e,t);this.parsedValue=Yv.fromBER(s)}async makeInternalValues(e,t=mt(!0)){if(!this.parsedValue)throw new Error('Please initialize "parsedValue" first');let n=new ex,s={...e,contentToEncrypt:this.parsedValue.toSchema().toBER(!1)};if(await n.encrypt(s,t),!n.encryptedContentInfo.encryptedContent)throw new Error("The filed `encryptedContent` in EncryptedContentInfo is empty");this.encryptionAlgorithm=n.encryptedContentInfo.contentEncryptionAlgorithm,this.encryptedData=n.encryptedContentInfo.encryptedContent}};uH.CLASS_NAME="PKCS8ShroudedKeyBag";var cd="secretTypeId",ld="secretValue",ife=[cd,ld],cH=class dS extends Se{static{o(this,"SecretBag")}constructor(e={}){super(),this.secretTypeId=B(e,cd,dS.defaultValues(cd)),this.secretValue=B(e,ld,dS.defaultValues(ld)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case cd:return P;case ld:return new it;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case cd:return t===P;case ld:return t instanceof it;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new He({name:t.id||"id"}),new ae({idBlock:{tagClass:3,tagNumber:0},value:[new it({name:t.value||"value"})]})]})}fromSchema(e){Ce(e,ife);let t=be(e,e,dS.schema({names:{id:cd,value:ld}}));ye.assertSchema(t,this.className),this.secretTypeId=t.result.secretTypeId.valueBlock.toString(),this.secretValue=t.result.secretValue}toSchema(){return new K({value:[new He({value:this.secretTypeId}),new ae({idBlock:{tagClass:3,tagNumber:0},value:[this.secretValue.toSchema()]})]})}toJSON(){return{secretTypeId:this.secretTypeId,secretValue:this.secretValue.toJSON()}}};cH.CLASS_NAME="SecretBag";var afe=class df{static{o(this,"SafeBagValueFactory")}static getItems(){return this.items||(this.items={},df.register("1.2.840.113549.1.12.10.1.1",Yv),df.register("1.2.840.113549.1.12.10.1.2",uH),df.register("1.2.840.113549.1.12.10.1.3",iH),df.register("1.2.840.113549.1.12.10.1.4",oH),df.register("1.2.840.113549.1.12.10.1.5",cH),df.register("1.2.840.113549.1.12.10.1.6",ym)),this.items}static register(e,t){this.getItems()[e]=t}static find(e){return this.getItems()[e]||null}},mf="bagId",gf="bagValue",vo="bagAttributes",ofe=[mf,gf,vo],HR=class av extends Se{static{o(this,"SafeBag")}constructor(e={}){super(),this.bagId=B(e,mf,av.defaultValues(mf)),this.bagValue=B(e,gf,av.defaultValues(gf)),vo in e&&(this.bagAttributes=B(e,vo,av.defaultValues(vo))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case mf:return P;case gf:return new it;case vo:return[];default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case mf:return t===P;case gf:return t instanceof it;case vo:return t.length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new He({name:t.bagId||mf}),new ae({idBlock:{tagClass:3,tagNumber:0},value:[new it({name:t.bagValue||gf})]}),new kr({optional:!0,value:[new lt({name:t.bagAttributes||vo,value:$r.schema()})]})]})}fromSchema(e){Ce(e,ofe);let t=be(e,e,av.schema({names:{bagId:mf,bagValue:gf,bagAttributes:vo}}));ye.assertSchema(t,this.className),this.bagId=t.result.bagId.valueBlock.toString();let n=afe.find(this.bagId);if(!n)throw new Error(`Invalid BAG_ID for SafeBag: ${this.bagId}`);this.bagValue=new n({schema:t.result.bagValue}),vo in t.result&&(this.bagAttributes=Array.from(t.result.bagAttributes,s=>new $r({schema:s})))}toSchema(){let e=[new He({value:this.bagId}),new ae({idBlock:{tagClass:3,tagNumber:0},value:[this.bagValue.toSchema()]})];return this.bagAttributes&&e.push(new kr({value:Array.from(this.bagAttributes,t=>t.toSchema())})),new K({value:e})}toJSON(){let e={bagId:this.bagId,bagValue:this.bagValue.toJSON()};return this.bagAttributes&&(e.bagAttributes=Array.from(this.bagAttributes,t=>t.toJSON())),e}};HR.CLASS_NAME="SafeBag";var Op="safeBags",ym=class KR extends Se{static{o(this,"SafeContents")}constructor(e={}){super(),this.safeBags=B(e,Op,KR.defaultValues(Op)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Op:return[];default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Op:return t.length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new lt({name:t.safeBags||P,value:HR.schema()})]})}fromSchema(e){Ce(e,[Op]);let t=be(e,e,KR.schema({names:{safeBags:Op}}));ye.assertSchema(t,this.className),this.safeBags=Array.from(t.result.safeBags,n=>new HR({schema:n}))}toSchema(){return new K({value:Array.from(this.safeBags,e=>e.toSchema())})}toJSON(){return{safeBags:Array.from(this.safeBags,e=>e.toJSON())}}};ym.CLASS_NAME="SafeContents";var ov="otherCertFormat",uv="otherCert",ufe=[ov,uv],mS=class gS extends Se{static{o(this,"OtherCertificateFormat")}constructor(e={}){super(),this.otherCertFormat=B(e,ov,gS.defaultValues(ov)),this.otherCert=B(e,uv,gS.defaultValues(uv)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case ov:return P;case uv:return new it;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new He({name:t.otherCertFormat||ov}),new it({name:t.otherCert||uv})]})}fromSchema(e){Ce(e,ufe);let t=be(e,e,gS.schema());ye.assertSchema(t,this.className),this.otherCertFormat=t.result.otherCertFormat.valueBlock.toString(),this.otherCert=t.result.otherCert}toSchema(){return new K({value:[new He({value:this.otherCertFormat}),this.otherCert]})}toJSON(){let e={otherCertFormat:this.otherCertFormat};return this.otherCert instanceof it||(e.otherCert=this.otherCert.toJSON()),e}},cv="certificates",cfe=[cv],Qf=class $R extends Se{static{o(this,"CertificateSet")}constructor(e={}){super(),this.certificates=B(e,cv,$R.defaultValues(cv)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case cv:return[];default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new kr({name:t.blockName||P,value:[new lt({name:t.certificates||cv,value:new Sr({value:[Gn.schema(),new ae({idBlock:{tagClass:3,tagNumber:0},value:[new it]}),new ae({idBlock:{tagClass:3,tagNumber:1},value:[new K]}),new ae({idBlock:{tagClass:3,tagNumber:2},value:_c.schema().valueBlock.value}),new ae({idBlock:{tagClass:3,tagNumber:3},value:mS.schema().valueBlock.value})]})})]})}fromSchema(e){Ce(e,cfe);let t=be(e,e,$R.schema());ye.assertSchema(t,this.className),this.certificates=Array.from(t.result.certificates||[],n=>{let s=n.idBlock.tagNumber;if(n.idBlock.tagClass===1)return new Gn({schema:n});let i=new K({value:n.valueBlock.value});switch(s){case 1:return i.valueBlock.value[0].valueBlock.value[0].valueBlock.valueDec===1?new _c({schema:i}):new ZS({schema:i});case 2:return new _c({schema:i});case 3:return new mS({schema:i})}return n})}toSchema(){return new kr({value:Array.from(this.certificates,e=>{switch(!0){case e instanceof Gn:return e.toSchema();case e instanceof ZS:return new ae({idBlock:{tagClass:3,tagNumber:1},value:e.toSchema().valueBlock.value});case e instanceof _c:return new ae({idBlock:{tagClass:3,tagNumber:2},value:e.toSchema().valueBlock.value});case e instanceof mS:return new ae({idBlock:{tagClass:3,tagNumber:3},value:e.toSchema().valueBlock.value})}return e.toSchema()})})}toJSON(){return{certificates:Array.from(this.certificates,e=>e.toJSON())}}};Qf.CLASS_NAME="CertificateSet";var lv="otherRevInfoFormat",fv="otherRevInfo",lfe=[lv,fv],$v=class yS extends Se{static{o(this,"OtherRevocationInfoFormat")}constructor(e={}){super(),this.otherRevInfoFormat=B(e,lv,yS.defaultValues(lv)),this.otherRevInfo=B(e,fv,yS.defaultValues(fv)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case lv:return P;case fv:return new it;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new He({name:t.otherRevInfoFormat||lv}),new it({name:t.otherRevInfo||fv})]})}fromSchema(e){Ce(e,lfe);let t=be(e,e,yS.schema());ye.assertSchema(t,this.className),this.otherRevInfoFormat=t.result.otherRevInfoFormat.valueBlock.toString(),this.otherRevInfo=t.result.otherRevInfo}toSchema(){return new K({value:[new He({value:this.otherRevInfoFormat}),this.otherRevInfo]})}toJSON(){let e={otherRevInfoFormat:this.otherRevInfoFormat};return this.otherRevInfo instanceof it||(e.otherRevInfo=this.otherRevInfo.toJSON()),e}};$v.CLASS_NAME="OtherRevocationInfoFormat";var hv="crls",eR="otherRevocationInfos",ffe=[hv],Xv=class vS extends Se{static{o(this,"RevocationInfoChoices")}constructor(e={}){super(),this.crls=B(e,hv,vS.defaultValues(hv)),this.otherRevocationInfos=B(e,eR,vS.defaultValues(eR)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case hv:return[];case eR:return[];default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new kr({name:t.blockName||P,value:[new lt({name:t.crls||P,value:new Sr({value:[Zv.schema(),new ae({idBlock:{tagClass:3,tagNumber:1},value:[new He,new it]})]})})]})}fromSchema(e){Ce(e,ffe);let t=be(e,e,vS.schema({names:{crls:hv}}));if(ye.assertSchema(t,this.className),t.result.crls)for(let n of t.result.crls)n.idBlock.tagClass===1?this.crls.push(new Zv({schema:n})):this.otherRevocationInfos.push(new $v({schema:n}))}toSchema(){let e=[];return e.push(...Array.from(this.crls,t=>t.toSchema())),e.push(...Array.from(this.otherRevocationInfos,t=>{let n=t.toSchema();return n.idBlock.tagClass=3,n.idBlock.tagNumber=1,n})),new kr({value:e})}toJSON(){return{crls:Array.from(this.crls,e=>e.toJSON()),otherRevocationInfos:Array.from(this.otherRevocationInfos,e=>e.toJSON())}}};Xv.CLASS_NAME="RevocationInfoChoices";var pv="certs",yf="crls",hfe=[pv,yf],xS=class XR extends Se{static{o(this,"OriginatorInfo")}constructor(e={}){super(),this.crls=B(e,yf,XR.defaultValues(yf)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case pv:return new Qf;case yf:return new Xv;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case pv:return t.certificates.length===0;case yf:return t.crls.length===0&&t.otherRevocationInfos.length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new ae({name:t.certs||P,optional:!0,idBlock:{tagClass:3,tagNumber:0},value:Qf.schema().valueBlock.value}),new ae({name:t.crls||P,optional:!0,idBlock:{tagClass:3,tagNumber:1},value:Xv.schema().valueBlock.value})]})}fromSchema(e){Ce(e,hfe);let t=be(e,e,XR.schema({names:{certs:pv,crls:yf}}));ye.assertSchema(t,this.className),pv in t.result&&(this.certs=new Qf({schema:new kr({value:t.result.certs.valueBlock.value})})),yf in t.result&&(this.crls=new Xv({schema:new kr({value:t.result.crls.valueBlock.value})}))}toSchema(){let e=[];return this.certs&&e.push(new ae({idBlock:{tagClass:3,tagNumber:0},value:this.certs.toSchema().valueBlock.value})),this.crls&&e.push(new ae({idBlock:{tagClass:3,tagNumber:1},value:this.crls.toSchema().valueBlock.value})),new K({value:e})}toJSON(){let e={};return this.certs&&(e.certs=this.certs.toJSON()),this.crls&&(e.crls=this.crls.toJSON()),e}};xS.CLASS_NAME="OriginatorInfo";var dv="issuer",mv="serialNumber",pfe=[dv,mv],Ln=class ES extends Se{static{o(this,"IssuerAndSerialNumber")}constructor(e={}){super(),this.issuer=B(e,dv,ES.defaultValues(dv)),this.serialNumber=B(e,mv,ES.defaultValues(mv)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case dv:return new Ar;case mv:return new he;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[Ar.schema(t.issuer||{}),new he({name:t.serialNumber||P})]})}fromSchema(e){Ce(e,pfe);let t=be(e,e,ES.schema({names:{issuer:{names:{blockName:dv}},serialNumber:mv}}));ye.assertSchema(t,this.className),this.issuer=new Ar({schema:t.result.issuer}),this.serialNumber=t.result.serialNumber}toSchema(){return new K({value:[this.issuer.toSchema(),this.serialNumber]})}toJSON(){return{issuer:this.issuer.toJSON(),serialNumber:this.serialNumber.toJSON()}}};Ln.CLASS_NAME="IssuerAndSerialNumber";var Sb="variant",dy="value",dfe=["blockName"],lH=class wS extends Se{static{o(this,"RecipientIdentifier")}constructor(e={}){super(),this.variant=B(e,Sb,wS.defaultValues(Sb)),dy in e&&(this.value=B(e,dy,wS.defaultValues(dy))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Sb:return-1;case dy:return{};default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Sb:return t===-1;case dy:return Object.keys(t).length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new Sr({value:[Ln.schema({names:{blockName:t.blockName||P}}),new tt({name:t.blockName||P,idBlock:{tagClass:3,tagNumber:0}})]})}fromSchema(e){Ce(e,dfe);let t=be(e,e,wS.schema({names:{blockName:"blockName"}}));ye.assertSchema(t,this.className),t.result.blockName.idBlock.tagClass===1?(this.variant=1,this.value=new Ln({schema:t.result.blockName})):(this.variant=2,this.value=new Be({valueHex:t.result.blockName.valueBlock.valueHex}))}toSchema(){switch(this.variant){case 1:if(!(this.value instanceof Ln))throw new Error("Incorrect type of RecipientIdentifier.value. It should be IssuerAndSerialNumber.");return this.value.toSchema();case 2:if(!(this.value instanceof Be))throw new Error("Incorrect type of RecipientIdentifier.value. It should be ASN.1 OctetString.");return new tt({idBlock:{tagClass:3,tagNumber:0},valueHex:this.value.valueBlock.valueHexView});default:return new it}}toJSON(){let e={variant:this.variant};return(this.variant===1||this.variant===2)&&this.value&&(e.value=this.value.toJSON()),e}};lH.CLASS_NAME="RecipientIdentifier";var vf="version",fd="rid",hd="keyEncryptionAlgorithm",pd="encryptedKey",Ab="recipientCertificate",mfe=[vf,fd,hd,pd],cA=class xo extends Se{static{o(this,"KeyTransRecipientInfo")}constructor(e={}){super(),this.version=B(e,vf,xo.defaultValues(vf)),this.rid=B(e,fd,xo.defaultValues(fd)),this.keyEncryptionAlgorithm=B(e,hd,xo.defaultValues(hd)),this.encryptedKey=B(e,pd,xo.defaultValues(pd)),this.recipientCertificate=B(e,Ab,xo.defaultValues(Ab)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case vf:return-1;case fd:return{};case hd:return new pe;case pd:return new Be;case Ab:return new Gn;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case vf:return t===xo.defaultValues(vf);case fd:return Object.keys(t).length===0;case hd:case pd:return t.isEqual(xo.defaultValues(e));case Ab:return!1;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new he({name:t.version||P}),lH.schema(t.rid||{}),pe.schema(t.keyEncryptionAlgorithm||{}),new Be({name:t.encryptedKey||P})]})}fromSchema(e){Ce(e,mfe);let t=be(e,e,xo.schema({names:{version:vf,rid:{names:{blockName:fd}},keyEncryptionAlgorithm:{names:{blockName:hd}},encryptedKey:pd}}));ye.assertSchema(t,this.className),this.version=t.result.version.valueBlock.valueDec,t.result.rid.idBlock.tagClass===3?this.rid=new Be({valueHex:t.result.rid.valueBlock.valueHex}):this.rid=new Ln({schema:t.result.rid}),this.keyEncryptionAlgorithm=new pe({schema:t.result.keyEncryptionAlgorithm}),this.encryptedKey=t.result.encryptedKey}toSchema(){let e=[];return this.rid instanceof Ln?(this.version=0,e.push(new he({value:this.version})),e.push(this.rid.toSchema())):(this.version=2,e.push(new he({value:this.version})),e.push(new tt({idBlock:{tagClass:3,tagNumber:0},valueHex:this.rid.valueBlock.valueHexView}))),e.push(this.keyEncryptionAlgorithm.toSchema()),e.push(this.encryptedKey),new K({value:e})}toJSON(){return{version:this.version,rid:this.rid.toJSON(),keyEncryptionAlgorithm:this.keyEncryptionAlgorithm.toJSON(),encryptedKey:this.encryptedKey.toJSON()}}};cA.CLASS_NAME="KeyTransRecipientInfo";var dd="algorithm",md="publicKey",gfe=[dd,md],lA=class gv extends Se{static{o(this,"OriginatorPublicKey")}constructor(e={}){super(),this.algorithm=B(e,dd,gv.defaultValues(dd)),this.publicKey=B(e,md,gv.defaultValues(md)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case dd:return new pe;case md:return new Ct;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case dd:case md:return t.isEqual(gv.defaultValues(e));default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[pe.schema(t.algorithm||{}),new Ct({name:t.publicKey||P})]})}fromSchema(e){Ce(e,gfe);let t=be(e,e,gv.schema({names:{algorithm:{names:{blockName:dd}},publicKey:md}}));ye.assertSchema(t,this.className),this.algorithm=new pe({schema:t.result.algorithm}),this.publicKey=t.result.publicKey}toSchema(){return new K({value:[this.algorithm.toSchema(),this.publicKey]})}toJSON(){return{algorithm:this.algorithm.toJSON(),publicKey:this.publicKey.toJSON()}}};lA.CLASS_NAME="OriginatorPublicKey";var Cb="variant",my="value",yfe=["blockName"],Gv=class bS extends Se{static{o(this,"OriginatorIdentifierOrKey")}constructor(e={}){super(),this.variant=B(e,Cb,bS.defaultValues(Cb)),my in e&&(this.value=B(e,my,bS.defaultValues(my))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Cb:return-1;case my:return{};default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Cb:return t===-1;case my:return Object.keys(t).length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new Sr({value:[Ln.schema({names:{blockName:t.blockName||P}}),new tt({idBlock:{tagClass:3,tagNumber:0},name:t.blockName||P}),new ae({idBlock:{tagClass:3,tagNumber:1},name:t.blockName||P,value:lA.schema().valueBlock.value})]})}fromSchema(e){Ce(e,yfe);let t=be(e,e,bS.schema({names:{blockName:"blockName"}}));ye.assertSchema(t,this.className),t.result.blockName.idBlock.tagClass===1?(this.variant=1,this.value=new Ln({schema:t.result.blockName})):t.result.blockName.idBlock.tagNumber===0?(t.result.blockName.idBlock.tagClass=1,t.result.blockName.idBlock.tagNumber=4,this.variant=2,this.value=t.result.blockName):(this.variant=3,this.value=new lA({schema:new K({value:t.result.blockName.valueBlock.value})}))}toSchema(){switch(this.variant){case 1:return this.value.toSchema();case 2:return this.value.idBlock.tagClass=3,this.value.idBlock.tagNumber=0,this.value;case 3:{let e=this.value.toSchema();return e.idBlock.tagClass=3,e.idBlock.tagNumber=1,e}default:return new it}}toJSON(){let e={variant:this.variant};return(this.variant===1||this.variant===2||this.variant===3)&&(e.value=this.value.toJSON()),e}};Gv.CLASS_NAME="OriginatorIdentifierOrKey";var gd="keyAttrId",wa="keyAttr",vfe=[gd,wa],Zf=class SS extends Se{static{o(this,"OtherKeyAttribute")}constructor(e={}){super(),this.keyAttrId=B(e,gd,SS.defaultValues(gd)),wa in e&&(this.keyAttr=B(e,wa,SS.defaultValues(wa))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case gd:return P;case wa:return{};default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case gd:return typeof t=="string"&&t===P;case wa:return Object.keys(t).length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({optional:t.optional||!0,name:t.blockName||P,value:[new He({name:t.keyAttrId||P}),new it({optional:!0,name:t.keyAttr||P})]})}fromSchema(e){Ce(e,vfe);let t=be(e,e,SS.schema({names:{keyAttrId:gd,keyAttr:wa}}));ye.assertSchema(t,this.className),this.keyAttrId=t.result.keyAttrId.valueBlock.toString(),wa in t.result&&(this.keyAttr=t.result.keyAttr)}toSchema(){let e=[];return e.push(new He({value:this.keyAttrId})),wa in this&&e.push(this.keyAttr),new K({value:e})}toJSON(){let e={keyAttrId:this.keyAttrId};return wa in this&&(e.keyAttr=this.keyAttr.toJSON()),e}};Zf.CLASS_NAME="OtherKeyAttribute";var xf="subjectKeyIdentifier",uc="date",cc="other",xfe=[xf,uc,cc],fA=class yd extends Se{static{o(this,"RecipientKeyIdentifier")}constructor(e={}){super(),this.subjectKeyIdentifier=B(e,xf,yd.defaultValues(xf)),uc in e&&(this.date=B(e,uc,yd.defaultValues(uc))),cc in e&&(this.other=B(e,cc,yd.defaultValues(cc))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case xf:return new Be;case uc:return new br;case cc:return new Zf;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case xf:return t.isEqual(yd.defaultValues(xf));case uc:return t.year===0&&t.month===0&&t.day===0&&t.hour===0&&t.minute===0&&t.second===0&&t.millisecond===0;case cc:return t.keyAttrId===P&&!("keyAttr"in t);default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new Be({name:t.subjectKeyIdentifier||P}),new br({optional:!0,name:t.date||P}),Zf.schema(t.other||{})]})}fromSchema(e){Ce(e,xfe);let t=be(e,e,yd.schema({names:{subjectKeyIdentifier:xf,date:uc,other:{names:{blockName:cc}}}}));ye.assertSchema(t,this.className),this.subjectKeyIdentifier=t.result.subjectKeyIdentifier,uc in t.result&&(this.date=t.result.date),cc in t.result&&(this.other=new Zf({schema:t.result.other}))}toSchema(){let e=[];return e.push(this.subjectKeyIdentifier),this.date&&e.push(this.date),this.other&&e.push(this.other.toSchema()),new K({value:e})}toJSON(){let e={subjectKeyIdentifier:this.subjectKeyIdentifier.toJSON()};return this.date&&(e.date=this.date.toJSON()),this.other&&(e.other=this.other.toJSON()),e}};fA.CLASS_NAME="RecipientKeyIdentifier";var Nb="variant",Tb="value",Efe=["blockName"],xm=class AS extends Se{static{o(this,"KeyAgreeRecipientIdentifier")}constructor(e={}){super(),this.variant=B(e,Nb,AS.defaultValues(Nb)),this.value=B(e,Tb,AS.defaultValues(Tb)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Nb:return-1;case Tb:return{};default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Nb:return t===-1;case Tb:return Object.keys(t).length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new Sr({value:[Ln.schema(t.issuerAndSerialNumber||{names:{blockName:t.blockName||P}}),new ae({name:t.blockName||P,idBlock:{tagClass:3,tagNumber:0},value:fA.schema(t.rKeyId||{names:{blockName:t.blockName||P}}).valueBlock.value})]})}fromSchema(e){Ce(e,Efe);let t=be(e,e,AS.schema({names:{blockName:"blockName"}}));ye.assertSchema(t,this.className),t.result.blockName.idBlock.tagClass===1?(this.variant=1,this.value=new Ln({schema:t.result.blockName})):(this.variant=2,this.value=new fA({schema:new K({value:t.result.blockName.valueBlock.value})}))}toSchema(){switch(this.variant){case 1:return this.value.toSchema();case 2:return new ae({idBlock:{tagClass:3,tagNumber:0},value:this.value.toSchema().valueBlock.value});default:return new it}}toJSON(){let e={variant:this.variant};return(this.variant===1||this.variant===2)&&(e.value=this.value.toJSON()),e}};xm.CLASS_NAME="KeyAgreeRecipientIdentifier";var vd="rid",Ef="encryptedKey",wfe=[vd,Ef],hA=class yv extends Se{static{o(this,"RecipientEncryptedKey")}constructor(e={}){super(),this.rid=B(e,vd,yv.defaultValues(vd)),this.encryptedKey=B(e,Ef,yv.defaultValues(Ef)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case vd:return new xm;case Ef:return new Be;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case vd:return t.variant===-1&&!("value"in t);case Ef:return t.isEqual(yv.defaultValues(Ef));default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[xm.schema(t.rid||{}),new Be({name:t.encryptedKey||P})]})}fromSchema(e){Ce(e,wfe);let t=be(e,e,yv.schema({names:{rid:{names:{blockName:vd}},encryptedKey:Ef}}));ye.assertSchema(t,this.className),this.rid=new xm({schema:t.result.rid}),this.encryptedKey=t.result.encryptedKey}toSchema(){return new K({value:[this.rid.toSchema(),this.encryptedKey]})}toJSON(){return{rid:this.rid.toJSON(),encryptedKey:this.encryptedKey.toJSON()}}};hA.CLASS_NAME="RecipientEncryptedKey";var Ib="encryptedKeys",fH="RecipientEncryptedKeys",bfe=[fH],zv=class GR extends Se{static{o(this,"RecipientEncryptedKeys")}constructor(e={}){super(),this.encryptedKeys=B(e,Ib,GR.defaultValues(Ib)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Ib:return[];default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Ib:return t.length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new lt({name:t.RecipientEncryptedKeys||P,value:hA.schema()})]})}fromSchema(e){Ce(e,bfe);let t=be(e,e,GR.schema({names:{RecipientEncryptedKeys:fH}}));ye.assertSchema(t,this.className),this.encryptedKeys=Array.from(t.result.RecipientEncryptedKeys,n=>new hA({schema:n}))}toSchema(){return new K({value:Array.from(this.encryptedKeys,e=>e.toSchema())})}toJSON(){return{encryptedKeys:Array.from(this.encryptedKeys,e=>e.toJSON())}}};zv.CLASS_NAME="RecipientEncryptedKeys";var xd="version",Ed="originator",Eo="ukm",wd="keyEncryptionAlgorithm",bd="recipientEncryptedKeys",Db="recipientCertificate",Bb="recipientPublicKey",Sfe=[xd,Ed,Eo,wd,bd],pA=class ba extends Se{static{o(this,"KeyAgreeRecipientInfo")}constructor(e={}){super(),this.version=B(e,xd,ba.defaultValues(xd)),this.originator=B(e,Ed,ba.defaultValues(Ed)),Eo in e&&(this.ukm=B(e,Eo,ba.defaultValues(Eo))),this.keyEncryptionAlgorithm=B(e,wd,ba.defaultValues(wd)),this.recipientEncryptedKeys=B(e,bd,ba.defaultValues(bd)),this.recipientCertificate=B(e,Db,ba.defaultValues(Db)),this.recipientPublicKey=B(e,Bb,ba.defaultValues(Bb)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case xd:return 0;case Ed:return new Gv;case Eo:return new Be;case wd:return new pe;case bd:return new zv;case Db:return new Gn;case Bb:return null;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case xd:return t===0;case Ed:return t.variant===-1&&!("value"in t);case Eo:return t.isEqual(ba.defaultValues(Eo));case wd:return t.algorithmId===P&&!("algorithmParams"in t);case bd:return t.encryptedKeys.length===0;case Db:return!1;case Bb:return!1;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new he({name:t.version||P}),new ae({idBlock:{tagClass:3,tagNumber:0},value:[Gv.schema(t.originator||{})]}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:1},value:[new Be({name:t.ukm||P})]}),pe.schema(t.keyEncryptionAlgorithm||{}),zv.schema(t.recipientEncryptedKeys||{})]})}fromSchema(e){Ce(e,Sfe);let t=be(e,e,ba.schema({names:{version:xd,originator:{names:{blockName:Ed}},ukm:Eo,keyEncryptionAlgorithm:{names:{blockName:wd}},recipientEncryptedKeys:{names:{blockName:bd}}}}));ye.assertSchema(t,this.className),this.version=t.result.version.valueBlock.valueDec,this.originator=new Gv({schema:t.result.originator}),Eo in t.result&&(this.ukm=t.result.ukm),this.keyEncryptionAlgorithm=new pe({schema:t.result.keyEncryptionAlgorithm}),this.recipientEncryptedKeys=new zv({schema:t.result.recipientEncryptedKeys})}toSchema(){let e=[];return e.push(new he({value:this.version})),e.push(new ae({idBlock:{tagClass:3,tagNumber:0},value:[this.originator.toSchema()]})),this.ukm&&e.push(new ae({optional:!0,idBlock:{tagClass:3,tagNumber:1},value:[this.ukm]})),e.push(this.keyEncryptionAlgorithm.toSchema()),e.push(this.recipientEncryptedKeys.toSchema()),new K({value:e})}toJSON(){let e={version:this.version,originator:this.originator.toJSON(),keyEncryptionAlgorithm:this.keyEncryptionAlgorithm.toJSON(),recipientEncryptedKeys:this.recipientEncryptedKeys.toJSON()};return this.ukm&&(e.ukm=this.ukm.toJSON()),e}};pA.CLASS_NAME="KeyAgreeRecipientInfo";var wf="keyIdentifier",lc="date",fc="other",Afe=[wf,lc,fc],Wv=class Sd extends Se{static{o(this,"KEKIdentifier")}constructor(e={}){super(),this.keyIdentifier=B(e,wf,Sd.defaultValues(wf)),lc in e&&(this.date=B(e,lc,Sd.defaultValues(lc))),fc in e&&(this.other=B(e,fc,Sd.defaultValues(fc))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case wf:return new Be;case lc:return new br;case fc:return new Zf;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case wf:return t.isEqual(Sd.defaultValues(wf));case lc:return t.year===0&&t.month===0&&t.day===0&&t.hour===0&&t.minute===0&&t.second===0&&t.millisecond===0;case fc:return t.compareWithDefault("keyAttrId",t.keyAttrId)&&!("keyAttr"in t);default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new Be({name:t.keyIdentifier||P}),new br({optional:!0,name:t.date||P}),Zf.schema(t.other||{})]})}fromSchema(e){Ce(e,Afe);let t=be(e,e,Sd.schema({names:{keyIdentifier:wf,date:lc,other:{names:{blockName:fc}}}}));ye.assertSchema(t,this.className),this.keyIdentifier=t.result.keyIdentifier,lc in t.result&&(this.date=t.result.date),fc in t.result&&(this.other=new Zf({schema:t.result.other}))}toSchema(){let e=[];return e.push(this.keyIdentifier),this.date&&e.push(this.date),this.other&&e.push(this.other.toSchema()),new K({value:e})}toJSON(){let e={keyIdentifier:this.keyIdentifier.toJSON()};return this.date&&(e.date=this.date),this.other&&(e.other=this.other.toJSON()),e}};Wv.CLASS_NAME="KEKIdentifier";var Ad="version",Cd="kekid",Nd="keyEncryptionAlgorithm",bf="encryptedKey",Rb="preDefinedKEK",Cfe=[Ad,Cd,Nd,bf],dA=class wo extends Se{static{o(this,"KEKRecipientInfo")}constructor(e={}){super(),this.version=B(e,Ad,wo.defaultValues(Ad)),this.kekid=B(e,Cd,wo.defaultValues(Cd)),this.keyEncryptionAlgorithm=B(e,Nd,wo.defaultValues(Nd)),this.encryptedKey=B(e,bf,wo.defaultValues(bf)),this.preDefinedKEK=B(e,Rb,wo.defaultValues(Rb)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Ad:return 0;case Cd:return new Wv;case Nd:return new pe;case bf:return new Be;case Rb:return Kr;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case"KEKRecipientInfo":return t===wo.defaultValues(Ad);case Cd:return t.compareWithDefault("keyIdentifier",t.keyIdentifier)&&!("date"in t)&&!("other"in t);case Nd:return t.algorithmId===P&&!("algorithmParams"in t);case bf:return t.isEqual(wo.defaultValues(bf));case Rb:return t.byteLength===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new he({name:t.version||P}),Wv.schema(t.kekid||{}),pe.schema(t.keyEncryptionAlgorithm||{}),new Be({name:t.encryptedKey||P})]})}fromSchema(e){Ce(e,Cfe);let t=be(e,e,wo.schema({names:{version:Ad,kekid:{names:{blockName:Cd}},keyEncryptionAlgorithm:{names:{blockName:Nd}},encryptedKey:bf}}));ye.assertSchema(t,this.className),this.version=t.result.version.valueBlock.valueDec,this.kekid=new Wv({schema:t.result.kekid}),this.keyEncryptionAlgorithm=new pe({schema:t.result.keyEncryptionAlgorithm}),this.encryptedKey=t.result.encryptedKey}toSchema(){return new K({value:[new he({value:this.version}),this.kekid.toSchema(),this.keyEncryptionAlgorithm.toSchema(),this.encryptedKey]})}toJSON(){return{version:this.version,kekid:this.kekid.toJSON(),keyEncryptionAlgorithm:this.keyEncryptionAlgorithm.toJSON(),encryptedKey:this.encryptedKey.toJSON()}}};dA.CLASS_NAME="KEKRecipientInfo";var Td="version",hc="keyDerivationAlgorithm",Id="keyEncryptionAlgorithm",Sf="encryptedKey",_b="password",Nfe=[Td,hc,Id,Sf],mA=class pc extends Se{static{o(this,"PasswordRecipientinfo")}constructor(e={}){super(),this.version=B(e,Td,pc.defaultValues(Td)),hc in e&&(this.keyDerivationAlgorithm=B(e,hc,pc.defaultValues(hc))),this.keyEncryptionAlgorithm=B(e,Id,pc.defaultValues(Id)),this.encryptedKey=B(e,Sf,pc.defaultValues(Sf)),this.password=B(e,_b,pc.defaultValues(_b)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Td:return-1;case hc:return new pe;case Id:return new pe;case Sf:return new Be;case _b:return Kr;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Td:return t===-1;case hc:case Id:return t.algorithmId===P&&!("algorithmParams"in t);case Sf:return t.isEqual(pc.defaultValues(Sf));case _b:return t.byteLength===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new he({name:t.version||P}),new ae({name:t.keyDerivationAlgorithm||P,optional:!0,idBlock:{tagClass:3,tagNumber:0},value:pe.schema().valueBlock.value}),pe.schema(t.keyEncryptionAlgorithm||{}),new Be({name:t.encryptedKey||P})]})}fromSchema(e){Ce(e,Nfe);let t=be(e,e,pc.schema({names:{version:Td,keyDerivationAlgorithm:hc,keyEncryptionAlgorithm:{names:{blockName:Id}},encryptedKey:Sf}}));ye.assertSchema(t,this.className),this.version=t.result.version.valueBlock.valueDec,hc in t.result&&(this.keyDerivationAlgorithm=new pe({schema:new K({value:t.result.keyDerivationAlgorithm.valueBlock.value})})),this.keyEncryptionAlgorithm=new pe({schema:t.result.keyEncryptionAlgorithm}),this.encryptedKey=t.result.encryptedKey}toSchema(){let e=[];return e.push(new he({value:this.version})),this.keyDerivationAlgorithm&&e.push(new ae({idBlock:{tagClass:3,tagNumber:0},value:this.keyDerivationAlgorithm.toSchema().valueBlock.value})),e.push(this.keyEncryptionAlgorithm.toSchema()),e.push(this.encryptedKey),new K({value:e})}toJSON(){let e={version:this.version,keyEncryptionAlgorithm:this.keyEncryptionAlgorithm.toJSON(),encryptedKey:this.encryptedKey.toJSON()};return this.keyDerivationAlgorithm&&(e.keyDerivationAlgorithm=this.keyDerivationAlgorithm.toJSON()),e}};mA.CLASS_NAME="PasswordRecipientInfo";var Dd="oriType",Af="oriValue",Tfe=[Dd,Af],zR=class vv extends Se{static{o(this,"OtherRecipientInfo")}constructor(e={}){super(),this.oriType=B(e,Dd,vv.defaultValues(Dd)),this.oriValue=B(e,Af,vv.defaultValues(Af)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Dd:return P;case Af:return{};default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Dd:return t===P;case Af:return Object.keys(t).length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new He({name:t.oriType||P}),new it({name:t.oriValue||P})]})}fromSchema(e){Ce(e,Tfe);let t=be(e,e,vv.schema({names:{oriType:Dd,oriValue:Af}}));ye.assertSchema(t,this.className),this.oriType=t.result.oriType.valueBlock.toString(),this.oriValue=t.result.oriValue}toSchema(){return new K({value:[new He({value:this.oriType}),this.oriValue]})}toJSON(){let e={oriType:this.oriType};return vv.compareWithDefault(Af,this.oriValue)||(e.oriValue=this.oriValue.toJSON()),e}};zR.CLASS_NAME="OtherRecipientInfo";var Ob="variant",gy="value",Ife=["blockName"],Cf=class xv extends Se{static{o(this,"RecipientInfo")}constructor(e={}){super(),this.variant=B(e,Ob,xv.defaultValues(Ob)),gy in e&&(this.value=B(e,gy,xv.defaultValues(gy))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Ob:return-1;case gy:return{};default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Ob:return t===xv.defaultValues(e);case gy:return Object.keys(t).length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new Sr({value:[cA.schema({names:{blockName:t.blockName||P}}),new ae({name:t.blockName||P,idBlock:{tagClass:3,tagNumber:1},value:pA.schema().valueBlock.value}),new ae({name:t.blockName||P,idBlock:{tagClass:3,tagNumber:2},value:dA.schema().valueBlock.value}),new ae({name:t.blockName||P,idBlock:{tagClass:3,tagNumber:3},value:mA.schema().valueBlock.value}),new ae({name:t.blockName||P,idBlock:{tagClass:3,tagNumber:4},value:zR.schema().valueBlock.value})]})}fromSchema(e){Ce(e,Ife);let t=be(e,e,xv.schema({names:{blockName:"blockName"}}));if(ye.assertSchema(t,this.className),t.result.blockName.idBlock.tagClass===1)this.variant=1,this.value=new cA({schema:t.result.blockName});else{let n=new K({value:t.result.blockName.valueBlock.value});switch(t.result.blockName.idBlock.tagNumber){case 1:this.variant=2,this.value=new pA({schema:n});break;case 2:this.variant=3,this.value=new dA({schema:n});break;case 3:this.variant=4,this.value=new mA({schema:n});break;case 4:this.variant=5,this.value=new zR({schema:n});break;default:throw new Error("Incorrect structure of RecipientInfo block")}}}toSchema(){Jt.assertEmpty(this.value,"value","RecipientInfo");let e=this.value.toSchema();switch(this.variant){case 1:return e;case 2:case 3:case 4:return e.idBlock.tagClass=3,e.idBlock.tagNumber=this.variant-1,e;default:return new it}}toJSON(){let e={variant:this.variant};return this.value&&this.variant>=1&&this.variant<=4&&(e.value=this.value.toJSON()),e}};Cf.CLASS_NAME="RecipientInfo";var dc="hashAlgorithm",mc="maskGenAlgorithm",gc="pSourceAlgorithm",Dfe=[dc,mc,gc],CS=class Ui extends Se{static{o(this,"RSAESOAEPParams")}constructor(e={}){super(),this.hashAlgorithm=B(e,dc,Ui.defaultValues(dc)),this.maskGenAlgorithm=B(e,mc,Ui.defaultValues(mc)),this.pSourceAlgorithm=B(e,gc,Ui.defaultValues(gc)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case dc:return new pe({algorithmId:"1.3.14.3.2.26",algorithmParams:new Pr});case mc:return new pe({algorithmId:"1.2.840.113549.1.1.8",algorithmParams:new pe({algorithmId:"1.3.14.3.2.26",algorithmParams:new Pr}).toSchema()});case gc:return new pe({algorithmId:"1.2.840.113549.1.1.9",algorithmParams:new Be({valueHex:new Uint8Array([218,57,163,238,94,107,75,13,50,85,191,239,149,96,24,144,175,216,7,9]).buffer})});default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new ae({idBlock:{tagClass:3,tagNumber:0},optional:!0,value:[pe.schema(t.hashAlgorithm||{})]}),new ae({idBlock:{tagClass:3,tagNumber:1},optional:!0,value:[pe.schema(t.maskGenAlgorithm||{})]}),new ae({idBlock:{tagClass:3,tagNumber:2},optional:!0,value:[pe.schema(t.pSourceAlgorithm||{})]})]})}fromSchema(e){Ce(e,Dfe);let t=be(e,e,Ui.schema({names:{hashAlgorithm:{names:{blockName:dc}},maskGenAlgorithm:{names:{blockName:mc}},pSourceAlgorithm:{names:{blockName:gc}}}}));ye.assertSchema(t,this.className),dc in t.result&&(this.hashAlgorithm=new pe({schema:t.result.hashAlgorithm})),mc in t.result&&(this.maskGenAlgorithm=new pe({schema:t.result.maskGenAlgorithm})),gc in t.result&&(this.pSourceAlgorithm=new pe({schema:t.result.pSourceAlgorithm}))}toSchema(){let e=[];return this.hashAlgorithm.isEqual(Ui.defaultValues(dc))||e.push(new ae({idBlock:{tagClass:3,tagNumber:0},value:[this.hashAlgorithm.toSchema()]})),this.maskGenAlgorithm.isEqual(Ui.defaultValues(mc))||e.push(new ae({idBlock:{tagClass:3,tagNumber:1},value:[this.maskGenAlgorithm.toSchema()]})),this.pSourceAlgorithm.isEqual(Ui.defaultValues(gc))||e.push(new ae({idBlock:{tagClass:3,tagNumber:2},value:[this.pSourceAlgorithm.toSchema()]})),new K({value:e})}toJSON(){let e={};return this.hashAlgorithm.isEqual(Ui.defaultValues(dc))||(e.hashAlgorithm=this.hashAlgorithm.toJSON()),this.maskGenAlgorithm.isEqual(Ui.defaultValues(mc))||(e.maskGenAlgorithm=this.maskGenAlgorithm.toJSON()),this.pSourceAlgorithm.isEqual(Ui.defaultValues(gc))||(e.pSourceAlgorithm=this.pSourceAlgorithm.toJSON()),e}};CS.CLASS_NAME="RSAESOAEPParams";var Bd="keyInfo",yc="entityUInfo",Rd="suppPubInfo",Bfe=[Bd,yc,Rd],WR=class _d extends Se{static{o(this,"ECCCMSSharedInfo")}constructor(e={}){super(),this.keyInfo=B(e,Bd,_d.defaultValues(Bd)),yc in e&&(this.entityUInfo=B(e,yc,_d.defaultValues(yc))),this.suppPubInfo=B(e,Rd,_d.defaultValues(Rd)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Bd:return new pe;case yc:return new Be;case Rd:return new Be;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Bd:case yc:case Rd:return t.isEqual(_d.defaultValues(e));default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[pe.schema(t.keyInfo||{}),new ae({name:t.entityUInfo||P,idBlock:{tagClass:3,tagNumber:0},optional:!0,value:[new Be]}),new ae({name:t.suppPubInfo||P,idBlock:{tagClass:3,tagNumber:2},value:[new Be]})]})}fromSchema(e){Ce(e,Bfe);let t=be(e,e,_d.schema({names:{keyInfo:{names:{blockName:Bd}},entityUInfo:yc,suppPubInfo:Rd}}));ye.assertSchema(t,this.className),this.keyInfo=new pe({schema:t.result.keyInfo}),yc in t.result&&(this.entityUInfo=t.result.entityUInfo.valueBlock.value[0]),this.suppPubInfo=t.result.suppPubInfo.valueBlock.value[0]}toSchema(){let e=[];return e.push(this.keyInfo.toSchema()),this.entityUInfo&&e.push(new ae({idBlock:{tagClass:3,tagNumber:0},value:[this.entityUInfo]})),e.push(new ae({idBlock:{tagClass:3,tagNumber:2},value:[this.suppPubInfo]})),new K({value:e})}toJSON(){let e={keyInfo:this.keyInfo.toJSON(),suppPubInfo:this.suppPubInfo.toJSON()};return this.entityUInfo&&(e.entityUInfo=this.entityUInfo.toJSON()),e}};WR.CLASS_NAME="ECCCMSSharedInfo";var Od="version",vc="originatorInfo",Pd="recipientInfos",kd="encryptedContentInfo",xc="unprotectedAttrs",Rfe=[Od,vc,Pd,kd,xc],A7={kdfAlgorithm:"SHA-512",kekEncryptionLength:256},_fe={"P-256":256,"P-384":384,"P-521":528},JR=class Ec extends Se{static{o(this,"EnvelopedData")}constructor(e={}){super(),this.version=B(e,Od,Ec.defaultValues(Od)),vc in e&&(this.originatorInfo=B(e,vc,Ec.defaultValues(vc))),this.recipientInfos=B(e,Pd,Ec.defaultValues(Pd)),this.encryptedContentInfo=B(e,kd,Ec.defaultValues(kd)),xc in e&&(this.unprotectedAttrs=B(e,xc,Ec.defaultValues(xc))),this.policy={disableSplit:!!e.disableSplit},e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Od:return 0;case vc:return new xS;case Pd:return[];case kd:return new Xn;case xc:return[];default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Od:return t===Ec.defaultValues(e);case vc:return t.certs.certificates.length===0&&t.crls.crls.length===0;case Pd:case xc:return t.length===0;case kd:return Xn.compareWithDefault("contentType",t.contentType)&&Xn.compareWithDefault("contentEncryptionAlgorithm",t.contentEncryptionAlgorithm)&&Xn.compareWithDefault("encryptedContent",t.encryptedContent);default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new he({name:t.version||P}),new ae({name:t.originatorInfo||P,optional:!0,idBlock:{tagClass:3,tagNumber:0},value:xS.schema().valueBlock.value}),new kr({value:[new lt({name:t.recipientInfos||P,value:Cf.schema()})]}),Xn.schema(t.encryptedContentInfo||{}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:1},value:[new lt({name:t.unprotectedAttrs||P,value:$r.schema()})]})]})}fromSchema(e){Ce(e,Rfe);let t=be(e,e,Ec.schema({names:{version:Od,originatorInfo:vc,recipientInfos:Pd,encryptedContentInfo:{names:{blockName:kd}},unprotectedAttrs:xc}}));ye.assertSchema(t,this.className),this.version=t.result.version.valueBlock.valueDec,vc in t.result&&(this.originatorInfo=new xS({schema:new K({value:t.result.originatorInfo.valueBlock.value})})),this.recipientInfos=Array.from(t.result.recipientInfos,n=>new Cf({schema:n})),this.encryptedContentInfo=new Xn({schema:t.result.encryptedContentInfo}),xc in t.result&&(this.unprotectedAttrs=Array.from(t.result.unprotectedAttrs,n=>new $r({schema:n})))}toSchema(){let e=[];return e.push(new he({value:this.version})),this.originatorInfo&&e.push(new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:this.originatorInfo.toSchema().valueBlock.value})),e.push(new kr({value:Array.from(this.recipientInfos,t=>t.toSchema())})),e.push(this.encryptedContentInfo.toSchema()),this.unprotectedAttrs&&e.push(new ae({optional:!0,idBlock:{tagClass:3,tagNumber:1},value:Array.from(this.unprotectedAttrs,t=>t.toSchema())})),new K({value:e})}toJSON(){let e={version:this.version,recipientInfos:Array.from(this.recipientInfos,t=>t.toJSON()),encryptedContentInfo:this.encryptedContentInfo.toJSON()};return this.originatorInfo&&(e.originatorInfo=this.originatorInfo.toJSON()),this.unprotectedAttrs&&(e.unprotectedAttrs=Array.from(this.unprotectedAttrs,t=>t.toJSON())),e}addRecipientByCertificate(e,t,n,s=mt(!0)){let i=Object.assign({useOAEP:!0,oaepHashAlgorithm:"SHA-512"},A7,t||{});if(e.subjectPublicKeyInfo.algorithm.algorithmId.indexOf("1.2.840.113549")!==-1)n=1;else if(e.subjectPublicKeyInfo.algorithm.algorithmId.indexOf("1.2.840.10045")!==-1)n=2;else throw new Error(`Unknown type of certificate's public key: ${e.subjectPublicKeyInfo.algorithm.algorithmId}`);switch(n){case 1:{let a,u;if(i.useOAEP===!0){a=s.getOIDByAlgorithm({name:"RSA-OAEP"},!0,"keyEncryptionAlgorithm");let l=s.getOIDByAlgorithm({name:i.oaepHashAlgorithm},!0,"RSAES-OAEP-params"),f=new pe({algorithmId:l,algorithmParams:new Pr});u=new CS({hashAlgorithm:f,maskGenAlgorithm:new pe({algorithmId:"1.2.840.113549.1.1.8",algorithmParams:f.toSchema()})}).toSchema()}else{if(a=s.getOIDByAlgorithm({name:"RSAES-PKCS1-v1_5"}),a===P)throw new Error("Can not find OID for RSAES-PKCS1-v1_5");u=new Pr}let c=new cA({version:0,rid:new Ln({issuer:e.issuer,serialNumber:e.serialNumber}),keyEncryptionAlgorithm:new pe({algorithmId:a,algorithmParams:u}),recipientCertificate:e});this.recipientInfos.push(new Cf({variant:1,value:c}))}break;case 2:{let a=new xm({variant:1,value:new Ln({issuer:e.issuer,serialNumber:e.serialNumber})});this._addKeyAgreeRecipientInfo(a,i,{recipientCertificate:e},s)}break;default:throw new Error(`Unknown "variant" value: ${n}`)}return!0}addRecipientByPreDefinedData(e,t={},n,s=mt(!0)){if(hr.assert(e,"preDefinedData","ArrayBuffer"),!e.byteLength)throw new Error("Pre-defined data could have zero length");if(!t.keyIdentifier){let i=new ArrayBuffer(16),a=new Uint8Array(i);s.getRandomValues(a),t.keyIdentifier=i}switch(t.hmacHashAlgorithm||(t.hmacHashAlgorithm="SHA-512"),t.iterationCount===void 0&&(t.iterationCount=2048),t.keyEncryptionAlgorithm||(t.keyEncryptionAlgorithm={name:"AES-KW",length:256}),t.keyEncryptionAlgorithmParams||(t.keyEncryptionAlgorithmParams=new Pr),n){case 1:{let i=s.getOIDByAlgorithm(t.keyEncryptionAlgorithm,!0,"keyEncryptionAlgorithm"),a=new dA({version:4,kekid:new Wv({keyIdentifier:new Be({valueHex:t.keyIdentifier})}),keyEncryptionAlgorithm:new pe({algorithmId:i,algorithmParams:t.keyEncryptionAlgorithmParams}),preDefinedKEK:e});this.recipientInfos.push(new Cf({variant:3,value:a}))}break;case 2:{let i=s.getOIDByAlgorithm({name:"PBKDF2"},!0,"keyDerivationAlgorithm"),a=new ArrayBuffer(64),u=new Uint8Array(a);s.getRandomValues(u);let c=s.getOIDByAlgorithm({name:"HMAC",hash:{name:t.hmacHashAlgorithm}},!0,"hmacHashAlgorithm"),l=new vm({salt:new Be({valueHex:a}),iterationCount:t.iterationCount,prf:new pe({algorithmId:c,algorithmParams:new Pr})}),f=s.getOIDByAlgorithm(t.keyEncryptionAlgorithm,!0,"keyEncryptionAlgorithm"),h=new mA({version:0,keyDerivationAlgorithm:new pe({algorithmId:i,algorithmParams:l.toSchema()}),keyEncryptionAlgorithm:new pe({algorithmId:f,algorithmParams:t.keyEncryptionAlgorithmParams}),password:e});this.recipientInfos.push(new Cf({variant:4,value:h}))}break;default:throw new Error(`Unknown value for "variant": ${n}`)}}addRecipientByKeyIdentifier(e,t,n,s=mt(!0)){let i=Object.assign({},A7,n||{}),a=new xm({variant:2,value:new fA({subjectKeyIdentifier:new Be({valueHex:t})})});this._addKeyAgreeRecipientInfo(a,i,{recipientPublicKey:e},s)}_addKeyAgreeRecipientInfo(e,t,n,s=mt(!0)){let i=new hA({rid:e}),a=s.getOIDByAlgorithm({name:"AES-KW",length:t.kekEncryptionLength},!0,"keyEncryptionAlgorithm"),u=new pe({algorithmId:a}),c=s.getOIDByAlgorithm({name:"ECDH",kdf:t.kdfAlgorithm},!0,"KeyAgreeRecipientInfo"),l=new ArrayBuffer(64),f=new Uint8Array(l);s.getRandomValues(f);let h={version:3,ukm:new Be({valueHex:l}),keyEncryptionAlgorithm:new pe({algorithmId:c,algorithmParams:u.toSchema()}),recipientEncryptedKeys:new zv({encryptedKeys:[i]})},d=new pA(Object.assign(h,n));this.recipientInfos.push(new Cf({variant:2,value:d}))}async encrypt(e,t,n=mt(!0)){let s=new ArrayBuffer(16),i=new Uint8Array(s);n.getRandomValues(i);let a=new Uint8Array(t),u=n.getOIDByAlgorithm(e,!0,"contentEncryptionAlgorithm"),c=await n.generateKey(e,!0,["encrypt"]),l=await n.encrypt({name:e.name,iv:i},c,a),f=await n.exportKey("raw",c);this.version=2,this.encryptedContentInfo=new Xn({disableSplit:this.policy.disableSplit,contentType:"1.2.840.113549.1.7.1",contentEncryptionAlgorithm:new pe({algorithmId:u,algorithmParams:new Be({valueHex:s})}),encryptedContent:new Be({valueHex:l})});let h=o(async y=>{let w=this.recipientInfos[y].value,S,E;if(w.recipientPublicKey)S=w.recipientPublicKey.algorithm.namedCurve,E=w.recipientPublicKey;else if(w.recipientCertificate){let me=w.recipientCertificate.subjectPublicKeyInfo.algorithm.algorithmParams;if(me.constructor.blockName()!==He.blockName())throw new Error(`Incorrect "recipientCertificate" for index ${y}`);switch(me.valueBlock.toString()){case"1.2.840.10045.3.1.7":S="P-256";break;case"1.3.132.0.34":S="P-384";break;case"1.3.132.0.35":S="P-521";break;default:throw new Error(`Incorrect curve OID for index ${y}`)}E=await w.recipientCertificate.getPublicKey({algorithm:{algorithm:{name:"ECDH",namedCurve:S},usages:[]}},n)}else throw new Error("Unsupported RecipientInfo");let x=_fe[S],b=await n.generateKey({name:"ECDH",namedCurve:S},!0,["deriveBits"]),A=await n.exportKey("spki",b.publicKey),k=await n.deriveBits({name:"ECDH",public:E},b.privateKey,x),I=new pe({schema:w.keyEncryptionAlgorithm.algorithmParams}),T=n.getAlgorithmByOID(I.algorithmId,!0,"aesKWAlgorithm"),V=T.length,U=new ArrayBuffer(4),M=new Uint8Array(U);for(let me=3;me>=0;me--)M[me]=V,V>>=8;let Z=new WR({keyInfo:new pe({algorithmId:I.algorithmId}),entityUInfo:w.ukm,suppPubInfo:new Be({valueHex:U})}).toSchema().toBER(!1),ue=n.getAlgorithmByOID(w.keyEncryptionAlgorithm.algorithmId,!0,"ecdhAlgorithm"),$=await f7(ue.kdf,k,T.length,Z,n),de=await n.importKey("raw",$,{name:"AES-KW"},!0,["wrapKey"]),xe=await n.wrapKey("raw",c,de,{name:"AES-KW"}),ve=new Gv;return ve.variant=3,ve.value=lA.fromBER(A),w.originator=ve,w.recipientEncryptedKeys.encryptedKeys[0].encryptedKey=new Be({valueHex:xe}),{ecdhPrivateKey:b.privateKey}},"SubKeyAgreeRecipientInfo"),d=o(async y=>{let w=this.recipientInfos[y].value,S=n.getAlgorithmByOID(w.keyEncryptionAlgorithm.algorithmId,!0,"keyEncryptionAlgorithm");if(S.name==="RSA-OAEP"){let E=w.keyEncryptionAlgorithm.algorithmParams,x=new CS({schema:E});if(S.hash=n.getAlgorithmByOID(x.hashAlgorithm.algorithmId),!("name"in S.hash))throw new Error(`Incorrect OID for hash algorithm: ${x.hashAlgorithm.algorithmId}`)}try{let E=await w.recipientCertificate.getPublicKey({algorithm:{algorithm:S,usages:["encrypt","wrapKey"]}},n),x=await n.encrypt(E.algorithm,E,f);w.encryptedKey=new Be({valueHex:x})}catch{}},"SubKeyTransRecipientInfo"),g=o(async y=>{let w=this.recipientInfos[y].value,S=n.getAlgorithmByOID(w.keyEncryptionAlgorithm.algorithmId,!0,"kekAlgorithm"),E=await n.importKey("raw",new Uint8Array(w.preDefinedKEK),S,!0,["wrapKey"]),x=await n.wrapKey("raw",c,E,S);w.encryptedKey=new Be({valueHex:x})},"SubKEKRecipientInfo"),m=o(async y=>{let w=this.recipientInfos[y].value,S;if(!w.keyDerivationAlgorithm)throw new Error('Please append encoded "keyDerivationAlgorithm"');if(!w.keyDerivationAlgorithm.algorithmParams)throw new Error('Incorrectly encoded "keyDerivationAlgorithm"');try{S=new vm({schema:w.keyDerivationAlgorithm.algorithmParams})}catch{throw new Error('Incorrectly encoded "keyDerivationAlgorithm"')}let E=new Uint8Array(w.password),x=await n.importKey("raw",E,"PBKDF2",!1,["deriveKey"]),b=n.getAlgorithmByOID(w.keyEncryptionAlgorithm.algorithmId,!0,"kekAlgorithm"),A="SHA-1";S.prf&&(A=n.getAlgorithmByOID(S.prf.algorithmId,!0,"prfAlgorithm").hash.name);let k=new Uint8Array(S.salt.valueBlock.valueHex),I=S.iterationCount,T=await n.deriveKey({name:"PBKDF2",hash:{name:A},salt:k,iterations:I},x,b,!0,["wrapKey"]),V=await n.wrapKey("raw",c,T,b);w.encryptedKey=new Be({valueHex:V})},"SubPasswordRecipientinfo"),v=[];for(let y=0;y<this.recipientInfos.length;y++)switch(this.recipientInfos[y].variant){case 1:v.push(await d(y));break;case 2:v.push(await h(y));break;case 3:v.push(await g(y));break;case 4:v.push(await m(y));break;default:throw new Error(`Unknown recipient type in array with index ${y}`)}return v}async decrypt(e,t,n=mt(!0)){let s=t||{};if(e+1>this.recipientInfos.length)throw new Error(`Maximum value for "index" is: ${this.recipientInfos.length-1}`);let i=o(async v=>{let y=this.recipientInfos[v].value,w,S,E,x=y.originator;if(s.recipientCertificate){let ue=s.recipientCertificate.subjectPublicKeyInfo.algorithm.algorithmParams;if(ue.constructor.blockName()!==He.blockName())throw new Error(`Incorrect "recipientCertificate" for index ${v}`);w=ue.valueBlock.toString()}else if(x.value.algorithm.algorithmParams){let ue=x.value.algorithm.algorithmParams;if(ue.constructor.blockName()!==He.blockName())throw new Error(`Incorrect originator for index ${v}`);w=ue.valueBlock.toString()}else throw new Error('Parameter "recipientCertificate" is mandatory for "KeyAgreeRecipientInfo" if algorithm params are missing from originator');if(!s.recipientPrivateKey)throw new Error('Parameter "recipientPrivateKey" is mandatory for "KeyAgreeRecipientInfo"');switch(w){case"1.2.840.10045.3.1.7":S="P-256",E=256;break;case"1.3.132.0.34":S="P-384",E=384;break;case"1.3.132.0.35":S="P-521",E=528;break;default:throw new Error(`Incorrect curve OID for index ${v}`)}let b,A=n;Ze.isBufferSource(s.recipientPrivateKey)?b=await n.importKey("pkcs8",s.recipientPrivateKey,{name:"ECDH",namedCurve:S},!0,["deriveBits"]):(b=s.recipientPrivateKey,"crypto"in s&&s.crypto&&(A=s.crypto.subtle)),"algorithmParams"in x.value.algorithm||(x.value.algorithm.algorithmParams=new He({value:w}));let k=x.value.toSchema().toBER(!1),I=await n.importKey("spki",k,{name:"ECDH",namedCurve:S},!0,[]),T=await A.deriveBits({name:"ECDH",public:I},b,E);async function V(ue){ue=ue||!1;let $=new pe({schema:y.keyEncryptionAlgorithm.algorithmParams}),de=n.getAlgorithmByOID($.algorithmId,!0,"kwAlgorithm"),xe=de.length,ve=new ArrayBuffer(4),me=new Uint8Array(ve);for(let Ie=3;Ie>=0;Ie--)me[Ie]=xe,xe>>=8;let z={algorithmId:$.algorithmId};ue&&(z.algorithmParams=new Pr);let le=new WR({keyInfo:new pe(z),entityUInfo:y.ukm,suppPubInfo:new Be({valueHex:ve})}).toSchema().toBER(!1),Ae=n.getAlgorithmByOID(y.keyEncryptionAlgorithm.algorithmId,!0,"ecdhAlgorithm");if(!Ae.name)throw new Error(`Incorrect OID for key encryption algorithm: ${y.keyEncryptionAlgorithm.algorithmId}`);return f7(Ae.kdf,T,de.length,le,n)}o(V,"applyKDF");let U=await V(),M=o(async ue=>n.importKey("raw",ue,{name:"AES-KW"},!0,["unwrapKey"]),"importAesKwKey"),ie=await M(U),Z=o(async ue=>{let $=this.encryptedContentInfo.contentEncryptionAlgorithm.algorithmId,de=n.getAlgorithmByOID($,!0,"contentEncryptionAlgorithm");return n.unwrapKey("raw",y.recipientEncryptedKeys.encryptedKeys[0].encryptedKey.valueBlock.valueHexView,ue,{name:"AES-KW"},de,!0,["decrypt"])},"unwrapSessionKey");try{return await Z(ie)}catch{let ue=await V(!0),$=await M(ue);return Z($)}},"SubKeyAgreeRecipientInfo"),a=o(async v=>{let y=this.recipientInfos[v].value;if(!s.recipientPrivateKey)throw new Error('Parameter "recipientPrivateKey" is mandatory for "KeyTransRecipientInfo"');let w=n.getAlgorithmByOID(y.keyEncryptionAlgorithm.algorithmId,!0,"keyEncryptionAlgorithm");if(w.name==="RSA-OAEP"){let k=y.keyEncryptionAlgorithm.algorithmParams,I=new CS({schema:k});if(w.hash=n.getAlgorithmByOID(I.hashAlgorithm.algorithmId),!("name"in w.hash))throw new Error(`Incorrect OID for hash algorithm: ${I.hashAlgorithm.algorithmId}`)}let S,E=n;Ze.isBufferSource(s.recipientPrivateKey)?S=await n.importKey("pkcs8",s.recipientPrivateKey,w,!0,["decrypt"]):(S=s.recipientPrivateKey,"crypto"in s&&s.crypto&&(E=s.crypto.subtle));let x=await E.decrypt(S.algorithm,S,y.encryptedKey.valueBlock.valueHexView),b=this.encryptedContentInfo.contentEncryptionAlgorithm.algorithmId,A=n.getAlgorithmByOID(b,!0,"contentEncryptionAlgorithm");if(!("name"in A))throw new Error(`Incorrect "contentEncryptionAlgorithm": ${b}`);return n.importKey("raw",x,A,!0,["decrypt"])},"SubKeyTransRecipientInfo"),u=o(async v=>{let y=this.recipientInfos[v].value;if(!s.preDefinedData)throw new Error('Parameter "preDefinedData" is mandatory for "KEKRecipientInfo"');let w=n.getAlgorithmByOID(y.keyEncryptionAlgorithm.algorithmId,!0,"kekAlgorithm"),S=await n.importKey("raw",s.preDefinedData,w,!0,["unwrapKey"]),E=this.encryptedContentInfo.contentEncryptionAlgorithm.algorithmId,x=n.getAlgorithmByOID(E,!0,"contentEncryptionAlgorithm");if(!x.name)throw new Error(`Incorrect "contentEncryptionAlgorithm": ${E}`);return n.unwrapKey("raw",y.encryptedKey.valueBlock.valueHexView,S,w,x,!0,["decrypt"])},"SubKEKRecipientInfo"),c=o(async v=>{let y=this.recipientInfos[v].value,w;if(!s.preDefinedData)throw new Error('Parameter "preDefinedData" is mandatory for "KEKRecipientInfo"');if(!y.keyDerivationAlgorithm)throw new Error('Please append encoded "keyDerivationAlgorithm"');if(!y.keyDerivationAlgorithm.algorithmParams)throw new Error('Incorrectly encoded "keyDerivationAlgorithm"');try{w=new vm({schema:y.keyDerivationAlgorithm.algorithmParams})}catch{throw new Error('Incorrectly encoded "keyDerivationAlgorithm"')}let S=await n.importKey("raw",s.preDefinedData,"PBKDF2",!1,["deriveKey"]),E=n.getAlgorithmByOID(y.keyEncryptionAlgorithm.algorithmId,!0,"keyEncryptionAlgorithm"),x=w.prf?n.getAlgorithmByOID(w.prf.algorithmId,!0,"prfAlgorithm").hash.name:"SHA-1",b=new Uint8Array(w.salt.valueBlock.valueHex),A=w.iterationCount,k=await n.deriveKey({name:"PBKDF2",hash:{name:x},salt:b,iterations:A},S,E,!0,["unwrapKey"]),I=this.encryptedContentInfo.contentEncryptionAlgorithm.algorithmId,T=n.getAlgorithmByOID(I,!0,"contentEncryptionAlgorithm");return n.unwrapKey("raw",y.encryptedKey.valueBlock.valueHexView,k,E,T,!0,["decrypt"])},"SubPasswordRecipientinfo"),l;switch(this.recipientInfos[e].variant){case 1:l=await a(e);break;case 2:l=await i(e);break;case 3:l=await u(e);break;case 4:l=await c(e);break;default:throw new Error(`Unknown recipient type in array with index ${e}`)}let f=this.encryptedContentInfo.contentEncryptionAlgorithm.algorithmId,h=n.getAlgorithmByOID(f,!0,"contentEncryptionAlgorithm"),d=this.encryptedContentInfo.contentEncryptionAlgorithm.algorithmParams.valueBlock.valueHex,g=new Uint8Array(d);if(!this.encryptedContentInfo.encryptedContent)throw new Error("Required property `encryptedContent` is empty");let m=this.encryptedContentInfo.getEncryptedContent();return n.decrypt({name:h.name,iv:g},l,m)}};JR.CLASS_NAME="EnvelopedData";var Pp="safeContents",yy="parsedValue",C7="contentInfos",YR=class NS extends Se{static{o(this,"AuthenticatedSafe")}constructor(e={}){super(),this.safeContents=B(e,Pp,NS.defaultValues(Pp)),yy in e&&(this.parsedValue=B(e,yy,NS.defaultValues(yy))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Pp:return[];case yy:return{};default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Pp:return t.length===0;case yy:return t instanceof Object&&Object.keys(t).length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new lt({name:t.contentInfos||P,value:Fr.schema()})]})}fromSchema(e){Ce(e,[C7]);let t=be(e,e,NS.schema({names:{contentInfos:C7}}));ye.assertSchema(t,this.className),this.safeContents=Array.from(t.result.contentInfos,n=>new Fr({schema:n}))}toSchema(){return new K({value:Array.from(this.safeContents,e=>e.toSchema())})}toJSON(){return{safeContents:Array.from(this.safeContents,e=>e.toJSON())}}async parseInternalValues(e,t=mt(!0)){if(Jt.assert(e,Pp),hr.assert(e.safeContents,Pp,"Array"),e.safeContents.length!==this.safeContents.length)throw new hr('Length of "parameters.safeContents" must be equal to "this.safeContents.length"');this.parsedValue={safeContents:[]};for(let[n,s]of this.safeContents.entries()){let i=e.safeContents[n],a=`parameters.safeContents[${n}]`;switch(s.contentType){case S_:{hr.assert(s.content,"this.safeContents[j].content",Be);let u=s.content.getValue();this.parsedValue.safeContents.push({privacyMode:0,value:ym.fromBER(u)})}break;case V7:{let u=new JR({schema:s.content});Jt.assert(a,i,"recipientCertificate","recipientKey");let c=i,l=c.recipientCertificate,f=c.recipientKey,h=await u.decrypt(0,{recipientCertificate:l,recipientPrivateKey:f},t);this.parsedValue.safeContents.push({privacyMode:2,value:ym.fromBER(h)})}break;case M7:{let u=new ex({schema:s.content});Jt.assert(a,i,"password");let c=i.password,l=await u.decrypt({password:c},t);this.parsedValue.safeContents.push({privacyMode:1,value:ym.fromBER(l)})}break;default:throw new Error(`Unknown "contentType" for AuthenticatedSafe: " ${s.contentType}`)}}}async makeInternalValues(e,t=mt(!0)){if(!this.parsedValue)throw new Error('Please run "parseValues" first or add "parsedValue" manually');if(hr.assert(this.parsedValue,"this.parsedValue","object"),hr.assert(this.parsedValue.safeContents,"this.parsedValue.safeContents","Array"),hr.assert(e,"parameters","object"),Jt.assert(e,"safeContents"),hr.assert(e.safeContents,"parameters.safeContents","Array"),e.safeContents.length!==this.parsedValue.safeContents.length)throw new hr('Length of "parameters.safeContents" must be equal to "this.parsedValue.safeContents"');this.safeContents=[];for(let[n,s]of this.parsedValue.safeContents.entries())switch(Jt.assert("content",s,"privacyMode","value"),hr.assert(s.value,"content.value",ym),s.privacyMode){case 0:{let i=s.value.toSchema().toBER(!1);this.safeContents.push(new Fr({contentType:"1.2.840.113549.1.7.1",content:new Be({valueHex:i})}))}break;case 1:{let i=new ex,a=e.safeContents[n];a.contentToEncrypt=s.value.toSchema().toBER(!1),await i.encrypt(a,t),this.safeContents.push(new Fr({contentType:"1.2.840.113549.1.7.6",content:i.toSchema()}))}break;case 2:{let i=new JR,a=s.value.toSchema().toBER(!1),u=e.safeContents[n];switch(Jt.assert(`parameters.safeContents[${n}]`,u,"encryptingCertificate","encryptionAlgorithm"),!0){case u.encryptionAlgorithm.name.toLowerCase()==="aes-cbc":case u.encryptionAlgorithm.name.toLowerCase()==="aes-gcm":break;default:throw new Error(`Incorrect parameter "encryptionAlgorithm" in "parameters.safeContents[i]": ${u.encryptionAlgorithm}`)}switch(!0){case u.encryptionAlgorithm.length===128:case u.encryptionAlgorithm.length===192:case u.encryptionAlgorithm.length===256:break;default:throw new Error(`Incorrect parameter "encryptionAlgorithm.length" in "parameters.safeContents[i]": ${u.encryptionAlgorithm.length}`)}let c=u.encryptionAlgorithm;i.addRecipientByCertificate(u.encryptingCertificate,{},void 0,t),await i.encrypt(c,a,t),this.safeContents.push(new Fr({contentType:"1.2.840.113549.1.7.3",content:i.toSchema()}))}break;default:throw new Error(`Incorrect value for "content.privacyMode": ${s.privacyMode}`)}return this}};YR.CLASS_NAME="AuthenticatedSafe";var Nf="hashAlgorithm",Ld="issuerNameHash",Fd="issuerKeyHash",Tf="serialNumber",Ofe=[Nf,Ld,Fd,Tf],js=class wc extends Se{static{o(this,"CertID")}static async create(e,t,n=mt(!0)){let s=new wc;return await s.createForCertificate(e,t,n),s}constructor(e={}){super(),this.hashAlgorithm=B(e,Nf,wc.defaultValues(Nf)),this.issuerNameHash=B(e,Ld,wc.defaultValues(Ld)),this.issuerKeyHash=B(e,Fd,wc.defaultValues(Fd)),this.serialNumber=B(e,Tf,wc.defaultValues(Tf)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Nf:return new pe;case Ld:case Fd:return new Be;case Tf:return new he;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Nf:return t.algorithmId===P&&!("algorithmParams"in t);case Ld:case Fd:case Tf:return t.isEqual(wc.defaultValues(Tf));default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[pe.schema(t.hashAlgorithmObject||{names:{blockName:t.hashAlgorithm||P}}),new Be({name:t.issuerNameHash||P}),new Be({name:t.issuerKeyHash||P}),new he({name:t.serialNumber||P})]})}fromSchema(e){Ce(e,Ofe);let t=be(e,e,wc.schema({names:{hashAlgorithm:Nf,issuerNameHash:Ld,issuerKeyHash:Fd,serialNumber:Tf}}));ye.assertSchema(t,this.className),this.hashAlgorithm=new pe({schema:t.result.hashAlgorithm}),this.issuerNameHash=t.result.issuerNameHash,this.issuerKeyHash=t.result.issuerKeyHash,this.serialNumber=t.result.serialNumber}toSchema(){return new K({value:[this.hashAlgorithm.toSchema(),this.issuerNameHash,this.issuerKeyHash,this.serialNumber]})}toJSON(){return{hashAlgorithm:this.hashAlgorithm.toJSON(),issuerNameHash:this.issuerNameHash.toJSON(),issuerKeyHash:this.issuerKeyHash.toJSON(),serialNumber:this.serialNumber.toJSON()}}isEqual(e){return!(this.hashAlgorithm.algorithmId!==e.hashAlgorithm.algorithmId||!Ze.isEqual(this.issuerNameHash.valueBlock.valueHexView,e.issuerNameHash.valueBlock.valueHexView)||!Ze.isEqual(this.issuerKeyHash.valueBlock.valueHexView,e.issuerKeyHash.valueBlock.valueHexView)||!this.serialNumber.isEqual(e.serialNumber))}async createForCertificate(e,t,n=mt(!0)){Jt.assert(t,Nf,"issuerCertificate");let s=n.getOIDByAlgorithm({name:t.hashAlgorithm},!0,"hashAlgorithm");this.hashAlgorithm=new pe({algorithmId:s,algorithmParams:new Pr});let i=t.issuerCertificate;this.serialNumber=e.serialNumber;let a=await n.digest({name:t.hashAlgorithm},i.subject.toSchema().toBER(!1));this.issuerNameHash=new Be({valueHex:a});let u=i.subjectPublicKeyInfo.subjectPublicKey.valueBlock.valueHexView,c=await n.digest({name:t.hashAlgorithm},u);this.issuerKeyHash=new Be({valueHex:c})}};js.CLASS_NAME="CertID";var Ud="certID",Vd="certStatus",Md="thisUpdate",bc="nextUpdate",If="singleExtensions",Pfe=[Ud,Vd,Md,bc,If],QR=class Sc extends Se{static{o(this,"SingleResponse")}constructor(e={}){super(),this.certID=B(e,Ud,Sc.defaultValues(Ud)),this.certStatus=B(e,Vd,Sc.defaultValues(Vd)),this.thisUpdate=B(e,Md,Sc.defaultValues(Md)),bc in e&&(this.nextUpdate=B(e,bc,Sc.defaultValues(bc))),If in e&&(this.singleExtensions=B(e,If,Sc.defaultValues(If))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Ud:return new js;case Vd:return{};case Md:case bc:return new Date(0,0,0);case If:return[];default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Ud:return js.compareWithDefault("hashAlgorithm",t.hashAlgorithm)&&js.compareWithDefault("issuerNameHash",t.issuerNameHash)&&js.compareWithDefault("issuerKeyHash",t.issuerKeyHash)&&js.compareWithDefault("serialNumber",t.serialNumber);case Vd:return Object.keys(t).length===0;case Md:case bc:return t===Sc.defaultValues(e);default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[js.schema(t.certID||{}),new Sr({value:[new tt({name:t.certStatus||P,idBlock:{tagClass:3,tagNumber:0}}),new ae({name:t.certStatus||P,idBlock:{tagClass:3,tagNumber:1},value:[new br,new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new _u]})]}),new tt({name:t.certStatus||P,idBlock:{tagClass:3,tagNumber:2},lenBlock:{length:1}})]}),new br({name:t.thisUpdate||P}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new br({name:t.nextUpdate||P})]}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:1},value:[un.schema(t.singleExtensions||{})]})]})}fromSchema(e){Ce(e,Pfe);let t=be(e,e,Sc.schema({names:{certID:{names:{blockName:Ud}},certStatus:Vd,thisUpdate:Md,nextUpdate:bc,singleExtensions:{names:{blockName:If}}}}));ye.assertSchema(t,this.className),this.certID=new js({schema:t.result.certID}),this.certStatus=t.result.certStatus,this.thisUpdate=t.result.thisUpdate.toDate(),bc in t.result&&(this.nextUpdate=t.result.nextUpdate.toDate()),If in t.result&&(this.singleExtensions=Array.from(t.result.singleExtensions.valueBlock.value,n=>new di({schema:n})))}toSchema(){let e=[];return e.push(this.certID.toSchema()),e.push(this.certStatus),e.push(new br({valueDate:this.thisUpdate})),this.nextUpdate&&e.push(new ae({idBlock:{tagClass:3,tagNumber:0},value:[new br({valueDate:this.nextUpdate})]})),this.singleExtensions&&e.push(new ae({idBlock:{tagClass:3,tagNumber:1},value:[new K({value:Array.from(this.singleExtensions,t=>t.toSchema())})]})),new K({value:e})}toJSON(){let e={certID:this.certID.toJSON(),certStatus:this.certStatus.toJSON(),thisUpdate:this.thisUpdate};return this.nextUpdate&&(e.nextUpdate=this.nextUpdate),this.singleExtensions&&(e.singleExtensions=Array.from(this.singleExtensions,t=>t.toJSON())),e}};QR.CLASS_NAME="SingleResponse";var Pb="tbs",Df="version",Ev="responderID",wv="producedAt",bv="responses",jd="responseExtensions",eh="ResponseData",TS=`${eh}.${Df}`,qd=`${eh}.${Ev}`,ZR=`${eh}.${wv}`,e_=`${eh}.${bv}`,IS=`${eh}.${jd}`,kfe=[eh,TS,qd,ZR,e_,IS],bo=class Sa extends Se{static{o(this,"ResponseData")}get tbs(){return Ze.toArrayBuffer(this.tbsView)}set tbs(e){this.tbsView=new Uint8Array(e)}constructor(e={}){super(),this.tbsView=new Uint8Array(B(e,Pb,Sa.defaultValues(Pb))),Df in e&&(this.version=B(e,Df,Sa.defaultValues(Df))),this.responderID=B(e,Ev,Sa.defaultValues(Ev)),this.producedAt=B(e,wv,Sa.defaultValues(wv)),this.responses=B(e,bv,Sa.defaultValues(bv)),jd in e&&(this.responseExtensions=B(e,jd,Sa.defaultValues(jd))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Df:return 0;case Pb:return Kr;case Ev:return{};case wv:return new Date(0,0,0);case bv:case jd:return[];default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Pb:return t.byteLength===0;case Ev:return Object.keys(t).length===0;case wv:return t===Sa.defaultValues(e);case bv:case jd:return t.length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||eh,value:[new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new he({name:t.version||TS})]}),new Sr({value:[new ae({name:t.responderID||qd,idBlock:{tagClass:3,tagNumber:1},value:[Ar.schema(t.ResponseDataByName||{names:{blockName:"ResponseData.byName"}})]}),new ae({name:t.responderID||qd,idBlock:{tagClass:3,tagNumber:2},value:[new Be({name:t.ResponseDataByKey||"ResponseData.byKey"})]})]}),new br({name:t.producedAt||ZR}),new K({value:[new lt({name:e_,value:QR.schema(t.response||{})})]}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:1},value:[un.schema(t.extensions||{names:{blockName:IS}})]})]})}fromSchema(e){Ce(e,kfe);let t=be(e,e,Sa.schema());ye.assertSchema(t,this.className),this.tbsView=t.result.ResponseData.valueBeforeDecodeView,TS in t.result&&(this.version=t.result[TS].valueBlock.valueDec),t.result[qd].idBlock.tagNumber===1?this.responderID=new Ar({schema:t.result[qd].valueBlock.value[0]}):this.responderID=t.result[qd].valueBlock.value[0],this.producedAt=t.result[ZR].toDate(),this.responses=Array.from(t.result[e_],n=>new QR({schema:n})),IS in t.result&&(this.responseExtensions=Array.from(t.result[IS].valueBlock.value,n=>new di({schema:n})))}toSchema(e=!1){let t;if(e===!1){if(!this.tbsView.byteLength)return Sa.schema();let n=Or(this.tbsView);ye.assert(n,"TBS Response Data"),t=n.result}else{let n=[];Df in this&&n.push(new ae({idBlock:{tagClass:3,tagNumber:0},value:[new he({value:this.version})]})),this.responderID instanceof Ar?n.push(new ae({idBlock:{tagClass:3,tagNumber:1},value:[this.responderID.toSchema()]})):n.push(new ae({idBlock:{tagClass:3,tagNumber:2},value:[this.responderID]})),n.push(new br({valueDate:this.producedAt})),n.push(new K({value:Array.from(this.responses,s=>s.toSchema())})),this.responseExtensions&&n.push(new ae({idBlock:{tagClass:3,tagNumber:1},value:[new K({value:Array.from(this.responseExtensions,s=>s.toSchema())})]})),t=new K({value:n})}return t}toJSON(){let e={};return Df in this&&(e.version=this.version),this.responderID&&(e.responderID=this.responderID),this.producedAt&&(e.producedAt=this.producedAt),this.responses&&(e.responses=Array.from(this.responses,t=>t.toJSON())),this.responseExtensions&&(e.responseExtensions=Array.from(this.responseExtensions,t=>t.toJSON())),e}};bo.CLASS_NAME="ResponseData";var tR="trustedCerts",rR="certs",nR="crls",sR="ocsps",iR="checkDate",aR="findOrigin",oR="findIssuer",$f;(function(r){r[r.unknown=-1]="unknown",r[r.success=0]="success",r[r.noRevocation=11]="noRevocation",r[r.noPath=60]="noPath",r[r.noValidPath=97]="noValidPath"})($f||($f={}));var Hd=class hH extends Error{static{o(this,"ChainValidationError")}constructor(e,t){super(t),this.name=hH.NAME,this.code=e,this.message=t}};Hd.NAME="ChainValidationError";function Lfe(r,e){for(let t=0;t<e.length;t++)if(Ze.isEqual(r.tbsView,e[t].tbsView))return!0;return!1}o(Lfe,"isTrusted");var pH=class dH{static{o(this,"CertificateChainValidationEngine")}constructor(e={}){this.trustedCerts=B(e,tR,this.defaultValues(tR)),this.certs=B(e,rR,this.defaultValues(rR)),this.crls=B(e,nR,this.defaultValues(nR)),this.ocsps=B(e,sR,this.defaultValues(sR)),this.checkDate=B(e,iR,this.defaultValues(iR)),this.findOrigin=B(e,aR,this.defaultValues(aR)),this.findIssuer=B(e,oR,this.defaultValues(oR))}static defaultFindOrigin(e,t){e.tbsView.byteLength===0&&(e.tbsView=new Uint8Array(e.encodeTBS().toBER()));for(let n of t.certs)if(n.tbsView.byteLength===0&&(n.tbsView=new Uint8Array(n.encodeTBS().toBER())),Ze.isEqual(e.tbsView,n.tbsView))return"Intermediate Certificates";for(let n of t.trustedCerts)if(n.tbsView.byteLength===0&&(n.tbsView=new Uint8Array(n.encodeTBS().toBER())),Ze.isEqual(e.tbsView,n.tbsView))return"Trusted Certificates";return"Unknown"}async defaultFindIssuer(e,t,n=mt(!0)){let s=[],i=null,a=null,u=null;if(e.subject.isEqual(e.issuer))try{if(await e.verify(void 0,n))return[e]}catch{}if(e.extensions){for(let l of e.extensions)if(l.extnID===w_&&l.parsedValue instanceof C_){l.parsedValue.keyIdentifier?i=l.parsedValue.keyIdentifier:(l.parsedValue.authorityCertIssuer&&(a=l.parsedValue.authorityCertIssuer),l.parsedValue.authorityCertSerialNumber&&(u=l.parsedValue.authorityCertSerialNumber));break}}function c(l){if(i!==null&&l.extensions){let h=!1;for(let d of l.extensions)if(d.extnID===Uce&&d.parsedValue){h=!0,Ze.isEqual(d.parsedValue.valueBlock.valueHex,i.valueBlock.valueHexView)&&s.push(l);break}if(h)return}let f=!1;u!==null&&(f=l.serialNumber.isEqual(u)),a!==null?l.subject.isEqual(a)&&f&&s.push(l):e.issuer.isEqual(l.subject)&&s.push(l)}o(c,"checkCertificate");for(let l of t.trustedCerts)c(l);for(let l of t.certs)c(l);for(let l=s.length-1;l>=0;l--)try{await e.verify(s[l],n)===!1&&s.splice(l,1)}catch{s.splice(l,1)}return s}defaultValues(e){switch(e){case tR:return[];case rR:return[];case nR:return[];case sR:return[];case iR:return new Date;case aR:return dH.defaultFindOrigin;case oR:return this.defaultFindIssuer;default:throw new Error(`Invalid member name for CertificateChainValidationEngine class: ${e}`)}}async sort(e=!1,t=mt(!0)){let n=[],s=o(async(m,v)=>{let y=[];function w(E){let x=!0;for(let b=0;b<E.length;b++){for(let A=0;A<E.length;A++)if(A!==b&&E[b]===E[A]){x=!1;break}if(!x)break}return x}if(o(w,"checkUnique"),Lfe(m,this.trustedCerts))return[[m]];let S=await this.findIssuer(m,this,v);if(S.length===0)throw new Error("No valid certificate paths found");for(let E=0;E<S.length;E++){if(Ze.isEqual(S[E].tbsView,m.tbsView)){y.push([S[E]]);continue}let x=await s(S[E],v);for(let b=0;b<x.length;b++){let A=x[b].slice();A.splice(0,0,S[E]),w(A)?y.push(A):y.push(x[b])}}return y},"buildPath"),i=o(async m=>{let v=[],y=[],w=[];if(v.push(...n.filter(S=>m.issuer.isEqual(S.subject))),v.length===0)return{status:1,statusMessage:"No certificate's issuers"};if(y.push(...this.crls.filter(S=>S.issuer.isEqual(m.issuer))),y.length===0)return{status:2,statusMessage:"No CRLs for specific certificate issuer"};for(let S=0;S<y.length;S++){let E=y[S];if(!(E.nextUpdate&&E.nextUpdate.value<this.checkDate))for(let x=0;x<v.length;x++)try{if(await y[S].verify({issuerCertificate:v[x]},t)){w.push({crl:y[S],certificate:v[x]});break}}catch{}}return w.length?{status:0,statusMessage:P,result:w}:{status:3,statusMessage:"No valid CRLs found"}},"findCRL"),a=o(async(m,v)=>{let y=t.getAlgorithmByOID(m.signatureAlgorithm.algorithmId);if(!y.name||!y.hash)return 1;for(let w=0;w<this.ocsps.length;w++){let E=await this.ocsps[w].getCertificateStatus(m,v,t);if(E.isForCertificate)return E.status===0?0:1}return 2},"findOCSP");async function u(m,v=!1){let y=!1,w=!1,S=!1,E=!1;if(m.extensions){for(let x=0;x<m.extensions.length;x++){let b=m.extensions[x];if(b.critical&&!b.parsedValue)return{result:!1,resultCode:6,resultMessage:`Unable to parse critical certificate extension: ${b.extnID}`};if(b.extnID===Vce){S=!0;let A=new Uint8Array(b.parsedValue.valueBlock.valueHex);(A[0]&4)===4&&(w=!0),(A[0]&2)===2&&(E=!0)}b.extnID===x_&&"cA"in b.parsedValue&&b.parsedValue.cA===!0&&(y=!0)}if(w===!0&&y===!1)return{result:!1,resultCode:3,resultMessage:'Unable to build certificate chain - using "keyCertSign" flag set without BasicConstraints'};if(S===!0&&y===!0&&w===!1)return{result:!1,resultCode:4,resultMessage:'Unable to build certificate chain - "keyCertSign" flag was not set'};if(y===!0&&S===!0&&v&&E===!1)return{result:!1,resultCode:5,resultMessage:'Unable to build certificate chain - intermediate certificate must have "cRLSign" key usage flag'}}return y===!1?{result:!1,resultCode:7,resultMessage:"Unable to build certificate chain - more than one possible end-user certificate"}:{result:!0,resultCode:0,resultMessage:P}}o(u,"checkForCA");let c=o(async(m,v)=>{for(let y=0;y<m.length;y++)if(m[y].notBefore.value>v||m[y].notAfter.value<v)return{result:!1,resultCode:8,resultMessage:"The certificate is either not yet valid or expired"};if(m.length<2)return{result:!1,resultCode:9,resultMessage:"Too short certificate path"};for(let y=m.length-2;y>=0;y--)if(m[y].issuer.isEqual(m[y].subject)===!1&&m[y].issuer.isEqual(m[y+1].subject)===!1)return{result:!1,resultCode:10,resultMessage:"Incorrect name chaining"};if(this.crls.length!==0||this.ocsps.length!==0)for(let y=0;y<m.length-1;y++){let w=2,S={status:0,statusMessage:P};if(this.ocsps.length!==0)switch(w=await a(m[y],m[y+1]),w){case 0:continue;case 1:return{result:!1,resultCode:12,resultMessage:"One of certificates was revoked via OCSP response"}}if(this.crls.length!==0){if(S=await i(m[y]),S.status===0&&S.result)for(let E=0;E<S.result.length;E++){if(S.result[E].crl.isCertificateRevoked(m[y]))return{result:!1,resultCode:12,resultMessage:"One of certificates had been revoked"};if((await u(S.result[E].certificate,!0)).result===!1)return{result:!1,resultCode:13,resultMessage:"CRL issuer certificate is not a CA certificate or does not have crlSign flag"}}else if(e===!1)throw new Hd($f.noRevocation,`No revocation values found for one of certificates: ${S.statusMessage}`)}else if(w===2)return{result:!1,resultCode:11,resultMessage:"No revocation values found for one of certificates"};if(w===2&&S.status===2&&e){let E=m[y+1],x=!1;if(E.extensions)for(let b of E.extensions)switch(b.extnID){case P7:case E_:case b_:x=!0;break}if(x)throw new Hd($f.noRevocation,`No revocation values found for one of certificates: ${S.statusMessage}`)}}for(let[y,w]of m.entries()){if(!y)continue;if(!(await u(w)).result)return{result:!1,resultCode:14,resultMessage:"One of intermediate certificates is not a CA certificate"}}return{result:!0}},"basicCheck");n.push(...this.trustedCerts),n.push(...this.certs);for(let m=0;m<n.length;m++)for(let v=0;v<n.length;v++)if(m!==v&&Ze.isEqual(n[m].tbsView,n[v].tbsView)){n.splice(v,1),m=0;break}let l=n[n.length-1],f,h=[l];if(f=await s(l,t),f.length===0)throw new Hd($f.noPath,"Unable to find certificate path");for(let m=f.length-1;m>=0;m--){let v=!1;for(let y=0;y<f[m].length;y++){let w=f[m][y];for(let S=0;S<this.trustedCerts.length;S++)if(Ze.isEqual(w.tbsView,this.trustedCerts[S].tbsView)){v=!0;break}if(v)break}v||f.splice(m,1)}if(f.length===0)throw new Hd($f.noValidPath,"No valid certificate paths found");let d=f[0].length,g=0;for(let m=0;m<f.length;m++)f[m].length<d&&(d=f[m].length,g=m);for(let m=0;m<f[g].length;m++)h.push(f[g][m]);if(f=await c(h,this.checkDate),f.result===!1)throw f;return h}async verify(e={},t=mt(!0)){function n(c,l){let f=Rc(c),h=Rc(l),d=f.split("."),g=h.split("."),m=d.length,v=g.length;if(m===0||v===0||m<v)return!1;for(let y=0;y<m;y++)if(d[y].length===0)return!1;for(let y=0;y<v;y++)if(g[y].length===0){if(y===0){if(v===1)return!1;continue}return!1}for(let y=0;y<v;y++)if(g[v-1-y].length!==0&&d[m-1-y].localeCompare(g[v-1-y])!==0)return!1;return!0}o(n,"compareDNSName");function s(c,l){let f=Rc(c),h=Rc(l),d=f.split("@"),g=h.split("@");if(d.length===0||g.length===0||d.length<g.length)return!1;if(g.length===1){if(n(d[1],g[0])){let v=d[1].split("."),y=g[0].split(".");return y[0].length===0?!0:v.length===y.length}return!1}return f.localeCompare(h)===0}o(s,"compareRFC822Name");function i(c,l){let f=Rc(c),h=Rc(l),d=f.split("/");if(h.split("/").length>1)return!1;if(d.length>1){for(let v=0;v<d.length;v++)if(d[v].length>0&&d[v].charAt(d[v].length-1)!==":"){f=d[v].split(":")[0];break}}if(n(f,h)){let v=f.split("."),y=h.split(".");return y[0].length===0?!0:v.length===y.length}return!1}o(i,"compareUniformResourceIdentifier");function a(c,l){let f=c.valueBlock.valueHexView,h=l.valueBlock.valueHexView;if(f.length===4&&h.length===8){for(let d=0;d<4;d++)if((f[d]^h[d])&h[d+4])return!1;return!0}if(f.length===16&&h.length===32){for(let d=0;d<16;d++)if((f[d]^h[d])&h[d+16])return!1;return!0}return!1}o(a,"compareIPAddress");function u(c,l){if(c.typesAndValues.length===0||l.typesAndValues.length===0)return!0;if(c.typesAndValues.length<l.typesAndValues.length)return!1;let f=!0,h=0;for(let d=0;d<l.typesAndValues.length;d++){let g=!1;for(let m=h;m<c.typesAndValues.length;m++)if(g=c.typesAndValues[m].isEqual(l.typesAndValues[d]),c.typesAndValues[m].type===l.typesAndValues[d].type&&(f=f&&g),g===!0)if(h===0||h===m){h=m+1;break}else return!1;if(g===!1)return!1}return h===0?!1:f}o(u,"compareDirectoryName");try{if(this.certs.length===0)throw new Error("Empty certificate array");let c=e.passedWhenNotRevValues||!1,l=e.initialPolicySet||[li],f=e.initialExplicitPolicy||!1,h=e.initialPolicyMappingInhibit||!1,d=e.initialInhibitPolicy||!1,g=e.initialPermittedSubtreesSet||[],m=e.initialExcludedSubtreesSet||[],v=e.initialRequiredNameForms||[],y=f,w=h,S=d,E=[!1,!1,!1],x=0,b=0,A=0,k=g,I=m,T=v,V=1;this.certs=await this.sort(c,t);let U=[];U.push(li);let M=[],ie=new Array(this.certs.length-1);for(let me=0;me<this.certs.length-1;me++)ie[me]=!0;M.push(ie);let Z=new Array(this.certs.length-1),ue=new Array(this.certs.length-1),$=y?this.certs.length-1:-1;for(let me=this.certs.length-2;me>=0;me--,V++){let z=this.certs[me];if(z.extensions){for(let ee=0;ee<z.extensions.length;ee++){let le=z.extensions[ee];if(le.extnID===k7){ue[me]=le.parsedValue;for(let Ae=0;Ae<U.length;Ae++)if(U[Ae]===li){delete M[Ae][me];break}for(let Ae=0;Ae<le.parsedValue.certificatePolicies.length;Ae++){let Ie=-1,_=le.parsedValue.certificatePolicies[Ae].policyIdentifier;for(let D=0;D<U.length;D++)if(_===U[D]){Ie=D;break}if(Ie===-1){U.push(_);let D=new Array(this.certs.length-1);D[me]=!0,M.push(D)}else M[Ie][me]=!0}}if(le.extnID===L7){if(w)return{result:!1,resultCode:98,resultMessage:"Policy mapping prohibited"};Z[me]=le.parsedValue}le.extnID===F7&&y===!1&&(le.parsedValue.requireExplicitPolicy===0?(y=!0,$=me):E[0]===!1?(E[0]=!0,x=le.parsedValue.requireExplicitPolicy):x=x>le.parsedValue.requireExplicitPolicy?le.parsedValue.requireExplicitPolicy:x,le.parsedValue.inhibitPolicyMapping===0?w=!0:E[1]===!1?(E[1]=!0,b=le.parsedValue.inhibitPolicyMapping+1):b=b>le.parsedValue.inhibitPolicyMapping+1?le.parsedValue.inhibitPolicyMapping+1:b),le.extnID===Gce&&S===!1&&(le.parsedValue.valueBlock.valueDec===0?S=!0:E[2]===!1?(E[2]=!0,A=le.parsedValue.valueBlock.valueDec):A=A>le.parsedValue.valueBlock.valueDec?le.parsedValue.valueBlock.valueDec:A)}if(S===!0){let ee=-1;for(let le=0;le<U.length;le++)if(U[le]===li){ee=le;break}ee!==-1&&delete M[0][me]}y===!1&&E[0]===!0&&(x--,x===0&&(y=!0,$=me,E[0]=!1)),w===!1&&E[1]===!0&&(b--,b===0&&(w=!0,E[1]=!1)),S===!1&&E[2]===!0&&(A--,A===0&&(S=!0,E[2]=!1))}}for(let me=0;me<this.certs.length-1;me++)if(me<this.certs.length-2&&typeof Z[me+1]<"u")for(let z=0;z<Z[me+1].mappings.length;z++){if(Z[me+1].mappings[z].issuerDomainPolicy===li||Z[me+1].mappings[z].subjectDomainPolicy===li)return{result:!1,resultCode:99,resultMessage:'The "anyPolicy" should not be a part of policy mapping scheme'};let ee=-1,le=-1;for(let Ae=0;Ae<U.length;Ae++)U[Ae]===Z[me+1].mappings[z].issuerDomainPolicy&&(ee=Ae),U[Ae]===Z[me+1].mappings[z].subjectDomainPolicy&&(le=Ae);typeof M[ee][me]<"u"&&delete M[ee][me];for(let Ae=0;Ae<ue[me].certificatePolicies.length;Ae++)if(Z[me+1].mappings[z].subjectDomainPolicy===ue[me].certificatePolicies[Ae].policyIdentifier&&ee!==-1&&le!==-1)for(let Ie=0;Ie<=me;Ie++)typeof M[le][Ie]<"u"&&(M[ee][Ie]=!0,delete M[le][Ie])}for(let me=0;me<U.length;me++)if(U[me]===li)for(let z=0;z<$;z++)delete M[me][z];let de=[];for(let me=0;me<M.length;me++){let z=!0;for(let ee=0;ee<this.certs.length-1;ee++){let le=!1;if(ee<$&&U[me]===li&&U.length>1){z=!1;break}if(typeof M[me][ee]>"u"){if(ee>=$){for(let Ae=0;Ae<U.length;Ae++)if(U[Ae]===li){M[Ae][ee]===!0&&(le=!0);break}}if(!le){z=!1;break}}}z===!0&&de.push(U[me])}let xe=[];if(l.length===1&&l[0]===li&&y===!1)xe=l;else if(de.length===1&&de[0]===li)xe=l;else for(let me=0;me<de.length;me++)for(let z=0;z<l.length;z++)if(l[z]===de[me]||l[z]===li){xe.push(de[me]);break}let ve={result:xe.length>0,resultCode:0,resultMessage:xe.length>0?P:'Zero "userConstrPolicies" array, no intersections with "authConstrPolicies"',authConstrPolicies:de,userConstrPolicies:xe,explicitPolicyIndicator:y,policyMappings:Z,certificatePath:this.certs};if(xe.length===0||ve.result===!1)return ve;V=1;for(let me=this.certs.length-2;me>=0;me--,V++){let z=this.certs[me],ee=[],le=[],Ae=[];if(z.extensions)for(let Y=0;Y<z.extensions.length;Y++){let q=z.extensions[Y];q.extnID===O7&&("permittedSubtrees"in q.parsedValue&&(le=le.concat(q.parsedValue.permittedSubtrees)),"excludedSubtrees"in q.parsedValue&&(Ae=Ae.concat(q.parsedValue.excludedSubtrees))),q.extnID===D7&&(ee=ee.concat(q.parsedValue.altNames))}let Ie=T.length<=0;for(let Y=0;Y<T.length;Y++)switch(T[Y].base.type){case 4:{if(T[Y].base.value.typesAndValues.length!==z.subject.typesAndValues.length)continue;Ie=!0;for(let q=0;q<z.subject.typesAndValues.length;q++)if(z.subject.typesAndValues[q].type!==T[Y].base.value.typesAndValues[q].type){Ie=!1;break}if(Ie===!0)break}break;default:}if(Ie===!1)throw ve.result=!1,ve.resultCode=21,ve.resultMessage="No necessary name form found",ve;let _=[[],[],[],[],[]];for(let Y=0;Y<k.length;Y++)switch(k[Y].base.type){case 1:_[0].push(k[Y]);break;case 2:_[1].push(k[Y]);break;case 4:_[2].push(k[Y]);break;case 6:_[3].push(k[Y]);break;case 7:_[4].push(k[Y]);break;default:}for(let Y=0;Y<5;Y++){let q=!1,Oe=!1,R=_[Y];for(let N=0;N<R.length;N++){switch(Y){case 0:if(ee.length>0)for(let te=0;te<ee.length;te++)ee[te].type===1&&(Oe=!0,q=q||s(ee[te].value,R[N].base.value));else for(let te=0;te<z.subject.typesAndValues.length;te++)(z.subject.typesAndValues[te].type==="1.2.840.113549.1.9.1"||z.subject.typesAndValues[te].type==="0.9.2342.19200300.100.1.3")&&(Oe=!0,q=q||s(z.subject.typesAndValues[te].value.valueBlock.value,R[N].base.value));break;case 1:if(ee.length>0)for(let te=0;te<ee.length;te++)ee[te].type===2&&(Oe=!0,q=q||n(ee[te].value,R[N].base.value));break;case 2:Oe=!0,q=u(z.subject,R[N].base.value);break;case 3:if(ee.length>0)for(let te=0;te<ee.length;te++)ee[te].type===6&&(Oe=!0,q=q||i(ee[te].value,R[N].base.value));break;case 4:if(ee.length>0)for(let te=0;te<ee.length;te++)ee[te].type===7&&(Oe=!0,q=q||a(ee[te].value,R[N].base.value));break;default:}if(q)break}if(q===!1&&R.length>0&&Oe)throw ve.result=!1,ve.resultCode=41,ve.resultMessage='Failed to meet "permitted sub-trees" name constraint',ve}let D=!1;for(let Y=0;Y<I.length;Y++){switch(I[Y].base.type){case 1:if(ee.length>=0)for(let q=0;q<ee.length;q++)ee[q].type===1&&(D=D||s(ee[q].value,I[Y].base.value));else for(let q=0;q<z.subject.typesAndValues.length;q++)(z.subject.typesAndValues[q].type==="1.2.840.113549.1.9.1"||z.subject.typesAndValues[q].type==="0.9.2342.19200300.100.1.3")&&(D=D||s(z.subject.typesAndValues[q].value.valueBlock.value,I[Y].base.value));break;case 2:if(ee.length>0)for(let q=0;q<ee.length;q++)ee[q].type===2&&(D=D||n(ee[q].value,I[Y].base.value));break;case 4:D=D||u(z.subject,I[Y].base.value);break;case 6:if(ee.length>0)for(let q=0;q<ee.length;q++)ee[q].type===6&&(D=D||i(ee[q].value,I[Y].base.value));break;case 7:if(ee.length>0)for(let q=0;q<ee.length;q++)ee[q].type===7&&(D=D||a(ee[q].value,I[Y].base.value));break;default:}if(D)break}if(D===!0)throw ve.result=!1,ve.resultCode=42,ve.resultMessage='Failed to meet "excluded sub-trees" name constraint',ve;k=k.concat(le),I=I.concat(Ae)}return ve}catch(c){return c instanceof Error?c instanceof Hd?{result:!1,resultCode:c.code,resultMessage:c.message,error:c}:{result:!1,resultCode:$f.unknown,resultMessage:c.message,error:c}:c&&typeof c=="object"&&"resultMessage"in c?c:{result:!1,resultCode:-1,resultMessage:`${c}`}}}},DS="tbsResponseData",Sv="signatureAlgorithm",Av="signature",Kd="certs",tx="BasicOCSPResponse",t_=`${tx}.${DS}`,r_=`${tx}.${Sv}`,n_=`${tx}.${Av}`,BS=`${tx}.${Kd}`,Ffe=[t_,r_,n_,BS],Jv=class Bf extends Se{static{o(this,"BasicOCSPResponse")}constructor(e={}){super(),this.tbsResponseData=B(e,DS,Bf.defaultValues(DS)),this.signatureAlgorithm=B(e,Sv,Bf.defaultValues(Sv)),this.signature=B(e,Av,Bf.defaultValues(Av)),Kd in e&&(this.certs=B(e,Kd,Bf.defaultValues(Kd))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case DS:return new bo;case Sv:return new pe;case Av:return new Ct;case Kd:return[];default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case"type":{let n=bo.compareWithDefault("tbs",t.tbs)&&bo.compareWithDefault("responderID",t.responderID)&&bo.compareWithDefault("producedAt",t.producedAt)&&bo.compareWithDefault("responses",t.responses);return"responseExtensions"in t&&(n=n&&bo.compareWithDefault("responseExtensions",t.responseExtensions)),n}case Sv:return t.algorithmId===P&&!("algorithmParams"in t);case Av:return t.isEqual(Bf.defaultValues(e));case Kd:return t.length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||tx,value:[bo.schema(t.tbsResponseData||{names:{blockName:t_}}),pe.schema(t.signatureAlgorithm||{names:{blockName:r_}}),new Ct({name:t.signature||n_}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new K({value:[new lt({name:BS,value:Gn.schema(t.certs||{})})]})]})]})}fromSchema(e){Ce(e,Ffe);let t=be(e,e,Bf.schema());ye.assertSchema(t,this.className),this.tbsResponseData=new bo({schema:t.result[t_]}),this.signatureAlgorithm=new pe({schema:t.result[r_]}),this.signature=t.result[n_],BS in t.result&&(this.certs=Array.from(t.result[BS],n=>new Gn({schema:n})))}toSchema(){let e=[];return e.push(this.tbsResponseData.toSchema()),e.push(this.signatureAlgorithm.toSchema()),e.push(this.signature),this.certs&&e.push(new ae({idBlock:{tagClass:3,tagNumber:0},value:[new K({value:Array.from(this.certs,t=>t.toSchema())})]})),new K({value:e})}toJSON(){let e={tbsResponseData:this.tbsResponseData.toJSON(),signatureAlgorithm:this.signatureAlgorithm.toJSON(),signature:this.signature.toJSON()};return this.certs&&(e.certs=Array.from(this.certs,t=>t.toJSON())),e}async getCertificateStatus(e,t,n=mt(!0)){let s={isForCertificate:!1,status:2},i={},a=[];for(let u of this.tbsResponseData.responses){let c=n.getAlgorithmByOID(u.certID.hashAlgorithm.algorithmId,!0,"CertID.hashAlgorithm");if(!i[c.name]){i[c.name]=1;let l=new js;a.push(l),await l.createForCertificate(e,{hashAlgorithm:c.name,issuerCertificate:t},n)}}for(let u of this.tbsResponseData.responses)for(let c of a)if(u.certID.isEqual(c)){s.isForCertificate=!0;try{switch(u.certStatus.idBlock.isConstructed){case!0:u.certStatus.idBlock.tagNumber===1&&(s.status=1);break;case!1:switch(u.certStatus.idBlock.tagNumber){case 0:s.status=0;break;case 2:s.status=2;break;default:}break;default:}}catch{}return s}return s}async sign(e,t="SHA-1",n=mt(!0)){if(!e)throw new Error("Need to provide a private key for signing");let s=await n.getSignatureParameters(e,t),i=s.parameters.algorithm;if(!("name"in i))throw new Error("Empty algorithm");this.signatureAlgorithm=s.signatureAlgorithm,this.tbsResponseData.tbsView=new Uint8Array(this.tbsResponseData.toSchema(!0).toBER());let a=await n.signWithPrivateKey(this.tbsResponseData.tbsView,e,{algorithm:i});this.signature=new Ct({valueHex:a})}async verify(e={},t=mt(!0)){let n=null,s=-1,i=e.trustedCerts||[];if(!this.certs)throw new Error("No certificates attached to the BasicOCSPResponse");switch(!0){case this.tbsResponseData.responderID instanceof Ar:for(let[l,f]of this.certs.entries())if(f.subject.isEqual(this.tbsResponseData.responderID)){s=l;break}break;case this.tbsResponseData.responderID instanceof Be:for(let[l,f]of this.certs.entries()){let h=await t.digest({name:"sha-1"},f.subjectPublicKeyInfo.subjectPublicKey.valueBlock.valueHexView);if(Bu(h,this.tbsResponseData.responderID.valueBlock.valueHex)){s=l;break}}break;default:throw new Error("Wrong value for responderID")}if(s===-1)throw new Error("Correct certificate was not found in OCSP response");n=this.certs[s];let a=[n];for(let l of this.certs){let f=await sH(l,n);f&&a.push(f)}if(!(await new pH({certs:a,trustedCerts:i}).verify({},t)).result)throw new Error("Validation of signer's certificate failed");return t.verifyWithPublicKey(this.tbsResponseData.tbsView,this.signature,this.certs[s].subjectPublicKeyInfo,this.signatureAlgorithm)}};Jv.CLASS_NAME="BasicOCSPResponse";var uR="tbs",cR="version",lR="subject",fR="subjectPublicKeyInfo",kp="attributes",Cv="signatureAlgorithm",Nv="signatureValue",bm="CertificationRequestInfo",P_=`${bm}.version`,k_=`${bm}.subject`,L_=`${bm}.subjectPublicKeyInfo`,gA=`${bm}.attributes`,Ufe=[bm,P_,k_,L_,gA,Cv,Nv];function Vfe(r={}){let e=B(r,"names",{});return new K({name:e.CertificationRequestInfo||bm,value:[new he({name:e.CertificationRequestInfoVersion||P_}),Ar.schema(e.subject||{names:{blockName:k_}}),qi.schema({names:{blockName:L_}}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new lt({optional:!0,name:e.CertificationRequestInfoAttributes||gA,value:$r.schema(e.attributes||{})})]})]})}o(Vfe,"CertificationRequestInfo");var Mfe=class Aa extends Se{static{o(this,"CertificationRequest")}get tbs(){return Ze.toArrayBuffer(this.tbsView)}set tbs(e){this.tbsView=new Uint8Array(e)}constructor(e={}){super(),this.tbsView=new Uint8Array(B(e,uR,Aa.defaultValues(uR))),this.version=B(e,cR,Aa.defaultValues(cR)),this.subject=B(e,lR,Aa.defaultValues(lR)),this.subjectPublicKeyInfo=B(e,fR,Aa.defaultValues(fR)),kp in e&&(this.attributes=B(e,kp,Aa.defaultValues(kp))),this.signatureAlgorithm=B(e,Cv,Aa.defaultValues(Cv)),this.signatureValue=B(e,Nv,Aa.defaultValues(Nv)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case uR:return Kr;case cR:return 0;case lR:return new Ar;case fR:return new qi;case kp:return[];case Cv:return new pe;case Nv:return new Ct;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({value:[Vfe(t.certificationRequestInfo||{}),new K({name:t.signatureAlgorithm||Cv,value:[new He,new it({optional:!0})]}),new Ct({name:t.signatureValue||Nv})]})}fromSchema(e){Ce(e,Ufe);let t=be(e,e,Aa.schema());ye.assertSchema(t,this.className),this.tbsView=t.result.CertificationRequestInfo.valueBeforeDecodeView,this.version=t.result[P_].valueBlock.valueDec,this.subject=new Ar({schema:t.result[k_]}),this.subjectPublicKeyInfo=new qi({schema:t.result[L_]}),gA in t.result&&(this.attributes=Array.from(t.result[gA],n=>new $r({schema:n}))),this.signatureAlgorithm=new pe({schema:t.result.signatureAlgorithm}),this.signatureValue=t.result.signatureValue}encodeTBS(){let e=[new he({value:this.version}),this.subject.toSchema(),this.subjectPublicKeyInfo.toSchema()];return kp in this&&e.push(new ae({idBlock:{tagClass:3,tagNumber:0},value:Array.from(this.attributes||[],t=>t.toSchema())})),new K({value:e})}toSchema(e=!1){let t;if(e===!1){if(this.tbsView.byteLength===0)return Aa.schema();let n=Or(this.tbsView);ye.assert(n,"PKCS#10 Certificate Request"),t=n.result}else t=this.encodeTBS();return new K({value:[t,this.signatureAlgorithm.toSchema(),this.signatureValue]})}toJSON(){let e={tbs:ut.ToHex(this.tbsView),version:this.version,subject:this.subject.toJSON(),subjectPublicKeyInfo:this.subjectPublicKeyInfo.toJSON(),signatureAlgorithm:this.signatureAlgorithm.toJSON(),signatureValue:this.signatureValue.toJSON()};return kp in this&&(e.attributes=Array.from(this.attributes||[],t=>t.toJSON())),e}async sign(e,t="SHA-1",n=mt(!0)){if(!e)throw new Error("Need to provide a private key for signing");let s=await n.getSignatureParameters(e,t),i=s.parameters;this.signatureAlgorithm=s.signatureAlgorithm,this.tbsView=new Uint8Array(this.encodeTBS().toBER());let a=await n.signWithPrivateKey(this.tbsView,e,i);this.signatureValue=new Ct({valueHex:a})}async verify(e=mt(!0)){return e.verifyWithPublicKey(this.tbsView,this.signatureValue,this.subjectPublicKeyInfo,this.signatureAlgorithm)}async getPublicKey(e,t=mt(!0)){return t.getPublicKey(this.subjectPublicKeyInfo,this.signatureAlgorithm,e)}};Mfe.CLASS_NAME="CertificationRequest";var Rf="digestAlgorithm",_f="digest",jfe=[Rf,_f],Xf=class Tv extends Se{static{o(this,"DigestInfo")}constructor(e={}){super(),this.digestAlgorithm=B(e,Rf,Tv.defaultValues(Rf)),this.digest=B(e,_f,Tv.defaultValues(_f)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Rf:return new pe;case _f:return new Be;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Rf:return pe.compareWithDefault("algorithmId",t.algorithmId)&&!("algorithmParams"in t);case _f:return t.isEqual(Tv.defaultValues(e));default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[pe.schema(t.digestAlgorithm||{names:{blockName:Rf}}),new Be({name:t.digest||_f})]})}fromSchema(e){Ce(e,jfe);let t=be(e,e,Tv.schema({names:{digestAlgorithm:{names:{blockName:Rf}},digest:_f}}));ye.assertSchema(t,this.className),this.digestAlgorithm=new pe({schema:t.result.digestAlgorithm}),this.digest=t.result.digest}toSchema(){return new K({value:[this.digestAlgorithm.toSchema(),this.digest]})}toJSON(){return{digestAlgorithm:this.digestAlgorithm.toJSON(),digest:this.digest.toJSON()}}};Xf.CLASS_NAME="DigestInfo";var $d="eContentType",Vi="eContent",qfe=[$d,Vi],Gf=class Of extends Se{static{o(this,"EncapsulatedContentInfo")}constructor(e={}){if(super(),this.eContentType=B(e,$d,Of.defaultValues($d)),Vi in e&&(this.eContent=B(e,Vi,Of.defaultValues(Vi)),this.eContent.idBlock.tagClass===1&&this.eContent.idBlock.tagNumber===4&&this.eContent.idBlock.isConstructed===!1)){let t=new Be({idBlock:{isConstructed:!0},isConstructed:!0}),n=0,s=this.eContent.valueBlock.valueHexView.slice().buffer,i=s.byteLength;for(;i>0;){let a=new Uint8Array(s,n,n+65536>s.byteLength?s.byteLength-n:65536),u=new ArrayBuffer(a.length),c=new Uint8Array(u);for(let l=0;l<c.length;l++)c[l]=a[l];t.valueBlock.value.push(new Be({valueHex:u})),i-=a.length,n+=a.length}this.eContent=t}e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case $d:return P;case Vi:return new Be;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case $d:return t===P;case Vi:return t.idBlock.tagClass===1&&t.idBlock.tagNumber===4?t.isEqual(Of.defaultValues(Vi)):!1;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new He({name:t.eContentType||P}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new it({name:t.eContent||P})]})]})}fromSchema(e){Ce(e,qfe);let t=be(e,e,Of.schema({names:{eContentType:$d,eContent:Vi}}));ye.assertSchema(t,this.className),this.eContentType=t.result.eContentType.valueBlock.toString(),Vi in t.result&&(this.eContent=t.result.eContent)}toSchema(){let e=[];return e.push(new He({value:this.eContentType})),this.eContent&&Of.compareWithDefault(Vi,this.eContent)===!1&&e.push(new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[this.eContent]})),new K({value:e})}toJSON(){let e={eContentType:this.eContentType};return this.eContent&&Of.compareWithDefault(Vi,this.eContent)===!1&&(e.eContent=this.eContent.toJSON()),e}};Gf.CLASS_NAME="EncapsulatedContentInfo";var Pf="mac",kf="macSalt",So="iterations",Hfe=[Pf,kf,So],Ac=class Lf extends Se{static{o(this,"MacData")}constructor(e={}){super(),this.mac=B(e,Pf,Lf.defaultValues(Pf)),this.macSalt=B(e,kf,Lf.defaultValues(kf)),So in e&&(this.iterations=B(e,So,Lf.defaultValues(So))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Pf:return new Xf;case kf:return new Be;case So:return 1;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Pf:return Xf.compareWithDefault("digestAlgorithm",t.digestAlgorithm)&&Xf.compareWithDefault("digest",t.digest);case kf:return t.isEqual(Lf.defaultValues(e));case So:return t===Lf.defaultValues(e);default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,optional:t.optional||!0,value:[Xf.schema(t.mac||{names:{blockName:Pf}}),new Be({name:t.macSalt||kf}),new he({optional:!0,name:t.iterations||So})]})}fromSchema(e){Ce(e,Hfe);let t=be(e,e,Lf.schema({names:{mac:{names:{blockName:Pf}},macSalt:kf,iterations:So}}));ye.assertSchema(t,this.className),this.mac=new Xf({schema:t.result.mac}),this.macSalt=t.result.macSalt,So in t.result&&(this.iterations=t.result.iterations.valueBlock.valueDec)}toSchema(){let e=[this.mac.toSchema(),this.macSalt];return this.iterations!==void 0&&e.push(new he({value:this.iterations})),new K({value:e})}toJSON(){let e={mac:this.mac.toJSON(),macSalt:this.macSalt.toJSON()};return this.iterations!==void 0&&(e.iterations=this.iterations),e}};Ac.CLASS_NAME="MacData";var zf="hashAlgorithm",Wf="hashedMessage",Kfe=[zf,Wf],ji=class Xd extends Se{static{o(this,"MessageImprint")}static async create(e,t,n=mt(!0)){let s=n.getOIDByAlgorithm({name:e},!0,"hashAlgorithm"),i=await n.digest(e,t);return new Xd({hashAlgorithm:new pe({algorithmId:s,algorithmParams:new Pr}),hashedMessage:new Be({valueHex:i})})}constructor(e={}){super(),this.hashAlgorithm=B(e,zf,Xd.defaultValues(zf)),this.hashedMessage=B(e,Wf,Xd.defaultValues(Wf)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case zf:return new pe;case Wf:return new Be;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case zf:return t.algorithmId===P&&!("algorithmParams"in t);case Wf:return t.isEqual(Xd.defaultValues(e))===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[pe.schema(t.hashAlgorithm||{}),new Be({name:t.hashedMessage||P})]})}fromSchema(e){Ce(e,Kfe);let t=be(e,e,Xd.schema({names:{hashAlgorithm:{names:{blockName:zf}},hashedMessage:Wf}}));ye.assertSchema(t,this.className),this.hashAlgorithm=new pe({schema:t.result.hashAlgorithm}),this.hashedMessage=t.result.hashedMessage}toSchema(){return new K({value:[this.hashAlgorithm.toSchema(),this.hashedMessage]})}toJSON(){return{hashAlgorithm:this.hashAlgorithm.toJSON(),hashedMessage:this.hashedMessage.toJSON()}}};ji.CLASS_NAME="MessageImprint";var Gd="reqCert",Cc="singleRequestExtensions",$fe=[Gd,Cc],yA=class Iv extends Se{static{o(this,"Request")}constructor(e={}){super(),this.reqCert=B(e,Gd,Iv.defaultValues(Gd)),Cc in e&&(this.singleRequestExtensions=B(e,Cc,Iv.defaultValues(Cc))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Gd:return new js;case Cc:return[];default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Gd:return t.isEqual(Iv.defaultValues(e));case Cc:return t.length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[js.schema(t.reqCert||{}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[un.schema(t.extensions||{names:{blockName:t.singleRequestExtensions||P}})]})]})}fromSchema(e){Ce(e,$fe);let t=be(e,e,Iv.schema({names:{reqCert:{names:{blockName:Gd}},extensions:{names:{blockName:Cc}}}}));ye.assertSchema(t,this.className),this.reqCert=new js({schema:t.result.reqCert}),Cc in t.result&&(this.singleRequestExtensions=Array.from(t.result.singleRequestExtensions.valueBlock.value,n=>new di({schema:n})))}toSchema(){let e=[];return e.push(this.reqCert.toSchema()),this.singleRequestExtensions&&e.push(new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new K({value:Array.from(this.singleRequestExtensions,t=>t.toSchema())})]})),new K({value:e})}toJSON(){let e={reqCert:this.reqCert.toJSON()};return this.singleRequestExtensions&&(e.singleRequestExtensions=Array.from(this.singleRequestExtensions,t=>t.toJSON())),e}};yA.CLASS_NAME="Request";var kb="tbs",zd="version",Wd="requestorName",Lb="requestList",Jd="requestExtensions",Sm="TBSRequest",RS=`${Sm}.${zd}`,_S=`${Sm}.${Wd}`,s_=`${Sm}.requests`,OS=`${Sm}.${Jd}`,Xfe=[Sm,RS,_S,s_,OS],Ao=class Co extends Se{static{o(this,"TBSRequest")}get tbs(){return Ze.toArrayBuffer(this.tbsView)}set tbs(e){this.tbsView=new Uint8Array(e)}constructor(e={}){super(),this.tbsView=new Uint8Array(B(e,kb,Co.defaultValues(kb))),zd in e&&(this.version=B(e,zd,Co.defaultValues(zd))),Wd in e&&(this.requestorName=B(e,Wd,Co.defaultValues(Wd))),this.requestList=B(e,Lb,Co.defaultValues(Lb)),Jd in e&&(this.requestExtensions=B(e,Jd,Co.defaultValues(Jd))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case kb:return Kr;case zd:return 0;case Wd:return new pr;case Lb:case Jd:return[];default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case kb:return t.byteLength===0;case zd:return t===Co.defaultValues(e);case Wd:return t.type===pr.defaultValues("type")&&Object.keys(t.value).length===0;case Lb:case Jd:return t.length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||Sm,value:[new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new he({name:t.TBSRequestVersion||RS})]}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:1},value:[pr.schema(t.requestorName||{names:{blockName:_S}})]}),new K({name:t.requestList||"TBSRequest.requestList",value:[new lt({name:t.requests||s_,value:yA.schema(t.requestNames||{})})]}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:2},value:[un.schema(t.extensions||{names:{blockName:t.requestExtensions||OS}})]})]})}fromSchema(e){Ce(e,Xfe);let t=be(e,e,Co.schema());ye.assertSchema(t,this.className),this.tbsView=t.result.TBSRequest.valueBeforeDecodeView,RS in t.result&&(this.version=t.result[RS].valueBlock.valueDec),_S in t.result&&(this.requestorName=new pr({schema:t.result[_S]})),this.requestList=Array.from(t.result[s_],n=>new yA({schema:n})),OS in t.result&&(this.requestExtensions=Array.from(t.result[OS].valueBlock.value,n=>new di({schema:n})))}toSchema(e=!1){let t;if(e===!1){if(this.tbsView.byteLength===0)return Co.schema();let n=Or(this.tbsView);if(ye.assert(n,"TBS Request"),!(n.result instanceof K))throw new Error("ASN.1 result should be SEQUENCE");t=n.result}else{let n=[];this.version!==void 0&&n.push(new ae({idBlock:{tagClass:3,tagNumber:0},value:[new he({value:this.version})]})),this.requestorName&&n.push(new ae({idBlock:{tagClass:3,tagNumber:1},value:[this.requestorName.toSchema()]})),n.push(new K({value:Array.from(this.requestList,s=>s.toSchema())})),this.requestExtensions&&n.push(new ae({idBlock:{tagClass:3,tagNumber:2},value:[new K({value:Array.from(this.requestExtensions,s=>s.toSchema())})]})),t=new K({value:n})}return t}toJSON(){let e={};return this.version!=null&&(e.version=this.version),this.requestorName&&(e.requestorName=this.requestorName.toJSON()),e.requestList=Array.from(this.requestList,t=>t.toJSON()),this.requestExtensions&&(e.requestExtensions=Array.from(this.requestExtensions,t=>t.toJSON())),e}};Ao.CLASS_NAME="TBSRequest";var Lp="signatureAlgorithm",Fp="signature",Vu="certs",Ff=class Yd extends Se{static{o(this,"Signature")}constructor(e={}){super(),this.signatureAlgorithm=B(e,Lp,Yd.defaultValues(Lp)),this.signature=B(e,Fp,Yd.defaultValues(Fp)),Vu in e&&(this.certs=B(e,Vu,Yd.defaultValues(Vu))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Lp:return new pe;case Fp:return new Ct;case Vu:return[];default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Lp:return t.algorithmId===P&&!("algorithmParams"in t);case Fp:return t.isEqual(Yd.defaultValues(e));case Vu:return t.length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[pe.schema(t.signatureAlgorithm||{}),new Ct({name:t.signature||P}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new K({value:[new lt({name:t.certs||P,value:Gn.schema({})})]})]})]})}fromSchema(e){Ce(e,[Lp,Fp,Vu]);let t=be(e,e,Yd.schema({names:{signatureAlgorithm:{names:{blockName:Lp}},signature:Fp,certs:Vu}}));ye.assertSchema(t,this.className),this.signatureAlgorithm=new pe({schema:t.result.signatureAlgorithm}),this.signature=t.result.signature,Vu in t.result&&(this.certs=Array.from(t.result.certs,n=>new Gn({schema:n})))}toSchema(){let e=[];return e.push(this.signatureAlgorithm.toSchema()),e.push(this.signature),this.certs&&e.push(new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new K({value:Array.from(this.certs,t=>t.toSchema())})]})),new K({value:e})}toJSON(){let e={signatureAlgorithm:this.signatureAlgorithm.toJSON(),signature:this.signature.toJSON()};return this.certs&&(e.certs=Array.from(this.certs,t=>t.toJSON())),e}};Ff.CLASS_NAME="Signature";var Qd="tbsRequest",Nc="optionalSignature",Gfe=[Qd,Nc],zfe=class PS extends Se{static{o(this,"OCSPRequest")}constructor(e={}){super(),this.tbsRequest=B(e,Qd,PS.defaultValues(Qd)),Nc in e&&(this.optionalSignature=B(e,Nc,PS.defaultValues(Nc))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Qd:return new Ao;case Nc:return new Ff;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Qd:return Ao.compareWithDefault("tbs",t.tbs)&&Ao.compareWithDefault("version",t.version)&&Ao.compareWithDefault("requestorName",t.requestorName)&&Ao.compareWithDefault("requestList",t.requestList)&&Ao.compareWithDefault("requestExtensions",t.requestExtensions);case Nc:return Ff.compareWithDefault("signatureAlgorithm",t.signatureAlgorithm)&&Ff.compareWithDefault("signature",t.signature)&&Ff.compareWithDefault("certs",t.certs);default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||"OCSPRequest",value:[Ao.schema(t.tbsRequest||{names:{blockName:Qd}}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[Ff.schema(t.optionalSignature||{names:{blockName:Nc}})]})]})}fromSchema(e){Ce(e,Gfe);let t=be(e,e,PS.schema());ye.assertSchema(t,this.className),this.tbsRequest=new Ao({schema:t.result.tbsRequest}),Nc in t.result&&(this.optionalSignature=new Ff({schema:t.result.optionalSignature}))}toSchema(e=!1){let t=[];return t.push(this.tbsRequest.toSchema(e)),this.optionalSignature&&t.push(new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[this.optionalSignature.toSchema()]})),new K({value:t})}toJSON(){let e={tbsRequest:this.tbsRequest.toJSON()};return this.optionalSignature&&(e.optionalSignature=this.optionalSignature.toJSON()),e}async createForCertificate(e,t,n=mt(!0)){let s=new js;await s.createForCertificate(e,t,n),this.tbsRequest.requestList.push(new yA({reqCert:s}))}async sign(e,t="SHA-1",n=mt(!0)){if(Jt.assertEmpty(e,"privateKey","OCSPRequest.sign method"),!this.optionalSignature)throw new Error('Need to create "optionalSignature" field before signing');let s=await n.getSignatureParameters(e,t),i=s.parameters;this.optionalSignature.signatureAlgorithm=s.signatureAlgorithm;let a=this.tbsRequest.toSchema(!0).toBER(!1),u=await n.signWithPrivateKey(a,e,i);this.optionalSignature.signature=new Ct({valueHex:u})}verify(){}};zfe.CLASS_NAME="OCSPRequest";var Zd="responseType",em="response",Wfe=[Zd,em],tm=class Dv extends Se{static{o(this,"ResponseBytes")}constructor(e={}){super(),this.responseType=B(e,Zd,Dv.defaultValues(Zd)),this.response=B(e,em,Dv.defaultValues(em)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Zd:return P;case em:return new Be;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Zd:return t===P;case em:return t.isEqual(Dv.defaultValues(e));default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new He({name:t.responseType||P}),new Be({name:t.response||P})]})}fromSchema(e){Ce(e,Wfe);let t=be(e,e,Dv.schema({names:{responseType:Zd,response:em}}));ye.assertSchema(t,this.className),this.responseType=t.result.responseType.valueBlock.toString(),this.response=t.result.response}toSchema(){return new K({value:[new He({value:this.responseType}),this.response]})}toJSON(){return{responseType:this.responseType,response:this.response.toJSON()}}};tm.CLASS_NAME="ResponseBytes";var Up="responseStatus",co="responseBytes",Jfe=class Bv extends Se{static{o(this,"OCSPResponse")}constructor(e={}){super(),this.responseStatus=B(e,Up,Bv.defaultValues(Up)),co in e&&(this.responseBytes=B(e,co,Bv.defaultValues(co))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Up:return new _u;case co:return new tm;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Up:return t.isEqual(Bv.defaultValues(e));case co:return tm.compareWithDefault("responseType",t.responseType)&&tm.compareWithDefault("response",t.response);default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||"OCSPResponse",value:[new _u({name:t.responseStatus||Up}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[tm.schema(t.responseBytes||{names:{blockName:co}})]})]})}fromSchema(e){Ce(e,[Up,co]);let t=be(e,e,Bv.schema());ye.assertSchema(t,this.className),this.responseStatus=t.result.responseStatus,co in t.result&&(this.responseBytes=new tm({schema:t.result.responseBytes}))}toSchema(){let e=[];return e.push(this.responseStatus),this.responseBytes&&e.push(new ae({idBlock:{tagClass:3,tagNumber:0},value:[this.responseBytes.toSchema()]})),new K({value:e})}toJSON(){let e={responseStatus:this.responseStatus.toJSON()};return this.responseBytes&&(e.responseBytes=this.responseBytes.toJSON()),e}async getCertificateStatus(e,t,n=mt(!0)){let s,i={isForCertificate:!1,status:2};if(!this.responseBytes||this.responseBytes.responseType!==qb)return i;try{let a=Or(this.responseBytes.response.valueBlock.valueHexView);ye.assert(a,"Basic OCSP response"),s=new Jv({schema:a.result})}catch{return i}return s.getCertificateStatus(e,t,n)}async sign(e,t,n=mt(!0)){var s;if(this.responseBytes&&this.responseBytes.responseType===qb)return Jv.fromBER(this.responseBytes.response.valueBlock.valueHexView).sign(e,t,n);throw new Error(`Unknown ResponseBytes type: ${((s=this.responseBytes)===null||s===void 0?void 0:s.responseType)||"Unknown"}`)}async verify(e=null,t=mt(!0)){var n;if(!(co in this))throw new Error("Empty ResponseBytes field");if(this.responseBytes&&this.responseBytes.responseType===qb){let s=Jv.fromBER(this.responseBytes.response.valueBlock.valueHexView);return e!==null&&(s.certs||(s.certs=[]),s.certs.push(e)),s.verify({},t)}throw new Error(`Unknown ResponseBytes type: ${((n=this.responseBytes)===null||n===void 0?void 0:n.responseType)||"Unknown"}`)}};Jfe.CLASS_NAME="OCSPResponse";var Ol="type",No="attributes",Fb="encodedValue",Yfe=[No],Ts=class Ca extends Se{static{o(this,"SignedAndUnsignedAttributes")}constructor(e={}){super(),this.type=B(e,Ol,Ca.defaultValues(Ol)),this.attributes=B(e,No,Ca.defaultValues(No)),this.encodedValue=B(e,Fb,Ca.defaultValues(Fb)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Ol:return-1;case No:return[];case Fb:return Kr;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Ol:return t===Ca.defaultValues(Ol);case No:return t.length===0;case Fb:return t.byteLength===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new ae({name:t.blockName||P,optional:!0,idBlock:{tagClass:3,tagNumber:t.tagNumber||0},value:[new lt({name:t.attributes||P,value:$r.schema()})]})}fromSchema(e){Ce(e,Yfe);let t=be(e,e,Ca.schema({names:{tagNumber:this.type,attributes:No}}));ye.assertSchema(t,this.className),this.type=t.result.idBlock.tagNumber,this.encodedValue=Ze.toArrayBuffer(t.result.valueBeforeDecodeView);let n=new Uint8Array(this.encodedValue);if(n[0]=49,!(No in t.result)){if(this.type===0)throw new Error("Wrong structure of SignedUnsignedAttributes");return}this.attributes=Array.from(t.result.attributes,s=>new $r({schema:s}))}toSchema(){if(Ca.compareWithDefault(Ol,this.type)||Ca.compareWithDefault(No,this.attributes))throw new Error('Incorrectly initialized "SignedAndUnsignedAttributes" class');return new ae({optional:!0,idBlock:{tagClass:3,tagNumber:this.type},value:Array.from(this.attributes,e=>e.toSchema())})}toJSON(){if(Ca.compareWithDefault(Ol,this.type)||Ca.compareWithDefault(No,this.attributes))throw new Error('Incorrectly initialized "SignedAndUnsignedAttributes" class');return{type:this.type,attributes:Array.from(this.attributes,e=>e.toJSON())}}};Ts.CLASS_NAME="SignedAndUnsignedAttributes";var rm="version",Uf="sid",nm="digestAlgorithm",Tc="signedAttrs",sm="signatureAlgorithm",Rv="signature",Ic="unsignedAttrs",Pc="SignerInfo",i_=`${Pc}.${rm}`,_v=`${Pc}.${Uf}`,a_=`${Pc}.${nm}`,kS=`${Pc}.${Tc}`,o_=`${Pc}.${sm}`,u_=`${Pc}.${Rv}`,LS=`${Pc}.${Ic}`,Qfe=[i_,_v,a_,kS,o_,u_,LS],vA=class An extends Se{static{o(this,"SignerInfo")}constructor(e={}){super(),this.version=B(e,rm,An.defaultValues(rm)),this.sid=B(e,Uf,An.defaultValues(Uf)),this.digestAlgorithm=B(e,nm,An.defaultValues(nm)),Tc in e&&(this.signedAttrs=B(e,Tc,An.defaultValues(Tc))),this.signatureAlgorithm=B(e,sm,An.defaultValues(sm)),this.signature=B(e,Rv,An.defaultValues(Rv)),Ic in e&&(this.unsignedAttrs=B(e,Ic,An.defaultValues(Ic))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case rm:return 0;case Uf:return new it;case nm:return new pe;case Tc:return new Ts({type:0});case sm:return new pe;case Rv:return new Be;case Ic:return new Ts({type:1});default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case rm:return An.defaultValues(rm)===t;case Uf:return t instanceof it;case nm:return t instanceof pe?t.isEqual(An.defaultValues(nm)):!1;case Tc:return Ts.compareWithDefault("type",t.type)&&Ts.compareWithDefault("attributes",t.attributes)&&Ts.compareWithDefault("encodedValue",t.encodedValue);case sm:return t instanceof pe?t.isEqual(An.defaultValues(sm)):!1;case Rv:case Ic:return Ts.compareWithDefault("type",t.type)&&Ts.compareWithDefault("attributes",t.attributes)&&Ts.compareWithDefault("encodedValue",t.encodedValue);default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:Pc,value:[new he({name:t.version||i_}),new Sr({value:[Ln.schema(t.sidSchema||{names:{blockName:_v}}),new Sr({value:[new ae({optional:!0,name:t.sid||_v,idBlock:{tagClass:3,tagNumber:0},value:[new Be]}),new tt({optional:!0,name:t.sid||_v,idBlock:{tagClass:3,tagNumber:0}})]})]}),pe.schema(t.digestAlgorithm||{names:{blockName:a_}}),Ts.schema(t.signedAttrs||{names:{blockName:kS,tagNumber:0}}),pe.schema(t.signatureAlgorithm||{names:{blockName:o_}}),new Be({name:t.signature||u_}),Ts.schema(t.unsignedAttrs||{names:{blockName:LS,tagNumber:1}})]})}fromSchema(e){Ce(e,Qfe);let t=be(e,e,An.schema());ye.assertSchema(t,this.className),this.version=t.result[i_].valueBlock.valueDec;let n=t.result[_v];n.idBlock.tagClass===1?this.sid=new Ln({schema:n}):this.sid=n,this.digestAlgorithm=new pe({schema:t.result[a_]}),kS in t.result&&(this.signedAttrs=new Ts({type:0,schema:t.result[kS]})),this.signatureAlgorithm=new pe({schema:t.result[o_]}),this.signature=t.result[u_],LS in t.result&&(this.unsignedAttrs=new Ts({type:1,schema:t.result[LS]}))}toSchema(){if(An.compareWithDefault(Uf,this.sid))throw new Error('Incorrectly initialized "SignerInfo" class');let e=[];return e.push(new he({value:this.version})),this.sid instanceof Ln?e.push(this.sid.toSchema()):e.push(this.sid),e.push(this.digestAlgorithm.toSchema()),this.signedAttrs&&An.compareWithDefault(Tc,this.signedAttrs)===!1&&e.push(this.signedAttrs.toSchema()),e.push(this.signatureAlgorithm.toSchema()),e.push(this.signature),this.unsignedAttrs&&An.compareWithDefault(Ic,this.unsignedAttrs)===!1&&e.push(this.unsignedAttrs.toSchema()),new K({value:e})}toJSON(){if(An.compareWithDefault(Uf,this.sid))throw new Error('Incorrectly initialized "SignerInfo" class');let e={version:this.version,digestAlgorithm:this.digestAlgorithm.toJSON(),signatureAlgorithm:this.signatureAlgorithm.toJSON(),signature:this.signature.toJSON()};return this.sid instanceof it||(e.sid=this.sid.toJSON()),this.signedAttrs&&An.compareWithDefault(Tc,this.signedAttrs)===!1&&(e.signedAttrs=this.signedAttrs.toJSON()),this.unsignedAttrs&&An.compareWithDefault(Ic,this.unsignedAttrs)===!1&&(e.unsignedAttrs=this.unsignedAttrs.toJSON()),e}};vA.CLASS_NAME="SignerInfo";var Ov="version",Pv="policy",kv="messageImprint",Lv="serialNumber",Fv="genTime",Vf="ordering",Mf="nonce",im="accuracy",am="tsa",om="extensions",Hi="TSTInfo",c_=`${Hi}.${Ov}`,l_=`${Hi}.${Pv}`,f_=`${Hi}.${kv}`,h_=`${Hi}.${Lv}`,p_=`${Hi}.${Fv}`,FS=`${Hi}.${im}`,US=`${Hi}.${Vf}`,VS=`${Hi}.${Mf}`,MS=`${Hi}.${am}`,jS=`${Hi}.${om}`,Zfe=[c_,l_,f_,h_,p_,FS,US,VS,MS,jS],mH=class Ns extends Se{static{o(this,"TSTInfo")}constructor(e={}){super(),this.version=B(e,Ov,Ns.defaultValues(Ov)),this.policy=B(e,Pv,Ns.defaultValues(Pv)),this.messageImprint=B(e,kv,Ns.defaultValues(kv)),this.serialNumber=B(e,Lv,Ns.defaultValues(Lv)),this.genTime=B(e,Fv,Ns.defaultValues(Fv)),im in e&&(this.accuracy=B(e,im,Ns.defaultValues(im))),Vf in e&&(this.ordering=B(e,Vf,Ns.defaultValues(Vf))),Mf in e&&(this.nonce=B(e,Mf,Ns.defaultValues(Mf))),am in e&&(this.tsa=B(e,am,Ns.defaultValues(am))),om in e&&(this.extensions=B(e,om,Ns.defaultValues(om))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case Ov:return 0;case Pv:return P;case kv:return new ji;case Lv:return new he;case Fv:return new Date(0,0,0);case im:return new Pl;case Vf:return!1;case Mf:return new he;case am:return new pr;case om:return[];default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case Ov:case Pv:case Fv:case Vf:return t===Ns.defaultValues(Vf);case kv:return ji.compareWithDefault(zf,t.hashAlgorithm)&&ji.compareWithDefault(Wf,t.hashedMessage);case Lv:case Mf:return t.isEqual(Ns.defaultValues(Mf));case im:return Pl.compareWithDefault(Mu,t.seconds)&&Pl.compareWithDefault(ju,t.millis)&&Pl.compareWithDefault(qu,t.micros);case am:return pr.compareWithDefault(by,t.type)&&pr.compareWithDefault(Sy,t.value);case om:return t.length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||Hi,value:[new he({name:t.version||c_}),new He({name:t.policy||l_}),ji.schema(t.messageImprint||{names:{blockName:f_}}),new he({name:t.serialNumber||h_}),new br({name:t.genTime||p_}),Pl.schema(t.accuracy||{names:{blockName:FS}}),new Oi({name:t.ordering||US,optional:!0}),new he({name:t.nonce||VS,optional:!0}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[pr.schema(t.tsa||{names:{blockName:MS}})]}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:1},value:[new lt({name:t.extensions||jS,value:di.schema(t.extension||{})})]})]})}fromSchema(e){Ce(e,Zfe);let t=be(e,e,Ns.schema());ye.assertSchema(t,this.className),this.version=t.result[c_].valueBlock.valueDec,this.policy=t.result[l_].valueBlock.toString(),this.messageImprint=new ji({schema:t.result[f_]}),this.serialNumber=t.result[h_],this.genTime=t.result[p_].toDate(),FS in t.result&&(this.accuracy=new Pl({schema:t.result[FS]})),US in t.result&&(this.ordering=t.result[US].valueBlock.value),VS in t.result&&(this.nonce=t.result[VS]),MS in t.result&&(this.tsa=new pr({schema:t.result[MS]})),jS in t.result&&(this.extensions=Array.from(t.result[jS],n=>new di({schema:n})))}toSchema(){let e=[];return e.push(new he({value:this.version})),e.push(new He({value:this.policy})),e.push(this.messageImprint.toSchema()),e.push(this.serialNumber),e.push(new br({valueDate:this.genTime})),this.accuracy&&e.push(this.accuracy.toSchema()),this.ordering!==void 0&&e.push(new Oi({value:this.ordering})),this.nonce&&e.push(this.nonce),this.tsa&&e.push(new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[this.tsa.toSchema()]})),this.extensions&&e.push(new ae({optional:!0,idBlock:{tagClass:3,tagNumber:1},value:Array.from(this.extensions,t=>t.toSchema())})),new K({value:e})}toJSON(){let e={version:this.version,policy:this.policy,messageImprint:this.messageImprint.toJSON(),serialNumber:this.serialNumber.toJSON(),genTime:this.genTime};return this.accuracy&&(e.accuracy=this.accuracy.toJSON()),this.ordering!==void 0&&(e.ordering=this.ordering),this.nonce&&(e.nonce=this.nonce.toJSON()),this.tsa&&(e.tsa=this.tsa.toJSON()),this.extensions&&(e.extensions=Array.from(this.extensions,t=>t.toJSON())),e}async verify(e,t=mt(!0)){if(!e.data)throw new Error('"data" is a mandatory attribute for TST_INFO verification');let n=e.data;if(e.notBefore&&this.genTime<e.notBefore)throw new Error("Generation time for TSTInfo object is less than notBefore value");if(e.notAfter&&this.genTime>e.notAfter)throw new Error("Generation time for TSTInfo object is more than notAfter value");let s=t.getAlgorithmByOID(this.messageImprint.hashAlgorithm.algorithmId,!0,"MessageImprint.hashAlgorithm"),i=await t.digest(s.name,new Uint8Array(n));return Ze.isEqual(i,this.messageImprint.hashedMessage.valueBlock.valueHexView)}};mH.CLASS_NAME="TSTInfo";var um="version",Uv="digestAlgorithms",Vv="encapContentInfo",cm="certificates",lm="crls",Mv="signerInfos",vy="ocsps",th="SignedData",d_=`${th}.${um}`,qS=`${th}.${Uv}`,m_=`${th}.${Vv}`,HS=`${th}.${cm}`,KS=`${th}.${lm}`,$S=`${th}.${Mv}`,ehe=[d_,qS,m_,HS,KS,$S],Kn=class extends Error{static{o(this,"SignedDataVerifyError")}constructor({message:e,code:t=0,date:n=new Date,signatureVerified:s=null,signerCertificate:i=null,signerCertificateVerified:a=null,timestampSerial:u=null,certificatePath:c=[]}){super(e),this.name="SignedDataVerifyError",this.date=n,this.code=t,this.timestampSerial=u,this.signatureVerified=s,this.signerCertificate=i,this.signerCertificateVerified=a,this.certificatePath=c}},wm=class Mi extends Se{static{o(this,"SignedData")}constructor(e={}){super(),this.version=B(e,um,Mi.defaultValues(um)),this.digestAlgorithms=B(e,Uv,Mi.defaultValues(Uv)),this.encapContentInfo=B(e,Vv,Mi.defaultValues(Vv)),cm in e&&(this.certificates=B(e,cm,Mi.defaultValues(cm))),lm in e&&(this.crls=B(e,lm,Mi.defaultValues(lm))),vy in e&&(this.ocsps=B(e,vy,Mi.defaultValues(vy))),this.signerInfos=B(e,Mv,Mi.defaultValues(Mv)),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case um:return 0;case Uv:return[];case Vv:return new Gf;case cm:return[];case lm:return[];case vy:return[];case Mv:return[];default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case um:return t===Mi.defaultValues(um);case Vv:return Gf.compareWithDefault("eContentType",t.eContentType)&&Gf.compareWithDefault("eContent",t.eContent);case Uv:case cm:case lm:case vy:case Mv:return t.length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return t.optional===void 0&&(t.optional=!1),new K({name:t.blockName||th,optional:t.optional,value:[new he({name:t.version||d_}),new kr({value:[new lt({name:t.digestAlgorithms||qS,value:pe.schema()})]}),Gf.schema(t.encapContentInfo||{names:{blockName:m_}}),new ae({name:t.certificates||HS,optional:!0,idBlock:{tagClass:3,tagNumber:0},value:Qf.schema().valueBlock.value}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:1},value:Xv.schema(t.crls||{names:{crls:KS}}).valueBlock.value}),new kr({value:[new lt({name:t.signerInfos||$S,value:vA.schema()})]})]})}fromSchema(e){Ce(e,ehe);let t=be(e,e,Mi.schema());if(ye.assertSchema(t,this.className),this.version=t.result[d_].valueBlock.valueDec,qS in t.result&&(this.digestAlgorithms=Array.from(t.result[qS],n=>new pe({schema:n}))),this.encapContentInfo=new Gf({schema:t.result[m_]}),HS in t.result){let n=new Qf({schema:new kr({value:t.result[HS].valueBlock.value})});this.certificates=n.certificates.slice(0)}KS in t.result&&(this.crls=Array.from(t.result[KS],n=>n.idBlock.tagClass===1?new Zv({schema:n}):(n.idBlock.tagClass=1,n.idBlock.tagNumber=16,new $v({schema:n})))),$S in t.result&&(this.signerInfos=Array.from(t.result[$S],n=>new vA({schema:n})))}toSchema(e=!1){let t=[];if(this.certificates&&this.certificates.length&&this.certificates.some(n=>n instanceof mS)||this.crls&&this.crls.length&&this.crls.some(n=>n instanceof $v)?this.version=5:this.certificates&&this.certificates.length&&this.certificates.some(n=>n instanceof _c)?this.version=4:this.certificates&&this.certificates.length&&this.certificates.some(n=>n instanceof ZS)||this.signerInfos.some(n=>n.version===3)||this.encapContentInfo.eContentType!==Mi.ID_DATA?this.version=3:this.version=1,t.push(new he({value:this.version})),t.push(new kr({value:Array.from(this.digestAlgorithms,n=>n.toSchema())})),t.push(this.encapContentInfo.toSchema()),this.certificates){let s=new Qf({certificates:this.certificates}).toSchema();t.push(new ae({idBlock:{tagClass:3,tagNumber:0},value:s.valueBlock.value}))}return this.crls&&t.push(new ae({idBlock:{tagClass:3,tagNumber:1},value:Array.from(this.crls,n=>{if(n instanceof $v){let s=n.toSchema();return s.idBlock.tagClass=3,s.idBlock.tagNumber=1,s}return n.toSchema(e)})})),t.push(new kr({value:Array.from(this.signerInfos,n=>n.toSchema())})),new K({value:t})}toJSON(){let e={version:this.version,digestAlgorithms:Array.from(this.digestAlgorithms,t=>t.toJSON()),encapContentInfo:this.encapContentInfo.toJSON(),signerInfos:Array.from(this.signerInfos,t=>t.toJSON())};return this.certificates&&(e.certificates=Array.from(this.certificates,t=>t.toJSON())),this.crls&&(e.crls=Array.from(this.crls,t=>t.toJSON())),e}async verify({signer:e=-1,data:t=Kr,trustedCerts:n=[],checkDate:s=new Date,checkChain:i=!1,passedWhenNotRevValues:a=!1,extendedMode:u=!1,findOrigin:c=null,findIssuer:l=null}={},f=mt(!0)){let h=null,d=null;try{let g=Kr,m=P,v=[],y=this.signerInfos[e];if(!y)throw new Kn({date:s,code:1,message:"Unable to get signer by supplied index"});if(!this.certificates)throw new Kn({date:s,code:2,message:"No certificates attached to this signed data"});if(y.sid instanceof Ln){for(let x of this.certificates)if(x instanceof Gn&&x.issuer.isEqual(y.sid.issuer)&&x.serialNumber.isEqual(y.sid.serialNumber)){h=x;break}}else{let x=y.sid,b=x.idBlock.isConstructed?x.valueBlock.value[0].valueBlock.valueHex:x.valueBlock.valueHex;for(let A of this.certificates){if(!(A instanceof Gn))continue;let k=await f.digest({name:"sha-1"},A.subjectPublicKeyInfo.subjectPublicKey.valueBlock.valueHexView);if(Bu(k,b)){h=A;break}}}if(!h)throw new Kn({date:s,code:3,message:"Unable to find signer certificate"});if(this.encapContentInfo.eContentType===Zce){if(!this.encapContentInfo.eContent)throw new Kn({date:s,code:15,message:"Error during verification: TSTInfo eContent is empty",signatureVerified:null,signerCertificate:h,timestampSerial:d,signerCertificateVerified:!0});let x;try{x=mH.fromBER(this.encapContentInfo.eContent.valueBlock.valueHexView)}catch{throw new Kn({date:s,code:15,message:"Error during verification: TSTInfo wrong ASN.1 schema ",signatureVerified:null,signerCertificate:h,timestampSerial:d,signerCertificateVerified:!0})}if(s=x.genTime,d=x.serialNumber.valueBlock.valueHexView.slice().buffer,t.byteLength===0)throw new Kn({date:s,code:4,message:"Missed detached data input array"});if(!await x.verify({data:t},f))throw new Kn({date:s,code:15,message:"Error during verification: TSTInfo verification is failed",signatureVerified:!1,signerCertificate:h,timestampSerial:d,signerCertificateVerified:!0})}if(i){let x=this.certificates.filter(I=>I instanceof Gn&&!!sH(I,h)),b={checkDate:s,certs:x,trustedCerts:n};l&&(b.findIssuer=l),c&&(b.findOrigin=c);let A=new pH(b);if(A.certs.push(h),this.crls)for(let I of this.crls)"thisUpdate"in I?A.crls.push(I):I.otherRevInfoFormat===qb&&A.ocsps.push(new Jv({schema:I.otherRevInfo}));this.ocsps&&A.ocsps.push(...this.ocsps);let k=await A.verify({passedWhenNotRevValues:a},f).catch(I=>{throw new Kn({date:s,code:5,message:`Validation of signer's certificate failed with error: ${I instanceof Object?I.resultMessage:I}`,signerCertificate:h,signerCertificateVerified:!1})});if(k.certificatePath&&(v=k.certificatePath),!k.result)throw new Kn({date:s,code:5,message:`Validation of signer's certificate failed: ${k.resultMessage}`,signerCertificate:h,signerCertificateVerified:!1})}let w=f.getAlgorithmByOID(y.digestAlgorithm.algorithmId);if(!("name"in w))throw new Kn({date:s,code:7,message:`Unsupported signature algorithm: ${y.digestAlgorithm.algorithmId}`,signerCertificate:h,signerCertificateVerified:!0});m=w.name;let S=this.encapContentInfo.eContent;if(S)S.idBlock.tagClass===1&&S.idBlock.tagNumber===4?t=S.getValue():t=S.valueBlock.valueBeforeDecodeView.slice().buffer;else if(t.byteLength===0)throw new Kn({date:s,code:8,message:"Missed detached data input array",signerCertificate:h,signerCertificateVerified:!0});if(y.signedAttrs){let x=!1,b=!1;for(let A of y.signedAttrs.attributes)if(A.type==="1.2.840.113549.1.9.3"&&(x=!0),A.type==="1.2.840.113549.1.9.4"&&(b=!0,g=A.values[0].valueBlock.valueHex),x&&b)break;if(x===!1)throw new Kn({date:s,code:9,message:'Attribute "content-type" is a mandatory attribute for "signed attributes"',signerCertificate:h,signerCertificateVerified:!0});if(b===!1)throw new Kn({date:s,code:10,message:'Attribute "message-digest" is a mandatory attribute for "signed attributes"',signatureVerified:null,signerCertificate:h,signerCertificateVerified:!0})}if(y.signedAttrs){let x=await f.digest(m,new Uint8Array(t));if(!Bu(x,g))throw new Kn({date:s,code:15,message:"Error during verification: Message digest doesn't match",signatureVerified:null,signerCertificate:h,timestampSerial:d,signerCertificateVerified:!0});t=y.signedAttrs.encodedValue}let E=y.signatureAlgorithm.algorithmId==="1.2.840.113549.1.1.1"?await f.verifyWithPublicKey(t,y.signature,h.subjectPublicKeyInfo,y.signatureAlgorithm,m):await f.verifyWithPublicKey(t,y.signature,h.subjectPublicKeyInfo,y.signatureAlgorithm);return u?{date:s,code:14,message:P,signatureVerified:E,signerCertificate:h,timestampSerial:d,signerCertificateVerified:!0,certificatePath:v}:E}catch(g){throw g instanceof Kn?g:new Kn({date:s,code:15,message:`Error during verification: ${g instanceof Error?g.message:g}`,signatureVerified:null,signerCertificate:h,timestampSerial:d,signerCertificateVerified:!0})}}async sign(e,t,n="SHA-1",s=Kr,i=mt(!0)){var a;if(!e)throw new Error("Need to provide a private key for signing");let u=this.signerInfos[t];if(!u)throw new RangeError("SignerInfo index is out of range");!(!((a=u.signedAttrs)===null||a===void 0)&&a.attributes.length)&&"hash"in e.algorithm&&"hash"in e.algorithm&&e.algorithm.hash&&(n=e.algorithm.hash.name);let c=i.getOIDByAlgorithm({name:n},!0,"hashAlgorithm");this.digestAlgorithms.filter(d=>d.algorithmId===c).length===0&&this.digestAlgorithms.push(new pe({algorithmId:c,algorithmParams:new Pr})),u.digestAlgorithm=new pe({algorithmId:c,algorithmParams:new Pr});let l=await i.getSignatureParameters(e,n),f=l.parameters;if(u.signatureAlgorithm=l.signatureAlgorithm,u.signedAttrs)if(u.signedAttrs.encodedValue.byteLength!==0)s=u.signedAttrs.encodedValue;else{s=u.signedAttrs.toSchema().toBER();let d=Ze.toUint8Array(s);d[0]=49}else{let d=this.encapContentInfo.eContent;if(d)d.idBlock.tagClass===1&&d.idBlock.tagNumber===4?s=d.getValue():s=d.valueBlock.valueBeforeDecodeView.slice().buffer;else if(s.byteLength===0)throw new Error("Missed detached data input array")}let h=await i.signWithPrivateKey(s,e,f);u.signature=new Be({valueHex:h})}};wm.CLASS_NAME="SignedData";wm.ID_DATA=S_;var jf="version",qf="authSafe",To="macData",xy="parsedValue",the=[jf,qf,To],rhe=class Hf extends Se{static{o(this,"PFX")}constructor(e={}){super(),this.version=B(e,jf,Hf.defaultValues(jf)),this.authSafe=B(e,qf,Hf.defaultValues(qf)),To in e&&(this.macData=B(e,To,Hf.defaultValues(To))),xy in e&&(this.parsedValue=B(e,xy,Hf.defaultValues(xy))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case jf:return 3;case qf:return new Fr;case To:return new Ac;case xy:return{};default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case jf:return t===Hf.defaultValues(e);case qf:return Fr.compareWithDefault("contentType",t.contentType)&&Fr.compareWithDefault("content",t.content);case To:return Ac.compareWithDefault("mac",t.mac)&&Ac.compareWithDefault("macSalt",t.macSalt)&&Ac.compareWithDefault("iterations",t.iterations);case xy:return t instanceof Object&&Object.keys(t).length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new he({name:t.version||jf}),Fr.schema(t.authSafe||{names:{blockName:qf}}),Ac.schema(t.macData||{names:{blockName:To,optional:!0}})]})}fromSchema(e){Ce(e,the);let t=be(e,e,Hf.schema({names:{version:jf,authSafe:{names:{blockName:qf}},macData:{names:{blockName:To}}}}));ye.assertSchema(t,this.className),this.version=t.result.version.valueBlock.valueDec,this.authSafe=new Fr({schema:t.result.authSafe}),To in t.result&&(this.macData=new Ac({schema:t.result.macData}))}toSchema(){let e=[new he({value:this.version}),this.authSafe.toSchema()];return this.macData&&e.push(this.macData.toSchema()),new K({value:e})}toJSON(){let e={version:this.version,authSafe:this.authSafe.toJSON()};return this.macData&&(e.macData=this.macData.toJSON()),e}async makeInternalValues(e={},t=mt(!0)){if(hr.assert(e,"parameters","object"),!this.parsedValue)throw new Error('Please call "parseValues" function first in order to make "parsedValue" data');switch(Jt.assertEmpty(this.parsedValue.integrityMode,"integrityMode","parsedValue"),Jt.assertEmpty(this.parsedValue.authenticatedSafe,"authenticatedSafe","parsedValue"),this.parsedValue.integrityMode){case 0:{if(!("iterations"in e))throw new Jt("iterations");Jt.assertEmpty(e.pbkdf2HashAlgorithm,"pbkdf2HashAlgorithm"),Jt.assertEmpty(e.hmacHashAlgorithm,"hmacHashAlgorithm"),Jt.assertEmpty(e.password,"password");let n=new ArrayBuffer(64),s=new Uint8Array(n);t.getRandomValues(s);let i=this.parsedValue.authenticatedSafe.toSchema().toBER(!1);this.authSafe=new Fr({contentType:Fr.DATA,content:new Be({valueHex:i})});let a=await t.stampDataWithPassword({password:e.password,hashAlgorithm:e.hmacHashAlgorithm,salt:n,iterationCount:e.iterations,contentToStamp:i});this.macData=new Ac({mac:new Xf({digestAlgorithm:new pe({algorithmId:t.getOIDByAlgorithm({name:e.hmacHashAlgorithm},!0,"hmacHashAlgorithm")}),digest:new Be({valueHex:a})}),macSalt:new Be({valueHex:n}),iterations:e.iterations})}break;case 1:{if(!("signingCertificate"in e))throw new Jt("signingCertificate");Jt.assertEmpty(e.privateKey,"privateKey"),Jt.assertEmpty(e.hashAlgorithm,"hashAlgorithm");let n=this.parsedValue.authenticatedSafe.toSchema().toBER(!1),s=new wm({version:1,encapContentInfo:new Gf({eContentType:"1.2.840.113549.1.7.1",eContent:new Be({valueHex:n})}),certificates:[e.signingCertificate]}),i=await t.digest({name:e.hashAlgorithm},new Uint8Array(n)),a=[];a.push(new $r({type:"1.2.840.113549.1.9.3",values:[new He({value:"1.2.840.113549.1.7.1"})]})),a.push(new $r({type:"1.2.840.113549.1.9.5",values:[new Il({valueDate:new Date})]})),a.push(new $r({type:"1.2.840.113549.1.9.4",values:[new Be({valueHex:i})]})),s.signerInfos.push(new vA({version:1,sid:new Ln({issuer:e.signingCertificate.issuer,serialNumber:e.signingCertificate.serialNumber}),signedAttrs:new Ts({type:0,attributes:a})})),await s.sign(e.privateKey,0,e.hashAlgorithm,void 0,t),this.authSafe=new Fr({contentType:"1.2.840.113549.1.7.2",content:s.toSchema(!0)})}break;default:throw new Error(`Parameter "integrityMode" has unknown value: ${this.parsedValue.integrityMode}`)}}async parseInternalValues(e,t=mt(!0)){switch(hr.assert(e,"parameters","object"),e.checkIntegrity===void 0&&(e.checkIntegrity=!0),this.parsedValue={},this.authSafe.contentType){case Fr.DATA:{Jt.assertEmpty(e.password,"password"),this.parsedValue.integrityMode=0,hr.assert(this.authSafe.content,"authSafe.content",Be);let n=this.authSafe.content.getValue();if(this.parsedValue.authenticatedSafe=YR.fromBER(n),e.checkIntegrity){if(!this.macData)throw new Error('Absent "macData" value, can not check PKCS#12 data integrity');let s=t.getAlgorithmByOID(this.macData.mac.digestAlgorithm.algorithmId,!0,"digestAlgorithm");if(!await t.verifyDataStampedWithPassword({password:e.password,hashAlgorithm:s.name,salt:Ze.toArrayBuffer(this.macData.macSalt.valueBlock.valueHexView),iterationCount:this.macData.iterations||1,contentToVerify:n,signatureToVerify:Ze.toArrayBuffer(this.macData.mac.digest.valueBlock.valueHexView)}))throw new Error("Integrity for the PKCS#12 data is broken!")}}break;case Fr.SIGNED_DATA:{this.parsedValue.integrityMode=1;let n=new wm({schema:this.authSafe.content}),s=n.encapContentInfo.eContent;Jt.assert(s,"eContent","cmsSigned.encapContentInfo"),hr.assert(s,"eContent",Be);let i=s.getValue();if(this.parsedValue.authenticatedSafe=YR.fromBER(i),!await n.verify({signer:0,checkChain:!1},t))throw new Error("Integrity for the PKCS#12 data is broken!")}break;default:throw new Error(`Incorrect value for "this.authSafe.contentType": ${this.authSafe.contentType}`)}}};rhe.CLASS_NAME="PFX";var fm="status",Dc="statusStrings",Bc="failInfo",nhe=[fm,Dc,Bc],N7;(function(r){r[r.granted=0]="granted",r[r.grantedWithMods=1]="grantedWithMods",r[r.rejection=2]="rejection",r[r.waiting=3]="waiting",r[r.revocationWarning=4]="revocationWarning",r[r.revocationNotification=5]="revocationNotification"})(N7||(N7={}));var jv=class Kf extends Se{static{o(this,"PKIStatusInfo")}constructor(e={}){super(),this.status=B(e,fm,Kf.defaultValues(fm)),Dc in e&&(this.statusStrings=B(e,Dc,Kf.defaultValues(Dc))),Bc in e&&(this.failInfo=B(e,Bc,Kf.defaultValues(Bc))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case fm:return 2;case Dc:return[];case Bc:return new Ct;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case fm:return t===Kf.defaultValues(e);case Dc:return t.length===0;case Bc:return t.isEqual(Kf.defaultValues(e));default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||P,value:[new he({name:t.status||P}),new K({optional:!0,value:[new lt({name:t.statusStrings||P,value:new ui})]}),new Ct({name:t.failInfo||P,optional:!0})]})}fromSchema(e){Ce(e,nhe);let t=be(e,e,Kf.schema({names:{status:fm,statusStrings:Dc,failInfo:Bc}}));ye.assertSchema(t,this.className);let n=t.result.status;if(n.valueBlock.isHexOnly===!0||n.valueBlock.valueDec<0||n.valueBlock.valueDec>5)throw new Error('PKIStatusInfo "status" has invalid value');this.status=n.valueBlock.valueDec,Dc in t.result&&(this.statusStrings=t.result.statusStrings),Bc in t.result&&(this.failInfo=t.result.failInfo)}toSchema(){let e=[];return e.push(new he({value:this.status})),this.statusStrings&&e.push(new K({optional:!0,value:this.statusStrings})),this.failInfo&&e.push(this.failInfo),new K({value:e})}toJSON(){let e={status:this.status};return this.statusStrings&&(e.statusStrings=Array.from(this.statusStrings,t=>t.toJSON())),this.failInfo&&(e.failInfo=this.failInfo.toJSON()),e}};jv.CLASS_NAME="PKIStatusInfo";var qv="version",Hv="messageImprint",hm="reqPolicy",pm="nonce",Io="certReq",dm="extensions",rh="TimeStampReq",g_=`${rh}.${qv}`,y_=`${rh}.${Hv}`,XS=`${rh}.${hm}`,GS=`${rh}.${pm}`,zS=`${rh}.${Io}`,WS=`${rh}.${dm}`,she=[g_,y_,XS,GS,zS,WS],ihe=class pi extends Se{static{o(this,"TimeStampReq")}constructor(e={}){super(),this.version=B(e,qv,pi.defaultValues(qv)),this.messageImprint=B(e,Hv,pi.defaultValues(Hv)),hm in e&&(this.reqPolicy=B(e,hm,pi.defaultValues(hm))),pm in e&&(this.nonce=B(e,pm,pi.defaultValues(pm))),Io in e&&(this.certReq=B(e,Io,pi.defaultValues(Io))),dm in e&&(this.extensions=B(e,dm,pi.defaultValues(dm))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case qv:return 0;case Hv:return new ji;case hm:return P;case pm:return new he;case Io:return!1;case dm:return[];default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case qv:case hm:case Io:return t===pi.defaultValues(e);case Hv:return ji.compareWithDefault("hashAlgorithm",t.hashAlgorithm)&&ji.compareWithDefault("hashedMessage",t.hashedMessage);case pm:return t.isEqual(pi.defaultValues(e));case dm:return t.length===0;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||rh,value:[new he({name:t.version||g_}),ji.schema(t.messageImprint||{names:{blockName:y_}}),new He({name:t.reqPolicy||XS,optional:!0}),new he({name:t.nonce||GS,optional:!0}),new Oi({name:t.certReq||zS,optional:!0}),new ae({optional:!0,idBlock:{tagClass:3,tagNumber:0},value:[new lt({name:t.extensions||WS,value:di.schema()})]})]})}fromSchema(e){Ce(e,she);let t=be(e,e,pi.schema());ye.assertSchema(t,this.className),this.version=t.result[g_].valueBlock.valueDec,this.messageImprint=new ji({schema:t.result[y_]}),XS in t.result&&(this.reqPolicy=t.result[XS].valueBlock.toString()),GS in t.result&&(this.nonce=t.result[GS]),zS in t.result&&(this.certReq=t.result[zS].valueBlock.value),WS in t.result&&(this.extensions=Array.from(t.result[WS],n=>new di({schema:n})))}toSchema(){let e=[];return e.push(new he({value:this.version})),e.push(this.messageImprint.toSchema()),this.reqPolicy&&e.push(new He({value:this.reqPolicy})),this.nonce&&e.push(this.nonce),Io in this&&pi.compareWithDefault(Io,this.certReq)===!1&&e.push(new Oi({value:this.certReq})),this.extensions&&e.push(new ae({idBlock:{tagClass:3,tagNumber:0},value:Array.from(this.extensions,t=>t.toSchema())})),new K({value:e})}toJSON(){let e={version:this.version,messageImprint:this.messageImprint.toJSON()};return this.reqPolicy!==void 0&&(e.reqPolicy=this.reqPolicy),this.nonce!==void 0&&(e.nonce=this.nonce.toJSON()),this.certReq!==void 0&&pi.compareWithDefault(Io,this.certReq)===!1&&(e.certReq=this.certReq),this.extensions&&(e.extensions=Array.from(this.extensions,t=>t.toJSON())),e}};ihe.CLASS_NAME="TimeStampReq";var mm="status",gm="timeStampToken",F_="TimeStampResp",v_=`${F_}.${mm}`,JS=`${F_}.${gm}`,ahe=[v_,JS],ohe=class YS extends Se{static{o(this,"TimeStampResp")}constructor(e={}){super(),this.status=B(e,mm,YS.defaultValues(mm)),gm in e&&(this.timeStampToken=B(e,gm,YS.defaultValues(gm))),e.schema&&this.fromSchema(e.schema)}static defaultValues(e){switch(e){case mm:return new jv;case gm:return new Fr;default:return super.defaultValues(e)}}static compareWithDefault(e,t){switch(e){case mm:return jv.compareWithDefault(mm,t.status)&&!("statusStrings"in t)&&!("failInfo"in t);case gm:return t.contentType===P&&t.content instanceof it;default:return super.defaultValues(e)}}static schema(e={}){let t=B(e,"names",{});return new K({name:t.blockName||F_,value:[jv.schema(t.status||{names:{blockName:v_}}),Fr.schema(t.timeStampToken||{names:{blockName:JS,optional:!0}})]})}fromSchema(e){Ce(e,ahe);let t=be(e,e,YS.schema());ye.assertSchema(t,this.className),this.status=new jv({schema:t.result[v_]}),JS in t.result&&(this.timeStampToken=new Fr({schema:t.result[JS]}))}toSchema(){let e=[];return e.push(this.status.toSchema()),this.timeStampToken&&e.push(this.timeStampToken.toSchema()),new K({value:e})}toJSON(){let e={status:this.status.toJSON()};return this.timeStampToken&&(e.timeStampToken=this.timeStampToken.toJSON()),e}async sign(e,t,n=mt(!0)){return this.assertContentType(),new wm({schema:this.timeStampToken.content}).sign(e,0,t,void 0,n)}async verify(e={signer:0,trustedCerts:[],data:Kr},t=mt(!0)){return this.assertContentType(),new wm({schema:this.timeStampToken.content}).verify(e,t)}assertContentType(){if(!this.timeStampToken)throw new Error("timeStampToken is absent in TSP response");if(this.timeStampToken.contentType!==U7)throw new Error(`Wrong format of timeStampToken: ${this.timeStampToken.contentType}`)}};ohe.CLASS_NAME="TimeStampResp";function uhe(){if(typeof globalThis<"u"&&"crypto"in globalThis){let r="webcrypto";"webkitSubtle"in globalThis.crypto&&(r="safari"),QS(r,new Em({name:r,crypto:globalThis.crypto}))}else if(typeof crypto<"u"&&"webcrypto"in crypto){let r="NodeJS ^15",e=crypto.webcrypto;QS(r,new Em({name:r,crypto:e}))}}o(uhe,"initCryptoEngine");uhe();var U_=null,rn=class{static{o(this,"Application")}static setEngine(e,t){U_=Object.assign(t,{name:e}),QS(e,new Em({name:e,crypto:t}))}static get crypto(){if(!U_)throw new _e(we.CRYPTOGRAPHIC_NO_MODULE);return U_}static isNodePlugin(){return typeof self>"u"&&typeof window>"u"}};function che(){rn.isNodePlugin()||rn.setEngine("W3 WebCrypto module",self.crypto)}o(che,"init");che();var xA=class{static{o(this,"XmlAlgorithm")}getAlgorithmName(){return this.namespaceURI}},nh=class extends xA{static{o(this,"HashAlgorithm")}async Digest(e){let t;if(typeof e=="string")t=ir.FromString(e,"utf8");else if(ArrayBuffer.isView(e))t=new Uint8Array(e.buffer);else if(e instanceof ArrayBuffer)t=new Uint8Array(e);else{let s=Sp(e);t=ir.FromString(s,"utf8")}let n=await rn.crypto.subtle.digest(this.algorithm,t);return new Uint8Array(n)}},Yr=class extends xA{static{o(this,"SignatureAlgorithm")}async Sign(e,t,n){let s=ir.FromString(e,"utf8");return rn.crypto.subtle.sign(n,t,s)}async Verify(e,t,n){let s=this.algorithm,i=ir.FromString(e,"utf8");return rn.crypto.subtle.verify(s,t,n,i)}};var cn="SHA-1",Cn="SHA-256",Nn="SHA-384",Tn="SHA-512",Am="http://www.w3.org/2000/09/xmldsig#sha1",Cm="http://www.w3.org/2001/04/xmlenc#sha256",Nm="http://www.w3.org/2001/04/xmldsig-more#sha384",Tm="http://www.w3.org/2001/04/xmlenc#sha512",EA=class extends nh{static{o(this,"Sha1")}constructor(){super(...arguments),this.algorithm={name:cn},this.namespaceURI=Am}},rx=class extends nh{static{o(this,"Sha256")}constructor(){super(...arguments),this.algorithm={name:Cn},this.namespaceURI=Cm}},wA=class extends nh{static{o(this,"Sha384")}constructor(){super(...arguments),this.algorithm={name:Nn},this.namespaceURI=Nm}},bA=class extends nh{static{o(this,"Sha512")}constructor(){super(...arguments),this.algorithm={name:Tn},this.namespaceURI=Tm}};var Ro="ECDSA",SA="http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha1",AA="http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha256",CA="http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha384",NA="http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha512";function TA(r){if(r.name.toUpperCase()===Ro.toUpperCase())switch(r.hash.name.toUpperCase()){case cn:return new Im;case Cn:return new Dm;case Nn:return new Bm;case Tn:return new Rm}return null}o(TA,"fromAlgorithm");var Im=class extends Yr{static{o(this,"EcdsaSha1")}constructor(){super(...arguments),this.algorithm={name:Ro,hash:{name:cn}},this.namespaceURI=SA}static fromAlgorithm(e){return TA(e)}},Dm=class extends Yr{static{o(this,"EcdsaSha256")}constructor(){super(...arguments),this.algorithm={name:Ro,hash:{name:Cn}},this.namespaceURI=AA}static fromAlgorithm(e){return TA(e)}},Bm=class extends Yr{static{o(this,"EcdsaSha384")}constructor(){super(...arguments),this.algorithm={name:Ro,hash:{name:Nn}},this.namespaceURI=CA}static fromAlgorithm(e){return TA(e)}},Rm=class extends Yr{static{o(this,"EcdsaSha512")}constructor(){super(...arguments),this.algorithm={name:Ro,hash:{name:Tn}},this.namespaceURI=NA}static fromAlgorithm(e){return TA(e)}};var _m="HMAC",V_="http://www.w3.org/2000/09/xmldsig#hmac-sha1",M_="http://www.w3.org/2001/04/xmldsig-more#hmac-sha256",j_="http://www.w3.org/2001/04/xmldsig-more#hmac-sha384",q_="http://www.w3.org/2001/04/xmldsig-more#hmac-sha512";function IA(r){if(r.name.toUpperCase()===_m.toUpperCase())switch(r.hash.name.toUpperCase()){case cn:return new nx;case Cn:return new sx;case Nn:return new ix;case Tn:return new ax}return null}o(IA,"fromAlgorithm");var nx=class extends Yr{static{o(this,"HmacSha1")}constructor(){super(...arguments),this.algorithm={name:_m,hash:{name:cn}},this.namespaceURI=V_}static fromAlgorithm(e){return IA(e)}},sx=class extends Yr{static{o(this,"HmacSha256")}constructor(){super(...arguments),this.algorithm={name:_m,hash:{name:Cn}},this.namespaceURI=M_}static fromAlgorithm(e){return IA(e)}},ix=class extends Yr{static{o(this,"HmacSha384")}constructor(){super(...arguments),this.algorithm={name:_m,hash:{name:Nn}},this.namespaceURI=j_}static fromAlgorithm(e){return IA(e)}},ax=class extends Yr{static{o(this,"HmacSha512")}constructor(){super(...arguments),this.algorithm={name:_m,hash:{name:Tn}},this.namespaceURI=q_}static fromAlgorithm(e){return IA(e)}};var _o="RSASSA-PKCS1-v1_5",DA="http://www.w3.org/2000/09/xmldsig#rsa-sha1",BA="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256",RA="http://www.w3.org/2001/04/xmldsig-more#rsa-sha384",_A="http://www.w3.org/2001/04/xmldsig-more#rsa-sha512";function OA(r){if(r.name.toUpperCase()===_o.toUpperCase())switch(r.hash.name.toUpperCase()){case cn:return new Om;case Cn:return new Pm;case Nn:return new km;case Tn:return new Lm}return null}o(OA,"fromAlgorithm");var Om=class extends Yr{static{o(this,"RsaPkcs1Sha1")}constructor(){super(...arguments),this.algorithm={name:_o,hash:{name:cn}},this.namespaceURI=DA}static fromAlgorithm(e){return OA(e)}},Pm=class extends Yr{static{o(this,"RsaPkcs1Sha256")}constructor(){super(...arguments),this.algorithm={name:_o,hash:{name:Cn}},this.namespaceURI=BA}static fromAlgorithm(e){return OA(e)}},km=class extends Yr{static{o(this,"RsaPkcs1Sha384")}constructor(){super(...arguments),this.algorithm={name:_o,hash:{name:Nn}},this.namespaceURI=RA}static fromAlgorithm(e){return OA(e)}},Lm=class extends Yr{static{o(this,"RsaPkcs1Sha512")}constructor(){super(...arguments),this.algorithm={name:_o,hash:{name:Tn}},this.namespaceURI=_A}static fromAlgorithm(e){return OA(e)}};function Fe(r,e,t,n){var s=arguments.length,i=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(r,e,t,n);else for(var u=r.length-1;u>=0;u--)(a=r[u])&&(i=(s<3?a(i):s>3?a(e,t,i):a(e,t))||i);return s>3&&i&&Object.defineProperty(e,t,i),i}o(Fe,"__decorate");function Ye(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}o(Ye,"__metadata");var fe={DefaultCanonMethod:"http://www.w3.org/TR/2001/REC-xml-c14n-20010315",DefaultDigestMethod:"http://www.w3.org/2001/04/xmlenc#sha256",DefaultPrefix:"ds",ElementNames:{CanonicalizationMethod:"CanonicalizationMethod",DigestMethod:"DigestMethod",DigestValue:"DigestValue",DSAKeyValue:"DSAKeyValue",DomainParameters:"DomainParameters",EncryptedKey:"EncryptedKey",HMACOutputLength:"HMACOutputLength",RSAPSSParams:"RSAPSSParams",MaskGenerationFunction:"MaskGenerationFunction",SaltLength:"SaltLength",KeyInfo:"KeyInfo",KeyName:"KeyName",KeyValue:"KeyValue",Modulus:"Modulus",Exponent:"Exponent",Manifest:"Manifest",Object:"Object",Reference:"Reference",RetrievalMethod:"RetrievalMethod",RSAKeyValue:"RSAKeyValue",ECDSAKeyValue:"ECDSAKeyValue",NamedCurve:"NamedCurve",PublicKey:"PublicKey",Signature:"Signature",SignatureMethod:"SignatureMethod",SignatureValue:"SignatureValue",SignedInfo:"SignedInfo",Transform:"Transform",Transforms:"Transforms",X509Data:"X509Data",PGPData:"PGPData",SPKIData:"SPKIData",SPKIexp:"SPKIexp",MgmtData:"MgmtData",X509IssuerSerial:"X509IssuerSerial",X509IssuerName:"X509IssuerName",X509SerialNumber:"X509SerialNumber",X509SKI:"X509SKI",X509SubjectName:"X509SubjectName",X509Certificate:"X509Certificate",X509CRL:"X509CRL",XPath:"XPath",X:"X",Y:"Y"},AttributeNames:{Algorithm:"Algorithm",Encoding:"Encoding",Id:"Id",MimeType:"MimeType",Type:"Type",URI:"URI"},AlgorithmNamespaces:{XmlDsigBase64Transform:"http://www.w3.org/2000/09/xmldsig#base64",XmlDsigC14NTransform:"http://www.w3.org/TR/2001/REC-xml-c14n-20010315",XmlDsigC14NWithCommentsTransform:"http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments",XmlDsigEnvelopedSignatureTransform:"http://www.w3.org/2000/09/xmldsig#enveloped-signature",XmlDsigXPathTransform:"http://www.w3.org/TR/1999/REC-xpath-19991116",XmlDsigXsltTransform:"http://www.w3.org/TR/1999/REC-xslt-19991116",XmlDsigExcC14NTransform:"http://www.w3.org/2001/10/xml-exc-c14n#",XmlDsigExcC14NWithCommentsTransform:"http://www.w3.org/2001/10/xml-exc-c14n#WithComments",XmlDecryptionTransform:"http://www.w3.org/2002/07/decrypt#XML",XmlLicenseTransform:"urn:mpeg:mpeg21:2003:01-REL-R-NS:licenseTransform"},Uri:{Manifest:"http://www.w3.org/2000/09/xmldsig#Manifest"},NamespaceURI:"http://www.w3.org/2000/09/xmldsig#",NamespaceURIMore:"http://www.w3.org/2007/05/xmldsig-more#",NamespaceURIPss:"http://www.example.org/xmldsig-pss/#"};var Br=class extends ws{static{o(this,"XmlSignatureObject")}};Br=Fe([Et({localName:"xmldsig",namespaceURI:fe.NamespaceURI,prefix:fe.DefaultPrefix})],Br);var mi=class extends Cp{static{o(this,"XmlSignatureCollection")}};mi=Fe([Et({localName:"xmldsig_collection",namespaceURI:fe.NamespaceURI,prefix:fe.DefaultPrefix})],mi);var gi=class extends Br{static{o(this,"DigestMethod")}constructor(e){super(),e&&(this.Algorithm=e)}};Fe([wr({localName:fe.AttributeNames.Algorithm,required:!0,defaultValue:fe.DefaultDigestMethod}),Ye("design:type",String)],gi.prototype,"Algorithm",void 0);gi=Fe([Et({localName:fe.ElementNames.DigestMethod}),Ye("design:paramtypes",[String])],gi);var Hs=class extends Br{static{o(this,"KeyInfoClause")}static canImportCryptoKey(e){return!1}};var lhe={name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},Fm=class extends Hs{static{o(this,"RsaKeyValue")}constructor(){super(...arguments),this.key=null,this.jwk=null,this.keyUsage=[]}static canImportCryptoKey(e){let t=e.algorithm.name.toUpperCase();return t===_o.toUpperCase()||t===Ki.toUpperCase()}async importKey(e){let t=e.algorithm.name?e.algorithm.name.toUpperCase():"";if(t!==_o.toUpperCase()&&t!==Ki.toUpperCase())throw new _e(we.ALGORITHM_WRONG_NAME,e.algorithm.name);this.key=e;let n=await rn.crypto.subtle.exportKey("jwk",e);return this.jwk=n,this.Modulus=ir.FromBase64Url(n.n||""),this.Exponent=ir.FromBase64Url(n.e||""),this.keyUsage=e.usages,this}async exportKey(e=lhe){if(this.key)return this.key;if(!this.Modulus)throw new _e(we.CRYPTOGRAPHIC,"RsaKeyValue has no Modulus");let t=ir.ToBase64Url(this.Modulus);if(!this.Exponent)throw new _e(we.CRYPTOGRAPHIC,"RsaKeyValue has no Exponent");let n=ir.ToBase64Url(this.Exponent),s;switch(e.name.toUpperCase()){case _o.toUpperCase():s="R";break;case Ki.toUpperCase():s="P";break;default:throw new _e(we.ALGORITHM_NOT_SUPPORTED,e.name)}switch(e.hash.name.toUpperCase()){case cn:s+="S1";break;case Cn:s+="S256";break;case Nn:s+="S384";break;case Tn:s+="S512";break}let i={kty:"RSA",alg:s,n:t,e:n,ext:!0};return rn.crypto.subtle.importKey("jwk",i,e,!0,this.keyUsage)}LoadXml(e){super.LoadXml(e),this.keyUsage=["verify"]}};Fe([Dt({localName:fe.ElementNames.Modulus,prefix:fe.DefaultPrefix,namespaceURI:fe.NamespaceURI,required:!0,converter:oi}),Ye("design:type",Object)],Fm.prototype,"Modulus",void 0);Fe([Dt({localName:fe.ElementNames.Exponent,prefix:fe.DefaultPrefix,namespaceURI:fe.NamespaceURI,required:!0,converter:oi}),Ye("design:type",Object)],Fm.prototype,"Exponent",void 0);Fm=Fe([Et({localName:fe.ElementNames.RSAKeyValue})],Fm);var H_="http://www.w3.org/2007/05/xmldsig-more#",K_="pss",Um=class extends ws{static{o(this,"MaskGenerationFunction")}};Fe([Dt({parser:gi}),Ye("design:type",gi)],Um.prototype,"DigestMethod",void 0);Fe([wr({localName:fe.AttributeNames.Algorithm,defaultValue:"http://www.w3.org/2007/05/xmldsig-more#MGF1"}),Ye("design:type",String)],Um.prototype,"Algorithm",void 0);Um=Fe([Et({localName:fe.ElementNames.MaskGenerationFunction,prefix:K_,namespaceURI:H_})],Um);var $i=class extends ws{static{o(this,"PssAlgorithmParams")}};Fe([Dt({parser:gi}),Ye("design:type",gi)],$i.prototype,"DigestMethod",void 0);Fe([Dt({parser:Um}),Ye("design:type",Um)],$i.prototype,"MGF",void 0);Fe([Dt({converter:Yg,prefix:K_,namespaceURI:H_}),Ye("design:type",Number)],$i.prototype,"SaltLength",void 0);Fe([Dt({converter:Yg}),Ye("design:type",Number)],$i.prototype,"TrailerField",void 0);$i=Fe([Et({localName:fe.ElementNames.RSAPSSParams,prefix:K_,namespaceURI:H_})],$i);var Ki="RSA-PSS",$_="http://www.w3.org/2007/05/xmldsig-more#rsa-pss",PA=class r extends Yr{static{o(this,"RsaPssWithParams")}constructor(){super(...arguments),this.algorithm={name:Ki,hash:{name:cn}},this.namespaceURI=$_}static fromAlgorithm(e){let t=null;if(e.name.toUpperCase()===Ki.toUpperCase()){switch(e.hash.name.toUpperCase()){case cn:t=new r;break;case Cn:t=new r;break;case Nn:t=new r;break;case Tn:t=new r;break}if(t)return t.algorithm.hash.name=e.hash.name,e.saltLength&&(t.algorithm.saltLength=e.saltLength),t}return null}fromMethod(e){if(!e.Any.Some(t=>{if(t instanceof $i){switch(t.DigestMethod.Algorithm.toLowerCase()){case Am:this.algorithm.hash.name=cn;break;case Cm:this.algorithm.hash.name=Cn;break;case Nm:this.algorithm.hash.name=Nn;break;case Tm:this.algorithm.hash.name=Tn;break;default:throw new _e(we.CRYPTOGRAPHIC,`Unsupported hash algorithm: ${t.DigestMethod.Algorithm}`)}return t.SaltLength&&(this.algorithm.saltLength=t.SaltLength),!0}return!1}))throw new _e(we.CRYPTOGRAPHIC,"RSA-PSS parameters not found in SignatureMethod")}toMethod(e){let t=new $i;switch(this.algorithm.hash.name.toUpperCase()){case cn:t.DigestMethod.Algorithm=Am;break;case Cn:t.DigestMethod.Algorithm=Cm;break;case Nn:t.DigestMethod.Algorithm=Nm;break;case Tn:t.DigestMethod.Algorithm=Tm;break;default:throw new _e(we.CRYPTOGRAPHIC,`Unsupported hash algorithm: ${this.algorithm.hash.name}`)}this.algorithm.saltLength&&(t.SaltLength=this.algorithm.saltLength),e.Any.Add(t)}};var X_="http://www.w3.org/2007/05/xmldsig-more#sha1-rsa-MGF1",G_="http://www.w3.org/2007/05/xmldsig-more#sha256-rsa-MGF1",z_="http://www.w3.org/2007/05/xmldsig-more#sha384-rsa-MGF1",W_="http://www.w3.org/2007/05/xmldsig-more#sha512-rsa-MGF1",Vm=class extends Yr{static{o(this,"RsaPssWithoutParamsBase")}static fromAlgorithm(e){return null}},kA=class extends Vm{static{o(this,"RsaPssWithoutParamsSha1")}constructor(){super(...arguments),this.algorithm={name:Ki,hash:{name:cn},saltLength:20},this.namespaceURI=X_}},LA=class extends Vm{static{o(this,"RsaPssWithoutParamsSha256")}constructor(){super(...arguments),this.algorithm={name:Ki,hash:{name:Cn},saltLength:32},this.namespaceURI=G_}},FA=class extends Vm{static{o(this,"RsaPssWithoutParamsSha384")}constructor(){super(...arguments),this.algorithm={name:Ki,hash:{name:Nn},saltLength:48},this.namespaceURI=z_}},UA=class extends Vm{static{o(this,"RsaPssWithoutParamsSha512")}constructor(){super(...arguments),this.algorithm={name:Ki,hash:{name:Tn},saltLength:64},this.namespaceURI=W_}};var Ks;(function(r){r[r.BeforeDocElement=0]="BeforeDocElement",r[r.InsideDocElement=1]="InsideDocElement",r[r.AfterDocElement=2]="AfterDocElement"})(Ks||(Ks={}));var Ta=class{static{o(this,"XmlCanonicalizer")}constructor(e,t,n=new Np){this.propagatedNamespaces=new Np,this.result=[],this.visibleNamespaces=new Np,this.inclusiveNamespacesPrefixList=[],this.state=Ks.BeforeDocElement,this.withComments=e,this.exclusive=t,this.propagatedNamespaces=n}get InclusiveNamespacesPrefixList(){return this.inclusiveNamespacesPrefixList.join(" ")}set InclusiveNamespacesPrefixList(e){this.inclusiveNamespacesPrefixList=e.split(" ")}Canonicalize(e){if(!e)throw new _e(we.CRYPTOGRAPHIC,"Parameter 1 is not Node");return this.WriteNode(e),this.result.join("")}WriteNode(e){switch(e.nodeType){case xt.Document:case xt.DocumentFragment:this.WriteDocumentNode(e);break;case xt.Element:this.WriteElementNode(e);break;case xt.CDATA:case xt.SignificantWhitespace:case xt.Text:Sl(e.parentNode)||this.WriteTextNode(e);break;case xt.Whitespace:this.state===Ks.InsideDocElement&&this.WriteTextNode(e);break;case xt.Comment:this.WriteCommentNode(e);break;case xt.ProcessingInstruction:this.WriteProcessingInstructionNode(e);break;case xt.EntityReference:for(let t=0;t<e.childNodes.length;t++)this.WriteNode(e.childNodes[t]);break;case xt.Attribute:throw new _e(we.CRYPTOGRAPHIC,"Attribute node is impossible here");case xt.EndElement:throw new _e(we.CRYPTOGRAPHIC,"Attribute node is impossible here");case xt.EndEntity:throw new _e(we.CRYPTOGRAPHIC,"Attribute node is impossible here");case xt.DocumentType:case xt.Entity:case xt.Notation:case xt.XmlDeclaration:break}}WriteDocumentNode(e){this.state=Ks.BeforeDocElement;for(let t=e.firstChild;t!=null;t=t.nextSibling)this.WriteNode(t)}WriteCommentNode(e){this.withComments&&(this.state===Ks.AfterDocElement?this.result.push(`
|
|
105
105
|
<!--`):this.result.push("<!--"),this.result.push(this.NormalizeString(e.nodeValue,xt.Comment)),this.state===Ks.BeforeDocElement?this.result.push(`-->
|
|
106
106
|
`):this.result.push("-->"))}WriteTextNode(e){this.result.push(this.NormalizeString(e.nodeValue,e.nodeType))}WriteProcessingInstructionNode(e){let t=e.nodeName||e.tagName;t!=="xml"&&(this.state===Ks.AfterDocElement?this.result.push(`
|
|
107
107
|
<?`):this.result.push("<?"),this.result.push(t),e.nodeValue&&(this.result.push(" "),this.result.push(this.NormalizeString(e.nodeValue,xt.ProcessingInstruction))),this.state===Ks.BeforeDocElement?this.result.push(`?>
|
|
108
108
|
`):this.result.push("?>"))}WriteElementNode(e){let t=this.state;this.state===Ks.BeforeDocElement&&(this.state=Ks.InsideDocElement),this.result.push("<"),this.result.push(e.nodeName);let n=this.WriteNamespacesAxis(e);this.WriteAttributesAxis(e),this.result.push(">");for(let s=e.firstChild;s!=null;s=s.nextSibling)this.WriteNode(s);for(this.result.push("</"),this.result.push(e.nodeName),this.result.push(">"),t===Ks.BeforeDocElement&&(this.state=Ks.AfterDocElement);n--;)this.visibleNamespaces.Pop()}WriteNamespacesAxis(e){let t=[],n=0;for(let i=0;i<e.attributes.length;i++){let a=e.attributes[i];if(!J_(a)){if(a.prefix&&!this.IsNamespaceRendered(a.prefix,a.namespaceURI)){let f={prefix:a.prefix,namespace:a.namespaceURI};t.push(f),this.visibleNamespaces.Add(f),n++}continue}if(a.localName==="xmlns"&&!a.prefix&&!a.nodeValue){let f={prefix:a.prefix,namespace:a.nodeValue};t.push(f),this.visibleNamespaces.Add(f),n++}let u=null,c;(c=/xmlns:([\w.-]+)/.exec(a.nodeName))&&(u=c[1]);let l=!0;if(this.exclusive&&!this.IsNamespaceInclusive(e,u)){let f=gH(e,u);if(f>1)l=!1;else if(f===0)continue}if(!this.IsNamespaceRendered(u,a.nodeValue)&&l){let f={prefix:u,namespace:a.nodeValue};t.push(f),this.visibleNamespaces.Add(f),n++}}if(!this.IsNamespaceRendered(e.prefix,e.namespaceURI)&&e.namespaceURI!=="http://www.w3.org/2000/xmlns/"){let i={prefix:e.prefix,namespace:e.namespaceURI};t.push(i),this.visibleNamespaces.Add(i),n++}t.sort(hhe);let s=null;return t.forEach(i=>{i.prefix!==s&&(s=i.prefix,this.result.push(" xmlns"),i.prefix&&this.result.push(":"+i.prefix),this.result.push('="'),this.result.push(i.namespace||""),this.result.push('"'))}),n}WriteAttributesAxis(e){let t=[];for(let n=0;n<e.attributes.length;n++){let s=e.attributes[n];J_(s)||t.push(s)}t.sort(phe),t.forEach(n=>{n!=null&&(this.result.push(" "),this.result.push(n.nodeName),this.result.push('="'),this.result.push(this.NormalizeString(n.nodeValue,xt.Attribute)),this.result.push('"'))})}NormalizeString(e,t){let n=[];if(e)for(let s=0;s<e.length;s++){let i=e[s];i==="<"&&(t===xt.Attribute||this.IsTextNode(t))?n.push("<"):i===">"&&this.IsTextNode(t)?n.push(">"):i==="&"&&(t===xt.Attribute||this.IsTextNode(t))?n.push("&"):i==='"'&&t===xt.Attribute?n.push("""):i===" "&&t===xt.Attribute?n.push("	"):i===`
|
|
109
|
-
`&&t===xt.Attribute?n.push("
"):i==="\r"?n.push("
"):n.push(i)}return n.join("")}IsTextNode(e){switch(e){case xt.Text:case xt.CDATA:case xt.SignificantWhitespace:case xt.Whitespace:return!0}return!1}IsNamespaceInclusive(e,t){let n=t||null;return e.prefix===n?!1:this.inclusiveNamespacesPrefixList.indexOf(n||"")!==-1}IsNamespaceRendered(e,t){if(e=e||"",t=t||"",!e&&!t||e==="xml"&&t==="http://www.w3.org/XML/1998/namespace")return!0;let n=this.visibleNamespaces.GetPrefix(e);return n?n.namespace===t:!1}};function hhe(r,e){return r==e?0:r?e?r.prefix?e.prefix?r.prefix<e.prefix?-1:r.prefix>e.prefix?1:0:1:-1:1:-1}o(hhe,"XmlDsigC14NTransformNamespacesComparer");function phe(r,e){if(!r.namespaceURI&&e.namespaceURI)return-1;if(!e.namespaceURI&&r.namespaceURI)return 1;let t=(r.namespaceURI||"")+r.localName,n=(e.namespaceURI||"")+e.localName;return t===n?0:t<n?-1:1}o(phe,"XmlDsigC14NTransformAttributesComparer");function gH(r,e,t=0){let n=e||null;if(r.prefix===n)return++t;if(r.attributes)for(let s=0;s<r.attributes.length;s++){let i=r.attributes[s];if(!J_(i)&&e&&r.attributes[s].prefix===e)return++t}for(let s=r.firstChild;s;s=s.nextSibling)if(s.nodeType===xt.Element){let a=gH(s,e,t);if(s.nodeType===xt.Element&&a)return++t+a}return t}o(gH,"IsNamespaceUsed");function J_(r){let e=/xmlns:/;return!!(r!==null&&r.nodeType===xt.Attribute&&(r.nodeName==="xmlns"||e.test(r.nodeName)))}o(J_,"IsNamespaceNode");var VA=class extends mi{static{o(this,"SignatureMethodOther")}OnLoadXml(e){for(let t=0;t<e.childNodes.length;t++){let n=e.childNodes.item(t);if(n.nodeType!==xt.Element||n.nodeName===fe.ElementNames.HMACOutputLength)continue;let s;switch(n.localName){case fe.ElementNames.RSAPSSParams:s=$i;break;default:break}if(s){let i=new s;i.LoadXml(n),this.Add(i)}}}};VA=Fe([Et({localName:"Other"})],VA);var Ia=class extends Br{static{o(this,"SignatureMethod")}};Fe([wr({localName:fe.AttributeNames.Algorithm,required:!0,defaultValue:""}),Ye("design:type",String)],Ia.prototype,"Algorithm",void 0);Fe([Dt({localName:fe.ElementNames.HMACOutputLength,namespaceURI:fe.NamespaceURI,prefix:fe.DefaultPrefix,converter:Yg}),Ye("design:type",Number)],Ia.prototype,"HMACOutputLength",void 0);Fe([Dt({parser:VA,noRoot:!0,minOccurs:0}),Ye("design:type",VA)],Ia.prototype,"Any",void 0);Ia=Fe([Et({localName:fe.ElementNames.SignatureMethod})],Ia);var Mm=class extends Br{static{o(this,"CanonicalizationMethod")}};Fe([wr({localName:fe.AttributeNames.Algorithm,required:!0,defaultValue:fe.DefaultCanonMethod}),Ye("design:type",String)],Mm.prototype,"Algorithm",void 0);Mm=Fe([Et({localName:fe.ElementNames.CanonicalizationMethod})],Mm);var jm=class extends Br{static{o(this,"DataObject")}};Fe([wr({localName:fe.AttributeNames.Id,defaultValue:""}),Ye("design:type",String)],jm.prototype,"Id",void 0);Fe([wr({localName:fe.AttributeNames.MimeType,defaultValue:""}),Ye("design:type",String)],jm.prototype,"MimeType",void 0);Fe([wr({localName:fe.AttributeNames.Encoding,defaultValue:""}),Ye("design:type",String)],jm.prototype,"Encoding",void 0);jm=Fe([Et({localName:fe.ElementNames.Object})],jm);var ox=class extends mi{static{o(this,"DataObjects")}};ox=Fe([Et({localName:"xmldsig_objects",parser:jm})],ox);var zn=class extends Br{static{o(this,"Transform")}constructor(){super(...arguments),this.innerXml=null}GetOutput(){throw new _e(we.METHOD_NOT_IMPLEMENTED)}LoadInnerXml(e){if(!e)throw new _e(we.PARAM_REQUIRED,"node");this.innerXml=e}GetInnerXml(){return this.innerXml}};Fe([wr({localName:fe.AttributeNames.Algorithm,defaultValue:""}),Ye("design:type",String)],zn.prototype,"Algorithm",void 0);Fe([Dt({localName:fe.ElementNames.XPath,defaultValue:""}),Ye("design:type",String)],zn.prototype,"XPath",void 0);zn=Fe([Et({localName:fe.ElementNames.Transform})],zn);var Oo=class extends zn{static{o(this,"XmlDsigBase64Transform")}constructor(){super(...arguments),this.Algorithm=fe.AlgorithmNamespaces.XmlDsigBase64Transform}GetOutput(){if(!this.innerXml)throw new _e(we.PARAM_REQUIRED,"innerXml");return sr.FromString(this.innerXml.textContent||"","base64")}};var Da=class extends zn{static{o(this,"XmlDsigC14NTransform")}constructor(){super(...arguments),this.Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315",this.xmlCanonicalizer=new Ta(!1,!1)}GetOutput(){if(!this.innerXml)throw new _e(we.PARAM_REQUIRED,"innerXml");return this.xmlCanonicalizer.Canonicalize(this.innerXml)}},Ba=class extends Da{static{o(this,"XmlDsigC14NWithCommentsTransform")}constructor(){super(...arguments),this.Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments",this.xmlCanonicalizer=new Ta(!0,!1)}};var Po=class extends zn{static{o(this,"XmlDsigEnvelopedSignatureTransform")}constructor(){super(...arguments),this.Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"}GetOutput(){if(!this.innerXml)throw new _e(we.PARAM_REQUIRED,"innerXml");let e=this.innerXml.firstChild,t=[];for(;e;)Vs(e)&&e.localName===fe.ElementNames.Signature&&e.namespaceURI===fe.NamespaceURI&&t.push(e),e=e.nextSibling;for(let n of t)n.parentNode?.removeChild(n);return this.innerXml}};var Ra=class extends zn{static{o(this,"XmlDsigExcC14NTransform")}constructor(){super(...arguments),this.Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#",this.xmlCanonicalizer=new Ta(!1,!0)}get InclusiveNamespacesPrefixList(){return this.xmlCanonicalizer.InclusiveNamespacesPrefixList}set InclusiveNamespacesPrefixList(e){this.xmlCanonicalizer.InclusiveNamespacesPrefixList=e}LoadXml(e){if(super.LoadXml(e),this.Element&&this.Element.childNodes)for(let t=0;t<this.Element.childNodes.length;t++){let n=this.Element.childNodes[t];if(n&&n.nodeType===1)switch(n.localName){case"InclusiveNamespaces":this.setInclusiveNamespacesElement(n);break}}}GetOutput(){if(!this.innerXml)throw new _e(we.PARAM_REQUIRED,"innerXml");return this.xmlCanonicalizer.Canonicalize(this.innerXml)}setInclusiveNamespacesElement(e){let t=e.getAttribute("PrefixList");t&&t.length>0&&(this.xmlCanonicalizer.InclusiveNamespacesPrefixList=t)}},_a=class extends Ra{static{o(this,"XmlDsigExcC14NWithCommentsTransform")}constructor(){super(...arguments),this.Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#WithComments",this.xmlCanonicalizer=new Ta(!0,!0)}};function yH(r){return r.parentNode?yH(r.parentNode):r}o(yH,"lookupParentNode");var qm=class extends zn{static{o(this,"XmlDsigXPathTransform")}constructor(){super(...arguments),this.Algorithm=fe.AlgorithmNamespaces.XmlDsigXPathTransform}GetOutput(){if(!this.innerXml)throw new _e(we.PARAM_REQUIRED,"innerXml");this.Filter(yH(this.innerXml),this.XPath)}Filter(e,t){let n=e.childNodes,s=[];for(let i=0;n&&i<n.length;i++){let a=n.item(i);s.push(a)}s.forEach(i=>{this.Evaluate(i,t)?i.parentNode&&i.parentNode.removeChild(i):this.Filter(i,t)})}GetEvaluator(e){return typeof self<"u"?e.ownerDocument==null?e:e.ownerDocument:Ap("xpath")}Evaluate(e,t){try{let n=this.GetEvaluator(e),s=this.GetXml();if(!s||!s.firstChild)throw new Error("XML element or firstChild is not defined");let i=s.firstChild,a=`boolean(${t})`,u=typeof self>"u"?Ap("xpath"):self;return!n.evaluate(a,e,{lookupNamespaceURI:o(l=>i.lookupNamespaceURI(l),"lookupNamespaceURI")},u.XPathResult.ANY_TYPE,null).booleanValue}catch{return!1}}};Fe([Dt({localName:fe.ElementNames.XPath,namespaceURI:fe.NamespaceURI,prefix:fe.DefaultPrefix,required:!0}),Ye("design:type",String)],qm.prototype,"XPath",void 0);var Hm=class extends mi{static{o(this,"Transforms")}OnLoadXml(e){super.OnLoadXml(e),this.items=this.GetIterator().map(t=>{switch(t.Algorithm){case fe.AlgorithmNamespaces.XmlDsigEnvelopedSignatureTransform:return sh(t,Po);case fe.AlgorithmNamespaces.XmlDsigC14NTransform:return sh(t,Da);case fe.AlgorithmNamespaces.XmlDsigC14NWithCommentsTransform:return sh(t,Ba);case fe.AlgorithmNamespaces.XmlDsigExcC14NTransform:return sh(t,Ra);case fe.AlgorithmNamespaces.XmlDsigExcC14NWithCommentsTransform:return sh(t,_a);case fe.AlgorithmNamespaces.XmlDsigBase64Transform:return sh(t,Oo);case fe.AlgorithmNamespaces.XmlDsigXPathTransform:return sh(t,qm);default:try{let n=ux.CreateFromName(t.Algorithm);if(!t.Element)throw new Error("Transform element is not defined");return n.LoadXml(t.Element),n}catch{throw new _e(we.CRYPTOGRAPHIC_UNKNOWN_TRANSFORM,t.Algorithm)}}})}};Hm=Fe([Et({localName:fe.ElementNames.Transforms,parser:zn})],Hm);function sh(r,e){let t=new e;if(!r.Element)throw new Error("Transform element is not defined");return t.LoadXml(r.Element),t}o(sh,"ChangeTransform");var Oa=class extends Br{static{o(this,"Reference")}constructor(e){super(),this.DigestMethod=new gi,e&&(this.Uri=e)}};Fe([wr({defaultValue:""}),Ye("design:type",String)],Oa.prototype,"Id",void 0);Fe([wr({localName:fe.AttributeNames.URI}),Ye("design:type",String)],Oa.prototype,"Uri",void 0);Fe([wr({localName:fe.AttributeNames.Type,defaultValue:""}),Ye("design:type",String)],Oa.prototype,"Type",void 0);Fe([Dt({parser:Hm}),Ye("design:type",Hm)],Oa.prototype,"Transforms",void 0);Fe([Dt({required:!0,parser:gi}),Ye("design:type",gi)],Oa.prototype,"DigestMethod",void 0);Fe([Dt({required:!0,localName:fe.ElementNames.DigestValue,namespaceURI:fe.NamespaceURI,prefix:fe.DefaultPrefix,converter:oi}),Ye("design:type",Uint8Array)],Oa.prototype,"DigestValue",void 0);Oa=Fe([Et({localName:fe.ElementNames.Reference}),Ye("design:paramtypes",[String])],Oa);var Km=class extends mi{static{o(this,"References")}};Km=Fe([Et({localName:"References",parser:Oa})],Km);var ko=class extends Br{static{o(this,"SignedInfo")}};Fe([wr({localName:fe.AttributeNames.Id,defaultValue:""}),Ye("design:type",String)],ko.prototype,"Id",void 0);Fe([Dt({parser:Mm,required:!0}),Ye("design:type",Mm)],ko.prototype,"CanonicalizationMethod",void 0);Fe([Dt({parser:Ia,required:!0}),Ye("design:type",Ia)],ko.prototype,"SignatureMethod",void 0);Fe([Dt({parser:Km,minOccurs:1,noRoot:!0}),Ye("design:type",Km)],ko.prototype,"References",void 0);ko=Fe([Et({localName:fe.ElementNames.SignedInfo})],ko);var zm="http://www.w3.org/2001/04/xmldsig-more#",Wm="ecdsa",ih=class extends ws{static{o(this,"EcdsaPublicKey")}};Fe([Dt({localName:fe.ElementNames.X,namespaceURI:zm,prefix:Wm,required:!0,converter:oi}),Ye("design:type",Uint8Array)],ih.prototype,"X",void 0);Fe([Dt({localName:fe.ElementNames.Y,namespaceURI:zm,prefix:Wm,required:!0,converter:oi}),Ye("design:type",Uint8Array)],ih.prototype,"Y",void 0);ih=Fe([Et({localName:fe.ElementNames.PublicKey,namespaceURI:zm,prefix:Wm})],ih);var $m=class extends ws{static{o(this,"NamedCurve")}};Fe([wr({localName:fe.AttributeNames.URI,required:!0}),Ye("design:type",String)],$m.prototype,"Uri",void 0);$m=Fe([Et({localName:fe.ElementNames.NamedCurve,namespaceURI:zm,prefix:Wm})],$m);var Xm=class extends ws{static{o(this,"DomainParameters")}};Fe([Dt({parser:$m}),Ye("design:type",$m)],Xm.prototype,"NamedCurve",void 0);Xm=Fe([Et({localName:fe.ElementNames.DomainParameters,namespaceURI:zm,prefix:Wm})],Xm);var Gm=class extends Hs{static{o(this,"EcdsaKeyValue")}constructor(){super(...arguments),this.name=fe.ElementNames.ECDSAKeyValue,this.key=null,this.jwk=null,this.keyUsage=null}static canImportCryptoKey(e){return e.algorithm.name.toUpperCase()===Ro.toUpperCase()}get NamedCurve(){return xH(this.DomainParameters.NamedCurve.Uri)}async importKey(e){if(!e.algorithm.name||e.algorithm.name.toUpperCase()!=="ECDSA")throw new _e(we.ALGORITHM_WRONG_NAME,e.algorithm.name);let t=await rn.crypto.subtle.exportKey("jwk",e);return this.key=e,this.jwk=t,this.PublicKey=new ih,this.PublicKey.X=sr.FromString(t.x||"","base64url"),this.PublicKey.Y=sr.FromString(t.y||"","base64url"),this.DomainParameters||(this.DomainParameters=new Xm),this.DomainParameters.NamedCurve||(this.DomainParameters.NamedCurve=new $m),this.DomainParameters.NamedCurve.Uri=xH(t.crv||""),this.keyUsage=e.usages,this}async exportKey(e){if(this.key)return this.key;let t=sr.ToBase64Url(this.PublicKey.X),n=sr.ToBase64Url(this.PublicKey.Y),s=dhe(this.DomainParameters.NamedCurve.Uri),i={kty:"EC",crv:s,x:t,y:n,ext:!0};this.keyUsage=["verify"];let a=await rn.crypto.subtle.importKey("jwk",i,{name:"ECDSA",namedCurve:s},!0,this.keyUsage);return this.key=a,this.key}};Fe([Dt({parser:Xm}),Ye("design:type",Xm)],Gm.prototype,"DomainParameters",void 0);Fe([Dt({parser:ih,required:!0}),Ye("design:type",ih)],Gm.prototype,"PublicKey",void 0);Gm=Fe([Et({localName:fe.ElementNames.ECDSAKeyValue,namespaceURI:zm,prefix:Wm})],Gm);function xH(r){switch(r){case"P-256":return"urn:oid:1.2.840.10045.3.1.7";case"P-384":return"urn:oid:1.3.132.0.34";case"P-521":return"urn:oid:1.3.132.0.35"}throw new _e(we.CRYPTOGRAPHIC,"Unknown NamedCurve")}o(xH,"GetNamedCurveOid");function dhe(r){switch(r){case"urn:oid:1.2.840.10045.3.1.7":return"P-256";case"urn:oid:1.3.132.0.34":return"P-384";case"urn:oid:1.3.132.0.35":return"P-521"}throw new _e(we.CRYPTOGRAPHIC,"Unknown NamedCurve OID")}o(dhe,"GetNamedCurveFromOid");var mhe=class extends Map{static{o(this,"KeyInfoClauseRegistry")}},kc=new mhe;kc.set(fe.ElementNames.RSAKeyValue,Fm);kc.set(fe.ElementNames.ECDSAKeyValue,Gm);var MA=class{static{o(this,"KeyInfoClauseFactory")}static create(e){let t=kc.get(e);if(!t)throw new _e(we.KEY_INFO_CLAUSE_NOT_SUPPORTED,e);return new t}};var cx=class extends Hs{static{o(this,"KeyValue")}set Value(e){this.element=null,this.value=e}get Value(){return this.value}constructor(e){super(),e&&(this.Value=e)}async importKey(e){for(let[,t]of kc)if(t.canImportCryptoKey(e)){let n=new t;return await n.importKey(e),this.Value=n,this}throw new _e(we.ALGORITHM_NOT_SUPPORTED,e.algorithm.name)}async exportKey(e){if(!this.Value)throw new _e(we.NULL_REFERENCE);return this.Value.exportKey(e)}OnGetXml(e){if(!this.Value)throw new _e(we.CRYPTOGRAPHIC,"KeyValue has empty value");let t=this.Value.GetXml();t&&e.appendChild(t)}OnLoadXml(e){for(let t=0;t<e.childNodes.length;t++){let n=e.childNodes.item(t);if(Vs(n))try{let s=n.localName,i=MA.create(s);i.LoadXml(n),this.value=i;return}catch{}}throw new _e(we.CRYPTOGRAPHIC,"Unsupported KeyValue in use")}};cx=Fe([Et({localName:fe.ElementNames.KeyValue}),Ye("design:paramtypes",[Hs])],cx);var ghe={"2.5.4.3":{short:"CN",long:"CommonName"},"2.5.4.6":{short:"C",long:"Country"},"2.5.4.5":{long:"DeviceSerialNumber"},"0.9.2342.19200300.100.1.25":{short:"DC",long:"DomainComponent"},"1.2.840.113549.1.9.1":{short:"E",long:"EMail"},"2.5.4.42":{short:"G",long:"GivenName"},"2.5.4.43":{short:"I",long:"Initials"},"2.5.4.7":{short:"L",long:"Locality"},"2.5.4.10":{short:"O",long:"Organization"},"2.5.4.11":{short:"OU",long:"OrganizationUnit"},"2.5.4.8":{short:"ST",long:"State"},"2.5.4.9":{short:"Street",long:"StreetAddress"},"2.5.4.4":{short:"SN",long:"SurName"},"2.5.4.12":{short:"T",long:"Title"},"1.2.840.113549.1.9.8":{long:"UnstructuredAddress"},"1.2.840.113549.1.9.2":{long:"UnstructuredName"}},Jm=class{static{o(this,"X509Certificate")}constructor(e){if(this.publicKey=null,e){let t=new Uint8Array(e);this.LoadRaw(t),this.raw=t}}get SerialNumber(){return this.simpl.serialNumber.valueBlock.toString()}get Issuer(){return this.NameToString(this.simpl.issuer)}get Subject(){return this.NameToString(this.simpl.subject)}async Thumbprint(e="SHA-1"){return rn.crypto.subtle.digest(e,this.raw)}get PublicKey(){return this.publicKey}GetRaw(){return this.raw}async exportKey(e){if(e){let t={algorithm:e,usages:["verify"]};if(t.algorithm.name.toUpperCase()===Ro){let s=this.simpl.subjectPublicKeyInfo.toJSON();if("crv"in s&&s.crv)t.algorithm.namedCurve=s.crv;else throw new Error("Cannot get Curved name from the ECDSA public key")}this.isHashedAlgorithm(t.algorithm)&&typeof t.algorithm.hash=="string"&&(t.algorithm.hash={name:t.algorithm.hash});let n=await this.simpl.getPublicKey({algorithm:t});return this.publicKey=n,n}return this.simpl.subjectPublicKeyInfo.algorithm.algorithmId==="1.2.840.113549.1.1.1"?this.publicKey=await this.simpl.getPublicKey({algorithm:{algorithm:{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},usages:["verify"]}}):this.publicKey=await this.simpl.getPublicKey(),this.publicKey}NameToString(e,t=","){let n=[];return e.typesAndValues.forEach(s=>{let i=s.type,a=ghe[i.toString()],u=a?a.short:null;n.push(`${u||i}=${s.value.valueBlock.value}`)}),n.join(t+" ")}LoadRaw(e){this.raw=new Uint8Array(e);let t=Or(this.raw.buffer);this.simpl=new Gn({schema:t.result})}isHashedAlgorithm(e){return!!e.hash}};var jA=class extends Br{static{o(this,"X509IssuerSerial")}};Fe([Dt({localName:fe.ElementNames.X509IssuerName,namespaceURI:fe.NamespaceURI,prefix:fe.DefaultPrefix,required:!0}),Ye("design:type",String)],jA.prototype,"X509IssuerName",void 0);Fe([Dt({localName:fe.ElementNames.X509SerialNumber,namespaceURI:fe.NamespaceURI,prefix:fe.DefaultPrefix,required:!0}),Ye("design:type",String)],jA.prototype,"X509SerialNumber",void 0);jA=Fe([Et({localName:fe.ElementNames.X509IssuerSerial})],jA);var ah;(function(r){r[r.None=0]="None",r[r.EndCertOnly=1]="EndCertOnly",r[r.ExcludeRoot=2]="ExcludeRoot",r[r.WholeChain=3]="WholeChain"})(ah||(ah={}));var Ym=class extends Hs{static{o(this,"KeyInfoX509Data")}constructor(e,t=ah.None){if(super(),this.x509crl=null,this.SubjectKeyIdList=[],e){if(e instanceof Uint8Array)this.AddCertificate(new Jm(e));else if(e instanceof Jm)switch(t){case ah.None:case ah.EndCertOnly:this.AddCertificate(e);break;case ah.ExcludeRoot:this.AddCertificatesChainFrom(e,!1);break;case ah.WholeChain:this.AddCertificatesChainFrom(e,!0);break}}}async importKey(e){throw new _e(we.METHOD_NOT_SUPPORTED)}async exportKey(e){if(!this.Certificates.length)throw new _e(we.NULL_REFERENCE);return this.Key=await this.Certificates[0].exportKey(e),this.Key}get Certificates(){return this.X509CertificateList}get CRL(){return this.x509crl}set CRL(e){this.x509crl=e}get IssuerSerials(){return this.IssuerSerialList}get SubjectKeyIds(){return this.SubjectKeyIdList}get SubjectNames(){return this.SubjectNameList}AddCertificate(e){if(!e)throw new _e(we.PARAM_REQUIRED,"certificate");this.X509CertificateList||(this.X509CertificateList=[]),this.X509CertificateList.push(e)}AddIssuerSerial(e,t){if(e==null)throw new _e(we.PARAM_REQUIRED,"issuerName");this.IssuerSerialList==null&&(this.IssuerSerialList=[]);let n={issuerName:e,serialNumber:t};this.IssuerSerialList.push(n)}AddSubjectKeyId(e){if(this.SubjectKeyIdList&&(this.SubjectKeyIdList=[]),typeof e=="string"){if(e!=null){let t=sr.FromBase64(e);this.SubjectKeyIdList.push(t)}}else this.SubjectKeyIdList.push(e)}AddSubjectName(e){this.SubjectNameList==null&&(this.SubjectNameList=[]),this.SubjectNameList.push(e)}GetXml(){let e=this.CreateDocument(),t=this.CreateElement(e),n=this.GetPrefix();if(this.IssuerSerialList!=null&&this.IssuerSerialList.length>0&&this.IssuerSerialList.forEach(s=>{let i=e.createElementNS(fe.NamespaceURI,n+fe.ElementNames.X509IssuerSerial),a=e.createElementNS(fe.NamespaceURI,n+fe.ElementNames.X509IssuerName);a.textContent=s.issuerName,i.appendChild(a);let u=e.createElementNS(fe.NamespaceURI,n+fe.ElementNames.X509SerialNumber);u.textContent=s.serialNumber,i.appendChild(u),t.appendChild(i)}),this.SubjectKeyIdList!=null&&this.SubjectKeyIdList.length>0&&this.SubjectKeyIdList.forEach(s=>{let i=e.createElementNS(fe.NamespaceURI,n+fe.ElementNames.X509SKI);i.textContent=sr.ToBase64(s),t.appendChild(i)}),this.SubjectNameList!=null&&this.SubjectNameList.length>0&&this.SubjectNameList.forEach(s=>{let i=e.createElementNS(fe.NamespaceURI,n+fe.ElementNames.X509SubjectName);i.textContent=s,t.appendChild(i)}),this.X509CertificateList!=null&&this.X509CertificateList.length>0&&this.X509CertificateList.forEach(s=>{let i=e.createElementNS(fe.NamespaceURI,n+fe.ElementNames.X509Certificate);i.textContent=sr.ToBase64(s.GetRaw()),t.appendChild(i)}),this.x509crl!=null){let s=e.createElementNS(fe.NamespaceURI,n+fe.ElementNames.X509CRL);s.textContent=sr.ToBase64(this.x509crl),t.appendChild(s)}return t}LoadXml(e){super.LoadXml(e),this.IssuerSerialList&&(this.IssuerSerialList=[]),this.SubjectKeyIdList&&(this.SubjectKeyIdList=[]),this.SubjectNameList&&(this.SubjectNameList=[]),this.X509CertificateList&&(this.X509CertificateList=[]),this.x509crl=null;let t=this.GetChildren(fe.ElementNames.X509IssuerSerial);t&&t.forEach(s=>{let i=Br.GetChild(s,fe.ElementNames.X509IssuerName,fe.NamespaceURI,!0),a=Br.GetChild(s,fe.ElementNames.X509SerialNumber,fe.NamespaceURI,!0);i&&i.textContent&&a&&a.textContent&&this.AddIssuerSerial(i.textContent,a.textContent)}),t=this.GetChildren(fe.ElementNames.X509SKI),t&&t.forEach(s=>{if(s.textContent){let i=sr.FromBase64(s.textContent);this.AddSubjectKeyId(i)}}),t=this.GetChildren(fe.ElementNames.X509SubjectName),t?.forEach(s=>{s.textContent&&this.AddSubjectName(s.textContent)}),t=this.GetChildren(fe.ElementNames.X509Certificate),t&&t.forEach(s=>{if(s.textContent){let i=sr.FromBase64(s.textContent);this.AddCertificate(new Jm(i))}});let n=this.GetChild(fe.ElementNames.X509CRL,!1);n&&n.textContent&&(this.x509crl=sr.FromBase64(n.textContent))}AddCertificatesChainFrom(e,t){}};Ym=Fe([Et({localName:fe.ElementNames.X509Data}),Ye("design:paramtypes",[Object,Object])],Ym);var lx=class extends Hs{static{o(this,"SPKIData")}async importKey(e){let t=await rn.crypto.subtle.exportKey("spki",e);return this.SPKIexp=new Uint8Array(t),this.Key=e,this}async exportKey(e){if(!this.SPKIexp)throw new Error("SPKI data is not defined");let t=await rn.crypto.subtle.importKey("spki",this.SPKIexp,e,!0,["verify"]);return this.Key=t,t}};Fe([Dt({localName:fe.ElementNames.SPKIexp,namespaceURI:fe.NamespaceURI,prefix:fe.DefaultPrefix,required:!0,converter:oi}),Ye("design:type",Object)],lx.prototype,"SPKIexp",void 0);lx=Fe([Et({localName:fe.ElementNames.SPKIData})],lx);var oh=class extends mi{static{o(this,"KeyInfo")}OnLoadXml(e){for(let t=0;t<e.childNodes.length;t++){let n=e.childNodes.item(t);if(n.nodeType!==xt.Element)continue;let s=null;switch(n.localName){case fe.ElementNames.KeyValue:s=cx;break;case fe.ElementNames.X509Data:s=Ym;break;case fe.ElementNames.SPKIData:s=lx;break;case fe.ElementNames.KeyName:case fe.ElementNames.RetrievalMethod:case fe.ElementNames.PGPData:case fe.ElementNames.MgmtData:}if(s){let i=new s;i.LoadXml(n),this.Add(i)}}}};Fe([wr({localName:fe.AttributeNames.Id,defaultValue:""}),Ye("design:type",String)],oh.prototype,"Id",void 0);oh=Fe([Et({localName:fe.ElementNames.KeyInfo})],oh);var Lc=class extends Br{static{o(this,"Signature")}};Fe([wr({localName:fe.AttributeNames.Id,defaultValue:""}),Ye("design:type",String)],Lc.prototype,"Id",void 0);Fe([Dt({parser:ko,required:!0}),Ye("design:type",ko)],Lc.prototype,"SignedInfo",void 0);Fe([Dt({localName:fe.ElementNames.SignatureValue,namespaceURI:fe.NamespaceURI,prefix:fe.DefaultPrefix,required:!0,converter:oi,defaultValue:null}),Ye("design:type",Object)],Lc.prototype,"SignatureValue",void 0);Fe([Dt({parser:oh}),Ye("design:type",oh)],Lc.prototype,"KeyInfo",void 0);Fe([Dt({parser:ox,noRoot:!0}),Ye("design:type",ox)],Lc.prototype,"ObjectList",void 0);Lc=Fe([Et({localName:fe.ElementNames.Signature})],Lc);var vhe=class extends Map{static{o(this,"AlgorithmRegistry")}},Lt=new vhe;Lt.set(DA,{type:"signature",algorithm:Om});Lt.set(BA,{type:"signature",algorithm:Pm});Lt.set(RA,{type:"signature",algorithm:km});Lt.set(_A,{type:"signature",algorithm:Lm});Lt.set(DA,{type:"signature",algorithm:Om});Lt.set(BA,{type:"signature",algorithm:Pm});Lt.set(RA,{type:"signature",algorithm:km});Lt.set(_A,{type:"signature",algorithm:Lm});Lt.set($_,{type:"signature",algorithm:PA});Lt.set(X_,{type:"signature",algorithm:kA});Lt.set(G_,{type:"signature",algorithm:LA});Lt.set(z_,{type:"signature",algorithm:FA});Lt.set(W_,{type:"signature",algorithm:UA});Lt.set(SA,{type:"signature",algorithm:Im});Lt.set(AA,{type:"signature",algorithm:Dm});Lt.set(CA,{type:"signature",algorithm:Bm});Lt.set(NA,{type:"signature",algorithm:Rm});Lt.set(SA.toUpperCase(),{type:"signature",algorithm:Im});Lt.set(AA.toUpperCase(),{type:"signature",algorithm:Dm});Lt.set(CA.toUpperCase(),{type:"signature",algorithm:Bm});Lt.set(NA.toUpperCase(),{type:"signature",algorithm:Rm});Lt.set(V_,{type:"signature",algorithm:nx});Lt.set(M_,{type:"signature",algorithm:sx});Lt.set(j_,{type:"signature",algorithm:ix});Lt.set(q_,{type:"signature",algorithm:ax});Lt.set(Am,{type:"hash",algorithm:EA});Lt.set(Cm,{type:"hash",algorithm:rx});Lt.set(Nm,{type:"hash",algorithm:wA});Lt.set(Tm,{type:"hash",algorithm:bA});var uh=class{static{o(this,"AlgorithmFactory")}static createHashAlgorithmFromNamespace(e){for(let[t,{type:n,algorithm:s}]of Lt)if(n==="hash"&&t===e)return new s;throw new _e(we.ALGORITHM_NOT_SUPPORTED,e)}static createSignatureAlgorithmFromMethod(e){for(let[t,{type:n,algorithm:s}]of Lt)if(n==="signature"&&e.Algorithm===t){let i=new s;return i.fromMethod&&i.fromMethod(e),i}throw new _e(we.ALGORITHM_NOT_SUPPORTED,e.Algorithm)}static createHashAlgorithmFromAlgorithm(e){for(let[,{type:t,algorithm:n}]of Lt)if(t==="hash"){let s=new n;if(s.algorithm.name.toUpperCase()===e.name.toUpperCase())return s}throw new _e(we.ALGORITHM_NOT_SUPPORTED,e.name)}static createSignatureAlgorithmFromAlgorithm(e){for(let[,{type:t,algorithm:n}]of Lt)if(t==="signature"){let s=n.fromAlgorithm(e);if(s)return s}throw new _e(we.ALGORITHM_NOT_SUPPORTED,e.name)}};var xhe=class extends Map{static{o(this,"TransformRegistry")}},Lo=new xhe;Lo.set(fe.AlgorithmNamespaces.XmlDsigBase64Transform,Oo);Lo.set(fe.AlgorithmNamespaces.XmlDsigC14NTransform,Da);Lo.set(fe.AlgorithmNamespaces.XmlDsigC14NWithCommentsTransform,Ba);Lo.set(fe.AlgorithmNamespaces.XmlDsigEnvelopedSignatureTransform,Po);Lo.set(fe.AlgorithmNamespaces.XmlDsigExcC14NTransform,Ra);Lo.set(fe.AlgorithmNamespaces.XmlDsigExcC14NWithCommentsTransform,_a);var ux=class{static{o(this,"CryptoConfig")}static CreateFromName(e){if(!e)throw new _e(we.PARAM_REQUIRED,"name");let t=Lo.get(e);if(t)return new t;let n;switch(e){case fe.AlgorithmNamespaces.XmlDsigBase64Transform:n=new Oo;break;case fe.AlgorithmNamespaces.XmlDsigC14NTransform:n=new Da;break;case fe.AlgorithmNamespaces.XmlDsigC14NWithCommentsTransform:n=new Ba;break;case fe.AlgorithmNamespaces.XmlDsigEnvelopedSignatureTransform:n=new Po;break;case fe.AlgorithmNamespaces.XmlDsigXPathTransform:throw new _e(we.ALGORITHM_NOT_SUPPORTED,e);case fe.AlgorithmNamespaces.XmlDsigXsltTransform:throw new _e(we.ALGORITHM_NOT_SUPPORTED,e);case fe.AlgorithmNamespaces.XmlDsigExcC14NTransform:n=new Ra;break;case fe.AlgorithmNamespaces.XmlDsigExcC14NWithCommentsTransform:n=new _a;break;case fe.AlgorithmNamespaces.XmlDecryptionTransform:throw new _e(we.ALGORITHM_NOT_SUPPORTED,e);default:throw new _e(we.ALGORITHM_NOT_SUPPORTED,e)}return n}static CreateSignatureAlgorithm(e){return uh.createSignatureAlgorithmFromMethod(e)}static CreateHashAlgorithm(e){return uh.createHashAlgorithmFromNamespace(e)}static GetHashAlgorithm(e){let t=typeof e=="string"?{name:e}:e;return uh.createHashAlgorithmFromAlgorithm(t)}static GetSignatureAlgorithm(e){let t=typeof e=="string"?{name:e}:e;return"hash"in t&&typeof t.hash=="string"&&(t.hash={name:t.hash}),uh.createSignatureAlgorithmFromAlgorithm(t)}static CreateSignatureMethod(e){let t=new Ia;return t.Algorithm=e.namespaceURI,e.toMethod&&e.toMethod(t),t}static RegisterSignatureAlgorithm(e,t){Lt.set(e,{type:"signature",algorithm:t})}static RegisterHashAlgorithm(e,t){Lt.set(e,{type:"hash",algorithm:t})}static RegisterKeyInfoClause(e,t){kc.set(e,t)}static RegisterTransform(e,t){Lo.set(e,t)}};var ph=Rt(IK(),1);var DK={xmldec:{version:"1.0",encoding:"UTF-8",standalone:void 0}};var BK={explicitArray:!1,explicitRoot:!1,preserveChildrenOrder:!0};var gO=class{static{o(this,"Xml2JsToolkit")}xml2js;constructor(e=hde){this.xml2js=e,U9({XMLSerializer:ph.default.XMLSerializer,DOMParser:ph.default.DOMParser,DOMImplementation:ph.default.DOMImplementation})}async validate(e,t){if(!e||e.trim().length===0)return or(new Mt("Please provide a valid xml content"));if(!t||t.trim().length===0)return or(new Mt("Please provide a valid existing xsd path"));try{return await lj.validate(e,t),Qr()}catch(n){return us(n)}}parse(e,t){return new Promise((n,s)=>new this.xml2js.Parser({...BK,...t}).parseString(e,(i,a)=>i?s(i):n(a)))}build(e,t){return Promise.resolve(new this.xml2js.Builder({...DK,...t}).buildObject(e))}digest(e,t,n=E0){return this.hash(this.canonicalize(e,n),t)}canonicalize(e,t=E0){let n=new ph.default.DOMParser().parseFromString(this.clear(e),"application/xml");return new Ta(t.includeComments,t.exclusive).Canonicalize(n)}getNode(e,t){let n=this.parseXml(e),i=this.getDocumentElement(n).getElementsByTagName(t).item(0);return i?this.clear(this.serializeXml(i)):null}getFirstNode(e){let t=this.parseXml(e),s=this.getDocumentElement(t).firstChild;return s?this.clear(this.serializeXml(s)):null}getAttribute(e,t){let n=this.parseXml(e);return this.getDocumentElement(n).getAttribute(t)}appendNode(e,t){let n=this.parseXml(e),s=this.getDocumentElement(n),i=this.getDocumentElement(this.parseXml(t));return s.appendChild(i),this.clear(this.serializeXml(n))}insertBefore(e,t,n){let s=this.parseXml(e),a=this.getDocumentElement(s).getElementsByTagName(t).item(0);if(!a?.parentNode)throw new Mt(`No element found with tag "${t}" to insert before`);let u=this.getDocumentElement(this.parseXml(n));return a.parentNode.insertBefore(u,a),this.clear(this.serializeXml(s))}hash(e,t){return RK.default.createHash(t).update(e,"utf8").digest().toString("base64")}parseXml(e){return new ph.default.DOMParser().parseFromString(e,"application/xml")}getDocumentElement(e){if(!e.documentElement)throw new Mt("Invalid xml provided. Missing root element.");return e.documentElement}serializeXml(e){return new ph.default.XMLSerializer().serializeToString(e)}clear(e){return['xmlns:default="http://www.w3.org/2000/09/xmldsig#"',' standalone="no"',"default:",":default",`
|
|
109
|
+
`&&t===xt.Attribute?n.push("
"):i==="\r"?n.push("
"):n.push(i)}return n.join("")}IsTextNode(e){switch(e){case xt.Text:case xt.CDATA:case xt.SignificantWhitespace:case xt.Whitespace:return!0}return!1}IsNamespaceInclusive(e,t){let n=t||null;return e.prefix===n?!1:this.inclusiveNamespacesPrefixList.indexOf(n||"")!==-1}IsNamespaceRendered(e,t){if(e=e||"",t=t||"",!e&&!t||e==="xml"&&t==="http://www.w3.org/XML/1998/namespace")return!0;let n=this.visibleNamespaces.GetPrefix(e);return n?n.namespace===t:!1}};function hhe(r,e){return r==e?0:r?e?r.prefix?e.prefix?r.prefix<e.prefix?-1:r.prefix>e.prefix?1:0:1:-1:1:-1}o(hhe,"XmlDsigC14NTransformNamespacesComparer");function phe(r,e){if(!r.namespaceURI&&e.namespaceURI)return-1;if(!e.namespaceURI&&r.namespaceURI)return 1;let t=(r.namespaceURI||"")+r.localName,n=(e.namespaceURI||"")+e.localName;return t===n?0:t<n?-1:1}o(phe,"XmlDsigC14NTransformAttributesComparer");function gH(r,e,t=0){let n=e||null;if(r.prefix===n)return++t;if(r.attributes)for(let s=0;s<r.attributes.length;s++){let i=r.attributes[s];if(!J_(i)&&e&&r.attributes[s].prefix===e)return++t}for(let s=r.firstChild;s;s=s.nextSibling)if(s.nodeType===xt.Element){let a=gH(s,e,t);if(s.nodeType===xt.Element&&a)return++t+a}return t}o(gH,"IsNamespaceUsed");function J_(r){let e=/xmlns:/;return!!(r!==null&&r.nodeType===xt.Attribute&&(r.nodeName==="xmlns"||e.test(r.nodeName)))}o(J_,"IsNamespaceNode");var VA=class extends mi{static{o(this,"SignatureMethodOther")}OnLoadXml(e){for(let t=0;t<e.childNodes.length;t++){let n=e.childNodes.item(t);if(n.nodeType!==xt.Element||n.nodeName===fe.ElementNames.HMACOutputLength)continue;let s;switch(n.localName){case fe.ElementNames.RSAPSSParams:s=$i;break;default:break}if(s){let i=new s;i.LoadXml(n),this.Add(i)}}}};VA=Fe([Et({localName:"Other"})],VA);var Ia=class extends Br{static{o(this,"SignatureMethod")}};Fe([wr({localName:fe.AttributeNames.Algorithm,required:!0,defaultValue:""}),Ye("design:type",String)],Ia.prototype,"Algorithm",void 0);Fe([Dt({localName:fe.ElementNames.HMACOutputLength,namespaceURI:fe.NamespaceURI,prefix:fe.DefaultPrefix,converter:Yg}),Ye("design:type",Number)],Ia.prototype,"HMACOutputLength",void 0);Fe([Dt({parser:VA,noRoot:!0,minOccurs:0}),Ye("design:type",VA)],Ia.prototype,"Any",void 0);Ia=Fe([Et({localName:fe.ElementNames.SignatureMethod})],Ia);var Mm=class extends Br{static{o(this,"CanonicalizationMethod")}};Fe([wr({localName:fe.AttributeNames.Algorithm,required:!0,defaultValue:fe.DefaultCanonMethod}),Ye("design:type",String)],Mm.prototype,"Algorithm",void 0);Mm=Fe([Et({localName:fe.ElementNames.CanonicalizationMethod})],Mm);var jm=class extends Br{static{o(this,"DataObject")}};Fe([wr({localName:fe.AttributeNames.Id,defaultValue:""}),Ye("design:type",String)],jm.prototype,"Id",void 0);Fe([wr({localName:fe.AttributeNames.MimeType,defaultValue:""}),Ye("design:type",String)],jm.prototype,"MimeType",void 0);Fe([wr({localName:fe.AttributeNames.Encoding,defaultValue:""}),Ye("design:type",String)],jm.prototype,"Encoding",void 0);jm=Fe([Et({localName:fe.ElementNames.Object})],jm);var ox=class extends mi{static{o(this,"DataObjects")}};ox=Fe([Et({localName:"xmldsig_objects",parser:jm})],ox);var zn=class extends Br{static{o(this,"Transform")}constructor(){super(...arguments),this.innerXml=null}GetOutput(){throw new _e(we.METHOD_NOT_IMPLEMENTED)}LoadInnerXml(e){if(!e)throw new _e(we.PARAM_REQUIRED,"node");this.innerXml=e}GetInnerXml(){return this.innerXml}};Fe([wr({localName:fe.AttributeNames.Algorithm,defaultValue:""}),Ye("design:type",String)],zn.prototype,"Algorithm",void 0);Fe([Dt({localName:fe.ElementNames.XPath,defaultValue:""}),Ye("design:type",String)],zn.prototype,"XPath",void 0);zn=Fe([Et({localName:fe.ElementNames.Transform})],zn);var Oo=class extends zn{static{o(this,"XmlDsigBase64Transform")}constructor(){super(...arguments),this.Algorithm=fe.AlgorithmNamespaces.XmlDsigBase64Transform}GetOutput(){if(!this.innerXml)throw new _e(we.PARAM_REQUIRED,"innerXml");return ir.FromString(this.innerXml.textContent||"","base64")}};var Da=class extends zn{static{o(this,"XmlDsigC14NTransform")}constructor(){super(...arguments),this.Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315",this.xmlCanonicalizer=new Ta(!1,!1)}GetOutput(){if(!this.innerXml)throw new _e(we.PARAM_REQUIRED,"innerXml");return this.xmlCanonicalizer.Canonicalize(this.innerXml)}},Ba=class extends Da{static{o(this,"XmlDsigC14NWithCommentsTransform")}constructor(){super(...arguments),this.Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments",this.xmlCanonicalizer=new Ta(!0,!1)}};var Po=class extends zn{static{o(this,"XmlDsigEnvelopedSignatureTransform")}constructor(){super(...arguments),this.Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"}GetOutput(){if(!this.innerXml)throw new _e(we.PARAM_REQUIRED,"innerXml");let e=this.innerXml.firstChild,t=[];for(;e;)Vs(e)&&e.localName===fe.ElementNames.Signature&&e.namespaceURI===fe.NamespaceURI&&t.push(e),e=e.nextSibling;for(let n of t)n.parentNode?.removeChild(n);return this.innerXml}};var Ra=class extends zn{static{o(this,"XmlDsigExcC14NTransform")}constructor(){super(...arguments),this.Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#",this.xmlCanonicalizer=new Ta(!1,!0)}get InclusiveNamespacesPrefixList(){return this.xmlCanonicalizer.InclusiveNamespacesPrefixList}set InclusiveNamespacesPrefixList(e){this.xmlCanonicalizer.InclusiveNamespacesPrefixList=e}LoadXml(e){if(super.LoadXml(e),this.Element&&this.Element.childNodes)for(let t=0;t<this.Element.childNodes.length;t++){let n=this.Element.childNodes[t];if(n&&n.nodeType===1)switch(n.localName){case"InclusiveNamespaces":this.setInclusiveNamespacesElement(n);break}}}GetOutput(){if(!this.innerXml)throw new _e(we.PARAM_REQUIRED,"innerXml");return this.xmlCanonicalizer.Canonicalize(this.innerXml)}setInclusiveNamespacesElement(e){let t=e.getAttribute("PrefixList");t&&t.length>0&&(this.xmlCanonicalizer.InclusiveNamespacesPrefixList=t)}},_a=class extends Ra{static{o(this,"XmlDsigExcC14NWithCommentsTransform")}constructor(){super(...arguments),this.Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#WithComments",this.xmlCanonicalizer=new Ta(!0,!0)}};function yH(r){return r.parentNode?yH(r.parentNode):r}o(yH,"lookupParentNode");var qm=class extends zn{static{o(this,"XmlDsigXPathTransform")}constructor(){super(...arguments),this.Algorithm=fe.AlgorithmNamespaces.XmlDsigXPathTransform}GetOutput(){if(!this.innerXml)throw new _e(we.PARAM_REQUIRED,"innerXml");this.Filter(yH(this.innerXml),this.XPath)}Filter(e,t){let n=e.childNodes,s=[];for(let i=0;n&&i<n.length;i++){let a=n.item(i);s.push(a)}s.forEach(i=>{this.Evaluate(i,t)?i.parentNode&&i.parentNode.removeChild(i):this.Filter(i,t)})}GetEvaluator(e){return typeof self<"u"?e.ownerDocument==null?e:e.ownerDocument:Ap("xpath")}Evaluate(e,t){try{let n=this.GetEvaluator(e),s=this.GetXml();if(!s||!s.firstChild)throw new Error("XML element or firstChild is not defined");let i=s.firstChild,a=`boolean(${t})`,u=typeof self>"u"?Ap("xpath"):self;return!n.evaluate(a,e,{lookupNamespaceURI:o(l=>i.lookupNamespaceURI(l),"lookupNamespaceURI")},u.XPathResult.ANY_TYPE,null).booleanValue}catch{return!1}}};Fe([Dt({localName:fe.ElementNames.XPath,namespaceURI:fe.NamespaceURI,prefix:fe.DefaultPrefix,required:!0}),Ye("design:type",String)],qm.prototype,"XPath",void 0);var Hm=class extends mi{static{o(this,"Transforms")}OnLoadXml(e){super.OnLoadXml(e),this.items=this.GetIterator().map(t=>{switch(t.Algorithm){case fe.AlgorithmNamespaces.XmlDsigEnvelopedSignatureTransform:return sh(t,Po);case fe.AlgorithmNamespaces.XmlDsigC14NTransform:return sh(t,Da);case fe.AlgorithmNamespaces.XmlDsigC14NWithCommentsTransform:return sh(t,Ba);case fe.AlgorithmNamespaces.XmlDsigExcC14NTransform:return sh(t,Ra);case fe.AlgorithmNamespaces.XmlDsigExcC14NWithCommentsTransform:return sh(t,_a);case fe.AlgorithmNamespaces.XmlDsigBase64Transform:return sh(t,Oo);case fe.AlgorithmNamespaces.XmlDsigXPathTransform:return sh(t,qm);default:try{let n=ux.CreateFromName(t.Algorithm);if(!t.Element)throw new Error("Transform element is not defined");return n.LoadXml(t.Element),n}catch{throw new _e(we.CRYPTOGRAPHIC_UNKNOWN_TRANSFORM,t.Algorithm)}}})}};Hm=Fe([Et({localName:fe.ElementNames.Transforms,parser:zn})],Hm);function sh(r,e){let t=new e;if(!r.Element)throw new Error("Transform element is not defined");return t.LoadXml(r.Element),t}o(sh,"ChangeTransform");var Oa=class extends Br{static{o(this,"Reference")}constructor(e){super(),this.DigestMethod=new gi,e&&(this.Uri=e)}};Fe([wr({defaultValue:""}),Ye("design:type",String)],Oa.prototype,"Id",void 0);Fe([wr({localName:fe.AttributeNames.URI}),Ye("design:type",String)],Oa.prototype,"Uri",void 0);Fe([wr({localName:fe.AttributeNames.Type,defaultValue:""}),Ye("design:type",String)],Oa.prototype,"Type",void 0);Fe([Dt({parser:Hm}),Ye("design:type",Hm)],Oa.prototype,"Transforms",void 0);Fe([Dt({required:!0,parser:gi}),Ye("design:type",gi)],Oa.prototype,"DigestMethod",void 0);Fe([Dt({required:!0,localName:fe.ElementNames.DigestValue,namespaceURI:fe.NamespaceURI,prefix:fe.DefaultPrefix,converter:oi}),Ye("design:type",Uint8Array)],Oa.prototype,"DigestValue",void 0);Oa=Fe([Et({localName:fe.ElementNames.Reference}),Ye("design:paramtypes",[String])],Oa);var Km=class extends mi{static{o(this,"References")}};Km=Fe([Et({localName:"References",parser:Oa})],Km);var ko=class extends Br{static{o(this,"SignedInfo")}};Fe([wr({localName:fe.AttributeNames.Id,defaultValue:""}),Ye("design:type",String)],ko.prototype,"Id",void 0);Fe([Dt({parser:Mm,required:!0}),Ye("design:type",Mm)],ko.prototype,"CanonicalizationMethod",void 0);Fe([Dt({parser:Ia,required:!0}),Ye("design:type",Ia)],ko.prototype,"SignatureMethod",void 0);Fe([Dt({parser:Km,minOccurs:1,noRoot:!0}),Ye("design:type",Km)],ko.prototype,"References",void 0);ko=Fe([Et({localName:fe.ElementNames.SignedInfo})],ko);var zm="http://www.w3.org/2001/04/xmldsig-more#",Wm="ecdsa",ih=class extends ws{static{o(this,"EcdsaPublicKey")}};Fe([Dt({localName:fe.ElementNames.X,namespaceURI:zm,prefix:Wm,required:!0,converter:oi}),Ye("design:type",Uint8Array)],ih.prototype,"X",void 0);Fe([Dt({localName:fe.ElementNames.Y,namespaceURI:zm,prefix:Wm,required:!0,converter:oi}),Ye("design:type",Uint8Array)],ih.prototype,"Y",void 0);ih=Fe([Et({localName:fe.ElementNames.PublicKey,namespaceURI:zm,prefix:Wm})],ih);var $m=class extends ws{static{o(this,"NamedCurve")}};Fe([wr({localName:fe.AttributeNames.URI,required:!0}),Ye("design:type",String)],$m.prototype,"Uri",void 0);$m=Fe([Et({localName:fe.ElementNames.NamedCurve,namespaceURI:zm,prefix:Wm})],$m);var Xm=class extends ws{static{o(this,"DomainParameters")}};Fe([Dt({parser:$m}),Ye("design:type",$m)],Xm.prototype,"NamedCurve",void 0);Xm=Fe([Et({localName:fe.ElementNames.DomainParameters,namespaceURI:zm,prefix:Wm})],Xm);var Gm=class extends Hs{static{o(this,"EcdsaKeyValue")}constructor(){super(...arguments),this.name=fe.ElementNames.ECDSAKeyValue,this.key=null,this.jwk=null,this.keyUsage=null}static canImportCryptoKey(e){return e.algorithm.name.toUpperCase()===Ro.toUpperCase()}get NamedCurve(){return xH(this.DomainParameters.NamedCurve.Uri)}async importKey(e){if(!e.algorithm.name||e.algorithm.name.toUpperCase()!=="ECDSA")throw new _e(we.ALGORITHM_WRONG_NAME,e.algorithm.name);let t=await rn.crypto.subtle.exportKey("jwk",e);return this.key=e,this.jwk=t,this.PublicKey=new ih,this.PublicKey.X=ir.FromString(t.x||"","base64url"),this.PublicKey.Y=ir.FromString(t.y||"","base64url"),this.DomainParameters||(this.DomainParameters=new Xm),this.DomainParameters.NamedCurve||(this.DomainParameters.NamedCurve=new $m),this.DomainParameters.NamedCurve.Uri=xH(t.crv||""),this.keyUsage=e.usages,this}async exportKey(e){if(this.key)return this.key;let t=ir.ToBase64Url(this.PublicKey.X),n=ir.ToBase64Url(this.PublicKey.Y),s=dhe(this.DomainParameters.NamedCurve.Uri),i={kty:"EC",crv:s,x:t,y:n,ext:!0};this.keyUsage=["verify"];let a=await rn.crypto.subtle.importKey("jwk",i,{name:"ECDSA",namedCurve:s},!0,this.keyUsage);return this.key=a,this.key}};Fe([Dt({parser:Xm}),Ye("design:type",Xm)],Gm.prototype,"DomainParameters",void 0);Fe([Dt({parser:ih,required:!0}),Ye("design:type",ih)],Gm.prototype,"PublicKey",void 0);Gm=Fe([Et({localName:fe.ElementNames.ECDSAKeyValue,namespaceURI:zm,prefix:Wm})],Gm);function xH(r){switch(r){case"P-256":return"urn:oid:1.2.840.10045.3.1.7";case"P-384":return"urn:oid:1.3.132.0.34";case"P-521":return"urn:oid:1.3.132.0.35"}throw new _e(we.CRYPTOGRAPHIC,"Unknown NamedCurve")}o(xH,"GetNamedCurveOid");function dhe(r){switch(r){case"urn:oid:1.2.840.10045.3.1.7":return"P-256";case"urn:oid:1.3.132.0.34":return"P-384";case"urn:oid:1.3.132.0.35":return"P-521"}throw new _e(we.CRYPTOGRAPHIC,"Unknown NamedCurve OID")}o(dhe,"GetNamedCurveFromOid");var mhe=class extends Map{static{o(this,"KeyInfoClauseRegistry")}},kc=new mhe;kc.set(fe.ElementNames.RSAKeyValue,Fm);kc.set(fe.ElementNames.ECDSAKeyValue,Gm);var MA=class{static{o(this,"KeyInfoClauseFactory")}static create(e){let t=kc.get(e);if(!t)throw new _e(we.KEY_INFO_CLAUSE_NOT_SUPPORTED,e);return new t}};var cx=class extends Hs{static{o(this,"KeyValue")}set Value(e){this.element=null,this.value=e}get Value(){return this.value}constructor(e){super(),e&&(this.Value=e)}async importKey(e){for(let[,t]of kc)if(t.canImportCryptoKey(e)){let n=new t;return await n.importKey(e),this.Value=n,this}throw new _e(we.ALGORITHM_NOT_SUPPORTED,e.algorithm.name)}async exportKey(e){if(!this.Value)throw new _e(we.NULL_REFERENCE);return this.Value.exportKey(e)}OnGetXml(e){if(!this.Value)throw new _e(we.CRYPTOGRAPHIC,"KeyValue has empty value");let t=this.Value.GetXml();t&&e.appendChild(t)}OnLoadXml(e){for(let t=0;t<e.childNodes.length;t++){let n=e.childNodes.item(t);if(Vs(n))try{let s=n.localName,i=MA.create(s);i.LoadXml(n),this.value=i;return}catch{}}throw new _e(we.CRYPTOGRAPHIC,"Unsupported KeyValue in use")}};cx=Fe([Et({localName:fe.ElementNames.KeyValue}),Ye("design:paramtypes",[Hs])],cx);var ghe={"2.5.4.3":{short:"CN",long:"CommonName"},"2.5.4.6":{short:"C",long:"Country"},"2.5.4.5":{long:"DeviceSerialNumber"},"0.9.2342.19200300.100.1.25":{short:"DC",long:"DomainComponent"},"1.2.840.113549.1.9.1":{short:"E",long:"EMail"},"2.5.4.42":{short:"G",long:"GivenName"},"2.5.4.43":{short:"I",long:"Initials"},"2.5.4.7":{short:"L",long:"Locality"},"2.5.4.10":{short:"O",long:"Organization"},"2.5.4.11":{short:"OU",long:"OrganizationUnit"},"2.5.4.8":{short:"ST",long:"State"},"2.5.4.9":{short:"Street",long:"StreetAddress"},"2.5.4.4":{short:"SN",long:"SurName"},"2.5.4.12":{short:"T",long:"Title"},"1.2.840.113549.1.9.8":{long:"UnstructuredAddress"},"1.2.840.113549.1.9.2":{long:"UnstructuredName"}},Jm=class{static{o(this,"X509Certificate")}constructor(e){if(this.publicKey=null,e){let t=new Uint8Array(e);this.LoadRaw(t),this.raw=t}}get SerialNumber(){return this.simpl.serialNumber.valueBlock.toString()}get Issuer(){return this.NameToString(this.simpl.issuer)}get Subject(){return this.NameToString(this.simpl.subject)}async Thumbprint(e="SHA-1"){return rn.crypto.subtle.digest(e,this.raw)}get PublicKey(){return this.publicKey}GetRaw(){return this.raw}async exportKey(e){if(e){let t={algorithm:e,usages:["verify"]};if(t.algorithm.name.toUpperCase()===Ro){let s=this.simpl.subjectPublicKeyInfo.toJSON();if("crv"in s&&s.crv)t.algorithm.namedCurve=s.crv;else throw new Error("Cannot get Curved name from the ECDSA public key")}this.isHashedAlgorithm(t.algorithm)&&typeof t.algorithm.hash=="string"&&(t.algorithm.hash={name:t.algorithm.hash});let n=await this.simpl.getPublicKey({algorithm:t});return this.publicKey=n,n}return this.simpl.subjectPublicKeyInfo.algorithm.algorithmId==="1.2.840.113549.1.1.1"?this.publicKey=await this.simpl.getPublicKey({algorithm:{algorithm:{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},usages:["verify"]}}):this.publicKey=await this.simpl.getPublicKey(),this.publicKey}NameToString(e,t=","){let n=[];return e.typesAndValues.forEach(s=>{let i=s.type,a=ghe[i.toString()],u=a?a.short:null;n.push(`${u||i}=${s.value.valueBlock.value}`)}),n.join(t+" ")}LoadRaw(e){this.raw=new Uint8Array(e);let t=Or(this.raw.buffer);this.simpl=new Gn({schema:t.result})}isHashedAlgorithm(e){return!!e.hash}};var jA=class extends Br{static{o(this,"X509IssuerSerial")}};Fe([Dt({localName:fe.ElementNames.X509IssuerName,namespaceURI:fe.NamespaceURI,prefix:fe.DefaultPrefix,required:!0}),Ye("design:type",String)],jA.prototype,"X509IssuerName",void 0);Fe([Dt({localName:fe.ElementNames.X509SerialNumber,namespaceURI:fe.NamespaceURI,prefix:fe.DefaultPrefix,required:!0}),Ye("design:type",String)],jA.prototype,"X509SerialNumber",void 0);jA=Fe([Et({localName:fe.ElementNames.X509IssuerSerial})],jA);var ah;(function(r){r[r.None=0]="None",r[r.EndCertOnly=1]="EndCertOnly",r[r.ExcludeRoot=2]="ExcludeRoot",r[r.WholeChain=3]="WholeChain"})(ah||(ah={}));var Ym=class extends Hs{static{o(this,"KeyInfoX509Data")}constructor(e,t=ah.None){if(super(),this.x509crl=null,this.SubjectKeyIdList=[],e){if(e instanceof Uint8Array)this.AddCertificate(new Jm(e));else if(e instanceof Jm)switch(t){case ah.None:case ah.EndCertOnly:this.AddCertificate(e);break;case ah.ExcludeRoot:this.AddCertificatesChainFrom(e,!1);break;case ah.WholeChain:this.AddCertificatesChainFrom(e,!0);break}}}async importKey(e){throw new _e(we.METHOD_NOT_SUPPORTED)}async exportKey(e){if(!this.Certificates.length)throw new _e(we.NULL_REFERENCE);return this.Key=await this.Certificates[0].exportKey(e),this.Key}get Certificates(){return this.X509CertificateList}get CRL(){return this.x509crl}set CRL(e){this.x509crl=e}get IssuerSerials(){return this.IssuerSerialList}get SubjectKeyIds(){return this.SubjectKeyIdList}get SubjectNames(){return this.SubjectNameList}AddCertificate(e){if(!e)throw new _e(we.PARAM_REQUIRED,"certificate");this.X509CertificateList||(this.X509CertificateList=[]),this.X509CertificateList.push(e)}AddIssuerSerial(e,t){if(e==null)throw new _e(we.PARAM_REQUIRED,"issuerName");this.IssuerSerialList==null&&(this.IssuerSerialList=[]);let n={issuerName:e,serialNumber:t};this.IssuerSerialList.push(n)}AddSubjectKeyId(e){if(this.SubjectKeyIdList&&(this.SubjectKeyIdList=[]),typeof e=="string"){if(e!=null){let t=ir.FromBase64(e);this.SubjectKeyIdList.push(t)}}else this.SubjectKeyIdList.push(e)}AddSubjectName(e){this.SubjectNameList==null&&(this.SubjectNameList=[]),this.SubjectNameList.push(e)}GetXml(){let e=this.CreateDocument(),t=this.CreateElement(e),n=this.GetPrefix();if(this.IssuerSerialList!=null&&this.IssuerSerialList.length>0&&this.IssuerSerialList.forEach(s=>{let i=e.createElementNS(fe.NamespaceURI,n+fe.ElementNames.X509IssuerSerial),a=e.createElementNS(fe.NamespaceURI,n+fe.ElementNames.X509IssuerName);a.textContent=s.issuerName,i.appendChild(a);let u=e.createElementNS(fe.NamespaceURI,n+fe.ElementNames.X509SerialNumber);u.textContent=s.serialNumber,i.appendChild(u),t.appendChild(i)}),this.SubjectKeyIdList!=null&&this.SubjectKeyIdList.length>0&&this.SubjectKeyIdList.forEach(s=>{let i=e.createElementNS(fe.NamespaceURI,n+fe.ElementNames.X509SKI);i.textContent=ir.ToBase64(s),t.appendChild(i)}),this.SubjectNameList!=null&&this.SubjectNameList.length>0&&this.SubjectNameList.forEach(s=>{let i=e.createElementNS(fe.NamespaceURI,n+fe.ElementNames.X509SubjectName);i.textContent=s,t.appendChild(i)}),this.X509CertificateList!=null&&this.X509CertificateList.length>0&&this.X509CertificateList.forEach(s=>{let i=e.createElementNS(fe.NamespaceURI,n+fe.ElementNames.X509Certificate);i.textContent=ir.ToBase64(s.GetRaw()),t.appendChild(i)}),this.x509crl!=null){let s=e.createElementNS(fe.NamespaceURI,n+fe.ElementNames.X509CRL);s.textContent=ir.ToBase64(this.x509crl),t.appendChild(s)}return t}LoadXml(e){super.LoadXml(e),this.IssuerSerialList&&(this.IssuerSerialList=[]),this.SubjectKeyIdList&&(this.SubjectKeyIdList=[]),this.SubjectNameList&&(this.SubjectNameList=[]),this.X509CertificateList&&(this.X509CertificateList=[]),this.x509crl=null;let t=this.GetChildren(fe.ElementNames.X509IssuerSerial);t&&t.forEach(s=>{let i=Br.GetChild(s,fe.ElementNames.X509IssuerName,fe.NamespaceURI,!0),a=Br.GetChild(s,fe.ElementNames.X509SerialNumber,fe.NamespaceURI,!0);i&&i.textContent&&a&&a.textContent&&this.AddIssuerSerial(i.textContent,a.textContent)}),t=this.GetChildren(fe.ElementNames.X509SKI),t&&t.forEach(s=>{if(s.textContent){let i=ir.FromBase64(s.textContent);this.AddSubjectKeyId(i)}}),t=this.GetChildren(fe.ElementNames.X509SubjectName),t?.forEach(s=>{s.textContent&&this.AddSubjectName(s.textContent)}),t=this.GetChildren(fe.ElementNames.X509Certificate),t&&t.forEach(s=>{if(s.textContent){let i=ir.FromBase64(s.textContent);this.AddCertificate(new Jm(i))}});let n=this.GetChild(fe.ElementNames.X509CRL,!1);n&&n.textContent&&(this.x509crl=ir.FromBase64(n.textContent))}AddCertificatesChainFrom(e,t){}};Ym=Fe([Et({localName:fe.ElementNames.X509Data}),Ye("design:paramtypes",[Object,Object])],Ym);var lx=class extends Hs{static{o(this,"SPKIData")}async importKey(e){let t=await rn.crypto.subtle.exportKey("spki",e);return this.SPKIexp=new Uint8Array(t),this.Key=e,this}async exportKey(e){if(!this.SPKIexp)throw new Error("SPKI data is not defined");let t=await rn.crypto.subtle.importKey("spki",this.SPKIexp,e,!0,["verify"]);return this.Key=t,t}};Fe([Dt({localName:fe.ElementNames.SPKIexp,namespaceURI:fe.NamespaceURI,prefix:fe.DefaultPrefix,required:!0,converter:oi}),Ye("design:type",Object)],lx.prototype,"SPKIexp",void 0);lx=Fe([Et({localName:fe.ElementNames.SPKIData})],lx);var oh=class extends mi{static{o(this,"KeyInfo")}OnLoadXml(e){for(let t=0;t<e.childNodes.length;t++){let n=e.childNodes.item(t);if(n.nodeType!==xt.Element)continue;let s=null;switch(n.localName){case fe.ElementNames.KeyValue:s=cx;break;case fe.ElementNames.X509Data:s=Ym;break;case fe.ElementNames.SPKIData:s=lx;break;case fe.ElementNames.KeyName:case fe.ElementNames.RetrievalMethod:case fe.ElementNames.PGPData:case fe.ElementNames.MgmtData:}if(s){let i=new s;i.LoadXml(n),this.Add(i)}}}};Fe([wr({localName:fe.AttributeNames.Id,defaultValue:""}),Ye("design:type",String)],oh.prototype,"Id",void 0);oh=Fe([Et({localName:fe.ElementNames.KeyInfo})],oh);var Lc=class extends Br{static{o(this,"Signature")}};Fe([wr({localName:fe.AttributeNames.Id,defaultValue:""}),Ye("design:type",String)],Lc.prototype,"Id",void 0);Fe([Dt({parser:ko,required:!0}),Ye("design:type",ko)],Lc.prototype,"SignedInfo",void 0);Fe([Dt({localName:fe.ElementNames.SignatureValue,namespaceURI:fe.NamespaceURI,prefix:fe.DefaultPrefix,required:!0,converter:oi,defaultValue:null}),Ye("design:type",Object)],Lc.prototype,"SignatureValue",void 0);Fe([Dt({parser:oh}),Ye("design:type",oh)],Lc.prototype,"KeyInfo",void 0);Fe([Dt({parser:ox,noRoot:!0}),Ye("design:type",ox)],Lc.prototype,"ObjectList",void 0);Lc=Fe([Et({localName:fe.ElementNames.Signature})],Lc);var vhe=class extends Map{static{o(this,"AlgorithmRegistry")}},Lt=new vhe;Lt.set(DA,{type:"signature",algorithm:Om});Lt.set(BA,{type:"signature",algorithm:Pm});Lt.set(RA,{type:"signature",algorithm:km});Lt.set(_A,{type:"signature",algorithm:Lm});Lt.set(DA,{type:"signature",algorithm:Om});Lt.set(BA,{type:"signature",algorithm:Pm});Lt.set(RA,{type:"signature",algorithm:km});Lt.set(_A,{type:"signature",algorithm:Lm});Lt.set($_,{type:"signature",algorithm:PA});Lt.set(X_,{type:"signature",algorithm:kA});Lt.set(G_,{type:"signature",algorithm:LA});Lt.set(z_,{type:"signature",algorithm:FA});Lt.set(W_,{type:"signature",algorithm:UA});Lt.set(SA,{type:"signature",algorithm:Im});Lt.set(AA,{type:"signature",algorithm:Dm});Lt.set(CA,{type:"signature",algorithm:Bm});Lt.set(NA,{type:"signature",algorithm:Rm});Lt.set(SA.toUpperCase(),{type:"signature",algorithm:Im});Lt.set(AA.toUpperCase(),{type:"signature",algorithm:Dm});Lt.set(CA.toUpperCase(),{type:"signature",algorithm:Bm});Lt.set(NA.toUpperCase(),{type:"signature",algorithm:Rm});Lt.set(V_,{type:"signature",algorithm:nx});Lt.set(M_,{type:"signature",algorithm:sx});Lt.set(j_,{type:"signature",algorithm:ix});Lt.set(q_,{type:"signature",algorithm:ax});Lt.set(Am,{type:"hash",algorithm:EA});Lt.set(Cm,{type:"hash",algorithm:rx});Lt.set(Nm,{type:"hash",algorithm:wA});Lt.set(Tm,{type:"hash",algorithm:bA});var uh=class{static{o(this,"AlgorithmFactory")}static createHashAlgorithmFromNamespace(e){for(let[t,{type:n,algorithm:s}]of Lt)if(n==="hash"&&t===e)return new s;throw new _e(we.ALGORITHM_NOT_SUPPORTED,e)}static createSignatureAlgorithmFromMethod(e){for(let[t,{type:n,algorithm:s}]of Lt)if(n==="signature"&&e.Algorithm===t){let i=new s;return i.fromMethod&&i.fromMethod(e),i}throw new _e(we.ALGORITHM_NOT_SUPPORTED,e.Algorithm)}static createHashAlgorithmFromAlgorithm(e){for(let[,{type:t,algorithm:n}]of Lt)if(t==="hash"){let s=new n;if(s.algorithm.name.toUpperCase()===e.name.toUpperCase())return s}throw new _e(we.ALGORITHM_NOT_SUPPORTED,e.name)}static createSignatureAlgorithmFromAlgorithm(e){for(let[,{type:t,algorithm:n}]of Lt)if(t==="signature"){let s=n.fromAlgorithm(e);if(s)return s}throw new _e(we.ALGORITHM_NOT_SUPPORTED,e.name)}};var xhe=class extends Map{static{o(this,"TransformRegistry")}},Lo=new xhe;Lo.set(fe.AlgorithmNamespaces.XmlDsigBase64Transform,Oo);Lo.set(fe.AlgorithmNamespaces.XmlDsigC14NTransform,Da);Lo.set(fe.AlgorithmNamespaces.XmlDsigC14NWithCommentsTransform,Ba);Lo.set(fe.AlgorithmNamespaces.XmlDsigEnvelopedSignatureTransform,Po);Lo.set(fe.AlgorithmNamespaces.XmlDsigExcC14NTransform,Ra);Lo.set(fe.AlgorithmNamespaces.XmlDsigExcC14NWithCommentsTransform,_a);var ux=class{static{o(this,"CryptoConfig")}static CreateFromName(e){if(!e)throw new _e(we.PARAM_REQUIRED,"name");let t=Lo.get(e);if(t)return new t;let n;switch(e){case fe.AlgorithmNamespaces.XmlDsigBase64Transform:n=new Oo;break;case fe.AlgorithmNamespaces.XmlDsigC14NTransform:n=new Da;break;case fe.AlgorithmNamespaces.XmlDsigC14NWithCommentsTransform:n=new Ba;break;case fe.AlgorithmNamespaces.XmlDsigEnvelopedSignatureTransform:n=new Po;break;case fe.AlgorithmNamespaces.XmlDsigXPathTransform:throw new _e(we.ALGORITHM_NOT_SUPPORTED,e);case fe.AlgorithmNamespaces.XmlDsigXsltTransform:throw new _e(we.ALGORITHM_NOT_SUPPORTED,e);case fe.AlgorithmNamespaces.XmlDsigExcC14NTransform:n=new Ra;break;case fe.AlgorithmNamespaces.XmlDsigExcC14NWithCommentsTransform:n=new _a;break;case fe.AlgorithmNamespaces.XmlDecryptionTransform:throw new _e(we.ALGORITHM_NOT_SUPPORTED,e);default:throw new _e(we.ALGORITHM_NOT_SUPPORTED,e)}return n}static CreateSignatureAlgorithm(e){return uh.createSignatureAlgorithmFromMethod(e)}static CreateHashAlgorithm(e){return uh.createHashAlgorithmFromNamespace(e)}static GetHashAlgorithm(e){let t=typeof e=="string"?{name:e}:e;return uh.createHashAlgorithmFromAlgorithm(t)}static GetSignatureAlgorithm(e){let t=typeof e=="string"?{name:e}:e;return"hash"in t&&typeof t.hash=="string"&&(t.hash={name:t.hash}),uh.createSignatureAlgorithmFromAlgorithm(t)}static CreateSignatureMethod(e){let t=new Ia;return t.Algorithm=e.namespaceURI,e.toMethod&&e.toMethod(t),t}static RegisterSignatureAlgorithm(e,t){Lt.set(e,{type:"signature",algorithm:t})}static RegisterHashAlgorithm(e,t){Lt.set(e,{type:"hash",algorithm:t})}static RegisterKeyInfoClause(e,t){kc.set(e,t)}static RegisterTransform(e,t){Lo.set(e,t)}};var ph=Rt(IK(),1);var DK={xmldec:{version:"1.0",encoding:"UTF-8",standalone:void 0}};var BK={explicitArray:!1,explicitRoot:!1,preserveChildrenOrder:!0};var gO=class{static{o(this,"Xml2JsToolkit")}xml2js;constructor(e=hde){this.xml2js=e,U9({XMLSerializer:ph.default.XMLSerializer,DOMParser:ph.default.DOMParser,DOMImplementation:ph.default.DOMImplementation})}async validate(e,t){if(!e||e.trim().length===0)return nr(new Vt("Please provide a valid xml content"));if(!t||t.trim().length===0)return nr(new Vt("Please provide a valid existing xsd path"));try{return await lj.validate(e,t),Qr()}catch(n){return us(n)}}parse(e,t){return new Promise((n,s)=>new this.xml2js.Parser({...BK,...t}).parseString(e,(i,a)=>i?s(i):n(a)))}build(e,t){return Promise.resolve(new this.xml2js.Builder({...DK,...t}).buildObject(e))}digest(e,t,n=E0){return this.hash(this.canonicalize(e,n),t)}canonicalize(e,t=E0){let n=new ph.default.DOMParser().parseFromString(this.clear(e),"application/xml");return new Ta(t.includeComments,t.exclusive).Canonicalize(n)}getNode(e,t){let n=this.parseXml(e),i=this.getDocumentElement(n).getElementsByTagName(t).item(0);return i?this.clear(this.serializeXml(i)):null}getFirstNode(e){let t=this.parseXml(e),s=this.getDocumentElement(t).firstChild;return s?this.clear(this.serializeXml(s)):null}getAttribute(e,t){let n=this.parseXml(e);return this.getDocumentElement(n).getAttribute(t)}appendNode(e,t){let n=this.parseXml(e),s=this.getDocumentElement(n),i=this.getDocumentElement(this.parseXml(t));return s.appendChild(i),this.clear(this.serializeXml(n))}insertBefore(e,t,n){let s=this.parseXml(e),a=this.getDocumentElement(s).getElementsByTagName(t).item(0);if(!a?.parentNode)throw new Vt(`No element found with tag "${t}" to insert before`);let u=this.getDocumentElement(this.parseXml(n));return a.parentNode.insertBefore(u,a),this.clear(this.serializeXml(s))}hash(e,t){return RK.default.createHash(t).update(e,"utf8").digest().toString("base64")}parseXml(e){return new ph.default.DOMParser().parseFromString(e,"application/xml")}getDocumentElement(e){if(!e.documentElement)throw new Vt("Invalid xml provided. Missing root element.");return e.documentElement}serializeXml(e){return new ph.default.XMLSerializer().serializeToString(e)}clear(e){return['xmlns:default="http://www.w3.org/2000/09/xmldsig#"',' standalone="no"',"default:",":default",`
|
|
110
110
|
`,"\r"," "].reduce((n,s)=>n.replace(s,""),e.replace(/(>)\s*(<)/gm,"$1$2"))}};var _K=require("class-validator");var yO=o(r=>(e,t)=>{(0,_K.registerDecorator)({name:"isDecimal",target:e.constructor,propertyName:t,options:r,validator:{validate(n){return n instanceof Kc?!0:typeof n=="string"||typeof n=="number"||typeof n=="bigint"},defaultMessage(n){return`${n.property} is not a valid Decimal value`}}})},"IsDecimal");var Wke=require("reflect-metadata"),vO=require("class-validator");var g0=Symbol("choice"),y0=o(r=>r==null||r==="","isEmpty"),pde=o(r=>e=>{let{properties:t,required:n=!1,...s}=r,i=Reflect.getMetadata(g0,e)??[],a={properties:t,required:n};i.push(a),Reflect.defineMetadata(g0,i,e);for(let u of t)(0,vO.registerDecorator)({name:"choice",target:e,propertyName:u,options:s,validator:{validate(c,l){let f=l.object,h=l.property,d=Reflect.getMetadata(g0,e);if(!d)return!0;let g=d.find(m=>m.properties.includes(h));if(!g||y0(c))return!0;for(let m of g.properties){if(m===h)continue;let v=f[m];if(!y0(v))return!1}for(let m of d)if(m!==g)for(let v of m.properties){let y=f[v];if(!y0(y))return!1}return!0},defaultMessage(c){let l=Reflect.getMetadata(g0,e);if(!l)return`${c.property} validation error`;let f=l.find(d=>d.properties.includes(c.property));if(!f)return`${c.property} validation error`;let h=c.object;for(let d of f.properties){let g=h[d];if(!y0(g)&&d!==c.property)return`${c.property} cannot be set because ${d} is already set. Only one property from this choice group is allowed.`}for(let d of l)if(d!==f)for(let g of d.properties){let m=h[g];if(!y0(m))return`${c.property} cannot be set because ${g} from a different choice group is already set.`}return`${c.property} validation error`}}});if(n)for(let u of t)(0,vO.registerDecorator)({name:"choiceGroupRequired",target:e,propertyName:u,options:{...s,always:!0},validator:{validate(c,l){let f=l.object,h=Reflect.getMetadata(g0,e);if(!h)return!0;let d=h.find(g=>g.properties.includes(l.property));if(!d?.required)return!0;for(let g of d.properties){let m=f[g];if(!y0(m))return!0}return l.property!==d.properties[0]},defaultMessage(c){let l=Reflect.getMetadata(g0,e);if(!l)return"At least one property from a choice group must be provided";let f=l.find(h=>h.properties.includes(c.property));return f?`You must provide a value for one of the following properties: ${f.properties.join(", ")}`:"At least one property from a choice group must be provided"}}})},"Choice");var Qke=require("reflect-metadata");var OK=require("class-transformer");var dde=o(({fixed:r,...e}={fixed:2})=>(t,n)=>{yO(e)(t,n),(0,OK.Transform)(({value:s})=>Kc.newOrUndefined(s)?.toFixed(r))(t,n)},"TransformDecimal");var PK=require("class-transformer"),kK=require("class-validator");var mde=o((r={})=>(e,t)=>{(0,PK.Transform)(({value:n})=>{let s=n instanceof Date?n.toISOString():n;return s?tl(s).tz("America/Sao_Paulo").format(r.format):void 0})(e,t),(0,kK.IsDateString)()(e,t)},"TransformDateString");var xO=class{static{o(this,"StateCodeAcValidator")}execute(e){if(e=e.replace(/\D/g,""),!/^01\d{11}$/.test(e))return!1;let t=e.split("").map(Number),n=t.slice(0,11),s=t[11],i=t[12],a=[4,3,2,9,8,7,6,5,4,3,2],c=n.reduce((m,v,y)=>m+v*a[y],0)%11,l=c===0||c===1?0:11-c,f=[5,4,3,2,9,8,7,6,5,4,3,2],d=[...n,l].reduce((m,v,y)=>m+v*f[y],0)%11,g=d===0||d===1?0:11-d;return s===l&&i===g}};var EO=class{static{o(this,"StateCodeAlValidator")}execute(e){let t=e.replace(/\D/g,"");if(t.length!==9||!t.startsWith("24"))return!1;let n=[9,8,7,6,5,4,3,2],s=0;for(let c=0;c<8;c++)s+=parseInt(t[c],10)*n[c];let a=s*10%11;return(a===10?0:a)===parseInt(t[8],10)}};var wO=class{static{o(this,"StateCodeAmValidator")}execute(e){let t=e.replace(/\D/g,"");if(t.length!==9)return!1;let n=[9,8,7,6,5,4,3,2],s=0;for(let a=0;a<8;a++)s+=parseInt(t[a],10)*n[a];let i;if(s<11)i=11-s;else{let a=s%11;i=a<=1?0:11-a}return i===parseInt(t[8],10)}};var bO=class{static{o(this,"StateCodeApValidator")}execute(e){let t=e.replace(/\D/g,"");if(t.length!==9||!t.startsWith("03"))return!1;let n=t.substring(0,8),s=parseInt(n,10),i,a;s>=3017001&&s<=3019022?(i=9,a=1):s>=3000001&&s<=3017e3?(i=5,a=0):(i=0,a=0);let u=[9,8,7,6,5,4,3,2],c=i;for(let h=0;h<8;h++)c+=parseInt(t[h],10)*u[h];let f=11-c%11;return f===10?f=0:f===11&&(f=a),f===parseInt(t[8],10)}};var SO=class{static{o(this,"StateCodeBaValidator")}execute(e){let t=e.replace(/\D/g,"");if(t.length!==8&&t.length!==9)return!1;let n=t.split("").map(v=>parseInt(v,10)),s=(t.length===8?n[0]:n[1])<=5||n[0]===8?10:11,i=t.length===8?[7,6,5,4,3,2]:[8,7,6,5,4,3,2],a=0;for(let v=0;v<i.length;v++)a+=n[v]*i[v];let u=a%s,c=s-u;(s===11&&u<=1||s===10&&u===0)&&(c=0);let f=(t.slice(0,t.length-2)+c.toString()).split("").map(v=>parseInt(v,10)),h=t.length===8?[8,7,6,5,4,3,2]:[9,8,7,6,5,4,3,2],d=0;for(let v=0;v<h.length;v++)d+=f[v]*h[v];let g=d%s,m=s-g;return(s===11&&g<=1||s===10&&g===0)&&(m=0),m===n[t.length-2]&&c===n[t.length-1]}};var AO=class{static{o(this,"StateCodeCeValidator")}execute(e){let t=e.replace(/\D/g,"");if(t.length!==9)return!1;let n=[9,8,7,6,5,4,3,2],s=0;for(let u=0;u<8;u++)s+=parseInt(t[u],10)*n[u];let a=11-s%11;return(a===10||a===11)&&(a=0),a===parseInt(t[8],10)}};var CO=class{static{o(this,"StateCodeDfValidator")}execute(e){let t=e.replace(/\D/g,"");if(t.length!==13||!t.startsWith("07"))return!1;let n=t.slice(0,11).split("").map(Number),s=t.slice(11).split("").map(Number),i=[2,3,4,5,6,7,8,9],a=0;for(let h=10,d=0;h>=0;h--,d=(d+1)%i.length)a+=n[h]*i[d];let u=11-a%11;(u===10||u===11)&&(u=0);let c=n.concat([u]),l=0;for(let h=11,d=0;h>=0;h--,d=(d+1)%i.length)l+=c[h]*i[d];let f=11-l%11;return(f===10||f===11)&&(f=0),u===s[0]&&f===s[1]}};var NO=class{static{o(this,"StateCodeEsValidator")}execute(e){let t=e.replace(/\D/g,"");if(t.length!==9)return!1;let n=[9,8,7,6,5,4,3,2],s=0;for(let u=0;u<8;u++)s+=parseInt(t[u],10)*n[u];let i=s%11;return(i<2?0:11-i)===parseInt(t[8],10)}};var TO=class{static{o(this,"StateCodeGoValidator")}execute(e){let t=e.replace(/\D/g,"");if(t.length!==9)return!1;let n=parseInt(t.substring(0,2));if(!(n===10||n===11||n>=20&&n<=29))return!1;let s=[9,8,7,6,5,4,3,2],i=0;for(let c=0;c<8;c++)i+=parseInt(t[c],10)*s[c];let a=i%11;return(a===0||a===1?0:11-a)===parseInt(t[8],10)}};var IO=class{static{o(this,"StateCodeMaValidator")}execute(e){let t=e.replace(/\D/g,"");if(t.length!==9||!t.startsWith("12"))return!1;let n=[9,8,7,6,5,4,3,2],s=0;for(let u=0;u<8;u++)s+=parseInt(t[u],10)*n[u];let i=s%11;return(i===0||i===1?0:11-i)===parseInt(t[8],10)}};var DO=class{static{o(this,"StateCodeMgValidator")}execute(e){let t=e.replace(/\D/g,"");if(t.length!==13)return!1;let n=t.slice(0,11),s=n.slice(0,3)+"0"+n.slice(3),i=0;for(let g=0;g<12;g++){let m=g%2===0?1:2,v=(parseInt(s[g])*m).toString();i+=v.split("").reduce((y,w)=>y+parseInt(w),0)}let u=Math.ceil(i/10)*10-i,c=n+u.toString(),l=[3,2,11,10,9,8,7,6,5,4,3,2],f=0;for(let g=0;g<12;g++)f+=parseInt(c[g])*l[g];let h=f%11,d=h<2?0:11-h;return parseInt(t[11])===u&&parseInt(t[12])===d}};var BO=class{static{o(this,"StateCodeMsValidator")}execute(e){let t=e.replace(/\D/g,"");if(t.length!==9||!(t.startsWith("28")||t.startsWith("50")))return!1;let n=[9,8,7,6,5,4,3,2],s=0;for(let c=0;c<8;c++)s+=parseInt(t[c],10)*n[c];let i=s%11,a=11-i;return(i===0||a>9?0:a)===parseInt(t[8],10)}};var RO=class{static{o(this,"StateCodeMtValidator")}execute(e){let t=e.replace(/\D/g,"");if(t.length!==11)return!1;let n=[3,2,9,8,7,6,5,4,3,2],s=0;for(let u=0;u<10;u++)s+=parseInt(t[u],10)*n[u];let i=s%11;return(i===0||i===1?0:11-i)===parseInt(t[10],10)}};var _O=class{static{o(this,"StateCodePaValidator")}execute(e){let t=e.replace(/\D/g,"");if(t.length!==9)return!1;let n=[9,8,7,6,5,4,3,2],s=0;for(let u=0;u<8;u++)s+=parseInt(t[u])*n[u];let i=s%11;return(i===0||i===1?0:11-i)===parseInt(t[8])}};var OO=class{static{o(this,"StateCodePbValidator")}execute(e){let t=e.replace(/\D/g,"");if(t.length!==9)return!1;let n=[9,8,7,6,5,4,3,2],s=0;for(let u=0;u<8;u++)s+=parseInt(t[u])*n[u];let a=11-s%11;return(a===10||a===11)&&(a=0),a===parseInt(t[8])}};var PO=class{static{o(this,"StateCodePeValidator")}execute(e){let t=e.replace(/\D/g,"");if(t.length!==9)return!1;let n=t.slice(0,7).split("").map(Number),s=[8,7,6,5,4,3,2],i=0;for(let g=0;g<7;g++)i+=n[g]*s[g];let a=i%11,u=a===0||a===1?0:11-a,c=[...n,u],l=[9,8,7,6,5,4,3,2],f=0;for(let g=0;g<8;g++)f+=c[g]*l[g];let h=f%11,d=h===0||h===1?0:11-h;return u===parseInt(t[7])&&d===parseInt(t[8])}};var kO=class{static{o(this,"StateCodePiValidator")}execute(e){let t=e.replace(/\D/g,"");if(t.length!==9)return!1;let n=[9,8,7,6,5,4,3,2],s=0;for(let u=0;u<8;u++)s+=parseInt(t[u],10)*n[u];let a=11-s%11;return(a===10||a===11)&&(a=0),a===parseInt(t[8],10)}};var LO=class{static{o(this,"StateCodePrValidator")}execute(e){let t=e.replace(/\D/g,"");if(t.length!==10)return!1;let n=t.slice(0,8).split("").map(Number),s=[3,2,7,6,5,4,3,2],i=[4,3,2,7,6,5,4,3,2],a=0;for(let h=0;h<8;h++)a+=n[h]*s[h];let u=11-a%11;u>=10&&(u=0);let c=[...n,u],l=0;for(let h=0;h<9;h++)l+=c[h]*i[h];let f=11-l%11;return f>=10&&(f=0),u===parseInt(t[8])&&f===parseInt(t[9])}};var FO=class{static{o(this,"StateCodeRjValidator")}execute(e){let t=e.replace(/\D/g,"");if(t.length!==8)return!1;let n=[2,7,6,5,4,3,2],s=0;for(let u=0;u<7;u++)s+=parseInt(t[u],10)*n[u];let i=s%11;return(i<=1?0:11-i)===parseInt(t[7],10)}};var UO=class{static{o(this,"StateCodeRnValidator")}execute(e){let t=e.replace(/\D/g,"");if(!(t.length===9||t.length===10)||!t.startsWith("20"))return!1;let n=t.length===9?[9,8,7,6,5,4,3,2]:[10,9,8,7,6,5,4,3,2],s=t.slice(0,n.length).split("").map(Number),i=0;for(let l=0;l<n.length;l++)i+=s[l]*n[l];let u=i*10%11;return(u===10?0:u)===parseInt(t[t.length-1])}};var VO=class{static{o(this,"StateCodeRoValidator")}execute(e){let t=e.replace(/\D/g,""),n,s;if(t.length===9)n=t.slice(3,8).split("").map(Number),s=[6,5,4,3,2];else if(t.length===14)n=t.slice(0,13).split("").map(Number),s=[6,5,4,3,2,9,8,7,6,5,4,3,2];else return!1;let i=0;for(let c=0;c<s.length;c++)i+=n[c]*s[c];let u=11-i%11;return(u===10||u===11)&&(u-=10),u===parseInt(t[t.length-1])}};var MO=class{static{o(this,"StateCodeRrValidator")}execute(e){let t=e.replace(/\D/g,"");if(t.length!==9||!t.startsWith("24"))return!1;let n=0;for(let i=0;i<8;i++)n+=(i+1)*parseInt(t[i],10);return n%9===parseInt(t[8],10)}};var jO=class{static{o(this,"StateCodeRsValidator")}execute(e){let t=e.replace(/\D/g,"");if(t.length!==10)return!1;let n=[2,9,8,7,6,5,4,3,2],s=0;for(let a=0;a<9;a++)s+=parseInt(t[a],10)*n[a];let i=11-s%11;return(i===10||i===11)&&(i=0),i===parseInt(t[9],10)}};var qO=class{static{o(this,"StateCodeScValidator")}execute(e){let t=e.replace(/\D/g,"");if(t.length!==9)return!1;let n=[9,8,7,6,5,4,3,2],s=0;for(let u=0;u<8;u++)s+=parseInt(t[u],10)*n[u];let a=11-s%11;return(a===10||a===11)&&(a=0),a===parseInt(t[8],10)}};var HO=class{static{o(this,"StateCodeSeValidator")}execute(e){let t=e.replace(/\D/g,"");if(t.length!==9)return!1;let n=[9,8,7,6,5,4,3,2],s=0;for(let u=0;u<8;u++)s+=parseInt(t[u])*n[u];let a=11-s%11;return(a===10||a===11)&&(a=0),a===parseInt(t[8],10)}};var KO=class{static{o(this,"StateCodeSpValidator")}execute(e){let t=e;if(t.length!==12)return!1;let n=t.split("").map(Number),s=[1,3,4,5,6,7,8,10],i=0;for(let f=0;f<8;f++)i+=n[f]*s[f];let a=i%11%10,u=[3,2,10,9,8,7,6,5,4,3,2],c=0;for(let f=0;f<11;f++)c+=n[f]*u[f];let l=c%11%10;return a===n[8]&&l===n[11]}};var $O=class{static{o(this,"StateCodeToValidator")}execute(e){let t=e.replace(/\D/g,"");if(t.length!==11)return!1;let n=t.split(""),s=n.slice(0,2).concat(n.slice(4,10)).map(Number),i=[9,8,7,6,5,4,3,2],a=0;for(let l=0;l<i.length;l++)a+=s[l]*i[l];let u=a%11;return(u<2?0:11-u)===parseInt(t[10])}};0&&(module.exports={ASN1,CanonicalizationMethod,Choice,Decimal,DigestAlgorithm,EntitySigner,Environment,IsDecimal,Left,MemoryCacheAdapter,NFeTsError,NativeCertificateRepository,NullCacheAdapter,PdfkitPdfBuilder,Right,SignatureAlgorithm,SignatureMethod,SignatureNamespace,Signer,SkipAllValidations,SkipValidation,SkipValidationMetadata,SoapRemoteTransmissionRepository,StateAcronyms,StateCodeAcValidator,StateCodeAlValidator,StateCodeAmValidator,StateCodeApValidator,StateCodeBaValidator,StateCodeCeValidator,StateCodeDfValidator,StateCodeEsValidator,StateCodeGoValidator,StateCodeMaValidator,StateCodeMgValidator,StateCodeMsValidator,StateCodeMtValidator,StateCodePaValidator,StateCodePbValidator,StateCodePeValidator,StateCodePiValidator,StateCodePrValidator,StateCodeRjValidator,StateCodeRnValidator,StateCodeRoValidator,StateCodeRrValidator,StateCodeRsValidator,StateCodeScValidator,StateCodeSeValidator,StateCodeSpValidator,StateCodeToValidator,StateCodes,TransformDateString,TransformDecimal,TransmissionError,TransmissionHostNotFoundError,TransmissionTimeoutError,ValidateErrorsMetadata,Validates,ValidationError,Xml2JsToolkit,XmlSigner,clearEmptyValues,dateToolkit,fixUtf8Mojibake,left,leftFromError,leftFromTransmissionError,mapConstraintsToErrors,mapTransmissionError,normalizeTransmissionStrings,plainToInstance,right,search,timezones,unreachable});
|
|
111
111
|
/*! Bundled license information:
|
|
112
112
|
|