@3kles/3kles-ionauth
Version:
2 lines • 209 kB
JavaScript
/*! For license information please see index.js.LICENSE.txt */
(()=>{var e={78:(e,t,r)=>{const n=r(8083),i=r(876),o=r(3943),s=r(6437),a=r(4043),c=r(6887);e.exports.generate=async(e,t,r,u=!0)=>{switch(e){case"RSA":return i(await o.generate(t,u),r);case"EC":return i(await s.generate(t,u),r);case"OKP":return i(await a.generate(t,u),r);case"oct":return i(await c.generate(t,u),r);default:throw new n.JOSENotSupported(`unsupported key type: ${e}`)}},e.exports.generateSync=(e,t,r,u=!0)=>{switch(e){case"RSA":return i(o.generateSync(t,u),r);case"EC":return i(s.generateSync(t,u),r);case"OKP":return i(a.generateSync(t,u),r);case"oct":return i(c.generateSync(t,u),r);default:throw new n.JOSENotSupported(`unsupported key type: ${e}`)}}},128:(e,t,r)=>{const n=r(6204),i=r(8083);e.exports=(e,{complete:t=!1}={})=>{if("string"!=typeof e||!e)throw new TypeError("JWT must be a string");const{0:r,1:o,2:s,length:a}=e.split(".");if(5===a)throw new TypeError("encrypted JWTs cannot be decoded");if(3!==a)throw new i.JWTMalformed("JWTs must have three components");try{const e={header:n.JSON.decode(r),payload:n.JSON.decode(o),signature:s};return t?e:e.payload}catch(e){throw new i.JWTMalformed("JWT is malformed")}}},144:(e,t,r)=>{"use strict";const n=r(3908);e.exports=(e,t,r=!1)=>{if(e instanceof n)return e;try{return new n(e,t)}catch(e){if(!r)return null;throw e}}},181:e=>{"use strict";e.exports=require("buffer")},226:e=>{e.exports=e=>!!e&&e.constructor===Object},270:(e,t,r)=>{"use strict";const n=r(3908),i=r(8311);e.exports=(e,t,r)=>{let o=null,s=null,a=null;try{a=new i(t,r)}catch(e){return null}return e.forEach(e=>{a.test(e)&&(o&&1!==s.compare(e)||(o=e,s=new n(o,r)))}),o}},349:(e,t,r)=>{"use strict";function n(e){var t=this;if(t instanceof n||(t=new n),t.tail=null,t.head=null,t.length=0,e&&"function"==typeof e.forEach)e.forEach(function(e){t.push(e)});else if(arguments.length>0)for(var r=0,i=arguments.length;r<i;r++)t.push(arguments[r]);return t}function i(e,t,r){var n=t===e.head?new a(r,null,t,e):new a(r,t,t.next,e);return null===n.next&&(e.tail=n),null===n.prev&&(e.head=n),e.length++,n}function o(e,t){e.tail=new a(t,e.tail,null,e),e.head||(e.head=e.tail),e.length++}function s(e,t){e.head=new a(t,null,e.head,e),e.tail||(e.tail=e.head),e.length++}function a(e,t,r,n){if(!(this instanceof a))return new a(e,t,r,n);this.list=n,this.value=e,t?(t.next=this,this.prev=t):this.prev=null,r?(r.prev=this,this.next=r):this.next=null}e.exports=n,n.Node=a,n.create=n,n.prototype.removeNode=function(e){if(e.list!==this)throw new Error("removing node which does not belong to this list");var t=e.next,r=e.prev;return t&&(t.prev=r),r&&(r.next=t),e===this.head&&(this.head=t),e===this.tail&&(this.tail=r),e.list.length--,e.next=null,e.prev=null,e.list=null,t},n.prototype.unshiftNode=function(e){if(e!==this.head){e.list&&e.list.removeNode(e);var t=this.head;e.list=this,e.next=t,t&&(t.prev=e),this.head=e,this.tail||(this.tail=e),this.length++}},n.prototype.pushNode=function(e){if(e!==this.tail){e.list&&e.list.removeNode(e);var t=this.tail;e.list=this,e.prev=t,t&&(t.next=e),this.tail=e,this.head||(this.head=e),this.length++}},n.prototype.push=function(){for(var e=0,t=arguments.length;e<t;e++)o(this,arguments[e]);return this.length},n.prototype.unshift=function(){for(var e=0,t=arguments.length;e<t;e++)s(this,arguments[e]);return this.length},n.prototype.pop=function(){if(this.tail){var e=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,e}},n.prototype.shift=function(){if(this.head){var e=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,e}},n.prototype.forEach=function(e,t){t=t||this;for(var r=this.head,n=0;null!==r;n++)e.call(t,r.value,n,this),r=r.next},n.prototype.forEachReverse=function(e,t){t=t||this;for(var r=this.tail,n=this.length-1;null!==r;n--)e.call(t,r.value,n,this),r=r.prev},n.prototype.get=function(e){for(var t=0,r=this.head;null!==r&&t<e;t++)r=r.next;if(t===e&&null!==r)return r.value},n.prototype.getReverse=function(e){for(var t=0,r=this.tail;null!==r&&t<e;t++)r=r.prev;if(t===e&&null!==r)return r.value},n.prototype.map=function(e,t){t=t||this;for(var r=new n,i=this.head;null!==i;)r.push(e.call(t,i.value,this)),i=i.next;return r},n.prototype.mapReverse=function(e,t){t=t||this;for(var r=new n,i=this.tail;null!==i;)r.push(e.call(t,i.value,this)),i=i.prev;return r},n.prototype.reduce=function(e,t){var r,n=this.head;if(arguments.length>1)r=t;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");n=this.head.next,r=this.head.value}for(var i=0;null!==n;i++)r=e(r,n.value,i),n=n.next;return r},n.prototype.reduceReverse=function(e,t){var r,n=this.tail;if(arguments.length>1)r=t;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");n=this.tail.prev,r=this.tail.value}for(var i=this.length-1;null!==n;i--)r=e(r,n.value,i),n=n.prev;return r},n.prototype.toArray=function(){for(var e=new Array(this.length),t=0,r=this.head;null!==r;t++)e[t]=r.value,r=r.next;return e},n.prototype.toArrayReverse=function(){for(var e=new Array(this.length),t=0,r=this.tail;null!==r;t++)e[t]=r.value,r=r.prev;return e},n.prototype.slice=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var r=new n;if(t<e||t<0)return r;e<0&&(e=0),t>this.length&&(t=this.length);for(var i=0,o=this.head;null!==o&&i<e;i++)o=o.next;for(;null!==o&&i<t;i++,o=o.next)r.push(o.value);return r},n.prototype.sliceReverse=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var r=new n;if(t<e||t<0)return r;e<0&&(e=0),t>this.length&&(t=this.length);for(var i=this.length,o=this.tail;null!==o&&i>t;i--)o=o.prev;for(;null!==o&&i>e;i--,o=o.prev)r.push(o.value);return r},n.prototype.splice=function(e,t,...r){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var n=0,o=this.head;null!==o&&n<e;n++)o=o.next;var s=[];for(n=0;o&&n<t;n++)s.push(o.value),o=this.removeNode(o);for(null===o&&(o=this.tail),o!==this.head&&o!==this.tail&&(o=o.prev),n=0;n<r.length;n++)o=i(this,o,r[n]);return s},n.prototype.reverse=function(){for(var e=this.head,t=this.tail,r=e;null!==r;r=r.prev){var n=r.prev;r.prev=r.next,r.next=n}return this.head=t,this.tail=e,this};try{r(9669)(n)}catch(e){}},381:function(e,t,r){"use strict";var n,i=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||(n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},n(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=n(e),s=0;s<r.length;s++)"default"!==r[s]&&i(t,e,r[s]);return o(t,e),t});Object.defineProperty(t,"__esModule",{value:!0}),t.IonAuth=void 0;const a=s(r(4040)),c=r(4601);t.IonAuth=class{client;option;constructor(e){if(!e&&!process.env.JWKS_URI)throw new Error("JWKS uri is required. Set the environment variable JWKS_URI or feed the uri in the options");this.option={cache:!0,rateLimit:!0,jwksRequestsPerMinute:10,cacheMaxAge:36e5,...e,jwksUri:process.env.JWKS_URI||e.jwksUri},this.initJwksClient()}async verify(e){try{const t=await this.getPublicKey(this.getKid(e));return a.verify(e,t)}catch(e){throw e instanceof c.SigningKeyNotFoundError?console.error("Error retrieving public key",e):e instanceof c.JwksRateLimitError?console.error("Jwks limit reached",e):console.error("Error during token validation",e),e}}initJwksClient(){this.client=new c.JwksClient(this.option)}async getPublicKey(e){return(await this.client.getSigningKey(e)).getPublicKey()}getKid(e){const t=a.decode(e,{complete:!0,json:!0});if(!t)throw new Error("Jwks kid not found");return t.header.kid}}},473:(e,t,r)=>{const{inherits:n}=r(9023),{DecoderBuffer:i}=r(4662),o=r(7868),s=r(3236);function a(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new c,this.tree._init(e.body)}function c(e){o.call(this,"der",e)}function u(e,t){let r=e.readUInt8(t);if(e.isError(r))return r;const n=s.tagClass[r>>6],i=!(32&r);if(31&~r)r&=31;else{let n=r;for(r=0;!(128&~n);){if(n=e.readUInt8(t),e.isError(n))return n;r<<=7,r|=127&n}}return{cls:n,primitive:i,tag:r,tagStr:s.tag[r]}}function p(e,t,r){let n=e.readUInt8(r);if(e.isError(n))return n;if(!t&&128===n)return null;if(!(128&n))return n;const i=127&n;if(i>4)return e.error("length octect is too long");n=0;for(let t=0;t<i;t++){n<<=8;const t=e.readUInt8(r);if(e.isError(t))return t;n|=t}return n}a.prototype.decode=function(e,t){return i.isDecoderBuffer(e)||(e=new i(e,t)),this.tree._decode(e,t)},n(c,o),c.prototype._peekTag=function(e,t,r){if(e.isEmpty())return!1;const n=e.save(),i=u(e,`Failed to peek tag: "${t}"`);return e.isError(i)?i:(e.restore(n),i.tag===t||i.tagStr===t||i.tagStr+"of"===t||r)},c.prototype._decodeTag=function(e,t,r){const n=u(e,`Failed to decode tag of "${t}"`);if(e.isError(n))return n;let i=p(e,n.primitive,`Failed to get length of "${t}"`);if(e.isError(i))return i;if(!r&&n.tag!==t&&n.tagStr!==t&&n.tagStr+"of"!==t)return e.error(`Failed to match tag: "${t}"`);if(n.primitive||null!==i)return e.skip(i,`Failed to match body of: "${t}"`);const o=e.save(),s=this._skipUntilEnd(e,`Failed to skip indefinite length body: "${this.tag}"`);return e.isError(s)?s:(i=e.offset-o.offset,e.restore(o),e.skip(i,`Failed to match body of: "${t}"`))},c.prototype._skipUntilEnd=function(e,t){for(;;){const r=u(e,t);if(e.isError(r))return r;const n=p(e,r.primitive,t);if(e.isError(n))return n;let i;if(i=r.primitive||null!==n?e.skip(n):this._skipUntilEnd(e,t),e.isError(i))return i;if("end"===r.tagStr)break}},c.prototype._decodeList=function(e,t,r,n){const i=[];for(;!e.isEmpty();){const t=this._peekTag(e,"end");if(e.isError(t))return t;const o=r.decode(e,"der",n);if(e.isError(o)&&t)break;i.push(o)}return i},c.prototype._decodeStr=function(e,t){if("bitstr"===t){const t=e.readUInt8();return e.isError(t)?t:{unused:t,data:e.raw()}}if("bmpstr"===t){const t=e.raw();if(t.length%2==1)return e.error("Decoding of string type: bmpstr length mismatch");let r="";for(let e=0;e<t.length/2;e++)r+=String.fromCharCode(t.readUInt16BE(2*e));return r}if("numstr"===t){const t=e.raw().toString("ascii");return this._isNumstr(t)?t:e.error("Decoding of string type: numstr unsupported characters")}if("octstr"===t)return e.raw();if("objDesc"===t)return e.raw();if("printstr"===t){const t=e.raw().toString("ascii");return this._isPrintstr(t)?t:e.error("Decoding of string type: printstr unsupported characters")}return/str$/.test(t)?e.raw().toString():e.error(`Decoding of string type: ${t} unsupported`)},c.prototype._decodeObjid=function(e,t,r){let n;const i=[];let o=0,s=0;for(;!e.isEmpty();)s=e.readUInt8(),o<<=7,o|=127&s,128&s||(i.push(o),o=0);128&s&&i.push(o);const a=i[0]/40|0,c=i[0]%40;if(n=r?i:[a,c].concat(i.slice(1)),t){let e=t[n.join(" ")];void 0===e&&(e=t[n.join(".")]),void 0!==e&&(n=e)}return n},c.prototype._decodeTime=function(e,t){const r=e.raw().toString();let n,i,o,s,a,c;if("gentime"===t)n=0|r.slice(0,4),i=0|r.slice(4,6),o=0|r.slice(6,8),s=0|r.slice(8,10),a=0|r.slice(10,12),c=0|r.slice(12,14);else{if("utctime"!==t)return e.error(`Decoding ${t} time is not supported yet`);n=0|r.slice(0,2),i=0|r.slice(2,4),o=0|r.slice(4,6),s=0|r.slice(6,8),a=0|r.slice(8,10),c=0|r.slice(10,12),n=n<70?2e3+n:1900+n}return Date.UTC(n,i-1,o,s,a,c,0)},c.prototype._decodeNull=function(){return null},c.prototype._decodeBool=function(e){const t=e.readUInt8();return e.isError(t)?t:0!==t},c.prototype._decodeInt=function(e,t){const r=e.raw();let n=BigInt(`0x${r.toString("hex")}`);return t&&(n=t[n.toString(10)]||n),n},c.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getDecoder("der").tree},e.exports=a},560:(e,t,r)=>{"use strict";const n=r(3908);e.exports=(e,t,r)=>new n(e,r).compare(new n(t,r))},720:(e,t,r)=>{const{improvedDH:n}=r(7580);if(n){const{diffieHellman:t}=r(6982),{KeyObject:n}=r(2805),i=r(876);e.exports=({keyObject:e},r)=>(r instanceof n||({keyObject:r}=i(r)),t({privateKey:e,publicKey:r}))}else{const{createECDH:t,constants:{POINT_CONVERSION_UNCOMPRESSED:n}}=r(6982),i=r(6204),o=e=>{switch(e){case"P-256":return"prime256v1";case"P-384":return"secp384r1";case"P-521":return"secp521r1"}},s=Buffer.alloc(1,n),a=(e,t)=>Buffer.concat([s,i.decodeToBuffer(e),i.decodeToBuffer(t)]);e.exports=({crv:e,d:r},{x:n,y:s})=>{const c=o(e),u=t(c);return u.setPrivateKey(i.decodeToBuffer(r)),u.computeSecret(a(n,s))}}},736:(e,t,r)=>{e.exports=function(e){function t(e){let r,i,o,s=null;function a(...e){if(!a.enabled)return;const n=a,i=Number(new Date),o=i-(r||i);n.diff=o,n.prev=r,n.curr=i,r=i,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let s=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(r,i)=>{if("%%"===r)return"%";s++;const o=t.formatters[i];if("function"==typeof o){const t=e[s];r=o.call(n,t),e.splice(s,1),s--}return r}),t.formatArgs.call(n,e),(n.log||t.log).apply(n,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=n,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==s?s:(i!==t.namespaces&&(i=t.namespaces,o=t.enabled(e)),o),set:e=>{s=e}}),"function"==typeof t.init&&t.init(a),a}function n(e,r){const n=t(this.namespace+(void 0===r?":":r)+e);return n.log=this.log,n}function i(e,t){let r=0,n=0,i=-1,o=0;for(;r<e.length;)if(n<t.length&&(t[n]===e[r]||"*"===t[n]))"*"===t[n]?(i=n,o=r,n++):(r++,n++);else{if(-1===i)return!1;n=i+1,o++,r=o}for(;n<t.length&&"*"===t[n];)n++;return n===t.length}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){const e=[...t.names,...t.skips.map(e=>"-"+e)].join(",");return t.enable(""),e},t.enable=function(e){t.save(e),t.namespaces=e,t.names=[],t.skips=[];const r=("string"==typeof e?e:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const e of r)"-"===e[0]?t.skips.push(e.slice(1)):t.names.push(e)},t.enabled=function(e){for(const r of t.skips)if(i(e,r))return!1;for(const r of t.names)if(i(e,r))return!0;return!1},t.humanize=r(6585),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach(r=>{t[r]=e[r]}),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return t.colors[Math.abs(r)%t.colors.length]},t.enable(t.load()),t}},769:(e,t,r)=>{const{createSign:n,createVerify:i,constants:o}=r(6982),{KEYOBJECT:s}=r(3146),a=r(7791),{asInput:c}=r(2805),u=(e,{[s]:t},r)=>{const i=c(t,!1);return n(e).update(r).sign({key:i,padding:o.RSA_PKCS1_PSS_PADDING,saltLength:o.RSA_PSS_SALTLEN_DIGEST})},p=(e,{[s]:t},r,n)=>{const a=c(t,!0);return i(e).update(r).verify({key:a,padding:o.RSA_PKCS1_PSS_PADDING,saltLength:o.RSA_PSS_SALTLEN_DIGEST},n)},l={PS256:528,PS384:784,PS512:1040};e.exports=(e,t)=>{["PS256","PS384","PS512"].forEach(r=>{const n=a(r);e.sign.set(r,u.bind(void 0,n)),e.verify.set(r,p.bind(void 0,n)),t.RSA.sign[r]=e=>e.private&&t.RSA.verify[r](e),t.RSA.verify[r]=e=>("sig"===e.use||void 0===e.use)&&e.length>=l[r]})}},855:(e,t,r)=>{var n=r(6585);e.exports=function(e,t){var r=t||Math.floor(Date.now()/1e3);if("string"==typeof e){var i=n(e);if(void 0===i)return;return Math.floor(r+i/1e3)}return"number"==typeof e?r+e:void 0}},857:e=>{"use strict";e.exports=require("os")},876:(e,t,r)=>{const{createPublicKey:n,createPrivateKey:i,createSecretKey:o,KeyObject:s}=r(2805),a=r(6204),c=r(226),{jwkToPem:u}=r(4297),p=r(8083),l=r(3943),f=r(6437),h=r(4043),d=r(6887),y=new Set(["string","buffer","object"]),g=(e={},t={})=>({alg:t.alg,key_ops:t.key_ops,kid:t.kid,use:t.use,x5c:t.x5c,x5t:t.x5t,"x5t#S256":t["x5t#S256"],...e}),m=/^[a-zA-Z0-9-]+ AAAA(?:[0-9A-Za-z+/])+(?:==|=)?(?: .*)?$/;e.exports=(e,t,{calculateMissingRSAPrimes:r=!1}={})=>{let v,E,b;if(!y.has(typeof e))throw new TypeError("key argument must be a string, buffer or an object");if(void 0!==t&&!c(t))throw new TypeError("parameters argument must be a plain object when provided");if(e instanceof s)switch(e.type){case"private":v=e;break;case"public":E=e;break;case"secret":b=e}else if("object"==typeof e&&e&&"kty"in e&&"oct"===e.kty){try{b=o(a.decodeToBuffer(e.k))}catch(t){"k"in e||(b={type:"secret"})}t=g(t,e)}else if("object"==typeof e&&e&&"kty"in e){let o;({calculateMissingRSAPrimes:r=!1}=t||{calculateMissingRSAPrimes:r});try{o=u(e,{calculateMissingRSAPrimes:r})}catch(e){if(e instanceof p.JOSEError)throw e}o&&e.d?v=i(o):o&&(E=n(o)),t=g({},e)}else if(e&&("object"==typeof e||"string"==typeof e)){try{v=i(e)}catch(e){if(e instanceof p.JOSEError)throw e}try{E=n(e),!e.startsWith("-----BEGIN CERTIFICATE-----")||t&&"x5c"in t||(t=g(t,{x5c:[e.replace(/(?:-----(?:BEGIN|END) CERTIFICATE-----|\s)/g,"")]}))}catch(e){if(e instanceof p.JOSEError)throw e}try{e.includes("-----BEGIN")||m.test(e.toString("ascii").replace(/[\r\n]/g,""))||(b=o(Buffer.isBuffer(e)?e:Buffer.from(e)))}catch(e){}}const w=v||E||b;if(v||E)switch(w.asymmetricKeyType){case"rsa":return new l(w,t);case"ec":return new f(w,t);case"ed25519":case"ed448":case"x25519":case"x448":return new h(w,t);default:throw new p.JOSENotSupported("only RSA, EC and OKP asymmetric keys are supported")}else if(b)return new d(w,t);throw new p.JWKImportFailed("key import failed")}},909:(e,t,r)=>{"use strict";const n=r(3908);e.exports=(e,t,r)=>{const i=new n(e,r),o=new n(t,r);return i.compare(o)||i.compareBuild(o)}},947:e=>{function t(e){Error.call(this,e),Error.captureStackTrace(this,this.constructor),this.name="ArgumentError",this.message=e}t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,e.exports=t},1033:(e,t,r)=>{const{publicEncrypt:n,privateDecrypt:i,constants:o}=r(6982),{oaepHashSupported:s}=r(7580),{KEYOBJECT:a}=r(3146),{asInput:c}=r(2805),u=(e,t,{[a]:r},i)=>{const o=c(r,!0);return{wrapped:n({key:o,oaepHash:t,padding:e},i)}},p=(e,t,{[a]:r},n)=>{const o=c(r,!1);return i({key:o,oaepHash:t,padding:e},n)},l={RSA1_5:0,"RSA-OAEP":592,"RSA-OAEP-256":784,"RSA-OAEP-384":1040,"RSA-OAEP-512":1296};e.exports=(e,t)=>{const r=["RSA-OAEP","RSA1_5"];s&&r.splice(1,0,"RSA-OAEP-256","RSA-OAEP-384","RSA-OAEP-512"),r.forEach(r=>{const n=(e=>{switch(e){case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":return o.RSA_PKCS1_OAEP_PADDING;case"RSA1_5":return o.RSA_PKCS1_PADDING}})(r),i=(e=>{switch(e){case"RSA-OAEP":return"sha1";case"RSA-OAEP-256":return"sha256";case"RSA-OAEP-384":return"sha384";case"RSA-OAEP-512":return"sha512";default:return}})(r);e.keyManagementEncrypt.set(r,u.bind(void 0,n,i)),e.keyManagementDecrypt.set(r,p.bind(void 0,n,i)),t.RSA.wrapKey[r]=e=>("enc"===e.use||void 0===e.use)&&e.length>=l[r],t.RSA.unwrapKey[r]=e=>e.private&&("enc"===e.use||void 0===e.use)&&e.length>=l[r]})}},1045:(e,t,r)=>{"use strict";var n=r(181).Buffer,i=r(181).SlowBuffer;function o(e,t){if(!n.isBuffer(e)||!n.isBuffer(t))return!1;if(e.length!==t.length)return!1;for(var r=0,i=0;i<e.length;i++)r|=e[i]^t[i];return 0===r}e.exports=o,o.install=function(){n.prototype.equal=i.prototype.equal=function(e){return o(this,e)}};var s=n.prototype.equal,a=i.prototype.equal;o.restore=function(){n.prototype.equal=s,i.prototype.equal=a}},1123:e=>{"use strict";const t=/^[0-9]+$/,r=(e,r)=>{const n=t.test(e),i=t.test(r);return n&&i&&(e=+e,r=+r),e===r?0:n&&!i?-1:i&&!n?1:e<r?-1:1};e.exports={compareIdentifiers:r,rcompareIdentifiers:(e,t)=>r(t,e)}},1161:e=>{function t(e){Error.call(this,e),Error.captureStackTrace(this,this.constructor),this.name="JwksError",this.message=e}t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,e.exports=t},1261:(e,t,r)=>{"use strict";const n=r(3908),i=r(8311),o=r(5580);e.exports=(e,t)=>{e=new i(e,t);let r=new n("0.0.0");if(e.test(r))return r;if(r=new n("0.0.0-0"),e.test(r))return r;r=null;for(let t=0;t<e.set.length;++t){const i=e.set[t];let s=null;i.forEach(e=>{const t=new n(e.semver.version);switch(e.operator){case">":0===t.prerelease.length?t.patch++:t.prerelease.push(0),t.raw=t.format();case"":case">=":s&&!o(t,s)||(s=t);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${e.operator}`)}}),!s||r&&!o(r,s)||(r=s)}return r&&e.test(r)?r:null}},1276:(e,t,r)=>{const n=r(6204),i=r(8253),o=r(226),s=r(8290),{JWSInvalid:a}=r(8083),{sign:c}=r(8847),u=r(9096),p=r(6604),l=Symbol("PROCESS_RECIPIENT");e.exports=class{constructor(e){if("string"==typeof e)e=n.encode(e);else if(Buffer.isBuffer(e))e=n.encodeBuffer(e),this._binary=!0;else{if(!o(e))throw new TypeError("payload argument must be a Buffer, string or an object");e=n.JSON.encode(e)}this._payload=e,this._recipients=[]}recipient(e,t,r){if(e=u(e),void 0!==t&&!o(t))throw new TypeError("protectedHeader argument must be a plain object when provided");if(void 0!==r&&!o(r))throw new TypeError("unprotectedHeader argument must be a plain object when provided");if(!i(t,r))throw new a("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");return this._recipients.push({key:e,protectedHeader:t?s(t):void 0,unprotectedHeader:r?s(r):void 0}),this}[l](e,t){const{key:r,protectedHeader:i,unprotectedHeader:o}=e;if("enc"===r.use)throw new TypeError('a key with "use":"enc" is not usable for signing');const s={protected:i||{},unprotected:o||{}};let u=s.protected.alg||s.unprotected.alg;if(u||(u=r.alg||[...r.algorithms("sign")][0],e.protectedHeader?s.protected.alg=e.protectedHeader.alg=u:s.protected=e.protectedHeader={alg:u}),!u)throw new a('could not resolve a usable "alg" for a recipient');e.header=o,e.protected=Object.keys(s.protected).length?n.JSON.encode(s.protected):"",t&&s.protected.crit&&s.protected.crit.includes("b64")&&!1===s.protected.b64&&(this._binary?this._payload=n.decodeToBuffer(this._payload):this._payload=n.decode(this._payload));const p=Buffer.concat([Buffer.from(e.protected||""),Buffer.from("."),Buffer.from(this._payload)]);e.signature=n.encodeBuffer(c(u,r,p))}sign(e){const t=p[e];if(!t)throw new TypeError('serialization must be one of "compact", "flattened", "general"');if(!this._recipients.length)throw new a("missing recipients");return t.validate(this,this._recipients),this._recipients.forEach((e,t)=>{this[l](e,0===t)}),t(this._payload,this._recipients)}}},1389:(e,t,r)=>{const n=r(5753)("jwks"),i=r(8639),{promisify:o,callbackify:s}=r(9023);e.exports.A=function(e,{cacheMaxEntries:t=5,cacheMaxAge:r=6e5}){return n(`Configured caching of signing keys. Max: ${t} / Age: ${r}`),o(i({hash:e=>e,load:s(e.getSigningKey.bind(e)),maxAge:r,max:t}))}},1549:(e,t,r)=>{const{randomBytes:n}=r(6982),i=r(6204),o=r(8083),s=BigInt(0),a=BigInt(1),c=BigInt(2),u=e=>{const t=e.toString(16);return i.encodeBuffer(Buffer.from(t.length%2?`0${t}`:t,"hex"))},p=e=>BigInt(`0x${e.toString("hex")}`),l=(e,t,r)=>{e=d(e,r);let n=a,i=e;for(;t>0;){const e=t%c;t/=c,e===a&&(n*=i,n%=r),i*=i,i%=r}return n},f=(e,t)=>{const r=t-e,n=r.toString(2).length;let i;do{i=p(h(n))}while(i>r);return i+e},h=e=>{const t=Math.ceil(e/8),r=n(t);return r[0]=r[0]&2**(e%8)-1,r},d=(e,t)=>(e%=t)<0?e+t:e;e.exports=e=>{const t=p(i.decodeToBuffer(e.e)),r=p(i.decodeToBuffer(e.d)),n=p(i.decodeToBuffer(e.n));if(r>=n)throw new o.JWKInvalid("invalid RSA private exponent");const{p:h,q:y}=((e,t,r)=>{const n=(e=>{let t=e;for(;t%c===s;)t/=c;return t})(e*t-a);let i,u=0;do{if(u++,30===u)throw new o.JWKImportFailed("failed to calculate missing primes");let e=0,t=l(f(c,r),n,r),p=s;for(;t!==a;){if(e++,22===e)throw new o.JWKImportFailed("failed to calculate missing primes");p=t,t=t*t%r}p!==r-a&&(i=p)}while(!i);const p=((e,t)=>{let r=s;for(;!((e|t)&a);)e>>=a,t>>=a,r++;for(;!(e&a);)e>>=a;do{for(;!(t&a);)t>>=a;if(e>t){const r=e;e=t,t=r}t-=e}while(t);return e<<r})(i-a,r),h=r/p;return p>h?{p,q:h}:{p:h,q:p}})(t,r,n),g=r%(h-a),m=r%(y-a),v=d(((e,t)=>{let r=s,n=a,i=a,o=s;for(;e!==s;){const s=t/e,a=t%e,c=r-i*s,u=n-o*s;t=e,e=a,r=i,n=o,i=c,o=u}return r})(d(y,h),h),h);return{...e,p:u(h),q:u(y),dp:u(g),dq:u(m),qi:u(v)}}},1603:e=>{e.exports={"1 2 840 10045 3 1 7":"P-256","1 3 132 0 10":"secp256k1","1 3 132 0 34":"P-384","1 3 132 0 35":"P-521","1 2 840 10045 2 1":"ecPublicKey","1 2 840 113549 1 1 1":"rsaEncryption","1 3 101 110":"X25519","1 3 101 111":"X448","1 3 101 112":"Ed25519","1 3 101 113":"Ed448"}},1691:(e,t,r)=>{const n=r(1741),i=r(3726),o=r(8980),s=r(7260),a=r(855),c=r(7019),u=r(4977),p=r(5747),{KeyObject:l,createSecretKey:f,createPublicKey:h}=r(6982),d=["RS256","RS384","RS512"],y=["ES256","ES384","ES512"],g=["RS256","RS384","RS512"],m=["HS256","HS384","HS512"];u&&(d.splice(d.length,0,"PS256","PS384","PS512"),g.splice(g.length,0,"PS256","PS384","PS512")),e.exports=function(e,t,r,u){let v;if("function"!=typeof r||u||(u=r,r={}),r||(r={}),r=Object.assign({},r),v=u||function(e,t){if(e)throw e;return t},r.clockTimestamp&&"number"!=typeof r.clockTimestamp)return v(new n("clockTimestamp must be a number"));if(void 0!==r.nonce&&("string"!=typeof r.nonce||""===r.nonce.trim()))return v(new n("nonce must be a non-empty string"));if(void 0!==r.allowInvalidAsymmetricKeyTypes&&"boolean"!=typeof r.allowInvalidAsymmetricKeyTypes)return v(new n("allowInvalidAsymmetricKeyTypes must be a boolean"));const E=r.clockTimestamp||Math.floor(Date.now()/1e3);if(!e)return v(new n("jwt must be provided"));if("string"!=typeof e)return v(new n("jwt must be a string"));const b=e.split(".");if(3!==b.length)return v(new n("jwt malformed"));let w;try{w=s(e,{complete:!0})}catch(e){return v(e)}if(!w)return v(new n("invalid token"));const S=w.header;let k;if("function"==typeof t){if(!u)return v(new n("verify must be called asynchronous if secret or public key is provided as a callback"));k=t}else k=function(e,r){return r(null,t)};return k(S,function(t,s){if(t)return v(new n("error in secret or public key callback: "+t.message));const u=""!==b[2].trim();if(!u&&s)return v(new n("jwt signature is required"));if(u&&!s)return v(new n("secret or public key must be provided"));if(!u&&!r.algorithms)return v(new n('please specify "none" in "algorithms" to verify unsigned tokens'));if(null!=s&&!(s instanceof l))try{s=h(s)}catch(e){try{s=f("string"==typeof s?Buffer.from(s):s)}catch(e){return v(new n("secretOrPublicKey is not valid key material"))}}if(r.algorithms||("secret"===s.type?r.algorithms=m:["rsa","rsa-pss"].includes(s.asymmetricKeyType)?r.algorithms=g:"ec"===s.asymmetricKeyType?r.algorithms=y:r.algorithms=d),-1===r.algorithms.indexOf(w.header.alg))return v(new n("invalid algorithm"));if(S.alg.startsWith("HS")&&"secret"!==s.type)return v(new n(`secretOrPublicKey must be a symmetric key when using ${S.alg}`));if(/^(?:RS|PS|ES)/.test(S.alg)&&"public"!==s.type)return v(new n(`secretOrPublicKey must be an asymmetric key when using ${S.alg}`));if(!r.allowInvalidAsymmetricKeyTypes)try{c(S.alg,s)}catch(e){return v(e)}let k;try{k=p.verify(e,w.header.alg,s)}catch(e){return v(e)}if(!k)return v(new n("invalid signature"));const _=w.payload;if(void 0!==_.nbf&&!r.ignoreNotBefore){if("number"!=typeof _.nbf)return v(new n("invalid nbf value"));if(_.nbf>E+(r.clockTolerance||0))return v(new i("jwt not active",new Date(1e3*_.nbf)))}if(void 0!==_.exp&&!r.ignoreExpiration){if("number"!=typeof _.exp)return v(new n("invalid exp value"));if(E>=_.exp+(r.clockTolerance||0))return v(new o("jwt expired",new Date(1e3*_.exp)))}if(r.audience){const e=Array.isArray(r.audience)?r.audience:[r.audience];if(!(Array.isArray(_.aud)?_.aud:[_.aud]).some(function(t){return e.some(function(e){return e instanceof RegExp?e.test(t):e===t})}))return v(new n("jwt audience invalid. expected: "+e.join(" or ")))}if(r.issuer&&("string"==typeof r.issuer&&_.iss!==r.issuer||Array.isArray(r.issuer)&&-1===r.issuer.indexOf(_.iss)))return v(new n("jwt issuer invalid. expected: "+r.issuer));if(r.subject&&_.sub!==r.subject)return v(new n("jwt subject invalid. expected: "+r.subject));if(r.jwtid&&_.jti!==r.jwtid)return v(new n("jwt jwtid invalid. expected: "+r.jwtid));if(r.nonce&&_.nonce!==r.nonce)return v(new n("jwt nonce invalid. expected: "+r.nonce));if(r.maxAge){if("number"!=typeof _.iat)return v(new n("iat required when maxAge is specified"));const e=a(r.maxAge,_.iat);if(void 0===e)return v(new n('"maxAge" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'));if(E>=e+(r.clockTolerance||0))return v(new o("maxAge exceeded",new Date(1e3*e)))}if(!0===r.complete){const e=w.signature;return v(null,{header:S,payload:_,signature:e})}return v(null,_)})}},1706:(e,t,r)=>{const{deflateRawSync:n}=r(3106),{KEYOBJECT:i}=r(3146),o=r(8399),s=r(6204),a=r(9096),c=r(226),{createSecretKey:u}=r(2805),p=r(8290),l=r(876),{JWEInvalid:f}=r(8083),{check:h,keyManagementEncrypt:d,encrypt:y}=r(8847),g=r(8678),m=r(7734),v=r(9648),E=Symbol("PROCESS_RECIPIENT");e.exports=class{constructor(e,t,r,n){if(!Buffer.isBuffer(e)&&"string"!=typeof e)throw new TypeError("cleartext argument must be a Buffer or a string");if(e=Buffer.from(e),void 0!==r&&!Buffer.isBuffer(r)&&"string"!=typeof r)throw new TypeError("aad argument must be a Buffer or a string when provided");if(r=r?Buffer.from(r):void 0,void 0!==t&&!c(t))throw new TypeError("protectedHeader argument must be a plain object when provided");if(void 0!==n&&!c(n))throw new TypeError("unprotectedHeader argument must be a plain object when provided");this._recipients=[],this._cleartext=e,this._aad=r,this._unprotected=n?p(n):void 0,this._protected=t?p(t):void 0}recipient(e,t){if(e=a(e),void 0!==t&&!c(t))throw new TypeError("header argument must be a plain object when provided");return this._recipients.push({key:e,header:t?p(t):void 0}),this}[E](e){const t=this._unprotected,r=this._protected,{length:n}=this._recipients,o={...r,...t,...e.header},{key:a}=e,c=o.enc;let p,y,g=o.alg;if("sig"===a.use)throw new TypeError('a key with "use":"sig" is not usable for encryption');if("dir"===g)h(a,"encrypt",c);else if(g)h(a,"keyManagementEncrypt",g);else{if(g=a.alg||[...a.algorithms("wrapKey")][0]||[...a.algorithms("deriveKey")][0],"ECDH-ES"===g&&1!==n&&(g=[...a.algorithms("deriveKey")][1]),!g)throw new f('could not resolve a usable "alg" for a recipient');1===n?r?r.alg=g:this._protected={alg:g}:e.header?e.header.alg=g:e.header={alg:g}}"oct"===a.kty&&"dir"===g?this._cek=l(a[i],{use:"enc",alg:c}):(h(this._cek,"encrypt",c),({wrapped:p,header:y}=d(g,a,this._cek[i].export(),{enc:c,alg:g})),"ECDH-ES"===g&&(this._cek=l(u(p),{use:"enc",alg:c}))),e.encrypted_key="dir"===g||"ECDH-ES"===g?"":s.encodeBuffer(p),y&&(e.generatedHeader=y)}encrypt(e){const t=g[e];if(!t)throw new TypeError('serialization must be one of "compact", "flattened", "general"');if(!this._recipients.length)throw new f("missing recipients");t.validate(this._protected,this._unprotected,this._aad,this._recipients);let r=v(this._protected,this._unprotected,this._recipients,!1,this._protected?this._protected.crit:void 0);r||(r="A128CBC-HS256",this._protected?this._protected.enc=r:this._protected={enc:r});const i={};this._cek=m(r);for(const e of this._recipients)this[E](e);const a=o(r);if(i.iv=s.encodeBuffer(a),1===this._recipients.length&&this._recipients[0].generatedHeader){const[{generatedHeader:e}]=this._recipients;delete this._recipients[0].generatedHeader,this._protected={...this._protected,...e}}let c;this._protected&&(i.protected=s.JSON.encode(this._protected)),i.unprotected=this._unprotected,this._aad?(i.aad=s.encode(this._aad),c=Buffer.concat([Buffer.from(i.protected||""),Buffer.from("."),Buffer.from(i.aad)])):c=Buffer.from(i.protected||"");let u=this._cleartext;this._protected&&"zip"in this._protected&&(u=n(u));const{ciphertext:p,tag:l}=y(r,this._cek,u,{iv:a,aad:c});return i.tag=s.encodeBuffer(l),i.ciphertext=s.encodeBuffer(p),t(i,this._recipients)}}},1729:(e,t,r)=>{"use strict";const n=r(144);e.exports=(e,t)=>{const r=n(e,t);return r&&r.prerelease.length?r.prerelease:null}},1741:e=>{var t=function(e,t){Error.call(this,e),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name="JsonWebTokenError",this.message=e,t&&(this.inner=t)};(t.prototype=Object.create(Error.prototype)).constructor=t,e.exports=t},1763:(e,t,r)=>{"use strict";const n=r(560);e.exports=(e,t)=>n(e,t,!0)},1832:(e,t,r)=>{"use strict";const n=r(144);e.exports=(e,t)=>{const r=n(e,null,!0),i=n(t,null,!0),o=r.compare(i);if(0===o)return null;const s=o>0,a=s?r:i,c=s?i:r,u=!!a.prerelease.length;if(c.prerelease.length&&!u){if(!c.patch&&!c.minor)return"major";if(0===c.compareMain(a))return c.minor&&!c.patch?"minor":"patch"}const p=u?"pre":"";return r.major!==i.major?p+"major":r.minor!==i.minor?p+"minor":r.patch!==i.patch?p+"patch":"prerelease"}},1977:(e,t,r)=>{const n=r(9589);e.exports=n.satisfies(process.version,">=15.7.0")},2010:(e,t,r)=>{"use strict";var n=r(2861).Buffer,i=r(3527);function o(e){if(n.isBuffer(e))return e;if("string"==typeof e)return n.from(e,"base64");throw new TypeError("ECDSA signature must be a Base64 string or a Buffer")}function s(e,t,r){for(var n=0;t+n<r&&0===e[t+n];)++n;return e[t+n]>=128&&--n,n}e.exports={derToJose:function(e,t){e=o(e);var r=i(t),s=r+1,a=e.length,c=0;if(48!==e[c++])throw new Error('Could not find expected "seq"');var u=e[c++];if(129===u&&(u=e[c++]),a-c<u)throw new Error('"seq" specified length of "'+u+'", only "'+(a-c)+'" remaining');if(2!==e[c++])throw new Error('Could not find expected "int" for "r"');var p=e[c++];if(a-c-2<p)throw new Error('"r" specified length of "'+p+'", only "'+(a-c-2)+'" available');if(s<p)throw new Error('"r" specified length of "'+p+'", max of "'+s+'" is acceptable');var l=c;if(c+=p,2!==e[c++])throw new Error('Could not find expected "int" for "s"');var f=e[c++];if(a-c!==f)throw new Error('"s" specified length of "'+f+'", expected "'+(a-c)+'"');if(s<f)throw new Error('"s" specified length of "'+f+'", max of "'+s+'" is acceptable');var h=c;if((c+=f)!==a)throw new Error('Expected to consume entire buffer, but "'+(a-c)+'" bytes remain');var d=r-p,y=r-f,g=n.allocUnsafe(d+p+y+f);for(c=0;c<d;++c)g[c]=0;e.copy(g,c,l+Math.max(-d,0),l+p);for(var m=c=r;c<m+y;++c)g[c]=0;return e.copy(g,c,h+Math.max(-y,0),h+f),(g=g.toString("base64")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")},joseToDer:function(e,t){e=o(e);var r=i(t),a=e.length;if(a!==2*r)throw new TypeError('"'+t+'" signatures must be "'+2*r+'" bytes, saw "'+a+'"');var c=s(e,0,r),u=s(e,r,e.length),p=r-c,l=r-u,f=2+p+1+1+l,h=f<128,d=n.allocUnsafe((h?2:3)+f),y=0;return d[y++]=48,h?d[y++]=f:(d[y++]=129,d[y++]=255&f),d[y++]=2,d[y++]=p,c<0?(d[y++]=0,y+=e.copy(d,y,0,r)):y+=e.copy(d,y,c,r),d[y++]=2,d[y++]=l,u<0?(d[y++]=0,e.copy(d,y,r)):e.copy(d,y,r+u),d}}},2018:e=>{"use strict";e.exports=require("tty")},2023:(e,t,r)=>{const n=r(8399),i=r(6204);e.exports=(e,t)=>{["A128GCMKW","A192GCMKW","A256GCMKW"].forEach(r=>{const o=r.substr(0,7),s=parseInt(r.substr(1,3),10),a=e.encrypt.get(o),c=e.decrypt.get(o);a&&c&&(e.keyManagementEncrypt.set(r,(e,t)=>{const o=n(r),{ciphertext:s,tag:c}=a(e,t,{iv:o});return{wrapped:s,header:{tag:i.encodeBuffer(c),iv:i.encodeBuffer(o)}}}),e.keyManagementDecrypt.set(r,c),t.oct.wrapKey[r]=t.oct.unwrapKey[r]=e=>("enc"===e.use||void 0===e.use)&&e.length===s)})}},2028:e=>{const t=e=>(e/8|0)+(e%8==0?0:1),r={ES256:t(256),ES256K:t(256),ES384:t(384),ES512:t(521)},n=(e,t,r)=>{let n=0;for(;t+n<r&&0===e[t+n];)++n;return e[t+n]>=128&&--n,n};e.exports.derToJose=(e,t)=>{if(!Buffer.isBuffer(e))throw new TypeError("ECDSA signature must be a Buffer");if(!r[t])throw new Error(`Unknown algorithm "${t}"`);const n=r[t],i=n+1,o=e.length;let s=0;if(48!==e[s++])throw new Error('Could not find expected "seq"');let a=e[s++];if(129===a&&(a=e[s++]),o-s<a)throw new Error(`"seq" specified length of ${a}", only ${o-s}" remaining`);if(2!==e[s++])throw new Error('Could not find expected "int" for "r"');const c=e[s++];if(o-s-2<c)throw new Error(`"r" specified length of "${c}", only "${o-s-2}" available`);if(i<c)throw new Error(`"r" specified length of "${c}", max of "${i}" is acceptable`);const u=s;if(s+=c,2!==e[s++])throw new Error('Could not find expected "int" for "s"');const p=e[s++];if(o-s!==p)throw new Error(`"s" specified length of "${p}", expected "${o-s}"`);if(i<p)throw new Error(`"s" specified length of "${p}", max of "${i}" is acceptable`);const l=s;if(s+=p,s!==o)throw new Error(`Expected to consume entire buffer, but "${o-s}" bytes remain`);const f=n-c,h=n-p,d=Buffer.allocUnsafe(f+c+h+p);for(s=0;s<f;++s)d[s]=0;e.copy(d,s,u+Math.max(-f,0),u+c),s=n;for(const e=s;s<e+h;++s)d[s]=0;return e.copy(d,s,l+Math.max(-h,0),l+p),d},e.exports.joseToDer=(e,t)=>{if(!Buffer.isBuffer(e))throw new TypeError("ECDSA signature must be a Buffer");if(!r[t])throw new TypeError(`Unknown algorithm "${t}"`);const i=r[t],o=e.length;if(o!==2*i)throw new Error(`"${t}" signatures must be "${2*i}" bytes, saw "${o}"`);const s=n(e,0,i),a=n(e,i,e.length),c=i-s,u=i-a,p=2+c+1+1+u,l=p<128,f=Buffer.allocUnsafe((l?2:3)+p);let h=0;return f[h++]=48,l?f[h++]=p:(f[h++]=129,f[h++]=255&p),f[h++]=2,f[h++]=c,s<0?(f[h++]=0,h+=e.copy(f,h,0,i)):h+=e.copy(f,h,s,i),f[h++]=2,f[h++]=u,a<0?(f[h++]=0,e.copy(f,h,i)):e.copy(f,h,i+a),f}},2035:e=>{e.exports=function(){this.octstr().contains().obj(this.key("privateKey").octstr())}},2075:(e,t,r)=>{const n=r(1706),i=r(8770),o=(e,t,r,i,o,s)=>new n(t,i,o,s).recipient(r).encrypt(e);e.exports.Encrypt=n,e.exports.encrypt=o.bind(void 0,"compact"),e.exports.encrypt.flattened=o.bind(void 0,"flattened"),e.exports.encrypt.general=o.bind(void 0,"general"),e.exports.decrypt=i},2111:(e,t,r)=>{"use strict";const n=r(4641),i=r(3999),o=r(5580),s=r(4089),a=r(7059),c=r(5200);e.exports=(e,t,r,u)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e===r;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e!==r;case"":case"=":case"==":return n(e,r,u);case"!=":return i(e,r,u);case">":return o(e,r,u);case">=":return s(e,r,u);case"<":return a(e,r,u);case"<=":return c(e,r,u);default:throw new TypeError(`Invalid operator: ${t}`)}}},2193:(e,t,r)=>{const{createCipheriv:n,createDecipheriv:i,getCiphers:o}=r(6982),{KEYOBJECT:s}=r(3146),{JWEInvalid:a,JWEDecryptionFailed:c}=r(8083),{asInput:u}=r(2805),p=function(e,t,r){if(12!==t.length)throw new a("invalid iv");if(3===arguments.length&&16!==r.length)throw new a("invalid tag")},l=(e,{[s]:t},r,{iv:i,aad:o=Buffer.alloc(0)})=>{const a=u(t,!1);p(e,i);const c=n(`aes-${e}-gcm`,a,i,{authTagLength:16});return c.setAAD(o),{ciphertext:Buffer.concat([c.update(r),c.final()]),tag:c.getAuthTag()}},f=(e,{[s]:t},r,{iv:n,tag:o=Buffer.alloc(0),aad:a=Buffer.alloc(0)})=>{const l=u(t,!1);p(e,n,o);try{const t=i(`aes-${e}-gcm`,l,n,{authTagLength:16});return t.setAuthTag(o),t.setAAD(a),Buffer.concat([t.update(r),t.final()])}catch(e){throw new c}};e.exports=(e,t)=>{["A128GCM","A192GCM","A256GCM"].forEach(r=>{const n=parseInt(r.substr(1,3),10);o().includes(`aes-${n}-gcm`)&&(e.encrypt.set(r,l.bind(void 0,n)),e.decrypt.set(r,f.bind(void 0,n)),t.oct.encrypt[r]=t.oct.decrypt[r]=e=>("enc"===e.use||void 0===e.use)&&e.length===n)})}},2203:e=>{"use strict";e.exports=require("stream")},2244:(e,t,r)=>{const n=r(128),i=r(8911),o=r(4895),s=r(3112);e.exports={sign:i,verify:o,...s},Object.defineProperty(e.exports,"decode",{enumerable:!1,configurable:!0,value:n})},2276:(e,t,r)=>{const{inherits:n}=r(9023),i=r(6325);function o(e){i.call(this,e),this.enc="pem"}n(o,i),o.prototype.encode=function(e,t){const r=i.prototype.encode.call(this,e).toString("base64"),n=[`-----BEGIN ${t.label}-----`];for(let e=0;e<r.length;e+=64)n.push(r.slice(e,e+64));return n.push(`-----END ${t.label}-----`),n.join("\n")},e.exports=o},2300:e=>{e.exports={oct:{decrypt:{},deriveKey:{},encrypt:{},sign:{},unwrapKey:{},verify:{},wrapKey:{}},EC:{decrypt:{},deriveKey:{},encrypt:{},sign:{},unwrapKey:{},verify:{},wrapKey:{}},RSA:{decrypt:{},deriveKey:{},encrypt:{},sign:{},unwrapKey:{},verify:{},wrapKey:{}},OKP:{decrypt:{},deriveKey:{},encrypt:{},sign:{},unwrapKey:{},verify:{},wrapKey:{}}}},2525:(e,t,r)=>{"use strict";const n=r(7638),i=r(560);e.exports=(e,t,r)=>{const o=[];let s=null,a=null;const c=e.sort((e,t)=>i(e,t,r));for(const e of c)n(e,t,r)?(a=e,s||(s=e)):(a&&o.push([s,a]),a=null,s=null);s&&o.push([s,null]);const u=[];for(const[e,t]of o)e===t?u.push(e):t||e!==c[0]?t?e===c[0]?u.push(`<=${t}`):u.push(`${e} - ${t}`):u.push(`>=${e}`):u.push("*");const p=u.join(" || "),l="string"==typeof t.raw?t.raw:String(t);return p.length<l.length?p:t}},2613:e=>{"use strict";e.exports=require("assert")},2677:(e,t,r)=>{const{getCurves:n}=r(6982),i=new Set;n().includes("prime256v1")&&i.add("P-256"),n().includes("secp256k1")&&i.add("secp256k1"),n().includes("secp384r1")&&i.add("P-384"),n().includes("secp521r1")&&i.add("P-521"),e.exports=i},2805:(e,t,r)=>{const{keyObjectSupported:n}=r(7580);let i,o,s,a,c;if(n)({createPublicKey:i,createPrivateKey:o,createSecretKey:s,KeyObject:a}=r(6982)),c=e=>e;else{const{EOL:e}=r(857),t=r(8083),n=r(226),u=r(4804),p=Symbol("toInput"),l=Symbol("namedCurve");c=(e,t)=>e instanceof a?e[p](t):s(e)[p](t);const f=e=>Buffer.from(e.replace(/(?:-----(?:BEGIN|END)(?: (?:RSA|EC))? (?:PRIVATE|PUBLIC) KEY-----|\s)/g,""),"base64"),h=(t,r)=>`-----BEGIN ${r}-----${e}${(t.toString("base64").match(/.{1,64}/g)||[]).join(e)}${e}-----END ${r}-----`,d=e=>{const r="string"==typeof e?e:`OID ${e.join(".")}`;throw new t.JOSENotSupported(`${r} is not supported in your Node.js runtime version`)};a=class{export({cipher:e,passphrase:r,type:n,format:i}={}){if("secret"===this._type)return this._buffer;if("public"===this._type){if("rsa"===this.asymmetricKeyType)switch(n){case"pkcs1":return"pem"===i?this._pem:f(this._pem);case"spki":{const e=u.get("PublicKeyInfo").encode({algorithm:{algorithm:"rsaEncryption",parameters:{type:"null"}},publicKey:{unused:0,data:f(this._pem)}},"pem",{label:"PUBLIC KEY"});return"pem"===i?e:f(e)}default:throw new TypeError(`The value ${n} is invalid for option "type"`)}if("ec"===this.asymmetricKeyType){if("spki"!==n)throw new TypeError(`The value ${n} is invalid for option "type"`);return"pem"===i?this._pem:f(this._pem)}}if("private"===this._type){if(void 0!==r||void 0!==e)throw new t.JOSENotSupported("encrypted private keys are not supported in your Node.js runtime version");if("pkcs8"===n){if(this._pkcs8)return"der"===i&&"string"==typeof this._pkcs8?f(this._pkcs8):"pem"===i&&Buffer.isBuffer(this._pkcs8)?h(this._pkcs8,"PRIVATE KEY"):this._pkcs8;if("rsa"===this.asymmetricKeyType){const e=this._asn1,t=u.get("RSAPrivateKey").encode(e),r=u.get("PrivateKeyInfo").encode({version:0,privateKey:t,algorithm:{algorithm:"rsaEncryption",parameters:{type:"null"}}});return this._pkcs8=r,this.export({type:n,format:i})}if("ec"===this.asymmetricKeyType){const e=this._asn1,t=u.get("ECPrivateKey").encode({version:e.version,privateKey:e.privateKey,publicKey:e.publicKey}),r=u.get("PrivateKeyInfo").encode({version:0,privateKey:t,algorithm:{algorithm:"ecPublicKey",parameters:this._asn1.parameters}});return this._pkcs8=r,this.export({type:n,format:i})}}if("rsa"===this.asymmetricKeyType&&"pkcs1"===n)return"pem"===i?this._pem:f(this._pem);if("ec"===this.asymmetricKeyType&&"sec1"===n)return"pem"===i?this._pem:f(this._pem);throw new TypeError(`The value ${n} is invalid for option "type"`)}}get type(){return this._type}get asymmetricKeyType(){return this._asymmetricKeyType}get symmetricKeySize(){return this._symmetricKeySize}[p](e){switch(this._type){case"secret":return this._buffer;case"public":return this._pem;default:return e?("_pub"in this||(this._pub=i(this)),this._pub[p](!1)):this._pem}}},s=e=>{if(!Buffer.isBuffer(e)||!e.length)throw new TypeError("input must be a non-empty Buffer instance");const t=new a;return t._buffer=Buffer.from(e),t._symmetricKeySize=e.length,t._type="secret",t},i=e=>{if(e instanceof a){if("private"!==e.type)throw new TypeError(`Invalid key object type ${e.type}, expected private.`);switch(e.asymmetricKeyType){case"ec":{const t=u.get("PublicKeyInfo").encode({algorithm:{algorithm:"ecPublicKey",parameters:e._asn1.parameters},publicKey:e._asn1.publicKey});return i({key:t,format:"der",type:"spki"})}case"rsa":{const t=u.get("RSAPublicKey").encode(e._asn1);return i({key:t,format:"der",type:"pkcs1"})}}}if(("string"==typeof e||Buffer.isBuffer(e))&&(e={key:e,format:"pem"}),!n(e))throw new TypeError("input must be a string, Buffer or an object");const{format:r,passphrase:s}=e;let c,{key:p,type:l}=e;if("string"!=typeof p&&!Buffer.isBuffer(p))throw new TypeError("key must be a string or Buffer");if("pem"!==r&&"der"!==r)throw new TypeError('format must be one of "pem" or "der"');if("pem"===r)switch(p=p.toString(),p.split(/\r?\n/g)[0].toString()){case"-----BEGIN PUBLIC KEY-----":l="spki",c="PUBLIC KEY";break;case"-----BEGIN RSA PUBLIC KEY-----":l="pkcs1",c="RSA PUBLIC KEY";break;case"-----BEGIN CERTIFICATE-----":throw new t.JOSENotSupported("X.509 certificates are not supported in your Node.js runtime version");case"-----BEGIN PRIVATE KEY-----":case"-----BEGIN EC PRIVATE KEY-----":case"-----BEGIN RSA PRIVATE KEY-----":return i(o(p));default:throw new TypeError("unknown/unsupported PEM type")}switch(l){case"spki":{const e=u.get("PublicKeyInfo"),t=e.decode(p,r,{label:c});let n,o;switch(t.algorithm.algorithm){case"ecPublicKey":o=new a,o._asn1=t,o._asymmetricKeyType="ec",o._type="public",o._pem=e.encode(t,"pem",{label:"PUBLIC KEY"});break;case"rsaEncryption":n="pkcs1",o=i({type:n,key:t.publicKey.data,format:"der"});break;default:d(t.algorithm.algorithm)}return o}case"pkcs1":{const e=u.get("RSAPublicKey"),t=e.decode(p,r,{label:c});if(t.n===BigInt(0))return i(o({key:p,format:r,type:l,passphrase:s}));const n=new a;return n._asn1=t,n._asymmetricKeyType="rsa",n._type="public",n._pem=e.encode(t,"pem",{label:"RSA PUBLIC KEY"}),n}case"pkcs8":case"sec1":return i(o({format:r,key:p,type:l,passphrase:s}));default:throw new TypeError(`The value ${l} is invalid for option "type"`)}},o=(e,r)=>{if(("string"==typeof e||Buffer.isBuffer(e))&&(e={key:e,format:"pem"}),!n(e))throw new TypeError("input must be a string, Buffer or an object");const{format:i,passphrase:s}=e;let c,{key:p,type:f}=e;if("string"!=typeof p&&!Buffer.isBuffer(p))throw new TypeError("key must be a string or Buffer");if(void 0!==s)throw new t.JOSENotSupported("encrypted private keys are not supported in your Node.js runtime version");if("pem"!==i&&"der"!==i)throw new TypeError('format must be one of "pem" or "der"');if("pem"===i)switch(p=p.toString(),p.split(/\r?\n/g)[0].toString()){case"-----BEGIN PRIVATE KEY-----":f="pkcs8",c="PRIVATE KEY";break;case"-----BEGIN EC PRIVATE KEY-----":f="sec1",c="EC PRIVATE KEY";break;case"-----BEGIN RSA PRIVATE KEY-----":f="pkcs1",c="RSA PRIVATE KEY";break;default:throw new TypeError("unknown/unsupported PEM type")}switch(f){case"pkcs8":{const e=u.get("PrivateKeyInfo").decode(p,i,{label:c});let t,r;switch(e.algorithm.algorithm){case"ecPublicKey":t="sec1",r=o({type:t,key:e.privateKey,format:"der"},{[l]:e.algorithm.parameters.value});break;case"rsaEncryption":t="pkcs1",r=o({type:t,key:e.privateKey,format:"der"});break;default:d(e.algorithm.algorithm)}return r._pkcs8=p,r}case"pkcs1":{const e=u.get("RSAPrivateKey"),t=e.decode(p,i,{label:c}),r=new a;return r._asn1=t,r._asymmetricKeyType="rsa",r._type="private",r._pem=e.encode(t,"pem",{label:"RSA PRIVATE KEY"}),r}case"sec1":{const e=u.get("ECPrivateKey");let t=e.decode(p,i,{label:c});if(!("parameters"in t)&&!r[l])throw new Error("invalid sec1");"parameters"in t||(t={...t,parameters:{type:"namedCurve",value:r[l]}});const n=new a;return n._asn1=t,n._asymmetricKeyType="ec",n._type="private",n._pem=e.encode(t,"pem",{label:"EC PRIVATE KEY"}),n}default:throw new TypeError(`The value ${f} is invalid for option "type"`)}}}e.exports={createPublicKey:i,createPrivateKey:o,createSecretKey:s,KeyObject:a,asInput:c}},2813:e=>{function t(e){Error.call(this,e),Error.captureStackTrace(this,this.constructor),this.name="SigningKeyNotFoundError",this.message=e}t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,e.exports=t},2851:(e,t,r)=>{var n=r(181).Buffer;e.exports=function(e){return"string"==typeof e?e:"number"==typeof e||n.isBuffer(e)?e.toString():JSON.stringify(e)}},2861:(e,t,r)=>{var n=r(181),i=n.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function s(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(o(n,t),t.Buffer=s),s.prototype=Object.create(i.prototype),o(i,s),s.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},s.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}},2912:(e,t,r)=>{const n=r(4263).retrieveSigningKeys;e.exports.A=function(e,{getKeysInterceptor:t}){const r=e.getSigningKey.bind(e);return async e=>{const i=await t();let o;if(i&&i.length&&(o=n(i)),o&&o.length){const t=o.find(t=>!e||t.kid===e);if(t)return t}return r(e)}}},2938:(e,t,r)=>{"use strict";const n=r(3908);e.exports=(e,t)=>new n(e,t).major},3007:(e,t,r)=>{"use strict";const n=r(3908);e.exports=(e,t,r,i,o)=>{"string"==typeof r&&(o=i,i=r,r=void 0);try{return new n(e instanceof n?e.version:e,r).inc(t,i,o).version}catch(e){return null}}},3065:(e,t,r)=>{var n=r(5472),i=r(3085),o=function(e,t,r){this.tokenBucket=new n(e,e,t,null),this.tokenBucket.content=e,this.curIntervalStart=i(),this.tokensThisInterval=0,this.fireImmediately=r};o.prototype={tokenBucket:null,curIntervalStart:0,tokensThisInterval:0,fireImmediately:!1,removeTokens:function(e,t){if(e>this.tokenBucket.bucketSize)return proce